dsh-plugin-dev-kb 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.en.md +6 -6
  3. package/README.md +6 -6
  4. package/kb/INDEX.md +21 -5
  5. package/kb/README.md +11 -10
  6. package/kb/extra/AGENTS.md +4 -4
  7. package/kb/extra/cookbook/adding-a-remote-api.md +197 -0
  8. package/kb/extra/cookbook/adding-a-remote-api.zh.md +197 -0
  9. package/kb/extra/cookbook/adding-a-vendored-package.md +2 -2
  10. package/kb/extra/cookbook/adding-a-vendored-package.zh.md +2 -2
  11. package/kb/extra/deepseek-llm-api-wire-extensions.md +163 -0
  12. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +163 -0
  13. package/kb/extra/development.md +8 -14
  14. package/kb/extra/development.zh.md +8 -14
  15. package/kb/extra/event-producer-consumer.md +55 -48
  16. package/kb/extra/event-producer-consumer.zh.md +58 -51
  17. package/kb/extra/glossary.md +1 -1
  18. package/kb/extra/glossary.zh.md +1 -1
  19. package/kb/extra/graph-atlas.md +0 -2
  20. package/kb/extra/graph-atlas.zh.md +0 -2
  21. package/kb/extra/i18n/README.md +4 -4
  22. package/kb/extra/i18n/README.zh.md +4 -4
  23. package/kb/extra/i18n/style-samples.md +2 -2
  24. package/kb/extra/module-graph.md +646 -926
  25. package/kb/extra/module-graph.zh.md +648 -928
  26. package/kb/extra/postmortem/0001-acp-default-export-drops-inject.md +2 -2
  27. package/kb/extra/postmortem/0001-acp-default-export-drops-inject.zh.md +2 -2
  28. package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.md +2 -2
  29. package/kb/extra/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +2 -2
  30. package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.md +2 -2
  31. package/kb/extra/postmortem/0003-web-agent-gui-feedback-loop.zh.md +2 -2
  32. package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +1 -1
  33. package/kb/extra/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +1 -1
  34. package/kb/extra/rescope.md +2 -2
  35. package/kb/extra/rescope.zh.md +2 -2
  36. package/kb/extra/subsystems/agent-team.md +28 -4
  37. package/kb/extra/subsystems/agent-team.zh.md +28 -4
  38. package/kb/extra/subsystems/attachment.md +168 -7
  39. package/kb/extra/subsystems/attachment.zh.md +168 -7
  40. package/kb/extra/subsystems/extensions.md +18 -0
  41. package/kb/extra/subsystems/extensions.zh.md +18 -0
  42. package/kb/extra/subsystems/feedback.md +4 -4
  43. package/kb/extra/subsystems/feedback.zh.md +4 -4
  44. package/kb/extra/subsystems/todo.md +32 -0
  45. package/kb/extra/subsystems/todo.zh.md +32 -0
  46. package/kb/extra/subsystems/webhook.md +70 -0
  47. package/kb/extra/subsystems/webhook.zh.md +70 -0
  48. package/kb/extra/testing.md +15 -10
  49. package/kb/extra/testing.zh.md +13 -8
  50. package/kb/extra/web-styling.md +4 -0
  51. package/kb/extra/web-styling.zh.md +4 -0
  52. package/kb/meta/search-index.json +309 -177
  53. package/kb/meta/site-pages.txt +183 -167
  54. package/kb/meta/source.json +5 -5
  55. package/kb/meta/topics.md +14 -6
  56. package/kb/site/develop/basic/publish.md +2 -2
  57. package/kb/site/develop/basic/tool.md +1 -1
  58. package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  59. package/kb/site/develop/framework/events.md +1 -1
  60. package/kb/site/develop/practice/dynamic-cordis.md +17 -0
  61. package/kb/site/develop/practice/llm-adapter.md +4 -3
  62. package/kb/site/en/develop/basic/publish.md +2 -2
  63. package/kb/site/en/develop/basic/tool.md +1 -1
  64. package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  65. package/kb/site/en/develop/framework/events.md +1 -1
  66. package/kb/site/en/develop/practice/dynamic-cordis.md +17 -0
  67. package/kb/site/en/develop/practice/llm-adapter.md +4 -3
  68. package/kb/site/en/guide/github-review.md +104 -0
  69. package/kb/site/en/guide/mcp-memory.md +103 -0
  70. package/kb/site/en/guide/network-proxy.md +87 -0
  71. package/kb/site/en/guide/providers.md +70 -17
  72. package/kb/site/en/guide/python-sdk.md +80 -34
  73. package/kb/site/en/guide/schedule.md +23 -0
  74. package/kb/site/en/reference/agent-lifecycle.md +6 -4
  75. package/kb/{extra → site/en/reference}/api-gateway.md +12 -10
  76. package/kb/site/en/reference/capability-seams.md +128 -73
  77. package/kb/site/en/reference/config-catalog.md +481 -360
  78. package/kb/site/en/reference/cookbook/adding-a-package.md +3 -4
  79. package/kb/site/en/reference/cookbook/adding-a-settings-card.md +12 -10
  80. package/kb/site/en/reference/cookbook/adding-a-tool.md +11 -4
  81. package/kb/site/en/reference/cookbook/adding-an-llm-adapter.md +1 -1
  82. package/kb/site/en/reference/cookbook/extension-cookbook.md +20 -17
  83. package/kb/site/en/reference/cordis-api/inherited.md +1 -1
  84. package/kb/site/en/reference/cordis-primer.md +2 -1
  85. package/kb/site/en/reference/index.md +30 -11
  86. package/kb/site/en/reference/persistence-catalog.md +148 -80
  87. package/kb/site/en/reference/subsystems/approval.md +10 -10
  88. package/kb/site/en/reference/subsystems/client-modules.md +58 -16
  89. package/kb/site/en/reference/subsystems/code-runtime.md +10 -6
  90. package/kb/site/en/reference/subsystems/commands.md +25 -16
  91. package/kb/site/en/reference/subsystems/compaction.md +11 -11
  92. package/kb/site/en/reference/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +50 -24
  93. package/kb/site/en/reference/subsystems/core.md +156 -17
  94. package/kb/site/en/reference/subsystems/credentials.md +44 -3
  95. package/kb/site/en/reference/subsystems/filesystem.md +12 -2
  96. package/kb/site/en/reference/subsystems/goal.md +1 -1
  97. package/kb/site/en/reference/subsystems/index.md +7 -2
  98. package/kb/site/en/reference/subsystems/jobs.md +1 -1
  99. package/kb/site/en/reference/subsystems/llm-streaming.md +154 -12
  100. package/kb/site/en/reference/subsystems/permission-presets.md +6 -6
  101. package/kb/site/en/reference/subsystems/persistence.md +185 -175
  102. package/kb/site/en/reference/subsystems/plan.md +2 -2
  103. package/kb/site/en/reference/subsystems/sandbox.md +2 -0
  104. package/kb/site/en/reference/subsystems/schedule.md +9 -3
  105. package/kb/site/en/reference/subsystems/session-projection.md +115 -48
  106. package/kb/site/en/reference/subsystems/session-query.md +28 -14
  107. package/kb/site/en/reference/subsystems/session-reference.md +53 -8
  108. package/kb/site/en/reference/subsystems/session-telemetry.md +8 -8
  109. package/kb/site/en/reference/subsystems/session-title.md +6 -6
  110. package/kb/site/en/reference/subsystems/session.md +401 -99
  111. package/kb/site/en/reference/subsystems/settings.md +101 -6
  112. package/kb/site/en/reference/subsystems/skills.md +23 -0
  113. package/kb/site/en/reference/subsystems/slots.md +178 -0
  114. package/kb/site/en/reference/subsystems/spill.md +2 -2
  115. package/kb/site/en/reference/subsystems/storage.md +34 -3
  116. package/kb/site/en/reference/subsystems/subagent.md +122 -109
  117. package/kb/site/en/reference/subsystems/system-prompt.md +17 -4
  118. package/kb/site/en/reference/subsystems/token-meter.md +27 -12
  119. package/kb/site/en/reference/subsystems/tools.md +39 -39
  120. package/kb/site/en/reference/subsystems/typert.md +62 -55
  121. package/kb/site/en/reference/subsystems/user-questions.md +33 -33
  122. package/kb/site/en/reference/subsystems/web-client.md +98 -0
  123. package/kb/site/en/reference/subsystems/web-server.md +11 -5
  124. package/kb/site/en/reference/subsystems/web.md +7 -1
  125. package/kb/site/en/reference/subsystems/workspace.md +102 -9
  126. package/kb/site/en/reference/tool-catalog.md +86 -82
  127. package/kb/site/en/reference/tool-execution-pipeline.md +1 -1
  128. package/kb/site/guide/github-review.md +104 -0
  129. package/kb/site/guide/mcp-memory.md +103 -0
  130. package/kb/site/guide/network-proxy.md +87 -0
  131. package/kb/site/guide/providers.md +70 -17
  132. package/kb/site/guide/python-sdk.md +87 -41
  133. package/kb/site/guide/schedule.md +23 -0
  134. package/kb/site/reference/agent-lifecycle.md +6 -4
  135. package/kb/{extra/api-gateway.zh.md → site/reference/api-gateway.md} +12 -10
  136. package/kb/site/reference/capability-seams.md +128 -73
  137. package/kb/site/reference/config-catalog.md +481 -360
  138. package/kb/site/reference/cookbook/adding-a-package.md +3 -4
  139. package/kb/site/reference/cookbook/adding-a-settings-card.md +12 -10
  140. package/kb/site/reference/cookbook/adding-a-tool.md +11 -4
  141. package/kb/site/reference/cookbook/adding-an-llm-adapter.md +1 -1
  142. package/kb/site/reference/cookbook/extension-cookbook.md +20 -17
  143. package/kb/site/reference/cordis-api/inherited.md +1 -1
  144. package/kb/site/reference/cordis-primer.md +2 -1
  145. package/kb/site/reference/index.md +30 -11
  146. package/kb/site/reference/persistence-catalog.md +148 -80
  147. package/kb/site/reference/subsystems/approval.md +10 -10
  148. package/kb/site/reference/subsystems/client-modules.md +58 -16
  149. package/kb/site/reference/subsystems/code-runtime.md +10 -6
  150. package/kb/site/reference/subsystems/commands.md +25 -16
  151. package/kb/site/reference/subsystems/compaction.md +11 -11
  152. package/kb/site/reference/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +50 -24
  153. package/kb/site/reference/subsystems/core.md +156 -17
  154. package/kb/site/reference/subsystems/credentials.md +44 -3
  155. package/kb/site/reference/subsystems/filesystem.md +12 -2
  156. package/kb/site/reference/subsystems/goal.md +1 -1
  157. package/kb/site/reference/subsystems/index.md +7 -2
  158. package/kb/site/reference/subsystems/jobs.md +1 -1
  159. package/kb/site/reference/subsystems/llm-streaming.md +154 -12
  160. package/kb/site/reference/subsystems/permission-presets.md +5 -5
  161. package/kb/site/reference/subsystems/persistence.md +184 -174
  162. package/kb/site/reference/subsystems/plan.md +2 -2
  163. package/kb/site/reference/subsystems/schedule.md +9 -3
  164. package/kb/site/reference/subsystems/session-projection.md +115 -48
  165. package/kb/site/reference/subsystems/session-query.md +28 -14
  166. package/kb/site/reference/subsystems/session-reference.md +53 -8
  167. package/kb/site/reference/subsystems/session-telemetry.md +8 -8
  168. package/kb/site/reference/subsystems/session-title.md +6 -6
  169. package/kb/site/reference/subsystems/session.md +401 -99
  170. package/kb/site/reference/subsystems/settings.md +101 -6
  171. package/kb/site/reference/subsystems/skills.md +23 -0
  172. package/kb/site/reference/subsystems/slots.md +178 -0
  173. package/kb/site/reference/subsystems/spill.md +2 -2
  174. package/kb/site/reference/subsystems/storage.md +34 -3
  175. package/kb/site/reference/subsystems/subagent.md +122 -109
  176. package/kb/site/reference/subsystems/system-prompt.md +17 -4
  177. package/kb/site/reference/subsystems/token-meter.md +27 -12
  178. package/kb/site/reference/subsystems/tools.md +39 -39
  179. package/kb/site/reference/subsystems/typert.md +62 -55
  180. package/kb/site/reference/subsystems/user-questions.md +33 -33
  181. package/kb/site/reference/subsystems/web-client.md +98 -0
  182. package/kb/site/reference/subsystems/web-server.md +11 -5
  183. package/kb/site/reference/subsystems/web.md +7 -1
  184. package/kb/site/reference/subsystems/workspace.md +102 -9
  185. package/kb/site/reference/tool-catalog.md +85 -81
  186. package/kb/site/reference/tool-execution-pipeline.md +1 -1
  187. package/package.json +2 -2
  188. package/skills/dsh-plugin-dev-kb.md +8 -6
