@deepseek-ai/dsh-subagent 0.1.2-alpha.3 → 0.1.2-alpha.5

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.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/subagent/subagent/README.md
5
- README.md: f13de661015f3aa59b776273376f07653f6bbba5
6
- README.zh.md: 42923504ed11b8eff7c0bdcd9d0c9505d741f42e
5
+ README.md: 257a76a4ef84583d3337f697bc8024d72219c4d6
6
+ README.zh.md: 135086b982df38089cdef0acf85535d35354a9d7
package/README.md CHANGED
@@ -44,11 +44,11 @@ An agent that calls the tool gets the child's final answer as the tool result. M
44
44
 
45
45
  ### One-shot and continuable children
46
46
 
47
- One-shot children run once and settle with a single result, plus an optional structured output and a safe diagnostic on failure. A start request may override the child Agent's provider, model, reasoning effort, and output-token limit through `agentOptions`; every requested option requires the provider's matching capability. Continuable children keep a durable session and accept later messages in order: the caller receives a stable child id, sends follow-ups, and can interrupt the current turn without destroying the child. The tool row's `backgroundMode` picks the shape (`one-shot` by default, or `continuable` on providers that support it).
47
+ One-shot children run once and settle with a single result, plus an optional structured output and a safe diagnostic on failure. A start request may override the child Agent's provider, model, reasoning effort, and output-token limit through `agentOptions`; every requested option requires the provider's matching capability. Continuable children keep a durable session and accept later messages in order: the caller receives a stable child id, sends adjacent-Agent messages, and can interrupt the current turn without destroying the child. The tool row's `backgroundMode` picks the shape (`one-shot` by default, or `continuable` on providers that support it).
48
48
 
49
- ### Following up, interrupting, and discovering
49
+ ### Messaging, interrupting, and discovering
50
50
 
51
- Continuable children answer follow-up messages as their next turns, and the parent can interrupt a running turn or list its children at any time. A browser continuation prompt may carry image parts: the Host admits and persists each image batch through the attachment store before the child inbox accepts the message, and refuses delivery when the child's declared model does not accept image input. Discovery covers both shapes: the service lists direct children and the full descendant tree — mode, activity, and lineage — reading live session state and optional persistence, without loading any child.
51
+ Every exact live Agent can use `sendMessage()` with a direct continuable child; a resident continuable child can also use it with its direct parent. A working target receives the message through Steer at its nearest step; an idle target starts a turn, and only a direct child can be cold-resumed. The parent can also interrupt a running descendant or list its children at any time. A browser continuation prompt may carry image parts: the Host admits and persists each image batch through the attachment store before the child inbox accepts the message, and refuses delivery when the child's declared model does not accept image input. Discovery covers both shapes: the service lists direct children and the full descendant tree — mode, activity, and lineage — reading live session state and optional persistence, without loading any child.
52
52
 
53
53
  ### Failure and recovery
54
54
 
@@ -76,7 +76,8 @@ This section explains how the service is built and where the observable behavior
76
76
  | File | Role |
77
77
  |---|---|
78
78
  | [`src/index.ts`](src/index.ts) | Service entry: provider registry, start and continuation API, lifecycle events |
79
- | [`src/continuation.ts`](src/continuation.ts) | Continuable children: identity reservation, Activation residency, follow-up, interrupt, settlement |
79
+ | [`src/continuation.ts`](src/continuation.ts) | Continuable children: identity reservation, Activation residency, adjacent messaging, interrupt, settlement |
80
+ | [`src/internal.ts`](src/internal.ts) | Host-only Queue adapter for browser and Team message protocols |
80
81
  | [`src/types.ts`](src/types.ts) | Public request, result, and provider contracts |
81
82
  | [`src/descriptor.ts`](src/descriptor.ts) | Versioned `subagent/descriptor` session-event vocabulary |
82
83
  | [`src/child-agent.ts`](src/child-agent.ts) | Child composition, delegated policy, depth helpers |
@@ -90,13 +91,13 @@ A request is validated against the provider's advertised capabilities, a durable
90
91
 
91
92
  ### Continuable flow
92
93
 
93
- The manager reserves a child identity, resolves the durable descriptor, creates (or cold-resumes) the child Agent, installs it in an Activation, and submits the prompt. Later messages become FIFO turns through the child's own inbox; an absent Activation cold-resumes from the persisted session. When a resident Activation settles, the manager tells the child's direct parent in the parent's own turn stream.
94
+ The manager reserves a child identity, resolves the durable descriptor, creates (or cold-resumes) the child Agent, installs it in an Activation, and submits the prompt. Model-authored messages cross one parent/child edge through fixed Steer scheduling; host protocols retain an internal Queue adapter for distinct turns. An absent direct-child Activation cold-resumes from the persisted session. When a resident Activation settles, the manager tells the child's direct parent in the parent's own turn stream.
94
95
 
