dsh-subagent-profile 0.3.3 → 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.
- package/README.md +48 -20
- package/README.zh.md +101 -73
- package/docs/screenshots/dispatch-card.png +0 -0
- package/docs/screenshots/settings-page1.png +0 -0
- package/docs/screenshots/settings-page2.png +0 -0
- package/index.mjs +142 -73
- package/lib/client.js +2239 -380
- package/lib/core/adoption-reminder.mjs +48 -0
- package/lib/core/adoption-tracker.mjs +430 -0
- package/lib/core/background-ledger.mjs +71 -0
- package/lib/core/cost-evidence.mjs +145 -0
- package/lib/core/cost-guard.mjs +1 -1
- package/lib/core/decision-trace.mjs +11 -31
- package/lib/core/delegation.mjs +8 -5
- package/lib/core/dispatch-gates.mjs +12 -5
- package/lib/core/dispatch-guard.mjs +6 -0
- package/lib/core/dispatch-schema.mjs +10 -5
- package/lib/core/dispatch-tool.mjs +52 -45
- package/lib/core/draft-gates.mjs +45 -0
- package/lib/core/drafts-store.mjs +45 -0
- package/lib/core/evolution-advice.mjs +224 -0
- package/lib/core/evolution-ledger.mjs +20 -9
- package/lib/core/evolution-summary.mjs +46 -223
- package/lib/core/http-routes.mjs +154 -85
- package/lib/core/presets-sync.mjs +254 -256
- package/lib/core/prices.mjs +46 -0
- package/lib/core/profile-directory.mjs +139 -0
- package/lib/core/profile-provider.mjs +3 -2
- package/lib/core/profiles-store.mjs +1 -1
- package/lib/core/reminder-store.mjs +172 -0
- package/lib/core/shims.mjs +11 -1
- package/package.json +82 -82
- package/presets/orchestrator/agent.cordis.yml +243 -243
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Hero -->
|
|
4
4
|
<div align="center">
|
|
5
|
-
<b style="font-size: 1.15em;"
|
|
5
|
+
<b style="font-size: 1.15em;">子 Agent 派发插件 —— 派发可控 · 成本有数 · 决策留痕</b><br /><br />
|
|
6
6
|
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
|
|
7
7
|
<img alt="npm" src="https://img.shields.io/npm/v/dsh-subagent-profile.svg" />
|
|
8
8
|
<img alt="DSH" src="https://img.shields.io/badge/DSH-0.1.0--rc.6%20~%200.2.0-blue.svg" />
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
For [DeepSeek Harness](https://github.com/deepseek-ai/dsh) (DSH).
|
|
14
14
|
|
|
15
|
-
>
|
|
15
|
+
> Dispatch subagents in DeepSeek Harness: pick model, reasoning effort, and tool scope per task; save common combos as named profiles for reuse. Built-in safety checks, cost estimation with savings analysis, and a full decision ledger.
|
|
16
16
|
|
|
17
17
|
## Why this plugin
|
|
18
18
|
|
|
@@ -21,12 +21,10 @@ For [DeepSeek Harness](https://github.com/deepseek-ai/dsh) (DSH).
|
|
|
21
21
|
| Per-subtask model / preset | ❌ same brain for every subtask | ✅ pick per subtask |
|
|
22
22
|
| Reusable named setups | ❌ | ✅ profiles |
|
|
23
23
|
| Tool-scope narrowing | ❌ | ✅ whitelist ∩ parent, `run_code` always removed |
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **Named, reusable profiles.** A profile is one bundle of preset + model + reasoning effort + tool scope + persona. Save "research" as `researcher` (reasoning off, search-only tools) and dispatch with `dispatch(profile="researcher")`; two built-ins ship (`swap-standard` = full standard coding toolkit, `researcher`), and you can add/edit/remove your own in the settings page.
|
|
29
|
-
- **Fully observable.** Every result reports the effective profile / preset / model / reasoning effort; logs are tagged `[dsh-subagent-profile]`.
|
|
24
|
+
| Safety checks | ❌ | ✅ whitelist / cost / intersection / approval / budget, all recorded |
|
|
25
|
+
| Cost visibility | ❌ | ✅ per-dispatch estimate + savings comparison |
|
|
26
|
+
| Decision ledger | ❌ | ✅ full trace: request vs. effective, gates, execution, settlement |
|
|
27
|
+
| GUI management | ❌ | ✅ settings page + per-session ledger tab |
|
|
30
28
|
|
|
31
29
|
## Installation
|
|
32
30
|
|
|
@@ -35,7 +33,7 @@ dsh plugin --profile web add dsh-subagent-profile # published package
|
|
|
35
33
|
dsh plugin --profile web add ./dsh-subagent-profile # from a local checkout
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
Restart `dsh web`. This is a standard **bundle plugin**: it provides the `dispatch` tool, the profile provider, the `subagent-profiles` service, the `/subagent-profiles/*` loopback management routes, the settings page (「子 Agent 方案」), and the `dispatch` tool-call card in the web GUI. On startup it also **self-installs an agent preset** — **`orchestrator`** (「编排者模式」) — pick it in the new-session preset picker. The sync is idempotent and re-runs on every startup, so upgrading the plugin updates the preset.
|
|
36
|
+
Restart `dsh web`. This is a standard **bundle plugin**: it provides the `dispatch` tool, the profile provider, the `subagent-profiles` service, the `/subagent-profiles/*` loopback management routes, the settings page (「子 Agent 方案」), the per-session ledger tab, and the `dispatch` tool-call card in the web GUI. On startup it also **self-installs an agent preset** — **`orchestrator`** (「编排者模式」) — pick it in the new-session preset picker. The sync is idempotent and re-runs on every startup, so upgrading the plugin updates the preset.
|
|
39
37
|
|
|
40
38
|
## Usage
|
|
41
39
|
|
|
@@ -66,28 +64,48 @@ dispatch(
|
|
|
66
64
|
|
|
67
65
|

|
|
68
66
|
|
|
67
|
+
### 3. Review in the decision ledger
|
|
68
|
+
|
|
69
|
+
Every session has a ledger tab that records each dispatch decision: what the parent saw and requested, what actually took effect (with ignored-request highlights), which tools were removed and why, how execution went (including stalls and parent interventions), and what it cost. Safety-check failures are surfaced with fix directions.
|
|
70
|
+
|
|
69
71
|
## Safety model
|
|
70
72
|
|
|
71
73
|
Delegation never lets a subagent gain more power than you already have — this is the default, with no configuration:
|
|
72
74
|
|
|
73
75
|
- **Tools only shrink.** A child's tool set is the intersection of the profile's tools and the parent's tools, and `run_code` is always removed.
|
|
74
|
-
- **Approval is
|
|
76
|
+
- **Approval is never bypassed.** Delegation does not waive the host's approval requirements; operations that need approval are rejected automatically.
|
|
75
77
|
- **Cost is capped.** Model, reasoning effort, tokens, and recursion depth are all bounded; out-of-range values fail loudly instead of silently downgrading.
|
|
78
|
+
- **An escape hatch, explicitly.** Non-official presets can be allowed per-preset (default off, each allowance audited).
|
|
79
|
+
|
|
80
|
+
## Observability & notifications
|
|
81
|
+
|
|
82
|
+
- **Live status.** Background dispatches show live phase badges (start / gate / create / running / settled), driven by host job events with polling fallback.
|
|
83
|
+
- **Reminder center.** Urgent events (escape-hatch allowances, audit degradation, budget anomalies) raise a persistent badge; the notification center keeps every reminder with full context — parent session, child session, task summary, and outcome — plus one-click jumps to the related sessions. Normal orchestration events (e.g. a parent not adopting a child's result) are recorded in the audit ledger without interrupting you.
|
|
84
|
+
- **Dispatch suggestions.** Based on historical dispatch statistics, the plugin can inject read-only optimization hints for the parent agent (e.g. "this profile has a low recent success rate, consider switching") — hints only, nothing is changed automatically.
|
|
85
|
+
- **Subagent header badge.** Child sessions show a compact summary badge (e.g. `继承父会话 · 前台` — "inherits the parent session, foreground"); hover for the full detail (model / effort / preset / mode / origin).
|
|
76
86
|
|
|
77
87
|
## Data
|
|
78
88
|
|
|
79
89
|
- `~/.dsh/subagent-profiles.json` — the profile registry (edited from the settings page).
|
|
80
90
|
- `~/.dsh/subagent-profiles.state.json` — the plugin's enable/disable switch (default enabled).
|
|
81
91
|
- `~/.dsh/subagent-profiles.failed-traces.json` — the failure ledger (dispatch failure traces).
|
|
92
|
+
- `~/.dsh/subagent-evolution/` — the decision ledger and statistics:
|
|
93
|
+
- `dispatch.jsonl` — per-dispatch decision records (no prompt content).
|
|
94
|
+
- `summaries.json` — aggregated per-profile statistics (versioned, rebuilt on corruption).
|
|
95
|
+
- `adopted-state.json` — adoption verdict state for child results (cross-restart).
|
|
96
|
+
- `reminders.json` — reminder store (one reminder = one audit record).
|
|
82
97
|
- `~/.dsh/.agent-presets/orchestrator/` — the self-installed `orchestrator` agent preset (synced from the bundled `presets/orchestrator/` on every startup).
|
|
83
98
|
|
|
84
|
-
`DSH_HOME` is respected and defaults to `~/.dsh`. Uninstalling the plugin removes the
|
|
99
|
+
`DSH_HOME` is respected and defaults to `~/.dsh`. Uninstalling the plugin removes the data files above and the self-installed `orchestrator` preset directory (other plugins' presets are left untouched); re-installing or re-launching re-syncs the preset and regenerates the data files.
|
|
85
100
|
|
|
86
101
|
## Known limitations
|
|
87
102
|
|
|
88
|
-
- **Background
|
|
89
|
-
- **Continuable
|
|
90
|
-
- **
|
|
103
|
+
- **Background dispatch** requires `@deepseek-ai/dsh-jobs` and `@deepseek-ai/dsh-tool-jobs` to be loaded; otherwise it fails with "dispatch: 后台派发不可用:缺少 jobs 服务".
|
|
104
|
+
- **Continuable mode** goes through the DSH standard composition path, so the `preset` swap and `reasoningEffort` are ignored (the child inherits the parent preset at the default reasoning effort).
|
|
105
|
+
- **Who decides the child's final tool set depends on the mode**:
|
|
106
|
+
- Continuable: narrowed by this plugin up front — the child's `allow` = (parent tool set − `run_code` − `deny`) ∩ `allow`. Assumption: continuable inherits the parent preset, so the child's tool set ≈ the parent's; if dsh's behavior changes so the two differ (e.g. a future preset swap composing a different tool set), tool narrowing fails with a hard error (conservatively safe — never silently granting more), to be replaced with a true parent ∩ child intersection once dsh provides an official seam.
|
|
107
|
+
- One-shot: decided by dsh; the plugin cannot read the final restricted result and the card reports "tools are finally granted by the system".
|
|
108
|
+
- **Cost figures are estimates**: computed from an average per-dispatch price (measured once per model); fine-grained per-token pricing is on the roadmap. The UI labels estimates as such and shows a note when the sample size is small.
|
|
91
109
|
|
|
92
110
|
## Repository structure
|
|
93
111
|
|
|
@@ -95,26 +113,36 @@ Delegation never lets a subagent gain more power than you already have — this
|
|
|
95
113
|
dsh-subagent-profile/
|
|
96
114
|
├── index.mjs # host side: the plugin itself (dispatch tool, profile provider, service, HTTP routes)
|
|
97
115
|
├── lib/
|
|
98
|
-
│ ├── client.js # browser side: settings page + dispatch tool-call card
|
|
116
|
+
│ ├── client.js # browser side: settings page + ledger + dispatch tool-call card
|
|
99
117
|
│ └── core/ # host-side modules (lightweight layering)
|
|
100
118
|
│ ├── pure.mjs # dependency-free pure functions (sanitize / prune / guard math — unit-tested)
|
|
101
119
|
│ ├── shims.mjs # the single @deepseek-ai import facade (guards fail loud, helpers degrade softly)
|
|
102
120
|
│ ├── catalog.mjs # tool-name → zh / category tables (zero-dep)
|
|
103
121
|
│ ├── catalog-cache.mjs # process-shared catalog snapshot (models / presets / tools, TTL cache)
|
|
104
122
|
│ ├── cost-guard.mjs # runtime capability checks (provider / model / reasoning effort)
|
|
105
|
-
│ ├──
|
|
123
|
+
│ ├── cost-evidence.mjs # counterfactual savings evidence (token-saving proof)
|
|
124
|
+
│ ├── prices.mjs # per-dispatch price table (average-based placeholder)
|
|
125
|
+
│ ├── decision-trace.mjs # decision trace (checks / effective / settled) + failure ledger
|
|
106
126
|
│ ├── delegation.mjs # background one-shot settling + child usage collection
|
|
107
|
-
│ ├── dispatch-gates.mjs # pre-dispatch
|
|
127
|
+
│ ├── dispatch-gates.mjs # pre-dispatch safety checks (whitelist / cost / intersection / budget)
|
|
108
128
|
│ ├── dispatch-guard.mjs # concurrency + per-parent token budget guard
|
|
109
129
|
│ ├── dispatch-schema.mjs # dispatch tool input/output schema declarations
|
|
110
130
|
│ ├── dispatch-tool.mjs # dispatch tool factory (defineTool + execute + syncTool)
|
|
131
|
+
│ ├── draft-gates.mjs # draft profile gates (three checks)
|
|
132
|
+
│ ├── drafts-store.mjs # draft profile persistence
|
|
111
133
|
│ ├── escape.mjs # escape-hatch allow store
|
|
112
|
-
│ ├── evolution-ledger.mjs #
|
|
113
|
-
│ ├── evolution-summary.mjs #
|
|
134
|
+
│ ├── evolution-ledger.mjs # decision ledger (jsonl) + governance audit
|
|
135
|
+
│ ├── evolution-summary.mjs # aggregate statistics (per-profile, capability/budget axes)
|
|
136
|
+
│ ├── evolution-advice.mjs # read-only dispatch suggestion generation
|
|
137
|
+
│ ├── adoption-tracker.mjs # child-result adoption verdict tracking (cross-restart)
|
|
138
|
+
│ ├── adoption-reminder.mjs # adoption-verdict reminder generation
|
|
139
|
+
│ ├── reminder-store.mjs # reminder store + audit-coupled records
|
|
140
|
+
│ ├── background-ledger.mjs # background job ledger (in-memory, resets on restart)
|
|
114
141
|
│ ├── http-routes.mjs # settings loopback HTTP routes
|
|
115
142
|
│ ├── intersection.mjs # tool-intersection pure core
|
|
116
143
|
│ ├── presets-sync.mjs # bundled preset self-install (hash-gated sync)
|
|
117
144
|
│ ├── profile-provider.mjs # the `profile` subagent provider
|
|
145
|
+
│ ├── profile-directory.mjs # read-only profile directory (for the model)
|
|
118
146
|
│ ├── profiles-store.mjs # profile registry store + switch persistence
|
|
119
147
|
│ └── whitelist.mjs # system-trust preset whitelist
|
|
120
148
|
├── presets/orchestrator/ # bundled "orchestrator" agent preset (self-installed, synced on every startup)
|
|
@@ -126,7 +154,7 @@ dsh-subagent-profile/
|
|
|
126
154
|
│ └── leak-scan.mjs # public-release gate: scans all history + worktree for sensitive patterns
|
|
127
155
|
├── docs/
|
|
128
156
|
│ └── screenshots/ # README screenshots
|
|
129
|
-
├── test/ # host-side tests (node:test, zero extra deps;
|
|
157
|
+
├── test/ # host-side tests (node:test, zero extra deps; 438 cases)
|
|
130
158
|
│ ├── README.md / README.zh.md # test directory guide (EN/ZH) — two-tier split explained
|
|
131
159
|
│ ├── harness/ctx.mjs # fake Cordis ctx + ~/.dsh isolation
|
|
132
160
|
│ ├── pure / input-schema / catalog-integrity.test.mjs # bare tier (import-free, runs in bare CI)
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Hero -->
|
|
4
4
|
<div align="center">
|
|
5
|
-
<b style="font-size: 1.15em;">子 Agent
|
|
5
|
+
<b style="font-size: 1.15em;">子 Agent 派发插件 —— 派发可控 · 成本有数 · 决策留痕</b><br /><br />
|
|
6
6
|
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
|
|
7
7
|
<img alt="npm" src="https://img.shields.io/npm/v/dsh-subagent-profile.svg" />
|
|
8
8
|
<img alt="DSH" src="https://img.shields.io/badge/DSH-0.1.0--rc.6%20~%200.2.0-blue.svg" />
|
|
@@ -10,143 +10,171 @@
|
|
|
10
10
|
|
|
11
11
|
<div align="center"><a href="README.md">English</a> · 中文</div>
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
适用于 [DeepSeek Harness](https://github.com/deepseek-ai/dsh)(DSH)。
|
|
14
14
|
|
|
15
|
-
>
|
|
15
|
+
> DeepSeek Harness 子 Agent 派发插件:按任务为子代理选模型、推理强度与工具范围,常用组合存成命名方案随时复用;内置安全检查、成本估算与节省分析、完整决策台账。
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 为什么需要这个插件
|
|
18
18
|
|
|
19
19
|
| | 内置 `subagent` | `dsh-subagent-profile` |
|
|
20
20
|
|---|---|---|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **把常用搭配存成命名方案,按名调用。** 「方案」= 预设 + 模型 + 推理强度 + 工具范围 + 人设的一揽子配置。把「调研」存成 `researcher`(关深度推理、只留检索工具),以后 `dispatch(profile="researcher")` 即可;内置 `swap-standard`(切到 standard 全套编码工具)和 `researcher` 两个现成方案,也能在设置页自己增删改。
|
|
29
|
-
- **每次派发都看得见实际用了什么。** 结果里标注实际生效的方案/预设/模型/推理强度,日志带 `[dsh-subagent-profile]` 标记,方便排查。
|
|
21
|
+
| 按子任务选模型/预设 | ❌ 每个子任务同一个「大脑」 | ✅ 按任务逐个指定 |
|
|
22
|
+
| 可复用的命名方案 | ❌ | ✅ 方案(profile) |
|
|
23
|
+
| 工具范围收敛 | ❌ | ✅ 白名单 ∩ 父会话,`run_code` 恒移除 |
|
|
24
|
+
| 派发前安全检查 | ❌ | ✅ 白名单/成本/交集/审批/预算,全程记录 |
|
|
25
|
+
| 成本可见 | ❌ | ✅ 每次派发的成本估算 + 节省对照 |
|
|
26
|
+
| 派发决策台账 | ❌ | ✅ 请求vs生效、检查结果、执行、结算全留痕 |
|
|
27
|
+
| 界面管理 | ❌ | ✅ 设置页 + 会话内台账标签页 |
|
|
30
28
|
|
|
31
29
|
## 安装
|
|
32
30
|
|
|
33
31
|
```bash
|
|
34
32
|
dsh plugin --profile web add dsh-subagent-profile # 发布包
|
|
35
|
-
dsh plugin --profile web add ./dsh-subagent-profile #
|
|
33
|
+
dsh plugin --profile web add ./dsh-subagent-profile # 本地源码
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
重启 `dsh web`。这是一个标准的 **bundle 插件**:提供 `dispatch` 工具、方案提供者、`subagent-profiles` 服务、`/subagent-profiles/*` 回环管理路由、设置页(「子 Agent 方案」)、会话内派发决策台账标签页,以及 web 界面中的 `dispatch` 工具卡片。启动时还会**自动安装一个 agent 预设**——**`orchestrator`**(「编排者模式」)——在新会话的预设选择器里选用。同步是幂等的且每次启动重跑,升级插件即更新预设。
|
|
39
37
|
|
|
40
|
-
##
|
|
38
|
+
## 使用
|
|
41
39
|
|
|
42
40
|
### 1. 配置子 Agent 方案
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
方案在设置页管理——每个方案打包预设 + 模型 + 推理强度 + 工具范围(可选人设),可单独启用、禁用、编辑、重置。内置两个:
|
|
45
43
|
|
|
46
44
|
| 方案 | 用途 |
|
|
47
45
|
|---|---|
|
|
48
|
-
| `swap-standard` |
|
|
49
|
-
| `researcher` |
|
|
46
|
+
| `swap-standard` | 让子代理切换到完整标准编码工具集 |
|
|
47
|
+
| `researcher` | 关闭深度推理,仅搜索工具 |
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
方案数据存于 `~/.dsh/subagent-profiles.json`,设置页修改即时生效。
|
|
52
50
|
|
|
53
|
-

|
|
54
52
|
|
|
55
|
-

|
|
56
54
|
|
|
57
|
-
### 2.
|
|
55
|
+
### 2. 按子任务派发——`dispatch` 工具
|
|
58
56
|
|
|
59
57
|
```js
|
|
60
58
|
dispatch(
|
|
61
59
|
profile: "researcher", // 预设 + 模型 + 推理强度 + 工具范围
|
|
62
|
-
prompt: "调研 DSH
|
|
60
|
+
prompt: "调研 DSH 插件生态并对比直接竞品",
|
|
63
61
|
run_in_background: true
|
|
64
62
|
)
|
|
65
63
|
```
|
|
66
64
|
|
|
67
|
-

|
|
66
|
+
|
|
67
|
+
### 3. 在派发决策台账中复盘
|
|
68
|
+
|
|
69
|
+
每个会话都有「派发决策台账」标签,记录每次派发决策:父会话看到了什么、请求了什么,实际生效了什么(请求被忽略处高亮),哪些工具被移除及原因,执行过程如何(含停滞与主 Agent 干预),以及成本多少。安全检查失败时给出修复方向。
|
|
68
70
|
|
|
69
71
|
## 安全模型
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
委派永远不会让子代理获得比你更大的权限——这是默认行为,无需配置:
|
|
74
|
+
|
|
75
|
+
- **工具只减不增。** 子代理的工具集 = 方案工具 ∩ 父会话工具,且 `run_code` 恒移除。
|
|
76
|
+
- **审批永不豁免。** 委派不豁免宿主的审批要求;需要审批的操作自动拒绝。
|
|
77
|
+
- **成本有上限。** 模型、推理强度、token、递归深度全部有界;越界值大声失败而非静默降级。
|
|
78
|
+
- **逃生舱,显式开启。** 非官方预设可逐个放行(默认关闭,每次放行留审计)。
|
|
79
|
+
|
|
80
|
+
## 可观测性与通知
|
|
72
81
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
82
|
+
- **实时状态。** 后台派发的阶段徽标实时更新(发起/检查/创建/执行中/结算),宿主任务事件驱动,轮询兜底。
|
|
83
|
+
- **提醒中心。** 紧急事件(逃生舱放行、审计降级、预算异常)触发常驻红角标;通知中心里每条提醒都带完整上下文——主会话、子会话、任务摘要、结果状态——并可一键跳转对应会话。正常编排事件(如父会话未采纳某次派发结果)只记审计台账,不打断你。
|
|
84
|
+
- **派发优化建议。** 基于历史派发统计,插件可向主 Agent 注入只读优化提示(如「该方案近期成功率偏低,可考虑换方案」)——只提示,不自动改任何配置。
|
|
85
|
+
- **子会话页头徽标。** 子会话页头显示紧凑摘要标签(如 `继承父会话 · 前台`),悬停查看全部字段(模型/推理强度/预设/模式/来源)。
|
|
76
86
|
|
|
77
|
-
##
|
|
87
|
+
## 数据文件
|
|
78
88
|
|
|
79
|
-
- `~/.dsh/subagent-profiles.json` ——
|
|
80
|
-
- `~/.dsh/subagent-profiles.state.json` ——
|
|
89
|
+
- `~/.dsh/subagent-profiles.json` —— 方案注册表(设置页编辑)。
|
|
90
|
+
- `~/.dsh/subagent-profiles.state.json` —— 插件开关状态(默认启用)。
|
|
81
91
|
- `~/.dsh/subagent-profiles.failed-traces.json` —— 失败台账(派发失败轨迹)。
|
|
82
|
-
- `~/.dsh
|
|
92
|
+
- `~/.dsh/subagent-evolution/` —— 派发决策台账与统计:
|
|
93
|
+
- `dispatch.jsonl` —— 每次派发的决策记录(不含 prompt 原文)。
|
|
94
|
+
- `summaries.json` —— 按方案聚合的统计(带版本号,损坏自动重建)。
|
|
95
|
+
- `adopted-state.json` —— 子结果采纳判定状态(跨重启)。
|
|
96
|
+
- `reminders.json` —— 提醒存储(一条提醒 = 一条审计记录)。
|
|
97
|
+
- `~/.dsh/.agent-presets/orchestrator/` —— 自动安装的 `orchestrator` 预设(每次启动从内置 `presets/orchestrator/` 同步)。
|
|
83
98
|
|
|
84
|
-
尊重 `DSH_HOME
|
|
99
|
+
尊重 `DSH_HOME` 环境变量(默认 `~/.dsh`)。卸载插件会移除上述数据文件与自动安装的 `orchestrator` 预设目录(其他插件的预设不动);重装或重启会重新同步预设并重建数据文件。
|
|
85
100
|
|
|
86
101
|
## 已知限制
|
|
87
102
|
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
103
|
+
- **后台派发**需要 `@deepseek-ai/dsh-jobs` 与 `@deepseek-ai/dsh-tool-jobs` 已加载;否则报「dispatch: 后台派发不可用:缺少 jobs 服务」。
|
|
104
|
+
- **持久(continuable)模式**走 DSH 标准组合路径,`preset` 换用与 `reasoningEffort` 会被忽略(子代理继承父预设与默认推理强度)。
|
|
105
|
+
- **子代理的最终工具集由谁决定,取决于模式**:
|
|
106
|
+
- 持久(continuable)模式:由本插件预先收敛——子代理 `allow` =(父工具集 − `run_code` − `deny`)∩ `allow`。前提假设:持久模式沿用父会话预设,故子工具集与父会话基本一致;一旦 dsh 的行为变化导致两者不同(如未来支持预设换用后组合出不同工具集),工具收敛会**直接报错拒绝**(保守安全,绝不静默放行),待 dsh 官方提供相应接口后替换为真正的父 ∩ 子交集。
|
|
107
|
+
- 一次性模式:由 dsh 决定,插件读不到最终受限结果;卡片显示「工具由系统最终授予」。
|
|
108
|
+
- **成本是估算**:按每次派发的均价计算(每个模型实测一次);按 token 的精细计价在路线图中。界面明确标注「估算」,样本不足时显示说明。
|
|
91
109
|
|
|
92
|
-
##
|
|
110
|
+
## 仓库结构
|
|
93
111
|
|
|
94
112
|
```
|
|
95
113
|
dsh-subagent-profile/
|
|
96
|
-
├── index.mjs # 宿主侧:插件本体(dispatch
|
|
114
|
+
├── index.mjs # 宿主侧:插件本体(dispatch 工具、方案提供者、服务、HTTP 路由)
|
|
97
115
|
├── lib/
|
|
98
|
-
│ ├── client.js # 浏览器侧:设置页 + dispatch
|
|
116
|
+
│ ├── client.js # 浏览器侧:设置页 + 台账 + dispatch 工具卡片
|
|
99
117
|
│ └── core/ # 宿主侧模块(轻量分层)
|
|
100
|
-
│ ├── pure.mjs #
|
|
101
|
-
│ ├── shims.mjs # @deepseek-ai
|
|
102
|
-
│ ├── catalog.mjs # 工具名 →
|
|
103
|
-
│ ├── catalog-cache.mjs #
|
|
104
|
-
│ ├── cost-guard.mjs #
|
|
105
|
-
│ ├──
|
|
106
|
-
│ ├──
|
|
107
|
-
│ ├──
|
|
108
|
-
│ ├──
|
|
118
|
+
│ ├── pure.mjs # 零依赖纯函数(清洗/剪枝/护栏数学——单测覆盖)
|
|
119
|
+
│ ├── shims.mjs # 唯一的 @deepseek-ai 导入门面(护栏大声失败,辅助软降级)
|
|
120
|
+
│ ├── catalog.mjs # 工具名 → 中文/分类表(零依赖)
|
|
121
|
+
│ ├── catalog-cache.mjs # 进程共享目录快照(模型/预设/工具,TTL 缓存)
|
|
122
|
+
│ ├── cost-guard.mjs # 运行时能力检查(提供方/模型/推理强度)
|
|
123
|
+
│ ├── cost-evidence.mjs # 省 token 反事实对照证据
|
|
124
|
+
│ ├── prices.mjs # 每次派发单价表(当前为均价占位)
|
|
125
|
+
│ ├── decision-trace.mjs # 决策轨迹(检查/生效/结算)+ 失败台账
|
|
126
|
+
│ ├── delegation.mjs # 后台一次性结算 + 子用量采集
|
|
127
|
+
│ ├── dispatch-gates.mjs # 派发前安全检查(白名单/成本/交集/预算)
|
|
128
|
+
│ ├── dispatch-guard.mjs # 并发 + 每父会话 token 预算护栏
|
|
109
129
|
│ ├── dispatch-schema.mjs # dispatch 工具输入/输出 schema 声明
|
|
110
130
|
│ ├── dispatch-tool.mjs # dispatch 工具工厂(defineTool + execute + syncTool)
|
|
111
|
-
│ ├──
|
|
112
|
-
│ ├──
|
|
113
|
-
│ ├──
|
|
114
|
-
│ ├──
|
|
115
|
-
│ ├──
|
|
116
|
-
│ ├──
|
|
117
|
-
│ ├──
|
|
118
|
-
│ ├──
|
|
131
|
+
│ ├── draft-gates.mjs # 草稿方案三道闸
|
|
132
|
+
│ ├── drafts-store.mjs # 草稿方案持久化
|
|
133
|
+
│ ├── escape.mjs # 逃生舱放行存储
|
|
134
|
+
│ ├── evolution-ledger.mjs # 派发决策台账(jsonl)+ 治理审计
|
|
135
|
+
│ ├── evolution-summary.mjs # 聚合统计(按方案,能力/预算双轴)
|
|
136
|
+
│ ├── evolution-advice.mjs # 只读派发建议生成
|
|
137
|
+
│ ├── adoption-tracker.mjs # 子结果采纳判定跟踪(跨重启)
|
|
138
|
+
│ ├── adoption-reminder.mjs # 采纳判定提醒生成
|
|
139
|
+
│ ├── reminder-store.mjs # 提醒存储 + 审计耦合记录
|
|
140
|
+
│ ├── background-ledger.mjs # 后台任务台账(内存态,重启即失)
|
|
141
|
+
│ ├── http-routes.mjs # 设置回环 HTTP 路由
|
|
142
|
+
│ ├── intersection.mjs # 工具交集纯核心
|
|
143
|
+
│ ├── presets-sync.mjs # 内置预设自动安装(哈希门控同步)
|
|
144
|
+
│ ├── profile-provider.mjs # `profile` 子代理提供者
|
|
145
|
+
│ ├── profile-directory.mjs # 只读方案目录(供模型参考)
|
|
146
|
+
│ ├── profiles-store.mjs # 方案注册表存储 + 开关持久化
|
|
119
147
|
│ └── whitelist.mjs # system-trust 预设白名单
|
|
120
|
-
├── presets/orchestrator/ #
|
|
121
|
-
├── cordis.patch.yml # bundle
|
|
122
|
-
├── .gitea/workflows/ci.yml # bare-CI(Gitea Actions
|
|
123
|
-
├── package.json # 元数据、files
|
|
148
|
+
├── presets/orchestrator/ # 内置「orchestrator」预设(自动安装,每次启动同步)
|
|
149
|
+
├── cordis.patch.yml # bundle patch:把插件行插入宿主组合
|
|
150
|
+
├── .gitea/workflows/ci.yml # bare-CI(Gitea Actions;需服务器上的 Act runner)
|
|
151
|
+
├── package.json # 元数据、files 白名单、exports(test / test:bare / preflight 脚本)
|
|
124
152
|
├── scripts/
|
|
125
|
-
│ ├── preflight.mjs #
|
|
126
|
-
│ └── leak-scan.mjs #
|
|
153
|
+
│ ├── preflight.mjs # 预检:预设树一致 + 无硬编码版本徽章(零依赖)
|
|
154
|
+
│ └── leak-scan.mjs # 公开发布门:扫描全历史与工作区的敏感模式
|
|
127
155
|
├── docs/
|
|
128
156
|
│ └── screenshots/ # README 截图
|
|
129
|
-
├── test/ #
|
|
130
|
-
│ ├── README.md / README.zh.md #
|
|
131
|
-
│ ├── harness/ctx.mjs #
|
|
132
|
-
│ ├── pure / input-schema / catalog-integrity.test.mjs # bare
|
|
133
|
-
│ └── *.test.mjs # junction
|
|
157
|
+
├── test/ # 宿主侧测试(node:test,零额外依赖;438 用例)
|
|
158
|
+
│ ├── README.md / README.zh.md # 测试目录指南(中英)——两层拆分说明
|
|
159
|
+
│ ├── harness/ctx.mjs # 假 Cordis ctx + ~/.dsh 隔离
|
|
160
|
+
│ ├── pure / input-schema / catalog-integrity.test.mjs # bare 层(免导入,bare CI 可跑)
|
|
161
|
+
│ └── *.test.mjs # junction 层(仅本地):characterization / facade / gating / persist / recycle /
|
|
134
162
|
│ # cost-guard / continuable-guard / decision-trace / dispatch-guard / escape-hatch /
|
|
135
163
|
│ # evolution-* / csrf / label-preset-sync / percall-spec / trust-label / audit-meta / …
|
|
136
|
-
├── README.md / README.zh.md #
|
|
164
|
+
├── README.md / README.zh.md # 本文档(英/中)
|
|
137
165
|
└── LICENSE
|
|
138
166
|
```
|
|
139
167
|
|
|
140
168
|
## 贡献
|
|
141
169
|
|
|
142
|
-
发现
|
|
170
|
+
发现 bug 或有想法?[提交 issue](https://github.com/muzyLink/dsh-subagent-profile/issues) 或 PR——欢迎一切贡献。
|
|
143
171
|
|
|
144
|
-
|
|
172
|
+
如果这个插件对你有用,请在 GitHub 上给个 ⭐——它帮助更多人发现它。
|
|
145
173
|
|
|
146
174
|
## 致谢
|
|
147
175
|
|
|
148
|
-
内置的 `orchestrator`
|
|
176
|
+
内置的 `orchestrator` 预设灵感来自 [dsh-web-ui](https://github.com/zhu1090093659/dsh-web-ui) 的 [dsh-liangshen](https://github.com/zhu1090093659/dsh-web-ui/tree/main/packages/dsh-liangshen)(梁神模式),Apache-2.0 许可。感谢作者。
|
|
149
177
|
|
|
150
|
-
##
|
|
178
|
+
## 许可
|
|
151
179
|
|
|
152
180
|
[MIT](LICENSE) — Copyright (c) 2026 muzyLink
|
|
Binary file
|
|
Binary file
|
|
Binary file
|