Files
Agentsd/docs/03-实施路线.md
未知时光 3299468df6 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>
2026-06-10 14:27:46 +08:00

2.3 KiB

03 - 实施路线

阶段 1:内核骨架(= 跑起来的 PID 1) 已完成

  • Rust workspace:agentsd 主二进制
  • gRPC server(tonic over TCP,后续切 UDS)
  • 实现 FS syscall(read/write/delete/rename/stat/list)
  • 实现 Memory syscall(SQLite KV + FTS5 trigram search,默认写入 data/memory.db)
  • 实现 Input syscall(stdin)
  • 实现 Display syscall(stdout)
  • 实现 Process syscall(spawn/kill/wait/stdin/stdout + watch channel 无竞态 wait)
  • 实现 Timer syscall(once/cancel/now + 回调事件通道)
  • 实现 Audio syscall(stub,待系统插件)
  • 实现 HID syscall(stub,待系统插件)
  • 实现 Network syscall(HTTP via reqwest)
  • Plugin Bridge(注册/调用路由/心跳,注册状态写入 data/plugins.json)
  • 插件加载:gRPC 握手 + 注册
  • echo 测试插件(Rust)验证基础链路
  • ai_test 手动验证插件(Rust,默认 disabled/autoload false)覆盖 Display/Memory/FS/Process/Timer/权限拒绝
  • proto 定义:完整 9 个 service + PluginBridge
  • 权限安全:无 x-plugin-id 的请求一律拒绝(UNAUTHENTICATED)
  • 死插件路由保护:Bridge.call 校验 PluginStatus::Running

验证结果:agentsd 启动 → Rust 插件通过 gRPC 注册 → ai_test 调用 Display/Memory/FS/Process/Timer syscall 并验证权限拒绝。

阶段 2:完善核心 syscall 部分完成

  • Network:reqwest 原生 HTTP client(阶段 1 已完成)
  • Network TCP 流:open_conn/send/close/listen 双向 TCP 通信
  • FS.Watch:接入 notify-rs v7 文件监听(递归)
  • Timer.Cron:接入 cron 表达式定时(7 段格式)
  • Audio:接入系统音频后端(wasapi/alsa)
  • HID:接入屏幕截取(Windows: win32 API)
  • Unix socket / Named pipe 传输(替代 TCP)

阶段 3:接入 Agent

  • Agent 插件:Input → LLM(Network) → Display
  • Hermes adapter(Python gRPC 插件)
  • 本地模型插件(llama.cpp via Process syscall)

阶段 4:插件管理(= systemctl)

  • agentsd start / stop / restart / status / list / logs
  • 看门狗(崩溃自动重启)
  • 依赖解析 + 拓扑排序
  • install / uninstall / enable / disable

阶段 5:生态

  • Web UI 插件(shell)
  • 语音交互(Audio + TTS/STT 插件)
  • 桌面自动化(HID + computer-use 插件)