dsh-subagent-library 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <p align="center">
10
10
  <img src="https://img.shields.io/github/actions/workflow/status/MaRi23333/dsh-subagent-library/ci.yml?style=flat-square&label=CI" alt="CI" />
11
11
  <img src="https://img.shields.io/github/license/MaRi23333/dsh-subagent-library?style=flat-square" alt="License: MIT" />
12
- <img src="https://img.shields.io/badge/DeepSeek%20Harness-0.1.1--rc.1-4d6bfe?style=flat-square" alt="DeepSeek Harness 0.1.1-rc.1" />
12
+ <img src="https://img.shields.io/badge/DeepSeek%20Harness-0.1.2--rc.1-4d6bfe?style=flat-square" alt="DeepSeek Harness 0.1.2-rc.1" />
13
13
  </p>
14
14
 
15
15
  ## Overview
@@ -72,7 +72,7 @@ Entry fields:
72
72
  | `subagentProvider` | no | **Subagent transport** (a `ctx.subagents` provider such as `spawn`); defaults to the plugin-level default `spawn` |
73
73
  | `maxTokens` | no | Subagent output cap |
74
74
  | `persona` | no | Subagent system prompt. Personas go through strict `{{…}}` template interpolation (same semantics as deployment personas) — an unregistered variable (e.g. `{{user}}`) fails child activation |
75
- | `toolFilter` | no | `allow`/`deny` tool-name lists (deny write-class tools for read-only roles; every name must be a registered tool or the save is rejected). **Read-only/restricted roles should also deny `list_subagents`/`delegate`** so children are not taught by the global prompt to re-delegate in a chain |
75
+ | `toolFilter` | no | `allow`/`deny` tool-name lists (deny write-class tools for read-only roles). **Read-only/restricted roles should also deny `list_subagents`/`delegate`** so children are not taught by the global prompt to re-delegate in a chain. Names are checked against the **actual parent session's** tool composition at delegation: a name missing there fails that delegation with a clear error listing the known tools — surfaced at the delegate call for foreground/continuable runs, and in the task result for background one-shots; saves are not pre-validated |
76
76
  | `maxDepth` | no | Delegation depth cap; **when unset, defaults to 3 when the transport supports depthLimit** (aligned with the official subagent tool to prevent chained recursive delegation; the harness itself has no global depth cap). Transports without depthLimit stay uncapped |
77
77
  | `backgroundMode` | no | `one-shot` (default) / `continuable` (resumable) |
78
78
 
@@ -111,9 +111,9 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
111
111
  A **Subagent Library** card appears under Settings: visually add/edit/remove entries
112
112
  (description / provider / model / subagentProvider transport / maxTokens / denied tools /
113
113
  depth / background mode / persona), written back to `$DSH_HOME/settings.yaml`, hot-reloaded.
114
- The add card takes the common fields (ID / description / provider / model / transport /
115
- output cap); the rest (denied tools / depth / background mode / persona) are edited inside
116
- the entry card.
114
+ The add card offers the same fields as an entry card (ID / description / provider / model /
115
+ transport / output cap / denied tools / depth / background mode / persona), so a role is
116
+ fully configured in one step.
117
117
 
118
118
  > **Security note:** the roster settings endpoint (`/subagent-library/api`) follows the
119
119
  > DSH Web Host's local trust boundary — the plugin itself adds no separate authentication
@@ -135,7 +135,7 @@ pnpm run typecheck
135
135
  pnpm run build # host: lib/index.js; client: lib/client.js
