核心原理

Console 注册、Execution Context 与 Shell 流程

说明 console registry 何时写入、execution context 能力面怎样连接 runtime 能力,以及 shell 的环境注入

Console 注册、Execution Context 与 Shell 流程

1. Console 注册

  • registry 文件:~/.downcity/console/agents.json
  • 保存已知 agent 与最近一次 daemon 元数据
  • daemon 启动后必须成功写 registry,否则回滚

2. Execution Context 流程

  • 一个 agent 进程绑定一个 rootPath
  • agent 组装一个 execution context 能力面
  • 这个能力面暴露 sessioninvokeplugins
  • plugin 向固定扩展点注册 pipelineguardeffectresolve
  • plugin action 和托管 runtime 会在自己的主路径里触发这些扩展点

3. Shell 流程

  • shell 状态现在由 shell runtime 持有,而不是 tool 本地临时维护进程表
  • shell_start 会返回 shell_id,它和 chat contextId 不是同一个东西
  • 长任务期间应优先使用 shell_statusshell_wait,而不是高频空轮询
  • 默认工作目录是当前项目根目录
  • 子进程会注入 DC_CTX_* 环境变量
  • shell 结束后,如果该会话属于真实 chat context,shell runtime 可以回投一条内部消息,再进入主回复链

关系图