dsh-paoding 0.2.2 → 0.3.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.
Files changed (42) hide show
  1. package/README.md +27 -32
  2. package/README_en.md +27 -32
  3. package/bin/dsh-paoding.mjs +73 -11
  4. package/docs/architecture.md +41 -34
  5. package/docs/architecture_en.md +65 -42
  6. package/docs/configuration.md +159 -65
  7. package/docs/configuration_en.md +161 -66
  8. package/docs/images/1.png +0 -0
  9. package/docs/installation.md +100 -237
  10. package/docs/installation_en.md +112 -252
  11. package/docs/orchestration.md +34 -38
  12. package/docs/orchestration_en.md +34 -38
  13. package/package.json +8 -5
  14. package/plugins/paoding-config-ui/api-core.mjs +215 -18
  15. package/plugins/paoding-config-ui/index.mjs +414 -154
  16. package/plugins/paoding-config-ui/lib/base.css +1083 -42
  17. package/plugins/paoding-config-ui/lib/client.js +2266 -252
  18. package/plugins/paoding-config-ui/package.json +2 -2
  19. package/plugins/paoding-config-ui/runtime-inventory.mjs +27 -26
  20. package/presets/orchestrator/agent.cordis.yml +19 -9
  21. package/presets/orchestrator/preset.yml +3 -2
  22. package/presets/orchestrator/restrict.mjs +2 -1
  23. package/tools/install.mjs +9 -4
  24. package/tools/lib/alloc.mjs +60 -29
  25. package/tools/lib/cli.mjs +127 -278
  26. package/tools/lib/compose.mjs +261 -95
  27. package/tools/lib/config.mjs +266 -86
  28. package/tools/lib/host.mjs +55 -24
  29. package/tools/lib/skills.mjs +72 -45
  30. package/tools/lib/state.mjs +172 -40
  31. package/tools/lib/upgrade.mjs +170 -0
  32. package/tools/lib/util.mjs +7 -0
  33. package/tools/lib/version.mjs +233 -0
  34. package/tools/lib/workspaces.mjs +74 -0
  35. package/tools/lib/yaml.mjs +92 -15
  36. package/docs/images/2.png +0 -0
  37. package/docs/images/3.png +0 -0
  38. package/docs/images/4.png +0 -0
  39. package/docs/images/5.png +0 -0
  40. package/docs/images/6.png +0 -0
  41. package/install.sh +0 -31
  42. package/tools/lib/wizard.mjs +0 -516
@@ -36,11 +36,12 @@ The essential differences from monolithic mode:
36
36
  | Dimension | Monolithic mode (default) | Orchestrator mode (this preset) |
37
37
  |---|---|---|
38
38
  | Responsibility | One agent does everything | Main agent decomposes and integrates; role sub-agents each do one job |
39
- | Cost | ~16.2k tokens tool tax paid on every request | Main agent ~5.5k; role surfaces ~3.0k–3.7k, paid only when delegated |
39
+ | Cost | ~16.2k tokens tool tax paid on every request | Main agent ~5.5k; role surfaces ~3.0k–3.8k, paid only when delegated |
40
40
  | Context | Every search dump, design draft and diff accumulates in the main context | Worker contexts are small and specialized and discarded after use; the main agent receives only summaries |
41
41
 
42
- The static source of the composition is `presets/orchestrator/agent.cordis.yml`, layered on top of DSH's
43
- builtin `standard` preset in full (see the "Under the hood" section below); at runtime
42
+ The static source of the composition is `presets/orchestrator/agent.cordis.yml`, which includes all of the
43
+ builtin `standard` preset's composition rows verbatim — copied into the same composition, not inherited at
44
+ runtime (see mechanism ① in the "Under the hood" section below); at runtime
44
45
  `restrict.mjs` trims the main agent's tool surface. The four role delegation instances are
45
46
  `delegation-search-external` / `delegation-design` / `delegation-implement` /
46
47
  `delegation-search-internal-deep`, all inside the composition's delegation group. That group also carries the
@@ -68,16 +69,17 @@ allow lists are in the "Roles & tool surfaces" section below):
68
69
  (on demand) (on demand) (on demand) (on demand)
