dsh-subagent-profile 0.3.2 → 0.3.4

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 (40) hide show
  1. package/README.md +77 -40
  2. package/README.zh.md +111 -74
  3. package/docs/screenshots/dispatch-card.png +0 -0
  4. package/docs/screenshots/settings-page1.png +0 -0
  5. package/docs/screenshots/settings-page2.png +0 -0
  6. package/index.mjs +276 -81
  7. package/lib/client.js +3218 -166
  8. package/lib/core/adoption-reminder.mjs +48 -0
  9. package/lib/core/adoption-tracker.mjs +430 -0
  10. package/lib/core/background-ledger.mjs +71 -0
  11. package/lib/core/catalog-cache.mjs +45 -7
  12. package/lib/core/catalog.mjs +6 -6
  13. package/lib/core/cost-evidence.mjs +145 -0
  14. package/lib/core/cost-guard.mjs +71 -44
  15. package/lib/core/decision-trace.mjs +413 -0
  16. package/lib/core/delegation.mjs +111 -50
  17. package/lib/core/dispatch-gates.mjs +153 -0
  18. package/lib/core/dispatch-guard.mjs +156 -0
  19. package/lib/core/dispatch-schema.mjs +103 -14
  20. package/lib/core/dispatch-tool.mjs +220 -204
  21. package/lib/core/draft-gates.mjs +45 -0
  22. package/lib/core/drafts-store.mjs +45 -0
  23. package/lib/core/escape.mjs +130 -0
  24. package/lib/core/evolution-advice.mjs +224 -0
  25. package/lib/core/evolution-ledger.mjs +300 -0
  26. package/lib/core/evolution-summary.mjs +255 -0
  27. package/lib/core/http-routes.mjs +256 -72
  28. package/lib/core/intersection.mjs +6 -9
  29. package/lib/core/presets-sync.mjs +161 -43
  30. package/lib/core/prices.mjs +46 -0
  31. package/lib/core/profile-directory.mjs +139 -0
  32. package/lib/core/profile-provider.mjs +42 -39
  33. package/lib/core/profiles-store.mjs +103 -76
  34. package/lib/core/pure.mjs +110 -66
  35. package/lib/core/reminder-store.mjs +172 -0
  36. package/lib/core/shims.mjs +67 -76
  37. package/lib/core/whitelist.mjs +23 -17
  38. package/package.json +82 -83
  39. package/presets/orchestrator/agent.cordis.yml +59 -87
  40. package/presets/orchestrator/NOTICE +0 -3
