dsh-team-presets 0.0.0-stage → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/ADAPTATION.md +331 -0
  2. package/CREDITS.md +83 -0
  3. package/LICENSE +22 -0
  4. package/NOTES.en.md +99 -0
  5. package/NOTES.md +99 -0
  6. package/NOTICE +38 -0
  7. package/README.en.md +472 -0
  8. package/README.md +501 -2
  9. package/assets/skills/git-release-hygiene/SKILL.md +36 -0
  10. package/assets/skills/github-repository-presentation/SKILL.md +150 -0
  11. package/assets/skills/grilling/SKILL.md +46 -0
  12. package/assets/skills/research/SKILL.md +28 -0
  13. package/cordis.patch.yml +12 -0
  14. package/examples/README.md +69 -0
  15. package/examples/engineering-team-with-personnel-control.json +69 -0
  16. package/lib/THIRD-PARTY-NOTICES.txt +40 -0
  17. package/lib/client.js +23732 -0
  18. package/lib/index.js +19382 -0
  19. package/lib/typert.host.d.ts +3 -0
  20. package/lib/typert.host.js +16265 -0
  21. package/lib/typert.remote-client.d.ts +77 -0
  22. package/lib/typert.remote-client.js +16252 -0
  23. package/lib/types/application.d.ts +119 -0
  24. package/lib/types/application.js +420 -0
  25. package/lib/types/builtin-teams.d.ts +141 -0
  26. package/lib/types/builtin-teams.js +274 -0
  27. package/lib/types/client/CategorySelect.d.ts +30 -0
  28. package/lib/types/client/CategorySelect.js +41 -0
  29. package/lib/types/client/ComposerTeamSelect.d.ts +14 -0
  30. package/lib/types/client/ComposerTeamSelect.js +86 -0
  31. package/lib/types/client/FieldPicker.d.ts +23 -0
  32. package/lib/types/client/FieldPicker.js +19 -0
  33. package/lib/types/client/TeamAgentView.d.ts +47 -0
  34. package/lib/types/client/TeamAgentView.js +183 -0
  35. package/lib/types/client/TeamCategoryManager.d.ts +39 -0
  36. package/lib/types/client/TeamCategoryManager.js +45 -0
  37. package/lib/types/client/TeamEditorView.d.ts +39 -0
  38. package/lib/types/client/TeamEditorView.js +69 -0
  39. package/lib/types/client/TeamImportDialog.d.ts +26 -0
  40. package/lib/types/client/TeamImportDialog.js +59 -0
  41. package/lib/types/client/TeamListView.d.ts +46 -0
  42. package/lib/types/client/TeamListView.js +48 -0
  43. package/lib/types/client/TeamPresetsSection.d.ts +14 -0
  44. package/lib/types/client/TeamPresetsSection.js +239 -0
  45. package/lib/types/client/TeamSkillsView.d.ts +24 -0
  46. package/lib/types/client/TeamSkillsView.js +149 -0
  47. package/lib/types/client/appearance.d.ts +40 -0
  48. package/lib/types/client/appearance.js +32 -0
  49. package/lib/types/client/index.d.ts +39 -0
  50. package/lib/types/client/index.js +128 -0
  51. package/lib/types/client/locales.d.ts +56 -0
  52. package/lib/types/client/locales.js +634 -0
  53. package/lib/types/client/preset-file.d.ts +63 -0
  54. package/lib/types/client/preset-file.js +133 -0
  55. package/lib/types/client/team-grouping.d.ts +135 -0
  56. package/lib/types/client/team-grouping.js +162 -0
  57. package/lib/types/client/team-metadata.d.ts +95 -0
  58. package/lib/types/client/team-metadata.js +145 -0
  59. package/lib/types/client/team-presets-controller.d.ts +729 -0
  60. package/lib/types/client/team-presets-controller.js +1359 -0
  61. package/lib/types/client/team-skills-controller.d.ts +186 -0
  62. package/lib/types/client/team-skills-controller.js +463 -0
  63. package/lib/types/config.d.ts +333 -0
  64. package/lib/types/config.js +118 -0
  65. package/lib/types/delegation.d.ts +71 -0
  66. package/lib/types/delegation.js +177 -0
  67. package/lib/types/execution.d.ts +111 -0
  68. package/lib/types/execution.js +264 -0
  69. package/lib/types/index.d.ts +39 -0
  70. package/lib/types/index.js +1176 -0
  71. package/lib/types/member-identity.d.ts +142 -0
  72. package/lib/types/member-identity.js +347 -0
  73. package/lib/types/member-runtime.d.ts +255 -0
  74. package/lib/types/member-runtime.js +500 -0
  75. package/lib/types/member-store.d.ts +160 -0
  76. package/lib/types/member-store.js +198 -0
  77. package/lib/types/presentation.d.ts +147 -0
  78. package/lib/types/presentation.js +157 -0
  79. package/lib/types/preset-editor.d.ts +97 -0
  80. package/lib/types/preset-editor.js +279 -0
  81. package/lib/types/preset-tools.d.ts +40 -0
  82. package/lib/types/preset-tools.js +586 -0
  83. package/lib/types/preset-transfer.d.ts +230 -0
  84. package/lib/types/preset-transfer.js +554 -0
  85. package/lib/types/presets.d.ts +145 -0
  86. package/lib/types/presets.js +270 -0
  87. package/lib/types/settings-reconcile.d.ts +25 -0
  88. package/lib/types/settings-reconcile.js +127 -0
  89. package/lib/types/team-catalog.d.ts +81 -0
  90. package/lib/types/team-catalog.js +628 -0
  91. package/lib/types/team-search.d.ts +176 -0
  92. package/lib/types/team-search.js +252 -0
  93. package/lib/types/team-skills/import.d.ts +107 -0
  94. package/lib/types/team-skills/import.js +275 -0
  95. package/lib/types/team-skills/index.d.ts +170 -0
  96. package/lib/types/team-skills/index.js +262 -0
  97. package/lib/types/team-skills/manager.d.ts +215 -0
  98. package/lib/types/team-skills/manager.js +596 -0
  99. package/lib/types/team-skills/paths.d.ts +115 -0
  100. package/lib/types/team-skills/paths.js +234 -0
  101. package/lib/types/team-skills/provider.d.ts +196 -0
  102. package/lib/types/team-skills/provider.js +385 -0
  103. package/lib/types/team-skills/service.d.ts +172 -0
  104. package/lib/types/team-skills/service.js +566 -0
  105. package/lib/types/team-skills/store.d.ts +94 -0
  106. package/lib/types/team-skills/store.js +689 -0
  107. package/lib/types/team-skills/tools.d.ts +45 -0
  108. package/lib/types/team-skills/tools.js +247 -0
  109. package/lib/types/tool-catalog.d.ts +61 -0
  110. package/lib/types/tool-catalog.js +217 -0
  111. package/lib/types/tool-descriptions.d.ts +21 -0
  112. package/lib/types/tool-descriptions.js +21 -0
  113. package/lib/types/tool-policy.d.ts +99 -0
  114. package/lib/types/tool-policy.js +233 -0
  115. package/lib/types/types.d.ts +546 -0
  116. package/lib/types/types.js +9 -0
  117. package/locale/en.json +6 -0
  118. package/locale/zh.json +6 -0
  119. package/package.json +176 -4