@@ -7,7 +7,7 @@ outline: [2,3]
7
7
 
8
8
  subagent seam 让一个 agent(智能体)将工作委派给子 agent。与 [bash](./shell.md) 一样,它是**一项可选能力**,不属于 agent loop(智能体循环),因此其类型定义在此而非 [core.md](./core.md) 中。它不同于其他能力 seam,因为**同一上下文中可共存多个提供方实现**,并按名称注册(`ctx.subagents`),而 bash 只允许一个执行器。该注册表遵循 [LLM(大语言模型)适配器注册表](./llm-streaming.md),而非单服务的 bash 执行器。
9
9
 
10
- Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/subagent)(`ctx.subagents` + 下文词汇)。Service Provider 是六个兄弟包:`dsh-subagent-spawn-in-process`、`-fork`、`-acp`、`-codex`、`-claude-code`、`-dsh-sdk`;面向模型的 Consumer 包括 [dsh-tool-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent)(按提供方委派)、[dsh-tool-subagent-control](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-control)(可选的全局 `send_message`、`interrupt_agent` 与 `list_agents` 控制工具)和 [dsh-tool-subagent-report](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-report)(可选的 child 作用域 `report` 返回通道)。同一个 `ctx.subagents` 服务通过内部激活管理器负责可继续子 agent 编排,并直接基于会话存储和可选的会话持久化提供只读的 child 与后代发现。产品提供方设计理由见 [Codex 与 Claude Code Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.zh.md);通用 seam 的设计理由见 [subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-06-21-subagent-capability-seam.zh.md)、[可继续 subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-28-continuable-subagent-conversations.zh.md)、[report 工具 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-30-continuable-subagent-report-tool.zh.md)、[持久化目录 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-22-durable-subagent-catalog-and-list-agents.zh.md)、[列表身份投影 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-06-subagent-list-identity-projection.zh.md)和[服务合并 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/simplification/2026-07-26-merge-subagent-control-service.zh.md)。
10
+ Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/subagent)(`ctx.subagents` + 下文词汇)。Service Provider 是六个兄弟包:`dsh-subagent-spawn-in-process`、`dsh-subagent-fork-in-process`、`dsh-subagent-acp`、`dsh-subagent-codex`、`dsh-subagent-claude-code`、`dsh-subagent-dsh-sdk`;面向模型的 Consumer 包括 [dsh-tool-subagent](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent)(按提供方委派)和 [dsh-tool-subagent-control](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-control)(可选的全局 `send_message`、`interrupt_agent` 与 `list_agents` 控制工具)。同一个 `ctx.subagents` 服务通过内部激活管理器负责可继续子 agent 编排,并直接基于会话存储和可选的会话持久化提供只读的 child 与后代发现。产品提供方设计理由见 [Codex 与 Claude Code Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-08-04-claude-code-and-codex-subagent-backends.zh.md);通用 seam 的设计理由见 [subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-06-21-subagent-capability-seam.zh.md)、[可继续 subagent Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-28-continuable-subagent-conversations.zh.md)、[相邻 Agent 消息 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-27-adjacent-agent-steer-messaging.zh.md)、[持久化目录 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-22-durable-subagent-catalog-and-list-agents.zh.md)、[列表身份投影 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-06-subagent-list-identity-projection.zh.md)和[服务合并 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/simplification/2026-07-26-merge-subagent-control-service.zh.md)。
11
11
 
