Migrate test plugins to Rust and async-ify syscall modules
- Replace Python test plugins (echo, ai_test, claudecode) with Rust implementations driven by the plugin SDK - Convert fs/network/process/timer syscall modules to async/await - Change Network.OpenConn to return stream ConnEvent (conn_id handed to client in first "open" frame for Send/Close routing) - Bind timer callbacks to plugin identity; stream_call subscriptions are identity-checked - Update docs and regenerate Python SDK protobuf stubs Verified: cargo build/test/clippy clean; echo + ai_test full syscall suites pass; hermes & claudecode register and heartbeat; cross-plugin bridge.call routing and auth denial verified end-to-end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,15 +78,18 @@ memory.search(query) -> results
|
||||
**管**:对外连接、监听 | **不管**:本地 IPC(内核 gRPC 总线)
|
||||
|
||||
```
|
||||
net.request(url, method, body?) -> response
|
||||
net.connect(addr, protocol) -> conn
|
||||
net.listen(port, protocol) -> listener
|
||||
net.send(conn, data)
|
||||
net.recv(conn) -> data
|
||||
net.close(conn)
|
||||
net.available() -> bool
|
||||
network.request(url, method, headers?, body?) -> response # HTTP 请求
|
||||
network.open_conn(addr, protocol) -> stream ConnEvent # TCP 建连,流式推送入站数据
|
||||
network.send(conn_id, data) # 向已有连接发数据
|
||||
network.close(conn_id) # 关闭连接
|
||||
network.listen(port, protocol) -> stream ConnEvent # 监听端口,每 accept 推送 ConnEvent
|
||||
network.available() -> bool # 网络连通性探测
|
||||
```
|
||||
|
||||
gRPC 流式语义:OpenConn/Listen 返回 `stream ConnEvent{conn_id, data, kind}`。
|
||||
- 首帧 kind="open"/"accept" 携带 conn_id,后续 kind="data" 携带入站字节,kind="closed" 表示对端关闭。
|
||||
- 发送用单独的 `Send` RPC(需传 conn_id),关闭用 `Close` RPC。
|
||||
|
||||
---
|
||||
|
||||
## 6. Process
|
||||
@@ -115,7 +118,7 @@ proc.list() -> [pid]
|
||||
|
||||
```
|
||||
timer.once(delay, callback) -> id # 到期后通过 PluginBridge.StreamCall 投递事件
|
||||
timer.cron(expr, callback) -> id
|
||||
timer.cron(expr, callback) -> id # cron 表达式格式(7段): sec min hour day month weekday year
|
||||
timer.cancel(id)
|
||||
timer.now() -> timestamp
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user