package/package.json CHANGED
@@ -1,83 +1,82 @@
1
- {
2
- "name": "dsh-subagent-profile",
3
- "version": "0.3.2",
4
- "description": "Dispatch one-shot subtasks to derived subagents with per-task overrides (preset/model/provider/reasoningEffort/persona/tool whitelist), a runtime-derived cost guard, a subagent-profiles service, observability metadata, and a web-GUI settings page plus a dispatch tool-call card.",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/muzyLink/dsh-subagent-profile.git"
8
- },
9
- "type": "module",
10
- "main": "index.mjs",
11
- "exports": {
12
- ".": "./index.mjs",
13
- "./client": "./lib/client.js",
14
- "./package.json": "./package.json"
15
- },
16
- "files": [
17
- "index.mjs",
18
- "lib",
19
- "cordis.patch.yml",
20
- "presets",
21
- "docs",
22
- "README.md",
23
- "README.zh.md"
24
- ],
25
- "dsh": {
26
- "bundle": {
27
- "patch": "./cordis.patch.yml"
28
- },
29
- "client": {
30
- "inject": [],
31
- "platform": "web"
32
- }
33
- },
34
- "peerDependencies": {
35
- "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0",
36
- "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0",
37
- "@deepseek-ai/dsh-subagent": ">=0.1.0-rc.6 <0.2.0",
38
- "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0"
39
- },
40
- "peerDependenciesMeta": {
41
- "@deepseek-ai/dsh-agent": {
42
- "optional": true
43
- },
44
- "@deepseek-ai/dsh-subagent": {
45
- "optional": true
46
- },
47
- "@deepseek-ai/dsh-llm": {
48
- "optional": true
49
- },
50
- "@deepseek-ai/dsh-tools": {
51
- "optional": true
52
- }
53
- },
54
- "devDependencies": {
55
- "@deepseek-ai/dsh-agent": "0.1.0-rc.8",
56
- "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
57
- "@deepseek-ai/dsh-subagent": "0.1.0-rc.8",
58
- "@deepseek-ai/dsh-tools": "0.1.0-rc.8",
59
- "@eslint/js": "^10.0.1",
60
- "eslint": "^10.9.0"
61
- },
62
- "engines": {
63
- "node": "^22.19.0 || >=24"
64
- },
65
- "publishConfig": {
66
- "access": "public"
67
- },
68
- "keywords": [
69
- "deepseek-harness",
70
- "dsh",
71
- "subagent",
72
- "dispatch",
73
- "profiles"
74
- ],
75
- "license": "MIT",
76
- "scripts": {
77
- "release": "node scripts/release.mjs",
78
- "test": "node --test \"test/**/*.test.mjs\"",
79
- "test:bare": "node --test test/pure.test.mjs test/input-schema.test.mjs test/catalog-integrity.test.mjs",
80
- "preflight": "node scripts/preflight.mjs",
81
- "leak-scan": "node scripts/leak-scan.mjs"
82
- }
83
- }
1
+ {
2
+ "name": "dsh-subagent-profile",
3
+ "version": "0.3.4",
4
+ "description": "DeepSeek Harness 子 Agent 派发插件:按任务为子代理选模型、推理强度与工具范围,常用组合存成命名方案随时复用;内置安全检查、成本估算与节省分析、完整决策台账。",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/muzyLink/dsh-subagent-profile.git"
8
+ },
9
+ "type": "module",
10
+ "main": "index.mjs",
11
+ "scripts": {
12
+ "test": "node --test \"test/**/*.test.mjs\"",
13
+ "test:bare": "node --test test/pure.test.mjs test/input-schema.test.mjs test/catalog-integrity.test.mjs",
14
+ "preflight": "node scripts/preflight.mjs",
15
+ "leak-scan": "node scripts/leak-scan.mjs"
16
+ },
17
+ "exports": {
18
+ ".": "./index.mjs",
19
+ "./client": "./lib/client.js",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "index.mjs",
24
+ "lib",
25
+ "cordis.patch.yml",
26
+ "presets",
27
+ "docs/screenshots",
28
+ "README.md",
29
+ "README.zh.md"
30
+ ],
31
+ "dsh": {
32
+ "bundle": {
33
+ "patch": "./cordis.patch.yml"
34
+ },
35
+ "client": {
36
+ "inject": [],
37
+ "platform": "web"
38
+ }
39
+ },
40
+ "peerDependencies": {
41
+ "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6 <0.2.0",
42
+ "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6 <0.2.0",
43
+ "@deepseek-ai/dsh-subagent": ">=0.1.0-rc.6 <0.2.0",
44
+ "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6 <0.2.0"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "@deepseek-ai/dsh-agent": {
48
+ "optional": true
49
+ },
50
+ "@deepseek-ai/dsh-subagent": {
51
+ "optional": true
52
+ },
53
+ "@deepseek-ai/dsh-llm": {
54
+ "optional": true
55
+ },
56
+ "@deepseek-ai/dsh-tools": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "devDependencies": {
61
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.8",
62
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
63
+ "@deepseek-ai/dsh-subagent": "0.1.0-rc.8",
64
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.8",
65
+ "@eslint/js": "^10.0.1",
66
+ "eslint": "^10.9.0"
67
+ },
68
+ "engines": {
69
+ "node": "^22.19.0 || >=24"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "keywords": [
75
+ "deepseek-harness",
76
+ "dsh",
77
+ "subagent",
78
+ "dispatch",
79
+ "profiles"
80
+ ],
81
+ "license": "MIT"
82
+ }
@@ -1,36 +1,30 @@
1
- # The `orchestrator` agent preset: the main-agent coordinator mode.
1
+ # `orchestrator` 编排者预设:主 Agent 协调模式。
2
2
  #
3
- # A full coding agent — identical to the shipped `standard` preset row-for-row —
4
- # whose persona turns it into the MAIN orchestrator: decompose work, delegate
5
- # each subtask to the right subagent via the host-registered `dispatch` tool
6
- # (per-scenario profile / preset / model / reasoning-effort) plus the ordinary
7
- # `subagent` / `subagent_fork` / `workflow` / `ralph` delegation tools, then
8
- # integrate the results. The `dispatch` tool itself is registered by the
9
- # dsh-subagent-profile host row, so it is already visible to every preset
10
- # including this one; this preset only adds the delegation tools below.
3
+ # 与官方 `standard` 预设逐行一致,仅 persona 段改写为「主协调 Agent」身份:
4
+ # 拆解任务、经宿主注册的 `dispatch` 工具(按场景选方案/预设/模型/推理强度)
5
+ # 加普通 `subagent` / `subagent_fork` / `workflow` / `ralph` 委派工具分派子任务,
6
+ # 再集成结果。`dispatch` 工具本身由 dsh-subagent-profile 宿主行注册,对所有
7
+ # 预设可见;本预设只补下面的委派工具。
11
8
  #
12
- # Adapted from the builtin `standard` preset (the persona section is the only
13
- # change). This file is an AGENT-PLANE composition. The roster mounts it ONCE
14
- # under a standing scope; every session naming it joins by scope parentage, so
15
- # the tools and prompt sections registered here cover each joined agent while a
16
- # session's own state stays keyed per Session/Agent inside the plugins. The
17
- # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
18
- # preset must not own: the registries themselves, the sandbox and approval
19
- # stack, persistence, and the model route.
9
+ # 改编自官方 `standard` 预设(仅 persona 段不同);原始 DeepSeek 版权与
10
+ # MIT 许可声明见开源仓库。
20
11
  #
21
- # A service row here MUST sit inside a group carrying an `isolate` realm.
22
- # Without one it publishes into the root realm, where it is process-global —
23
- # another preset publishing the same name collides, and a host reader would
24
- # resolve one preset's instance for every session; `dsh-agent-presets` rejects
25
- # that at mount. `true` means an entry-local realm: this standing mount's own
26
- # private instance, apart from every other preset's. (A shared label does NOT
27
- # pool instances — `provide()` throws on the second registration under the
28
- # same realm symbol; labels join REALMS, and are not what this file needs.)
12
+ # 本文件是 agent 平面组成:由 roster 挂载一次到 standing scope,引用它的会话
13
+ # 经 scope 父系加入,本文件注册的工具与 prompt 段覆盖每个加入的 agent;会话
14
+ # 自身状态仍按 Session/Agent 键控在插件内。宿主组成(base.cordis.yml +
15
+ # web.cordis.yml)保留预设不得拥有的东西:注册表、沙箱与审批栈、持久化、
16
+ # 模型路由。
17
+ #
18
+ # 服务行必须放在带 `isolate` realm 的 group 内:否则发布进根 realm 成为
19
+ # 进程全局单例——另一预设发布同名会冲突,宿主读者会对每个会话解析同一实例,
20
+ # `dsh-agent-presets` 挂载时拒绝。`true` 表示条目本地 realm:本 standing mount
21
+ # 私有的实例。共享 label 不会合并实例(同一 realm 符号下二次 provide 抛错),
22
+ # label 只连接 REALMS,本文件不需要。
29
23
 
30
24
  # ── identity ────────────────────────────────────────────────────────────────
31
25
 
32
- # The orchestrator persona, shadowing the deployment default for this agent.
33
- # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
26
+ # 编排者 persona,遮蔽本 agent 的部署默认人设。
27
+ # `{{model}}` 与 `{{cwd}}` 从 agent 自身的路由与工作目录解析。
34
28
  - id: persona
35
29
  name: '@deepseek-ai/dsh-persona'
36
30
  config:
@@ -41,7 +35,7 @@
41
35
 
42
36
  prompt 必须自包含:子 Agent 看不到你的对话,写全背景、目标、期望产出、验收标准与禁止事项。
43
37
 
44
- 边界:子 Agent 能力 ⊆ 你,审批恒为「永不」;子 Agent 失败或超出权限时自己接手重做,或用 ask_user_question 向用户澄清。
38
+ 边界:子 Agent 能力 ⊆ 你,派发不豁免父会话的审批要求;子 Agent 失败或超出权限时自己接手重做,或用 ask_user_question 向用户澄清。
45
39
 
46
40
  - id: agent-instructions
47
41
  name: '@deepseek-ai/dsh-agent-instructions'
@@ -50,13 +44,11 @@
50
44
 
51
45
  # ── shell ───────────────────────────────────────────────────────────────────
52
46
 
53
- # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
54
- # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
55
- # the criterion for host-plane ownership — injection resolves before any session
56
- # exists, so there is no agent to key by. Behind a preset realm those variables
57
- # never reached the model's shell at all. Both shell tools consume the host
58
- # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
59
- # host-plane too.
47
+ # `shell-env` 留在宿主组成:apps/cli/src/web.ts 注入它以发布
48
+ # DSH_WEB_URL/DSH_WEB_MODE,且宿主行注入服务即宿主平面归属标准——注入在
49
+ # 会话存在前解析,没有可归属的 agent;放预设 realm 里这些变量到不了模型
50
+ # 的 shell。两个 shell 工具在此消费宿主注册表;其执行器
51
+ # (bash-sandbox/pwsh-sandbox)也在宿主平面。
60
52
  - id: tool-bash
61
53
  name: '@deepseek-ai/dsh-tool-bash'
62
54
  disabled: !!js process.platform === 'win32'
@@ -67,8 +59,7 @@
67
59
 
68
60
  # ── filesystem ──────────────────────────────────────────────────────────────
69
61
 
70
- # Both register into the host `tools` registry and provide nothing, so
71
- # they need no realm. The `fs` service and its policy stay in the host.
62
+ # 两者都注册进宿主 tools 注册表且不提供服务,无需 realm;fs 服务与其策略留在宿主。
72
63
  - id: tool-fs
73
64
  name: '@deepseek-ai/dsh-tool-fs'
74
65
 
@@ -79,23 +70,18 @@
79
70
 
80
71
  # ── background jobs ────────────────────────────────────────────────────────
81
72
 
82
- # Only the model-facing controls. The task REGISTRY stays on the host plane:
83
- # its producers sit outside any realm this file could put it in — `tool-bash`
84
- # above resolves it with `ctx.get`, and an entry-local realm here is invisible
85
- # to every sibling row, so `run_in_background` would answer "background jobs
86
- # unavailable" while these controls sat in the catalog. The registry is keyed by
87
- # owning agent anyway, so one host instance serves every session. What a preset
88
- # chooses is whether its agent can collect and stop background work at all.
73
+ # 只放模型可见的控制。任务注册表留在宿主平面:其生产者在本文件任何 realm
74
+ # 之外(上面 tool-bash 用 ctx.get 解析它,条目本地 realm 对兄弟行不可见),
75
+ # 否则 run_in_background 会答「后台任务不可用」。注册表本就按所属 agent
76
+ # 键控,一个宿主实例服务所有会话;预设只决定其 agent 能否收集/停止后台任务。
89
77
  - id: tool-jobs
90
78
  name: '@deepseek-ai/dsh-tool-jobs'
91
79
 
92
80
  # ── skills ──────────────────────────────────────────────────────────────────
93
81
 
94
- # The skill REGISTRY lives in the host composition and is layered per scope:
95
- # these rows register into THIS preset's layer of it, so they need no realm.
96
- # `skill-filesystem` contributes local-root discovery for agents on this preset, and
97
- # `tool-skill` gives them the catalog and loader; the merged catalog also
98
- # carries whatever the deployment registered globally (repository plugins).
82
+ # skill 注册表在宿主组成中按 scope 分层;以下行注册进本预设的那一层,
83
+ # 无需 realm。`skill-filesystem` 为本预设的 agent 提供本地根发现,
84
+ # `tool-skill` 提供目录与加载器;合并后的目录也包含部署全局注册的内容。
99
85
  - id: skill-filesystem
100
86
  name: '@deepseek-ai/dsh-skill-filesystem'
101
87
 
@@ -104,19 +90,16 @@
104
90
 
105
91
  # ── goals ───────────────────────────────────────────────────────────────────
106
92
 
107
- # Only the model-facing tool. The goal SERVICE, its session driver, and the
108
- # `/goal` command stay on the host plane: the Gateway serves the goal domain as
109
- # Remote endpoints whose receiver comes from a generated descriptor, so it
110
- # resolves `goals` on the host and an entry-local realm here would hide it. The
111
- # registry is keyed by session anyway, so one host instance serves every
112
- # session. What a preset chooses is whether its agent can call the goal tool.
93
+ # 只放模型可见的工具。goal 服务、会话驱动与 /goal 命令留在宿主平面:
94
+ # Gateway 以 Remote endpoint 服务 goal 域,接收方来自生成描述符,条目本地
95
+ # realm 会隐藏它。注册表本就按会话键控,一个宿主实例服务所有会话;预设
96
+ # 只决定其 agent 能否调用 goal 工具。
113
97
  - id: tool-goal
114
98
  name: '@deepseek-ai/dsh-tool-goal'
115
99
 
116
100
  # ── plan mode ───────────────────────────────────────────────────────────────
117
101
 
118
- # Plan state is per-agent by nature, so an entry-local realm is not a
119
- # workaround here — it is the correct lifetime.
102
+ # plan 状态按 agent 天然独立,条目本地 realm 正是正确的生命周期。
120
103
  - id: planning
121
104
  name: cordis:group
122
105
  group: true
@@ -141,15 +124,13 @@
141
124
 
142
125
  # ── compaction ──────────────────────────────────────────────────────────────
143
126
 
144
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
145
- # share this realm rather than sit outside it.
127
+ # `compaction-basic` 经 ctx.get 读取 toolResultPrune,pruner 必须与本 realm
128
+ # 共享而非留在外面。
146
129
  #
147
- # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
148
- # plane, and the rows here resolve that one instance. It takes no configuration,
149
- # keys every fold by Session, and owns the context-meter projection units the
150
- # browser reads for every session — behind a realm those units would come and go
151
- # with whichever presets happen to be mounted. What a preset chooses is whether
152
- # its agent compacts at all, which is `compaction-basic` below.
130
+ # `tokenMeter` 刻意不在本 realm:meter 留在宿主平面,此处各行解析那个单例。
131
+ # 它无配置、按 Session 键控每次 fold,且持有浏览器为每个会话读取的上下文
132
+ # 计量单位——进 realm 会随挂载的预设增减。预设只决定其 agent 是否压缩,
133
+ # 即下面的 compaction-basic。
153
134
  - id: compaction
154
135
  name: cordis:group
155
136
  group: true
@@ -172,24 +153,18 @@
172
153
 
173
154
  # ── delegation and workflows ────────────────────────────────────────────────
174
155
 
175
- # The `subagents` registry and its spawn/fork backends live in the HOST
176
- # composition: the registry is a process singleton whose cross-session queries
177
- # the api-proxy serves to the browser, and a provider name may only be
178
- # registered once. This preset contributes the delegation TOOLS, which resolve
179
- # that host registry. The `dispatch` tool (and the `profile` provider it
180
- # drives) are registered by the dsh-subagent-profile host row, so they are
181
- # host-global and already visible here; this group adds the ordinary
182
- # subagent/workflow tools so the orchestrator can choose the cheapest fit.
156
+ # `subagents` 注册表及其 spawn/fork 后端在宿主组成中:注册表是进程单例,
157
+ # api-proxy 供浏览器跨会话查询,provider 名只能注册一次。本预设贡献
158
+ # delegation 工具,解析该宿主注册表。`dispatch` 工具(及其驱动的 profile
159
+ # provider)由 dsh-subagent-profile 宿主行注册,宿主全局可见;本组补普通
160
+ # subagent/workflow 工具,让编排者选最省成本的方式。
183
161
  #
184
- # `workflows` is different — nothing outside an agent reads it — so every row
185
- # that reaches it shares one entry-local realm here, and a consumer left
186
- # outside would resolve a host registry this preset does not populate.
162
+ # `workflows` 不同——没有 agent 之外的东西读它——到达它的行共享本条目本地
163
+ # realm,留在外面的消费者会解析到本预设未填充的宿主注册表。
187
164
  #
188
- # `tool-subagent-report` is host-plane for the same reason as the registry,
189
- # not because a preset may not want it: it registers a CONTINUABLE SETUP on
190
- # that singleton rather than a tool this agent calls, and the setup list is
191
- # not scope-aware — one copy per mounted preset means every child gets
192
- # `report` registered once per live session, which throws on the second.
165
+ # `tool-subagent-report` 与注册表同理在宿主平面:它在那个单例上注册
166
+ # continuable setup 而非本 agent 调用的工具,且 setup 列表不感知 scope——
167
+ # 每个挂载的预设各注册一份,每个子 agent 都会重复注册 `report`,第二次抛错。
193
168
  - id: delegation
194
169
  name: cordis:group
195
170
  group: true
@@ -216,10 +191,8 @@
216
191
  toolName: subagent_fork
217
192
  backgroundMode: continuable
218
193
 
219
- # Production dsh does not install these optional providers. Install the
220
- # matching Bundle in this Profile and restart the Host, then copy this
221
- # preset and remove `disabled` from the matching tool row. Host availability
222
- # alone grants no tool.
194
+ # 生产版 dsh 不安装这些可选 provider。在本 Profile 安装对应 Bundle 并
195
+ # 重启宿主,再复制本预设、移除对应行的 disabled。宿主可用性本身不授予工具。
223
196
  - id: tool-subagent-codex
224
197
  name: '@deepseek-ai/dsh-tool-subagent'
225
198
  disabled: true
@@ -262,8 +235,7 @@
262
235
  config:
263
236
  allowParallelInProgress: true
264
237
 
265
- # The `web` service and its search provider stay in the host composition; only
266
- # the model-facing tool is per-session.
238
+ # `web` 服务及其搜索 provider 留在宿主组成;只有模型可见的工具按会话。
267
239
  - id: tool-web
268
240
  name: '@deepseek-ai/dsh-tool-web'
269
241
  config:
@@ -1,3 +0,0 @@
1
- agent.cordis.yml 改编自 DeepSeek Harness 内置 standard preset(MIT)。
2
- 仅 persona 段改写为「主协调 Agent」身份;其余行与原 standard 预设一致。
3
- 原始 DeepSeek 版权与 MIT 许可声明见开源仓库。