12
12
  源码:[`packages/subagent/subagent/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/types.ts)、[`packages/subagent/subagent/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts)和 [`packages/subagent/subagent/src/continuation.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/continuation.ts)
13
13
 
@@ -28,6 +28,7 @@ Service Definition:[dsh-subagent](https://github.com/deepseek-ai/deepseek-harn
28
28
  * to `maxDepth`; the other names match.
29
29
  */
30
30
  interface SubagentCapabilities {
31
+ readonly agentOptions: boolean
31
32
  readonly outputSchema: boolean
32
33
  readonly depthLimit: boolean
33
34
  readonly toolFilter: boolean
@@ -37,7 +38,7 @@ interface SubagentCapabilities {
37
38
 
38
39
  ## 单次启动请求
39
40
 
40
- 工具层根据模型输入和自身配置构建此请求;服务在 `start` 之前针对指定提供方进行校验。必填的 `parent` 提供会话 cwd、谱系与委派深度。可选的 output schema、depth、工具过滤器和 persona 需要对应的能力 flag 匹配。不支持的 schema 在启动时即失败;进程内后端将 filter 和 persona 的作用域限定在子 agent 创建阶段,并通过强制 capture 工具实现所支持的 object-rooted schema。
41
+ 工具层根据模型输入和自身配置构建此请求;服务在 `start` 之前针对指定提供方进行校验。必填的 `parent` 提供会话 cwd、谱系与委派深度。可选的 Agent 提供方、模型、推理强度与 token 覆盖、output schema、depth、工具过滤器和 persona 需要对应的能力 flag 匹配。进程内后端会把 `agentOptions` 合并到父 Agent 选项之上,将 filter 和 persona 的作用域限定在子 agent 创建阶段,并通过强制 capture 工具实现所支持的 object-rooted schema。DSH SDK 后端会把四个 Agent 路由字段合并到实例默认值之上,并在子运行时初始化期间校验;ACP、Codex 与 Claude Code 会在启动传输前拒绝 `agentOptions`。
41
42
 
42
43
  ```ts type-equiv
43
44
  /**
@@ -66,6 +67,13 @@ interface SubagentStartRequest {
66
67
  * remaining turn work when it fires afterward.
67
68
  */
68
69
  readonly signal: AbortSignal
70
+ /**
71
+ * Optional host-Agent provider, model, reasoning-effort, and output-token
72
+ * overrides. Requires {@link SubagentCapabilities.agentOptions}; in-process
73
+ * providers merge them over the parent Agent's options when they create the
74
+ * child, while the DSH SDK provider merges them over its instance defaults
75
+ * before initializing the separate child runtime.
76
+ */
69
77
  readonly agentOptions?: AgentOptions
70
78
  /**
71
79
  * Object-rooted JSON Schema within `assertObjectJsonSchema`'s enforced subset. Start rejects
@@ -128,21 +136,21 @@ persisted Session
128
136
 
129
137
  `SubagentRuntime.startContinuable()` 会预留稳定的子 agent id,对版本化的 `subagent/descriptor` payload 建立快照,向指定提供方索取其分离的 `ContinuableCreateSpec`,通过私有的 activation-owner 作用域创建子 Agent,建立任何可继续父级的所有权,并提交初始提示词。当收件箱(inbox)准入产出消息 id 时,它以 `{ childId, messageId }` resolve——无需等待轮次开始,也无需等待消息进入会话日志。在该准入之前的任何失败都会以两个 id 都不返回的方式 reject,并 dispose(资源释放)任何已创建的 handle,回滚 Activation 与父级所有权。
130
138
 
131
- `SubagentRuntime.followup()` 是唯一的继续执行消息操作,其路由仅取决于 Activation 的驻留状态:
139
+ `SubagentRuntime.sendMessage()` 是唯一由模型编写消息的操作。它接收确切在线 sender 与目标 id,只允许直接 parent 或直接可继续 child,自行推导 sender 来源信息,并根据目标 child 的 Activation 驻留状态路由:
132
140
 
133
- | Activation 状态 | `followup` |
141
+ | 目标 Activation 状态 | `sendMessage` |
134
142
  |---|---|
135
- | `running` | 在同一 Activation 中入队 |
136
- | `waiting` | 唤醒同一 Activation |
137
- | 无 Activation | 冷恢复一个新的 Activation |
143
+ | `running` | 在同一 Activation steer 最近的 step |
144
+ | `waiting` | 唤醒并 steer 同一 Activation |
145
+ | 无 Activation | 冷恢复新的 Activation,然后 steer |
138
146
 
139
147
  `running` 表示 Agent 拥有活跃的准入或轮次,或正在唤醒收件箱工作;`waiting` 表示它已完全停稳,但仍拥有至少一个尚未完成 dispose 的子 Activation;`settled` 表示已完全停稳且其拥有的每个子级都已 dispose,此时管理器会 dispose [`AgentHandle`](./core.md#creation-and-ownership) 并移除该 Activation。管理器根据 Agent 的完全停稳状态与其拥有的子级集合推导这些内部条件,而非维护第二套执行状态机。
140
148
 
141
- Agent 收件箱是唯一的队列。每条继续执行消息都会成为一个 `Agent.followup()` FIFO 轮次,因此已接受的消息共享同一个可观测顺序,且后续消息无法改变已在进行中的轮次。投递成功会返回被接受的 `MessageId`;既有的 `agent/inbox/inserted`、`agent/inbox/claimed` 与 `agent/inbox/discarded` 事件仍是消息生命周期的观测点,继续执行层不定义任何 subagent 专属的投递路由。
149
+ Agent 收件箱是唯一队列。每条 Agent 消息都使用 `Agent.steer()`:空闲目标会启动一个轮次,运行中目标则在最近的 step 边界领取消息。投递成功会返回被接受的 `MessageId`;既有的 `agent/inbox/inserted`、`agent/inbox/claimed` 与 `agent/inbox/discarded` 事件仍是消息生命周期的观测点,继续执行层不定义任何 subagent 专属的投递路由。
142
150
 
143
- 后续操作的权限来自确切的在线 Agent 工具上下文。已认证的 Agent 必须是持久化子 agent 在 `SessionHeader.parentSession` 中记录的直接父级。`MessageSource` `senderSessionId` 记录谁提供了已准入的消息,但不授予任何权限;可选的面向模型工具使用 `CoordinatorMessageSource`。
151
+ 权限来自确切在线 sender。parent child 的投递要求目标的 `SessionHeader.parentSession` 指向 sender;child 到 parent 的投递要求 sender 的驻留 Activation 指向目标。sibling、相隔多于一条边的 ancestor、self-target、陈旧 Agent 对象与一次性 child 都会被拒绝。每条已接受消息都以 `Agent <sender-id> sent a message:` 作为前缀,并记录 `AgentMessageSource`;来源信息记录 sender,但不授予权限。
144
152
 
145
- 对于这两种操作,调用方 signal 仅在收件箱接受之前掌管查找、物化与准入。此后管理器独立掌管该 Activation:之后的调用方取消既不会取消已接受的轮次,也不会 dispose 子 agent,并且该 seam 不对外暴露任何 steering(中途引导)操作。
153
+ 对于 `startContinuable()` 与 `sendMessage()`,调用方 signal 仅在收件箱接受之前掌管查找、物化与准入。此后管理器独立掌管该 Activation:之后的调用方取消既不会取消已接受的轮次,也不会 dispose 子 agent。浏览器中的人类提示仍由私有 Queue 适配器处理,因此继续产生独立 FIFO 轮次。
146
154
 
147
155
  `SubagentRuntime.interrupt(targetSessionId, authority)` 是唯一的公开停止操作:它同步完成鉴权,对在线目标发出 `Agent.cancel(cause, { keepInbox: true })`,然后不等待完全停稳即返回。Activation、其尚未领取的待处理 inbox 工作与已发布的后代均不受影响;已被领取进入中断轮次的工作不会重新入队。被中断的 driver 进入 idle 后,一次唤醒发送会恢复被暂停的 FIFO 队列。不存在的目标——未知、一次性或已结算——以及未绑定管理器的组合是被接受的 no-op。对在线目标,错误的 parent 地址或不在其在线祖先链中的调用方会以 `UNAUTHORIZED` 拒绝;陈旧的 ancestor 对象和指向自身的 ancestor 请求会在查找目标前拒绝。
148
156
 
@@ -162,21 +170,19 @@ type SubagentInterruptAuthority =
162
170
  最终结算会等待 `ctx.sessions.flush(session)`,但会忽略其参与布尔值,因为任意 listener 都无法证明某个持久化后端已存储该状态。rejection 会被记录,但不会使 Activation 失败;管理器仍会 dispose 该 handle 并释放所有权,此后持久化的子 agent 状态在后续恢复时可能缺失或陈旧。管理器卸载会调用内部的管理器全局 drain,关闭准入并 dispose 每片在线森林;`drainContinuableDescendants(parents)` 只关闭由 host 确切拥有的在线 Agent 之下的准入,并 dispose 其可继续后代,而无关森林保持在线。两者都会等待各自作用域内已获准的物化过程,自顶向下传播取消,按 child-first 顺序释放 handle,并且即使个别分支失败也会等待所有选中分支。持久化子会话不受该进程内拆卸的影响。
163
171
 
164
172
  ```ts type-equiv
165
- /** Attribution for a model coordinator's follow-up to one of its children. */
166
- interface CoordinatorMessageSource {
167
- readonly kind: 'coordinator'
173
+ /** Durable attribution for one model-authored message between adjacent Agents. */
174
+ interface AgentMessageSource {
175
+ readonly kind: 'agent-message'
168
176
  /** A message another agent addressed to this one (`relay` context form). */
169
177
  readonly form: 'relay'
170
- /** Session id of the agent whose tool call produced the follow-up. */
178
+ /** Session id of the Agent whose tool call produced the message. */
171
179
  readonly senderSessionId: SessionId
172
180
  }
173
181
  ```
174
182
 
175
183
  ```ts type-equiv
176
- /** Options for following up with one continuable child. */
177
- interface SubagentFollowupOptions {
178
- /** Durable attribution retained on the delivered message; it grants no authority. */
179
- readonly source: MessageSource
184
+ /** Options for one model-authored message between adjacent Agents. */
185
+ interface SubagentSendMessageOptions {
180
186
  /** Caller cancellation, owning the operation only until inbox acceptance. */
181
187
  readonly signal: AbortSignal
182
188
  }
@@ -192,33 +198,13 @@ interface ContinuableStart {
192
198
  }
193
199
  ```
194
200
 
195
- 可选的可继续 child 设置贡献可以在 child 基础组合完成后、Activation 发布前安装限定在作用域内的能力。该注册表按顺序执行且具有事务性:设置失败或被撤销时会回滚未发布的 Activation;child 作用域 dispose 时会释放所有安装;新注册项在下一个 Activation 生效;移除注册项时则会立即撤销每个驻留中的安装。
196
-
197
- `SubagentRuntime.reportFrom()` 通过该扩展点实现报告,无需新增第二条队列或承载结果的 child 包装层。调用由确切的在线 child Agent 授权,调用方不能指定接收方。管理器从 child 的持久化 `parentSession` 中推导唯一接收方,要求该 parent Agent 必须在线,将选中内容封装为一条 `subagent-report` 用户消息,并返回该消息的稳定 `MessageId`。静默投递使用 `Agent.inject()`,不会唤醒 parent;next-step 投递使用 `Agent.steer()`,会唤醒空闲 parent,或加入运行中 parent 最近的 step 边界。两种模式都不会结束 child 轮次,最终回答也不会隐式报告。
198
-
199
- ```ts type-equiv
200
- /** Durable attribution for a continuable child's explicit parent report. */
201
- interface SubagentReportMessageSource {
202
- readonly kind: 'subagent-report'
203
- /** A message another agent addressed to this one (`relay` context form). */
204
- readonly form: 'relay'
205
- /** Session id of the reporting child. */
206
- readonly senderSessionId: SessionId
207
- }
208
- ```
209
-
210
- ```ts type-equiv
211
- /** Deployment scheduling policy for accepted child reports. */
212
- type SubagentReportDelivery = 'quiet' | 'next-step'
213
- ```
214
-
215
- 上报是 child 自己的选择,因此管理器还保有一份属于自己的记账:当驻留 Activation 结算时,它会向该 child 持久化的直接 parent 投递一条通知,说明该 epoch 如何结束,并携带其最终 assistant 内容。对每个调用方拿到过 id 的 child,这条投递都是无条件的;它发生在会让 parent 被判定为已结算的所有权释放之前,并通过与上报相同的唤醒准入记账到达驻留 parent。若 parent 自身所在的谱系已在拆卸中,这条通知会以不唤醒的方式送达,因为唤醒一个静息 Agent 是开启一个轮次,而不是排队等待工作。其来源信息使用一个独立的 kind,因此 transcript(文本记录)绝不会把运行时的记账呈现为 child 自己写下的内容。
201
+ 当驻留 Activation 结算时,管理器会向该 child 持久化的直接 parent 投递一条通知,说明该 epoch 如何结束,并携带其最终 assistant 内容。对每个调用方拿到过 id 的 child,这条投递都是无条件的;它发生在会让 parent 被判定为已结算的所有权释放之前,并通过与 Agent 消息相同的唤醒准入记账到达驻留 parent。若 parent 自身所在的谱系已在拆卸中,这条通知会以不唤醒的方式送达,因为唤醒一个静息 Agent 是开启一个轮次,而不是排队等待工作。其来源信息使用一个独立的 kind,因此 transcript(文本记录)绝不会把运行时的记账呈现为 child 自己写下的内容。
216
202
 
217
203
  ```ts type-equiv
218
204
  /**
219
205
  * Durable attribution for the runtime's own account of a continuable child
220
206
  * settling. Deliberately a different kind from
221
- * {@link SubagentReportMessageSource}: a report is content the child chose,
207
+ * {@link AgentMessageSource}: an Agent message is content the sender chose,
222
208
  * while this message is the manager stating what became of the child, and a
223
209
  * transcript that merged them would credit the child with words it never wrote.
224
210
  */
@@ -233,17 +219,7 @@ interface SubagentSettledMessageSource {
233
219
  }
234
220
  ```
235
221
 
236
- ```ts type-equiv
237
- /** Options for one continuable child's report to its direct parent. */
238
- interface SubagentReportOptions {
239
- /** Already-resolved parent scheduling policy. */
240
- readonly delivery: SubagentReportDelivery
241
- /** Caller cancellation, owning authorization and admission until acceptance. */
242
- readonly signal: AbortSignal
243
- }
244
- ```
245
-
246
- 提供方只参与准备初始创建 spec,`spawn` 与 `fork` 在此有所不同。其返回的 spec 只携带分离的、提供方专属的创建输入——目前是可选的父级历史种子——不含 Agent、`AgentHandle`、提示词投递、结果、dispose 或恢复操作。冷恢复根本不经由提供方分发:管理器折叠通用描述符,通过同一个 activation-owner 作用域调用 `ctx.agents.resume()`,并提交等待中的轮次。
222
+ 提供方只参与准备初始创建 spec,`spawn` 与 `fork` 在此有所不同。其返回的 spec 只携带分离的、提供方专属的创建输入——即可选的父级历史种子——不含 Agent、`AgentHandle`、提示词投递、结果、dispose 或恢复操作。冷恢复根本不经由提供方分发:管理器折叠通用描述符,通过同一个 activation-owner 作用域调用 `ctx.agents.resume()`,并提交等待中的轮次。
247
223
 
248
224
  ```ts type-equiv
249
225
  /**
@@ -283,13 +259,13 @@ interface ContinuableCreateSpec {
283
259
  }
284
260
  ```
285
261
 
286
- 描述符([descriptor.ts](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/descriptor.ts) 中的 `SubagentDescriptorData`)是每个由会话支撑的 subagent 所使用、按模式判别的持久化身份。两种模式都携带提供方名称。`one-shot` 描述符可以携带调用方拥有的可选显示 `label`;`continuable` 描述符要求以委派 `description` 作为持久化创建标签,并另外对已解析的子 agent `agentOptions.provider`/`model` 与可选的 `persona`/`toolFilter` 建立快照,用于冷恢复。它绝不会对可合并扩展的 `AgentOptions` 对象建立快照,因此无关的扩展值不会破坏继续执行,后续新增组合配置输入则是一次有意的版本更改。描述符省略 `subagentDepth`(冷恢复以持久化 header 中的 `delegationDepth` 作为单调下界)和 `outputSchema`(单次运行或 Activation 的结果约定,而非持久化身份)。
262
+ 描述符([descriptor.ts](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/subagent/src/descriptor.ts) 中的 `SubagentDescriptorData`)是每个由会话支撑的 subagent 所使用、按模式判别的持久化身份。两种模式都携带提供方名称。`one-shot` 描述符可以携带调用方拥有的可选显示 `label`;`continuable` 描述符要求以委派 `description` 作为持久化创建标签,并另外对已解析的子 agent `agentOptions.provider`/`model`/`reasoningEffort` 与可选的 `persona`/`toolFilter` 建立快照,用于冷恢复。它绝不会对可合并扩展的 `AgentOptions` 对象建立快照,因此无关的扩展值不会破坏继续执行,后续新增组合配置输入则是一次有意的版本更改。描述符省略 `subagentDepth`(冷恢复以持久化 header 中的 `delegationDepth` 作为单调下界)和 `outputSchema`(单次运行或 Activation 的结果约定,而非持久化身份)。
287
263
 
288
- 本地一次性提供方会在子 agent 的初始轮次内、首次请求前追加描述符。继续执行管理器会在任何提供方提供的谱系之后、初始提示词获准之前追加描述符;`header.seedLength` 仍是 fork 谱系边界:恢复时的描述符权威读取子 agent 自身的后缀,而供列表使用的身份投影以 last-wins 折叠 `subagent/descriptor`,子 agent 自己的描述符会覆盖 fork seed 中祖先的描述符。该事件只进入日志:不含 `surfaceOp`,绝不进入模型历史,并由仅追加日志跨压缩保留。格式错误的当前版本描述符属于损坏;本运行时无法对不受支持的版本进行分类。
264
+ 本地一次性提供方会在子 agent 的初始轮次内、首次请求前追加描述符。继续执行管理器会在任何提供方提供的谱系之后、初始提示词获准之前追加描述符;`Session.inheritedEventCount` 仍是 fork 谱系边界:恢复时的描述符权威读取子 agent 自身的后缀,而供列表使用的身份投影以 last-wins 折叠 `subagent/descriptor`,子 agent 自己的描述符会覆盖 fork seed 中祖先的描述符。seeded cold list 会跳过 cache hint,直到权威 observation 提供该精确 cut。该事件只进入日志:不含 `surfaceOp`,绝不进入模型历史,并由仅追加日志跨压缩保留。格式错误的当前版本描述符属于损坏;本运行时无法对不受支持的版本进行分类。
289
265
 
290
266
  ## 持久化枚举:`listChildren()`、`listDescendants()` 与其条目
291
267
 
292
- `SubagentRuntime.listChildren(parentSessionId)` 从 `ctx.sessions.list()` 与可选 `ctx.sessionPersistence.list()` 的实时优先合并中枚举 parent 直接且由会话支撑的 subagent——不经查询服务,也不会加载或恢复任何 Agent。候选是持久 header 携带 `origin: 'subagent'` 的直接 child;该标记只负责枚举分类与粗粒度的通用路由拒绝,不能证明描述符有效、child 可恢复或操作已获授权——身份由投影折叠负责,恢复由 Activation 约定负责。每行的 `mode`/`label` 是已注册 `subagent` projection unit 的值,经三级阶梯供值:存活 child 由注册表水位缓存供值(零日志读取);冷 child 先读可选的投影 checkpoint 缓存(`cachedSnapshot`——过 own-suffix seq 门的身份即定值,own descriptor 一经追加不可变);否则在一次 `persistence.inspect()` 读取上经注册表折叠(有界并发,每次列表重新计算)。该缓存是纯可选加速层:服务缺席、行里是 `null` 哨兵或 key 缺席、seq 门不过、读取出错,都静默落到权威重折。折叠规则是 `subagent/descriptor` last-wins 且没有失败通道:子 agent 自己的描述符覆盖 fork seed 中祖先的描述符,格式错误或版本不认识的载荷折叠为可序列化的 `null` 哨兵,视同无值。结果是按 `createdAt`、再按 id 排序的 `SubagentListEntry[]`:取到身份即生成带有 `mode: 'one-shot' | 'continuable'` 和 `activity: 'running' | 'inactive'` 的 `child` 条目;可继续条目始终携带 `label`,一次性条目则只在启动调用方提供展示元数据时携带该字段。已定局而折叠无身份的候选生成 `corrupt` diagnostic——缺失、格式错误与版本不认识的描述符有意不再细分(`unsupported` 仍保留在类型中但从不产出);运行中而无身份的候选被省略(描述符落盘前的创建窗口);冷检查失败生成一条 `unavailable` diagnostic 并在下次列表自然重试,因此一个损坏的 sibling 不会隐藏健康 child。`hasChildren` 标记存在持久 subagent origin 的直接后代,读取自同一份合并材料。活动状态只表示逻辑记录是否在 `ctx.sessions` 中存活,而不表示结果或可恢复性。缺少持久化时,枚举退化为仅存活枚举而不是报错——此时冷 child 本就无法恢复。缺少 `ctx.sessionProjections` 注册表时,`listChildren()` 抛出携带错误码 `SUBAGENT_CONTROL_PROJECTIONS_UNAVAILABLE` 的 `SubagentError`,缺少会话存储时则抛出 `SUBAGENT_CONTROL_SESSION_STORE_UNAVAILABLE`,两者都在任何读取之前检查,因此零 child 的部署同样确定失败;列表工具在插件加载时要求 `ctx.subagents` 与 `ctx.agents`。UI 等服务消费方可以展示两种模式,并为无标签的一次性 child 选择回退展示;面向模型的 `list_agents` 适配器([dsh-tool-subagent-control](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-control) 中可单独加载的 `/list-agents` 插件)则只保留可继续条目,并通过在线 Agent 注册表将状态细化为自己的 `running`/`idle`/`ready` 词汇,其中 `ready` 把仅存于存储的 child 命名为可恢复而非终态。枚举不会查询继续执行管理器的 Activation map、Agent 注册表或提供方可用性;`send_message` 仍是消息送达时的权威操作,列表中的运行中可继续 child 仍可能因所有权冲突而拒绝投递。读路径的设计理由见[列表身份投影 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-06-subagent-list-identity-projection.zh.md)。
268
+ `SubagentRuntime.listChildren(parentSessionId)` 从 `ctx.sessions` 与会话查询引擎 `listSessions()` 的实时优先合并中枚举 parent 直接且由会话支撑的 subagent——不会加载或恢复任何 Agent。候选是持久 header 携带 `origin: 'subagent'` 的直接 child;该标记只负责枚举分类与粗粒度的通用路由拒绝,不能证明描述符有效、child 可恢复或操作已获授权——身份由投影折叠负责,恢复由 Activation 约定负责。每行的 `mode`/`label` 是已注册 `subagent` projection unit 的值,经三级阶梯供值:存活 child 由注册表水位缓存供值(零日志读取);冷 child 先读可选的投影 checkpoint 缓存(`cachedSnapshot`——过 own-suffix seq 门的身份即定值,own descriptor 一经追加不可变);否则在一次 `query.observeSession()` 冷观察上经注册表折叠(有界并发,每次列表重新计算)。该缓存是纯可选加速层:服务缺席、行里是 `null` 哨兵或 key 缺席、seq 门不过、读取出错,都静默落到权威重折。折叠规则是 `subagent/descriptor` last-wins 且没有失败通道:子 agent 自己的描述符覆盖 fork seed 中祖先的描述符,格式错误或版本不认识的载荷折叠为可序列化的 `null` 哨兵,视同无值。结果是按 `createdAt`、再按 id 排序的 `SubagentListEntry[]`:取到身份即生成带有 `mode: 'one-shot' | 'continuable'` 和 `activity: 'running' | 'inactive'` 的 `child` 条目;可继续条目始终携带 `label`,一次性条目则只在启动调用方提供展示元数据时携带该字段。已定局而折叠无身份的候选生成 `corrupt` diagnostic——缺失、格式错误与版本不认识的描述符有意不再细分(`unsupported` 仍保留在类型中但从不产出);运行中而无身份的候选被省略(描述符落盘前的创建窗口);冷检查失败生成一条 `unavailable` diagnostic 并在下次列表自然重试,因此一个损坏的 sibling 不会隐藏健康 child。`hasChildren` 标记存在持久 subagent origin 的直接后代,读取自同一份合并材料。活动状态只表示逻辑记录是否在 `ctx.sessions` 中存活,而不表示结果或可恢复性。缺少持久化时,枚举退化为仅存活枚举而不是报错——此时冷 child 本就无法恢复。缺少 `ctx.sessionProjections` 注册表时,`listChildren()` 抛出携带错误码 `SUBAGENT_CONTROL_PROJECTIONS_UNAVAILABLE` 的 `SubagentError`,缺少会话存储时则抛出 `SUBAGENT_CONTROL_SESSION_STORE_UNAVAILABLE`,两者都在任何读取之前检查,因此零 child 的部署同样确定失败;列表工具在插件加载时要求 `ctx.subagents` 与 `ctx.agents`。UI 等服务消费方可以展示两种模式,并为无标签的一次性 child 选择回退展示;面向模型的 `list_agents` 适配器([dsh-tool-subagent-control](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/subagent/tool-subagent-control) 中可单独加载的 `/list-agents` 插件)则只保留可继续条目,并通过在线 Agent 注册表将状态细化为自己的 `running`/`idle`/`ready` 词汇,其中 `ready` 把仅存于存储的 child 命名为可恢复而非终态。枚举不会查询继续执行管理器的 Activation map、Agent 注册表或提供方可用性;`send_message` 仍是消息送达时的权威操作,列表中的运行中可继续 child 仍可能因所有权冲突而拒绝投递。读路径的设计理由见[列表身份投影 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/architecture/2026-08-06-subagent-list-identity-projection.zh.md)。
293
269
 
294
270
  `SubagentRuntime.listDescendants(rootSessionId)` 将同一份实时优先语料与基于投影的解释应用到根的完整后代树,并按稳定 pre-order 输出。普通会话和一次性 child 仍作为遍历节点,因此其下的可继续后代仍可发现;只有 `origin: 'subagent'` 的候选会生成条目。每个返回的 child 或 diagnostic 都从枚举所得的持久 header 附加树位置;冷检查在提供身份前还会重新校验完整生命周期:
295
271
 
@@ -419,7 +395,7 @@ interface SubagentRun {
419
395
 
420
396
  ## 提供方约定:`SubagentProvider`
421
397
 
422
- 每个提供方都是一个具名的子 agent 传输层,多个提供方可以共存。服务在 `start()` 之前校验请求的启动时能力,并拒绝在没有 `prepareContinuable` 的提供方上发起可继续 start。`inheritsParentContext` 仅描述对话种子注入(`fork`:true;`spawn` 和 `acp`:false),使消费方能生成准确的面向模型措辞,而不暗示继承了工具、服务或权限。
398
+ 每个提供方都是一个具名的子 agent 传输层,多个提供方可以共存。服务在 `start()` 之前校验请求的启动时能力,并拒绝在没有 `prepareContinuable` 的提供方上发起可继续 start。`inheritsParentContext` 仅描述对话种子注入(`fork`:true;`spawn` 和 `acp`:false),使消费方能生成准确的面向模型措辞,而不暗示继承了工具、服务或权限。如果某个提供方的一次性路由拥有静态的提供方自有默认值,它会公开可选且不可变的 `agentRouteDefaults`,使 Consumer 能够在预检前以正确基线合并模型与工具覆盖。
423
399
 
424
400
  ```ts type-equiv
425
401
  /**
@@ -441,6 +417,13 @@ interface SubagentProvider {
441
417
  * It says nothing about tool registration, injected services, or authority inheritance.
442
418
  */
443
419
  readonly inheritsParentContext: boolean
420
+ /**
421
+ * Optional static provider-owned provider/model route for one-shot Agent
422
+ * options. Consumers merge tool/model overrides over these values before
423
+ * preflight; providers whose route derives from the parent omit it. The value
424
+ * is detached immutable data and requires `agentOptions` support.
425
+ */
426
+ readonly agentRouteDefaults?: Readonly<{ provider: string; model: string }>
444
427
  /**
445
428
  * Establish a ONE-SHOT child and return its handle after publication.
446
429
  * The service has already validated that every requested start-time
@@ -489,6 +472,22 @@ spawn 和 fork 后端通过 `parent.ctx` 创建一个普通的单次 agent,将
489
472
 
490
473
  Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
491
474
 
475
+ <a id="ctxsubagentmodelselection--subagentmodelselectionconfig"></a>
476
+
477
+ ### `ctx.subagentModelSelection` — `SubagentModelSelectionConfig`
478
+
479
+ Singleton settings owner read by delegation tools when an Agent is published.
480
+
481
+ ```ts cordis-catalog
482
+ /**
483
+ * Read a detached selection preference for the next eligible Agent publication.
484
+ * @returns the enabled state and exact allowed routes.
485
+ */
486
+ current(): SubagentModelSelectionSettings
487
+ ```
488
+
489
+ Source: [`packages/subagent/tool-subagent/src/model-selection-settings.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/tool-subagent/src/model-selection-settings.ts)
490
+
492
491
  <a id="ctxsubagents--subagentruntime"></a>
493
492
 
494
493
  ### `ctx.subagents` — `SubagentRuntime`
@@ -508,21 +507,20 @@ Named provider registry with one-shot runs, durable discovery, and continuable-c
508
507
  async startContinuable(spec: ContinuableStartSpec): Promise<ContinuableStart>
509
508
 
510
509
  /**
511
- * Deliver one later message to a continuable child as its next FIFO turn. A
512
- * resident child's Agent inbox accepts it directly (waking a `waiting`
513
- * Activation), while an absent one is cold-resumed from its persisted
514
- * Session. The Agent inbox is the only queue, so every accepted message has
515
- * one observable order.
516
- * @param parent - the exact live direct parent authorizing this delivery.
517
- * @param childId - durable child session id.
518
- * @param content - user-role content to deliver.
519
- * @param options - the message source fields and caller cancellation, which stops the
520
- * operation only before inbox acceptance.
510
+ * Steer one model-authored message to the sender's direct parent or direct
511
+ * continuable child. A running target admits it at the nearest step boundary;
512
+ * an idle target starts a turn, and an absent direct child cold-resumes from
513
+ * persistence. The service derives durable sender attribution from the exact
514
+ * live sender. Caller cancellation stops only pre-acceptance work.
515
+ * @param sender - exact live Agent authorizing and originating the message.
516
+ * @param targetId - durable direct-parent or direct-child session id.
517
+ * @param content - model-authored content to deliver.
518
+ * @param options - caller cancellation before inbox acceptance.
521
519
  * @returns the accepted message's inbox id.
522
- * @throws when continuation services are unavailable, parent authority is
523
- * rejected, or the message was not admitted.
520
+ * @throws when continuation services are unavailable, adjacency is rejected,
521
+ * or the message was not admitted.
524
522
  */
525
- async followup( parent: Agent, childId: SessionId, content: ContentBlock[], options: SubagentFollowupOptions, ): Promise<MessageId>
523
+ async sendMessage( sender: Agent, targetId: SessionId, content: ContentBlock[], options: SubagentSendMessageOptions, ): Promise<MessageId>
526
524
 
527
525
  /**
528
526
  * Interrupt one live continuable child's current turn under a human parent
@@ -541,29 +539,6 @@ async followup( parent: Agent, childId: SessionId, content: ContentBlock[], opti
541
539
  */
542
540
  interrupt(targetSessionId: SessionId, authority: SubagentInterruptAuthority): void
543
541
 
544
- /**
545
- * Deliver selected content from one live continuable child to its durable
546
- * direct parent. The child is the authority credential; callers cannot name a
547
- * recipient. Reporting does not conclude the child's turn or Activation.
548
- * @param child - exact live reporting child.
549
- * @param content - selected model-facing content.
550
- * @param options - parent scheduling and pre-acceptance cancellation.
551
- * @returns the stable identity of the parent-accepted message.
552
- * @throws when continuation services are unavailable, sender authorization
553
- * fails, or the direct parent is not live.
554
- */
555
- async reportFrom( child: Agent, content: ContentBlock[], options: SubagentReportOptions, ): Promise<MessageId>
556
-
557
- /**
558
- * Compose one deployment capability into every continuable child's
559
- * unpublished creation context on fresh creation and cold resume. Grants wait
560
- * for the next Activation; removing the contribution revokes every resident
561
- * installation immediately.
562
- * @param contribution - synchronous child-scope installer.
563
- * @returns the exact Cordis effect disposer.
564
- */
565
- registerContinuableSetup(contribution: ContinuableSetupContribution): () => void
566
-
567
542
  /**
568
543
  * Close continuable admission below exact live parent Agents, stop only their
569
544
  * visible descendant Activations synchronously, then await admitted scoped
@@ -590,27 +565,16 @@ async drainContinuableChildren(parent: Agent, childIds: readonly SessionId[]): P
590
565
 
591
566
  /**
592
567
  * Enumerate the parent's direct session-backed subagents without loading or
593
- * resuming an Agent and without any query service: the listing merges the live
594
- * session store with optional session persistence (live-preferred) and
595
- * serves each child's durable mode/label from the registered `subagent`
596
- * projection unit down a three-rung ladder — the registry's watermark
597
- * snapshot for a live child; for a cold one, a durable projection-cache
598
- * row when the optional cache serves an own-suffix identity (its `seq`
599
- * gate proves the value postdates the fork seed, where a child's own
600
- * descriptor is immutable once appended), else one persistence inspection
601
- * folded through the registry. The
602
- * projection fold is the single classification authority; per-child
603
- * diagnostics relay a fold that served no identity or a failed inspection,
604
- * never a list-time descriptor parse. Absent persistence, enumeration is
605
- * live-only (a cold child cannot be resumed then either, so its absence is
606
- * capability absence, not an error). This service consults no Agent
607
- * registrations, Activations, or providers.
568
+ * resuming an Agent. The Session query service supplies one live-preferred
569
+ * corpus and shared point observations; the projection cache supplies
570
+ * immutable descriptor hits without opening cold logs. The registered
571
+ * `subagent` projection remains the sole mode/label classifier.
608
572
  *
609
- * Every persistence read receives `signal`, and the listing rechecks
610
- * cancellation around each of those awaits. Read rejections that settle
573
+ * Every query receives `signal`, and the listing rechecks cancellation
574
+ * around each await. Read rejections that settle
611
575
  * after an abort become a stable `SubagentError` with code `CANCELLED`.
612
576
  * @param parentSessionId - parent session whose direct children are listed.
613
- * @param signal - caller-owned cancellation forwarded to persistence reads
577
+ * @param signal - caller-owned cancellation forwarded to Session queries
614
578
  * and observed around every read await.
615
579
  * @returns children and per-child diagnostics ordered by `createdAt`, then id.
616
580
  * @throws {@link SubagentError} when the projection registry or the session
@@ -635,6 +599,55 @@ listChildren(parentSessionId: SessionId, signal?: AbortSignal): Promise<Subagent
635
599
  */
636
600
  listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<SubagentDescendantListEntry[]>
637
601
 
602
+ /**
603
+ * Remote face of {@link listChildren} for one browser: the durable listing
604
+ * plus live Agent activity and the delivery-time parent availability hint.
605
+ * Parent availability is a hint; {@link prompt} performs the authoritative
606
+ * check. Named apart from the provider-name {@link list}, which owns the
607
+ * member.
608
+ * @param parentSessionId - parent session whose direct children are listed.
609
+ * @param signal - carrier cancellation forwarded to Session queries.
610
+ * @returns the catalog view for that parent.
611
+ * @throws {RemoteError} `gateway/bad-request` for an empty parent id,
612
+ * `gateway/cancelled` for an aborted read, `subagent/projections-unavailable` when
613
+ * the deployment has no projection registry, otherwise `gateway/internal`.
614
+ */
615
+ @Remote('list') async remoteExportList(parentSessionId: SessionId, signal: AbortSignal): Promise<SubagentCatalog>
616
+
617
+ /**
618
+ * Deliver one browser-authored message to a continuable child through the
619
+ * exact live direct parent, retaining the caller-minted request identity and
620
+ * validated browser zone on the accepted message. Success identifies the
621
+ * message the child's FIFO inbox accepted; later execution is independent of
622
+ * this call.
623
+ * Image parts are admitted and persisted through the attachment store
624
+ * before delivery, and the child's model must accept image input.
625
+ * @param request - durable address, minted identity, content, and optional browser zone.
626
+ * @param signal - carrier cancellation, owning the call until inbox acceptance.
627
+ * @returns the accepted message's inbox identity.
628
+ * @throws {RemoteError} `gateway/bad-request`, `subagent/attachment-invalid`,
629
+ * `subagent/invalid-time-zone`, `subagent/parent-unavailable`,
630
+ * `subagent/not-resumable`, `subagent/unauthorized`,
631
+ * `subagent/delivery-unavailable`, `gateway/cancelled`, or `gateway/internal`.
632
+ */
633
+ @Remote('prompt') async prompt(request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>
634
+
635
+ /**
636
+ * Remote face of {@link interrupt} under one durable parent address. No
637
+ * catalog, history, persistence, or parent Agent lookup runs: the core
638
+ * primitive alone authorizes the address against the live Activation, which
639
+ * is what keeps a live child interruptible while its parent Agent is offline.
640
+ * Absent, idle, and already-completed targets are accepted no-ops there.
641
+ * @param childSessionId - durable child session id to interrupt.
642
+ * @param parentSessionId - durable direct parent whose authority is claimed.
643
+ * @param mode - required continuable-address discriminator.
644
+ * @returns acknowledgement that the cancel signal was admitted, not that the target is quiescent.
645
+ * @throws {RemoteError} `gateway/bad-request` for an empty id,
646
+ * `subagent/unauthorized` when the address does not own the live target,
647
+ * otherwise `gateway/internal`.
648
+ */
649
+ @Remote('interruptByParent') interruptByParent( childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable', ): SubagentInterruptReceipt
650
+
638
651
  /**
639
652
  * Register a provider under its name. Registration is effect-scoped and HMR
640
653
  * safe; removing a provider blocks new starts but does not revoke runs that
@@ -42,7 +42,7 @@ interface ToolProviderResult {
42
42
 
43
43
  ## 提示词段落
44
44
 
45
- `PromptSection` 是一份只读的同进程注册约定。其文本可以是静态的,也可以从当前组装上下文动态解析。协作式组装完成后,一个有效的 `complete` 段会成为唯一的提示词段落。
45
+ `PromptSection` 是一份只读的同进程注册约定。其文本可以是静态的,也可以从当前组装上下文动态解析。各段先按 order 升序排列,再按名称的代码单元顺序排列;仓库贡献方通过 `getSectionOrder()` 解析服务持有的具名分配。Runtime-context 贡献方通过 `getContextOrder()` 解析独立分配。协作式组装完成后,一个有效的 `complete` 段会成为唯一的提示词段落。
46
46
 
47
47
  ```ts type-equiv
48
48
  /** One contributed section of the system prompt (registry input). */
@@ -50,9 +50,8 @@ interface PromptSection {
50
50
  /** Unique name — a duplicate registration throws (see {@link SystemPrompt.section}). */
51
51
  readonly name: string
52
52
  /**
53
- * Sections are concatenated in ascending order. Convention: `-100` is the
54
- * harness identity, `0` the deployment persona, tool guidance uses 100–199;
55
- * other negative orders also render before the persona.
53
+ * Sections are concatenated in ascending order. Equal orders use code-unit
54
+ * name order.
56
55
  */
57
56
  readonly order: number
58
57
  /**
@@ -112,6 +111,20 @@ Registry service for the prompt inputs assembled before each model step.
112
111
  */
113
112
  section(section: PromptSection): () => void
114
113
 
114
+ /**
115
+ * Resolve the centrally owned placement of a repository prompt section.
116
+ * @param name - stable section placement name.
117
+ * @returns the section's numeric sort order.
118
+ */
119
+ getSectionOrder(name: PromptSectionOrderName): number
120
+
121
+ /**
122
+ * Resolve the centrally owned placement of a repository runtime context.
123
+ * @param name - stable context placement name.
124
+ * @returns the context's numeric sort order.
125
+ */
126
+ getContextOrder(name: PromptContextOrderName): number
127
+
115
128
  /**
116
129
  * Register ordered dynamic context in the calling context's scope. Scoped
117
130
  * entries shadow global entries with the same name.
@@ -15,21 +15,21 @@ outline: [2,3]
15
15
  /** Detached immutable request-pressure and surface snapshot at one consumed log revision. */
16
16
  interface TokenMeasurement {
17
17
  /** Number of durable events consumed; equal to the next unread event seq. */
18
- readonly logRevision: number
18
+ readonly logRevision: SessionLogOffset
19
19
  /** Provider or heuristic anchor used for this measurement. */
20
20
  readonly baseline: TokenMeasurementBaseline
21
21
  /** Signed repricing of current surface content relative to the baseline anchor. */
22
22
  readonly surfaceDeltaTokens: number
23
23
  /** Non-negative current request-and-response pressure. */
24
24
  readonly totalTokens: number
25
- /** Total heuristic tokens across the current surface. */
25
+ /** Total route-priced request tokens across the current surface; equals the sum of the node prices. */
26
26
  readonly surfaceTokens: number
27
27
  /** Current surface nodes in positional head-to-tail order. */
28
28
  readonly nodes: readonly TokenSurfaceNode[]
29
29
  }
30
30
  ```
31
31
 
32
- `baseline.kind === 'usage'` 表示最近一次成功的提供方调用具有相同的规范请求 envelope,且该调用的总量不低于其完整启发式锚点。`estimated` 表示不存在可复用的保守 usage 锚点,因此服务使用固定启发式规则对完整信封和表层定价。后续成功请求会替换早先的锚点;有符号的 `surfaceDeltaTokens` 会保留相对于匹配锚点的增长与缩减。`totalTokens` 仍表示请求与响应压力,`surfaceTokens` 则是仅针对表层的启发式总量,等于所有节点价格之和。
32
+ 每次计量都会通过 `ctx.llm` 把生效信封的路由 provider/model 解析为该路由声明的请求图片定价,因此图片出现处按请求实际发送的视觉 token 加模型可见文本计价;未声明定价的路由与组合保持固定启发式规则。`baseline.kind === 'usage'` 表示最近一次成功的提供方调用具有相同的规范请求 envelope,且该调用的总量不低于其完整路由定价锚点。`estimated` 表示不存在可复用的保守 usage 锚点,因此服务自行对完整信封和表层定价。后续成功请求会替换早先的锚点;有符号的 `surfaceDeltaTokens` 会保留相对于匹配锚点的增长与缩减,且两侧按同一路由重新定价。`totalTokens` 仍表示请求与响应压力,`surfaceTokens` 则是表层的路由定价总量,等于所有节点价格之和。
33
33
 
34
34
  ## `TokenSurfaceNode`
35
35
 
@@ -37,9 +37,20 @@ interface TokenMeasurement {
37
37
  /** One token-priced node in the current ordered session surface. */
38
38
  interface TokenSurfaceNode {
39
39
  /** Durable sequence number of the surface event. */
40
- readonly seq: number
41
- /** Heuristic tokens for the exact message projected by this node. */
40
+ readonly seq: SessionSeq
41
+ /**
42
+ * Request-pressure tokens for the exact message projected by this node under
43
+ * the measured route: image occurrences carry the route's declared visual
44
+ * price when the routed adapter declares one, and the fixed heuristic
45
+ * otherwise. Trigger, retention, and range selection all read this price.
46
+ */
42
47
  readonly tokens: number
48
+ /**
49
+ * Fixed-heuristic tokens for the same message, independent of any route.
50
+ * The shadow-price protocol prices replacements with this value so the O(1)
51
+ * projection fold stays in agreement with its own appends.
52
+ */
53
+ readonly heuristicTokens: number
43
54
  }
44
55
  ```
45
56
 
@@ -63,14 +74,18 @@ Replay owner for one service-wide estimator and isolated per-session folds.
63
74
  /**
64
75
  * Measure current request pressure and surface through the durable tail.
65
76
  *
66
- * Provider usage is reused only when the latest successful call's canonical
67
- * request envelope matches `requestHeader` and its total is no lower than
68
- * that call's full heuristic anchor; otherwise the complete envelope and
69
- * surface are heuristically repriced.
77
+ * The effective envelope's routed provider/model selects the request-image
78
+ * pricing every node is priced under: a route whose adapter declares image
79
+ * pricing charges each retained image its visual tokens plus its
80
+ * model-visible text, while other routes keep the fixed heuristic. Provider
81
+ * usage is reused only when the latest successful call's canonical request
82
+ * envelope matches `requestHeader` and its total is no lower than that
83
+ * call's full route-priced anchor; otherwise the complete envelope and
84
+ * surface are repriced.
70
85
  *
71
- * `requestHeader` affects request pressure only; surface fields always
72
- * describe the current session surface. Every call clones those positional
73
- * nodes, so measurement is O(surface).
86
+ * `requestHeader` replaces the latest logged envelope for pressure and node
87
+ * pricing; the node set always describes the current session surface. Every
88
+ * call clones those positional nodes, so measurement is O(surface).
74
89
  *
75
90
  * @param session - session to replay through its current durable tail.
76
91
  * @param requestHeader - optional effective request envelope replacing the latest logged header.