69
70
  │ │ │ │
70
71
  ▼ ▼ ▼ ▼
71
- web_search read/read_image read/write/edit glob/grep/read
72
- mcp__tavily__* glob/grep/bash glob/grep/bash read_image/bash
73
- (5 tools) skill/write/edit skill/web_search ask_user_question
74
- glob/grep/read ask_user_question ask_user_question todo_write
75
- ask_user_question todo_write todo_write job_output
76
- (no write/edit) job_output job_output job_list
77
- job_list job_list/job_kill job_kill
78
- job_kill get_goal (read-only; no
79
- create_goal file writes,
80
- update_goal no network)
72
+ web_search read/read_image read/read_image glob/grep/read
73
+ mcp__tavily__* glob/grep/bash write/edit read_image/bash
74
+ (5 tools) skill/web_search glob/grep/bash ask_user_question
75
+ glob/grep/read ask_user_question skill/web_search todo_write
76
+ ask_user_question todo_write ask_user_question job_output
77
+ (no write/edit) job_output todo_write job_list
78
+ job_list job_output job_kill
79
+ job_kill job_list/job_kill (read-only; no
80
+ get_goal file writes,
81
+ create_goal no network)
82
+ update_goal
81
83
  ```
82
84
 
83
85
  In the diagram:
@@ -89,8 +91,9 @@ In the diagram:
89
91
  job_kill);
90
92
  - Four arrows fan out to the **role sub-agents**, each created on demand (cold path). search_external
91
93
  carries web_search, the five `mcp__tavily__*` tools, plus glob/grep/read and ask_user_question, with no
92
- write/edit; design carries read/read_image/glob/grep/bash/skill/write/edit plus coordination tools;
93
- implement carries read/write/edit/glob/grep/bash/skill/web_search plus coordination and goal tools;
94
+ write/edit; design carries read/read_image/glob/grep/bash/skill/web_search plus coordination tools;
95
+ implement carries read/read_image/write/edit/glob/grep/bash/skill/web_search plus coordination and
96
+ goal tools;
94
97
  search_internal_deep carries the full read-only internal-search surface (glob/grep/read/read_image/bash
95
98
  plus ask_user_question and job tools) — no file modification, no network.
96
99
 
@@ -105,19 +108,21 @@ measured calibration; figures are order-of-magnitude estimates):
105
108
  | Monolithic (status quo, untrimmed) | All 60 tools | **~16.2k** | Paid in full on every request |
106
109
  | Orchestrator main agent | 21-entry whitelist (∩ registry) | **~5.5k** | ↓66%; zero delegation latency for internal search |
107
110
  | search_external sub-agent | 10 allowed entries | ~3.0k | Paid only when web research actually runs |
108
- | design sub-agent | 13 allowed entries | ~3.2k | Paid only when a design task is delegated |
109
- | implement sub-agent | 16 allowed entries | ~3.7k | Paid only when an implementation task is delegated |
111
+ | design sub-agent | 12 allowed entries | ~3.3k | Paid only when a design task is delegated |
112
+ | implement sub-agent | 17 allowed entries | ~3.8k | Paid only when an implementation task is delegated |
110
113
  | search_internal_deep sub-agent | 10 allowed entries | not separately estimated | Paid only when a deep repo search is delegated |
111
114
 
112
- Note: role tool counts above follow the actual `allow` entries in `agent.cordis.yml` (design 13 / implement
113
- 16); the old README figures of 14 / 17 and a 22-entry whitelist are outdated.
115
+ Note: role tool counts above follow the actual `allow` entries in `agent.cordis.yml` (design 12 / implement
116
+ 17); the old README figures of 14 / 17 and a 22-entry whitelist are outdated.
114
117
 
115
118
  **The real win is context isolation, not the few thousand tokens saved per se**:
116
119
 
117
120
  - A monolithic agent's context accumulates every search dump, every design draft and every diff — even when a
118
121
  tool is unused in the current request, its past outputs still occupy the window;
119
122
  - In the orchestrator architecture every worker keeps a small, specialized context (its own role tools and
120
- outputs only); roles are one-shot by default and discarded after use. The main agent receives only
123
+ outputs only); roles are one-shot by default and discarded after use (the session mode is per-role
124
+ configurable — a role that genuinely needs multi-round polishing can switch to continuable, see
125
+ [Orchestration](orchestration_en.md)). The main agent receives only
121
126
  structured summaries and integrates them — it never pours a sub-agent's full context into its own window;
122
127
  - Consequently the main agent's window size is decoupled from "how much work this round delegated"; in long
123
128
  sessions the token level is dominated by the orchestrator's own summaries and decisions (combined with
@@ -168,19 +173,20 @@ persona and the delegation-failure SOP live in [docs/orchestration_en.md](orches
168
173
 
169
174
  The four built-in roles are just the factory division of labor: through the same mechanism, any combination
170
175
  of tools and skills becomes a new delegation tool — write a toolName under the config `roles` key (or create
171
- it in the wizard / config UI), the installer generates a `delegation-<toolName>` block, injects the
176
+ it in the 庖丁配置 panel), the generator produces a `delegation-<toolName>` block, injects the
172
177
  toolName into the main-agent allow list, and appends the role's persona first line (its duty sentence)
173
178
  to the main-agent persona as a delegation row (a role with no tools is rejected at apply time); see
174
179
  section 6 of [docs/configuration_en.md](configuration_en.md).
175
- Custom roles support the same `model` / `provider` dedicated-model sub-keys as the built-in roles (same
176
- sub-keys, same generation mechanism — see 2.5).
180
+ Custom roles support the same `model` / `provider` dedicated-model sub-keys and the same `background_mode`
181
+ session-mode sub-key as the built-in roles (same sub-keys, same generation mechanism — the generator always
182
+ writes a `backgroundMode` row for custom role blocks, and `continuable` takes effect the same way — see 2.5 / 2.6).
177
183
  For example, a `ppt` agent carrying the `html-ppt` skill gives slide-making its own dedicated sub-agent.
178
184
 
179
185
  | Delegation tool | Instance ID | Persona in one sentence | Load cost |
180
186
  |---|---|---|---|
181
187
  | `search_external` | `delegation-search-external` | Web research only (web_search + tavily), never modifies files; returns a structured research summary (findings, sources, open questions) | ~3.0k, only when delegated |
182
- | `design` | `delegation-design` | Produces UI/UX designs, wireframes and frontend specs; may load design skills (frontend-design, html-ppt) via the skill tool; reads reference material first, delivers a spec, does not implement final code | ~3.2k, only when delegated |
183
- | `implement` | `delegation-implement` | Writes and edits code: read surrounding context → surgical change → verify (build/test/grep); does not redesign architecture | ~3.7k, only when delegated |
188
+ | `design` | `delegation-design` | Produces UI/UX designs, wireframes and frontend specs; may load design skills (frontend-design, html-ppt) via the skill tool; reads reference material first, delivers a spec, does not implement final code | ~3.3k, only when delegated |
189
+ | `implement` | `delegation-implement` | Writes and edits code: read surrounding context → surgical change → verify (build/test/grep); does not redesign architecture | ~3.8k, only when delegated |
184
190
  | `search_internal_deep` | `delegation-search-internal-deep` | Repository exploration only: never modifies files, never uses the network; handles tasks too heavy for the main agent's context (whole-repo grep dumps, full-file reads beyond a page, cross-directory symbol/definition tracking); returns condensed summaries only | not separately estimated, only when delegated |
185
191
 
186
192
  The table above is the factory default; the configuration layer can trim and customize it (see
@@ -188,13 +194,23 @@ The table above is the factory default; the configuration layer can trim and cus
188
194
  deleted wholesale via `roles_remove` (2.3; `search_internal_deep` cannot); a built-in role can carry a display
189
195
  name `roles.<toolName>.name`, which rewrites only the subject of its persona identity sentence (2.4); it can
190
196
  also be pinned to a dedicated model `roles.<toolName>.model` / `.provider`, injected by the generator as
191
- `agentOptions` in the delegation block, defaulting to following the main agent (2.5); and the main agent itself
192
- can be renamed via `main_agent_name` — one key, two places (section 5).
197
+ `agentOptions` in the delegation block, defaulting to following the main agent (2.5); and it can carry a session
198
+ mode `roles.<toolName>.background_mode` — configured as `continuable`, the delegation block gets a
199
+ `backgroundMode` row and the child conversation is kept across turns; built-in and custom roles share the
200
+ semantics, with the generator always writing the `backgroundMode` row for custom role blocks (2.6); the main agent's persona
201
+ identity line cannot be renamed (the orchestrator's identity is not a configurable item); `main_agent_display_name`
202
+ (see configuration_en.md section 5) changes only the preset display name and leaves the persona
203
+ identity line untouched.
193
204
 
194
205
  ### Per-role toolFilter.allow detail
195
206
 
196
207
  The allow lists below are transcribed verbatim from `agent.cordis.yml` (at install time the generator
197
- rewrites each list as "config/static intent ∩ runtime-detected host tools", see
208
+ rewrites only the three configurable roles' allow lists — `search_external` / `design` / `implement` —
209
+ against the whitelist "preset's own tool face ∪ runtime detection inventory"; names in neither are dropped
210
+ with a stated reason in the Preview removed list. `search_internal_deep` is a static delegation whose allow
211
+ list is **not** reconciled against the inventory: hand-written names that belong to neither are kept, land
212
+ on disk silently, and fail at runtime with unknown tools at child creation — same caveat as the codegraph
213
+ note for that role below; see
198
214
  [docs/configuration_en.md](configuration_en.md)).
199
215
 
200
216
  **`search_external` (external research, 10 entries)**
@@ -205,21 +221,21 @@ rewrites each list as "config/static intent ∩ runtime-detected host tools", se
205
221
  | toolFilter.allow | `web_search`, `mcp__tavily__tavily_search`, `mcp__tavily__tavily_crawl`, `mcp__tavily__tavily_extract`, `mcp__tavily__tavily_map`, `mcp__tavily__tavily_research`, `glob`, `grep`, `read`, `ask_user_question` |
206
222
  | Load cost | ~3.0k tokens, incurred only when web research actually runs |
207
223
 
208
- **`design` (design, 13 entries)**
224
+ **`design` (design, 12 entries)**
209
225
 
210
226
  | Field | Value |
211
227
  |---|---|
212
228
  | Persona job | Produces UI/UX designs, wireframes and frontend specs; loads design skills (frontend-design, html-ppt) via the skill tool; reads reference material first, then delivers a spec; does not implement final code |
213
- | toolFilter.allow | `read`, `read_image`, `glob`, `grep`, `bash`, `skill`, `write`, `edit`, `ask_user_question`, `todo_write`, `job_output`, `job_list`, `job_kill` |
214
- | Load cost | ~3.2k tokens, incurred only when a design task is delegated |
229
+ | toolFilter.allow | `read`, `read_image`, `glob`, `grep`, `bash`, `skill`, `web_search`, `ask_user_question`, `todo_write`, `job_output`, `job_list`, `job_kill` |
230
+ | Load cost | ~3.3k tokens, incurred only when a design task is delegated |
215
231
 
216
- **`implement` (implementation, 16 entries)**
232
+ **`implement` (implementation, 17 entries)**
217
233
 
218
234
  | Field | Value |
219
235
  |---|---|
220
236
  | Persona job | Writes and edits code: read surrounding context first → surgical changes → verify (build/test/grep), reporting what changed and how it was verified; does not redesign architecture |
221
- | toolFilter.allow | `read`, `write`, `edit`, `glob`, `grep`, `bash`, `skill`, `web_search`, `ask_user_question`, `todo_write`, `job_output`, `job_list`, `job_kill`, `get_goal`, `create_goal`, `update_goal` |
222
- | Load cost | ~3.7k tokens, incurred only when an implementation task is delegated |
237
+ | toolFilter.allow | `read`, `read_image`, `write`, `edit`, `glob`, `grep`, `bash`, `skill`, `web_search`, `ask_user_question`, `todo_write`, `job_output`, `job_list`, `job_kill`, `get_goal`, `create_goal`, `update_goal` |
238
+ | Load cost | ~3.8k tokens, incurred only when an implementation task is delegated |
223
239
 
224
240
  **`search_internal_deep` (whole-repo deep search, 10 entries)**
225
241
 
@@ -298,11 +314,17 @@ stop reason: `error` → re-delegate once; `max-tokens` → split the task; `ref
298
314
  failures of the same task, stop and report to the user; every re-delegation must carry the previous
