@darkbear9494/dsh-model-manager 0.2.0 → 0.5.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 +399 -55
- package/client.js +259 -5
- package/cordis.patch.yml +23 -2
- package/lib/index.js +1047 -30
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -3,7 +3,14 @@
|
|
|
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. Since 0.5.0 the
|
|
11
|
+
*session* can also pick its own tier: invoking a thinking skill — `grilling`, or the `grill-me`
|
|
12
|
+
alias people type — puts the top-level session on the `planning` role for the rest of the session,
|
|
13
|
+
exactly as plan mode does.
|
|
7
14
|
|
|
8
15
|
## What it is
|
|
9
16
|
|
|
@@ -16,7 +23,22 @@ nothing tells you afterwards which model a given subagent ended up on.
|
|
|
16
23
|
This plugin is that layer. It keeps one ordered route list per role, classifies each
|
|
17
24
|
delegated child from the label the delegating agent gives it, rewrites the child's resolved
|
|
18
25
|
route to the role's route when inheritance is provable, and exposes a read-only
|
|
19
|
-
`model_manager` tool that reports what happened.
|
|
26
|
+
`model_manager` tool that reports what happened. 0.3.0 adds two layers on top of routing
|
|
27
|
+
proper: an **auto-delegation policy** — a system-prompt section that teaches the top-level
|
|
28
|
+
agent to plan and dispatch subagents instead of doing everything itself, which is the
|
|
29
|
+
behaviour the harness's own instructions only nudge at — and an **update check** that
|
|
30
|
+
compares the installed version with the registry's `dist-tags.latest` and tells you how to
|
|
31
|
+
upgrade. 0.4.0 makes the label a contract instead of a hint: a leading `plan:`/`vision:`
|
|
32
|
+
prefix decides the tier before any keyword is consulted, the policy never advertises a tier
|
|
33
|
+
with no models behind it, it teaches the delegating agent to leave `provider`/`model` unset
|
|
34
|
+
on tiered units (an explicitly named route overrides the tier under `hybrid`), and the
|
|
35
|
+
failover cursor is tracked per (session, role) so one tier's wear never pushes another tier
|
|
36
|
+
off its first model. 0.5.0 gives the top-level `planning` tier a second trigger besides plan
|
|
37
|
+
mode: a session that invoked one of the skills listed in `strategy.planningSkills` (default
|
|
38
|
+
`['grill-me', 'grilling']`) runs on the planning role's models for the rest of its life, whether
|
|
39
|
+
the intent arrived as a `/grilling` gesture in user text, as the harness's skill injection, or as
|
|
40
|
+
the model's own `skill` tool call — and it is read from a durable session projection, so it
|
|
41
|
+
survives a restart, a resume and a fork. It is still deliberately small: one ESM host
|
|
20
42
|
file, one config schema, and one hand-written client file that contributes a
|
|
21
43
|
configuration card to the Plugins page. There is no build step for either half.
|
|
22
44
|
|
|
@@ -68,19 +90,27 @@ before handing it to pnpm. All four forms work:
|
|
|
68
90
|
| `@darkbear9494/dsh-model-manager` | registry — the shortest one to type |
|
|
69
91
|
| `github:jyshangguan/dsh-model-manager` | git — the `https://github.com/…` URL works too |
|
|
70
92
|
| `/Users/you/src/dsh-model-manager` | absolute local directory (relative paths are refused) |
|
|
71
|
-
| `/Users/you/darkbear9494-dsh-model-manager-0.2.0.tgz` | local tarball — `npm pack` makes one |
|
|
93
|
+
| `/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) |
|
|
72
94
|
|
|
73
95
|
Registering the plugin by name was verified end-to-end on this runtime: `dsh plugin --profile
|
|
74
96
|
<name> add @darkbear9494/dsh-model-manager` resolves the current release (`^0.1.0` at first
|
|
75
97
|
publish, `^0.2.0` since) from the registry, `reconcile()`
|
|
76
98
|
appends the bundle, the composed tree mounts row `model-manager`, and a boot reaches the LLM stage
|
|
77
99
|
with no peer refusal and no loader error. The git and local-path forms were checked the same way.
|
|
100
|
+
The same add command is the **upgrade** path: re-running it with `@latest` resolves the newer
|
|
101
|
+
version and updates the dependency in place.
|
|
78
102
|
|
|
79
103
|
### The registry copy
|
|
80
104
|
|
|
81
|
-
`@darkbear9494/dsh-model-manager@0.
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
`@darkbear9494/dsh-model-manager@0.4.0` is the current release **on the registry**, public
|
|
106
|
+
access, the same 8 files as 0.2.0 (the tarball grew, not the file list: the host half, the client
|
|
107
|
+
half and this README carry the new sections). The 0.5.0 planning-skill work described throughout
|
|
108
|
+
this README is this release **in the working copy** — nothing here claims it is published, because
|
|
109
|
+
it is not: `add @darkbear9494/dsh-model-manager@latest` still resolves 0.4.0 until someone runs
|
|
110
|
+
`npm publish`, so 0.5.0 installs from a local path (or from git, once it is pushed there). 0.2.0
|
|
111
|
+
packed 63.1 kB with the same 8 files, and 0.1.0, the first publish, 62.3 kB. The declared gate is
|
|
112
|
+
`>=0.1.7-rc.2 <0.3.0`, so every release on the 0.1.7–0.2.x runtime lines installs without an
|
|
113
|
+
exemption.
|
|
84
114
|
|
|
85
115
|
Two things learned while publishing it, in case a future version has to be released:
|
|
86
116
|
|
|
@@ -138,7 +168,8 @@ The 0.2.0 line is admitted because the host half is verified against it. Against
|
|
|
138
168
|
every API this plugin touches is unchanged from 0.1.7-rc.2: `dsh-session-projection`
|
|
139
169
|
(`stateOf`), `dsh-plan-mode`, `dsh-agent`, `dsh-subagent`, `dsh-tool-subagent` +
|
|
140
170
|
`model-selection-settings`, `dsh-tools`, `dsh-llm`, `dsh-session` and `dsh-client-modules` are
|
|
141
|
-
byte-identical, all
|
|
171
|
+
byte-identical, all six subscribed events (including `agent/pre-step`, whose dispatch and
|
|
172
|
+
decision shapes 0.5.0's skill trigger reads) and every probed service still exist, and all 22
|
|
142
173
|
failover `failure.code` values are still emitted. A real boot on that runtime applied the host
|
|
143
174
|
half, bound every event, resolved every injection and registered the `model_manager` tool. The
|
|
144
175
|
client half is unchanged too: `window.__ModuleLoader__.load({ id, factory })`, the `dsh.client`
|
|
@@ -169,7 +200,7 @@ Only a restart picks it up. Remove the old name, install the new one, then resta
|
|
|
169
200
|
|
|
170
201
|
| File | Purpose |
|
|
171
202
|
| --- | --- |
|
|
172
|
-
| `lib/index.js` | Host half: Cordis identity `model-manager`, exported `Config`, `apply`, the `agent/request` routing, the `agent/request-error` failover, and the `model_manager` tool. |
|
|
203
|
+
| `lib/index.js` | Host half: Cordis identity `model-manager`, exported `Config`, `apply`, the `agent/request` routing, the `agent/request-error` failover, the `agent/pre-step` planning-skill observer, the three session projections, and the `model_manager` tool. |
|
|
173
204
|
| `client.js` | Client half: the configuration card, contributed as a page in the Settings panel. |
|
|
174
205
|
| `locale/en.json`, `locale/zh.json` | Display metadata only — the bundle's `title` and `description` in the plugin list. |
|
|
175
206
|
| `cordis.patch.yml` | Bundle layer: inserts exactly one row, id `model-manager`. |
|
|
@@ -285,14 +316,28 @@ resolves to no route, and requests classified into it pass through unchanged —
|
|
|
285
316
|
|
|
286
317
|
| Role | What it is for | When it applies | Bundled default |
|
|
287
318
|
| --- | --- | --- | --- |
|
|
288
|
-
| `main` | The top-level agent outside plan mode. | Requests from a non-subagent session
|
|
289
|
-
| `planning` | Reasoning, design, analysis, research. | Top-level requests while plan mode is active; subagents whose label matches a planning keyword (and no vision keyword). | `pku-corpus/qwen3.8-max-0902` |
|
|
319
|
+
| `main` | The top-level agent, outside plan mode and outside any active planning skill. | Requests from a non-subagent session **outside** plan mode and outside any active planning skill. | `models: []` (no route — the composer choice is left alone) |
|
|
320
|
+
| `planning` | Reasoning, design, analysis, research. | Top-level requests while plan mode is active **or** while a listed planning skill (default `grilling` / `grill-me`) has been invoked in the session; subagents whose label matches a planning keyword (and no vision keyword). | `pku-corpus/qwen3.8-max-0902` |
|
|
290
321
|
| `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` |
|
|
291
322
|
| `vision` | Image, screenshot, chart and OCR work. | Subagents whose label matches a vision keyword. | `models: []` (falls back to `execution`) |
|
|
292
323
|
|
|
324
|
+
A top-level session has two ways onto `planning`, and neither of them is its label:
|
|
325
|
+
the harness's plan mode, and `strategy.planningSkills` — the skills a user invokes to do thinking
|
|
326
|
+
work (`grilling`, plus the `grill-me` alias that loads it). Invoking one counts as entering the
|
|
327
|
+
tier: the session is on `planning` **for the rest of the session**, because the skill's
|
|
328
|
+
instructions stay in context and a grilling interview runs over many turns, not one. There is no
|
|
329
|
+
exit gesture — start a new session, or set `planningSkills: []`, which is the off switch — and a
|
|
330
|
+
model you hand-picked in the composer still wins under `hybrid`, the same way it does in plan mode.
|
|
331
|
+
See [Planning skills](#planning-skills).
|
|
332
|
+
|
|
293
333
|
A route is `{ provider, model, reasoningEffort? }`. The top-level `pick` is `first`
|
|
294
334
|
(default) or `round-robin` and applies to every role alike; with one model in a role's list
|
|
295
|
-
it has no effect for that role.
|
|
335
|
+
it has no effect for that role. Under `first` the list is a failover chain, and since 0.4.0
|
|
336
|
+
the wear position is tracked per **(session, role)**, not per session: a session that failed
|
|
337
|
+
over while it was serving `planning` (plan mode moves one session between `main` and
|
|
338
|
+
`planning` on every request; a planning skill moves it to `planning` and leaves it there) comes
|
|
339
|
+
back to `main` still on `main`'s first model. A role may
|
|
340
|
+
also carry a
|
|
296
341
|
`note` — free text for humans, printed under the role in the `routes` table and never
|
|
297
342
|
used for routing.
|
|
298
343
|
|
|
@@ -300,25 +345,27 @@ used for routing.
|
|
|
300
345
|
|
|
301
346
|
The client half contributes a configuration card to the Plugins page. It writes exactly the
|
|
302
347
|
values documented under [Configuration](#configuration) — `roles.<role>.models`, the
|
|
303
|
-
top-level `pick` and `strategy.
|
|
348
|
+
top-level `pick`, `strategy.mode` and `strategy.autoDelegate` — so the two paths are
|
|
349
|
+
interchangeable: use the card to try a routing
|
|
304
350
|
choice, the YAML to pin it. This package's own `cordis.patch.yml` is the declarative source
|
|
305
351
|
that ships with the bundle and is re-read on every boot, and a profile patch overrides it by
|
|
306
352
|
row id; the card never edits patch files, so if a patch layer pins a value, edit the patch.
|
|
307
353
|
|
|
308
354
|
### Where the card appears
|
|
309
355
|
|
|
310
|
-
`client.js` registers **
|
|
356
|
+
`client.js` registers **three** surfaces and deliberately nothing on the Plugins page:
|
|
311
357
|
|
|
312
358
|
| Slot | Registration id | What it renders |
|
|
313
359
|
| --- | --- | --- |
|
|
314
|
-
| `settings.section` | `model-manager` | The configuration card: the four roles and their model lists, the shared selection strategy, the distribution mode. |
|
|
360
|
+
| `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. |
|
|
315
361
|
| `conversation.session.header.utilities` | `model-manager-usage` | The per-session model-usage summary the host half folds from the durable log. |
|
|
362
|
+
| `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. |
|
|
316
363
|
|
|
317
364
|
So the path is **设置 → 模型管理器** — not Plugins → the row → configure. `plugins.item` and
|
|
318
365
|
`plugins.row.config` are *not* registered: one card in one place was the requirement, and a
|
|
319
366
|
second copy on the Plugins page would only be a second place for the same values to disagree.
|
|
320
367
|
|
|
321
|
-
|
|
368
|
+
All entries are registered **unconditionally** rather than behind the shipped
|
|
322
369
|
`configForms.whileServed([ns], …)` gate. The Host serves a settings namespace only for a row
|
|
323
370
|
whose Config schema has volatile fields, so that gate would hide the card entirely whenever the
|
|
324
371
|
optional schemastery dependency failed to resolve — making a packaging problem look exactly like
|
|
@@ -338,12 +385,14 @@ polling on the client, and the numbers survive a restart.
|
|
|
338
385
|
| `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. |
|
|
339
386
|
| 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. |
|
|
340
387
|
| `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. |
|
|
388
|
+
| `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. |
|
|
341
389
|
| 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. |
|
|
390
|
+
| 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). |
|
|
342
391
|
|
|
343
392
|
**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.
|
|
344
393
|
|
|
345
|
-
Each role also carries a hint line (`Top-level agent outside plan mode
|
|
346
|
-
|
|
394
|
+
Each role also carries a hint line (`Top-level agent outside plan mode and planning skills. …`,
|
|
395
|
+
`Used for image, screenshot and OCR work. Pick a model
|
|
347
396
|
that accepts images.`, …) so the card explains itself without this README open.
|
|
348
397
|
|
|
349
398
|
The card cannot tell you whether a model accepts images: the session model catalog carries
|
|
@@ -422,9 +471,11 @@ the patch layer.
|
|
|
422
471
|
**Verification status, stated honestly:** the client half was verified by JavaScript syntax,
|
|
423
472
|
manifest validation, a structural load of the `window.__ModuleLoader__.load` factory — which
|
|
424
473
|
confirms that only `react` is required, that `apply` registers the `dsh-model-manager` locale
|
|
425
|
-
namespace with the same
|
|
426
|
-
not just their counts), that exactly
|
|
427
|
-
`model-manager` and `conversation.session.header.utilities` under
|
|
474
|
+
namespace with the same 61 keys in English and Chinese (the test compares the sorted key *sets*,
|
|
475
|
+
not just their counts), that exactly three registrations land across the two surfaces —
|
|
476
|
+
`settings.section` under `model-manager` and `conversation.session.header.utilities` under
|
|
477
|
+
`model-manager-usage` (the per-session usage) plus `model-manager-update` (the update chip,
|
|
478
|
+
which renders `null` while the update store is idle) — and
|
|
428
479
|
that `apply` still returns normally when every injected collaborator throws. It was also checked
|
|
429
480
|
against the live slot contract in `@deepseek-ai/dsh-client-ui-settings`. **Visual verification of
|
|
430
481
|
the rendered card is not available in this environment:** the harness's own verification guidance
|
|
@@ -509,15 +560,20 @@ unresolved-lineage route all leave the rotation where it was.
|
|
|
509
560
|
|
|
510
561
|
Only a session whose `session.header.origin` is `'subagent'` is classified by label. The
|
|
511
562
|
label is the `description` the delegating agent passed to the `subagent` tool, which the
|
|
512
|
-
harness stores as the child's label. Matching is case-insensitive
|
|
513
|
-
|
|
563
|
+
harness stores as the child's label. Matching is case-insensitive, anchored at a leading
|
|
564
|
+
word boundary, and prefix-first, in this order:
|
|
514
565
|
|
|
515
566
|
1. Empty label → `execution`.
|
|
516
|
-
2.
|
|
517
|
-
|
|
518
|
-
|
|
567
|
+
2. A label starting with `plan:` (case-insensitive, leading whitespace ignored) →
|
|
568
|
+
`planning`.
|
|
569
|
+
3. A label starting with `vision:` → `vision`.
|
|
570
|
+
4. Else any `visionKeywords` match → `vision`.
|
|
571
|
+
5. Else any `planningKeywords` match → `planning`.
|
|
572
|
+
6. Else `execution`.
|
|
519
573
|
|
|
520
|
-
|
|
574
|
+
The leading prefix is authoritative — it is the one part of the label the delegating model
|
|
575
|
+
writes *on purpose*, so `"plan: analyse the screenshots"` is planning work. Among keyword
|
|
576
|
+
matches, vision is tested before planning, so a label matching both lands on `vision`.
|
|
521
577
|
|
|
522
578
|
| Delegation `description` | Matched by | Role | Applied route (bundled defaults) |
|
|
523
579
|
| --- | --- | --- | --- |
|
|
@@ -528,7 +584,70 @@ Vision is tested before planning, so a label that matches both lands on `vision`
|
|
|
528
584
|
| `"summarize the changelog"` | nothing | `execution` | `pku-corpus/qwen3.8-flash` |
|
|
529
585
|
|
|
530
586
|
A non-subagent session is never classified by label: it gets `planning` while plan mode
|
|
531
|
-
is active
|
|
587
|
+
is active **or** while one of `strategy.planningSkills` has been invoked in it — a trigger that
|
|
588
|
+
then holds for the rest of the session — and `main` otherwise. See
|
|
589
|
+
[Planning skills](#planning-skills).
|
|
590
|
+
|
|
591
|
+
### Planning skills
|
|
592
|
+
|
|
593
|
+
`strategy.planningSkills` (default `['grill-me', 'grilling']`) is the user-facing half of the
|
|
594
|
+
planning tier: plan mode is the harness declaring that this session is doing thinking work, a
|
|
595
|
+
skill invocation is the user declaring the same thing. Both names ship in the list because
|
|
596
|
+
`grill-me` is the alias a person types and `grilling` is the skill it loads. A subagent is never
|
|
597
|
+
escalated by a skill — a child is classified by its label alone.
|
|
598
|
+
|
|
599
|
+
**Three signals count**, because DSH commits each of them before the request it can influence:
|
|
600
|
+
|
|
601
|
+
| Signal | Read from | Escalates |
|
|
602
|
+
| --- | --- | --- |
|
|
603
|
+
| The injected skill message — `user/message` with `source.kind: 'skill-invocation'` and `source.name` | the durable fold **and** `agent/pre-step` | the step that carries the gesture |
|
|
604
|
+
| A `/name` gesture in direct user text | the same two | the same step |
|
|
605
|
+
| A model-invoked `skill` tool call — `tool/call`, name `skill`, JSON `arguments.name` | the durable fold | the **next** request of that session |
|
|
606
|
+
|
|
607
|
+
Recognition uses the harness's own grammar, kept byte-identical to `dsh-tool-skill`'s: a skill
|
|
608
|
+
name is lowercase kebab-case (`[a-z0-9]+(-[a-z0-9]+)*`) and the gesture is a `/name` standing
|
|
609
|
+
alone between whitespace. So "grill me on this" written in prose matches nothing, while the
|
|
610
|
+
`skill` call the model then makes does — one request later, once that call is in the log.
|
|
611
|
+
|
|
612
|
+
**Why the first request needs a second hook.** DSH fires `agent/pre-step` *before*
|
|
613
|
+
`agent/request`, and commits the step's user batch — the skill injection included — only *after*
|
|
614
|
+
`agent/request` returns (`dsh-agent-loop`: `preStep()` → `prepareRequest()` →
|
|
615
|
+
`session.append('user/message')`). A fold-only design would therefore serve the first, and most
|
|
616
|
+
important, request of a `/grilling` turn on `main`. So the plugin registers a prepended,
|
|
617
|
+
observe-only `agent/pre-step` listener that records every skill name in the step's batches and
|
|
618
|
+
returns the harness's decision untouched. `{ prepend: true }` is what lets it see the injections
|
|
619
|
+
at all: `dsh-tool-skill` registers as an inner hook, so a normally ordered listener would run
|
|
620
|
+
inside it and never receive them. That map is per-process and is dropped with the agent on
|
|
621
|
+
`agent/disposed`.
|
|
622
|
+
|
|
623
|
+
**Why the trigger survives a restart.** The durable half is a third session projection,
|
|
624
|
+
`modelManagerPlanningSkill`, folded from the `user/message` and `tool/call` events. It stores
|
|
625
|
+
*every* skill name the session invoked, not just the configured planning ones, because membership
|
|
626
|
+
is decided against the **live** config on every request: adding a name to `planningSkills` reaches
|
|
627
|
+
a session that invoked it an hour ago, and `[]` switches the trigger off on the next request
|
|
628
|
+
without a restart. Both halves are append-only, which is what makes the trigger **sticky for the
|
|
629
|
+
rest of the session** — the way entering plan mode is, and for the same reason: the skill's
|
|
630
|
+
instructions stay in context and its interview runs over many turns. Plan mode is consulted first,
|
|
631
|
+
so a session that is in plan mode *and* has been grilled records trigger `plan-mode`; the role is
|
|
632
|
+
`planning` either way.
|
|
633
|
+
|
|
634
|
+
Normalization follows the keyword lists, with one addition: entries are trimmed, lowercased and
|
|
635
|
+
de-duplicated, and anything that is not a kebab-case skill name is dropped, so a typo in the list
|
|
636
|
+
can never match a session by accident. An absent or non-list value uses the defaults; an explicit
|
|
637
|
+
`[]` — or a list whose every entry was dropped — disables the trigger.
|
|
638
|
+
|
|
639
|
+
**What you can see of it.** The host logs one line per switch rather than per request
|
|
640
|
+
(`planning skill "grilling" is active in this session; top-level requests route as planning`),
|
|
641
|
+
`model_manager(action: "routes")` prints the live list on its `Planning skills:` line, and
|
|
642
|
+
`model_manager(action: "report")` adds a `Planning skill trigger: <session> → <skill>` line under
|
|
643
|
+
the `Top-level agents` table for any session that got there through a skill. The system-prompt
|
|
644
|
+
cheat sheet says the same, but only while the planning role actually has models behind it.
|
|
645
|
+
|
|
646
|
+
**It is a routing aid, not enforcement.** It decides which *role* a top-level request is
|
|
647
|
+
classified into, and nothing else. It cannot make a model think better, and under `hybrid` a model
|
|
648
|
+
you hand-picked in the composer still serves the session: the report row shows role `planning`
|
|
649
|
+
with reason `explicit session selection (respected)` and your route, exactly as it does in plan
|
|
650
|
+
mode. There is no exit gesture — start a new session, or set `planningSkills: []`.
|
|
532
651
|
|
|
533
652
|
### The vision → execution fallback
|
|
534
653
|
|
|
@@ -599,6 +718,128 @@ warn [model-manager] vision role route(s) declare no image input and image work
|
|
|
599
718
|
undeclared modalities may well accept images, and an unresolvable route is already reported
|
|
600
719
|
by the allow-list audit.
|
|
601
720
|
|
|
721
|
+
## Auto-delegation policy (`strategy.autoDelegate`)
|
|
722
|
+
|
|
723
|
+
**The problem it solves.** The harness gives the top-level agent a `subagent` tool and a
|
|
724
|
+
one-line nudge ("Start independent delegations together in one message"), but nothing tells
|
|
725
|
+
it *when* to delegate. In practice the model does the work itself and only reaches for a
|
|
726
|
+
delegation when it cannot proceed — image reading being the canonical case. This plugin is
|
|
727
|
+
already in the business of routing delegations by role; 0.3.0 makes it also *ask* for them.
|
|
728
|
+
|
|
729
|
+
`strategy.autoDelegate` controls a second system-prompt section, `model-manager:delegation`
|
|
730
|
+
(order 550 — next to the harness's own `PLAN_POLICY`/`TEAM_POLICY` rows, not next to the
|
|
731
|
+
routing cheat sheet, because this is a behavioural policy rather than a routing fact):
|
|
732
|
+
|
|
733
|
+
| Level | Rendered for | What it tells the top-level agent |
|
|
734
|
+
| --- | --- | --- |
|
|
735
|
+
| `off` | nobody | Nothing — no section text at all. |
|
|
736
|
+
| `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. |
|
|
737
|
+
| `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. |
|
|
738
|
+
|
|
739
|
+
Both levels end with the same labelling block, so the policy and the role tiers are used
|
|
740
|
+
together — which is the point of having both in one plugin. The block labels each delegation
|
|
741
|
+
by the *kind of work it carries* (`plan:` = must be thought through, `vision:` = reads images,
|
|
742
|
+
plain = mechanical execution), states that a leading prefix decides the tier with keyword
|
|
743
|
+
matching as the fallback, and — under any mode that actually routes — tells the agent to
|
|
744
|
+
**omit `provider` and `model` on `plan:`/`vision:` units**, because a route named explicitly
|
|
745
|
+
on the delegation overrides the tier. That last line is the one that makes the label matter
|
|
746
|
+
under `hybrid`, where a respected explicit choice is exactly what defeats role routing.
|
|
747
|
+
|
|
748
|
+
**Rendering is per assembly, and deliberately narrow.** The section's text function receives
|
|
749
|
+
the assembly context (`{ agent, scope }`, the same object `dsh-agent`'s
|
|
750
|
+
`assembleContextFor` builds) and returns `''` — no policy at all — unless every gate passes:
|
|
751
|
+
|
|
752
|
+
- the manager is enabled and the level is not `off`;
|
|
753
|
+
- the assembly is **not** a delegated child: `session.header.origin === 'subagent'` or
|
|
754
|
+
`header.delegationDepth > 0` both disqualify. Children already carry the harness's fixed
|
|
755
|
+
`subagent:delegation` runtime context, and encouraging a child to re-delegate would push
|
|
756
|
+
every unit one depth level down for no benefit;
|
|
757
|
+
- the assembly's scope **actually exposes a delegation tool**, checked with
|
|
758
|
+
`tools.get('subagent', scope)` / `tools.get('subagent_fork', scope)` — the same probe
|
|
759
|
+
`dsh-tool-subagent`'s own prompt section uses. An agent whose composition restricted the
|
|
760
|
+
delegation tools never sees a policy naming a tool it cannot call, and a harness that
|
|
761
|
+
renames the tool loses the policy rather than rendering a broken instruction.
|
|
762
|
+
|
|
763
|
+
Beyond the gates, the labelling block adapts to what is actually behind it: a tier with no
|
|
764
|
+
configured models is never advertised (no `plan:` line when the planning role is empty — and
|
|
765
|
+
the balanced "plan first" bullet loses its label too), and under `advisory`, where nothing is
|
|
766
|
+
routed at all, the omit-`provider`/`model` line is dropped because it would warn about
|
|
767
|
+
nothing.
|
|
768
|
+
|
|
769
|
+
Only the tools that resolve are named: with both present the policy mentions `subagent` and
|
|
770
|
+
the `subagent_fork` preference for work that needs this conversation's context; with only
|
|
771
|
+
`subagent` the fork line is dropped. `model_manager(action: "routes")` reports the level
|
|
772
|
+
(`Auto-delegation: balanced — …`), and the settings card offers the three-way select, so
|
|
773
|
+
switching levels needs no restart — the section reads the live config, so a saved edit
|
|
774
|
+
applies to the next request.
|
|
775
|
+
|
|
776
|
+
## Automatic update checks
|
|
777
|
+
|
|
778
|
+
The host half checks whether a newer `@darkbear9494/dsh-model-manager` is published, and
|
|
779
|
+
tells you — passively in the log, on demand through the tool, and persistently in the Web UI.
|
|
780
|
+
|
|
781
|
+
**How it works.** The plugin reads its own version from its `package.json` (so a git
|
|
782
|
+
checkout, an npm install and a tarball install all report what actually shipped), fetches
|
|
783
|
+
the abbreviated packument `<registry>/@darkbear9494%2fdsh-model-manager` with
|
|
784
|
+
`Accept: application/vnd.npm.install-v1+json`, reads `dist-tags.latest`, and compares the
|
|
785
|
+
two with a semver comparator that handles prereleases (`0.3.1-rc.1 < 0.3.1`, numeric
|
|
786
|
+
prerelease identifiers compare numerically). The first check runs ~10 s after boot — never
|
|
787
|
+
on the boot path — and then once per `intervalHours`; every failure path (no network,
|
|
788
|
+
CORS, a malformed packument) lands in a logged diagnostic and a `CHECK FAILED` verdict,
|
|
789
|
+
never a throw, and never touches routing.
|
|
790
|
+
|
|
791
|
+
**Where a newer release is surfaced:**
|
|
792
|
+
|
|
793
|
+
| Surface | What you see |
|
|
794
|
+
| --- | --- |
|
|
795
|
+
| 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.` |
|
|
796
|
+
| `model_manager` action `update` | The full report below — including the paste-ready upgrade command with the live profile name. |
|
|
797
|
+
| `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. |
|
|
798
|
+
| Settings card | A warn-toned banner at the top of the card with the versions, the upgrade command, and a **Re-check** button. |
|
|
799
|
+
| 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. |
|
|
800
|
+
|
|
801
|
+
Asking for the check directly:
|
|
802
|
+
|
|
803
|
+
```text
|
|
804
|
+
model_manager(action: "update")
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
```text
|
|
808
|
+
Model manager update check
|
|
809
|
+
|
|
810
|
+
installed : 0.2.0
|
|
811
|
+
latest : 0.3.0
|
|
812
|
+
registry : https://registry.npmjs.org
|
|
813
|
+
checked : 2026-10-07T03:12:44.612Z
|
|
814
|
+
verdict : UPDATE AVAILABLE (0.2.0 -> 0.3.0)
|
|
815
|
+
|
|
816
|
+
To upgrade, run in a terminal:
|
|
817
|
+
|
|
818
|
+
dsh plugin --profile desktop add @darkbear9494/dsh-model-manager@latest
|
|
819
|
+
|
|
820
|
+
then restart the harness so the new version mounts. The Plugins page can reinstall
|
|
821
|
+
the same package instead; both paths run the same installer. Tell the user this
|
|
822
|
+
upgrade is available and what command to run.
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
The `<profile>` in the command is read from the host's working directory
|
|
826
|
+
(`$DSH_HOME/profiles/<name>`); when the layout does not match, the command prints
|
|
827
|
+
`<profile>` as a placeholder. Upgrading is re-running the add command — the installer
|
|
828
|
+
(`dsh plugin add` / the GUI's `install_bundle`) resolves the new version, updates the
|
|
829
|
+
dependency and keeps the bundle registration; restart the harness afterwards so the new
|
|
830
|
+
host half mounts.
|
|
831
|
+
|
|
832
|
+
**The browser half runs the same comparison itself.** The Web client cannot read the host's
|
|
833
|
+
in-memory state, so `client.js` pins the version it shipped with (a packaging test pins
|
|
834
|
+
that constant equal to `package.json`) and fetches the same packument once per page load —
|
|
835
|
+
plus on every `settings/document-updated` (the registry URL is row config, so a change
|
|
836
|
+
re-checks) and on the banner's Re-check button. That is why the chip and banner can appear
|
|
837
|
+
the moment the GUI opens. An offline or registry-blocked deployment simply sees no banner;
|
|
838
|
+
the host log and the tool action still report the update. This also means the browser makes
|
|
839
|
+
one cross-origin `fetch` to the configured registry — `registry.npmjs.org` (and npmmirror)
|
|
840
|
+
answer it with `Access-Control-Allow-Origin: *`; a registry that does not is silently
|
|
841
|
+
unusable for the client half and only the host surfaces remain.
|
|
842
|
+
|
|
602
843
|
## Configuration
|
|
603
844
|
|
|
604
845
|
Config is the `config` of the row id `model-manager`. This bundle ships a layer that
|
|
@@ -639,12 +880,32 @@ Complete key set, with the schema defaults shown in comments:
|
|
|
639
880
|
mode: hybrid # default: hybrid; "hybrid" | "managed" | "advisory"
|
|
640
881
|
# visionKeywords: omitted = the 20 built-ins; any list you write replaces them
|
|
641
882
|
# planningKeywords: omitted = the 24 built-ins; [] DISABLES that classifier
|
|
883
|
+
# planningSkills: omitted = ['grill-me', 'grilling']; [] DISABLES the trigger
|
|
642
884
|
historyLimit: 300 # default: 300; any positive value floors to at least 1
|
|
885
|
+
autoDelegate: balanced # default: balanced; "off" | "balanced" | "eager" — the delegation policy
|
|
886
|
+
update: # 0.3.0 — automatic update check
|
|
887
|
+
enabled: true # default: true; only an explicit false stops the checks
|
|
888
|
+
registry: https://registry.npmjs.org # any npm-compatible registry (npmmirror works)
|
|
889
|
+
intervalHours: 24 # default: 24; explicit 0 = check at boot only
|
|
643
890
|
```
|
|
644
891
|
|
|
645
|
-
The
|
|
646
|
-
|
|
647
|
-
|
|
892
|
+
The three lists are shown commented out because their default is a built-in list rather than a
|
|
893
|
+
literal value: omitting the key keeps the built-ins, while writing any list — including `[]` —
|
|
894
|
+
replaces them, and `[]` switches that classifier or trigger off entirely. `planningSkills` differs
|
|
895
|
+
in one way: its entries are normalized — trimmed, lowercased, de-duplicated, anything that is not
|
|
896
|
+
a kebab-case skill name dropped — so a list whose entries are all invalid is exactly the same as
|
|
897
|
+
`[]`. See [Planning skills](#planning-skills).
|
|
898
|
+
|
|
899
|
+
Behaviours of the `update` block worth knowing:
|
|
900
|
+
|
|
901
|
+
- `registry` must be an `http(s)` origin; anything else (or a non-string) falls back to
|
|
902
|
+
`https://registry.npmjs.org`. Trailing slashes are trimmed.
|
|
903
|
+
- `intervalHours` accepts a fraction (0.5 = 30 min, useful when watching a release land)
|
|
904
|
+
and is floored at one minute so a mis-typed hour cannot hammer a registry. An absent,
|
|
905
|
+
malformed or negative value means the 24 h default; an explicit `0` means "check at boot
|
|
906
|
+
only". `enabled: false` is the actual off switch.
|
|
907
|
+
- A settings save that changes the update block re-arms the schedule **and** runs one
|
|
908
|
+
immediate check, so switching to a mirror registry takes effect without a restart.
|
|
648
909
|
|
|
649
910
|
Each entry of `models` is:
|
|
650
911
|
|
|
@@ -662,6 +923,12 @@ Behaviours of `readConfig` worth knowing:
|
|
|
662
923
|
individual route. A route written with the snake_case alias is called out by name —
|
|
663
924
|
`unknown key "roles.planning.models[].reasoning_effort" ignored — the key is
|
|
664
925
|
"reasoningEffort"`.
|
|
926
|
+
- `strategy.planningSkills` normalizes differently from the keyword lists: entries are trimmed,
|
|
927
|
+
lowercased, de-duplicated and dropped when they are not kebab-case skill names, so an absent or
|
|
928
|
+
non-list value means the `['grill-me', 'grilling']` defaults while *any* list replaces them —
|
|
929
|
+
including one that normalizes down to empty, which is the disabled state. Membership is checked
|
|
930
|
+
against the live config on every request, so adding a skill and setting `[]` both take effect on
|
|
931
|
+
the next request with no restart.
|
|
665
932
|
- `historyLimit` accepts any positive number, floored to an integer and raised to a
|
|
666
933
|
minimum of 1, so a fractional value cannot floor to 0 and silently disable usage
|
|
667
934
|
tracking. `0`, a negative number, a non-number or an absent key all mean 300.
|
|
@@ -697,6 +964,11 @@ The bundled layer this package ships is:
|
|
|
697
964
|
models: []
|
|
698
965
|
strategy:
|
|
699
966
|
mode: hybrid
|
|
967
|
+
autoDelegate: balanced
|
|
968
|
+
update:
|
|
969
|
+
enabled: true
|
|
970
|
+
registry: https://registry.npmjs.org
|
|
971
|
+
intervalHours: 24
|
|
700
972
|
```
|
|
701
973
|
|
|
702
974
|
## Seeing which model each subagent used
|
|
@@ -742,14 +1014,15 @@ finished value: no folding in the browser, no polling, no fetch route. That is t
|
|
|
742
1014
|
|
|
743
1015
|
### The tool
|
|
744
1016
|
|
|
745
|
-
The plugin registers one read-only tool, `model_manager`, with
|
|
1017
|
+
The plugin registers one read-only tool, `model_manager`, with five actions:
|
|
746
1018
|
|
|
747
1019
|
| Action | Returns |
|
|
748
1020
|
| --- | --- |
|
|
749
|
-
| `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. |
|
|
750
|
-
| `routes` | Role table (role, effective models, role `note`), the shared selection strategy, active mode, allow-list audit with a YAML snippet for unlisted routes, the vision image-capability check, and the first 8 keywords of each list. |
|
|
1021
|
+
| `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. Under the top-level table it names any session that is on `planning` because of a planning skill (`Planning skill trigger: <session> → <skill>`). Carries one update-available line when a newer release was found. |
|
|
1022
|
+
| `routes` | Role table (role, effective models, role `note`), the shared selection strategy, active mode, the auto-delegation level, the planning-skill list (`Planning skills: grill-me, grilling — …`, or `(disabled)`), 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. |
|
|
751
1023
|
| `usage` | Request and subagent counts per role/model across the whole process, including top-level turns. |
|
|
752
1024
|
| `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. |
|
|
1025
|
+
| `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. |
|
|
753
1026
|
|
|
754
1027
|
Both `report` and `usage` read **process-local in-memory state**: they answer for the current
|
|
755
1028
|
`dsh` process only, and a restart clears them. A subagent that finished before a restart
|
|
@@ -825,6 +1098,12 @@ The `reason` column is the outcome for that request:
|
|
|
825
1098
|
| `advisory (not applied)` | `advisory` mode classified the request but changed nothing; the model shown is the one actually used. |
|
|
826
1099
|
| `passthrough (role unconfigured)` | The role resolved to no route at all, so the request was returned unchanged. |
|
|
827
1100
|
|
|
1101
|
+
A planning-skill escalation adds **no reason string**: the row reads exactly as it would in plan
|
|
1102
|
+
mode — `applied`, or `explicit session selection (respected)` when a hand-picked composer model is
|
|
1103
|
+
running — and the skill is named on its own line under the table,
|
|
1104
|
+
`Planning skill trigger: <session> → <skill>`, which appears only for sessions that reached
|
|
1105
|
+
`planning` through a skill.
|
|
1106
|
+
|
|
828
1107
|
Verbatim example rows for the two reasons not shown above:
|
|
829
1108
|
|
|
830
1109
|
```text
|
|
@@ -929,7 +1208,7 @@ Vision role (image capability):
|
|
|
929
1208
|
|
|
930
1209
|
Delegation labels select the tier. The `description` you pass to a delegation
|
|
931
1210
|
becomes the child label, which the manager matches against (word-anchored):
|
|
932
|
-
vision : vision, visual, image, images, screenshot, screen shot, ocr,
|
|
1211
|
+
vision : vision, visual, image, images, screenshot, screen shot, ocr, diagram, …
|
|
933
1212
|
planning : plan, planning, design, architect, architecture, analyse, analyze, analysis, …
|
|
934
1213
|
else : execution
|
|
935
1214
|
```
|
|
@@ -995,7 +1274,9 @@ mistaken for a normal "no routes listed" state.
|
|
|
995
1274
|
## Tuning the classification
|
|
996
1275
|
|
|
997
1276
|
`strategy.visionKeywords` and `strategy.planningKeywords` are the whole classification
|
|
998
|
-
policy
|
|
1277
|
+
policy **for delegated work**. A subagent is classified by its label and nothing else; the
|
|
1278
|
+
top-level tier comes from plan mode and `strategy.planningSkills`, documented under
|
|
1279
|
+
[Planning skills](#planning-skills).
|
|
999
1280
|
|
|
1000
1281
|
- **An absent key uses the built-ins. An explicit `[]` disables that classifier.** That
|
|
1001
1282
|
is the only way to switch one off: `visionKeywords: []` sends every vision word to the
|
|
@@ -1007,15 +1288,20 @@ policy.
|
|
|
1007
1288
|
longer matches `"redesign"`, while `screenshot` still matches `"screenshots"` and the
|
|
1008
1289
|
multi-word `ui mock` still matches. It is not a full-word match, so `plan` still matches
|
|
1009
1290
|
`"planet"` and `render` still matches `"rendering"`. Prefer distinctive words.
|
|
1010
|
-
-
|
|
1291
|
+
- A leading `plan:` / `vision:` prefix is authoritative: it decides the tier before any
|
|
1292
|
+
keyword is consulted. Among keyword matches, vision is tested before planning, so a
|
|
1293
|
+
label matching both goes to `vision`.
|
|
1294
|
+
- The built-in vision list has no `figure` — "figure out the bug" is ordinary reasoning
|
|
1295
|
+
work, and a genuine figure-reading unit can say `vision: read figure 3`. Re-add it with
|
|
1296
|
+
`strategy.visionKeywords` if your labels read that way.
|
|
1011
1297
|
- Regex metacharacters in a keyword are escaped, so `pkg.io` or `a+b` match literally.
|
|
1012
1298
|
- The matchers are rebuilt on a saved Settings edit, so a keyword change applies live.
|
|
1013
1299
|
|
|
1014
1300
|
The built-in lists, used when a keyword list is absent:
|
|
1015
1301
|
|
|
1016
1302
|
```text
|
|
1017
|
-
vision (
|
|
1018
|
-
|
|
1303
|
+
vision (19): vision, visual, image, images, screenshot, screen shot, ocr, diagram,
|
|
1304
|
+
chart, plot, photo, picture, png, jpg, jpeg, webp, gif,
|
|
1019
1305
|
ui mock, render
|
|
1020
1306
|
planning (24): plan, planning, design, architect, architecture, analyse, analyze,
|
|
1021
1307
|
analysis, research, investigate, review, critique, strategy, reasoning,
|
|
@@ -1029,7 +1315,7 @@ and prints `(disabled)` for an explicitly emptied list:
|
|
|
1029
1315
|
```text
|
|
1030
1316
|
Delegation labels select the tier. The `description` you pass to a delegation
|
|
1031
1317
|
becomes the child label, which the manager matches against (word-anchored):
|
|
1032
|
-
vision : vision, visual, image, images, screenshot, screen shot, ocr,
|
|
1318
|
+
vision : vision, visual, image, images, screenshot, screen shot, ocr, diagram, …
|
|
1033
1319
|
planning : (disabled)
|
|
1034
1320
|
else : execution
|
|
1035
1321
|
```
|
|
@@ -1060,10 +1346,17 @@ Replace a list with the keywords you want, remembering that a patch override rep
|
|
|
1060
1346
|
```
|
|
1061
1347
|
|
|
1062
1348
|
The plugin also contributes a system-prompt section (name `model-manager`, order 60) that
|
|
1063
|
-
tells the delegating agent to
|
|
1064
|
-
work, `vision:` for image work, or leave it plain for execution
|
|
1349
|
+
tells the delegating agent to label a delegation description with `plan:` for thinking
|
|
1350
|
+
work, `vision:` for image work, or leave it plain for execution — a leading prefix winning
|
|
1351
|
+
over keyword matches — to leave `provider` and `model` unset so the role route applies
|
|
1352
|
+
(dropped under `advisory`), and it lists each role's
|
|
1065
1353
|
effective models (including a fallback). It is empty text when no role has any models, so
|
|
1066
|
-
the prompt is not padded with a description of routing that does nothing
|
|
1354
|
+
the prompt is not padded with a description of routing that does nothing; when only the
|
|
1355
|
+
planning tier is missing it says so, so a `plan:` label is never a silent no-op. When
|
|
1356
|
+
`planningSkills` is non-empty **and** the planning role has models, the same section adds one
|
|
1357
|
+
line saying that a top-level session which invoked one of those skills runs on the planning tier,
|
|
1358
|
+
like plan mode; with no models behind the tier it stays quiet rather than advertising a trigger
|
|
1359
|
+
that routes nowhere.
|
|
1067
1360
|
|
|
1068
1361
|
## How it stays safe
|
|
1069
1362
|
|
|
@@ -1103,10 +1396,27 @@ degrades to a notice or a log line.
|
|
|
1103
1396
|
shape change degrades to "unset" rather than a render error.
|
|
1104
1397
|
- **Every optional integration is probed and wrapped.** Plan mode, the agent list and
|
|
1105
1398
|
lineage, the parent's request header, subagent listing, the allow-list service, the
|
|
1106
|
-
model-capability lookup,
|
|
1399
|
+
model-capability lookup, the `sessionProjections` registry the planning-skill fold is read
|
|
1400
|
+
from, `tools` and `systemPrompt` are each reached through a guarded
|
|
1107
1401
|
accessor and a `try`/`catch`; a missing service means that feature is inert, not that the
|
|
1108
1402
|
plugin fails. The `agent/request` handler catches its own errors, logs one warning
|
|
1109
1403
|
(`routing skipped for one request: …`) and returns the request it was given, unchanged.
|
|
1404
|
+
The `agent/pre-step` observer is observe-only: it wraps its own scan in a `try`, never
|
|
1405
|
+
touches the decision it returns, and ignores a rejected step. Without the projection registry
|
|
1406
|
+
the skill trigger falls back to the in-process pre-step signal alone, so it stops surviving a
|
|
1407
|
+
restart; without either signal the session simply stays on `main`.
|
|
1408
|
+
- **The delegation policy cannot corrupt a prompt.** The section's text function is wrapped
|
|
1409
|
+
end-to-end and returns `''` on any failure — including a throwing `tools.get` — so the
|
|
1410
|
+
worst case is the pre-0.3.0 prompt with no policy, never a broken assembly. It renders
|
|
1411
|
+
only for depth-0 top-level agents that actually have the delegation tools, and reads the
|
|
1412
|
+
live config, so a volatile save changes it on the next request.
|
|
1413
|
+
- **The update check cannot disturb anything.** It starts ~10 s after boot (never on the
|
|
1414
|
+
boot path), runs behind a timeout and a coalescing guard, and every failure path lands
|
|
1415
|
+
in `updateState.status === 'error'` with a reason at info level — offline deployments log
|
|
1416
|
+
one line per interval, not a warning storm. It writes nothing, changes no routing, and a
|
|
1417
|
+
missing `fetch` is just another failed check. The client half's check is gated on
|
|
1418
|
+
`window.location`, browser-only, wrapped in the same `safely` discipline, and its timers
|
|
1419
|
+
(host side) are unref'd or cordis-effect-owned so a test process still exits.
|
|
1110
1420
|
- **`apply` never throws.** The whole body sits behind a backstop that logs
|
|
1111
1421
|
`failed to initialise; model routing is disabled: …` and returns, so a misconfiguration
|
|
1112
1422
|
degrades routing instead of preventing the harness from booting. Malformed configs
|
|
@@ -1122,13 +1432,18 @@ degrades to a notice or a log line.
|
|
|
1122
1432
|
so `readConfig` returns a `warnings` array and `apply` logs each entry at warn level:
|
|
1123
1433
|
`unknown config key "bogus" ignored`, `unknown role "nope" ignored`,
|
|
1124
1434
|
`unknown key "roles.planning.mispelled" ignored`, `unknown key "strategy.nope" ignored`,
|
|
1435
|
+
`unknown key "update.nope" ignored`,
|
|
1125
1436
|
and the route-level form with its `reasoningEffort` hint.
|
|
1126
1437
|
- **The pure helpers are exported for testing:** `name`, `Config`, `apply` plus
|
|
1127
|
-
`readConfig`, `applyRoute`, `effectiveRouteOf`
|
|
1438
|
+
`readConfig`, `applyRoute`, `effectiveRouteOf`, `parseVersion`, `compareVersions`,
|
|
1439
|
+
`installedVersion`, `profileHint`, `delegationPolicyText`, `skillNamesOfEvent` — the skill
|
|
1440
|
+
fold's whole recognizer, so the gesture, injection and `tool/call` paths are testable without
|
|
1441
|
+
a session — and the three default lists (vision keywords, planning keywords, planning skills).
|
|
1128
1442
|
- **It does not touch the subagent allow-list row**, precisely to avoid the duplicate
|
|
1129
1443
|
loader entry id that would abort startup.
|
|
1130
1444
|
- **The `model_manager` tool is read-only.** Its description says so and the
|
|
1131
|
-
implementation only reads state
|
|
1445
|
+
implementation only reads state — the `update` action forces a network check but writes
|
|
1446
|
+
nothing.
|
|
1132
1447
|
|
|
1133
1448
|
## Testing
|
|
1134
1449
|
|
|
@@ -1136,19 +1451,22 @@ degrades to a notice or a log line.
|
|
|
1136
1451
|
npm test
|
|
1137
1452
|
```
|
|
1138
1453
|
|
|
1139
|
-
Runs
|
|
1454
|
+
Runs eleven suites in child processes and aggregates the result — **949 assertions** at the time
|
|
1140
1455
|
of writing. Each suite also runs on its own: `node test/<name>.test.mjs`.
|
|
1141
1456
|
|
|
1142
1457
|
| Suite | Assertions | What it pins |
|
|
1143
1458
|
| --- | --- | --- |
|
|
1144
|
-
| `packaging.test.mjs` |
|
|
1145
|
-
| `routing.test.mjs` |
|
|
1146
|
-
| `
|
|
1147
|
-
| `
|
|
1148
|
-
| `
|
|
1459
|
+
| `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. |
|
|
1460
|
+
| `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. |
|
|
1461
|
+
| `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. |
|
|
1462
|
+
| `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. |
|
|
1463
|
+
| `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. |
|
|
1464
|
+
| `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. |
|
|
1465
|
+
| `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. |
|
|
1149
1466
|
| `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. |
|
|
1150
|
-
| `usage-projection.test.mjs` |
|
|
1467
|
+
| `usage-projection.test.mjs` | 43 | The projections this plugin registers — all three of them, `modelManagerUsage`, `modelManagerSelection` and since 0.5.0 `modelManagerPlanningSkill`, each asserted to be registered under its own key — and 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`). |
|
|
1151
1468
|
| `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. |
|
|
1469
|
+
| `planning-skills.test.mjs` | 100 | New in 0.5.0. The skill → top-level `planning` escalation, in eight blocks: the pure event fold `skillNamesOfEvent` over all three records — the `skill-invocation` injection, the `/name` gesture in direct user text, and a model's `skill` `tool/call` with JSON arguments — including the gesture-boundary rules, hostile payloads that record nothing and never throw, and the grammar pinned **byte-identical against the real `dsh-tool-skill`** when a DSH install resolves; `planningSkills` configuration (absent → `grill-me`/`grilling`, explicit `[]` honoured, lowercasing/trimming/de-duplication, invalid names dropped, volatile refs unwrapped, no unknown-key warning either way, and the schema union accepting an array / rejecting anything else); the `modelManagerPlanningSkill` projection (key, `stateVersion`, `init`, folding all three event shapes, mixed-case canonicalization, same-reference returns that suppress republishing, `.parse` rejecting junk); the **live** `agent/pre-step` signal — registered prepended, routing the FIRST request of a gesture step, stickiness across later turns, non-listed skills left on `main`, `[]` disabling it, the enter/reject decision returned by identity, a dozen hostile payloads, a subagent never escalated, `agent/disposed` dropping the live signal, a volatile reload of `[]` applying to the next request, and the info notice firing once per switch; the **durable** signal (a resumed session routing planning from a logged invocation, gesture, or model tool call, a durable name inert under `[]`, and no throw when the projection service is absent); plan mode keeping its own behaviour and owning the trigger when both apply; an explicit composer pick still winning the route while the row records role `planning`; and both diagnostic surfaces — the `Planning skills:` line in `routes` and the `Planning skill trigger:` line in `report`, each in its enabled and disabled form. |
|
|
1152
1470
|
|
|
1153
1471
|
The suites are plain Node scripts — no test framework, and no dependency beyond Node itself.
|
|
1154
1472
|
|
|
@@ -1174,6 +1492,13 @@ outside the repository.
|
|
|
1174
1492
|
- **Leading-boundary matching still matches word prefixes** (`plan` in `"planet"`,
|
|
1175
1493
|
`render` in `"rendering"`), and the first match wins with vision tested before planning.
|
|
1176
1494
|
Two classifier lists cannot express precedence beyond that.
|
|
1495
|
+
- **The planning-skill trigger is sticky, and there is no exit gesture.** Once a session invokes
|
|
1496
|
+
a listed skill it stays on `planning` for the rest of that session: the durable
|
|
1497
|
+
`modelManagerPlanningSkill` fold records what the session *invoked*, not what is currently in
|
|
1498
|
+
force, and it is append-only. Start a new session, or set `strategy.planningSkills: []`, to opt
|
|
1499
|
+
out. A skill the **model** invoked (through its `skill` tool) escalates only from the next
|
|
1500
|
+
request of that session onward — the `tool/call` event exists only once the model has emitted
|
|
1501
|
+
it, so the step that asked for the skill still runs on the route already chosen.
|
|
1177
1502
|
- **`hybrid` compares routes by value.** A child that deliberately names the same route as
|
|
1178
1503
|
the parent's effective route is indistinguishable from one that inherited it, and will
|
|
1179
1504
|
be rewritten to the role route.
|
|
@@ -1219,9 +1544,9 @@ outside the repository.
|
|
|
1219
1544
|
at 42 characters with `…`, and `"` becomes `'`.
|
|
1220
1545
|
- **`roles.<role>.note` affects only the `routes` table.** It is human annotation; no
|
|
1221
1546
|
routing decision, report or count reads it, and the boot log does not print it.
|
|
1222
|
-
- **`main` empty is the simplest policy, and now not the only one.** With `main: []` a
|
|
1223
|
-
|
|
1224
|
-
`hybrid`, a session whose model was picked by hand keeps it (see "`main` and the composer's
|
|
1547
|
+
- **`main` empty is the simplest policy, and now not the only one.** With `main: []` a top-level
|
|
1548
|
+
turn outside plan mode and outside a planning skill is never rewritten. With `main` configured
|
|
1549
|
+
under `hybrid`, a session whose model was picked by hand keeps it (see "`main` and the composer's
|
|
1225
1550
|
model picker") and only untouched sessions are rewritten; under `managed` every top-level
|
|
1226
1551
|
request is rewritten, chosen by hand or not.
|
|
1227
1552
|
- **The card can only pick what the catalog advertises.** A route the catalog stopped returning keeps its row and stays editable, labelled `(not advertised)`, but you cannot add such a route — or any model absent from the catalog — from the UI. Provider and model are never free text here, so a typo cannot be written into the config; use the patch layer for a route the host does not advertise.
|
|
@@ -1241,3 +1566,22 @@ outside the repository.
|
|
|
1241
1566
|
- **The card needs one restart after installing**, because the client-module boot manifest
|
|
1242
1567
|
caches package metadata per loader specifier until restart. Before that the Settings entry is
|
|
1243
1568
|
simply absent.
|
|
1569
|
+
- **The delegation policy is a prompt, not an enforcement.** `strategy.autoDelegate` changes
|
|
1570
|
+
what the top-level agent is *told*; it cannot make a model delegate, and a strong-willed
|
|
1571
|
+
model can still do the work itself. `eager` is the stronger instruction, not a guarantee.
|
|
1572
|
+
A label is likewise overridable: under `hybrid`, a delegation that names `provider`/`model`
|
|
1573
|
+
keeps that route — which is why the policy now tells the agent to leave those unset on
|
|
1574
|
+
`plan:`/`vision:` units, but it cannot stop a model that insists on naming one. The policy
|
|
1575
|
+
also disappears silently if the harness's subagent tool is renamed
|
|
1576
|
+
(`toolName` in `dsh-tool-subagent` config), because the text function only names tools it
|
|
1577
|
+
can resolve in scope.
|
|
1578
|
+
- **The update check sees `dist-tags.latest`, nothing else.** It compares against the
|
|
1579
|
+
`latest` tag on the configured registry, so a newer prerelease (or a `next` tag) is
|
|
1580
|
+
invisible, and an intranet mirror that lags npm will keep reporting "up to date" after a
|
|
1581
|
+
release. The browser banner additionally needs the registry to answer CORS — npmjs and
|
|
1582
|
+
npmmirror do; one that does not simply leaves the client-side surfaces empty while the
|
|
1583
|
+
host log and the tool action still report.
|
|
1584
|
+
- **The client banner's "installed" version is the pinned constant.** The browser cannot
|
|
1585
|
+
read `package.json`, so `client.js` pins `VERSION` and a packaging test keeps it equal;
|
|
1586
|
+
a hand-edited checkout that bumps only one side will show a self-inconsistent banner
|
|
1587
|
+
(which the same test refuses to let the repo ship).
|