dsh-plugin-dev-kb 1.0.9 → 1.3.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 +26 -0
- package/README.en.md +14 -8
- package/README.md +14 -8
- package/docs/banner.svg +25 -0
- package/kb/INDEX.md +8 -2
- package/kb/README.md +4 -4
- package/kb/extra/AGENTS.md +3 -3
- 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/cookbook/adding-a-session-format-version.md +109 -0
- package/kb/extra/cookbook/adding-a-session-format-version.zh.md +109 -0
- package/kb/extra/cookbook/adding-a-vendored-package.md +1 -1
- package/kb/extra/cookbook/adding-a-vendored-package.zh.md +1 -1
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.md +1 -1
- package/kb/extra/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
- package/kb/extra/deepseek-llm-api-wire-extensions.md +19 -15
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +19 -15
- package/kb/extra/development.md +13 -3
- package/kb/extra/development.zh.md +13 -3
- package/kb/extra/event-producer-consumer.md +49 -46
- package/kb/extra/event-producer-consumer.zh.md +52 -49
- package/kb/extra/i18n/README.md +2 -1
- package/kb/extra/i18n/README.zh.md +3 -2
- package/kb/extra/i18n/style-samples.md +2 -2
- package/kb/extra/i18n/translation-prompt.md +1 -1
- package/kb/extra/module-graph.md +493 -1002
- package/kb/extra/module-graph.zh.md +495 -1004
- package/kb/extra/rescope.md +1 -1
- package/kb/extra/rescope.zh.md +1 -1
- package/kb/extra/session-format-status.md +47 -0
- package/kb/extra/session-format-status.zh.md +47 -0
- package/kb/extra/subsystems/agent-team.md +3 -2
- package/kb/extra/subsystems/agent-team.zh.md +3 -2
- package/kb/extra/subsystems/attachment.md +157 -4
- package/kb/extra/subsystems/attachment.zh.md +157 -4
- package/kb/extra/subsystems/feedback.md +164 -30
- package/kb/extra/subsystems/feedback.zh.md +164 -30
- package/kb/extra/testing.md +9 -4
- package/kb/extra/testing.zh.md +9 -4
- package/kb/extra/web-styling.md +5 -0
- package/kb/extra/web-styling.zh.md +5 -0
- package/kb/meta/search-index.json +223 -151
- package/kb/meta/site-pages.txt +187 -181
- package/kb/meta/source.json +5 -5
- package/kb/meta/topics.md +5 -5
- package/kb/site/develop/basic/publish.md +1 -1
- 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/basic/publish.md +1 -1
- 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/python-sdk.md +19 -3
- package/kb/site/en/guide/schedule.md +2 -0
- package/kb/site/en/reference/agent-lifecycle.md +17 -8
- package/kb/site/en/reference/api-gateway.md +2 -2
- package/kb/site/en/reference/capability-seams.md +24 -10
- package/kb/site/en/reference/config-catalog.md +322 -264
- 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/adding-a-tool.md +1 -1
- package/kb/site/en/reference/cookbook/extension-cookbook.md +16 -13
- package/kb/site/en/reference/index.md +26 -9
- package/kb/site/en/reference/persistence-catalog.md +189 -95
- package/kb/site/en/reference/subsystems/approval.md +1 -1
- package/kb/site/en/reference/subsystems/client-modules.md +9 -0
- package/kb/site/en/reference/subsystems/client-resources.md +94 -0
- 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 +10 -10
- package/kb/site/en/reference/subsystems/conversation.md +11 -4
- package/kb/site/en/reference/subsystems/core.md +173 -29
- package/kb/site/en/reference/subsystems/credentials.md +5 -4
- package/kb/site/en/reference/subsystems/filesystem.md +15 -0
- package/kb/site/en/reference/subsystems/goal.md +38 -2
- package/kb/site/en/reference/subsystems/index.md +3 -1
- package/kb/site/en/reference/subsystems/invariants.md +1 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +43 -12
- package/kb/site/en/reference/subsystems/lsp.md +1 -1
- package/kb/site/en/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/en/reference/subsystems/persistence.md +211 -199
- 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/scope.md +1 -1
- 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 +29 -1
- package/kb/site/en/reference/subsystems/session-telemetry.md +27 -10
- package/kb/site/en/reference/subsystems/session-title.md +6 -6
- package/kb/site/en/reference/subsystems/session.md +208 -103
- package/kb/site/en/reference/subsystems/settings.md +30 -12
- package/kb/site/en/reference/subsystems/shell.md +9 -6
- package/kb/site/en/reference/subsystems/sidebar-right.md +151 -0
- package/kb/site/en/reference/subsystems/skills.md +1 -1
- package/kb/site/en/reference/subsystems/slots.md +41 -32
- package/kb/site/en/reference/subsystems/spill.md +13 -6
- package/kb/site/en/reference/subsystems/storage.md +28 -5
- package/kb/site/en/reference/subsystems/subagent.md +58 -105
- package/kb/site/en/reference/subsystems/subprocess.md +25 -26
- package/kb/site/en/reference/subsystems/system-prompt.md +18 -3
- package/kb/site/en/reference/subsystems/token-meter.md +4 -3
- package/kb/site/en/reference/subsystems/tools.md +5 -5
- 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 +88 -9
- package/kb/site/en/reference/tool-catalog.md +56 -66
- package/kb/site/en/reference/tool-execution-pipeline.md +2 -2
- package/kb/site/guide/network-proxy.md +87 -0
- package/kb/site/guide/providers.md +70 -17
- package/kb/site/guide/python-sdk.md +19 -3
- package/kb/site/guide/schedule.md +2 -0
- package/kb/site/reference/agent-lifecycle.md +17 -8
- package/kb/site/reference/api-gateway.md +2 -2
- package/kb/site/reference/capability-seams.md +24 -10
- package/kb/site/reference/config-catalog.md +321 -263
- 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/adding-a-tool.md +1 -1
- package/kb/site/reference/cookbook/extension-cookbook.md +16 -13
- package/kb/site/reference/index.md +26 -9
- package/kb/site/reference/persistence-catalog.md +190 -96
- package/kb/site/reference/subsystems/approval.md +1 -1
- package/kb/site/reference/subsystems/client-modules.md +9 -0
- package/kb/site/reference/subsystems/client-resources.md +94 -0
- 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 +10 -10
- package/kb/site/reference/subsystems/conversation.md +11 -4
- package/kb/site/reference/subsystems/core.md +173 -29
- package/kb/site/reference/subsystems/credentials.md +5 -4
- package/kb/site/reference/subsystems/filesystem.md +15 -0
- package/kb/site/reference/subsystems/goal.md +38 -2
- package/kb/site/reference/subsystems/index.md +14 -12
- package/kb/site/reference/subsystems/invariants.md +1 -1
- package/kb/site/reference/subsystems/llm-streaming.md +43 -12
- package/kb/site/reference/subsystems/lsp.md +1 -1
- package/kb/site/reference/subsystems/permission-presets.md +5 -5
- package/kb/site/reference/subsystems/persistence.md +210 -198
- package/kb/site/reference/subsystems/plan.md +3 -3
- package/kb/site/reference/subsystems/schedule.md +9 -3
- package/kb/site/reference/subsystems/scope.md +1 -1
- 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 +29 -1
- package/kb/site/reference/subsystems/session-telemetry.md +27 -10
- package/kb/site/reference/subsystems/session-title.md +6 -6
- package/kb/site/reference/subsystems/session.md +208 -103
- package/kb/site/reference/subsystems/settings.md +30 -12
- package/kb/site/reference/subsystems/shell.md +9 -6
- package/kb/site/reference/subsystems/sidebar-right.md +151 -0
- package/kb/site/reference/subsystems/skills.md +1 -1
- package/kb/site/reference/subsystems/slots.md +41 -32
- package/kb/site/reference/subsystems/spill.md +13 -6
- package/kb/site/reference/subsystems/storage.md +28 -5
- package/kb/site/reference/subsystems/subagent.md +58 -105
- package/kb/site/reference/subsystems/subprocess.md +25 -26
- package/kb/site/reference/subsystems/system-prompt.md +18 -3
- package/kb/site/reference/subsystems/token-meter.md +4 -3
- package/kb/site/reference/subsystems/tools.md +5 -5
- 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 +88 -9
- package/kb/site/reference/tool-catalog.md +55 -65
- package/kb/site/reference/tool-execution-pipeline.md +2 -2
- package/lib/index.js +25 -44
- package/package.json +3 -2
- package/skills/dsh-plugin-dev-kb.md +4 -4
|
@@ -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
|
|
|
@@ -5,7 +5,7 @@ outline: [2,3]
|
|
|
5
5
|
|
|
6
6
|
# 工作区
|
|
7
7
|
|
|
8
|
-
工作区(workspace)是用户工作目录的持久记录:一个建立在规范路径之上的稳定 id、一个显示标题,以及归属于它的会话的有序账本。该子系统是单个包(package)([dsh-workspace](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/workspace/workspace),`ctx.workspaceRegistry`)——一项宿主侧可选能力,不属于 agent loop(智能体循环)主干,并且对模型不可见(没有工具、没有提示词文本、没有会话事件)。它通过[存储领域数据形式](./storage.md)存储自己的记录,并对照 [`SessionHeader.cwd`](./persistence.md#sessionheader--metadata-beside-the-log) 校验会话成员资格,因此 `storageDomain` 与 `sessionPersistence` 是必需的启动依赖:持久化这一依赖不可用时,插件保持 pending,而不是把这种不可用误当作空历史。设计记录:[领域 KV 存储 Agent Note(agent 决策记录)](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.zh.md);引导与 GUI 顺序:[Workspace UI 产品流程 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/
|
|
8
|
+
工作区(workspace)是用户工作目录的持久记录:一个建立在规范路径之上的稳定 id、一个显示标题,以及归属于它的会话的有序账本。该子系统是单个包(package)([dsh-workspace](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/workspace/workspace),`ctx.workspaceRegistry`)——一项宿主侧可选能力,不属于 agent loop(智能体循环)主干,并且对模型不可见(没有工具、没有提示词文本、没有会话事件)。它通过[存储领域数据形式](./storage.md)存储自己的记录,并对照 [`SessionHeader.cwd`](./persistence.md#sessionheader--metadata-beside-the-log) 校验会话成员资格,因此 `storageDomain` 与 `sessionPersistence` 是必需的启动依赖:持久化这一依赖不可用时,插件保持 pending,而不是把这种不可用误当作空历史。设计记录:[领域 KV 存储 Agent Note(agent 决策记录)](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.zh.md);引导与 GUI 顺序:[Workspace UI 产品流程 Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md)。
|
|
9
9
|
|
|
10
10
|
源码:[`packages/workspace/workspace/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/types.ts)
|
|
11
11
|
|
|
@@ -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
|
|
|
@@ -245,6 +245,85 @@ Host service backing the generated `ctx.remote.workspace` namespace.
|
|
|
245
245
|
|
|
246
246
|
Source: [`packages/api/workspace-controller/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/index.ts)
|
|
247
247
|
|
|
248
|
+
<a id="ctxworkspacefiles--workspacefiles"></a>
|
|
249
|
+
|
|
250
|
+
### `ctx.workspaceFiles` — `WorkspaceFiles`
|
|
251
|
+
|
|
252
|
+
Host Remote file reads and workspace directory observations over the composed filesystem.
|
|
253
|
+
|
|
254
|
+
```ts cordis-catalog
|
|
255
|
+
/**
|
|
256
|
+
* Read one page of lines from a UTF-8 file readable by the filesystem backend.
|
|
257
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
258
|
+
* @param path - absolute path or path relative to the workspace root; files outside it are allowed.
|
|
259
|
+
* @param range - the line window; omitted fields take the page defaults.
|
|
260
|
+
* @param signal - caller cancellation.
|
|
261
|
+
* @returns the page, the file's version at the stat before it, and whether it reaches the last line.
|
|
262
|
+
*/
|
|
263
|
+
@Remote async read( workspaceFileScope: WorkspaceFileScope, path: string, range: WorkspaceFileRange, signal: AbortSignal, ): Promise<WorkspaceFileText>
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Read one byte window of a regular file readable by the filesystem backend: raw
|
|
267
|
+
* bytes, no text decoding and no binary rejection.
|
|
268
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
269
|
+
* @param path - absolute path or path relative to the workspace root; files outside it are allowed.
|
|
270
|
+
* @param range - the byte window; omitted fields take the window defaults.
|
|
271
|
+
* @param signal - caller cancellation.
|
|
272
|
+
* @returns the window in base64, the file's version and size at the stat before it, and whether it reaches the last byte.
|
|
273
|
+
*/
|
|
274
|
+
@Remote async readBytes( workspaceFileScope: WorkspaceFileScope, path: string, range: WorkspaceByteRange, signal: AbortSignal, ): Promise<WorkspaceFileBytes>
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Read a complete regular file as bytes, subject to the configured full-file cap.
|
|
278
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
279
|
+
* @param path - absolute or workspace-relative file path.
|
|
280
|
+
* @param signal - caller cancellation.
|
|
281
|
+
* @returns one complete base64 window with offset zero and eof true; oversized files fail with too-large.
|
|
282
|
+
*/
|
|
283
|
+
@Remote async readAll(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceFileBytes>
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Read a complete file relative to another file's directory, including outside the workspace.
|
|
287
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
288
|
+
* @param path - base file, absolute or workspace-relative.
|
|
289
|
+
* @param relativePath - relative filesystem path, not a URL or absolute path.
|
|
290
|
+
* @param signal - caller cancellation.
|
|
291
|
+
* @returns the complete related file using the ordinary file-size and access checks.
|
|
292
|
+
*/
|
|
293
|
+
@Remote async readRelated( workspaceFileScope: WorkspaceFileScope, path: string, relativePath: string, signal: AbortSignal, ): Promise<WorkspaceFileBytes>
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Report one regular file's identity, version, and size without its content.
|
|
297
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
298
|
+
* @param path - absolute path or path relative to the workspace root; files outside it are allowed.
|
|
299
|
+
* @param signal - caller cancellation.
|
|
300
|
+
* @returns the file's absolute path, current version, and byte size.
|
|
301
|
+
*/
|
|
302
|
+
@Remote async stat(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceFileStat>
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* List the direct children of one directory inside the Session's workspace.
|
|
306
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
307
|
+
* @param path - workspace path, absolute or relative to the workspace root.
|
|
308
|
+
* @param signal - caller cancellation.
|
|
309
|
+
* @returns the directory's children in the backend's stable name order, bounded by the entry cap.
|
|
310
|
+
*/
|
|
311
|
+
@Remote async list(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceDirectoryListing>
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Stream every `fs/observed` observation of a file inside the Session's
|
|
315
|
+
* workspace. Only instrumented filesystem operations report here; the OS is
|
|
316
|
+
* not watched.
|
|
317
|
+
* @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
|
|
318
|
+
* @param signal - generation cancellation.
|
|
319
|
+
* @returns `ready` once the Host observation queue is active and the workspace
|
|
320
|
+
* root is resolved, then queued and live observations in emission order.
|
|
321
|
+
*/
|
|
322
|
+
@Remote({ mode: 'stream' }) changes(workspaceFileScope: WorkspaceFileScope, signal: AbortSignal): AsyncIterable<WorkspaceFileWatchFrame>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Source: [`packages/api/workspace-files/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-files/src/index.ts)
|
|
326
|
+
|
|
248
327
|
<a id="ctxworkspaceregistry--workspaceregistry"></a>
|
|
249
328
|
|
|
250
329
|
### `ctx.workspaceRegistry` — `WorkspaceRegistry`
|
|
@@ -253,13 +332,13 @@ Durable workspace registry. Startup waits for `sessionPersistence`, builds one c
|
|
|
253
332
|
|
|
254
333
|
```ts cordis-catalog
|
|
255
334
|
/**
|
|
256
|
-
* Create or reuse a workspace for an existing directory. The
|
|
257
|
-
* canonicalized through `fs.realpath`; a nonexistent
|
|
258
|
-
*
|
|
259
|
-
*
|
|
335
|
+
* Create or reuse a workspace for an existing directory. The fully qualified
|
|
336
|
+
* path is canonicalized through `fs.realpath`; a relative, nonexistent, or
|
|
337
|
+
* non-directory path rejects. Repeated calls for the same canonical path
|
|
338
|
+
* return the existing entity without changing its title.
|
|
260
339
|
* A newly created workspace is prepended to the durable registry order.
|
|
261
340
|
* Different canonical paths may share a display title.
|
|
262
|
-
* @param path - Existing directory to own, in
|
|
341
|
+
* @param path - Existing directory to own, in a fully qualified path spelling.
|
|
263
342
|
* @param title - Display title used only when a new record is created.
|
|
264
343
|
* @returns the existing or newly durable workspace.
|
|
265
344
|
*/
|
|
@@ -312,7 +391,7 @@ archiveSession(sessionId: SessionId): Promise<void>
|
|
|
312
391
|
* Resolve by canonical directory path without creating or mutating a
|
|
313
392
|
* workspace. A missing path rejects during `realpath`; an existing unowned
|
|
314
393
|
* directory returns `undefined`.
|
|
315
|
-
* @param path - Existing directory path in
|
|
394
|
+
* @param path - Existing directory path in a fully qualified spelling.
|
|
316
395
|
* @returns the workspace owning the canonical path, when one exists.
|
|
317
396
|
*/
|
|
318
397
|
async resolveByPath(path: string): Promise<Workspace | undefined>
|
|
@@ -9,7 +9,7 @@ editSource: "docs/tool-catalog.zh.md"
|
|
|
9
9
|
|
|
10
10
|
已发布插件向 `ctx.tools` 提供的所有面向模型的工具:模型通过系统提示词组装获得的 `name`、`description` 和 JSON Schema `parameters`。本目录是[子系统页面](./subsystems/core.md)(类型及每页生成的 `cordis-surface` 接线区域)的补充;本页列出的是向 agent(智能体)提供的*工具*。
|
|
11
11
|
|
|
12
|
-
英文源文件由系统**生成**,并通过 `pnpm run verify-tool-catalog`(`doc-sync`(文档同步门禁)的一部分)验证新鲜度;本中文文件作为经评审对侧通过双语配对维护。与 Cordis 目录(纯源码 AST 处理)不同,英文生成器会在真实上下文中**启动**每个工具插件并读取 `ctx.tools.schemas()`,因为工具 schema 无法通过静态分析完全确定,例如运行时展开的枚举、拼接的描述、由配置决定的名称以及使用原始 JSON Schema 的 MCP 工具。完整性守卫会 glob 匹配 `packages/*/tool-*`;如果生成器的启动 manifest
|
|
12
|
+
英文源文件由系统**生成**,并通过 `pnpm run verify-tool-catalog`(`doc-sync`(文档同步门禁)的一部分)验证新鲜度;本中文文件作为经评审对侧通过双语配对维护。与 Cordis 目录(纯源码 AST 处理)不同,英文生成器会在真实上下文中**启动**每个工具插件并读取 `ctx.tools.schemas()`,因为工具 schema 无法通过静态分析完全确定,例如运行时展开的枚举、拼接的描述、由配置决定的名称以及使用原始 JSON Schema 的 MCP 工具。完整性守卫会 glob 匹配 `packages/*/tool-*`;如果生成器的启动 manifest(元数据清单)遗漏任何包,检查就会失败,因此新工具不会在无人察觉的情况下缺少文档。
|
|
13
13
|
|
|
14
14
|
范围:`packages/*/tool-*` 下已发布的产品工具,每个工具均使用其**默认**配置启动;但如果某个 Config 字段是**必填项**且没有默认值,生成器就必须作出选择,对应包的说明会记录本页展示的是哪个分支。注册的工具**名称**可以是加载时配置,例如 `tool-subagent` 的 `toolName`,因此部署可能以不同名称或额外名称提供某个包;如果存在随产品发布的别名,对应包的说明会予以记录。`examples/` 中的演示工具(例如 `echo`)不在范围内,这与 Cordis 目录仅涵盖包的范围一致。
|
|
15
15
|
|
|
@@ -22,9 +22,10 @@ editSource: "docs/tool-catalog.zh.md"
|
|
|
22
22
|
| 工具包 | 模型可见名称 | 依赖 | 写入/影响 | 随产品发布的别名 | 部署说明 |
|
|
23
23
|
| --- | --- | --- | --- | --- | --- |
|
|
24
24
|
| `@deepseek-ai/dsh-tool-ask-user` | `ask_user_question` | `ctx.tools`、`ctx.userQuestions` | `tool/call`、`tool/result after a UI/provider answers the question` | - | ask_user_question 会暂停工具调用,直到当前 UI 提供方返回人类答案。 |
|
|
25
|
-
| `@deepseek-ai/dsh-tools` | `run_code` | `ctx.tools`、`ctx.codeRuntime (execution time)`、`ctx.systemPrompt` | `tool/call`、`one tool/
|
|
25
|
+
| `@deepseek-ai/dsh-tools` | `run_code` | `ctx.tools`、`ctx.codeRuntime (execution time)`、`ctx.systemPrompt` | `tool/call`、`one tool/ptc-dispatch-start + tool/ptc-dispatch pair per bridged sub-call`、`tool/result` | - | 在 `mode: ptc`/`mode: both` 下,它由工具注册表所有,作为可过滤能力层之外的保留传输机制(参见 PTC mode Agent Note)。在 `ptc` 下,它是注册表对协议格式(wire format)的唯一贡献;其他可见能力在使用已加载运行时语言生成的 SDK 章节中声明。程序通过 binding 调用这些能力,调用按照原生并发约定调度:启动顺序和策略遵循提交顺序,并发安全的函数体最多重叠执行 `maxParallelSubCalls` 个。调用会重新进入完整且受守卫保护的工具流水线,并将每个嵌套执行关联到此外层结果。 |
|
|
26
26
|
| `@deepseek-ai/dsh-plan-mode` | `exit_plan_mode` | `ctx.tools`、`ctx.systemPrompt`、`ctx.userQuestions (execution time, opportunistic)` | `tool/call`、`plan/mode inactive on an approved review`、`tool/result` | - | 规划未激活时,exit_plan_mode 仍保留在面向模型的 schema 中,这样状态转换不会在规划策略变更之外额外造成工具目录变动。其执行路径会拒绝规划模式之外的调用;在规划模式下,它通过用户交互 seam 提交计划(批准/根据反馈继续规划),批准后会在步骤边界记录规划模式已停用。 |
|
|
27
27
|
| `@deepseek-ai/dsh-tool-bash` | `bash` | `ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs at call time for run_in_background` | `tool/call`、`tool/result` | - | bash 工具是 bash 执行器 seam 面向模型的消费方。使用 `run_in_background` 的运行会注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具(来自 `@deepseek-ai/dsh-tool-jobs`)收集/停止;禁用 `enableRunInBackground` 配置(默认为 true)后,该参数会被完全移除。 |
|
|
28
|
+
| `@deepseek-ai/dsh-tool-present` | `present` | `ctx.tools`, `ctx.fs`, `ctx.sessionProjections` | `tool/call`, `deliverables/presented 在成功的最终结果之后`, `tool/result` | - | 交付归调用方 Session 所有;Web ui-deliverables 提供源文件打开与卡片。 |
|
|
28
29
|
| `@deepseek-ai/dsh-tool-pwsh` | `pwsh` | `ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs at call time for run_in_background` | `tool/call`、`tool/result` | - | pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费方(由 `@deepseek-ai/dsh-pwsh-local` 等 PowerShell 执行器为 `ctx.shell` 提供后端);除沙箱接口外,它逐项对应 bash 工具调用。使用 `run_in_background` 的运行会注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具收集/停止;托管的 `DSH_*` 环境来自 `@deepseek-ai/dsh-shell-env`。每次调用都在新进程中运行,不使用持久 PTY 会话。路径采用原生 `C:\...` 形式,变量采用 `$env:NAME`。 |
|
|
29
30
|
| `@deepseek-ai/dsh-tool-cordis` | `cordis_define`、`cordis_inspect_list`、`cordis_inspect_query`、`cordis_inspect_self`、`cordis_run`、`cordis_stop`、`cordis_undefine` | `ctx.tools`、`ctx.dynamicCordisRunner` | `tool/call`、`tool/result`、`process-local dynamic package lifecycle` | - | 不在任何随产品发布的树中,需要显式选择启用;动态 Package 代码可以访问真实运行时,见 .agents/notes/implemented/feature/2026-07-08-self-referential-cordis-toolset.md。该工具集注入 `@deepseek-ai/dsh-cordis-host-runner` 提供的 `ctx.dynamicCordisRunner`,后者拥有定义注册表和 vm 沙箱;组合缺少它时这些工具不会激活。运行中的 Package 在停止、undefine 或 DSH 重启前可以注册**额外的**模型可见工具;发生这类工具集变化时,系统会记录完整且有变动的请求头。 |
|
|
30
31
|
| `@deepseek-ai/dsh-tool-bash-persistent` | `bash` | `ctx.tools`、`ctx.terminals`、`an owning Agent at execution time` | `tool/call`、`PTY shell state`、`tool/result` | - | 一个按所有者隔离的持久 bash 工具;部署组合提供 PTY 后端,并可覆盖面向模型的环境描述。 |
|
|
@@ -41,9 +42,8 @@ editSource: "docs/tool-catalog.zh.md"
|
|
|
41
42
|
| `@deepseek-ai/dsh-tool-session-query` | `session_event_read`、`session_event_search`、`session_event_trace`、`session_search`、`session_trace` | `ctx.tools`、`ctx.systemPrompt`、`ctx.sessionQuery`、`a calling Agent for workspace authority` | `tool/call`、`tool/result` | - | 这 5 个只读工具会隐藏提供方游标,并根据不可变的调用 agent 会话为每个结果授权。该包需要选择启用;需要强制截止时间或限制行内输出的组合还会挂载通用超时或 spill 策略。 |
|
|
42
43
|
| `@deepseek-ai/dsh-tool-subagent` | `list_subagent_models`、`subagent` | `ctx.tools`、`ctx.subagents`、`ctx.systemPrompt`、`用于模型发现和所选路由校验的 ctx.llm` | `tool/call`、`tool/result`、`child session events through the chosen provider` | `subagent`、`subagent_fork` | 注册的委派工具名称取决于加载时 `toolName` 配置(默认为 `subagent`);上述默认 schema 关闭模型选择,而发现 schema 则展示为已启用 Session 中可用的固定配套工具。Web preset 会在每个新顶层 Session 创建时读取插件页偏好,并为其子 Session 保留该决定;`subagent_fork` 始终使用固定路由。每个实例通过 `modelSelectionSettings`、`backgroundMode` 与 `enableRunInBackground` 独立控制是否读取模型选择设置及其后台行为。 |
|
|
43
44
|
| `@deepseek-ai/dsh-tool-subagent-control` | `interrupt_agent`、`list_agents`、`send_message` | `ctx.tools`、`ctx.subagents`、`ctx.agents and ctx.sessionProjections (list_agents only)` | `tool/call`、`tool/result`、`child session events through ctx.subagents` | - | 这些是控制可继续后台 subagent 的全局命名工具:绑定提供方的 `tool-subagent` 实例注册不同的委派工具;本包注册一次 `send_message` 和 `interrupt_agent`,另由 `list_agents` 通过单独加载的 `/list-agents` 插件提供,其目录行使用 sessionProjections 和实时 Agent 注册表。 |
|
|
44
|
-
| `@deepseek-ai/dsh-tool-subagent-report` | `report` | `ctx.subagents`、`ctx.systemPrompt`、`a live continuable in-process child Agent` | `tool/call`、`tool/result`、`a user-role message in the direct parent session` | - | 按可继续的进程内子级注册,而非全局注册,因此该 schema 仅在这种子级内部可见,并且不受其全局 `toolFilter` 影响。同一份贡献还会安装子级作用域的 `tool:report` 系统提示词 section,本目录不渲染该 section。面向父级的 `send_message` 工具单独安装。 |
|
|
45
45
|
| `@deepseek-ai/dsh-tool-jobs` | `job_kill`、`job_list`、`job_output` | `ctx.tools`、`ctx.jobs`、`ctx.systemPrompt` | `tool/call`、`tool/result`、`user/message via agent.inject() for background completion notices` | - | 与任务种类无关的后台任务控制器:后台 bash 命令、PTY 发送和 subagent 都通过相同的 3 个工具读取、列出和终止。加载该插件会挂接控制器,从而启用生产方的 `ctx.jobs.start()`。 |
|
|
46
|
-
| `@deepseek-ai/dsh-experimental-tool-agent-team` | `
|
|
46
|
+
| `@deepseek-ai/dsh-experimental-tool-agent-team` | `interrupt_agent`、`list_agents`、`send_message`、`spawn_teammate`、`team_task_create`、`team_task_get`、`team_task_list`、`team_task_update`、`wait_agent` | `ctx.tools`、`ctx.systemPrompt`、`ctx.agentTeams`、`an exact live Team member Agent` | `tool/call`、`team/member`、`team/message/queued`、`team/message/delivered`、`team/task`、`tool/result` | - | 这 9 个工具限定于隐式 Team Lead 与持久 teammate 作用域。随产品发布的 dsh-base bundle 默认禁用该包;文档中的 Agent Teams profile patch 会启用它,并禁用旧 continuable child 的同名控制工具。 |
|
|
47
47
|
| `@deepseek-ai/dsh-tool-todo` | `todo_write` | `ctx.tools`、`owning Agent session` | `tool/call`、`todo/write`、`tool/result` | - | todo_write 是会话所有的状态;UI 将最新的 todo/write 事件渲染为检查清单。`allowParallelInProgress` 是没有默认值的必填项,因此本目录明确选择 `true`,对应描述允许同时存在多个 `in_progress` 项。选择 `false` 的部署会获得同一工具,但描述会要求只能有 1 个活动任务。 |
|
|
48
48
|
| `@deepseek-ai/dsh-tool-workflow` | `workflow` | `ctx.tools`、`ctx.workflowEngine`、`ctx.systemPrompt`、`a calling Agent (exec.agent parents the script children)` | `tool/call`、`tool/result` | - | - |
|
|
49
49
|
| `@deepseek-ai/dsh-tool-web` | `web_fetch`、`web_search` | `ctx.tools`、`ctx.web`、`ctx.systemPrompt` | `tool/call`、`tool/result` | - | web_search 和 web_fetch 将提供方选择置于 ctx.web 之后,使模型可见 schema 在更换后端时保持稳定。 |
|
|
@@ -225,6 +225,49 @@ ask_user_question 会暂停工具调用,直到当前 UI 提供方返回人类
|
|
|
225
225
|
|
|
226
226
|
bash 工具是 bash 执行器 seam 面向模型的消费方。使用 `run_in_background` 的运行会注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具(来自 `@deepseek-ai/dsh-tool-jobs`)收集/停止;禁用 `enableRunInBackground` 配置(默认为 true)后,该参数会被完全移除。
|
|
227
227
|
|
|
228
|
+
<a id="deepseek-aidsh-tool-present"></a>
|
|
229
|
+
|
|
230
|
+
## `@deepseek-ai/dsh-tool-present`
|
|
231
|
+
|
|
232
|
+
### `present`
|
|
233
|
+
|
|
234
|
+
声明交付 Session 文件系统可访问的已有文件。如果你创建或更新的文件是用户要求接收的成果,则必须在写入完成后、最终回复前调用 present,包括通过 Bash 或代码执行创建的文件。在回复中提到文件路径不能替代这次调用。文件必须已存在。用户打开当前源文件;不复制或保存其内容。
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"type": "object",
|
|
239
|
+
"properties": {
|
|
240
|
+
"files": {
|
|
241
|
+
"type": "array",
|
|
242
|
+
"items": {
|
|
243
|
+
"type": "object",
|
|
244
|
+
"additionalProperties": false,
|
|
245
|
+
"properties": {
|
|
246
|
+
"path": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"description": "Path of an existing regular file. Relative paths use the Session working directory."
|
|
249
|
+
},
|
|
250
|
+
"description": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"description": "Brief description for the user."
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"required": [
|
|
256
|
+
"path"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"required": [
|
|
262
|
+
"files"
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
来源: [`packages/fs/tool-present/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/tool-present/src/index.ts)
|
|
268
|
+
|
|
269
|
+
交付归调用方 Session 所有;Web ui-deliverables 提供源文件打开与卡片。
|
|
270
|
+
|
|
228
271
|
<a id="deepseek-aidsh-tool-pwsh"></a>
|
|
229
272
|
|
|
230
273
|
## `@deepseek-ai/dsh-tool-pwsh`
|
|
@@ -739,7 +782,7 @@ pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费
|
|
|
739
782
|
|
|
740
783
|
### `read_image`
|
|
741
784
|
|
|
742
|
-
读取 PNG/JPEG/WebP/GIF
|
|
785
|
+
读取 PNG/JPEG/WebP/GIF 文件并返回图像本身。无扩展名的路径同样被接受;格式按文件内容检测,因此规范化附件路径可以直接传入,无需复制或重命名。Harness 会在下一次模型请求前校验并缩小受支持的大图,因此仅为查看图片时应直接使用此工具,无需安装图片库或创建缩略图。可以用小批次并发读取彼此独立的文件。要求当前模型接受图像输入。
|
|
743
786
|
|
|
744
787
|
```json
|
|
745
788
|
{
|
|
@@ -1626,7 +1669,7 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
|
|
|
1626
1669
|
|
|
1627
1670
|
### `list_agents`
|
|
1628
1671
|
|
|
1629
|
-
按持久 id 和标签列出你的可继续后台 subagent。用它回忆你启动过哪些 subagent,而不是轮询完成情况——subagent 完成时你会被告知。状态来自实时注册表:running 表示 agent 此刻正在工作;idle 表示已加载但处于轮次之间,可能正在等待它启动的 agent;ready 表示它只存在于存储中——可恢复而非终态,也不表示有结果等待收集;`send_message`
|
|
1672
|
+
按持久 id 和标签列出你的可继续后台 subagent。用它回忆你启动过哪些 subagent,而不是轮询完成情况——subagent 完成时你会被告知。状态来自实时注册表:running 表示 agent 此刻正在工作;idle 表示已加载但处于轮次之间,可能正在等待它启动的 agent;ready 表示它只存在于存储中——可恢复而非终态,也不表示有结果等待收集;`send_message` 会在运行中 child 的最近 step 边界 steer 消息,或为 idle、ready child 启动轮次,且无论处于哪种状态,直接子级都仍可作为 `send_message` 的目标。该快照并非投递承诺;`send_message` 会执行权威检查,仍可能失败。无法读取的子级会作为诊断信息报告,而不会被静默丢弃。`descendants` 作用域会按稳定的前序顺序遍历你下方的整棵树,并为每个条目标注其持久的直接父会话 id 和深度。只有深度为 1 的条目可以使用 `send_message`;更深的条目只能作为 `interrupt_agent` 的候选目标。
|
|
1630
1673
|
|
|
1631
1674
|
```json
|
|
1632
1675
|
{
|
|
@@ -1648,23 +1691,23 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
|
|
|
1648
1691
|
|
|
1649
1692
|
### `send_message`
|
|
1650
1693
|
|
|
1651
|
-
根据
|
|
1694
|
+
根据 agent id 向直接可继续 child 发送消息。如果你是驻留的可继续 child,也可以把自己的直接 parent 作为目标。如果目标仍在工作,消息会 steer 其最近的 step;如果目标处于 idle,消息会启动一个轮次。此调用不会返回该 agent 的答案,只会确认消息已投递。调用失败表示消息**未**投递。
|
|
1652
1695
|
|
|
1653
1696
|
```json
|
|
1654
1697
|
{
|
|
1655
1698
|
"type": "object",
|
|
1656
1699
|
"properties": {
|
|
1657
|
-
"
|
|
1700
|
+
"agent_id": {
|
|
1658
1701
|
"type": "string",
|
|
1659
|
-
"description": "The
|
|
1702
|
+
"description": "The agent id of your direct continuable child, or your direct parent when you are a resident continuable child."
|
|
1660
1703
|
},
|
|
1661
1704
|
"message": {
|
|
1662
1705
|
"type": "string",
|
|
1663
|
-
"description": "The message to deliver to the
|
|
1706
|
+
"description": "The message to deliver to the agent."
|
|
1664
1707
|
}
|
|
1665
1708
|
},
|
|
1666
1709
|
"required": [
|
|
1667
|
-
"
|
|
1710
|
+
"agent_id",
|
|
1668
1711
|
"message"
|
|
1669
1712
|
]
|
|
1670
1713
|
}
|
|
@@ -1674,33 +1717,6 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
|
|
|
1674
1717
|
|
|
1675
1718
|
这些是控制可继续后台 subagent 的全局命名工具:绑定提供方的 `tool-subagent` 实例注册不同的委派工具;本包注册一次 `send_message` 和 `interrupt_agent`,另由 `list_agents` 通过单独加载的 `/list-agents` 插件提供,其目录行使用 sessionProjections 和实时 Agent 注册表。
|
|
1676
1719
|
|
|
1677
|
-
<a id="deepseek-aidsh-tool-subagent-report"></a>
|
|
1678
|
-
|
|
1679
|
-
## `@deepseek-ai/dsh-tool-subagent-report`
|
|
1680
|
-
|
|
1681
|
-
### `report`
|
|
1682
|
-
|
|
1683
|
-
向启动你的 agent 报告选定内容。在你结束前调用一次,给出自包含的最终结果;当进度或发现会改变该 agent 接下来的行动时,也可以更早调用。该 agent 与你共享工作区,但不会自动收到你的 transcript(文本记录)、工具输出或推理,因此完成你的工作本身并不等于交出结果。报告不会结束你的轮次或完成你的工作,且只有直接父级会收到。失败的调用仍可能已经送达,因此不要盲目重复。
|
|
1684
|
-
|
|
1685
|
-
```json
|
|
1686
|
-
{
|
|
1687
|
-
"type": "object",
|
|
1688
|
-
"properties": {
|
|
1689
|
-
"output": {
|
|
1690
|
-
"type": "string",
|
|
1691
|
-
"description": "Actionable content for your parent; summarize conclusions and reference relevant shared paths."
|
|
1692
|
-
}
|
|
1693
|
-
},
|
|
1694
|
-
"required": [
|
|
1695
|
-
"output"
|
|
1696
|
-
]
|
|
1697
|
-
}
|
|
1698
|
-
```
|
|
1699
|
-
|
|
1700
|
-
来源:[`packages/subagent/tool-subagent-report/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/subagent/tool-subagent-report/src/index.ts)
|
|
1701
|
-
|
|
1702
|
-
按可继续的进程内子级注册,而非全局注册,因此该 schema 仅在这种子级内部可见,并且不受其全局 `toolFilter` 影响。同一份贡献还会安装子级作用域的 `tool:report` 系统提示词 section,本目录不渲染该 section。面向父级的 `send_message` 工具单独安装。
|
|
1703
|
-
|
|
1704
1720
|
<a id="deepseek-aidsh-tool-jobs"></a>
|
|
1705
1721
|
|
|
1706
1722
|
## `@deepseek-ai/dsh-tool-jobs`
|
|
@@ -1778,32 +1794,6 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
|
|
|
1778
1794
|
|
|
1779
1795
|
## `@deepseek-ai/dsh-experimental-tool-agent-team`
|
|
1780
1796
|
|
|
1781
|
-
### `followup_task`
|
|
1782
|
-
|
|
1783
|
-
向另一名 Team member 发送持久 follow-up task,并在需要时启动一个 turn。
|
|
1784
|
-
|
|
1785
|
-
```json
|
|
1786
|
-
{
|
|
1787
|
-
"type": "object",
|
|
1788
|
-
"properties": {
|
|
1789
|
-
"target": {
|
|
1790
|
-
"type": "string",
|
|
1791
|
-
"description": "Team member name, or lead."
|
|
1792
|
-
},
|
|
1793
|
-
"message": {
|
|
1794
|
-
"type": "string",
|
|
1795
|
-
"description": "Self-contained message for the target."
|
|
1796
|
-
}
|
|
1797
|
-
},
|
|
1798
|
-
"required": [
|
|
1799
|
-
"target",
|
|
1800
|
-
"message"
|
|
1801
|
-
]
|
|
1802
|
-
}
|
|
1803
|
-
```
|
|
1804
|
-
|
|
1805
|
-
来源:[`packages/experimental/tool-agent-team/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/experimental/tool-agent-team/src/index.ts)
|
|
1806
|
-
|
|
1807
1797
|
### `interrupt_agent`
|
|
1808
1798
|
|
|
1809
1799
|
中断一名 teammate 的当前 turn,同时保留其待处理 inbox。仅 Team Lead 可用。
|
|
@@ -1840,7 +1830,7 @@ lsp 工具将提供方选择和语言服务器子进程置于 ctx.lsp 之后,
|
|
|
1840
1830
|
|
|
1841
1831
|
### `send_message`
|
|
1842
1832
|
|
|
1843
|
-
向另一名 Team member
|
|
1833
|
+
向另一名 Team member 发送一条持久消息。running target 会在最近的步骤边界收到消息;idle target 会启动一个 turn;inactive teammate 会冷恢复。
|
|
1844
1834
|
|
|
1845
1835
|
```json
|
|
1846
1836
|
{
|
|
@@ -21,7 +21,7 @@ flowchart TD
|
|
|
21
21
|
around["<code>tools/execute</code> waterfall<br/>timeout, retry, metrics (around dispatch)"]
|
|
22
22
|
toolBody["Registered tool execute() body"]
|
|
23
23
|
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
|
24
|
-
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/
|
|
24
|
+
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/ptc-dispatch</code>"]
|
|
25
25
|
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
|
26
26
|
normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
|
|
27
27
|
finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
|
|
@@ -61,6 +61,6 @@ flowchart TD
|
|
|
61
61
|
allResults --> context
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
文件系统的先读后编辑检查位于 `tool-fs` 之下,通过 `fs/*` 事件实现。通用的前置/后置 waterfall 承载钩子与审批策略;`ctx.approval` 在单调守卫之前处理询问,而不得重新排序的所有者策略仍作为已注册的守卫。超时等环绕分发关注点对 `tools/execute` 进行包装。注册表会对候选结果进行无损快照;如果快照失败,则会先将失败规范化,之后再由可见定义中已随快照固定的 `finalizeContent` 回调强制执行其同步且仅限内容的不变式。随后,`tools/result` 会观察不可变、可由 JSON 无损表示的结果。这样一来,钩子便可跨越不同工具系列,而无需让工具与某个策略服务耦合。PTC mode 会将保留的 `run_code` 传输及其序列化子调用都送入流水线;子调用携带父级 token、记录 `tool/
|
|
64
|
+
文件系统的先读后编辑检查位于 `tool-fs` 之下,通过 `fs/*` 事件实现。通用的前置/后置 waterfall 承载钩子与审批策略;`ctx.approval` 在单调守卫之前处理询问,而不得重新排序的所有者策略仍作为已注册的守卫。超时等环绕分发关注点对 `tools/execute` 进行包装。注册表会对候选结果进行无损快照;如果快照失败,则会先将失败规范化,之后再由可见定义中已随快照固定的 `finalizeContent` 回调强制执行其同步且仅限内容的不变式。随后,`tools/result` 会观察不可变、可由 JSON 无损表示的结果。这样一来,钩子便可跨越不同工具系列,而无需让工具与某个策略服务耦合。PTC mode 会将保留的 `run_code` 传输及其序列化子调用都送入流水线;子调用携带父级 token、记录 `tool/ptc-dispatch`、将拒绝呈现为具有约束力的驳回,并省略 `additionalContexts`,以保持调用与结果相邻。
|
|
65
65
|
|
|
66
66
|
维护模式:英文源文件包含人工维护的 Mermaid 流程图,并由生成器写出;本中文文件作为经评审对侧通过双语配对维护。确切的工具 schema 与事件签名位于生成的目录中。
|
package/lib/index.js
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* 从插件目录解析不到;这里本来也不需要)。
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { existsSync, readdirSync, readFileSync
|
|
18
|
-
import { homedir } from 'node:os'
|
|
17
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
|
19
18
|
import { dirname, join } from 'node:path'
|
|
20
19
|
import { fileURLToPath } from 'node:url'
|
|
21
20
|
|
|
@@ -26,6 +25,14 @@ const PKG_DIR = dirname(fileURLToPath(import.meta.url))
|
|
|
26
25
|
const SKILLS_DIR = join(PKG_DIR, '..', 'skills')
|
|
27
26
|
const KB_DIR = join(PKG_DIR, '..', 'kb')
|
|
28
27
|
|
|
28
|
+
/** logger 拿不到时降级 console。 */
|
|
29
|
+
function makeLogger(ctx, tag) {
|
|
30
|
+
return {
|
|
31
|
+
info: (...args) => (ctx.logger?.info ? ctx.logger.info(...args) : console.log(tag, ...args)),
|
|
32
|
+
warn: (...args) => (ctx.logger?.warn ? ctx.logger.warn(...args) : console.warn(tag, ...args))
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
/** 极简 frontmatter 解析(name/description/whenToUse)。 */
|
|
30
37
|
function parseFrontmatter(md) {
|
|
31
38
|
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(md)
|
|
@@ -41,10 +48,10 @@ function parseFrontmatter(md) {
|
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
/** 从 skills/ 目录加载技能定义(文件缺失/无 frontmatter 时跳过并警告,绝不让插件挂载失败)。 */
|
|
44
|
-
function loadSkills() {
|
|
51
|
+
function loadSkills(log) {
|
|
45
52
|
const out = []
|
|
46
53
|
if (!existsSync(SKILLS_DIR)) {
|
|
47
|
-
|
|
54
|
+
log.warn('skills 目录缺失,技能未加载:' + SKILLS_DIR)
|
|
48
55
|
return out
|
|
49
56
|
}
|
|
50
57
|
for (const file of readdirSync(SKILLS_DIR)) {
|
|
@@ -52,7 +59,7 @@ function loadSkills() {
|
|
|
52
59
|
try {
|
|
53
60
|
const fm = parseFrontmatter(readFileSync(join(SKILLS_DIR, file), 'utf8'))
|
|
54
61
|
if (!fm.name || !fm.description) {
|
|
55
|
-
|
|
62
|
+
log.warn(`技能文件缺少 name/description frontmatter,已跳过:${file}`)
|
|
56
63
|
continue
|
|
57
64
|
}
|
|
58
65
|
out.push({
|
|
@@ -62,20 +69,14 @@ function loadSkills() {
|
|
|
62
69
|
body: fm.body
|
|
63
70
|
})
|
|
64
71
|
} catch (err) {
|
|
65
|
-
|
|
72
|
+
log.warn(`技能文件读取失败,已跳过:${file}(${err?.message ?? err})`)
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
return out
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
/** 挂载状态文件(自诊断:$DSH_HOME/dsh-plugin-dev-kb.state.json)。 */
|
|
72
|
-
function dshHome() {
|
|
73
|
-
return process.env.DSH_HOME || join(homedir(), '.dsh')
|
|
74
|
-
}
|
|
75
|
-
|
|
76
78
|
export function apply(ctx, config) {
|
|
77
|
-
const
|
|
78
|
-
const state = { skills: [] }
|
|
79
|
+
const log = makeLogger(ctx, '[dsh-plugin-dev-kb]')
|
|
79
80
|
|
|
80
81
|
// 契约(dsh-skill validateDefinition):定义必须含 name/description/
|
|
81
82
|
// source/content 四个字符串;provider 缺省为 'runtime'。
|
|
@@ -85,37 +86,17 @@ export function apply(ctx, config) {
|
|
|
85
86
|
// resourceBase 让 skill 工具渲染相对资源引导——知识库位置随插件安装
|
|
86
87
|
// 位置动态解析,不依赖任何写死的机器路径。
|
|
87
88
|
const kbRoot = KB_DIR.replaceAll('\\', '/')
|
|
88
|
-
for (const skill of loadSkills()) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
state.skills.push(skill.name)
|
|
99
|
-
console.log(`[dsh-plugin-dev-kb] 技能已注册:${skill.name}`)
|
|
100
|
-
} catch (err) {
|
|
101
|
-
console.warn(`[dsh-plugin-dev-kb] 技能注册失败:${skill.name}(${err?.message ?? err})`)
|
|
102
|
-
}
|
|
89
|
+
for (const skill of loadSkills(log)) {
|
|
90
|
+
ctx.effect(() => ctx.skills.register({
|
|
91
|
+
name: skill.name,
|
|
92
|
+
description: skill.description,
|
|
93
|
+
...(skill.whenToUse ? { whenToUse: skill.whenToUse } : {}),
|
|
94
|
+
source: 'runtime',
|
|
95
|
+
content: skill.body.replaceAll('{{KB_ROOT}}', kbRoot),
|
|
96
|
+
resourceBase: { kind: 'directory', path: KB_DIR }
|
|
97
|
+
}), `dsh-plugin-dev-kb: register skill ${skill.name}`)
|
|
98
|
+
log.info(`技能已注册:${skill.name}`)
|
|
103
99
|
}
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
writeFileSync(join(dshHome(), 'dsh-plugin-dev-kb.state.json'), JSON.stringify({
|
|
107
|
-
plugin: 'dsh-plugin-dev-kb',
|
|
108
|
-
mountedAt: new Date().toISOString(),
|
|
109
|
-
skills: state.skills
|
|
110
|
-
}, null, 2), 'utf8')
|
|
111
|
-
} catch { /* 状态文件写入失败不影响挂载 */ }
|
|
112
|
-
|
|
113
|
-
console.log(`[dsh-plugin-dev-kb] 已挂载:${state.skills.length} 技能(知识库在 kb/ 目录)`)
|
|
114
|
-
|
|
115
|
-
// 卸载清理(HMR 重载时避免重复注册)。
|
|
116
|
-
return () => {
|
|
117
|
-
for (const dispose of disposers) {
|
|
118
|
-
try { dispose() } catch { /* ignore */ }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
101
|
+
log.info(`已挂载(知识库在 kb/ 目录)`)
|
|
121
102
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-dev-kb",
|
|
3
|
-
"description": "dsh 插件开发知识库:DeepSeek Harness 官方文档站完整 Markdown 镜像(中英双语
|
|
4
|
-
"version": "1.0
|
|
3
|
+
"description": "dsh 插件开发知识库:DeepSeek Harness 官方文档站完整 Markdown 镜像(中英双语 188 页)+ 62 篇仓库补充开发参考 + 主题导航与 253 文件全量搜索索引;以 dsh-plugin-dev-kb 技能让 agent 在插件开发任务中自动加载定位文档。纯数据插件,零运行时依赖。",
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"lib",
|
|
13
|
+
"docs",
|
|
13
14
|
"kb",
|
|
14
15
|
"skills",
|
|
15
16
|
"scripts",
|
|
@@ -16,18 +16,18 @@ whenToUse: 开发 dsh 插件、查询 dsh 能力与 API、写 Tool、配置 cord
|
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
kb/
|
|
19
|
-
├── site/ 线上站点完整镜像(中英双语
|
|
20
|
-
│ ├── guide/ 入门:quickstart / providers / python-sdk / github-review / schedule / mcp-memory
|
|
19
|
+
├── site/ 线上站点完整镜像(中英双语 188 页,优先读这里)
|
|
20
|
+
│ ├── guide/ 入门:quickstart / providers / python-sdk / github-review / schedule / mcp-memory / network-proxy
|
|
21
21
|
│ ├── develop/ basic(第一个插件/tool/config/publish)、framework(生命周期/服务/事件)、
|
|
22
22
|
│ │ practice(能力分层/LLM适配器/动态装配)、cordis-tutorial(7章)
|
|
23
23
|
│ ├── reference/ index(架构)、cordis-primer、capability-seams、agent-lifecycle、
|
|
24
24
|
│ │ config-catalog、tool-catalog、api-gateway、cordis-api/(6)、cookbook/(5)、subsystems/(46)
|
|
25
25
|
│ └── en/ 英文站镜像(结构与中文站一致)
|
|
26
|
-
├── extra/ 仓库内未发布到站点的补充文档(
|
|
26
|
+
├── extra/ 仓库内未发布到站点的补充文档(62 篇):glossary、defensive-patterns、
|
|
27
27
|
│ module-graph、testing、postmortem/(4)、i18n/、cookbook 与 subsystems 扩展
|
|
28
28
|
├── meta/
|
|
29
29
|
│ ├── topics.md ★ 主题导航:任务场景 → 要读的文件(先用这个)
|
|
30
|
-
│ ├── search-index.json 全量检索索引(
|
|
30
|
+
│ ├── search-index.json 全量检索索引(253 文件:path/url/title/字符数)
|
|
31
31
|
│ ├── source.json 来源信息(commit/时间/统计)
|
|
32
32
|
│ └── site-pages.txt 线上站点页面清单
|
|
33
33
|
├── INDEX.md 全部 站点 URL ↔ 本地文件 对照
|