95
96
  ### Ownership and invariants
96
97
 
97
98
  - **Publication is the boundary** — before it the provider owns the setup and must roll back on failure; after it the caller owns the run and must dispose it.
98
99
  - **Registration is effect-scoped** — removing a provider blocks new starts but never revokes accepted runs.
99
- - **Continuation authority is exact identity** — follow-ups require the exact live direct parent; reports require the exact live child.
100
+ - **Agent-message authority is exact adjacency** — `sendMessage()` requires the exact live sender; every sender may target a direct continuable child, while only a sender with a resident continuable Activation may target its direct parent.
100
101
  - **The descriptor is log-only** — a session event absent from model history and retained across compaction; a continuable descriptor records the resolved child provider, model, and reasoning effort explicitly for cold resume.
101
102
 
102
103
  </details>
@@ -124,11 +125,11 @@ Read these pages when the package-level contract is not enough. They move from t
124
125
 
125
126
  #### What the model sees
126
127
 
127
- One user-role parent message opening with the outcome — `Background subagent <child-id> finished and will do no further work unless you send it more.`, or the matching line for a child that was stopped, ran out of room, declined, or failed — followed by `Its closing message:` and the child's final assistant content, or `It left no closing message.` when it produced none. This is the service's only direct parent-side contribution; delegation schemas, parent continuation and discovery, and the child-scoped `report` belong to `dsh-tool-subagent`, `dsh-tool-subagent-control`, and `dsh-tool-subagent-report`.
128
+ One user-role parent message opening with the outcome — `Background subagent <child-id> finished and will do no further work unless you send it more.`, or the matching line for a child that was stopped, ran out of room, declined, or failed — followed by `Its closing message:` and the child's final assistant content, or `It left no closing message.` when it produced none. This runtime-owned notice is distinct from model-authored parent/child messages, which use `sendMessage()` and `AgentMessageSource`; delegation schemas and model controls belong to the Consumer packages.
128
129
 
129
130
  #### Token effect
130
131
 
131
- One notice per settled Activation in the parent's request, sized by the child's final message. A child that both reports and settles costs the parent both.
132
+ One notice per settled Activation in the parent's request, sized by the child's final message. A child that sends its own message and then settles costs the parent both.
132
133
 
133
134
  #### KV Cache effect
134
135
 
@@ -162,12 +163,12 @@ Prefix-stable within a child: the statement never changes during the child's lif
162
163
  These limits define when the seam is a poor fit or needs special operational care. They are current package constraints, not a general delegation comparison or a task backlog.
163
164
 
164
165
  - **ACP children remain one-shot and are not trace-enumerable** — an ACP run has no local child session in the parent's session corpus, and remote providers need an Activation ownership contract before they can support continuable children.
165
- - **No host-user continuation** — `followup()` requires the exact live direct parent; only `interrupt()` accepts a durable human parent address.
166
- - **Continuation messages never steer** parent-to-child follow-ups enqueue later turns; they never redirect the child's current turn.
166
+ - **Adjacent model messaging only** — `sendMessage()` requires an exact live sender; every sender may target a direct continuable child, while only a sender with a resident continuable Activation may target its direct parent. Browser prompts use the separate Queue control path.
167
+ - **A direct parent must remain live for child-to-parent delivery** the service has no durable parent mailbox; a missing parent rejects the message instead of accepting work it cannot wake.
167
168
  - **Wake gap during cancellation convergence** — a follow-up accepted after an interrupt signal but before the driver becomes idle stays queued until another waking send.
168
169
  - **Process-local residency** — the Activation inbox and ownership graph do not coordinate two harness processes; concurrent access to one persistence store needs a durable mailbox and cross-process lease protocol.
169
170
  - **No replay of accepted-but-unlogged messages** — a crash can lose an accepted prompt that never reached the child's session log; the lost message is not replayed automatically.
170
- - **No durable report mailbox** — reports require a live direct parent and provide acceptance identity rather than exactly-once delivery.
171
+ - **No durable parent mailbox** — child-to-parent messages require a resident continuable child and live direct parent, and provide acceptance identity rather than exactly-once delivery.
171
172
  - **Lifecycle events are observe-only** — a run-affecting `subagent/end` continuation or decision API waits for a concrete consumer.
172
173
 
173
174
  <a id="dev-note"></a>
package/README.zh.md CHANGED
@@ -44,11 +44,11 @@ kind: "package-reference"
44
44
 
45
45
  ### 一次性与可继续子级
46
46
 