299
315
  integration summary) — see [docs/orchestration_en.md](orchestration_en.md).
300
316
 
301
- **⑦ Hot-swap means presets are static directories.** Install, uninstall and modification are plain file
302
- operations: the generator copies/rewrites the static sources into `$DSH_HOME/.agent-presets/orchestrator`;
303
- editing the YAML / mjs, re-running the generator, and restarting the host or opening a new session takes
304
- effect. Uninstalling means deleting the directory. No DSH source changes; the preset leaves nothing behind
305
- when removed.
317
+ **⑦ Hot-swap means a static preset directory plus plugin-channel mounting.** The plugin itself is installed
318
+ into a profile via `dsh plugin add` (pnpm plus the in-package bundle patch), so the sidebar panel mounts and
319
+ unmounts with it; the orchestrator preset is a static directory — the generator copies/rewrites the static
320
+ sources into `$DSH_HOME/.agent-presets/orchestrator`; editing the YAML / mjs, hitting Save & Apply in the
321
+ panel to regenerate, and restarting the host or opening a new session takes effect. Uninstall = `dsh plugin
322
+ remove` plus deleting the directory (see [Installation](installation_en.md)). No DSH source changes; the
323
+ preset leaves nothing behind when removed.
324
+
325
+ ## Web config panel client bundle: multi-file sources, single-file artifact
326
+
327
+ The panel's front-end code lives in `plugins/paoding-config-ui/src/client/` as a dozen-odd fragment files whose two-digit filename prefixes fix the concatenation order; `scripts/build-client.mjs` concatenates them verbatim into `plugins/paoding-config-ui/lib/client.js` — no transpiling, no minifying, no inserted separators, so the artifact matches the fragments byte for byte. The DSH platform serves exactly one entry per package (`exports["./client"]`), which is why the published artifact stays that single file. Edit the fragments, then rerun the build script to regenerate the artifact; hand-editing `lib/client.js` is caught by the `--check` mode wired into the `prepublishOnly` hook.
306
328
 