package/ADAPTATION.md ADDED
@@ -0,0 +1,331 @@
1
+ # DSH 版本适配说明(rc.2 → rc.3)
2
+
3
+ 本文写给两类读者:
4
+
5
+ - **想把本插件装到自己 DSH 上的使用者** —— 看「我需要做什么」。
6
+ - **想让自己的智能体帮你改代码/改插件的开发者** —— 看「适配点清单」,那些是 rc.2 → rc.3 真正变了的地方,照着改就行,不用重新摸索。
7
+
8
+ 适配基线:Runtime `0.2.1-rc.3`,插件本版 `0.2.0`。
9
+
10
+ ---
11
+
12
+ ## 一、我需要做什么(使用者)
13
+
14
+ 只有一件事:**确认你的 DSH 版本对得上**,然后装上。
15
+
16
+ | 你的 DSH 版本 | 能不能用本版 | 说明 |
17
+ |---|---|---|
18
+ | `>= 0.2.2-rc.1 < 0.3.0` | ✅ 可以 | 插件声明的最低版本。`dsh-tool-executor-native` 在 npm 上只从 `0.2.2-alpha.2` 起存在 |
19
+ | `0.2.1-rc.x` | ❌ 不行 | 该系列没有独立的 `dsh-tool-executor-native` 包,peer 无法满足 |
20
+ | `0.2.0-rc.2` 及更早 | ❌ 不行 | 插件管理器会拒绝安装/激活。要用就必须先升级 DSH |
21
+ | `>= 0.3.0` | ❌ 未验证 | 本版没有在 0.3 上跑过,不声明支持 |
22
+
23
+ 查版本:
24
+
25
+ ```sh
26
+ dsh --version
27
+ ```
28
+
29
+ `0.2.2-rc.1` 已实测:版本校验通过、模块加载成功、六个关键包的所有符号(`setExecutor`、`guard`、`turnBoundaryOf`、`assembleContextFor`、`installModelSelection`、`createScope`、`NativeToolExecutor`)全部存在且签名未变。
30
+
31
+ ### 别把两件事搞混
32
+
33
+ - **插件版本**(本版 `0.2.0`)
34
+ - **Runtime 版本**(`0.2.1-rc.3`)
35
+
36
+ 两条独立的版本线。插件 `0.2.0` 跑在 Runtime `0.2.1-rc.3` 上是正常组合,不是版本不匹配。
37
+
38
+ ---
39
+
40
+ ## 二、rc.2 → rc.3 到底变了什么(适配点清单)
41
+
42
+ 以下六条是本插件为了在 rc.3 上跑通而实际改动的地方。每条都写了**症状**(不改会怎样)、**旧写法**、**新写法**。给别人改插件用。
43
+
44
+ ### 1. 工具执行从「单次调用」改成「批量调用」
45
+
46
+ **这是最容易踩的一条**,本插件 132 个老测试全挂在这上面。
47
+
48
+ **症状**:运行时报 `TypeError: Cannot read properties of undefined (reading 'map')`,栈里指向 `tools/src/batch.ts`;或直接被包成 `ToolBatchExecutionError: Tool batch execution failed`。
49
+
50
+ **旧写法(rc.2)** —— `execute` 收一个调用,直接返回结果:
51
+
52
+ ```ts
53
+ const result = await ctx.tools.execute({
54
+ callId: ToolCallId('my-call'),
55
+ name: 'some_tool',
56
+ arguments: { a: 1 }, // 对象
57
+ agent,
58
+ signal,
59
+ })
60
+ // result: ToolExecutionResult = { isError, content }
61
+ ```
62
+
63
+ **新写法(rc.3)** —— `execute` 收一批,返回一批:
64
+
65
+ ```ts
66
+ const batch = await ctx.tools.execute({
67
+ calls: [{
68
+ type: 'tool-call',
69
+ id: ToolCallId('my-call'),
70
+ name: 'some_tool',
71
+ arguments: JSON.stringify({ a: 1 }), // 原始 JSON 字符串,不是对象
72
+ }],
73
+ agent,
74
+ signal,
75
+ })
76
+ // batch: ToolBatchResult = { results, additionalContexts, concluded }
77
+ // batch.results[i]: ToolCallResult = { callId, result: ToolExecutionResult }
78
+ ```
79
+
80
+ 三个必须记住的差异:
81
+
82
+ 1. 入参从 `{callId, name, arguments}` 变成 `{calls: [...]}`。
83
+ 2. `arguments` 是**字符串**,不是对象(rc.3 内部 `JSON.parse`,空字符串按 `{}` 处理)。
84
+ 3. 结果**深了一层**:`result` → `batch.results[i].result`。而且 `results[i]` 本身还带 `callId`,所以想按 id 对应结果时不用自己记顺序。
85
+
86
+ 放多个调用时,一次塞进 `calls` 数组,按 `results` 顺序取;rc.3 会按每个工具自己的并发类别调度(`parallel` 还是 `serial`),这部分你不需要自己管。
87
+
88
+ 相关源码位置(Runtime checkout 内):`packages/core/tools/src/executor.ts`(类型定义)、`packages/core/tools/src/batch.ts`(调度实现)。
89
+
90
+ ### 2. `tools.presentAs()` 被 `tools.setExecutor()` 取代
91
+
92
+ **症状**:调用 `presentAs` 报方法不存在;或者工具策略装上了但没生效。
93
+
94
+ **旧写法**:
95
+ ```ts
96
+ const dispose = agent.ctx.tools.presentAs('native')
97
+ ```
98
+
99
+ **新写法**:
100
+ ```ts
101
+ import { NativeToolExecutor } from '@deepseek-ai/dsh-tool-executor-native'
102
+
103
+ const dispose = agent.ctx.tools.setExecutor(new NativeToolExecutor(agent.ctx))
104
+ ```
105
+
106
+ 语义差异(这点很关键,容易写出 bug):
107
+
108
+ - rc.3 里**同一个 scope 只接受一个「活着的」executor**。第二个声明会抛错。
109
+ - 但 executor 卸载之后,scope 就重新接受新的声明了。
110
+ - 所以「先探一下这个 scope 收不收」的正确做法是:声明 → 立刻释放 → 再正式声明。本插件 `src/presentation.ts` 的 `prepareNativePresentation` 就是这么做的,注释里写清了为什么释放就够。
111
+
112
+ **本插件因此新增了一个 peer 依赖**:`@deepseek-ai/dsh-tool-executor-native >= 0.2.2-rc.1`。这是 `engines.dsh` 下限抬到 `0.2.2-rc.1` 的真正原因——那个包在 npm 上只从 `0.2.2-alpha.2` 才开始存在,0.2.1-rc.x 时期 native 执行器还内建在 Runtime 里。
113
+
114
+ > **v0.2.0 的教训**:当时把 peer 写成 `>=0.2.1-rc.2`,指向一个不存在的版本。npm 为凑区间去拉 `0.2.2-alpha.2`,而它的 `cordis ~4.0.6-alpha.1` 与 0.2.1-rc.x 的 `4.0.5` 冲突,安装直接失败。**peer 范围必须能对上真实存在的版本。**
115
+
116
+ ### 3. 读「这一轮是不是用户发起的」换了 API
117
+
118
+ **症状**:预设写入工具报 `must be called inside an open model turn`,即使确实在对话里;或者报 `ctx.sessionProjections` 是 undefined。
119
+
120
+ **旧写法**:
121
+ ```ts
122
+ const boundary = ctx.sessionProjections.stateOf(agent.session, 'turnBoundary')
123
+ ```
124
+
125
+ **新写法**:
126
+ ```ts
127
+ const boundary = ctx.agents.turnBoundaryOf(agent.session)
128
+ ```
129
+
130
+ 连带变化:插件 `inject` 列表里的 `sessionProjections` 可以去掉(本插件已去掉,现在注入的是 `['agents', 'agentTeams', 'tools', 'systemPrompt', 'settings', 'subagents']`)。
131
+
132
+ 返回值形状没变,还是 `{ openTurnStartSeq, ... }`,`null` 表示当前没有打开的轮次。
133
+
134
+ ### 4. 成员模型路由必须走 selection **事件**,不能只装投影
135
+
136
+ **症状**:成员第一个请求用的模型是对的,但会话恢复、上下文压缩之后模型变了;或者模型选择器显示的和实际跑的不一致。
137
+
138
+ **旧写法** —— 只装一个投影,覆盖当前值:
139
+ ```ts
140
+ disposers.push(installModelSelection(agent.ctx, {
141
+ current: { provider, model, reasoningEffort },
142
+ assembled: undefined,
143
+ }))
144
+ ```
145
+
146
+ **新写法** —— 先通过 Agent 记录一条 selection 事件,再装投影;投影只负责重放会话里已经记下的值:
147
+ ```ts
148
+ agent.model.select({ provider, model, reasoningEffort })
149
+ disposers.push(installModelSelection(agent.ctx))
150
+ ```
151
+
152
+ 原因:rc.3 的会话日志是权威来源。只装投影不改事件,replay / compaction / 模型选择器三者就会各说各话。本插件改动在 `src/member-runtime.ts` 的 `installMemberScopes`。
153
+
154
+ ### 5. `Subagents` 服务多要求一个依赖
155
+
156
+ **症状**:测试里 `ctx.plugin(Subagents)` 之后 `ctx.subagents` 是 `undefined`,报 `Cannot read properties of undefined (reading 'registerProvider')` / `(reading 'list')` / `(reading 'getProvider')`。
157
+
158
+ rc.3 的 `SubagentRuntime` 声明了 `static inject = ['workingDirectory', 'sessionProjections']`。所以只提供 `workingDirectory` 不够了,还得有 `sessionProjections`(`SessionProjectionRegistry`,来自 `@deepseek-ai/dsh-session-projection`)。
159
+
160
+ **最省事的修法**:测试里用 `mountAgentLoopTestDependencies(ctx)`,它已经按正确顺序挂好 `LlmRuntime / SessionStore / SessionProjectionRegistry / SystemPrompt / ToolRuntime / NativeToolExecutor / AgentRegistry`。要手搓最小上下文的话,在挂 `Subagents` **之前** `await ctx.plugin(SessionProjectionRegistry)`。
161
+
162
+ > 注意别被这条误导:插件自己的 `inject` 里去掉了 `sessionProjections`(见第 3 条),但**测试装配**里挂着它——这是两件事。插件不需要读它了,可 `Subagents` 需要它存在。
163
+
164
+ ### 6. 工具执行器必须真的挂上,否则运行时报 "unavailable"
165
+
166
+ **症状**:`ToolExecutorUnavailableError: The selected tool executor is unavailable. Load an executor in this composition before running the agent.`
167
+
168
+ 这不是代码错,是组合里没挂 `NativeToolExecutor`(或 PTC 那个)。`mountAgentLoopTestDependencies` 默认会挂;手搓上下文的必须自己补。
169
+
170
+ ### 7. 【最容易翻车】`setExecutor()` 的声明释放了,这个 scope 就废了
171
+
172
+ 这条是 rc.3 最隐蔽的一处,**单元级看不出来,只有「插件被卸载过一次」才炸**。
173
+
174
+ **症状**:同一个 `ToolExecutorUnavailableError`,但组合里明明挂了 executor。
175
+
176
+ **实测行为**(我写了探针逐条验过):
177
+
178
+ | 步骤 | 结果 |
179
+ |---|---|
180
+ | root 有 executor,正常调用 | ✅ 正常 |
181
+ | 在 **agent scope** 调 `setExecutor(...)` | ✅ 正常 |
182
+ | 调用它的 disposer 释放 | ❌ 之后每次调用都抛 `ToolExecutorUnavailableError` |
183
+ | 在同一 scope **再** `setExecutor(...)` | ✅ 恢复 |
184
+
185
+ 原因:`setExecutor()` 的文档写着 *"Unloading leaves the selection unavailable until it is replaced"* —— 释放**不会回退到父层或 root**,它留下一条 `executor: undefined` 的记录,专门用来防止程序悄悄落到另一个 executor 上。而 `selectExecutor` 沿 scope 链找到这条记录就 `break`,不检查它是不是空的。
186
+
187
+ **所以**:
188
+ - 想让 scope 回到默认,只能**重新声明**,不能靠释放。
189
+ - 任何「临时装一下、用完就释放」的 probe 写法都是定时炸弹。
190
+ - 插件被卸载(HMR、重新加载、quarantine 重建角色)时如果释放了 agent-scope 声明,**这个会话的所有工具调用全废**,包括它自己的恢复通道。
191
+
192
+ **正确写法**:声明绑定到**真正拥有它的那个 scope 的生命周期**,而不是申请它的那次调用的生命周期。
193
+
194
+ ```ts
195
+ // ✅ 声明随 Agent 存活,插件卸载不影响;同一 Agent 只声明一次
196
+ const declarations = new WeakMap<Agent, () => void>()
197
+ export function installNativePresentation(agent: Agent): () => void {
198
+ if (declarations.has(agent)) return () => {}
199
+ const release = agent.ctx.tools.setExecutor(new NativeToolExecutor(agent.ctx))
200
+ declarations.set(agent, release)
201
+ agent.ctx.effect(() => () => { declarations.delete(agent); release() }, 'name')
202
+ return () => {} // 调用方拿到的disposer是空操作
203
+ }
204
+
205
+ // ❌ probe 用完就释放:下一次这个 Agent 的任何调用都会抛 unavailable
206
+ const release = agent.ctx.tools.setExecutor(new NativeToolExecutor(agent.ctx))
207
+ release()
208
+ ```
209
+
210
+ **验证要点**:`agent.ctx.effect()` 注册的清理函数**随 Agent 销毁**,不随插件卸载。我实测过:插件 dispose 后声明仍在、调用正常;Agent dispose 后才真正释放。这是让二者生命周期正确解耦的关键。
211
+
212
+ 本插件因此在 `src/presentation.ts` 用了一张 `WeakMap` 缓存声明,`src/tool-policy.ts` 的 `guardPolicy` 只复用、不再拥有或释放它。
213
+
214
+ ---
215
+
216
+ ## 三、让智能体帮你适配(可直接粘给它)
217
+
218
+ 把下面这段丢给你的智能体,它能照着干活,不用你解释背景:
219
+
220
+ > 这个 DSH 插件要适配 Runtime `0.2.1-rc.3`。rc.2 到 rc.3 的变化点已记录在仓库 `ADAPTATION.md`,请先读它。
221
+ >
222
+ > 具体做:
223
+ > 1. `grep -rn "tools.execute({" src/ tests/` 找出所有单次调用形状,改成 `{ calls: [{ type:'tool-call', id, name, arguments: JSON.stringify(args) }] }`,结果取 `batch.results[i].result`。
224
+ > 2. `grep -rn "presentAs" src/ tests/` ���成 `setExecutor(new NativeToolExecutor(ctx))`;注意同 scope 只能有一个活 executor,探测后要立即释放。
225
+ > 3. `grep -rn "sessionProjections.stateOf" src/ tests/` 改成 `ctx.agents.turnBoundaryOf(session)`,并把 `sessionProjections` 从插件 `inject` 里去掉。
226
+ > 4. `grep -rn "installModelSelection" src/` 确认是先 `agent.model.select(...)` 再装投影。
227
+ > 5. 测试里挂 `Subagents` 之前确认 `workingDirectory` 与 `sessionProjections` 都在,否则用 `mountAgentLoopTestDependencies`。
228
+ > 6. `package.json` 的 `engines.dsh` 抬到 `>=0.2.1-rc.2 <0.3.0`,并加 peer `@deepseek-ai/dsh-tool-executor-native`。
229
+ >
230
+ > 每改一处就单独跑相关测试;不要为了变绿放宽断言。改完跑类型检查、构建、全量测试。
231
+
232
+ ---
233
+
234
+ ## 四、本版新增的功能:队长人事权限(personnelControl)
235
+
236
+ 顺带记录,因为这是 `0.2.0` 相对上游 `0.1.8` 的功能增量。
237
+
238
+ **用途**:让队长自己管团队成员名单,不必每次都由人去设置页改。
239
+
240
+ **开关**:每个团队一个 `personnelControl` 布尔值,**默认关闭**。开启本身即授权,队长不再逐次申请审批。
241
+
242
+ **开着的时候队长能做**(走 `update_team_preset` 工具):
243
+ - 新增成员、改成员名字
244
+ - 改成员的描述、系统提示词
245
+ - 改成员的 `provider` / `model` / `reasoningEffort`
246
+ - 改成员的 `toolMode` / `tools`
247
+ - 移除成员
248
+
249
+ **两条护栏**(都在 `src/preset-editor.ts`):
250
+ 1. `toolMode: "custom"` 配空工具列表 → 拒绝。空白名单等于「一个工具都不许」,与打错字无法区分。
251
+ 2. 切回 `toolMode: "all"` 时清空已存列表。否则日后切回 `custom` 会悄悄复活一个没人重选过的限制。
252
+
253
+ **一条权限护栏**(`src/preset-tools.ts` 的 `writeAuthorisedByPolicy`):会话权限等级为「仅可查看」(read-only)时,成员名单写入被拒。因为那不是「不许改预设」,而是「这个会话什么都不改」。
254
+
255
+ **生效时机**:名单在一次任务边界后生效,不在改它的那一轮内生效。因为名单在工具集注册时就解析完了。
256
+
257
+ ---
258
+
259
+ ## 五、改动清单(本版相对上游 0.1.8)
260
+
261
+ ### Runtime API 迁移
262
+
263
+ | 文件 | 改动 |
264
+ |---|---|
265
+ | `src/presentation.ts` | `presentAs('native')` → `setExecutor(new NativeToolExecutor(ctx))`;声明随 **Agent 生命周期**持有,不再释放(见下方「第 7 点」) |
266
+ | `src/tool-policy.ts` | 同上,守卫路径;`guardPolicy` 不再拥有/释放该声明 |
267
+ | `src/preset-tools.ts` | `sessionProjections.stateOf` → `agents.turnBoundaryOf`;新增 read-only 权限护栏;成员路由整体校验 |
268
+ | `src/member-runtime.ts` | 模型路由改为先 `agent.model.select()` 记录事件,再装投影 |
269
+ | `src/index.ts` | `inject` 去掉 `sessionProjections` |
270
+ | `src/application.ts` | 注释与类型措辞跟进 executor 语义 |
271
+ | `package.json` | `engines.dsh` → `>=0.2.1-rc.2`;新增 peer `dsh-tool-executor-native` |
272
+ | `tsconfig.host.json` / `tsconfig.client.json` | 补入 12 个此前漏检的源文件(覆盖 36 → 48,全覆盖) |
273
+
274
+ ### 功能增量
275
+
276
+ | 文件 | 改动 |
277
+ |---|---|
278
+ | `src/types.ts` | `TeamPreset.personnelControl?: boolean` |
279
+ | `src/config.ts` | 配置 schema 增加 `personnelControl`,默认 `false` |
280
+ | `src/preset-editor.ts` | 成员增删改全套:`name`/`provider`/`model`/`reasoningEffort`/`toolMode`/`tools`/`remove`,含两条护栏 |
281
+ | `src/preset-tools.ts` | `update_team_preset` 暴露上述参数;`get_team_preset` 回报完整成员配置 |
282
+ | `src/client/preset-file.ts` | 新增文件格式 v3,携带 `personnelControl`,v1/v2 兼容读取 |
283
+ | `src/client/TeamEditorView.tsx` | 设置页新增人事权限开关 |
284
+ | `src/client/locales.ts` | 中英文案 |
285
+
286
+ ### 新增测试
287
+
288
+ | 文件 | 覆盖 |
289
+ |---|---|
290
+ | `tests/personnel-control.spec.ts` | 16 个用例:开关语义、增删改、两条护栏、read-only 拒绝 |
291
+ | `tests/team-editor.client.spec.tsx` | 设置页开关渲染 |
292
+ | `tests/preset-tools.spec.ts` | 从 33 增至 37 |
293
+
294
+ ---
295
+
296
+ ## 六、验证状态(诚实版)
297
+
298
+ 本版发布前实测过:
299
+
300
+ | 项目 | 结果 |
301
+ |---|---|
302
+ | 类型检查(host) | 0 本地诊断 |
303
+ | 类型检查(client) | 0 本地诊断 |
304
+ | 构建 | 通过,产物 `lib/index.js` SHA256 `5dc3c1dbf55f96857ea313563caca82cda2a40824b52d9d175bb4eb9627b71d1` |
305
+ | 全量测试 | 762 个用例:**761 通过 / 1 跳过 / 0 失败**(51 文件,连跑 3 次一致) |
306
+ | 真实运行时加载 | 已在本机 Runtime `0.2.1-rc.3` 上线运行 |
307
+
308
+ **没有验证到的**:
309
+ - Windows 平台。路径分隔符与可执行文件解析有单元测试覆盖,但没有真机跑过完整原生构建链。
310
+ - Runtime `0.3.x`。本版不声明支持。
311
+
312
+ ---
313
+
314
+ ## 七、本地开发怎么跑
315
+
316
+ 需要一份**装了依赖**的 Runtime checkout:
317
+
318
+ ```sh
319
+ export DSH_CHECKOUT=/绝对路径/deepseek-runtime
320
+ npm test # 单元/组合测试
321
+ npm run typecheck # host + client 两面
322
+ npm run bundle # 构建 lib/
323
+ ```
324
+
325
+ 构建脚本会在临时工作区里镜像 checkout,**绝不写进 Runtime 目录**。
326
+
327
+ **踩过的坑**:某些测试要在「祖先目录没有 node_modules」的目录里跑(为了证明产物没有裸 `zod` 依赖)。如果 `/tmp` 下有 `node_modules`,`typert-isolation.spec.ts` 会整组跳过并报 `No dependency-isolated scratch directory is available`。绕过:
328
+
329
+ ```sh
330
+ TMPDIR=/dev/shm npm test
331
+ ```
package/CREDITS.md ADDED
@@ -0,0 +1,83 @@
1
+ # 来源与致谢 · Origins and Credits
2
+
3
+ 本仓库是一个**下游适配分支**,不是从零开始的独立作品。它的存在建立在他人的工作之上,这一页把关系写清楚。
4
+
5
+ *This repository is a downstream adaptation fork, not an independent work built from nothing. This page states the relationship plainly.*
6
+
7
+ ---
8
+
9
+ ## 一、起点:上游作者
10
+
11
+ **原项目**:[bloodarea/dsh-agent-team-presets](https://github.com/bloodarea/dsh-agent-team-presets)
12
+ **原作者**:**bloodarea**
13
+ **npm**:[dsh-team-presets](https://www.npmjs.com/package/dsh-team-presets)
14
+
15
+ 这个插件的**全部设计起点**来自上游。具体来说,下列内容由原作者创作,本仓库沿用而非重写:
16
+
17
+ | 范围 | 说明 |
18
+ |---|---|
19
+ | 插件整体架构 | 一个 Host 行同时充当 bundle 与它组合的插件;`dsh.bundle.patch` 装配方式 |
20
+ | 团队预设数据模型 | 队长 + 成员的配置结构、每成员独立的 provider / 模型 / 思考强度 / 工具白名单 |
21
+ | 9 套内置预设 | `contrib/default-presets/` 下全部团队的原始设定 |
22
+ | 私有 Team Skill 子系统 | 技能目录存储、事务日志、依赖解析、按角色作用域隔离注册的整套机制 |
23
+ | 浏览器前端 | 设置页、输入区团队选择器、预设编辑器、导入导出界面的原始实现 |
24
+ | 面向智能体的工具面 | 预设读写、技能管理、成员召唤等工具的定义与语义 |
25
+
26
+ 没有上游的这些打底,本仓库没有可以「适配」的对象。**原作者是这项工作的真正起点。**
27
+
28
+ ---
29
+
30
+ ## 二、本分支做了什么
31
+
32
+ 本仓库的工作集中在**让它在新版 Runtime 上继续可用,并补上使用门槛**。相对上游的增量:
33
+
34
+ | 增量 | 性质 |
35
+ |---|---|
36
+ | Runtime API 迁移(rc.2 → rc.3 → 0.2.2) | 适配。上游停在某个版本,本分支跟进后续 Runtime 的接口变化 |
37
+ | 修掉 `setExecutor` 释放后留下永久墓碑的执行器缺陷 | 修 bug。绑定到 Agent 生命周期而非插件卸载 |
38
+ | 队长人事权限(`personnelControl`) | 新功能。允许队长在运行中增删改队员 |
39
+ | 中文文档与 `ADAPTATION.md` | 文档。把迁移点写成别的 agent 能直接照做的东西 |
40
+ | 脱敏示例团队 | 文档。一套可直接导入的真实配置 |
41
+ | 打包与发布整理 | 工程。`files` 白名单、凭据扫描、构建校验 |
42
+
43
+ **一句话**:上游提供骨架与创意,本分支负责让它活下去、并解释清楚怎么用。
44
+
45
+ ---
46
+
47
+ ## 三、三方素材
48
+
49
+ | 来源 | 内容 | 许可 |
50
+ |---|---|---|
51
+ | **张灏焱** | 贡献 `grilling`、`research` 两个方法型 Team Skill | MIT |
52
+ | **Matt Pocock** — [skills](https://github.com/mattpocock/skills) | 上述两个方法技能改编自它,pin 到 commit `5beb35b0` | MIT,全文见 [NOTICE](<NOTICE>) |
53
+
54
+ ---
55
+
56
+ ## 四、许可与归属
57
+
58
+ [MIT](<LICENSE>)。`LICENSE` 里并列保留两行版权:
59
+
60
+ ```
61
+ Copyright (c) 2026 bloodarea (original author)
62
+ Copyright (c) 2026 Jax (modifications and packaging in this fork)
63
+ ```
64
+
65
+ MIT 允许修改与再分发,但不允许抹掉原始署名。**本仓库不抹。** 任何再分发本仓库的人,也应当保留这两行。
66
+
67
+ 上游仓库本身**未做任何改动**——本分支的 remote `origin` 仍指向上游,但从未向它推送。
68
+
69
+ ---
70
+
71
+ ## 五、如果你要基于本仓库再做分支
72
+
73
+ 请照做:
74
+
75
+ 1. 保留 `LICENSE` 里的 original author 一行。
76
+ 2. 在 `CREDITS.md` 里说明你的改动范围,别把上游的工作算成自己的。
77
+ 3. 如果改的是 Runtime 适配,先读 [ADAPTATION.md](<ADAPTATION.md>)——那里记了踩过的坑。
78
+
79
+ 这样这条线才能一直往回追到真正的起点。
80
+
81
+ ---
82
+
83
+ <sub>本页中英文合并版。English readers: the table in section 一 and 二 is the substance; the rule is simple — the architecture, the preset model, the built-in teams and the Team Skill subsystem come from **bloodarea**, and this fork adapts them to newer Runtime releases and documents how. Keep both copyright lines.</sub>
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bloodarea (original author)
4
+ Copyright (c) 2026 Jax (modifications and packaging in this fork)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/NOTES.en.md ADDED
@@ -0,0 +1,99 @@
1
+ # On this plugin, and where it came from
2
+
3
+ *A note for users and for whoever comes next · 2026-11-11*
4
+
5
+ ---
6
+
7
+ ## I. The conclusion first
8
+
9
+ The development of `dsh-agent-team-presets` **was inspired by the original author, [bloodarea](https://github.com/bloodarea/dsh-agent-team-presets)**.
10
+
11
+ That is not a courtesy line. It is an accurate description. The substantial parts — how the plugin is assembled, what a team preset looks like, the nine built-in teams, how private skills are isolated per role — were not conceived in this repository. This repository did something else.
12
+
13
+ Stating that plainly matters more than stating it pleasantly.
14
+
15
+ ---
16
+
17
+ ## II. What upstream contributed
18
+
19
+ **The original author is where this work begins.** Precisely enough to point at:
20
+
21
+ | Upstream creation | Weight |
22
+ |---|---|
23
+ | Overall plugin architecture | One Host row serving both as the bundle and as the plugin it composes, assembled through `dsh.bundle.patch`. This is the foundation the whole plugin stands on |
24
+ | Team preset data model | A captain plus members, each member with its own provider, model, reasoning effort and tool allow-list. This abstraction decided what the plugin could do |
25
+ | Nine built-in presets | Complete team definitions from lightweight through full-stack to audit. An upstream product judgement |
26
+ | Private Team Skill subsystem | Skill directory storage, transactional journal, dependency resolution, registration isolated into one role's scope. Technically the hardest part |
27
+ | Browser front end | The original settings page, composer team picker and preset editor |
28
+ | Agent-facing tool surface | The definitions and semantics of the preset, skill-management and member-summoning tools |
29
+
30
+ Read that table and the conclusion follows: **without upstream there would have been nothing here to adapt.**
31
+
32
+ ---
33
+
34
+ ## III. What this branch did
35
+
36
+ Relative to upstream, the work here is concentrated on **keeping it usable on newer Runtime releases and lowering the barrier for others**:
37
+
38
+ | Addition | Nature | Detail |
39
+ |---|---|---|
40
+ | Runtime API migration | Adaptation | Upstream pinned a release; later Runtime interfaces changed. This branch follows them |
41
+ | Executor lifetime defect fix | Bug fix | Releasing `setExecutor` left a permanent tombstone at the Agent scope that never falls back to the root executor. The fix binds the declaration to the Agent lifetime rather than to plugin unload |
42
+ | Captain personnel control (`personnelControl`) | Feature | Lets the captain add, remove and edit members while running, without a trip to the settings page |
43
+ | Chinese documentation and `ADAPTATION.md` | Documentation | Seven API migration points written so another agent can follow them directly |
44
+ | Desensitized example team | Documentation | A real configuration with the personnel switch, stripped of private detail, importable as-is |
45
+ | Packaging and release hygiene | Engineering | `files` allow-list, credential scan, build verification, version alignment |
46
+
47
+ **The division of labour is clear.** Upstream supplied the skeleton and the ideas; this branch keeps it alive and explains how to use it. Conflating the two would be unfair to the original author and dishonest to users.
48
+
49
+ ---
50
+
51
+ ## IV. Third-party material
52
+
53
+ | Source | Content | License |
54
+ |---|---|---|
55
+ | **张灏焱** | The `grilling` and `research` method Team Skills | MIT |
56
+ | **Matt Pocock** — [skills](https://github.com/mattpocock/skills) | The two method skills adapt these, pinned at `5beb35b0` | MIT, full text in [NOTICE](<NOTICE>) |
57
+
58
+ ---
59
+
60
+ ## V. License and boundaries
61
+
62
+ [MIT](<LICENSE>). `LICENSE` retains two copyright lines side by side:
63
+
64
+ ```
65
+ Copyright (c) 2026 bloodarea (original author)
66
+ Copyright (c) 2026 Jax (modifications and packaging in this fork)
67
+ ```
68
+
69
+ MIT permits modification and redistribution, **but not the removal of original attribution.** This repository does not remove it.
70
+
71
+ One more thing worth writing down: **the upstream repository has never been touched.** This repository's `origin` remote still points at it, and not one commit has been pushed there. Adaptation happens on the fork. Keeping the fork clean is not a favour to anyone — it is just the correct way to work.
72
+
73
+ ---
74
+
75
+ ## VI. If you fork this again
76
+
77
+ Three things, please:
78
+
79
+ 1. Keep the original author line in `LICENSE`.
80
+ 2. State your scope of change in [CREDITS.md](<CREDITS.md>). Do not count upstream's work as your own.
81
+ 3. If your change is a Runtime adaptation, read [ADAPTATION.md](<ADAPTATION.md>) first. It records the traps. It will save you a day.
82
+
83
+ That is how this chain stays traceable back to where it actually started.
84
+
85
+ ---
86
+
87
+ ## VII. Current state
88
+
89
+ | Item | Value |
90
+ |---|---|
91
+ | Plugin version | `0.2.1` |
92
+ | Runtime support | `>= 0.2.2-rc.1 < 0.3.0` |
93
+ | Tests | 762 cases / 761 passed / 1 skipped / 0 failed across 51 files |
94
+ | Typecheck | host 0 local diagnostics / client 0 local diagnostics |
95
+ | Distribution | GitHub Releases + npm (package name `dsh-team-presets`, distinct from the upstream `dsh-agent-team-presets`) |
96
+
97
+ ---
98
+
99
+ <sub>This note complements the [README](<README.en.md>) and [CREDITS.md](<CREDITS.md>): the README explains usage, CREDITS explains attribution, this note explains the history and the reasoning. 中文版:[NOTES.md](<NOTES.md>)。</sub>
package/NOTES.md ADDED
@@ -0,0 +1,99 @@
1
+ # 关于这个插件,以及它从哪里来
2
+
3
+ *一份给使用者与后来者的说明 · 2026-11-11*
4
+
5
+ ---
6
+
7
+ ## 一、先说结论
8
+
9
+ `dsh-agent-team-presets` 这个插件,**它的开发由原作者 [bloodarea](https://github.com/bloodarea/dsh-agent-team-presets) 启发**。
10
+
11
+ 这不是一句客套。它是对事实的准确描述:容器里那些真正有分量的东西——插件怎么装配、团队预设长什么样、9 套内置团队、私有技能怎么按角色隔离——都不是本仓库想出来的。本仓库做的是另一件事。
12
+
13
+ 把话说清楚,比把话说好听重要。
14
+
15
+ ---
16
+
17
+ ## 二、上游给了什么
18
+
19
+ **原作者是这项工作的起点。** 具体到可以逐项指认的程度:
20
+
21
+ | 上游创作 | 分量 |
22
+ |---|---|
23
+ | 插件整体架构 | 一个 Host 行同时充当 bundle 与它组合的插件,用 `dsh.bundle.patch` 装配。这是整个插件得以成立的地基 |
24
+ | 团队预设数据模型 | 队长 + 成员;每个成员独立的 provider、模型、思考强度、工具白名单。这个抽象决定了插件能做什么 |
25
+ | 9 套内置预设 | 从「轻量」到「全栈」到「审计」的完整团队设定,是上游的产品判断 |
26
+ | 私有 Team Skill 子系统 | 技能目录存储、事务日志、依赖解析、按角色作用域隔离注册。这是技术上最难的一块 |
27
+ | 浏览器前端 | 设置页、输入区团队选择器、预设编辑器的原始实现 |
28
+ | 面向智能体的工具面 | 预设读写、技能管理、成员召唤等工具的定义与语义 |
29
+
30
+ 读完这张表,结论不难得出:**没有上游,本仓库没有可以「适配」的对象。**
31
+
32
+ ---
33
+
34
+ ## 三、本分支做了什么
35
+
36
+ 相对上游,这里的工作集中在**让它在新版 Runtime 上继续可用,并降低别人的使用门槛**:
37
+
38
+ | 增量 | 性质 | 说明 |
39
+ |---|---|---|
40
+ | Runtime API 迁移 | 适配 | 上游停在某个版本,后续 Runtime 的接口变了。本分支跟进 |
41
+ | 执行器生命周期缺陷修复 | 修 bug | `setExecutor` 释放后会在 Agent 作用域留下永久墓碑,不会回落到 root 执行器。修法是把声明绑定到 Agent 生命周期,而不是插件卸载 |
42
+ | 队长人事权限 `personnelControl` | 新功能 | 让队长在运行中增删改队员,不必回设置页 |
43
+ | 中文文档与 `ADAPTATION.md` | 文档 | 把七个 API 迁移点写成别的 agent 能直接照做的东西 |
44
+ | 脱敏示例团队 | 文档 | 一套带人事权限开关的真实配置,去掉私有信息后可直接导入 |
45
+ | 打包与发布整理 | 工程 | `files` 白名单、凭据扫描、构建校验、版本对齐 |
46
+
47
+ **分工是清楚的。** 上游提供骨架与创意,本分支负责让它活下去、并解释清楚怎么用。把这两件事混为一谈,对原作者不公平,对使用者也不诚实。
48
+
49
+ ---
50
+
51
+ ## 四、三方素材
52
+
53
+ | 来源 | 内容 | 许可 |
54
+ |---|---|---|
55
+ | **张灏焱** | `grilling`、`research` 两个方法型 Team Skill | MIT |
56
+ | **Matt Pocock** — [skills](https://github.com/mattpocock/skills) | 上述两个技能改编自它,pin 到 `5beb35b0` | MIT,全文见 [NOTICE](<NOTICE>) |
57
+
58
+ ---
59
+
60
+ ## 五、许可与边界
61
+
62
+ [MIT](<LICENSE>)。`LICENSE` 里并列保留两行版权:
63
+
64
+ ```
65
+ Copyright (c) 2026 bloodarea (original author)
66
+ Copyright (c) 2026 Jax (modifications and packaging in this fork)
67
+ ```
68
+
69
+ MIT 允许修改与再分发,**但不允许抹掉原始署名**。本仓库不抹。
70
+
71
+ 还有一条值得写下来:**上游仓库从未被改动。** 本仓库的 `origin` remote 仍指向上游,但一次提交也没往那边推过。适配在分叉上做,污染留给别人是另一回事——两件事本仓库都不做。
72
+
73
+ ---
74
+
75
+ ## 六、如果还要再分叉
76
+
77
+ 请照做三件事:
78
+
79
+ 1. 保留 `LICENSE` 里 original author 那一行。
80
+ 2. 在 [CREDITS.md](<CREDITS.md>) 里说明你的改动范围,别把上游的工作算成自己的。
81
+ 3. 如果改的是 Runtime 适配,先读 [ADAPTATION.md](<ADAPTATION.md>)——那里记着踩过的坑,能省你一整天。
82
+
83
+ 这样这条线才能一直往回追到真正的起点。
84
+
85
+ ---
86
+
87
+ ## 七、当前状态
88
+
89
+ | 项 | 值 |
90
+ |---|---|
91
+ | 插件版本 | `0.2.1` |
92
+ | Runtime 支持 | `>= 0.2.2-rc.1 < 0.3.0` |
93
+ | 测试 | 762 用例 / 761 通过 / 1 跳过 / 0 失败,51 文件全过 |
94
+ | 类型检查 | host 0 本地诊断 / client 0 本地诊断 |
95
+ | 发布形态 | GitHub Releases + npm(包名 `dsh-team-presets`,与上游 `dsh-agent-team-presets` 区分) |
96
+
97
+ ---
98
+
99
+ <sub>本说明与 [README](<README.md>)、[CREDITS.md](<CREDITS.md>) 互为补充:README 讲怎么用,CREDITS 讲归属,本文讲来龙去脉与判断。English version: [NOTES.en.md](<NOTES.en.md>)。</sub>
package/NOTICE ADDED
@@ -0,0 +1,38 @@
1
+ Third-party skill documents
2
+ ===========================
3
+
4
+ This repository includes Team Skill documents adapted from:
5
+
6
+ Matt Pocock, "skills"
7
+ https://github.com/mattpocock/skills
8
+ commit 5beb35b040e3de97e54fa9e386d7e42d15c295c2
9
+
10
+ Adapted files:
11
+
12
+ - assets/skills/grilling/SKILL.md
13
+ - assets/skills/research/SKILL.md
14
+
15
+ These files are DSH adaptations and differ from the upstream originals.
16
+ The upstream material is licensed under the MIT License, reproduced below.
17
+
18
+ MIT License
19
+
20
+ Copyright (c) 2026 Matt Pocock
21
+
22
+ Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ of this software and associated documentation files (the "Software"), to deal
24
+ in the Software without restriction, including without limitation the rights
25
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ copies of the Software, and to permit persons to whom the Software is
27
+ furnished to do so, subject to the following conditions:
28
+
29
+ The above copyright notice and this permission notice shall be included in all
30
+ copies or substantial portions of the Software.
31
+
32
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
+ SOFTWARE.