136
136
  ```
137
137
 
138
- - Dev dependencies are pinned to DSH `0.1.0-rc.6` (see package.json devDependencies); verified compatible up to `0.1.1-rc.1`. If the interfaces drift on other versions, adjust against the corresponding tag of the [deepseek-harness repo](https://github.com/deepseek-ai/deepseek-harness).
138
+ - Dev dependencies remain pinned to DSH `0.1.0-rc.6` (see package.json devDependencies); the user has verified the plugin on the latest DSH `0.1.2-rc.1`. If the interfaces drift on other versions, adjust against the corresponding tag of the [deepseek-harness repo](https://github.com/deepseek-ai/deepseek-harness).
139
139
 
140
140
  ## License
141
141
 
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <p align="center">
10
10
  <img src="https://img.shields.io/github/actions/workflow/status/MaRi23333/dsh-subagent-library/ci.yml?style=flat-square&label=CI" alt="CI" />
11
11
  <img src="https://img.shields.io/github/license/MaRi23333/dsh-subagent-library?style=flat-square" alt="License: MIT" />
12
- <img src="https://img.shields.io/badge/DeepSeek%20Harness-0.1.1--rc.1-4d6bfe?style=flat-square" alt="DeepSeek Harness 0.1.1-rc.1" />
12
+ <img src="https://img.shields.io/badge/DeepSeek%20Harness-0.1.2--rc.1-4d6bfe?style=flat-square" alt="DeepSeek Harness 0.1.2-rc.1" />
13
13
  </p>
14
14
 
15
15
  > **English:** dsh-subagent-library is a named subagent roster plugin for the
@@ -79,7 +79,7 @@ subagent-library:
79
79
  | `subagentProvider` | 否 | **子代理传输层**(`spawn` 等 `ctx.subagents` provider);默认取插件级默认 `spawn` |
80
80
  | `maxTokens` | 否 | 子代理输出上限 |
81
81
  | `persona` | 否 | 子代理角色提示词。注意 persona 走严格的 `{{…}}` 模板插值(与部署 persona 同语义)——出现未注册的变量(如 `{{user}}`)会让子代理激活失败 |
82
- | `toolFilter` | 否 | `allow`/`deny` 工具名单(只读角色用 deny 禁写类工具;名单必须都是已注册的工具名,否则保存被拒)。**只读/受限角色建议把 `list_subagents`/`delegate` 也列入 deny**,防止子代理被全局提示词教去链式再派活 |
82
+ | `toolFilter` | 否 | `allow`/`deny` 工具名单(只读角色用 deny 禁写类工具)。**只读/受限角色建议把 `list_subagents`/`delegate` 也列入 deny**,防止子代理被全局提示词教去链式再派活。名单按**委派时实际父会话**的工具组合校验:名字不在该组合时委派会明确报错(并列出可用工具名)——前台与可续聊在委派当场报出,后台 one-shot 的失败显示在任务结果中;保存阶段不做校验 |
83
83
  | `maxDepth` | 否 | 委派深度上限;**缺省 = 传输层支持 depthLimit 时默认 3**(与官方 subagent 工具对齐,防链式递归派活;harness 自身无全局深度上限),不支持 depthLimit 的传输层则不设上限 |
84
84
  | `backgroundMode` | 否 | `one-shot`(默认)/ `continuable`(可续聊) |
85
85
 
@@ -116,7 +116,7 @@ npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-subagent-lib
116
116
 
117
117
  Settings → 设置 里新增「子代理库」卡片:可视化增删改条目(描述 / Provider / 模型 /
118
118
  传输层 subagentProvider / 输出上限 maxTokens / 禁用工具 / 深度 / 后台模式 / 角色提示词),写回 `$DSH_HOME/settings.yaml`,热生效。
119
- 新增卡只收常用字段(ID / 描述 / Provider / 模型 / 传输层 / 输出上限),其余字段(禁用工具 / 深度 / 后台模式 / 角色提示词)在条目卡内编辑。
119
+ 新增卡与条目卡字段一致(ID / 描述 / Provider / 模型 / 传输层 / 输出上限 / 禁用工具 / 深度 / 后台模式 / 角色提示词),一次配置完整角色。
120
120
 
121
121
  > **安全提示**:子代理库的设置接口(`/subagent-library/api`)遵循 DSH Web Host 的本地可信边界,插件自身不含独立身份验证层。若将 DSH Web 绑定到局域网 / 公网 / 反向代理,请在外层配置认证与访问控制,不要把该接口暴露给不可信客户端——子代理 persona 与配置可能包含内部工作规则。
122
122
 
@@ -134,7 +134,7 @@ pnpm run typecheck
134
134
  pnpm run build # host: lib/index.js;client: lib/client.js
135
135
  ```
136
136
 
137
- - 开发依赖锁定 DSH `0.1.0-rc.6`(见 package.json devDependencies),实机验证兼容至 `0.1.1-rc.1`;其他版本如接口漂移请对照 [deepseek-harness 仓库](https://github.com/deepseek-ai/deepseek-harness) 相应 tag 调整。
137
+ - 开发依赖仍锁定 DSH `0.1.0-rc.6`(见 package.json devDependencies),已由用户在最新 DSH `0.1.2-rc.1` 实际验证正常;其他版本如接口漂移请对照 [deepseek-harness 仓库](https://github.com/deepseek-ai/deepseek-harness) 相应 tag 调整。
138
138
 
139
139
  ## License
140
140
 
package/lib/client.js CHANGED
@@ -218,6 +218,13 @@ function LibrarySettings(props) {
218
218
  });
219
219
  return;
220
220
  }