47
- 一次性子 agent 只运行一次,并以单个结果结算,可附带可选的结构化输出与失败时的安全诊断。启动请求可以通过 `agentOptions` 覆盖子 Agent 的提供方、模型、推理等级与输出 token 上限;每个请求的选项都要求提供方声明对应能力。可继续子 agent 保留持久会话并按顺序接受后续消息:调用方收到稳定的子 agent id、发送后续消息,并可中断当前轮次而不销毁子 agent。工具行的 `backgroundMode` 选择形态(默认 `one-shot`,或在支持的提供方上使用 `continuable`)。
47
+ 一次性子 agent 只运行一次,并以单个结果结算,可附带可选的结构化输出与失败时的安全诊断。启动请求可以通过 `agentOptions` 覆盖子 Agent 的提供方、模型、推理等级与输出 token 上限;每个请求的选项都要求提供方声明对应能力。可继续子 agent 保留持久会话并按顺序接受后续消息:调用方收到稳定的子 agent id、发送相邻 Agent 消息,并可中断当前轮次而不销毁子 agent。工具行的 `backgroundMode` 选择形态(默认 `one-shot`,或在支持的提供方上使用 `continuable`)。
48
48
 
49
- ### 后续消息、中断与发现
49
+ ### 消息、中断与发现
50
50
 
51
- 可继续子 agent 把后续消息作为下一个轮次回答,父级随时可以中断运行中的轮次或列举自己的子级。浏览器发出的继续执行 prompt 可以携带图片部分:Host 先通过附件存储完成整批图片的准入与持久化,子级 inbox 才接受这条消息;当子级声明的模型不接受图片输入时拒绝投递。发现覆盖两种形态:服务列举直接子级与完整后代树——模式、活动状态与血缘——直接读取在线会话状态与可选持久化,不加载任何子 agent。
51
+ 每个确切在线 Agent 都可以对直接可继续 child 使用 `sendMessage()`;驻留的可继续 child 还可以对自己的直接 parent 使用它。正在工作的目标通过 Steer 在最近 step 接收消息;空闲目标启动轮次,且只有直接 child 可以冷恢复。parent 也可以随时中断正在运行的后代或列举自己的子级。浏览器发出的继续执行 prompt 可以携带图片部分:Host 先通过附件存储完成整批图片的准入与持久化,子级 inbox 才接受这条消息;当子级声明的模型不接受图片输入时拒绝投递。发现覆盖两种形态:服务列举直接子级与完整后代树——模式、活动状态与血缘——直接读取在线会话状态与可选持久化,不加载任何子 agent。
52
52
 
53
53
  ### 失败与恢复
54
54
 
@@ -76,7 +76,8 @@ kind: "package-reference"
76
76
  | 文件 | 职责 |
77
77
  |---|---|
78
78
  | [`src/index.ts`](src/index.ts) | 服务入口:提供方注册表、启动与继续 API、生命周期事件 |
79
- | [`src/continuation.ts`](src/continuation.ts) | 可继续子级:身份预留、Activation 驻留、后续消息、中断、结算 |
79
+ | [`src/continuation.ts`](src/continuation.ts) | 可继续子级:身份预留、Activation 驻留、相邻消息、中断、结算 |
80
+ | [`src/internal.ts`](src/internal.ts) | 供浏览器与 Team 消息协议使用的 host-only Queue 适配器 |
80
81
  | [`src/types.ts`](src/types.ts) | 公开的请求、结果与提供方约定 |
81
82
  | [`src/descriptor.ts`](src/descriptor.ts) | 版本化的 `subagent/descriptor` 会话事件词汇 |
82
83
  | [`src/child-agent.ts`](src/child-agent.ts) | 子级组装、委派策略、深度辅助函数 |
@@ -90,13 +91,13 @@ kind: "package-reference"
90
91
 
91
92
  ### 可继续流程
92
93
 
93
- 管理器预留子 agent 身份、解析持久化描述符、创建(或冷恢复)子 agent、把它安装进 Activation 并提交提示词。后续消息经子 agent 自己的 inbox 成为 FIFO 轮次;没有 Activation 时从持久化会话冷恢复。当驻留 Activation 结算时,管理器会在父级自身的轮次流中告知该子级的直接父级。
94
+ 管理器预留 child 身份、解析持久化描述符、创建(或冷恢复)child、把它安装进 Activation 并提交提示词。模型编写的消息通过固定 Steer 调度跨一条 parent/child 边;host 协议保留内部 Queue 适配器以创建独立轮次。直接 child 不存在 Activation 时会从持久化会话冷恢复。当驻留 Activation 结算时,管理器会在 parent 自身的轮次流中告知该 child 的直接 parent。
94
95
 
95
96
  ### 所有权与不变式
96
97
 
97
98
  - **发布即边界**——发布前提供方拥有设置并须在失败时回滚;发布后调用方拥有运行并须 dispose(资源释放)它。