307
329
  ## Performance: token governance
308
330
 
@@ -334,7 +356,7 @@ summarizing too frequently.
334
356
  | 0.45 (landed in this preset) | 117,965 tokens | ~80K | ~16% tail ≈42K + summary checkpoint |
335
357
  | 0.35 (optional, more aggressive) | ~92K tokens | ~67K | Saves more tokens, summarizes more often |
336
358
 
337
- After changing the threshold, re-run `./install.sh --auto` to apply. Companion components in the same
359
+ After changing the threshold, hit Save & Apply in 庖丁配置 to regenerate. Companion components in the same
338
360
  composition:
339
361
 
340
362
  - `tool-result-pruner`: oversized tool results are trimmed with `thresholdChars: 8192 / headChars: 4096 /
@@ -356,8 +378,9 @@ composition:
356
378
  listed in full (`mcp__tavily__tavily_search/crawl/extract/map/research`).
357
379
  - **Tools absent from the main-agent whitelist raise no error**: the waterfall filter only matches by name
358
380
  against the resolved `assembly.tools`, so a tool that is not mounted (e.g. a commented-out MCP) simply
359
- never appears — install and runtime both pass silently. Config intent and actual mounts are reconciled by
360
- install-time detection (`install.sh --auto` / `--dry-run`); re-run it after changing host patches.
381
+ never appears — generation and runtime both pass silently. Config intent and actual mounts are reconciled
382
+ by generation-time detection; after changing host patches, hit Save & Apply in 庖丁配置 to sync (Preview
383
+ shows the list first).
361
384
  - **Whole-repo exploration tasks should be delegated to `search_internal_deep` rather than done by the
362
385
  main agent**: whole-repo grep dumps and full-file reads that repeatedly flood the main context are
363
386
  exactly what that role isolates (read-only, no network, condensed summaries only).