221
+ if (newEntry.maxDepth !== void 0 && (!Number.isInteger(newEntry.maxDepth) || newEntry.maxDepth < 1)) {
222
+ setStatus({
223
+ kind: "error",
224
+ text: "深度上限需为 ≥1 的整数。"
225
+ });
226
+ return;
227
+ }
221
228
  applyWrite({
222
229
  op: "save",
223
230
  entries: {
@@ -791,6 +798,103 @@ function LibrarySettings(props) {
791
798
  }
792
799
  })]
793
800
  })]
801
+ }),
802
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
803
+ style: {
804
+ display: "flex",
805
+ flexWrap: "wrap",
806
+ gap: "8px"
807
+ },
808
+ children: [
809
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
810
+ style: colStyle,
811
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
812
+ style: labelStyle,
813
+ children: "深度上限"
814
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
815
+ type: "number",
816
+ min: 1,
817
+ value: newEntry.maxDepth ?? "",
818
+ onChange: (event) => setNewEntry({
819
+ ...newEntry,
820
+ maxDepth: event.target.value === "" ? void 0 : Number(event.target.value)
821
+ }),
822
+ style: {
823
+ ...inputStyle,
824
+ maxWidth: "80px"
825
+ }
826
+ })]
827
+ }),
828
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
829
+ style: colStyle,
830
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
831
+ style: labelStyle,
832
+ children: "后台模式"
833
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
834
+ value: newEntry.backgroundMode ?? "one-shot",
835
+ onChange: (event) => setNewEntry({
836
+ ...newEntry,
837
+ backgroundMode: event.target.value
838
+ }),
839
+ style: {
840
+ ...inputStyle,
841
+ maxWidth: "140px"
842
+ },
843
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
844
+ value: "one-shot",
845
+ children: "one-shot"
846
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
847
+ value: "continuable",
848
+ children: "continuable"
849
+ })]
850
+ })]
851
+ }),
852
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
853
+ style: {
854
+ ...colStyle,
855
+ flex: 2
856
+ },
857
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
858
+ style: labelStyle,
859
+ children: "禁用工具"
860
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
861
+ value: (newEntry.toolFilter?.deny ?? []).join(", "),
862
+ onChange: (event) => {
863
+ const deny = event.target.value.split(",").map((item) => item.trim()).filter(Boolean);
864
+ const allow = newEntry.toolFilter?.allow;
865
+ setNewEntry({
866
+ ...newEntry,
867
+ toolFilter: allow !== void 0 && allow.length > 0 || deny.length > 0 ? {
868
+ ...allow !== void 0 && allow.length > 0 ? { allow } : {},
869
+ ...deny.length > 0 ? { deny } : {}
870
+ } : void 0
871
+ });
872
+ },
873
+ placeholder: "write, edit, todo_write, …",
874
+ style: inputStyle
875
+ })]
876
+ })
877
+ ]
878
+ }),
879
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
880
+ style: rowStyle,
881
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
882
+ style: labelStyle,
883
+ children: "角色提示词"
884
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
885
+ value: newEntry.persona ?? "",
886
+ onChange: (event) => setNewEntry({
887
+ ...newEntry,
888
+ persona: event.target.value
889
+ }),
890
+ placeholder: "子代理的系统提示词(可选)",
891
+ rows: 3,
892
+ style: {
893
+ ...inputStyle,
894
+ resize: "vertical",
895
+ fontFamily: "inherit"
896
+ }
897
+ })]
794
898
  })
795
899
  ]
796
900
  }),
package/lib/index.js CHANGED
@@ -9339,18 +9339,6 @@ function apply(ctx, config$1) {
9339
9339
  ...config$1,
9340
9340
  entries: candidate
9341
9341
  });
9342
- for (const entry of Object.values(candidate)) {
9343
- const filter = entry.toolFilter;
9344
- if (filter === void 0) continue;
9345
- for (const name$1 of [...filter.allow ?? [], ...filter.deny ?? []]) if (ctx.tools.get(name$1) === void 0) {
9346
- sendJson(res, 400, {
9347
- ok: false,
9348
- error: "invalid-tool-name",
9349
- message: `toolFilter 引用了未注册的工具 "${name$1}"`
9350
- });
9351
- return;
9352
- }
9353
- }
9354
9342
  const userSection = svc.describe().find((row) => row.ns === ns)?.user ?? {};
9355
9343
  await svc.replace(ns, {
9356
9344
  ...userSection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-subagent-library",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Named subagent library for DeepSeek Harness: a settings-driven roster of role subagents (model + persona + tool filter), exposed to every session through the list_subagents and delegate tools, a /subagent command, and a Settings page.",
5
5
  "keywords": [
6
6
  "deepseek-harness",