98
99
  - **注册受 effect 作用域约束**——移除提供方会阻止新启动,但绝不撤销已接受的运行。
99
- - **继续执行权限基于确切身份**——后续消息要求确切在线直接父级;上报要求确切在线子级。
100
+ - **Agent 消息权限基于确切相邻关系**——`sendMessage()` 要求确切在线 sender;每个 sender 都可以指定直接可继续 child,只有具备驻留可继续 Activation 的 sender 可以指定自己的直接 parent。
100
101
  - **描述符仅进日志**——它是会话事件,不进入模型历史,并跨压缩(compaction)保留;可继续描述符会显式记录解析后的子级提供方、模型与推理等级,用于冷恢复。
101
102
 
102
103
  </details>
@@ -124,11 +125,11 @@ kind: "package-reference"
124
125
 
125
126
  #### 模型看到什么
126
127
 
127
- 一条用户角色的父级消息,开头是结果本身——`Background subagent <child-id> finished and will do no further work unless you send it more.`,或子级被停止、耗尽额度、拒绝任务或失败时的对应句子——随后是 `Its closing message:` 与子级的最终 assistant 内容;若子级没有产出内容,则是 `It left no closing message.`。这是本服务面向父级的唯一直接贡献;委派 schema、父级延续与发现以及子级作用域的 `report` 分别归 `dsh-tool-subagent`、`dsh-tool-subagent-control` `dsh-tool-subagent-report` 所有。
128
+ 一条用户角色的父级消息,开头是结果本身——`Background subagent <child-id> finished and will do no further work unless you send it more.`,或子级被停止、耗尽额度、拒绝任务或失败时的对应句子——随后是 `Its closing message:` 与子级的最终 assistant 内容;若子级没有产出内容,则是 `It left no closing message.`。这条由 runtime 生成的通知与模型编写的父子消息相互独立;后者使用 `sendMessage()` `AgentMessageSource`。委派 schema 与模型控制工具归 Consumer 包所有。
128
129
 
129
130
  #### Token 影响
130
131
 
131
- 父级请求中,每个已结算的 Activation 一条通知,长度取决于子级的最终消息。如果子级既上报又结算,父级请求会同时承担两者。
132
+ 父级请求中,每个已结算的 Activation 一条通知,长度取决于子级的最终消息。如果子级先发送自己的消息再结算,父级请求会同时承担两者。
132
133
 
133
134
  #### KV Cache 影响
134
135
 
@@ -162,12 +163,12 @@ You are a delegated subagent: your permission scope was fixed when you were star
162
163
  这些限制说明该 seam 何时不合适,或何时需要特别的运维注意。它们是当前包约束,不是通用委派对比或任务积压。
163
164
 
164
165
  - **ACP 子级仍为一次性,且无法通过追踪枚举**——ACP 运行在父级会话语料中没有本地子会话,远程提供方需要 Activation 所有权约定才能支持可继续子级。
165
- - **无 host-user 继续执行**——`followup()` 要求确切在线直接父级;只有 `interrupt()` 接受持久化的人类父级地址。
166
- - **继续执行消息绝不 steering(中途引导)**——父到子的后续消息排入后续轮次;它们绝不会重定向子级当前轮次。
166
+ - **仅允许相邻模型消息**——`sendMessage()` 要求确切在线 sender;每个 sender 都可以指定直接可继续 child,只有具备驻留可继续 Activation 的 sender 可以指定自己的直接 parent。浏览器提示使用独立的 Queue 控制路径。
167
+ - **child 到 parent 的投递要求直接 parent 保持在线**——服务没有持久 parent mailbox;parent 缺失时会拒绝消息,而非接受无法唤醒的工作。
167
168
  - **取消收敛期间存在唤醒缺口**——中断信号发出后、driver 进入 idle 前被接受的后续消息会保持排队,直到另一条唤醒发送到达。
168
169
  - **驻留仅限进程内**——Activation inbox 与所有权图不会在两个 harness 进程之间协调;对单个持久化存储的并发访问需要持久化邮箱与跨进程租约协议。
169
170
  - **不回放已接受但未记录的消息**——崩溃可能丢失从未写入子会话日志、已被接受的提示词;丢失的消息不会自动回放。
170
- - **没有持久化的上报 mailbox**——上报需要在线直接父级,提供的是接受标识,不保证恰好一次投递。
171
+ - **没有持久化 parent mailbox**——child 到 parent 的消息要求驻留的可继续 child 与在线直接 parent,提供的是接受标识,不保证恰好一次投递。
171
172
  - **生命周期事件只供观察**——影响运行的 `subagent/end` 延续或决策接口仍需等待具体消费方。
172
173
 
173
174
  <a id="dev-note"></a>