dsh-plugin-dev-kb 1.0.9 → 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.
- package/CHANGELOG.md +10 -0
- package/README.en.md +6 -6
- package/README.md +6 -6
- package/kb/INDEX.md +4 -2
- package/kb/README.md +4 -4
- package/kb/extra/AGENTS.md +1 -1
- package/kb/extra/cookbook/adding-a-remote-api.md +197 -0
- package/kb/extra/cookbook/adding-a-remote-api.zh.md +197 -0
- package/kb/extra/deepseek-llm-api-wire-extensions.md +18 -14
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +18 -14
- package/kb/extra/event-producer-consumer.md +44 -43
- package/kb/extra/event-producer-consumer.zh.md +47 -46
- package/kb/extra/i18n/style-samples.md +2 -2
- package/kb/extra/module-graph.md +444 -991
- package/kb/extra/module-graph.zh.md +446 -993
- package/kb/extra/subsystems/agent-team.md +4 -3
- package/kb/extra/subsystems/agent-team.zh.md +4 -3
- package/kb/extra/subsystems/attachment.md +157 -4
- package/kb/extra/subsystems/attachment.zh.md +157 -4
- package/kb/extra/subsystems/feedback.md +2 -2
- package/kb/extra/subsystems/feedback.zh.md +2 -2
- package/kb/extra/testing.md +6 -2
- package/kb/extra/testing.zh.md +6 -2
- package/kb/extra/web-styling.md +4 -0
- package/kb/extra/web-styling.zh.md +4 -0
- package/kb/meta/search-index.json +135 -111
- package/kb/meta/site-pages.txt +184 -182
- package/kb/meta/source.json +5 -5
- package/kb/meta/topics.md +4 -4
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +3 -2
- package/kb/site/en/develop/practice/llm-adapter.md +4 -3
- package/kb/site/en/guide/network-proxy.md +87 -0
- package/kb/site/en/guide/providers.md +70 -17
- package/kb/site/en/guide/schedule.md +2 -0
- package/kb/site/en/reference/agent-lifecycle.md +5 -3
- package/kb/site/en/reference/api-gateway.md +2 -2
- package/kb/site/en/reference/capability-seams.md +14 -7
- package/kb/site/en/reference/config-catalog.md +157 -230
- package/kb/site/en/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/en/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/en/reference/cookbook/extension-cookbook.md +15 -12
- package/kb/site/en/reference/index.md +11 -4
- package/kb/site/en/reference/persistence-catalog.md +91 -70
- package/kb/site/en/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/en/reference/subsystems/commands.md +25 -16
- package/kb/site/en/reference/subsystems/compaction.md +9 -9
- package/kb/site/en/reference/subsystems/conversation.md +11 -4
- package/kb/site/en/reference/subsystems/core.md +96 -15
- package/kb/site/en/reference/subsystems/credentials.md +5 -4
- package/kb/site/en/reference/subsystems/goal.md +1 -1
- package/kb/site/en/reference/subsystems/index.md +1 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +24 -3
- package/kb/site/en/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/en/reference/subsystems/persistence.md +185 -194
- package/kb/site/en/reference/subsystems/plan.md +3 -3
- package/kb/site/en/reference/subsystems/sandbox.md +2 -0
- package/kb/site/en/reference/subsystems/schedule.md +9 -3
- package/kb/site/en/reference/subsystems/session-projection.md +50 -24
- package/kb/site/en/reference/subsystems/session-query.md +19 -13
- package/kb/site/en/reference/subsystems/session-reference.md +25 -1
- package/kb/site/en/reference/subsystems/session-telemetry.md +6 -5
- package/kb/site/en/reference/subsystems/session-title.md +6 -6
- package/kb/site/en/reference/subsystems/session.md +156 -73
- package/kb/site/en/reference/subsystems/settings.md +30 -12
- package/kb/site/en/reference/subsystems/skills.md +1 -1
- package/kb/site/en/reference/subsystems/slots.md +1 -0
- package/kb/site/en/reference/subsystems/storage.md +28 -5
- package/kb/site/en/reference/subsystems/subagent.md +43 -97
- package/kb/site/en/reference/subsystems/system-prompt.md +16 -3
- package/kb/site/en/reference/subsystems/token-meter.md +2 -2
- package/kb/site/en/reference/subsystems/typert.md +18 -18
- package/kb/site/en/reference/subsystems/web-client.md +1 -1
- package/kb/site/en/reference/subsystems/workspace.md +8 -8
- package/kb/site/en/reference/tool-catalog.md +10 -64
- package/kb/site/guide/network-proxy.md +87 -0
- package/kb/site/guide/providers.md +70 -17
- package/kb/site/guide/schedule.md +2 -0
- package/kb/site/reference/agent-lifecycle.md +5 -3
- package/kb/site/reference/api-gateway.md +2 -2
- package/kb/site/reference/capability-seams.md +14 -7
- package/kb/site/reference/config-catalog.md +156 -229
- package/kb/site/reference/cookbook/adding-a-package.md +1 -2
- package/kb/site/reference/cookbook/adding-a-settings-card.md +10 -8
- package/kb/site/reference/cookbook/extension-cookbook.md +15 -12
- package/kb/site/reference/index.md +11 -4
- package/kb/site/reference/persistence-catalog.md +91 -70
- package/kb/site/reference/subsystems/code-runtime.md +7 -3
- package/kb/site/reference/subsystems/commands.md +25 -16
- package/kb/site/reference/subsystems/compaction.md +9 -9
- package/kb/site/reference/subsystems/conversation.md +11 -4
- package/kb/site/reference/subsystems/core.md +96 -15
- package/kb/site/reference/subsystems/credentials.md +5 -4
- package/kb/site/reference/subsystems/goal.md +1 -1
- package/kb/site/reference/subsystems/index.md +1 -1
- package/kb/site/reference/subsystems/llm-streaming.md +24 -3
- package/kb/site/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/reference/subsystems/persistence.md +184 -193
- package/kb/site/reference/subsystems/plan.md +3 -3
- package/kb/site/reference/subsystems/schedule.md +9 -3
- package/kb/site/reference/subsystems/session-projection.md +50 -24
- package/kb/site/reference/subsystems/session-query.md +19 -13
- package/kb/site/reference/subsystems/session-reference.md +25 -1
- package/kb/site/reference/subsystems/session-telemetry.md +6 -5
- package/kb/site/reference/subsystems/session-title.md +6 -6
- package/kb/site/reference/subsystems/session.md +156 -73
- package/kb/site/reference/subsystems/settings.md +30 -12
- package/kb/site/reference/subsystems/skills.md +1 -1
- package/kb/site/reference/subsystems/slots.md +1 -0
- package/kb/site/reference/subsystems/storage.md +28 -5
- package/kb/site/reference/subsystems/subagent.md +43 -97
- package/kb/site/reference/subsystems/system-prompt.md +16 -3
- package/kb/site/reference/subsystems/token-meter.md +2 -2
- package/kb/site/reference/subsystems/typert.md +18 -18
- package/kb/site/reference/subsystems/web-client.md +1 -1
- package/kb/site/reference/subsystems/workspace.md +8 -8
- package/kb/site/reference/tool-catalog.md +9 -63
- package/package.json +2 -2
- package/skills/dsh-plugin-dev-kb.md +4 -4
|
@@ -261,7 +261,7 @@ Host service backing `ctx.remote.skills` without activating a cold Agent.
|
|
|
261
261
|
* @param request - Session identity whose cwd and preset select the catalog view.
|
|
262
262
|
* @param signal - caller lifetime carried by the Remote transport; admitted catalog reads retain their existing completion semantics.
|
|
263
263
|
* @returns user-invocable skill metadata without loading skill bodies.
|
|
264
|
-
* @throws
|
|
264
|
+
* @throws RemoteError when the Session cannot be inspected or no registry can serve it.
|
|
265
265
|
*/
|
|
266
266
|
@Remote async list(request: SkillListRequest, signal: AbortSignal): Promise<SkillListValue>
|
|
267
267
|
```
|
|
@@ -138,6 +138,7 @@ root
|
|
|
138
138
|
│ │ │ ├─ conversation.chat.commandview
|
|
139
139
|
│ │ │ ├─ conversation.chat.turnTail
|
|
140
140
|
│ │ │ └─ tool.call.toolview
|
|
141
|
+
│ │ │ ├─ tool.call.images
|
|
141
142
|
│ │ │ └─ tool.view.cordis
|
|
142
143
|
│ │ ├─ conversation.message.images
|
|
143
144
|
│ │ └─ conversation.trajectory.images
|
|
@@ -47,7 +47,7 @@ interface StorageBackend {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
一个后端拥有一个介质(一棵文件树的根目录、一个数据库文件),并提供可选的操作组;`kv` 是唯一已交付的操作组。`KvFacet.open(descriptor)` 打开一个具名 unit——`KvUnitDescriptor`
|
|
50
|
+
一个后端拥有一个介质(一棵文件树的根目录、一个数据库文件),并提供可选的操作组;`kv` 是唯一已交付的操作组。`KvFacet.open(descriptor)` 打开一个具名 unit——`KvUnitDescriptor` 携带名称、当前格式版本、可选的兼容记录版本、表名清单,以及是否存在全局单例 slot——并返回提供 `loadAll`、`putRecord`、`deleteRecord`、`setGlobal` 和 `close` 的 `KvUnit`。unit 名与表名必须匹配 `UNIT_NAME_RE`(既可安全用作文件名,也可安全用作 SQL 标识符片段);记录键是任意字符串,绝不进入文件路径。unit 不对并发写入做串行化——顺序由调用方负责——但每次单独调用在介质上都是原子的,且 resolve 后即已持久。`single` 介质上记录的版本不同时拒绝 `version-mismatch`;`per-record` 文档的版本在接受集合之外时读作不存在。无法按该 unit 解析的介质拒绝 `malformed-medium`。[`backend.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage/src/backend.ts) 是逐条款的规范性约定,[`tests/contract.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage/tests/contract.ts) 中的共享一致性套件会针对每个后端检查每项条款。[json 后端](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage-json/README.zh.md)以原子方式为每个 unit 整文件重新发布一份人类可读文件;[sqlite 后端](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/storage/storage-sqlite/README.zh.md)在单个数据库中每行存储一份文档,用于频繁更新的数据。
|
|
51
51
|
|
|
52
52
|
## 声明领域
|
|
53
53
|
|
|
@@ -58,16 +58,36 @@ interface StorageBackend {
|
|
|
58
58
|
interface DomainSpec {
|
|
59
59
|
/** Domain name; must match `UNIT_NAME_RE` (doubles as the backend unit name). */
|
|
60
60
|
readonly name: string
|
|
61
|
-
/**
|
|
61
|
+
/** Current domain format version; reads enforce it according to the selected layout. */
|
|
62
62
|
readonly version: number
|
|
63
63
|
/**
|
|
64
64
|
* Medium layout for the backend unit: `single` (the default) stores the
|
|
65
65
|
* whole unit as one document; `per-record` stores each record as its own
|
|
66
66
|
* document, for units whose records are large, sparse, or individually
|
|
67
|
-
* disposable — the projection cache — and scopes version
|
|
68
|
-
* (
|
|
67
|
+
* disposable — the projection cache — and scopes version checks per record
|
|
68
|
+
* (an unaccepted record document is discarded, never migrated).
|
|
69
69
|
*/
|
|
70
70
|
readonly layout?: 'single' | 'per-record'
|
|
71
|
+
/**
|
|
72
|
+
* Older domain versions whose stored records the current record schemas
|
|
73
|
+
* also accept (the declaring owner vouches for that, typically by
|
|
74
|
+
* declaring the fields older records lack as optional). `per-record` backends
|
|
75
|
+
* read documents stamped with a listed version instead of discarding them,
|
|
76
|
+
* and accept a legacy whole-unit file so stamped for the one-time
|
|
77
|
+
* bootstrap; writes always stamp {@link version}.
|
|
78
|
+
*/
|
|
79
|
+
readonly compatibleVersions?: readonly number[]
|
|
80
|
+
/**
|
|
81
|
+
* What `open` does with a stored table record that fails its zod schema.
|
|
82
|
+
* Absent (the default), the whole open rejects with `invalid-record` —
|
|
83
|
+
* right for authoritative data. `'backup-and-skip'` is for domains whose
|
|
84
|
+
* records are disposable derived data: the backend moves the record's
|
|
85
|
+
* document aside (`KvUnit.backupRecord`), the failure is logged with
|
|
86
|
+
* its cause, and the open continues with the record absent. A backend
|
|
87
|
+
* without `backupRecord` (no per-record document to move) falls back
|
|
88
|
+
* to the rejecting default. The global slot always rejects.
|
|
89
|
+
*/
|
|
90
|
+
readonly invalidRecords?: 'backup-and-skip'
|
|
71
91
|
/** Optional global singleton slot. */
|
|
72
92
|
readonly global?: DomainGlobalSpec<unknown>
|
|
73
93
|
/** Table declarations keyed by table name; each name must match `UNIT_NAME_RE`. */
|
|
@@ -183,7 +203,10 @@ The mounted domain facility. Opens declared domains over routed backends; one fa
|
|
|
183
203
|
* (`facet-unsupported`); open the unit projected from the spec (backend
|
|
184
204
|
* `version-mismatch`/`malformed-medium` pass through); load and validate
|
|
185
205
|
* every stored record against the spec's zod schemas (`invalid-record`
|
|
186
|
-
* with the offending table and key
|
|
206
|
+
* with the offending table and key — unless the spec declares
|
|
207
|
+
* `invalidRecords: 'backup-and-skip'` and the unit can move documents aside, in
|
|
208
|
+
* which case the failing record is backed up, logged, and skipped);
|
|
209
|
+
* construct the domain.
|
|
187
210
|
*
|
|
188
211
|
* Lifecycle: the CALLER owns the returned handle and closes it via
|
|
189
212
|
* `Domain.close()` (typically as its own `ctx.effect` disposer) — the
|
|
@@ -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`、`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)
|
|
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
|
|
|
@@ -136,21 +136,21 @@ persisted Session
|
|
|
136
136
|
|
|
137
137
|
`SubagentRuntime.startContinuable()` 会预留稳定的子 agent id,对版本化的 `subagent/descriptor` payload 建立快照,向指定提供方索取其分离的 `ContinuableCreateSpec`,通过私有的 activation-owner 作用域创建子 Agent,建立任何可继续父级的所有权,并提交初始提示词。当收件箱(inbox)准入产出消息 id 时,它以 `{ childId, messageId }` resolve——无需等待轮次开始,也无需等待消息进入会话日志。在该准入之前的任何失败都会以两个 id 都不返回的方式 reject,并 dispose(资源释放)任何已创建的 handle,回滚 Activation 与父级所有权。
|
|
138
138
|
|
|
139
|
-
`SubagentRuntime.
|
|
139
|
+
`SubagentRuntime.sendMessage()` 是唯一由模型编写消息的操作。它接收确切在线 sender 与目标 id,只允许直接 parent 或直接可继续 child,自行推导 sender 来源信息,并根据目标 child 的 Activation 驻留状态路由:
|
|
140
140
|
|
|
141
|
-
| Activation 状态 | `
|
|
141
|
+
| 目标 Activation 状态 | `sendMessage` |
|
|
142
142
|
|---|---|
|
|
143
|
-
| `running` | 在同一 Activation
|
|
144
|
-
| `waiting` |
|
|
145
|
-
| 无 Activation |
|
|
143
|
+
| `running` | 在同一 Activation 中 steer 最近的 step |
|
|
144
|
+
| `waiting` | 唤醒并 steer 同一 Activation |
|
|
145
|
+
| 无 Activation | 冷恢复新的 Activation,然后 steer |
|
|
146
146
|
|
|
147
147
|
`running` 表示 Agent 拥有活跃的准入或轮次,或正在唤醒收件箱工作;`waiting` 表示它已完全停稳,但仍拥有至少一个尚未完成 dispose 的子 Activation;`settled` 表示已完全停稳且其拥有的每个子级都已 dispose,此时管理器会 dispose [`AgentHandle`](./core.md#creation-and-ownership) 并移除该 Activation。管理器根据 Agent 的完全停稳状态与其拥有的子级集合推导这些内部条件,而非维护第二套执行状态机。
|
|
148
148
|
|
|
149
|
-
Agent
|
|
149
|
+
Agent 收件箱是唯一队列。每条 Agent 消息都使用 `Agent.steer()`:空闲目标会启动一个轮次,运行中目标则在最近的 step 边界领取消息。投递成功会返回被接受的 `MessageId`;既有的 `agent/inbox/inserted`、`agent/inbox/claimed` 与 `agent/inbox/discarded` 事件仍是消息生命周期的观测点,继续执行层不定义任何 subagent 专属的投递路由。
|
|
150
150
|
|
|
151
|
-
|
|
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,但不授予权限。
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
对于 `startContinuable()` 与 `sendMessage()`,调用方 signal 仅在收件箱接受之前掌管查找、物化与准入。此后管理器独立掌管该 Activation:之后的调用方取消既不会取消已接受的轮次,也不会 dispose 子 agent。浏览器中的人类提示仍由私有 Queue 适配器处理,因此继续产生独立 FIFO 轮次。
|
|
154
154
|
|
|
155
155
|
`SubagentRuntime.interrupt(targetSessionId, authority)` 是唯一的公开停止操作:它同步完成鉴权,对在线目标发出 `Agent.cancel(cause, { keepInbox: true })`,然后不等待完全停稳即返回。Activation、其尚未领取的待处理 inbox 工作与已发布的后代均不受影响;已被领取进入中断轮次的工作不会重新入队。被中断的 driver 进入 idle 后,一次唤醒发送会恢复被暂停的 FIFO 队列。不存在的目标——未知、一次性或已结算——以及未绑定管理器的组合是被接受的 no-op。对在线目标,错误的 parent 地址或不在其在线祖先链中的调用方会以 `UNAUTHORIZED` 拒绝;陈旧的 ancestor 对象和指向自身的 ancestor 请求会在查找目标前拒绝。
|
|
156
156
|
|
|
@@ -170,21 +170,19 @@ type SubagentInterruptAuthority =
|
|
|
170
170
|
最终结算会等待 `ctx.sessions.flush(session)`,但会忽略其参与布尔值,因为任意 listener 都无法证明某个持久化后端已存储该状态。rejection 会被记录,但不会使 Activation 失败;管理器仍会 dispose 该 handle 并释放所有权,此后持久化的子 agent 状态在后续恢复时可能缺失或陈旧。管理器卸载会调用内部的管理器全局 drain,关闭准入并 dispose 每片在线森林;`drainContinuableDescendants(parents)` 只关闭由 host 确切拥有的在线 Agent 之下的准入,并 dispose 其可继续后代,而无关森林保持在线。两者都会等待各自作用域内已获准的物化过程,自顶向下传播取消,按 child-first 顺序释放 handle,并且即使个别分支失败也会等待所有选中分支。持久化子会话不受该进程内拆卸的影响。
|
|
171
171
|
|
|
172
172
|
```ts type-equiv
|
|
173
|
-
/**
|
|
174
|
-
interface
|
|
175
|
-
readonly kind: '
|
|
173
|
+
/** Durable attribution for one model-authored message between adjacent Agents. */
|
|
174
|
+
interface AgentMessageSource {
|
|
175
|
+
readonly kind: 'agent-message'
|
|
176
176
|
/** A message another agent addressed to this one (`relay` context form). */
|
|
177
177
|
readonly form: 'relay'
|
|
178
|
-
/** Session id of the
|
|
178
|
+
/** Session id of the Agent whose tool call produced the message. */
|
|
179
179
|
readonly senderSessionId: SessionId
|
|
180
180
|
}
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
```ts type-equiv
|
|
184
|
-
/** Options for
|
|
185
|
-
interface
|
|
186
|
-
/** Durable attribution retained on the delivered message; it grants no authority. */
|
|
187
|
-
readonly source: MessageSource
|
|
184
|
+
/** Options for one model-authored message between adjacent Agents. */
|
|
185
|
+
interface SubagentSendMessageOptions {
|
|
188
186
|
/** Caller cancellation, owning the operation only until inbox acceptance. */
|
|
189
187
|
readonly signal: AbortSignal
|
|
190
188
|
}
|
|
@@ -200,33 +198,13 @@ interface ContinuableStart {
|
|
|
200
198
|
}
|
|
201
199
|
```
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
`SubagentRuntime.reportFrom()` 通过该扩展点实现报告,无需新增第二条队列或承载结果的 child 包装层。调用由确切的在线 child Agent 授权,调用方不能指定接收方。管理器从 child 的持久化 `parentSession` 中推导唯一接收方,要求该 parent Agent 必须在线,将选中内容封装为一条 `subagent-report` 用户消息,并返回该消息的稳定 `MessageId`。静默投递使用 `Agent.inject()`,不会唤醒 parent;next-step 投递使用 `Agent.steer()`,会唤醒空闲 parent,或加入运行中 parent 最近的 step 边界。两种模式都不会结束 child 轮次,最终回答也不会隐式报告。
|
|
206
|
-
|
|
207
|
-
```ts type-equiv
|
|
208
|
-
/** Durable attribution for a continuable child's explicit parent report. */
|
|
209
|
-
interface SubagentReportMessageSource {
|
|
210
|
-
readonly kind: 'subagent-report'
|
|
211
|
-
/** A message another agent addressed to this one (`relay` context form). */
|
|
212
|
-
readonly form: 'relay'
|
|
213
|
-
/** Session id of the reporting child. */
|
|
214
|
-
readonly senderSessionId: SessionId
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
```ts type-equiv
|
|
219
|
-
/** Deployment scheduling policy for accepted child reports. */
|
|
220
|
-
type SubagentReportDelivery = 'quiet' | 'next-step'
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
上报是 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 自己写下的内容。
|
|
224
202
|
|
|
225
203
|
```ts type-equiv
|
|
226
204
|
/**
|
|
227
205
|
* Durable attribution for the runtime's own account of a continuable child
|
|
228
206
|
* settling. Deliberately a different kind from
|
|
229
|
-
* {@link
|
|
207
|
+
* {@link AgentMessageSource}: an Agent message is content the sender chose,
|
|
230
208
|
* while this message is the manager stating what became of the child, and a
|
|
231
209
|
* transcript that merged them would credit the child with words it never wrote.
|
|
232
210
|
*/
|
|
@@ -241,16 +219,6 @@ interface SubagentSettledMessageSource {
|
|
|
241
219
|
}
|
|
242
220
|
```
|
|
243
221
|
|
|
244
|
-
```ts type-equiv
|
|
245
|
-
/** Options for one continuable child's report to its direct parent. */
|
|
246
|
-
interface SubagentReportOptions {
|
|
247
|
-
/** Already-resolved parent scheduling policy. */
|
|
248
|
-
readonly delivery: SubagentReportDelivery
|
|
249
|
-
/** Caller cancellation, owning authorization and admission until acceptance. */
|
|
250
|
-
readonly signal: AbortSignal
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
222
|
提供方只参与准备初始创建 spec,`spawn` 与 `fork` 在此有所不同。其返回的 spec 只携带分离的、提供方专属的创建输入——即可选的父级历史种子——不含 Agent、`AgentHandle`、提示词投递、结果、dispose 或恢复操作。冷恢复根本不经由提供方分发:管理器折叠通用描述符,通过同一个 activation-owner 作用域调用 `ctx.agents.resume()`,并提交等待中的轮次。
|
|
255
223
|
|
|
256
224
|
```ts type-equiv
|
|
@@ -293,11 +261,11 @@ interface ContinuableCreateSpec {
|
|
|
293
261
|
|
|
294
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 的结果约定,而非持久化身份)。
|
|
295
263
|
|
|
296
|
-
本地一次性提供方会在子 agent 的初始轮次内、首次请求前追加描述符。继续执行管理器会在任何提供方提供的谱系之后、初始提示词获准之前追加描述符;`
|
|
264
|
+
本地一次性提供方会在子 agent 的初始轮次内、首次请求前追加描述符。继续执行管理器会在任何提供方提供的谱系之后、初始提示词获准之前追加描述符;`Session.inheritedEventCount` 仍是 fork 谱系边界:恢复时的描述符权威读取子 agent 自身的后缀,而供列表使用的身份投影以 last-wins 折叠 `subagent/descriptor`,子 agent 自己的描述符会覆盖 fork seed 中祖先的描述符。seeded cold list 会跳过 cache hint,直到权威 observation 提供该精确 cut。该事件只进入日志:不含 `surfaceOp`,绝不进入模型历史,并由仅追加日志跨压缩保留。格式错误的当前版本描述符属于损坏;本运行时无法对不受支持的版本进行分类。
|
|
297
265
|
|
|
298
266
|
## 持久化枚举:`listChildren()`、`listDescendants()` 与其条目
|
|
299
267
|
|
|
300
|
-
`SubagentRuntime.listChildren(parentSessionId)` 从 `ctx.sessions
|
|
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)。
|
|
301
269
|
|
|
302
270
|
`SubagentRuntime.listDescendants(rootSessionId)` 将同一份实时优先语料与基于投影的解释应用到根的完整后代树,并按稳定 pre-order 输出。普通会话和一次性 child 仍作为遍历节点,因此其下的可继续后代仍可发现;只有 `origin: 'subagent'` 的候选会生成条目。每个返回的 child 或 diagnostic 都从枚举所得的持久 header 附加树位置;冷检查在提供身份前还会重新校验完整生命周期:
|
|
303
271
|
|
|
@@ -539,21 +507,20 @@ Named provider registry with one-shot runs, durable discovery, and continuable-c
|
|
|
539
507
|
async startContinuable(spec: ContinuableStartSpec): Promise<ContinuableStart>
|
|
540
508
|
|
|
541
509
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* @param
|
|
548
|
-
* @param
|
|
549
|
-
* @param content -
|
|
550
|
-
* @param options -
|
|
551
|
-
* 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.
|
|
552
519
|
* @returns the accepted message's inbox id.
|
|
553
|
-
* @throws when continuation services are unavailable,
|
|
554
|
-
*
|
|
520
|
+
* @throws when continuation services are unavailable, adjacency is rejected,
|
|
521
|
+
* or the message was not admitted.
|
|
555
522
|
*/
|
|
556
|
-
async
|
|
523
|
+
async sendMessage( sender: Agent, targetId: SessionId, content: ContentBlock[], options: SubagentSendMessageOptions, ): Promise<MessageId>
|
|
557
524
|
|
|
558
525
|
/**
|
|
559
526
|
* Interrupt one live continuable child's current turn under a human parent
|
|
@@ -572,29 +539,6 @@ async followup( parent: Agent, childId: SessionId, content: ContentBlock[], opti
|
|
|
572
539
|
*/
|
|
573
540
|
interrupt(targetSessionId: SessionId, authority: SubagentInterruptAuthority): void
|
|
574
541
|
|
|
575
|
-
/**
|
|
576
|
-
* Deliver selected content from one live continuable child to its durable
|
|
577
|
-
* direct parent. The child is the authority credential; callers cannot name a
|
|
578
|
-
* recipient. Reporting does not conclude the child's turn or Activation.
|
|
579
|
-
* @param child - exact live reporting child.
|
|
580
|
-
* @param content - selected model-facing content.
|
|
581
|
-
* @param options - parent scheduling and pre-acceptance cancellation.
|
|
582
|
-
* @returns the stable identity of the parent-accepted message.
|
|
583
|
-
* @throws when continuation services are unavailable, sender authorization
|
|
584
|
-
* fails, or the direct parent is not live.
|
|
585
|
-
*/
|
|
586
|
-
async reportFrom( child: Agent, content: ContentBlock[], options: SubagentReportOptions, ): Promise<MessageId>
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* Compose one deployment capability into every continuable child's
|
|
590
|
-
* unpublished creation context on fresh creation and cold resume. Grants wait
|
|
591
|
-
* for the next Activation; removing the contribution revokes every resident
|
|
592
|
-
* installation immediately.
|
|
593
|
-
* @param contribution - synchronous child-scope installer.
|
|
594
|
-
* @returns the exact Cordis effect disposer.
|
|
595
|
-
*/
|
|
596
|
-
registerContinuableSetup(contribution: ContinuableSetupContribution): () => void
|
|
597
|
-
|
|
598
542
|
/**
|
|
599
543
|
* Close continuable admission below exact live parent Agents, stop only their
|
|
600
544
|
* visible descendant Activations synchronously, then await admitted scoped
|
|
@@ -664,9 +608,9 @@ listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<Subagen
|
|
|
664
608
|
* @param parentSessionId - parent session whose direct children are listed.
|
|
665
609
|
* @param signal - carrier cancellation forwarded to Session queries.
|
|
666
610
|
* @returns the catalog view for that parent.
|
|
667
|
-
* @throws {
|
|
668
|
-
* `cancelled` for an aborted read, `subagent
|
|
669
|
-
* the deployment has no projection registry, otherwise `internal`.
|
|
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`.
|
|
670
614
|
*/
|
|
671
615
|
@Remote('list') async remoteExportList(parentSessionId: SessionId, signal: AbortSignal): Promise<SubagentCatalog>
|
|
672
616
|
|
|
@@ -676,13 +620,15 @@ listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<Subagen
|
|
|
676
620
|
* validated browser zone on the accepted message. Success identifies the
|
|
677
621
|
* message the child's FIFO inbox accepted; later execution is independent of
|
|
678
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.
|
|
679
625
|
* @param request - durable address, minted identity, content, and optional browser zone.
|
|
680
626
|
* @param signal - carrier cancellation, owning the call until inbox acceptance.
|
|
681
627
|
* @returns the accepted message's inbox identity.
|
|
682
|
-
* @throws {
|
|
683
|
-
* `subagent-
|
|
684
|
-
* `subagent-
|
|
685
|
-
* `internal`.
|
|
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`.
|
|
686
632
|
*/
|
|
687
633
|
@Remote('prompt') async prompt(request: SubagentPromptRequest, signal: AbortSignal): Promise<SubagentPromptReceipt>
|
|
688
634
|
|
|
@@ -696,9 +642,9 @@ listDescendants(rootSessionId: SessionId, signal?: AbortSignal): Promise<Subagen
|
|
|
696
642
|
* @param parentSessionId - durable direct parent whose authority is claimed.
|
|
697
643
|
* @param mode - required continuable-address discriminator.
|
|
698
644
|
* @returns acknowledgement that the cancel signal was admitted, not that the target is quiescent.
|
|
699
|
-
* @throws {
|
|
700
|
-
* `subagent
|
|
701
|
-
* otherwise `internal`.
|
|
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`.
|
|
702
648
|
*/
|
|
703
649
|
@Remote('interruptByParent') interruptByParent( childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable', ): SubagentInterruptReceipt
|
|
704
650
|
|
|
@@ -42,7 +42,7 @@ interface ToolProviderResult {
|
|
|
42
42
|
|
|
43
43
|
## 提示词段落
|
|
44
44
|
|
|
45
|
-
`PromptSection` 是一份只读的同进程注册约定。其文本可以是静态的,也可以从当前组装上下文动态解析。各段先按 order
|
|
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). */
|
|
@@ -51,8 +51,7 @@ interface PromptSection {
|
|
|
51
51
|
readonly name: string
|
|
52
52
|
/**
|
|
53
53
|
* Sections are concatenated in ascending order. Equal orders use code-unit
|
|
54
|
-
* name order.
|
|
55
|
-
* {@link FIRST_PARTY_SECTION_ORDER}.
|
|
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,7 +15,7 @@ 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:
|
|
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. */
|
|
@@ -37,7 +37,7 @@ 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:
|
|
40
|
+
readonly seq: SessionSeq
|
|
41
41
|
/**
|
|
42
42
|
* Request-pressure tokens for the exact message projected by this node under
|
|
43
43
|
* the measured route: image occurrences carry the route's declared visual
|
|
@@ -142,7 +142,7 @@ interface TypertRemoteNamespaceMap {}
|
|
|
142
142
|
|
|
143
143
|
## Host Gateway
|
|
144
144
|
|
|
145
|
-
Connection 会先解码 carrier envelope,再调用 `ctx.typertGateway`。请求将精确的具名 wire 字段与 carrier 的取消 signal
|
|
145
|
+
Connection 会先解码 carrier envelope,再调用 `ctx.typertGateway`。请求将精确的具名 wire 字段与 carrier 的取消 signal 分开携带;基础设施与边界失败由 `TypertGatewayError` 承载,其 `gateway/*` 码就是普通的 `RemoteError` 码,因此 RPC 适配器会把每个经结构识别的 `RemoteError` 连同其 code 与 details 原样放行,只把无法识别的异常归并为 `gateway/internal`。
|
|
146
146
|
|
|
147
147
|
```ts type-equiv
|
|
148
148
|
/** One Remote method request after a carrier has decoded its envelope. */
|
|
@@ -161,23 +161,23 @@ interface InvokeRemoteRequest {
|
|
|
161
161
|
```ts type-equiv
|
|
162
162
|
/** Stable infrastructure and boundary failures emitted before or after business execution. */
|
|
163
163
|
type TypertGatewayErrorCode =
|
|
164
|
-
| 'ambiguous-endpoint'
|
|
165
|
-
| 'arguments-invalid'
|
|
166
|
-
| 'binding-invalid'
|
|
167
|
-
| 'context-failed'
|
|
168
|
-
| 'context-not-found'
|
|
169
|
-
| 'context-unavailable'
|
|
170
|
-
| 'definition-unavailable'
|
|
171
|
-
| 'input-invalid'
|
|
172
|
-
| 'invocation-unavailable'
|
|
173
|
-
| 'lookup-failed'
|
|
174
|
-
| 'lookup-not-found'
|
|
175
|
-
| 'lookup-unavailable'
|
|
176
|
-
| 'method-unavailable'
|
|
177
|
-
| 'provider-mismatch'
|
|
178
|
-
| 'result-invalid'
|
|
179
|
-
| 'service-unavailable'
|
|
180
|
-
| 'signature-invalid'
|
|
164
|
+
| 'gateway/ambiguous-endpoint'
|
|
165
|
+
| 'gateway/arguments-invalid'
|
|
166
|
+
| 'gateway/binding-invalid'
|
|
167
|
+
| 'gateway/context-failed'
|
|
168
|
+
| 'gateway/context-not-found'
|
|
169
|
+
| 'gateway/context-unavailable'
|
|
170
|
+
| 'gateway/definition-unavailable'
|
|
171
|
+
| 'gateway/input-invalid'
|
|
172
|
+
| 'gateway/invocation-unavailable'
|
|
173
|
+
| 'gateway/lookup-failed'
|
|
174
|
+
| 'gateway/lookup-not-found'
|
|
175
|
+
| 'gateway/lookup-unavailable'
|
|
176
|
+
| 'gateway/method-unavailable'
|
|
177
|
+
| 'gateway/provider-mismatch'
|
|
178
|
+
| 'gateway/result-invalid'
|
|
179
|
+
| 'gateway/service-unavailable'
|
|
180
|
+
| 'gateway/signature-invalid'
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
```ts type-equiv
|
|
@@ -58,7 +58,7 @@ Connection 拥有 request correlation、`/api` carrier、trust check、精确 Fe
|
|
|
58
58
|
|
|
59
59
|
`ui-session` 安装 `session` scope adapter,并提供 `useSessions`、`useSession`、`sessionId` 和 `useProjection`。领域 adapter 可以继续添加标准 source,但不会把 React hook 放进 model object。
|
|
60
60
|
|
|
61
|
-
`ui-conversation` 对每个 `SessionBinding.eventSource` 只绑定一次。它的 event registry
|
|
61
|
+
`ui-conversation` 对每个 `SessionBinding.eventSource` 只绑定一次。它的 event registry 把持久 Session event 与 Client-only `assistant/live-chunk` update 关联成稳定的业务 Context,view registry 则 materialize target snapshot。Chat Assistant、Trajectory Assistant 与 Turn Tail 同时解释 live chunk 和持久 settlement 中嵌入的紧凑 stream,因此重连与分页历史无需持久 token 行即可复现相同 Assistant 状态。`ui-chat` 与 `ui-trajectory` 分别注册自己的 Definition 和 builder:它们可以解释同一 event family,但不会导入或共享彼此的最终 display model。Shell 选择一个已注册 view,再通过标准 hook 与 Slot 交付其 snapshot。[Conversation](./conversation.md)定义 Context identity、replay、Location data、target builder 与 keyed renderer。
|
|
62
62
|
|
|
63
63
|
`ui-slots` 提供类型化 registry 与 lifecycle ledger;`ui-renderer` 是唯一通过 `useSyncExternalStore` 绑定裸 observable、拥有 React context 并渲染 root tree 的包。功能 component 通过推导出的 props 接收 framework hook、owner prop、store action 与显式 injection。[Web Client Slots](./slots.md)列出这些输入、扩展 API 与当前 Slot 层级。
|
|
64
64
|
|
|
@@ -43,7 +43,7 @@ interface Workspace {
|
|
|
43
43
|
*/
|
|
44
44
|
readonly path: string
|
|
45
45
|
|
|
46
|
-
/** Display title. Defaults to
|
|
46
|
+
/** Display title. Defaults to the final path segment, or a filesystem root's own spelling; duplicates are allowed. */
|
|
47
47
|
readonly title: string
|
|
48
48
|
|
|
49
49
|
/** ISO-8601 creation instant, stamped at create and never rewritten. */
|
|
@@ -120,7 +120,7 @@ interface Workspace {
|
|
|
120
120
|
|
|
121
121
|
## 注册表:`ctx.workspaceRegistry`
|
|
122
122
|
|
|
123
|
-
`WorkspaceRegistry`([签名](#ctxworkspaceregistry--workspaceregistry))拥有注册与解析。`create(path, title?)`
|
|
123
|
+
`WorkspaceRegistry`([签名](#ctxworkspaceregistry--workspaceregistry))拥有注册与解析。`create(path, title?)` 要求完全限定路径并将其规范化,拒绝不存在的路径(原样传出原始 `ENOENT`)或非目录;当规范路径已被拥有时原样返回既有实体;否则创建一条标题为 `title ?? defaultWorkspaceTitle(path)` 的记录并前插到持久的注册表顺序中(不同规范路径可以共享同一显示标题,没有最终路径段时使用根路径拼写)。`get(id)` 与有序的 `list()` 是同步缓存读取;`resolveByPath(path)` 应用同一套完全限定 realpath 规范但不创建。`delete(id)` 只移除注册记录、顺序条目和会话账本——目录、用户文件、实时会话和已持久化日志一概不动,因此这些会话变为 Ungrouped([决策](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-07-27-workspace-registration-deletion.zh.md));未知 id 返回 `false`。create 与 delete 会在其两次写入(记录 + 顺序)可能分叉之前先持久写入一个待定变更标记;启动时恰好解决被标记的那次变更——通过删除被标记的表行:这会补完被中断的 delete,并回滚被中断的 create(注册可以重建,因此回滚是安全方向)——而没有标记的顺序/表不一致则作为损坏大声失败。
|
|
124
124
|
|
|
125
125
|
会话的 cwd 在创建时由创建者赋予,而不是由本注册表赋予——API 网关从所选工作区的 `path` 解析新会话的 cwd(回退到显式或默认 cwd),先创建会话使 cwd 落入其不可变的 [`SessionHeader`](./persistence.md#sessionheader--metadata-beside-the-log),再调用 `attachSession`,后者会把已存储的 header cwd 与工作区路径重新校验一遍。首次成功启动时,注册表仅凭已持久化的 header(`id`、`cwd`、`createdAt`——绝不读事件正文)引导历史:把规范 cwd 有效的会话按目录分组为工作区,最新的排在最前;「已初始化」标记最后写入,因此被中断的引导可以安全续跑。引导只发生这一次:没有 cwd 的历史遗留会话保持 Ungrouped,此后创建的会话只能通过 `attachSession` 加入工作区。
|
|
126
126
|
|
|
@@ -253,13 +253,13 @@ Durable workspace registry. Startup waits for `sessionPersistence`, builds one c
|
|
|
253
253
|
|
|
254
254
|
```ts cordis-catalog
|
|
255
255
|
/**
|
|
256
|
-
* Create or reuse a workspace for an existing directory. The
|
|
257
|
-
* canonicalized through `fs.realpath`; a nonexistent
|
|
258
|
-
*
|
|
259
|
-
*
|
|
256
|
+
* Create or reuse a workspace for an existing directory. The fully qualified
|
|
257
|
+
* path is canonicalized through `fs.realpath`; a relative, nonexistent, or
|
|
258
|
+
* non-directory path rejects. Repeated calls for the same canonical path
|
|
259
|
+
* return the existing entity without changing its title.
|
|
260
260
|
* A newly created workspace is prepended to the durable registry order.
|
|
261
261
|
* Different canonical paths may share a display title.
|
|
262
|
-
* @param path - Existing directory to own, in
|
|
262
|
+
* @param path - Existing directory to own, in a fully qualified path spelling.
|
|
263
263
|
* @param title - Display title used only when a new record is created.
|
|
264
264
|
* @returns the existing or newly durable workspace.
|
|
265
265
|
*/
|
|
@@ -312,7 +312,7 @@ archiveSession(sessionId: SessionId): Promise<void>
|
|
|
312
312
|
* Resolve by canonical directory path without creating or mutating a
|
|
313
313
|
* workspace. A missing path rejects during `realpath`; an existing unowned
|
|
314
314
|
* directory returns `undefined`.
|
|
315
|
-
* @param path - Existing directory path in
|
|
315
|
+
* @param path - Existing directory path in a fully qualified spelling.
|
|
316
316
|
* @returns the workspace owning the canonical path, when one exists.
|
|
317
317
|
*/
|
|
318
318
|
async resolveByPath(path: string): Promise<Workspace | undefined>
|