🎯 目标 (Goal)
引入 RemoteRuntimeAdapter,在不大改 TUI 核心业务层的前提下,把 TUI 的运行请求与流式事件改为经由 Gateway(优先 IPC 管道)转发。
🔍 涉及范围 (Scope)
- 新增 TUI 侧的网关 JSON-RPC 客户端与远程 Runtime 适配器。
- 保留旧接口外观,极小化
internal/tui/core 的改动。
- 注意:本阶段不进行“彻底去除 runtime import”的重构(留给阶段 3),保留本地直连降级能力。
📁 待修改文件 (Proposed Files)
internal/tui/services/remote_runtime_adapter.go (新增)
internal/tui/services/gateway_rpc_client.go (新增)
internal/tui/services/gateway_stream_client.go (新增)
internal/tui/services/runtime_bridge.go
internal/app/bootstrap.go
internal/cli/root.go (增加 --runtime-mode 切换开关)
- 以及对应的
_test.go 测试文件
✅ 实现清单 (To-Do List)
🎉 验收标准 (Acceptance Criteria)
🔗 依赖关系 (Dependencies)
🎯 目标 (Goal)
引入
RemoteRuntimeAdapter,在不大改 TUI 核心业务层的前提下,把 TUI 的运行请求与流式事件改为经由 Gateway(优先 IPC 管道)转发。🔍 涉及范围 (Scope)
internal/tui/core的改动。📁 待修改文件 (Proposed Files)
internal/tui/services/remote_runtime_adapter.go(新增)internal/tui/services/gateway_rpc_client.go(新增)internal/tui/services/gateway_stream_client.go(新增)internal/tui/services/runtime_bridge.gointernal/app/bootstrap.gointernal/cli/root.go(增加--runtime-mode切换开关)_test.go测试文件✅ 实现清单 (To-Do List)
RemoteRuntimeAdapter:发起业务会话前自动执行gateway.authenticate→gateway.bindStream。gateway.event通知,并映射为 TUI 可消费的内部事件形态。~/.neocode/auth.json获取 Token。--runtime-mode=local/gateway开关,默认保持local以便平滑灰度测试。🎉 验收标准 (Acceptance Criteria)
--runtime-mode=gateway模式下,TUI 可正常对话并无损渲染大模型打字机流式输出。request_id审计记录。/metrics可观察到对应方法的请求计数增长。local模式依然可用,go test ./...通过。🔗 依赖关系 (Dependencies)