Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/substrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ byteseek 不再注册任何自有 Rust rwir。所需能力全部是 kvlang 标
| `json·to` / `json·from` | 标准 json rwir |
| `http·call(method,header,url,body) -> resp` | 标准 http rwir |
| `kvlanglayout·vet / ·format / ·layout / ·dump` | 标准 layout rwir |
| `internet/proc·exec(args,envs) -> code, out, err` | 标准 internet rwir(子进程 + 捕获 @ 句柄) |
| `networld/proc·exec(args,envs) -> code, out, err` | 标准 networld rwir(子进程 + 捕获 @ 句柄) |
| `vthread·call(funckey)` | native builtin(同 vid 动态调用) |
| `string·* / kv·* / xv·*` | native builtin |

`shell·run` / `python·run` 是 `lib/` 下的 kv rwfunc:把命令包成 `{"bash","-c",cmd}` /
`{"python3","-c",code}` 交给 `internet/proc·exec`,绑定 stdout/stderr 写槽即捕获(`@[]uint8`
扩展句柄,`println` 读时按 body 前缀 `/internet/{host}/proc` 路由回兑现物理字节),返回 stdout。
`{"python3","-c",code}` 交给 `networld/proc·exec`,绑定 stdout/stderr 写槽即捕获(`@[]uint8`
扩展句柄,`println` 读时按 body 前缀 `/networld/{host}/proc` 路由回兑现物理字节),返回 stdout。

## 已验证(0rs)

- `KVLANG_LIB=lib kvlang` 引导:config/语法速览/系统提示三 init 于 layout 期种入,rwfunc 持久。
- `kvlang byteseek·main`:REPL 循环、`exit` 退出、无 key 时 `llm·call` 回填 error 且 `byteseek·run` 跳过。
- `byteseek·run(entry)` → `vthread·call`:同 vid 动态执行入库的 session 程序,其内 rwir 就地派发。
- `shell·run` / `python·run`:经 `internet/proc·exec` 捕获子进程 stdout 并透明兑现。
- `shell·run` / `python·run`:经 `networld/proc·exec` 捕获子进程 stdout 并透明兑现。
- `make test`(无网络无 LLM,shm 后端):vet + session 执行 + shell/python 捕获全链路通过。
2 changes: 1 addition & 1 deletion lib/byteseek/python.kv
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lib python {
println("🔧 python:", code)
noenv = map()
a = {"python3", "-c", code}
internet/proc·exec(a, noenv) -> ret, o, e
networld/proc·exec(a, noenv) -> ret, o, e
println("↳", o, e)
o -> out
}
Expand Down
4 changes: 2 additions & 2 deletions lib/byteseek/shell.kv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# shell·run(cmd) -> out:跑一段 bash,返回 stdout(@ 句柄,读时兑现)。
# 绑定 out/err 写槽 → internet/proc·exec 管道捕获两流;就地打印工具头与两流后返回 stdout。
# 绑定 out/err 写槽 → networld/proc·exec 管道捕获两流;就地打印工具头与两流后返回 stdout。

lib shell {
rwfunc run(cmd:[]char/utf32) -> (out:[]char/utf32) {
println("🔧 shell:", cmd)
noenv = map()
a = {"bash", "-c", cmd}
internet/proc·exec(a, noenv) -> code, o, e
networld/proc·exec(a, noenv) -> code, o, e
println("↳", o, e)
o -> out
}
Expand Down
2 changes: 1 addition & 1 deletion tests/selftest.kv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# byteseek 自检(无网络、无 LLM):验证全 kvlang 主脑的执行链——
# byteseek·run(entry) → vthread·call 在当前 vthread 动态执行生成程序;
# shell·run / python·run 经 internet/proc·exec 捕获子进程 stdout。
# shell·run / python·run 经 networld/proc·exec 捕获子进程 stdout。
# 先 boot byteseek 库(KVLANG_LIB=lib kvlang),再 layout 本文件,最后 run selftest·go。
# 期望输出:
# vet(good)= ok
Expand Down
Loading