@darkbear9494/dsh-model-manager 0.1.0 → 0.4.0
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 +314 -80
- package/client.js +277 -23
- package/cordis.patch.yml +15 -0
- package/lib/index.js +759 -37
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
A host-half plugin for DeepSeek Harness that assigns models to four roles — `main`,
|
|
4
4
|
`planning`, `execution`, `vision` — applies them on the `agent/request` waterfall, and
|
|
5
5
|
reports which model every subagent actually used, with its role, the reason, and its live
|
|
6
|
-
status.
|
|
6
|
+
status. Since 0.3.0 it also **prompts the top-level agent to delegate** (`strategy.autoDelegate`)
|
|
7
|
+
and **checks npm for a newer release of itself** (`update`), surfacing an upgrade notice in the
|
|
8
|
+
log, through the `model_manager` tool, on the settings card, and as a chip in the session header.
|
|
9
|
+
Since 0.4.0 the delegation label is a contract, not a hint: a leading `plan:`/`vision:` prefix
|
|
10
|
+
decides the tier outright, and each role's failover chain wears down on its own.
|
|
7
11
|
|
|
8
12
|
## What it is
|
|
9
13
|
|
|
@@ -16,24 +20,34 @@ nothing tells you afterwards which model a given subagent ended up on.
|
|
|
16
20
|
This plugin is that layer. It keeps one ordered route list per role, classifies each
|
|
17
21
|
delegated child from the label the delegating agent gives it, rewrites the child's resolved
|
|
18
22
|
route to the role's route when inheritance is provable, and exposes a read-only
|
|
19
|
-
`model_manager` tool that reports what happened.
|
|
23
|
+
`model_manager` tool that reports what happened. 0.3.0 adds two layers on top of routing
|
|
24
|
+
proper: an **auto-delegation policy** — a system-prompt section that teaches the top-level
|
|
25
|
+
agent to plan and dispatch subagents instead of doing everything itself, which is the
|
|
26
|
+
behaviour the harness's own instructions only nudge at — and an **update check** that
|
|
27
|
+
compares the installed version with the registry's `dist-tags.latest` and tells you how to
|
|
28
|
+
upgrade. 0.4.0 makes the label a contract instead of a hint: a leading `plan:`/`vision:`
|
|
29
|
+
prefix decides the tier before any keyword is consulted, the policy never advertises a tier
|
|
30
|
+
with no models behind it, it teaches the delegating agent to leave `provider`/`model` unset
|
|
31
|
+
on tiered units (an explicitly named route overrides the tier under `hybrid`), and the
|
|
32
|
+
failover cursor is tracked per (session, role) so one tier's wear never pushes another tier
|
|
33
|
+
off its first model. It is still deliberately small: one ESM host
|
|
20
34
|
file, one config schema, and one hand-written client file that contributes a
|
|
21
35
|
configuration card to the Plugins page. There is no build step for either half.
|
|
22
36
|
|
|
23
37
|
## Install
|
|
24
38
|
|
|
25
|
-
One command — straight from GitHub, or from a working copy:
|
|
39
|
+
One command — from the registry, straight from GitHub, or from a working copy:
|
|
26
40
|
|
|
27
41
|
```bash
|
|
28
|
-
# from
|
|
42
|
+
# from npm
|
|
43
|
+
dsh plugin --profile desktop add @darkbear9494/dsh-model-manager@latest
|
|
44
|
+
|
|
45
|
+
# from GitHub, no registry involved; needs git access to the repo
|
|
29
46
|
dsh plugin --profile desktop add github:jyshangguan/dsh-model-manager
|
|
30
47
|
|
|
31
48
|
# from a working copy (path must be absolute)
|
|
32
49
|
git clone https://github.com/jyshangguan/dsh-model-manager.git
|
|
33
50
|
dsh plugin --profile desktop add /absolute/path/to/dsh-model-manager
|
|
34
|
-
|
|
35
|
-
# from npm — only after `npm publish`; see "Not on npm yet" below
|
|
36
|
-
dsh plugin --profile desktop add @darkbear9494/dsh-model-manager@latest
|
|
37
51
|
```
|
|
38
52
|
|
|
39
53
|
Use the profile your app actually boots. `dsh web` and the Web GUI run the `web` profile; the
|
|
@@ -61,29 +75,40 @@ should show row id `model-manager`, `enabled: true`, `fiberPhase: active`.
|
|
|
61
75
|
The Plugins page's **Add plugin** field reads *"Enter the plugin's package name, GitHub repository
|
|
62
76
|
address, or local directory path."* It is the GUI's `install_bundle`, and it parses the string
|
|
63
77
|
through the same `parseInstallSpec` (`@deepseek-ai/dsh-plugin-manager/lib/types/install-spec.js`)
|
|
64
|
-
before handing it to pnpm.
|
|
78
|
+
before handing it to pnpm. All four forms work:
|
|
65
79
|
|
|
66
80
|
| Field input | Spec kind |
|
|
67
81
|
| --- | --- |
|
|
82
|
+
| `@darkbear9494/dsh-model-manager` | registry — the shortest one to type |
|
|
68
83
|
| `github:jyshangguan/dsh-model-manager` | git — the `https://github.com/…` URL works too |
|
|
69
84
|
| `/Users/you/src/dsh-model-manager` | absolute local directory (relative paths are refused) |
|
|
70
|
-
| `/Users/you/dsh-model-manager-0.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
is
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
| `/Users/you/darkbear9494-dsh-model-manager-0.2.0.tgz` | local tarball — `npm pack` makes one (0.3.0's would be named the same way) |
|
|
86
|
+
|
|
87
|
+
Registering the plugin by name was verified end-to-end on this runtime: `dsh plugin --profile
|
|
88
|
+
<name> add @darkbear9494/dsh-model-manager` resolves the current release (`^0.1.0` at first
|
|
89
|
+
publish, `^0.2.0` since) from the registry, `reconcile()`
|
|
90
|
+
appends the bundle, the composed tree mounts row `model-manager`, and a boot reaches the LLM stage
|
|
91
|
+
with no peer refusal and no loader error. The git and local-path forms were checked the same way.
|
|
92
|
+
The same add command is the **upgrade** path: re-running it with `@latest` resolves the newer
|
|
93
|
+
version and updates the dependency in place.
|
|
94
|
+
|
|
95
|
+
### The registry copy
|
|
96
|
+
|
|
97
|
+
`@darkbear9494/dsh-model-manager@0.4.0` is the current release, public access, the same 8
|
|
98
|
+
files as 0.2.0 (the tarball grew, not the file list: the host half, the client half and this
|
|
99
|
+
README carry the new sections). 0.2.0 packed 63.1 kB with the same 8 files, and 0.1.0, the
|
|
100
|
+
first publish, 62.3 kB. The declared gate is `>=0.1.7-rc.2 <0.3.0`, so every release on the
|
|
101
|
+
0.1.7–0.2.x runtime lines installs without an exemption.
|
|
102
|
+
|
|
103
|
+
Two things learned while publishing it, in case a future version has to be released:
|
|
104
|
+
|
|
105
|
+
- The scope has to equal the npm account, or name an organization the account belongs to. See
|
|
106
|
+
[Why the package is scoped](#why-the-package-is-scoped-and-why-the-scope-is-darkbear9494).
|
|
107
|
+
- The registry's read path lags the write. Immediately after a successful `npm publish`
|
|
108
|
+
(`PUT 200`, `exit 0`) the packument can still answer `404 Not found` — and so can `npm view`,
|
|
109
|
+
`npm install` and a GUI install — while the tarball URL already returns `200`. It cleared on its
|
|
110
|
+
own in about five minutes here. Wait it out rather than republishing; the second `npm publish`
|
|
111
|
+
would fail on the version already existing.
|
|
87
112
|
|
|
88
113
|
### Why the package is scoped, and why the scope is `@darkbear9494`
|
|
89
114
|
|
|
@@ -111,7 +136,7 @@ peer — only names equal to `@deepseek-ai/dsh` or beginning `@deepseek-ai/dsh-`
|
|
|
111
136
|
command:
|
|
112
137
|
|
|
113
138
|
```bash
|
|
114
|
-
dsh plugin --profile desktop allow-version @darkbear9494/dsh-model-manager@0.
|
|
139
|
+
dsh plugin --profile desktop allow-version @darkbear9494/dsh-model-manager@0.2.0 \
|
|
115
140
|
--dsh-version <exact runtime version> --accept-risk
|
|
116
141
|
```
|
|
117
142
|
|
|
@@ -270,7 +295,9 @@ dsh --profile web --patch ./smoke.patch.yml headless "say ok"
|
|
|
270
295
|
|
|
271
296
|
## The four roles
|
|
272
297
|
|
|
273
|
-
Each role holds an ordered list of routes
|
|
298
|
+
Each role holds an ordered list of routes. Since 0.2.0 the **selection strategy is one
|
|
299
|
+
top-level `pick` for every role** — the per-role `pick` field of 0.1.x is gone, and a config
|
|
300
|
+
that still carries it gets a warning naming the move. A role with no models
|
|
274
301
|
resolves to no route, and requests classified into it pass through unchanged — except
|
|
275
302
|
`vision`, which falls back to `execution`. A subagent never uses `main`.
|
|
276
303
|
|
|
@@ -281,34 +308,41 @@ resolves to no route, and requests classified into it pass through unchanged —
|
|
|
281
308
|
| `execution` | Default tier for delegated implementation. | Every subagent that matches neither keyword list, including a child with an empty label; also the fallback for vision when `vision` has no models. | `pku-corpus/qwen3.8-flash` |
|
|
282
309
|
| `vision` | Image, screenshot, chart and OCR work. | Subagents whose label matches a vision keyword. | `models: []` (falls back to `execution`) |
|
|
283
310
|
|
|
284
|
-
A route is `{ provider, model, reasoningEffort? }
|
|
285
|
-
`round-robin
|
|
311
|
+
A route is `{ provider, model, reasoningEffort? }`. The top-level `pick` is `first`
|
|
312
|
+
(default) or `round-robin` and applies to every role alike; with one model in a role's list
|
|
313
|
+
it has no effect for that role. Under `first` the list is a failover chain, and since 0.4.0
|
|
314
|
+
the wear position is tracked per **(session, role)**, not per session: a session that failed
|
|
315
|
+
over while it was serving `planning` (plan mode moves one session between `main` and
|
|
316
|
+
`planning` on every request) comes back to `main` still on `main`'s first model. A role may
|
|
317
|
+
also carry a
|
|
286
318
|
`note` — free text for humans, printed under the role in the `routes` table and never
|
|
287
319
|
used for routing.
|
|
288
320
|
|
|
289
321
|
## Configure in the UI
|
|
290
322
|
|
|
291
323
|
The client half contributes a configuration card to the Plugins page. It writes exactly the
|
|
292
|
-
values documented under [Configuration](#configuration) — `roles.<role>.models
|
|
293
|
-
`strategy.mode` — so the two paths are
|
|
324
|
+
values documented under [Configuration](#configuration) — `roles.<role>.models`, the
|
|
325
|
+
top-level `pick`, `strategy.mode` and `strategy.autoDelegate` — so the two paths are
|
|
326
|
+
interchangeable: use the card to try a routing
|
|
294
327
|
choice, the YAML to pin it. This package's own `cordis.patch.yml` is the declarative source
|
|
295
328
|
that ships with the bundle and is re-read on every boot, and a profile patch overrides it by
|
|
296
329
|
row id; the card never edits patch files, so if a patch layer pins a value, edit the patch.
|
|
297
330
|
|
|
298
331
|
### Where the card appears
|
|
299
332
|
|
|
300
|
-
`client.js` registers **
|
|
333
|
+
`client.js` registers **three** surfaces and deliberately nothing on the Plugins page:
|
|
301
334
|
|
|
302
335
|
| Slot | Registration id | What it renders |
|
|
303
336
|
| --- | --- | --- |
|
|
304
|
-
| `settings.section` | `model-manager` | The configuration card: the four roles and their model lists, the
|
|
337
|
+
| `settings.section` | `model-manager` | The configuration card: the four roles and their model lists, the shared selection strategy, the auto-delegation level, the distribution mode, and the update banner. |
|
|
305
338
|
| `conversation.session.header.utilities` | `model-manager-usage` | The per-session model-usage summary the host half folds from the durable log. |
|
|
339
|
+
| `conversation.session.header.utilities` | `model-manager-update` | The update-available chip (0.3.0): renders nothing unless a newer release was found, then shows `更新:<latest>` and discloses the upgrade command on click. |
|
|
306
340
|
|
|
307
341
|
So the path is **设置 → 模型管理器** — not Plugins → the row → configure. `plugins.item` and
|
|
308
342
|
`plugins.row.config` are *not* registered: one card in one place was the requirement, and a
|
|
309
343
|
second copy on the Plugins page would only be a second place for the same values to disagree.
|
|
310
344
|
|
|
311
|
-
|
|
345
|
+
All entries are registered **unconditionally** rather than behind the shipped
|
|
312
346
|
`configForms.whileServed([ns], …)` gate. The Host serves a settings namespace only for a row
|
|
313
347
|
whose Config schema has volatile fields, so that gate would hide the card entirely whenever the
|
|
314
348
|
optional schemastery dependency failed to resolve — making a packaging problem look exactly like
|
|
@@ -326,12 +360,13 @@ polling on the client, and the numbers survive a restart.
|
|
|
326
360
|
| Model rows, one per role (`Main model`, `Planning and reasoning`, `Execution`, `Image recognition`) | `set roles.<role>.models` | Each configured route is its own row with a `<select>` grouped by provider in `<optgroup>`s, fed by `ctx.remote.session.modelCatalog()` and labelled `name — id`. A route the catalog stopped advertising stays selectable and is marked `(not in catalog)` rather than being silently swapped. An empty list is the YAML default: no route for that role, and `vision` falls back to `execution`. |
|
|
327
361
|
| Add a model | `set roles.<role>.models` | One dashed control under the rows, listing every catalog model the role has not already used, so a model cannot be added twice. |
|
|
328
362
|
| `up` / `remove` | `set roles.<role>.models` | Reorder and delete. The whole list is rewritten in one atomic operation, so a reorder cannot interleave into a partial state. The up control is **disabled on the first row** rather than absent, so the column never changes width. |
|
|
329
|
-
`reasoning.efforts`** in the catalog. `(model default)` writes a route with no `reasoningEffort`, letting the adapter choose; naming a tier explicitly is how you satisfy a model that rejects a request without one. |
|
|
330
363
|
| Reasoning-effort picker | `set roles.<role>.models` (single route with `reasoningEffort`) | Appears **only when the selected model advertises `reasoning.efforts`** in the catalog. `(model default)` writes a route with no `reasoningEffort`, letting the adapter choose; naming a tier explicitly is how you satisfy a model that rejects a request without one. |
|
|
331
|
-
| `Pick` (`first` / `round-robin`) | `set
|
|
364
|
+
| `Pick` (`first` / `round-robin`) | `set pick` | **One control for every role** (since 0.2.0), rendered next to the distribution mode with a hint line. `first` always uses index 0 of each role's list and only advances when a route fails; `round-robin` spreads consecutive requests across each role's list. |
|
|
365
|
+
| `Auto delegation` (`off` / `balanced` / `eager`) | `set strategy.autoDelegate` | New in 0.3.0. The [delegation policy](#auto-delegation-policy-strategyautodelegate) level, labelled with one-line explanations. A stored level the card does not know displays as `balanced`, mirroring the host half's fallback. |
|
|
332
366
|
| Distribution mode | `set strategy.mode` | `hybrid` / `managed` / `advisory`, labelled with the same one-line explanations this README uses. A stored mode the card does not know displays as `hybrid`, mirroring the host half's fallback. |
|
|
367
|
+
| Update banner (read-only) | — | New in 0.3.0. When the client-side update store says a newer release exists, a warn-toned banner opens the card: versions, the upgrade command, and a **Re-check** button. See [Automatic update checks](#automatic-update-checks). |
|
|
333
368
|
|
|
334
|
-
**Layout.** One CSS grid per role, with fixed column tracks `auto minmax(0, 1fr) auto auto` — index, model, effort, actions. That choice is the whole reason the rows line up: in a flex row a control with `flex: 1 1 16rem` takes width from its siblings, so any row that omits one control (a model with no reasoning tiers, a first row with no reorder button) pulls every other row's right edge out of alignment. Under the grid a row with no effort control still emits an empty cell, so the action column sits at the same x everywhere. The two actions are glyphs rather than words, so the column is also the same width in either locale; each keeps an `aria-label` and a native `title`. The add affordance is deliberately unlike a model row — dashed border, no fill, muted text, spanning the value columns
|
|
369
|
+
**Layout.** One CSS grid per role, with fixed column tracks `auto minmax(0, 1fr) auto auto` — index, model, effort, actions. That choice is the whole reason the rows line up: in a flex row a control with `flex: 1 1 16rem` takes width from its siblings, so any row that omits one control (a model with no reasoning tiers, a first row with no reorder button) pulls every other row's right edge out of alignment. Under the grid a row with no effort control still emits an empty cell, so the action column sits at the same x everywhere. The two actions are glyphs rather than words, so the column is also the same width in either locale; each keeps an `aria-label` and a native `title`. The add affordance is deliberately unlike a model row — dashed border, no fill, muted text, spanning the value columns.
|
|
335
370
|
|
|
336
371
|
Each role also carries a hint line (`Top-level agent outside plan mode. Leave unset to keep
|
|
337
372
|
following the composer selection.`, `Used for image, screenshot and OCR work. Pick a model
|
|
@@ -413,9 +448,11 @@ the patch layer.
|
|
|
413
448
|
**Verification status, stated honestly:** the client half was verified by JavaScript syntax,
|
|
414
449
|
manifest validation, a structural load of the `window.__ModuleLoader__.load` factory — which
|
|
415
450
|
confirms that only `react` is required, that `apply` registers the `dsh-model-manager` locale
|
|
416
|
-
namespace with the same
|
|
417
|
-
not just their counts), that exactly
|
|
418
|
-
`model-manager` and `conversation.session.header.utilities` under
|
|
451
|
+
namespace with the same 61 keys in English and Chinese (the test compares the sorted key *sets*,
|
|
452
|
+
not just their counts), that exactly three registrations land across the two surfaces —
|
|
453
|
+
`settings.section` under `model-manager` and `conversation.session.header.utilities` under
|
|
454
|
+
`model-manager-usage` (the per-session usage) plus `model-manager-update` (the update chip,
|
|
455
|
+
which renders `null` while the update store is idle) — and
|
|
419
456
|
that `apply` still returns normally when every injected collaborator throws. It was also checked
|
|
420
457
|
against the live slot contract in `@deepseek-ai/dsh-client-ui-settings`. **Visual verification of
|
|
421
458
|
the rendered card is not available in this environment:** the harness's own verification guidance
|
|
@@ -500,15 +537,20 @@ unresolved-lineage route all leave the rotation where it was.
|
|
|
500
537
|
|
|
501
538
|
Only a session whose `session.header.origin` is `'subagent'` is classified by label. The
|
|
502
539
|
label is the `description` the delegating agent passed to the `subagent` tool, which the
|
|
503
|
-
harness stores as the child's label. Matching is case-insensitive
|
|
504
|
-
|
|
540
|
+
harness stores as the child's label. Matching is case-insensitive, anchored at a leading
|
|
541
|
+
word boundary, and prefix-first, in this order:
|
|
505
542
|
|
|
506
543
|
1. Empty label → `execution`.
|
|
507
|
-
2.
|
|
508
|
-
|
|
509
|
-
|
|
544
|
+
2. A label starting with `plan:` (case-insensitive, leading whitespace ignored) →
|
|
545
|
+
`planning`.
|
|
546
|
+
3. A label starting with `vision:` → `vision`.
|
|
547
|
+
4. Else any `visionKeywords` match → `vision`.
|
|
548
|
+
5. Else any `planningKeywords` match → `planning`.
|
|
549
|
+
6. Else `execution`.
|
|
510
550
|
|
|
511
|
-
|
|
551
|
+
The leading prefix is authoritative — it is the one part of the label the delegating model
|
|
552
|
+
writes *on purpose*, so `"plan: analyse the screenshots"` is planning work. Among keyword
|
|
553
|
+
matches, vision is tested before planning, so a label matching both lands on `vision`.
|
|
512
554
|
|
|
513
555
|
| Delegation `description` | Matched by | Role | Applied route (bundled defaults) |
|
|
514
556
|
| --- | --- | --- | --- |
|
|
@@ -525,8 +567,8 @@ is active and `main` otherwise.
|
|
|
525
567
|
|
|
526
568
|
If `vision.models` is empty when a vision request is routed, the plugin serves it from the
|
|
527
569
|
execution role's models instead. The role recorded for that request is still `vision`;
|
|
528
|
-
the model is the execution role's, and
|
|
529
|
-
counter are the ones used. The `routes` table marks such a role `(via execution)`. If
|
|
570
|
+
the model is the execution role's, and the shared `pick` strategy with the execution
|
|
571
|
+
role's `round-robin` counter are the ones used. The `routes` table marks such a role `(via execution)`. If
|
|
530
572
|
`execution` is empty as well, there is no route and the request passes through. This is
|
|
531
573
|
why the bundled default (`vision: []`) is safe: vision work is served by the execution
|
|
532
574
|
tier until you configure a dedicated vision model.
|
|
@@ -590,6 +632,128 @@ warn [model-manager] vision role route(s) declare no image input and image work
|
|
|
590
632
|
undeclared modalities may well accept images, and an unresolvable route is already reported
|
|
591
633
|
by the allow-list audit.
|
|
592
634
|
|
|
635
|
+
## Auto-delegation policy (`strategy.autoDelegate`)
|
|
636
|
+
|
|
637
|
+
**The problem it solves.** The harness gives the top-level agent a `subagent` tool and a
|
|
638
|
+
one-line nudge ("Start independent delegations together in one message"), but nothing tells
|
|
639
|
+
it *when* to delegate. In practice the model does the work itself and only reaches for a
|
|
640
|
+
delegation when it cannot proceed — image reading being the canonical case. This plugin is
|
|
641
|
+
already in the business of routing delegations by role; 0.3.0 makes it also *ask* for them.
|
|
642
|
+
|
|
643
|
+
`strategy.autoDelegate` controls a second system-prompt section, `model-manager:delegation`
|
|
644
|
+
(order 550 — next to the harness's own `PLAN_POLICY`/`TEAM_POLICY` rows, not next to the
|
|
645
|
+
routing cheat sheet, because this is a behavioural policy rather than a routing fact):
|
|
646
|
+
|
|
647
|
+
| Level | Rendered for | What it tells the top-level agent |
|
|
648
|
+
| --- | --- | --- |
|
|
649
|
+
| `off` | nobody | Nothing — no section text at all. |
|
|
650
|
+
| `balanced` (default) | the orchestrating top-level agent | Default to solving substantive work through subagents: delegate the decomposition itself as a `plan:` unit, dispatch the units it returned together in one message, keep coordination / trivial edits / user-facing decisions / final synthesis for yourself, verify what comes back. |
|
|
651
|
+
| `eager` | the orchestrating top-level agent | You are the orchestrator: nearly all substantive work — research, analysis, implementation, review, verification — belongs in delegations, the decomposition itself going out as a `plan:` unit first; do work yourself only when no delegation can carry it. |
|
|
652
|
+
|
|
653
|
+
Both levels end with the same labelling block, so the policy and the role tiers are used
|
|
654
|
+
together — which is the point of having both in one plugin. The block labels each delegation
|
|
655
|
+
by the *kind of work it carries* (`plan:` = must be thought through, `vision:` = reads images,
|
|
656
|
+
plain = mechanical execution), states that a leading prefix decides the tier with keyword
|
|
657
|
+
matching as the fallback, and — under any mode that actually routes — tells the agent to
|
|
658
|
+
**omit `provider` and `model` on `plan:`/`vision:` units**, because a route named explicitly
|
|
659
|
+
on the delegation overrides the tier. That last line is the one that makes the label matter
|
|
660
|
+
under `hybrid`, where a respected explicit choice is exactly what defeats role routing.
|
|
661
|
+
|
|
662
|
+
**Rendering is per assembly, and deliberately narrow.** The section's text function receives
|
|
663
|
+
the assembly context (`{ agent, scope }`, the same object `dsh-agent`'s
|
|
664
|
+
`assembleContextFor` builds) and returns `''` — no policy at all — unless every gate passes:
|
|
665
|
+
|
|
666
|
+
- the manager is enabled and the level is not `off`;
|
|
667
|
+
- the assembly is **not** a delegated child: `session.header.origin === 'subagent'` or
|
|
668
|
+
`header.delegationDepth > 0` both disqualify. Children already carry the harness's fixed
|
|
669
|
+
`subagent:delegation` runtime context, and encouraging a child to re-delegate would push
|
|
670
|
+
every unit one depth level down for no benefit;
|
|
671
|
+
- the assembly's scope **actually exposes a delegation tool**, checked with
|
|
672
|
+
`tools.get('subagent', scope)` / `tools.get('subagent_fork', scope)` — the same probe
|
|
673
|
+
`dsh-tool-subagent`'s own prompt section uses. An agent whose composition restricted the
|
|
674
|
+
delegation tools never sees a policy naming a tool it cannot call, and a harness that
|
|
675
|
+
renames the tool loses the policy rather than rendering a broken instruction.
|
|
676
|
+
|
|
677
|
+
Beyond the gates, the labelling block adapts to what is actually behind it: a tier with no
|
|
678
|
+
configured models is never advertised (no `plan:` line when the planning role is empty — and
|
|
679
|
+
the balanced "plan first" bullet loses its label too), and under `advisory`, where nothing is
|
|
680
|
+
routed at all, the omit-`provider`/`model` line is dropped because it would warn about
|
|
681
|
+
nothing.
|
|
682
|
+
|
|
683
|
+
Only the tools that resolve are named: with both present the policy mentions `subagent` and
|
|
684
|
+
the `subagent_fork` preference for work that needs this conversation's context; with only
|
|
685
|
+
`subagent` the fork line is dropped. `model_manager(action: "routes")` reports the level
|
|
686
|
+
(`Auto-delegation: balanced — …`), and the settings card offers the three-way select, so
|
|
687
|
+
switching levels needs no restart — the section reads the live config, so a saved edit
|
|
688
|
+
applies to the next request.
|
|
689
|
+
|
|
690
|
+
## Automatic update checks
|
|
691
|
+
|
|
692
|
+
The host half checks whether a newer `@darkbear9494/dsh-model-manager` is published, and
|
|
693
|
+
tells you — passively in the log, on demand through the tool, and persistently in the Web UI.
|
|
694
|
+
|
|
695
|
+
**How it works.** The plugin reads its own version from its `package.json` (so a git
|
|
696
|
+
checkout, an npm install and a tarball install all report what actually shipped), fetches
|
|
697
|
+
the abbreviated packument `<registry>/@darkbear9494%2fdsh-model-manager` with
|
|
698
|
+
`Accept: application/vnd.npm.install-v1+json`, reads `dist-tags.latest`, and compares the
|
|
699
|
+
two with a semver comparator that handles prereleases (`0.3.1-rc.1 < 0.3.1`, numeric
|
|
700
|
+
prerelease identifiers compare numerically). The first check runs ~10 s after boot — never
|
|
701
|
+
on the boot path — and then once per `intervalHours`; every failure path (no network,
|
|
702
|
+
CORS, a malformed packument) lands in a logged diagnostic and a `CHECK FAILED` verdict,
|
|
703
|
+
never a throw, and never touches routing.
|
|
704
|
+
|
|
705
|
+
**Where a newer release is surfaced:**
|
|
706
|
+
|
|
707
|
+
| Surface | What you see |
|
|
708
|
+
| --- | --- |
|
|
709
|
+
| Host log | `warn [model-manager] update available: @darkbear9494/dsh-model-manager 0.2.0 -> 0.3.0 (checked https://registry.npmjs.org). Run the model_manager tool with action "update" for the upgrade command, then restart.` |
|
|
710
|
+
| `model_manager` action `update` | The full report below — including the paste-ready upgrade command with the live profile name. |
|
|
711
|
+
| `report` / `routes` | One status line each (`Update check: 0.3.0 AVAILABLE (installed 0.2.0, …)`); `routes` always carries the line, `report` only when an update exists. |
|
|
712
|
+
| Settings card | A warn-toned banner at the top of the card with the versions, the upgrade command, and a **Re-check** button. |
|
|
713
|
+
| Session header | A small `更新:0.3.0` chip next to the usage button; clicking it discloses the upgrade command. It disappears when the store says up to date. |
|
|
714
|
+
|
|
715
|
+
Asking for the check directly:
|
|
716
|
+
|
|
717
|
+
```text
|
|
718
|
+
model_manager(action: "update")
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
```text
|
|
722
|
+
Model manager update check
|
|
723
|
+
|
|
724
|
+
installed : 0.2.0
|
|
725
|
+
latest : 0.3.0
|
|
726
|
+
registry : https://registry.npmjs.org
|
|
727
|
+
checked : 2026-10-07T03:12:44.612Z
|
|
728
|
+
verdict : UPDATE AVAILABLE (0.2.0 -> 0.3.0)
|
|
729
|
+
|
|
730
|
+
To upgrade, run in a terminal:
|
|
731
|
+
|
|
732
|
+
dsh plugin --profile desktop add @darkbear9494/dsh-model-manager@latest
|
|
733
|
+
|
|
734
|
+
then restart the harness so the new version mounts. The Plugins page can reinstall
|
|
735
|
+
the same package instead; both paths run the same installer. Tell the user this
|
|
736
|
+
upgrade is available and what command to run.
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
The `<profile>` in the command is read from the host's working directory
|
|
740
|
+
(`$DSH_HOME/profiles/<name>`); when the layout does not match, the command prints
|
|
741
|
+
`<profile>` as a placeholder. Upgrading is re-running the add command — the installer
|
|
742
|
+
(`dsh plugin add` / the GUI's `install_bundle`) resolves the new version, updates the
|
|
743
|
+
dependency and keeps the bundle registration; restart the harness afterwards so the new
|
|
744
|
+
host half mounts.
|
|
745
|
+
|
|
746
|
+
**The browser half runs the same comparison itself.** The Web client cannot read the host's
|
|
747
|
+
in-memory state, so `client.js` pins the version it shipped with (a packaging test pins
|
|
748
|
+
that constant equal to `package.json`) and fetches the same packument once per page load —
|
|
749
|
+
plus on every `settings/document-updated` (the registry URL is row config, so a change
|
|
750
|
+
re-checks) and on the banner's Re-check button. That is why the chip and banner can appear
|
|
751
|
+
the moment the GUI opens. An offline or registry-blocked deployment simply sees no banner;
|
|
752
|
+
the host log and the tool action still report the update. This also means the browser makes
|
|
753
|
+
one cross-origin `fetch` to the configured registry — `registry.npmjs.org` (and npmmirror)
|
|
754
|
+
answer it with `Access-Control-Allow-Origin: *`; a registry that does not is silently
|
|
755
|
+
unusable for the client half and only the host surfaces remain.
|
|
756
|
+
|
|
593
757
|
## Configuration
|
|
594
758
|
|
|
595
759
|
Config is the `config` of the row id `model-manager`. This bundle ships a layer that
|
|
@@ -606,7 +770,7 @@ re-reads the config itself — including rebuilding the keyword matchers. A keyw
|
|
|
606
770
|
change saved on the Settings page — or from the [card on the Plugins
|
|
607
771
|
page](#configure-in-the-ui), which writes the same volatile namespace — takes effect on the
|
|
608
772
|
next request, with no restart. The
|
|
609
|
-
event logs `settings reloaded — mode …` on success; a value that cannot be re-read logs
|
|
773
|
+
event logs `settings reloaded — mode …, pick …` on success; a value that cannot be re-read logs
|
|
610
774
|
`could not reload settings; routing keeps the previous config: …` and the previously
|
|
611
775
|
active config stays in force.
|
|
612
776
|
|
|
@@ -615,31 +779,44 @@ Complete key set, with the schema defaults shown in comments:
|
|
|
615
779
|
```yaml
|
|
616
780
|
- id: model-manager
|
|
617
781
|
config:
|
|
782
|
+
pick: first # default: first; "first" | "round-robin" — ONE strategy for every role
|
|
618
783
|
roles:
|
|
619
784
|
main:
|
|
620
785
|
models: [] # default: [] — empty means "leave the composer/model selection alone"
|
|
621
|
-
pick: first # default: first; "first" | "round-robin"
|
|
622
786
|
note: '' # default: none — optional free text, printed by `routes` under the role
|
|
623
787
|
planning:
|
|
624
788
|
models: [] # schema default: [] (this package's own layer sets pku-corpus/qwen3.8-max-0902)
|
|
625
|
-
pick: first
|
|
626
789
|
execution:
|
|
627
790
|
models: [] # schema default: [] (this package's own layer sets pku-corpus/qwen3.8-flash)
|
|
628
|
-
pick: first
|
|
629
791
|
vision:
|
|
630
792
|
models: [] # schema default: [] — empty falls back to the execution role
|
|
631
|
-
pick: first
|
|
632
793
|
strategy:
|
|
633
794
|
mode: hybrid # default: hybrid; "hybrid" | "managed" | "advisory"
|
|
634
795
|
# visionKeywords: omitted = the 20 built-ins; any list you write replaces them
|
|
635
796
|
# planningKeywords: omitted = the 24 built-ins; [] DISABLES that classifier
|
|
636
797
|
historyLimit: 300 # default: 300; any positive value floors to at least 1
|
|
798
|
+
autoDelegate: balanced # default: balanced; "off" | "balanced" | "eager" — the delegation policy
|
|
799
|
+
update: # 0.3.0 — automatic update check
|
|
800
|
+
enabled: true # default: true; only an explicit false stops the checks
|
|
801
|
+
registry: https://registry.npmjs.org # any npm-compatible registry (npmmirror works)
|
|
802
|
+
intervalHours: 24 # default: 24; explicit 0 = check at boot only
|
|
637
803
|
```
|
|
638
804
|
|
|
639
805
|
The two keyword lists are shown commented out because their default is the built-in list
|
|
640
806
|
rather than a literal value: omitting the key keeps the built-ins, while writing any list —
|
|
641
807
|
including `[]` — replaces them, and `[]` switches that classifier off entirely.
|
|
642
808
|
|
|
809
|
+
Behaviours of the `update` block worth knowing:
|
|
810
|
+
|
|
811
|
+
- `registry` must be an `http(s)` origin; anything else (or a non-string) falls back to
|
|
812
|
+
`https://registry.npmjs.org`. Trailing slashes are trimmed.
|
|
813
|
+
- `intervalHours` accepts a fraction (0.5 = 30 min, useful when watching a release land)
|
|
814
|
+
and is floored at one minute so a mis-typed hour cannot hammer a registry. An absent,
|
|
815
|
+
malformed or negative value means the 24 h default; an explicit `0` means "check at boot
|
|
816
|
+
only". `enabled: false` is the actual off switch.
|
|
817
|
+
- A settings save that changes the update block re-arms the schedule **and** runs one
|
|
818
|
+
immediate check, so switching to a mirror registry takes effect without a restart.
|
|
819
|
+
|
|
643
820
|
Each entry of `models` is:
|
|
644
821
|
|
|
645
822
|
| Key | Required | Default | Meaning |
|
|
@@ -691,6 +868,11 @@ The bundled layer this package ships is:
|
|
|
691
868
|
models: []
|
|
692
869
|
strategy:
|
|
693
870
|
mode: hybrid
|
|
871
|
+
autoDelegate: balanced
|
|
872
|
+
update:
|
|
873
|
+
enabled: true
|
|
874
|
+
registry: https://registry.npmjs.org
|
|
875
|
+
intervalHours: 24
|
|
694
876
|
```
|
|
695
877
|
|
|
696
878
|
## Seeing which model each subagent used
|
|
@@ -736,14 +918,15 @@ finished value: no folding in the browser, no polling, no fetch route. That is t
|
|
|
736
918
|
|
|
737
919
|
### The tool
|
|
738
920
|
|
|
739
|
-
The plugin registers one read-only tool, `model_manager`, with
|
|
921
|
+
The plugin registers one read-only tool, `model_manager`, with five actions:
|
|
740
922
|
|
|
741
923
|
| Action | Returns |
|
|
742
924
|
| --- | --- |
|
|
743
|
-
| `report` (default) | A `Top-level agents` table — session id, role, model, reason, live status, and whether the session's model was picked by hand or left at the deployment default — then the per-subagent table: child id, role, model, reason, live status, delegation label, and finally the active mode with subagent-only totals by role/model. |
|
|
744
|
-
| `routes` | Role table (role,
|
|
925
|
+
| `report` (default) | A `Top-level agents` table — session id, role, model, reason, live status, and whether the session's model was picked by hand or left at the deployment default — then the per-subagent table: child id, role, model, reason, live status, delegation label, and finally the active mode with subagent-only totals by role/model. Carries one update-available line when a newer release was found. |
|
|
926
|
+
| `routes` | Role table (role, effective models, role `note`), the shared selection strategy, active mode, the auto-delegation level, the update-check status line, allow-list audit with a YAML snippet for unlisted routes, the vision image-capability check, and the first 8 keywords of each list. |
|
|
745
927
|
| `usage` | Request and subagent counts per role/model across the whole process, including top-level turns. |
|
|
746
928
|
| `client` | Whether the Host composed this package's Web client half into the browser boot graph, the route serving its bundle, and the current graph revision. Use it when the settings card does not appear. |
|
|
929
|
+
| `update` | Forces a fresh [update check](#automatic-update-checks) and returns installed vs latest, the registry, the timestamp, and — when a newer release exists — the paste-ready upgrade command with the live profile name. Use it whenever `report`/`routes` says an update is available, and relay the command to the user. |
|
|
747
930
|
|
|
748
931
|
Both `report` and `usage` read **process-local in-memory state**: they answer for the current
|
|
749
932
|
`dsh` process only, and a restart clears them. A subagent that finished before a restart
|
|
@@ -880,13 +1063,17 @@ model_manager(action: "routes")
|
|
|
880
1063
|
```text
|
|
881
1064
|
Model manager roles
|
|
882
1065
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1066
|
+
Enabled: yes
|
|
1067
|
+
|
|
1068
|
+
Selection: first — every role starts at its top model and fails over down its list (one strategy for all roles)
|
|
1069
|
+
|
|
1070
|
+
Role effective model(s)
|
|
1071
|
+
---------- ------------------------------------------
|
|
1072
|
+
main (unconfigured — passes through)
|
|
1073
|
+
planning pku-corpus/qwen3.8-max-0902
|
|
1074
|
+
note: use for architecture and migration design
|
|
1075
|
+
execution pku-corpus/qwen3.8-flash
|
|
1076
|
+
vision pku-corpus/kimi-k3, pku-corpus/qwen3.8-flash, pku-corpus/mystery, pku-corpus/broken
|
|
890
1077
|
|
|
891
1078
|
Strategy mode: hybrid (apply when the child inherited the parent route)
|
|
892
1079
|
|
|
@@ -919,7 +1106,7 @@ Vision role (image capability):
|
|
|
919
1106
|
|
|
920
1107
|
Delegation labels select the tier. The `description` you pass to a delegation
|
|
921
1108
|
becomes the child label, which the manager matches against (word-anchored):
|
|
922
|
-
vision : vision, visual, image, images, screenshot, screen shot, ocr,
|
|
1109
|
+
vision : vision, visual, image, images, screenshot, screen shot, ocr, diagram, …
|
|
923
1110
|
planning : plan, planning, design, architect, architecture, analyse, analyze, analysis, …
|
|
924
1111
|
else : execution
|
|
925
1112
|
```
|
|
@@ -997,15 +1184,20 @@ policy.
|
|
|
997
1184
|
longer matches `"redesign"`, while `screenshot` still matches `"screenshots"` and the
|
|
998
1185
|
multi-word `ui mock` still matches. It is not a full-word match, so `plan` still matches
|
|
999
1186
|
`"planet"` and `render` still matches `"rendering"`. Prefer distinctive words.
|
|
1000
|
-
-
|
|
1187
|
+
- A leading `plan:` / `vision:` prefix is authoritative: it decides the tier before any
|
|
1188
|
+
keyword is consulted. Among keyword matches, vision is tested before planning, so a
|
|
1189
|
+
label matching both goes to `vision`.
|
|
1190
|
+
- The built-in vision list has no `figure` — "figure out the bug" is ordinary reasoning
|
|
1191
|
+
work, and a genuine figure-reading unit can say `vision: read figure 3`. Re-add it with
|
|
1192
|
+
`strategy.visionKeywords` if your labels read that way.
|
|
1001
1193
|
- Regex metacharacters in a keyword are escaped, so `pkg.io` or `a+b` match literally.
|
|
1002
1194
|
- The matchers are rebuilt on a saved Settings edit, so a keyword change applies live.
|
|
1003
1195
|
|
|
1004
1196
|
The built-in lists, used when a keyword list is absent:
|
|
1005
1197
|
|
|
1006
1198
|
```text
|
|
1007
|
-
vision (
|
|
1008
|
-
|
|
1199
|
+
vision (19): vision, visual, image, images, screenshot, screen shot, ocr, diagram,
|
|
1200
|
+
chart, plot, photo, picture, png, jpg, jpeg, webp, gif,
|
|
1009
1201
|
ui mock, render
|
|
1010
1202
|
planning (24): plan, planning, design, architect, architecture, analyse, analyze,
|
|
1011
1203
|
analysis, research, investigate, review, critique, strategy, reasoning,
|
|
@@ -1019,7 +1211,7 @@ and prints `(disabled)` for an explicitly emptied list:
|
|
|
1019
1211
|
```text
|
|
1020
1212
|
Delegation labels select the tier. The `description` you pass to a delegation
|
|
1021
1213
|
becomes the child label, which the manager matches against (word-anchored):
|
|
1022
|
-
vision : vision, visual, image, images, screenshot, screen shot, ocr,
|
|
1214
|
+
vision : vision, visual, image, images, screenshot, screen shot, ocr, diagram, …
|
|
1023
1215
|
planning : (disabled)
|
|
1024
1216
|
else : execution
|
|
1025
1217
|
```
|
|
@@ -1050,10 +1242,13 @@ Replace a list with the keywords you want, remembering that a patch override rep
|
|
|
1050
1242
|
```
|
|
1051
1243
|
|
|
1052
1244
|
The plugin also contributes a system-prompt section (name `model-manager`, order 60) that
|
|
1053
|
-
tells the delegating agent to
|
|
1054
|
-
work, `vision:` for image work, or leave it plain for execution
|
|
1245
|
+
tells the delegating agent to label a delegation description with `plan:` for thinking
|
|
1246
|
+
work, `vision:` for image work, or leave it plain for execution — a leading prefix winning
|
|
1247
|
+
over keyword matches — to leave `provider` and `model` unset so the role route applies
|
|
1248
|
+
(dropped under `advisory`), and it lists each role's
|
|
1055
1249
|
effective models (including a fallback). It is empty text when no role has any models, so
|
|
1056
|
-
the prompt is not padded with a description of routing that does nothing
|
|
1250
|
+
the prompt is not padded with a description of routing that does nothing; when only the
|
|
1251
|
+
planning tier is missing it says so, so a `plan:` label is never a silent no-op.
|
|
1057
1252
|
|
|
1058
1253
|
## How it stays safe
|
|
1059
1254
|
|
|
@@ -1097,6 +1292,18 @@ degrades to a notice or a log line.
|
|
|
1097
1292
|
accessor and a `try`/`catch`; a missing service means that feature is inert, not that the
|
|
1098
1293
|
plugin fails. The `agent/request` handler catches its own errors, logs one warning
|
|
1099
1294
|
(`routing skipped for one request: …`) and returns the request it was given, unchanged.
|
|
1295
|
+
- **The delegation policy cannot corrupt a prompt.** The section's text function is wrapped
|
|
1296
|
+
end-to-end and returns `''` on any failure — including a throwing `tools.get` — so the
|
|
1297
|
+
worst case is the pre-0.3.0 prompt with no policy, never a broken assembly. It renders
|
|
1298
|
+
only for depth-0 top-level agents that actually have the delegation tools, and reads the
|
|
1299
|
+
live config, so a volatile save changes it on the next request.
|
|
1300
|
+
- **The update check cannot disturb anything.** It starts ~10 s after boot (never on the
|
|
1301
|
+
boot path), runs behind a timeout and a coalescing guard, and every failure path lands
|
|
1302
|
+
in `updateState.status === 'error'` with a reason at info level — offline deployments log
|
|
1303
|
+
one line per interval, not a warning storm. It writes nothing, changes no routing, and a
|
|
1304
|
+
missing `fetch` is just another failed check. The client half's check is gated on
|
|
1305
|
+
`window.location`, browser-only, wrapped in the same `safely` discipline, and its timers
|
|
1306
|
+
(host side) are unref'd or cordis-effect-owned so a test process still exits.
|
|
1100
1307
|
- **`apply` never throws.** The whole body sits behind a backstop that logs
|
|
1101
1308
|
`failed to initialise; model routing is disabled: …` and returns, so a misconfiguration
|
|
1102
1309
|
degrades routing instead of preventing the harness from booting. Malformed configs
|
|
@@ -1112,13 +1319,17 @@ degrades to a notice or a log line.
|
|
|
1112
1319
|
so `readConfig` returns a `warnings` array and `apply` logs each entry at warn level:
|
|
1113
1320
|
`unknown config key "bogus" ignored`, `unknown role "nope" ignored`,
|
|
1114
1321
|
`unknown key "roles.planning.mispelled" ignored`, `unknown key "strategy.nope" ignored`,
|
|
1322
|
+
`unknown key "update.nope" ignored`,
|
|
1115
1323
|
and the route-level form with its `reasoningEffort` hint.
|
|
1116
1324
|
- **The pure helpers are exported for testing:** `name`, `Config`, `apply` plus
|
|
1117
|
-
`readConfig`, `applyRoute`, `effectiveRouteOf`
|
|
1325
|
+
`readConfig`, `applyRoute`, `effectiveRouteOf`, `parseVersion`, `compareVersions`,
|
|
1326
|
+
`installedVersion`, `profileHint`, `delegationPolicyText` and the two default keyword
|
|
1327
|
+
lists.
|
|
1118
1328
|
- **It does not touch the subagent allow-list row**, precisely to avoid the duplicate
|
|
1119
1329
|
loader entry id that would abort startup.
|
|
1120
1330
|
- **The `model_manager` tool is read-only.** Its description says so and the
|
|
1121
|
-
implementation only reads state
|
|
1331
|
+
implementation only reads state — the `update` action forces a network check but writes
|
|
1332
|
+
nothing.
|
|
1122
1333
|
|
|
1123
1334
|
## Testing
|
|
1124
1335
|
|
|
@@ -1126,16 +1337,18 @@ degrades to a notice or a log line.
|
|
|
1126
1337
|
npm test
|
|
1127
1338
|
```
|
|
1128
1339
|
|
|
1129
|
-
Runs
|
|
1340
|
+
Runs ten suites in child processes and aggregates the result — **848 assertions** at the time
|
|
1130
1341
|
of writing. Each suite also runs on its own: `node test/<name>.test.mjs`.
|
|
1131
1342
|
|
|
1132
1343
|
| Suite | Assertions | What it pins |
|
|
1133
1344
|
| --- | --- | --- |
|
|
1134
|
-
| `packaging.test.mjs` |
|
|
1135
|
-
| `routing.test.mjs` |
|
|
1136
|
-
| `
|
|
1137
|
-
| `
|
|
1138
|
-
| `
|
|
1345
|
+
| `packaging.test.mjs` | 35 | The package identity that nothing else cross-checks: the scoped name is the one string the bundle patch's loader row, the client half's module id and the host half's `PACKAGE_NAME` must all agree on, while the cordis row id, the client row namespace and the locale namespace must all *stay* unscoped. Plus publishability (not private, public access, a real `@deepseek-ai/dsh` version gate, schemastery still optional) and tarball completeness — every `exports` target and every `files` pattern resolved against disk, so a published package cannot mount-less. The gate is not string-matched: a self-validating semver comparator (prerelease-aware, and checked against the ordering trap first) proves the declared range admits 0.1.7-rc.2, 0.2.0-rc.2 **and** 0.2.0 while refusing 0.1.6 and 0.3.0 — because `<0.2.0` reads as "every 0.2.0 prerelease" while excluding 0.2.0 itself. 0.3.0 also pins the release plumbing both halves share: the client's `VERSION` constant equals `package.json` (a drift would ship a lying update banner), both halves fetch the same percent-encoded packument path, and the bundle patch carries the new `autoDelegate`/`update` defaults. |
|
|
1346
|
+
| `routing.test.mjs` | 10 | The four roles route as documented; label classification (including a leading `plan:` beating vision keywords under `hybrid`); an explicit child route is respected; the tool and **both** system-prompt sections register; `apply` survives malformed configs. |
|
|
1347
|
+
| `delegation.test.mjs` | 39 | The auto-delegation policy: config normalization (absent → `balanced`, unrecognised → `balanced`, volatile refs unwrapped), the schema union, section registration and its 550 order, and every rendering gate — children (by `origin` and by `delegationDepth`) get `''`, tool-less scopes get `''`, fork-only scopes still get a policy naming `subagent_fork`, the master switch suppresses it, a volatile save switches levels live, and a throwing `tools.get` degrades to `''` instead of throwing out of a prompt section. Plus tier awareness: the policy delegates the decomposition, states the prefix rule, teaches the omit-`provider` rule (dropped under `advisory`), and never advertises a `plan:` tier with no models behind it. |
|
|
1348
|
+
| `update.test.mjs` | 58 | Version parsing and semver comparison (prerelease ordering, numeric identifiers, build-metadata equality, unparseable → `undefined`), `installedVersion` against the real manifest, `profileHint` from a real chdir, update-config normalization (registry sanitization, interval semantics including explicit 0 and the one-minute floor), and the check itself end-to-end with `fetch` mocked: available / up-to-date / older-latest / HTTP failure / malformed packument / rejected fetch / disabled-never-fetches / custom registry, plus the `report`/`routes` status lines, the log levels (available → warn, failure → info), scheduling through the cordis timer API (10 s boot delay, 24 h interval, boot-only, floor, disarm), and a volatile re-arm that immediately re-checks a changed registry. |
|
|
1349
|
+
| `edge.test.mjs` | 557 | Hostile configs, keyword anchoring and trimming, the leading-prefix rule (`plan:`/`vision:` beat keyword matches, case-insensitive, whitespace-tolerant; `"figure out"` is no longer an image label), explicit-`[]`-disables versus absent-uses-defaults, the 0.2.0 pick migration (legacy per-role values warn and are ignored; the top-level value normalizes), round-robin committing only on apply, LRU eviction, the manager-owned rule, volatile settings reload, every `reason` string, the report/usage/routes output, and the generated allow-list YAML round-tripped through the **real** harness validator. |
|
|
1350
|
+
| `failover.test.mjs` | 28 | The failover chain and every guard: it walks to the end of the list and then stops rather than wrapping; `ABORTED`, `INVALID_REQUEST` and `IMAGE_OFFLOAD_REQUIRED` never fail over; a downstream recovery decision is passed through untouched; the per-step cap holds and resets on a new step; `round-robin` does wrap; single-model and disabled roles do nothing; a route outside the role's list is left alone; hostile payloads never throw; subagent chains fail over too. And the cursor isolation of 0.4.0: a planning failure advances only the planning cursor, so the same session back on `main` starts at `main`'s first model, and re-entering plan mode resumes the worn planning chain. |
|
|
1351
|
+
| `client-structure.test.mjs` | 37 | The client half loads through `window.__ModuleLoader__`, requires **only** `react`, exports `{ inject, apply }`, registers its locale dictionaries and exactly three surfaces (settings card, usage surface, update chip — the last of which renders `null` while the update store is idle), and — because the check mirrors the real `SlotCore.register` validation — fails if a registration ever loses its `name`. It also declares each `remote.<namespace>` used must appear in `inject`, drives the settings-form bindings, renders the usage surface against a stubbed projection face in both its collapsed and expanded states (an empty-projection case proving those render assertions are not vacuous), and pins the 0.2.0 card shape: exactly one shared selection control writing the top-level `pick`, with no per-role pick control left anywhere in the tree. The update check itself is gated on `window.location`, so the suite provably never fetches. |
|
|
1139
1352
|
| `client-diagnostic.test.mjs` | 17 | Every branch of `model_manager` with `action: "client"`, including the two that matter most: a bundle the Host will not serve, and a bundle that serves but registers the wrong id. |
|
|
1140
1353
|
| `usage-projection.test.mjs` | 42 | The per-session model-usage fold: bucket sums against the harness's own field names, refusal of unsafe or fractional counts without aborting the fold, usage recovered from an embedded stream, separate attribution per provider/model, immutable state transitions, reference stability that suppresses republishing, and both schemas rejecting junk through the only method cordis calls (`.parse`). |
|
|
1141
1354
|
| `explicit-selection.test.mjs` | 25 | The rule that `main` yields to a hand-picked session model, and nothing else does: respected under `hybrid`, still applied under `managed`, untouched by a respected call in the round-robin rotation, and falling back to the old rewriting behaviour when the projection service is absent, when `stateOf` throws, or when the key was never registered. A disabled manager is checked too. Plus the `Top-level agents` report table: the hand-picked versus default-driven verdict, no orphaned subagent header when no subagent exists, a row that outlives its agent degrading to `unknown, agent no longer live`, and — read back out of the renderer's own source — proof that the reason column is still padded past the longest reason string it can print. |
|
|
@@ -1177,7 +1390,9 @@ outside the repository.
|
|
|
1177
1390
|
keeps being managed as long as its route matches the applied one, even after its parent
|
|
1178
1391
|
is gone. If a child legitimately changes its own model to one the parent also uses, the
|
|
1179
1392
|
manager takes it back.
|
|
1180
|
-
- **`round-robin` is per-process
|
|
1393
|
+
- **`round-robin` is per-process; the strategy itself is global.** The pick strategy is one
|
|
1394
|
+
top-level value shared by every role, but the rotation counters are per-role, live in an
|
|
1395
|
+
in-memory `Map` and
|
|
1181
1396
|
reset to index 0 on restart. A role with a single model never advances, and an advance is
|
|
1182
1397
|
committed only when a route is applied, so `advisory` passes and both kinds of respected
|
|
1183
1398
|
route do not rotate. Routing happens per LLM request, not per turn, so a `round-robin`
|
|
@@ -1229,3 +1444,22 @@ outside the repository.
|
|
|
1229
1444
|
- **The card needs one restart after installing**, because the client-module boot manifest
|
|
1230
1445
|
caches package metadata per loader specifier until restart. Before that the Settings entry is
|
|
1231
1446
|
simply absent.
|
|
1447
|
+
- **The delegation policy is a prompt, not an enforcement.** `strategy.autoDelegate` changes
|
|
1448
|
+
what the top-level agent is *told*; it cannot make a model delegate, and a strong-willed
|
|
1449
|
+
model can still do the work itself. `eager` is the stronger instruction, not a guarantee.
|
|
1450
|
+
A label is likewise overridable: under `hybrid`, a delegation that names `provider`/`model`
|
|
1451
|
+
keeps that route — which is why the policy now tells the agent to leave those unset on
|
|
1452
|
+
`plan:`/`vision:` units, but it cannot stop a model that insists on naming one. The policy
|
|
1453
|
+
also disappears silently if the harness's subagent tool is renamed
|
|
1454
|
+
(`toolName` in `dsh-tool-subagent` config), because the text function only names tools it
|
|
1455
|
+
can resolve in scope.
|
|
1456
|
+
- **The update check sees `dist-tags.latest`, nothing else.** It compares against the
|
|
1457
|
+
`latest` tag on the configured registry, so a newer prerelease (or a `next` tag) is
|
|
1458
|
+
invisible, and an intranet mirror that lags npm will keep reporting "up to date" after a
|
|
1459
|
+
release. The browser banner additionally needs the registry to answer CORS — npmjs and
|
|
1460
|
+
npmmirror do; one that does not simply leaves the client-side surfaces empty while the
|
|
1461
|
+
host log and the tool action still report.
|
|
1462
|
+
- **The client banner's "installed" version is the pinned constant.** The browser cannot
|
|
1463
|
+
read `package.json`, so `client.js` pins `VERSION` and a packaging test keeps it equal;
|
|
1464
|
+
a hand-edited checkout that bumps only one side will show a self-inconsistent banner
|
|
1465
|
+
(which the same test refuses to let the repo ship).
|