dsh-plugin-subagent-director 0.3.0 → 0.4.0-beta.1

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 CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  本项目的所有显著变更都会记录在此文件中。格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.4.0-beta.1] - 2026-08-30
6
+
7
+ ### 新增
8
+
9
+ - **纯编排模式(`/orchestrate`)**(PR #3,@WinterSold1er):`/orchestrate on|off` 命令(无参数默认 on),开启后注入「纯编排者」系统提示——主代理只允许通过 `subagent_role` 委派、禁止亲自读/写/执行,角色清单从 `subagent-director.roles` 动态渲染(无硬编码 role id),未配置角色时提示先配置;`sessionProjections` 服务缺失时命令返回明确错误而非假装成功。
10
+
11
+ ### 修复
12
+
13
+ - **真实 cordis 探针发现的隐性 bug**(issue #5):cordis 的 `ctx.effect(fn)` 契约是「立即执行 fn、以返回值为 disposer」,原先包在 effect 里的 `fiber.dispose()` 清理块会把 `/orchestrate` 命令与 projection 的 `ctx.inject` 子 fiber **在创建瞬间卸载**——真实宿主上命令从未注册成功过(既有测试全基于 fake,未覆盖该契约);子 fiber 本就随父 fiber 生命周期自动卸载,清理块已移除,并由新增的真实 cordis 探针测试永久钉住;
14
+ - **开发/测试环境对齐真实宿主 0.1.1 线**(issue #5):devDeps 与 peer ranges 由 `0.1.0-rc.6/rc.8` 升至 `^0.1.1-rc.2`(新增 `dsh-session-projection` peer);projection 注册改用真实类型契约(`SessionEventMap` / `SessionProjectionStateMap` / `SessionProjectionMap` 声明合并 + 类型化 `register`),契约形状漂移现在在 typecheck 期暴露,而不是运行期被 `snapshot()` 静默跳过;
15
+ - 顶层 `inject` 移除 `'commands'`(非 dsh-base 装配上主条目会永久 PENDING、核心委派功能全失效);命令 handler 增加 `invocation.agent.session` 可选链守卫;
16
+ - 移除未使用的 `@deepseek-ai/dsh-client-schema-form` 依赖(源码零引用,且其 0.1.0 线 peer 链与 0.1.1 线冲突)。
17
+
18
+ ### 测试
19
+
20
+ - 单元/集成测试由 197 增至 233:`/orchestrate` 功能与接线用例、handler 守卫用例,以及**真实 cordis `Context` + 真实 `SessionProjectionRegistry` 集成探针**(无 commands 服务时主条目正常激活、核心服务缺失时保持 PENDING、commands 后到时命令经真实 `ctx.inject` 子 fiber 响应式注册、projection 经真实 `snapshot()` 驱动 on→off 折叠)。
21
+
22
+ ### 已知取舍
23
+
24
+ - 用过 `/orchestrate` 的会话在未挂载本插件的 boot(卸载后、其他 profile)中无法加载:上游暂无第三方事件注册 / `ignorable` 写入 API,已在 README FAQ 与 issue #6 记录。
25
+
5
26
  ## [0.3.0] - 2026-08-29
6
27
 
7
28
  ### 新增
package/README.md CHANGED
@@ -55,7 +55,7 @@ dsh plugin --profile <name> add dsh-plugin-subagent-director
55
55
  name: dsh-plugin-subagent-director
56
56
  config:
57
57
  subagentProvider: spawn # 传输:spawn(无父上下文)/ fork(继承父历史)
58
- toolName: subagent_role # 模型可见工具名
58
+ toolName: subagent_role # 本插件注册的模型可见工具名(不是内置 subagent)
59
59
  enableRunInBackground: true
60
60
  backgroundMode: one-shot # one-shot 或 continuable
61
61
  maxDepth: 3
@@ -124,6 +124,27 @@ subagent_role({ role: "code-reviewer", model: "deepseek-chat", prompt: "..." })
124
124
  `role` 参数支持用角色 id 或显示名引用:未命中 id 时会按 `displayName` 精确匹配
125
125
  (多个同名角色取定义顺序第一个并提示);建议始终用 id,见系统提示中的 Delegate 行。
126
126
 
127
+ > **`subagent_role` 与内置 `subagent` 是两个不同的工具。** 本插件注册的是
128
+ > `subagent_role`(工具名由 `toolName` 配置,默认 `subagent_role`);DSH 基础
129
+ > bundle 另有内置的 `subagent` / `subagent_fork`,两者在同一次请求的工具清单里
130
+ > **并存**。只有走 `subagent_role` 才会应用角色 persona 与 `toolFilter`;模型改用
131
+ > 内置 `subagent` 时这两项不生效(`applyDefaultRoute` 开启时默认模型仍会生效)。
132
+ > 因此需要角色语义时,请在提示里明确要求调用 `subagent_role`。
133
+
134
+ ### 纯编排模式(`/orchestrate`)
135
+
136
+ ```text
137
+ /orchestrate # 等价于 /orchestrate on
138
+ /orchestrate on # 进入纯编排模式
139
+ /orchestrate off # 退出
140
+ ```
141
+
142
+ 打开后会注入一段「纯编排者」系统提示:主代理只允许通过委派工具派活,角色清单
143
+ 从当前 `subagent-director.roles` 动态渲染(无硬编码 role id),未配置角色时提示
144
+ 先去配置。该模式依赖宿主的 `commands` 与 `sessionProjections` 服务:标准 profile
145
+ (dsh-base)都会提供二者;`sessionProjections` 缺失时命令返回明确错误而不是假装
146
+ 成功,`commands` 缺失时命令不注册,插件其余功能不受影响。
147
+
127
148
  ## 术语
128
149
 
129
150
  - **subagentProvider(传输)**:`spawn` / `fork` / `acp`——子代理跑在哪条传输链路上;
@@ -135,7 +156,7 @@ subagent_role({ role: "code-reviewer", model: "deepseek-chat", prompt: "..." })
135
156
 
136
157
  ```bash
137
158
  npm install
138
- npm test # vitest(129 用例)
159
+ npm test # vitest(233 用例)
139
160
  npm run typecheck
140
161
  npm run build # host(tsc) + client(rolldown bundle)
141
162
  ```
@@ -150,6 +171,14 @@ DSH 的 Web API 只向白名单内的 settings 命名空间开放读写。本插
150
171
  `defaultProvider`/`defaultModel` 且未关闭 `applyDefaultRoute` 时,所有未显式
151
172
  指定模型的子代理(含内置工具发起的)都会使用该默认模型。
152
173
 
174
+ **用过 `/orchestrate` 的会话,卸载插件后还能打开吗?**
175
+ 不能。`/orchestrate` 会在会话日志写入 `orchestrate/change` 事件,而宿主的持久化
176
+ 加载校验遇到「未知且未标记 ignorable」的事件类型时会拒绝加载整个日志(避免误解
177
+ 日志语义)。插件挂载时会动态注册该事件类型,正常使用不受影响;但在未挂载本插件
178
+ 的环境(卸载后、其他 profile)中,这些会话将无法打开。上游暂未提供第三方事件
179
+ 类型的官方注册或 `ignorable` 写入 API,此为已知取舍,详见
180
+ [issue #6](https://github.com/SeverusZh/dsh-plugin-subagent-director/issues/6)。
181
+
153
182
  **新供应商/API 会自动出现吗?**
154
183
  会。设置页订阅了供应商与设置变更事件,在 Models 页新增供应商/API key 后,下拉列表自动刷新,无需重启。
155
184
 
package/lib/config.d.ts CHANGED
@@ -27,7 +27,17 @@ export interface DirectorConfig {
27
27
  * Default 'spawn'.
28
28
  */
29
29
  subagentProvider?: string;
30
- /** Model-facing tool name, default 'subagent_role'. Each loaded instance must use a distinct name. */
30
+ /**
31
+ * Model-facing tool name for THIS plugin's delegation tool, default
32
+ * 'subagent_role'. Each loaded instance must use a distinct name.
33
+ *
34
+ * Not the same tool as DSH's built-in `subagent` / `subagent_fork`: those are
35
+ * registered by the base bundle and coexist with this one in the same request
36
+ * tool catalog. Only calls that go through this name apply role persona and
37
+ * role `toolFilter`; a model that picks the built-in `subagent` instead gets
38
+ * neither (the default model route still applies when `applyDefaultRoute` is
39
+ * on — see below).
40
+ */
31
41
  toolName?: string;
32
42
  /** Expose `run_in_background` (default true). Disabled instances omit the argument. */
33
43
  enableRunInBackground?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAEvC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,qDAAqD;AACrD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;GAQjB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAEvC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,qDAAqD;AACrD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;GAQjB,CAAC"}
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAiDzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC;IAC7C,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAChD,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACxE,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACjF,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAC7C,CAAC,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AA2DzC,qDAAqD;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC;IAC7C,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAChD,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACxE,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACjF,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CAC7C,CAAC,CAAC"}
package/lib/index.d.ts CHANGED
@@ -8,7 +8,10 @@
8
8
  * Dependency posture: tools/subagents/llm/settings are required through inject
9
9
  * (both web and headless bundles mount the settings service); systemPrompt
10
10
  * remains optional and is acquired lazily so its absence does not block the
11
- * rest. The webServer-dependent HTTP bridge lives in the separate
11
+ * rest. The /orchestrate command's `commands` dependency likewise stays
12
+ * optional — acquired reactively (ctx.inject child fiber) in orchestrate.ts,
13
+ * so hosts without a command registry lose only that command. The
14
+ * webServer-dependent HTTP bridge lives in the separate
12
15
  * \`subagent-director-bridge\` entry (src/bridge-entry.ts).
13
16
  *
14
17
  * Background modes: 'one-shot' defaults calls to foreground and runs background
@@ -22,6 +25,7 @@ export { Config } from './config.js';
22
25
  export type { DirectorConfig } from './config.js';
23
26
  export { assertDelegationCapabilities, buildSubagentRequest, createDelegationParameters, createDelegationOutputSchema, createDelegationTool, DELEGATION_TOOL_PREFIX, resolveDelegationMode, renderDelegationResult, type DelegationToolArgs, type DelegationResult, type DelegationRoute, type DelegationModeDecision, type SubagentRequestParts, } from './delegation-tool.js';
24
27
  export { applyGuidance, renderRolesGuidance, GUIDANCE_SECTION_ORDER, GUIDANCE_SECTION_NAME } from './guidance.js';
28
+ export { applyOrchestrate, renderOrchestratorPrompt, renderOrchestratorRoles, buildOrchestratorFrame, ORCHESTRATE_SECTION_NAME, ORCHESTRATE_SECTION_ORDER, ORCHESTRATE_PROJECTION_KEY, ORCHESTRATE_EVENT_TYPE, ORCHESTRATE_VALID_MODES, type OrchestrateMode, } from './orchestrate.js';
25
29
  export { CLOSE_SUBAGENT_TOOL_NAME, createCloseSubagentTool } from './close-tool.js';
26
30
  export { SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE, SettingsSchema, validateDirectorSettings, installDirectorSettings, type RoleTemplate, type SubagentDirectorSettings, } from './settings.js';
27
31
  export declare const name = "subagent-director";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAUnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CA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BAAsB,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACL,oCAAoC,EACpC,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,IAAI,sBAAsB,CAAC;AAExC,eAAO,MAAM,MAAM,UAA4C,CAAC;AAEhE,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,aAAa,EAAE,cAAc,QAmE/E"}
package/lib/index.js CHANGED
@@ -3,10 +3,12 @@ import { createDelegationTool } from './delegation-tool.js';
3
3
  import { CLOSE_SUBAGENT_TOOL_NAME, createCloseSubagentTool } from './close-tool.js';
4
4
  import { applyDefaultRouteSeam } from './default-route.js';
5
5
  import { applyGuidance } from './guidance.js';
6
+ import { applyOrchestrate } from './orchestrate.js';
6
7
  import { createSettingsSnapshot, installDirectorSettings } from './settings.js';
7
8
  export { Config } from './config.js';
8
9
  export { assertDelegationCapabilities, buildSubagentRequest, createDelegationParameters, createDelegationOutputSchema, createDelegationTool, DELEGATION_TOOL_PREFIX, resolveDelegationMode, renderDelegationResult, } from './delegation-tool.js';
9
10
  export { applyGuidance, renderRolesGuidance, GUIDANCE_SECTION_ORDER, GUIDANCE_SECTION_NAME } from './guidance.js';
11
+ export { applyOrchestrate, renderOrchestratorPrompt, renderOrchestratorRoles, buildOrchestratorFrame, ORCHESTRATE_SECTION_NAME, ORCHESTRATE_SECTION_ORDER, ORCHESTRATE_PROJECTION_KEY, ORCHESTRATE_EVENT_TYPE, ORCHESTRATE_VALID_MODES, } from './orchestrate.js';
10
12
  export { CLOSE_SUBAGENT_TOOL_NAME, createCloseSubagentTool } from './close-tool.js';
11
13
  export { SUBAGENT_DIRECTOR_SETTINGS_NAMESPACE, SettingsSchema, validateDirectorSettings, installDirectorSettings, } from './settings.js';
12
14
  export const name = 'subagent-director';
@@ -35,6 +37,8 @@ export function apply(ctx, config) {
35
37
  }
36
38
  // ---- role guidance ----------------------------------------------------
37
39
  applyGuidance(ctx, getSettings, toolName);
40
+ // ---- orchestrate command + projection + prompt section ----------------
41
+ applyOrchestrate(ctx, getSettings, toolName);
38
42
  // ---- close_subagent tool ----------------------------------------------
39
43
  // Provider-independent (drain is a global subagents operation), so it
40
44
  // registers at mount time like the control tools; on a deployment without
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,GAMvB,MAAM,sB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AAG,CAAC,MAAM,CAAC,IAAI,CACb,GAAG,GAAG,IAAI,GAAG,gBAAgB,GAAG,QAAQ,GAAG,yBAAyB,GAAG,GAAG,GAAG,YAAY,GAAG,GAAG,GAAG,uBAAuB,GAAG,GAAG,GAAG,cAAc,GAAG,GAAG,CACvJ,CAAC;QACF,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC,CAAC;IAEF,GAAG,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,QAA0B,EAAE,EAAE;QAC/D,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI,WAAW,KAAK,SAAS;YAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,KAAa,EAAE,EAAE;QACpD,IAAI,KAAK,KAAK,YAAY,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO;QAChE,WAAW,EAAE,CAAC;QACd,WAAW,GAAG,SAAS,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACxD,IAAI,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,CAAC,CAAC;;QACrC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,sBAAsB,GAAG,GAAG,GAAG,YAAY,GAAG,6BAA6B,GAAG,QAAQ,GAAG,sCAAsC,CAAC,CAAC;AACrK,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Orchestrate command for Subagent Director (merged from the standalone
3
+ * `orchestrate` plugin).
4
+ *
5
+ * Adds a `/orchestrate on|off` slash command that flips a per-session
6
+ * projection and, when on, injects a pure-orchestrator system-prompt section.
7
+ * The orchestrator delegates exclusively through the subagent-director
8
+ * delegation tool, whose model-facing name is `config.toolName` (default
9
+ * `subagent_role`) and is threaded in here as `toolName`.
10
+ *
11
+ * Naming caveat (observed on a live 0.1.1-rc.x web host): the assembled tool catalog
12
+ * contains BOTH this plugin's `subagent_role` and the base bundle's built-in
13
+ * `subagent` / `subagent_fork`. They are distinct tools, not two names for one
14
+ * wire entry. The prompt below names `toolName` explicitly precisely because a
15
+ * model that reaches for the built-in `subagent` bypasses role persona and role
16
+ * toolFilter.
17
+ *
18
+ * The role list rendered into the prompt is derived dynamically from the live
19
+ * plugin settings (`subagent-director.roles`) — the same source `guidance.ts`
20
+ * reads — so it never hard-codes role ids and stays correct when the operator
21
+ * reconfigures roles. When no roles are configured the prompt tells the user
22
+ * to configure them rather than silently emitting an empty section.
23
+ *
24
+ * Service posture mirrors `guidance.ts`: `commands` and `sessionProjections` are
25
+ * acquired reactively through `ctx.inject` (so the `/orchestrate` command and the
26
+ * projection register as soon as the host service is ready, even if it mounts
27
+ * slightly after `apply`), while `systemPrompt` is still read lazily via
28
+ * `ctx.get`. A host that never provides `sessionProjections` degrades to an
29
+ * honest error from the command handler rather than a silent no-op.
30
+ */
31
+ import type { Context } from '@deepseek-ai/cordis';
32
+ import type { SubagentDirectorSettings } from './settings.js';
33
+ /** Stable system-prompt section name. */
34
+ export declare const ORCHESTRATE_SECTION_NAME = "orchestrate-mode";
35
+ /** Prompt order: sits low (55) so the orchestrator contract is near the top. */
36
+ export declare const ORCHESTRATE_SECTION_ORDER = 55;
37
+ /** Per-session projection key holding the orchestrator on/off state. */
38
+ export declare const ORCHESTRATE_PROJECTION_KEY = "orchestrate";
39
+ /** Session event type emitted when the mode changes. */
40
+ export declare const ORCHESTRATE_EVENT_TYPE = "orchestrate/change";
41
+ /** Accepted mode values. */
42
+ export declare const ORCHESTRATE_VALID_MODES: readonly ['on', 'off'];
43
+ export type OrchestrateMode = (typeof ORCHESTRATE_VALID_MODES)[number];
44
+ interface OrchestrateState {
45
+ mode: OrchestrateMode;
46
+ }
47
+ declare module '@deepseek-ai/dsh-session/types' {
48
+ interface SessionEventMap {
49
+ 'orchestrate/change': {
50
+ mode: OrchestrateMode;
51
+ };
52
+ }
53
+ }
54
+ declare module '@deepseek-ai/dsh-session-projection/types' {
55
+ interface SessionProjectionStateMap {
56
+ /** /orchestrate mode state, folded from `orchestrate/change` events. */
57
+ orchestrate: OrchestrateState;
58
+ }
59
+ interface SessionProjectionMap {
60
+ /** Client-visible wire payload of the orchestrate projection unit. */
61
+ orchestrate: {
62
+ mode: OrchestrateMode;
63
+ };
64
+ }
65
+ }
66
+ /**
67
+ * Build the data-independent framing of the orchestrator prompt for a given
68
+ * delegation tool name. The role list is appended separately by
69
+ * {@link renderOrchestratorRoles}.
70
+ * @param toolName - the configured model-facing delegation tool name.
71
+ */
72
+ export declare function buildOrchestratorFrame(toolName: string): string;
73
+ /**
74
+ * Render the role list portion of the orchestrator prompt from the live
75
+ * settings. Returns a "configure roles first" notice when no roles exist so
76
+ * the operator is told what to do instead of receiving a blank contract.
77
+ * @param settings - current resolved settings snapshot.
78
+ * @param toolName - the configured model-facing delegation tool name.
79
+ */
80
+ export declare function renderOrchestratorRoles(settings: SubagentDirectorSettings, toolName: string): string;
81
+ /**
82
+ * Assemble the full orchestrator prompt (framing + dynamic role list).
83
+ * @param settings - current resolved settings snapshot.
84
+ * @param toolName - the configured model-facing delegation tool name.
85
+ */
86
+ export declare function renderOrchestratorPrompt(settings: SubagentDirectorSettings, toolName: string): string;
87
+ /**
88
+ * Wire the `/orchestrate` command, its session projection, and the
89
+ * orchestrator prompt section into the host. Each host-plane service is
90
+ * acquired lazily and guarded, so a missing service degrades to a no-op.
91
+ * @param ctx - plugin context.
92
+ * @param getSettings - returns the current settings snapshot.
93
+ * @param toolName - the configured model-facing delegation tool name.
94
+ */
95
+ export declare function applyOrchestrate(ctx: Context, getSettings: () => SubagentDirectorSettings, toolName: string): void;
96
+ export {};
97
+ //# s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AAG,MAAM,CAepG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUrG;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,WAAW,EAAE,MAAM,wBAAwB,EAC3C,QAAQ,EAAE,MAAM,GACf,IAAI,CAuNN"}
@@ -0,0 +1,277 @@
1
+ import { z } from 'zod';
2
+ import { KNOWN_SESSION_EVENT_TYPES } from '@deepseek-ai/dsh-session';
3
+ /** Stable system-prompt section name. */
4
+ export const ORCHESTRATE_SECTION_NAME = 'orchestrate-mode';
5
+ /** Prompt order: sits low (55) so the orchestrator contract is near the top. */
6
+ export const ORCHESTRATE_SECTION_ORDER = 55;
7
+ /** Per-session projection key holding the orchestrator on/off state. */
8
+ export const ORCHESTRATE_PROJECTION_KEY = 'orchestrate';
9
+ /** Session event type emitted when the mode changes. */
10
+ export const ORCHESTRATE_EVENT_TYPE = 'orchestrate/change';
11
+ /** Accepted mode values. */
12
+ export const ORCHESTRATE_VALID_MODES = ['on', 'off'];
13
+ /**
14
+ * Build the data-independent framing of the orchestrator prompt for a given
15
+ * delegation tool name. The role list is appended separately by
16
+ * {@link renderOrchestratorRoles}.
17
+ * @param toolName - the configured model-facing delegation tool name.
18
+ */
19
+ export function buildOrchestratorFrame(toolName) {
20
+ return `You are a PURE ORCHESTRATOR. Your only action is to call the \`${toolName}\` tool (provided by the subagent-director plugin) to delegate work. You must NEVER read, write, edit, grep, find, or execute anything yourself.
21
+
22
+ The subagent-director plugin supplies its role templates from settings (subagent-director.roles) and the guidance section 'subagent-director:roles'. Delegate exactly one task per call:
23
+
24
+ ${toolName}({ role: '<role-id>', prompt: '<self-contained task>', description: '<what this delegation produces>' })`;
25
+ }
26
+ /**
27
+ * Render the role list portion of the orchestrator prompt from the live
28
+ * settings. Returns a "configure roles first" notice when no roles exist so
29
+ * the operator is told what to do instead of receiving a blank contract.
30
+ * @param settings - current resolved settings snapshot.
31
+ * @param toolName - the configured model-facing delegation tool name.
32
+ */
33
+ export function renderOrchestratorRoles(settings, toolName) {
34
+ const roles = settings.roles ?? {};
35
+ const entries = Object.entries(roles).filter(([, role]) => role !== undefined);
36
+ if (entries.length === 0) {
37
+ return 'No Subagent Director roles are configured yet. Configure `subagent-director.roles` (settings.yaml or the settings panel) before entering orchestrator mode — the orchestrator can only delegate to defined roles.';
38
+ }
39
+ const lines = [
40
+ `Delegate work by calling the \`${toolName}\` tool with a role id from the list below. Reference roles by their id (shown), never by display name, and never invent a role id that is not listed:`,
41
+ ];
42
+ for (const [id, role] of entries) {
43
+ lines.push(`- ${role.displayName || id}: ${role.description}`);
44
+ lines.push(` ${toolName}({ role: "${id}", prompt: "..." })`);
45
+ }
46
+ return lines.join('\n');
47
+ }
48
+ /**
49
+ * Assemble the full orchestrator prompt (framing + dynamic role list).
50
+ * @param settings - current resolved settings snapshot.
51
+ * @param toolName - the configured model-facing delegation tool name.
52
+ */
53
+ export function renderOrchestratorPrompt(settings, toolName) {
54
+ return `${buildOrchestratorFrame(toolName)}\n\n${renderOrchestratorRoles(settings, toolName)}\n\nOrchestration rules:
55
+ 1. Only dispatch. Forbid doing the work yourself.
56
+ 2. Independent tasks -> dispatch them in parallel (multiple ${toolName} calls in one turn).
57
+ 3. Dependent / relay tasks -> wait for the prior subagent to finish, then dispatch the next stage.
58
+ 4. Every subagent prompt must be self-contained: goal, constraints, output format, acceptance criteria. Subagents receive NO parent context.
59
+ 5. If the user's request names a specific role, dispatch to that role id. If a display name is given, map it to its id. If no role is named, dispatch to the role whose display name indicates coordination (e.g. contains 协调 / Orchestrator / Coordinator); when no such role exists, dispatch to the first configured role and let it decompose and coordinate.
60
+ 6. Unclear dependencies or missing information -> ask the USER, never guess.
61
+ 7. For independent fan-out you may set run_in_background: true and collect results later; for relay steps set run_in_background: false so you wait for the result before dispatching the next stage.
62
+ 8. Finish only when every subagent has completed. Then output a summary report: who produced what, and remaining todos.`;
63
+ }
64
+ /**
65
+ * Wire the `/orchestrate` command, its session projection, and the
66
+ * orchestrator prompt section into the host. Each host-plane service is
67
+ * acquired lazily and guarded, so a missing service degrades to a no-op.
68
+ * @param ctx - plugin context.
69
+ * @param getSettings - returns the current settings snapshot.
70
+ * @param toolName - the configured model-facing delegation tool name.
71
+ */
72
+ export function applyOrchestrate(ctx, getSettings, toolName) {
73
+ // Register our event type on the shared KNOWN set so session logs carrying
74
+ // `orchestrate/change` load in any boot that mounts this plugin.
75
+ // The shared set is a mutable Set at runtime; its exported type is
76
+ // ReadonlySet, so we widen to Set<string> for the add call.
77
+ try {
78
+ KNOWN_SESSION_EVENT_TYPES.add(ORCHESTRATE_EVENT_TYPE);
79
+ }
80
+ catch (err) {
81
+ ctx.logger.warn('[orchestrate] could not register event type:', err?.message);
82
+ }
83
+ // Resolve sessionProjections *reactively*. At plugin apply time the host
84
+ // may not have mounted the sessionProjections service yet — that is the P0
85
+ // timing root cause: a one-shot `ctx.get` here returned undefined and
86
+ // silently no-op'd the projection registration, so /orchestrate never
87
+ // injected. Instead we register the projection the moment the service becomes
88
+ // available via ctx.inject, and keep `projections` in a closure so the
89
+ // command handler and prompt section observe it once it resolves. If the
90
+ // service is genuinely absent the handler (and the apply-time fallback)
91
+ // surface an honest error instead of a silent no-op.
92
+ let projections = undefined;
93
+ const missing = () => ctx.logger.warn('[orchestrate] sessionProjections service is missing on this host — the /orchestrate command will NOT take effect (no projection registered, orchestrator prompt will not inject). Provide the dsh-session-projection sessionProjections service to enable orchestrator mode.');
94
+ const registerProjection = (sp) => {
95
+ if (projections !== undefined)
96
+ return; // idempotent: inject may re-fire
97
+ projections = sp;
98
+ sp.register({
99
+ key: ORCHESTRATE_PROJECTION_KEY,
100
+ stateVersion: 1,
101
+ // Real @deepseek-ai/dsh-session-projection contract (SessionProjectionRegistry):
102
+ // `stateSchema` validates host state (persisted-cache restore path); a
103
+ // client-visible unit MUST declare `wire: { viewSchema, view }` or
104
+ // `snapshot()` SKIPS it entirely (`if (def.wire === undefined) continue`),
105
+ // so `snapshot().values['orchestrate']` is never populated and the prompt
106
+ // section always reads undefined → no injection. The prior `schema` + bare
107
+ // `view` made this a host-only unit — the actual root cause of the
108
+ // on==off byte-identical system prompts. Fix: declare both correctly.
109
+ stateSchema: z.object({ mode: z.enum(ORCHESTRATE_VALID_MODES) }),
110
+ init: () => ({ mode: 'off' }),
111
+ apply: (state, event) => {
112
+ if (!event || event.type !== ORCHESTRATE_EVENT_TYPE)
113
+ return state;
114
+ const mode = event.data.mode;
115
+ if (!ORCHESTRATE_VALID_MODES.includes(mode) || state.mode === mode)
116
+ return state;
117
+ return { mode };
118
+ },
119
+ wire: {
120
+ viewSchema: z.object({ mode: z.enum(ORCHESTRATE_VALID_MODES) }),
121
+ view: (state) => ({ mode: state.mode }),
122
+ },
123
+ });
124
+ ctx.logger.info('[orchestrate] host active (command + projection + prompt section)');
125
+ };
126
+ const spNow = ctx.get('sessionProjections');
127
+ if (spNow !== undefined) {
128
+ registerProjection(spNow);
129
+ }
130
+ else {
131
+ // Reactive path: register once the host mounts sessionProjections. The
132
+ // child fiber's callback only runs when the dependency is present, so
133
+ // this also covers the "ready slightly later" case that the one-shot get
134
+ // missed. If the service never appears, the handler below returns an
135
+ // honest error — no silent no-op.
136
+ //
137
+ // The child fiber is owned by this plugin's fiber lifecycle (its
138
+ // registration effect lives on the parent fiber), so it unloads
139
+ // automatically with the plugin. Do NOT wrap it in ctx.effect: cordis
140
+ // effects run their callback immediately and treat the return value as
141
+ // the disposer, so `ctx.effect(() => fiber.dispose())` would unload the
142
+ // child at birth — pinned by the real-cordis probe in
143
+ // test/orchestrate-cordis.test.ts.
144
+ ctx.inject(['sessionProjections'], (injectedCtx) => {
145
+ registerProjection(injectedCtx.get('sessionProjections'));
146
+ });
147
+ }
148
+ // Register the `/orchestrate` slash command *reactively* through a
149
+ // `ctx.inject` child fiber (the dsh-plan-mode precedent). `commands` is NOT a
150
+ // required entry-inject: standard profiles mount it via dsh-base (so the
151
+ // child fiber activates immediately there), but non-dsh-base assemblies (ACP
152
+ // hosts, UI-less demo spines, custom harnesses) may never provide it, and a
153
+ // required inject would leave the whole main entry PENDING on those hosts —
154
+ // the core delegation features would never load. The child-fiber shape also
155
+ // recovers from a host that mounts `commands` slightly after `apply`. The
156
+ // handler reads `projections` from the closure, so command availability and
157
+ // projection availability are decoupled: the handler still refuses honestly
158
+ // (with a warning) if the projection service never came up.
159
+ // The child fiber is owned by this plugin's fiber lifecycle and unloads
160
+ // with the plugin — never wrap it in ctx.effect (cordis effects run their
161
+ // callback immediately and treat the return value as the disposer, so
162
+ // `ctx.effect(() => fiber.dispose())` would unload the child at birth;
163
+ // pinned by the real-cordis probe in test/orchestrate-cordis.test.ts).
164
+ ctx.inject(['commands'], (injectedCtx) => {
165
+ const commands = injectedCtx.get('commands');
166
+ commands.register({
167
+ name: 'orchestrate',
168
+ description: 'Enter pure-orchestrator mode — delegate all work to the subagent-director team. No args defaults to "on".',
169
+ input: { hint: 'on|off (no args = on)' },
170
+ handler: (invocation) => {
171
+ const mode = (invocation.rawInput || '').trim().toLowerCase() || 'on';
172
+ if (!ORCHESTRATE_VALID_MODES.includes(mode)) {
173
+ return { kind: 'error', text: `Invalid: "${invocation.rawInput}". Valid: on|off` };
174
+ }
175
+ // Without sessionProjections the projection is never registered, so
176
+ // /orchestrate cannot take effect. Refuse with an honest message
177
+ // instead of falsely reporting success (P0 silent-degradation fix).
178
+ if (projections === undefined) {
179
+ // Service never became available (truly absent host): refuse with an
180
+ // honest message and warn, instead of falsely reporting success (P0
181
+ // silent-degradation fix).
182
+ missing();
183
+ return {
184
+ kind: 'error',
185
+ text: `Orchestrator mode "${mode}" was NOT applied: the sessionProjections service is missing on this host, so /orchestrate has no effect and the orchestrator prompt will not inject. ` +
186
+ `Provide the dsh-session-projection sessionProjections service to enable orchestrator mode.`,
187
+ };
188
+ }
189
+ const session = invocation?.agent?.session;
190
+ if (session === undefined || typeof session.append !== 'function') {
191
+ return {
192
+ kind: 'error',
193
+ text: `Orchestrator mode "${mode}" was NOT applied: this command invocation carries no agent session to append the mode change to.`,
194
+ };
195
+ }
196
+ session.append(ORCHESTRATE_EVENT_TYPE, { mode });
197
+ return { kind: 'success', text: mode === 'off' ? 'Orchestrator mode: off' : 'Orchestrator mode: on' };
198
+ },
199
+ });
200
+ });
201
+ const systemPrompt = ctx.get('systemPrompt');
202
+ if (systemPrompt !== undefined) {
203
+ systemPrompt.section({
204
+ name: ORCHESTRATE_SECTION_NAME,
205
+ order: ORCHESTRATE_SECTION_ORDER,
206
+ text: (context) => {
207
+ // Root-cause note (P0 render-time silent no-op, sibling of C1):
208
+ // @deepseek-ai/dsh-session-projection's read face keys its per-session
209
+ // watermark cache by the SESSION OBJECT via a WeakMap and folds
210
+ // `session.events` (see cellFor/buildCell in the package's lib/index.js).
211
+ // A snapshot therefore reads the mode ONLY from the live Session object
212
+ // whose `.events` log carries the `orchestrate/change` event that the
213
+ // /orchestrate command appended. If the assembly context hands a
214
+ // DIFFERENT session reference (e.g. a request wrapper instead of the
215
+ // agent's own session), the cell is rebuilt from an empty log and
216
+ // silently returns 'off', dropping the section. We must hand the
217
+ // canonical session object — and try every session reference the
218
+ // context exposes so a stray wrapper reference cannot downgrade us.
219
+ const sessionCandidates = [];
220
+ if (context?.agent?.session)
221
+ sessionCandidates.push(context.agent.session);
222
+ if (context?.session && context.session !== context?.agent?.session) {
223
+ sessionCandidates.push(context.session);
224
+ }
225
+ if (sessionCandidates.length === 0) {
226
+ // No resolvable session — cannot read the projection. Warn instead of
227
+ // silently dropping (P0 honest-degradation; do not return '' silently).
228
+ ctx.logger.warn('[orchestrate] system-prompt section invoked without a resolvable session (both context.agent.session and context.session are absent) — orchestrator-mode section skipped. Possible cause: the assembly context shape differs from the dsh-agent AssembleContext contract.');
229
+ return '';
230
+ }
231
+ // P0 missing-service path: the service never mounted. The apply-time
232
+ // missing() already emitted the loud warning, so only the section is
233
+ // skipped here (no per-assembly re-warning).
234
+ if (projections === undefined)
235
+ return '';
236
+ let resolvedMode;
237
+ let sawError = false;
238
+ for (const candidate of sessionCandidates) {
239
+ try {
240
+ const snap = projections.snapshot(candidate);
241
+ const value = snap?.values?.[ORCHESTRATE_PROJECTION_KEY];
242
+ if (value && typeof value.mode === 'string') {
243
+ const m = value.mode;
244
+ // 'on' wins immediately; otherwise remember the first known value.
245
+ if (m === 'on') {
246
+ resolvedMode = 'on';
247
+ break;
248
+ }
249
+ if (resolvedMode === undefined)
250
+ resolvedMode = m;
251
+ }
252
+ }
253
+ catch (err) {
254
+ // Surface instead of silently dropping (D1). The most likely cause
255
+ // is a session-identity mismatch: this candidate is not the object
256
+ // the /orchestrate command wrote the orchestrate/change event to.
257
+ sawError = true;
258
+ ctx.logger.warn('[orchestrate] could not read orchestrator mode from projection for a candidate session (session identity may not match the session /orchestrate on wrote to):', err?.message);
259
+ }
260
+ }
261
+ if (resolvedMode === undefined) {
262
+ // Could not resolve any mode from any candidate session. Warn with the
263
+ // likely cause; do NOT silently pretend 'off'.
264
+ if (!sawError) {
265
+ ctx.logger.warn('[orchestrate] orchestrator mode could not be resolved from any candidate session — orchestrator-mode section skipped. Possible cause: the assembly context session identity does not match the session the /orchestrate command wrote the orchestrate/change event to (the projection cache is keyed by the live Session object, per @deepseek-ai/dsh-session-projection).');
266
+ }
267
+ return '';
268
+ }
269
+ // Legitimate off: no section, no warning (intended behavior).
270
+ if (resolvedMode === 'off')
271
+ return '';
272
+ return renderOrchestratorPrompt(getSettings(), toolName);
273
+ },
274
+ });
275
+ }
276
+ }
277
+ //# sourceMappingURL=orchestrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrate.js","sourceRoot":"","sources":["../src/orchestrate.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAqB,MAAM,0BAA0B,CAAC;AAKxF,yCAAyC;AACzC,MAAM,CA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C9J,GAAa,EAAE,OAAO,CACxB,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;oBAC/B,uEAAuE;oBACvE,+CAA+C;oBAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACd,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,4WAA4W,CAC7W,CAAC;oBACJ,CAAC;oBACD,OAAO,EAAE,CAAC;gBACZ,CAAC;gBACD,8DAA8D;gBAC9D,IAAI,YAAY,KAAK,KAAK;oBAAE,OAAO,EAAE,CAAC;gBACtC,OAAO,wBAAwB,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-subagent-director",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-beta.1",
4
4
  "description": "Subagent Director: choose an LLM provider/model for each subagent (call args > role binding > plugin default > inherit parent) and plan main-agent/subagent responsibilities with role templates, plus a settings UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -65,23 +65,27 @@
65
65
  "model",
66
66
  "role-template"
67
67
  ],
68
+ "dependencies": {
69
+ "zod": "^4.4.3"
70
+ },
68
71
  "license": "MIT",
69
72
  "peerDependencies": {
70
73
  "react": "^18.2.0",
71
74
  "@deepseek-ai/cordis": "^4.0.1",
72
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
73
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
74
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.6",
75
- "@deepseek-ai/dsh-subagent": "^0.1.0-rc.8",
76
- "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
77
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
78
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
79
- "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.6",
80
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
81
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6",
82
- "@deepseek-ai/dsh-client-schema-form": "^0.1.0-rc.6",
83
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
84
- "@deepseek-ai/dsh-host-apiproxy": "^0.1.0-rc.6"
75
+ "@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
76
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
77
+ "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
78
+ "@deepseek-ai/dsh-subagent": "^0.1.1-rc.2",
79
+ "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
80
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
81
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
82
+ "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2",
83
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
84
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2",
85
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
86
+ "@deepseek-ai/dsh-host-apiproxy": "^0.1.1-rc.2",
87
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
88
+ "@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2"
85
89
  },
86
90
  "devDependencies": {
87
91
  "react": "^18.2.0",
@@ -90,21 +94,22 @@
90
94
  "@types/react": "^18.3.1",
91
95
  "@types/react-dom": "^18.3.1",
92
96
  "@deepseek-ai/cordis": "^4.0.1",
93
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
94
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
95
- "@deepseek-ai/dsh-settings": "^0.1.0-rc.6",
96
- "@deepseek-ai/dsh-subagent": "^0.1.0-rc.8",
97
- "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
98
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
97
+ "@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
98
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
99
+ "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
100
+ "@deepseek-ai/dsh-subagent": "^0.1.1-rc.2",
101
+ "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
102
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
99
103
  "@deepseek-ai/schemastery": "^3.18.1",
100
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
101
- "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.6",
102
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
103
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.6",
104
- "@deepseek-ai/dsh-client-schema-form": "^0.1.0-rc.6",
105
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
106
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
107
- "@deepseek-ai/dsh-host-apiproxy": "^0.1.0-rc.6",
104
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
105
+ "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2",
106
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
107
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2",
108
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
109
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.1-rc.2",
110
+ "@deepseek-ai/dsh-host-apiproxy": "^0.1.1-rc.2",
111
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
112
+ "@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
108
113
  "rolldown": "^1.2.4",
109
114
  "@types/node": "^26.2.0",
110
115
  "typescript": "^7.0.2",