@darkbear9494/dsh-model-manager 0.5.0 → 0.6.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 +79 -16
- package/client.js +1 -1
- package/lib/index.js +115 -0
- package/package.json +5 -3
- package/skills/autoplan/SKILL.md +34 -0
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@ Since 0.4.0 the delegation label is a contract, not a hint: a leading `plan:`/`v
|
|
|
10
10
|
decides the tier outright, and each role's failover chain wears down on its own. Since 0.5.0 the
|
|
11
11
|
*session* can also pick its own tier: invoking a thinking skill — `grilling`, or the `grill-me`
|
|
12
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.
|
|
13
|
+
exactly as plan mode does. Since 0.6.0 it ships one skill of its own: **`/autoplan`** turns the two
|
|
14
|
+
tiers into a workflow — the plan is designed by a `plan:`-labelled fork on the planning model, and
|
|
15
|
+
the main model implements the returned plan immediately, without stopping for approval.
|
|
14
16
|
|
|
15
17
|
## What it is
|
|
16
18
|
|
|
@@ -38,9 +40,12 @@ mode: a session that invoked one of the skills listed in `strategy.planningSkill
|
|
|
38
40
|
`['grill-me', 'grilling']`) runs on the planning role's models for the rest of its life, whether
|
|
39
41
|
the intent arrived as a `/grilling` gesture in user text, as the harness's skill injection, or as
|
|
40
42
|
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.
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
survives a restart, a resume and a fork. 0.6.0 adds a second, complementary skill: `/autoplan`
|
|
44
|
+
plans on the planning tier and implements on `main` in the same turn, with no approval gate in
|
|
45
|
+
between — the label-driven tiers become a workflow instead of a setting. It is still deliberately
|
|
46
|
+
small: one ESM host file, one config schema, one bundled skill body, and one hand-written client
|
|
47
|
+
file that contributes a configuration card to the Plugins page. There is no build step for either
|
|
48
|
+
half.
|
|
44
49
|
|
|
45
50
|
## Install
|
|
46
51
|
|
|
@@ -102,13 +107,12 @@ version and updates the dependency in place.
|
|
|
102
107
|
|
|
103
108
|
### The registry copy
|
|
104
109
|
|
|
105
|
-
`@darkbear9494/dsh-model-manager@0.
|
|
106
|
-
access, the same 8 files as 0.2.0 (the tarball grew, not the file list: the
|
|
107
|
-
half and this README carry the new sections).
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`
|
|
111
|
-
packed 63.1 kB with the same 8 files, and 0.1.0, the first publish, 62.3 kB. The declared gate is
|
|
110
|
+
`@darkbear9494/dsh-model-manager@0.5.0` is the current release on the registry (published
|
|
111
|
+
2026-10-25), public access, the same 8 files as 0.2.0 (the tarball grew, not the file list: the
|
|
112
|
+
host half, the client half and this README carry the new sections). It packs 92.1 kB (292.2 kB
|
|
113
|
+
unpacked) with those 8 files; 0.2.0 packed 63.1 kB, and 0.1.0, the first publish, 62.3 kB. 0.6.0
|
|
114
|
+
is the first release with a bundled skill, so it adds a ninth file —
|
|
115
|
+
`skills/autoplan/SKILL.md` — and packs 97.1 kB (306.5 kB unpacked). The declared gate is
|
|
112
116
|
`>=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
117
|
exemption.
|
|
114
118
|
|
|
@@ -649,6 +653,58 @@ you hand-picked in the composer still serves the session: the report row shows r
|
|
|
649
653
|
with reason `explicit session selection (respected)` and your route, exactly as it does in plan
|
|
650
654
|
mode. There is no exit gesture — start a new session, or set `planningSkills: []`.
|
|
651
655
|
|
|
656
|
+
### The `/autoplan` skill
|
|
657
|
+
|
|
658
|
+
`grilling` makes a session *think* on the planning tier; `/autoplan` makes it *think and then act*
|
|
659
|
+
without a review step. It is a **bundled skill**: the plugin registers it as a DSH runtime skill
|
|
660
|
+
through `ctx.skills.register` at startup, so installing the plugin is the whole install. Typing
|
|
661
|
+
`/autoplan <task>` in a session injects its body exactly like `dsh-tool-skill` injects any other
|
|
662
|
+
skill (the host recognises the `/name` gesture in direct user text, and the skill is
|
|
663
|
+
`userInvocable`); a model can also load it through the `skill` tool when the user asks to
|
|
664
|
+
plan-and-implement in one shot. The body ships as `skills/autoplan/SKILL.md`, read once at apply
|
|
665
|
+
time.
|
|
666
|
+
|
|
667
|
+
**The two phases use the two tiers, not a model swap mid-session:**
|
|
668
|
+
|
|
669
|
+
| Phase | Who runs it | Which model |
|
|
670
|
+
| --- | --- | --- |
|
|
671
|
+
| Plan | one `subagent_fork` the top-level agent dispatches, description `plan: design the implementation plan for <task>` | the `planning` role — the `plan:` label is the existing contract |
|
|
672
|
+
| Implement | the top-level session itself (or plain execution-tier units, per the delegation policy) | the `main` role |
|
|
673
|
+
|
|
674
|
+
The fork inherits the conversation, so the planner starts with every fact the main model already
|
|
675
|
+
gathered; it returns a decision-complete plan (goal, success criteria, changes by subsystem,
|
|
676
|
+
edge cases, tests, assumptions). The main model then implements it and reports what changed,
|
|
677
|
+
what it ran, and which assumptions it made on the user's behalf. The skill explicitly forbids
|
|
678
|
+
the things that would turn this into an approval flow: no `ask_user_question` to approve the
|
|
679
|
+
plan, no entering or exiting plan mode, no waiting. `autoplan` is deliberately **not** in
|
|
680
|
+
`strategy.planningSkills` — that list pins the whole session to the planning tier, while here the
|
|
681
|
+
top level must end up on `main` to implement.
|
|
682
|
+
|
|
683
|
+
**Why not switch the session's own model?** That was the other design: escalate the session to
|
|
684
|
+
`planning` on the gesture, then demote it when the plan is done. It needs a phase state machine,
|
|
685
|
+
a durable projection to survive restart, and a demotion trigger the manager cannot actually
|
|
686
|
+
observe — it would depend on the model remembering to call a marker tool, and a model that
|
|
687
|
+
forgets it leaves the whole session stuck on the expensive tier. Routing on the delegation label
|
|
688
|
+
already switches models per unit, and a fork carries the full conversation, so the two-phase
|
|
689
|
+
workflow needs no new state at all.
|
|
690
|
+
|
|
691
|
+
**Boundaries.** `/autoplan` skips *plan review*, not safety: approval prompts for risky
|
|
692
|
+
operations, sandbox limits and destructive-operation confirmations still apply, and the body says
|
|
693
|
+
so. Inside plan mode the plan-mode rules win — there the plan still goes through `exit_plan_mode`.
|
|
694
|
+
If the planning role has no models, the `plan:` unit simply keeps the inherited route and the flow
|
|
695
|
+
still runs. If `subagent_fork` is not in scope, the body falls back to plain `subagent` with a
|
|
696
|
+
self-contained prompt.
|
|
697
|
+
|
|
698
|
+
**Overrides and degradation.** The built-in copy is a runtime skill at DSH's runtime rank (250):
|
|
699
|
+
a project-level `.dsh/skills/autoplan/SKILL.md` (rank 100) or `.agents/skills/autoplan/` (200)
|
|
700
|
+
overrides it, but a `~/.dsh/skills/autoplan/` copy (rank 400) does **not** — that precedence is
|
|
701
|
+
DSH's, and it is the one surprising part of customising this skill. Registration is optional and
|
|
702
|
+
never load-bearing: no skills service in the composition, a throwing `register()`, or a missing or
|
|
703
|
+
malformed `SKILL.md` all degrade to a logged warning, and `model_manager(action: "routes")` prints
|
|
704
|
+
an `Autoplan skill: registered` / `not registered (…)` line so you can tell which case you are in.
|
|
705
|
+
Registering the skill is not routing: it happens even with `enabled: false`, where only the model
|
|
706
|
+
switch stops.
|
|
707
|
+
|
|
652
708
|
### The vision → execution fallback
|
|
653
709
|
|
|
654
710
|
If `vision.models` is empty when a vision request is routed, the plugin serves it from the
|
|
@@ -1397,9 +1453,9 @@ degrades to a notice or a log line.
|
|
|
1397
1453
|
- **Every optional integration is probed and wrapped.** Plan mode, the agent list and
|
|
1398
1454
|
lineage, the parent's request header, subagent listing, the allow-list service, the
|
|
1399
1455
|
model-capability lookup, the `sessionProjections` registry the planning-skill fold is read
|
|
1400
|
-
from, `tools` and `
|
|
1401
|
-
accessor and a `try`/`catch`; a missing service means
|
|
1402
|
-
plugin fails. The `agent/request` handler catches its own errors, logs one warning
|
|
1456
|
+
from, `tools`, `systemPrompt` and the `skills` registry the `/autoplan` skill is registered
|
|
1457
|
+
on are each reached through a guarded accessor and a `try`/`catch`; a missing service means
|
|
1458
|
+
that feature is inert, not that the plugin fails. The `agent/request` handler catches its own errors, logs one warning
|
|
1403
1459
|
(`routing skipped for one request: …`) and returns the request it was given, unchanged.
|
|
1404
1460
|
The `agent/pre-step` observer is observe-only: it wraps its own scan in a `try`, never
|
|
1405
1461
|
touches the decision it returns, and ignores a rejected step. Without the projection registry
|
|
@@ -1451,12 +1507,12 @@ degrades to a notice or a log line.
|
|
|
1451
1507
|
npm test
|
|
1452
1508
|
```
|
|
1453
1509
|
|
|
1454
|
-
Runs
|
|
1510
|
+
Runs twelve suites in child processes and aggregates the result — **993 assertions** at the time
|
|
1455
1511
|
of writing. Each suite also runs on its own: `node test/<name>.test.mjs`.
|
|
1456
1512
|
|
|
1457
1513
|
| Suite | Assertions | What it pins |
|
|
1458
1514
|
| --- | --- | --- |
|
|
1459
|
-
| `packaging.test.mjs` |
|
|
1515
|
+
| `packaging.test.mjs` | 37 | 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
1516
|
| `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
1517
|
| `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
1518
|
| `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. |
|
|
@@ -1466,6 +1522,7 @@ of writing. Each suite also runs on its own: `node test/<name>.test.mjs`.
|
|
|
1466
1522
|
| `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. |
|
|
1467
1523
|
| `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`). |
|
|
1468
1524
|
| `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. |
|
|
1525
|
+
| `autoplan-skill.test.mjs` | 42 | New in 0.6.0. The bundled `/autoplan` skill: the pure frontmatter parser (`parseSkillMarkdown`) accepting exactly a well-formed SKILL.md — CRLF, edge-trimming, a `---` line inside the body preserved, a `name:` line in the body not mistaken for frontmatter — and returning `undefined` for a missing/unclosed fence, an empty body, an empty description, an invalid name, and every hostile input without throwing; the shipped definition satisfying the runtime contract `dsh-skill` validates on `get()` (kebab name, non-empty description/content, both invocation flags, a string source) and its body carrying the load-bearing instructions (the `plan:`-labelled `subagent_fork`, the no-approval rule, the plan-mode boundary, the `subagent` fallback, the main-tier implementation phase) so it cannot be silently gutted; registration through a mock skills service — exactly once, the shipped definition, an info log naming the skill — and every degradation: a throwing `register()` and a composition with no skills service both leave `apply()` working with a warning, and `routes()` distinguishing registered from not; registration independent of `config.enabled`; and the routing invariant that `/autoplan` is not a planning skill — a top-level session that invoked it stays on the `main` tier, with `/grilling` as the escalating control. The packaging suite additionally pins that `skills/` is in `files` and the body ships. |
|
|
1469
1526
|
| `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. |
|
|
1470
1527
|
|
|
1471
1528
|
The suites are plain Node scripts — no test framework, and no dependency beyond Node itself.
|
|
@@ -1499,6 +1556,12 @@ outside the repository.
|
|
|
1499
1556
|
out. A skill the **model** invoked (through its `skill` tool) escalates only from the next
|
|
1500
1557
|
request of that session onward — the `tool/call` event exists only once the model has emitted
|
|
1501
1558
|
it, so the step that asked for the skill still runs on the route already chosen.
|
|
1559
|
+
- **`/autoplan` is a workflow, not enforcement.** The body is injected as instructions, so the
|
|
1560
|
+
model decides how faithfully to follow it: nothing forces the fork, and nothing stops a model
|
|
1561
|
+
from asking a question anyway. What the plugin does guarantee is the tiers — the `plan:` label
|
|
1562
|
+
routes the planning fork, and the top-level session stays on `main` because `autoplan` is not in
|
|
1563
|
+
`planningSkills`. A project-level skill file of the same name overrides the bundled body
|
|
1564
|
+
entirely (see the override note above).
|
|
1502
1565
|
- **`hybrid` compares routes by value.** A child that deliberately names the same route as
|
|
1503
1566
|
the parent's effective route is indistinguishable from one that inherited it, and will
|
|
1504
1567
|
be rewritten to the role route.
|
package/client.js
CHANGED
|
@@ -64,7 +64,7 @@ window.__ModuleLoader__.load({
|
|
|
64
64
|
* test/packaging.test.mjs pins it equal to package.json, so a release that
|
|
65
65
|
* forgets to bump both fails the suite instead of shipping a wrong banner.
|
|
66
66
|
*/
|
|
67
|
-
const VERSION = '0.
|
|
67
|
+
const VERSION = '0.6.0';
|
|
68
68
|
/**
|
|
69
69
|
* Registry path of this package. The scoped name is percent-encoded the
|
|
70
70
|
* way npm serves scoped packuments.
|
package/lib/index.js
CHANGED
|
@@ -242,6 +242,74 @@ function skillNamesOfEvent(event) {
|
|
|
242
242
|
return [];
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Body of the bundled `/autoplan` skill, shipped beside this file.
|
|
247
|
+
*
|
|
248
|
+
* The skill is registered as a DSH runtime skill (`ctx.skills.register`) so
|
|
249
|
+
* that installing this plugin is the whole install: the user types
|
|
250
|
+
* `/autoplan <task>` and the harness injects the body like any other skill.
|
|
251
|
+
* The body is read at apply time with the same self-package read the version
|
|
252
|
+
* check already uses, so a bad install degrades to "skill not registered".
|
|
253
|
+
*/
|
|
254
|
+
const AUTOPLAN_SKILL_URL = new URL('../skills/autoplan/SKILL.md', import.meta.url);
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Parse a SKILL.md document's frontmatter and body. Pure.
|
|
258
|
+
*
|
|
259
|
+
* Deliberately minimal: the frontmatter must open the document with a `---`
|
|
260
|
+
* line, close on a `---` line, and declare single-line `name:` and
|
|
261
|
+
* `description:` values. Anything else — a missing fence, an invalid name, an
|
|
262
|
+
* empty description or an empty body — yields `undefined`, and the caller
|
|
263
|
+
* degrades to "not registered" instead of registering a malformed skill.
|
|
264
|
+
* CRLF is tolerated so a Windows checkout still loads.
|
|
265
|
+
*/
|
|
266
|
+
function parseSkillMarkdown(text) {
|
|
267
|
+
if (typeof text !== 'string') return undefined;
|
|
268
|
+
const source = text.replace(/\r\n?/g, '\n');
|
|
269
|
+
if (!source.startsWith('---\n')) return undefined;
|
|
270
|
+
let fence = source.indexOf('\n---', 4);
|
|
271
|
+
while (fence !== -1 && fence + 4 < source.length && source[fence + 4] !== '\n') {
|
|
272
|
+
fence = source.indexOf('\n---', fence + 1);
|
|
273
|
+
}
|
|
274
|
+
if (fence === -1) return undefined;
|
|
275
|
+
const frontmatter = source.slice(4, fence);
|
|
276
|
+
// Trim both edges: a body that opens with spaces would render as a Markdown
|
|
277
|
+
// code block in the harness's `<skill_instructions>` wrapper. Interior
|
|
278
|
+
// whitespace is preserved (it carries the document's structure).
|
|
279
|
+
const content = source.slice(fence + 4).trim();
|
|
280
|
+
const name = /^name:\s*(.*)$/m.exec(frontmatter)?.[1]?.trim() ?? '';
|
|
281
|
+
const description = /^description:\s*(.*)$/m.exec(frontmatter)?.[1]?.trim() ?? '';
|
|
282
|
+
if (!SKILL_NAME.test(name) || description === '' || content === '') return undefined;
|
|
283
|
+
return { name, description, content };
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The runtime skill definition for `/autoplan`, or `undefined`.
|
|
288
|
+
*
|
|
289
|
+
* Shape is what `@deepseek-ai/dsh-skill`'s `register()` accepts: the body
|
|
290
|
+
* rides `content`, `source` is the display origin (this is a bundled provider,
|
|
291
|
+
* matching the harness's own `bundled` skills), and both invocation flags are
|
|
292
|
+
* on — a person can type `/autoplan`, and a model can load it through the
|
|
293
|
+
* `skill` tool when the user asks for "plan and implement in one shot".
|
|
294
|
+
*/
|
|
295
|
+
function autoplanSkillDefinition() {
|
|
296
|
+
let text;
|
|
297
|
+
try {
|
|
298
|
+
text = readFileSync(AUTOPLAN_SKILL_URL, 'utf8');
|
|
299
|
+
} catch {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
const parsed = parseSkillMarkdown(text);
|
|
303
|
+
if (parsed === undefined) return undefined;
|
|
304
|
+
return {
|
|
305
|
+
name: parsed.name,
|
|
306
|
+
description: parsed.description,
|
|
307
|
+
content: parsed.content,
|
|
308
|
+
source: 'bundled',
|
|
309
|
+
invocation: { modelInvocable: true, userInvocable: true },
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
245
313
|
// ---------------------------------------------------------------------------
|
|
246
314
|
// Config
|
|
247
315
|
// ---------------------------------------------------------------------------
|
|
@@ -966,6 +1034,13 @@ function createEngine(initialConfig, ctx, log, rawConfig) {
|
|
|
966
1034
|
*/
|
|
967
1035
|
let toolsService;
|
|
968
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* Whether the bundled `/autoplan` runtime skill was registered. Surfaced by
|
|
1039
|
+
* the `routes` action so an operator can tell "the skill exists" from "this
|
|
1040
|
+
* composition has no skills service, or the shipped SKILL.md is broken".
|
|
1041
|
+
*/
|
|
1042
|
+
let autoplanRegistered = false;
|
|
1043
|
+
|
|
969
1044
|
/**
|
|
970
1045
|
* Latest update-check outcome. Statuses: `idle` (not yet checked), `checking`,
|
|
971
1046
|
* `ok` (up to date), `available` (a newer release exists), `error` (the check
|
|
@@ -2032,6 +2107,12 @@ function createEngine(initialConfig, ctx, log, rawConfig) {
|
|
|
2032
2107
|
: `${config.strategy.planningSkills.join(', ')} — a top-level session that invoked one routes as `
|
|
2033
2108
|
+ 'planning for the rest of the session, like plan mode'}`,
|
|
2034
2109
|
'',
|
|
2110
|
+
`Autoplan skill: ${autoplanRegistered
|
|
2111
|
+
? 'registered — `/autoplan` plans on the planning tier and implements on `main` '
|
|
2112
|
+
+ 'without an approval gate'
|
|
2113
|
+
: 'not registered (no skills service in this composition, or skills/autoplan/SKILL.md '
|
|
2114
|
+
+ 'is missing or invalid in this install)'}`,
|
|
2115
|
+
'',
|
|
2035
2116
|
allowListBlock(),
|
|
2036
2117
|
'',
|
|
2037
2118
|
visionBlock,
|
|
@@ -2521,6 +2602,38 @@ function createEngine(initialConfig, ctx, log, rawConfig) {
|
|
|
2521
2602
|
log('warn', `system prompt section not registered: ${error?.message ?? error}`);
|
|
2522
2603
|
}
|
|
2523
2604
|
});
|
|
2605
|
+
|
|
2606
|
+
// The bundled `/autoplan` skill. Registration is a workflow concern, not
|
|
2607
|
+
// routing: it is deliberately independent of `config.enabled`, because a
|
|
2608
|
+
// manager that is observing only still ships the plan-then-implement
|
|
2609
|
+
// gesture, it simply stops moving the planning fork onto another model.
|
|
2610
|
+
// A composition without the skills service never runs this callback at
|
|
2611
|
+
// all, and every failure inside degrades to a warning.
|
|
2612
|
+
ctx.inject(['skills'], (scoped) => {
|
|
2613
|
+
try {
|
|
2614
|
+
const skills = scoped?.skills;
|
|
2615
|
+
if (skills === undefined || typeof skills.register !== 'function') {
|
|
2616
|
+
log('warn', 'the skills service is present but exposes no register(); /autoplan is unavailable');
|
|
2617
|
+
return;
|
|
2618
|
+
}
|
|
2619
|
+
const register = () => {
|
|
2620
|
+
const definition = autoplanSkillDefinition();
|
|
2621
|
+
if (definition === undefined) {
|
|
2622
|
+
log('warn', '/autoplan skill not registered: skills/autoplan/SKILL.md is missing or invalid');
|
|
2623
|
+
return () => {};
|
|
2624
|
+
}
|
|
2625
|
+
const dispose = skills.register(definition);
|
|
2626
|
+
autoplanRegistered = true;
|
|
2627
|
+
log('info', `registered the /autoplan skill — ${definition.description}`);
|
|
2628
|
+
return typeof dispose === 'function' ? dispose : () => {};
|
|
2629
|
+
};
|
|
2630
|
+
if (typeof scoped.effect === 'function') scoped.effect(register);
|
|
2631
|
+
else register();
|
|
2632
|
+
} catch (error) {
|
|
2633
|
+
autoplanRegistered = false;
|
|
2634
|
+
log('warn', `/autoplan skill not registered: ${error?.message ?? error}`);
|
|
2635
|
+
}
|
|
2636
|
+
});
|
|
2524
2637
|
}
|
|
2525
2638
|
|
|
2526
2639
|
// Boot diagnostic: tell the operator about role routes the delegation tool
|
|
@@ -2618,6 +2731,8 @@ export {
|
|
|
2618
2731
|
profileHint,
|
|
2619
2732
|
delegationPolicyText,
|
|
2620
2733
|
skillNamesOfEvent,
|
|
2734
|
+
parseSkillMarkdown,
|
|
2735
|
+
autoplanSkillDefinition,
|
|
2621
2736
|
DEFAULT_PLANNING_KEYWORDS,
|
|
2622
2737
|
DEFAULT_PLANNING_SKILLS,
|
|
2623
2738
|
DEFAULT_VISION_KEYWORDS,
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkbear9494/dsh-model-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Role-based model manager for DeepSeek Harness: assign models to planning, execution, vision and main roles, route subagent work by role, escalate sessions that invoke a planning skill (grilling / grill-me) to the planning role, report which model every subagent used, prompt the top-level agent to delegate, and check npm for updates.",
|
|
5
|
+
"description": "Role-based model manager for DeepSeek Harness: assign models to planning, execution, vision and main roles, route subagent work by role, escalate sessions that invoke a planning skill (grilling / grill-me) to the planning role, report which model every subagent used, prompt the top-level agent to delegate, ship a /autoplan skill that plans on the planning tier then implements on main without stopping for approval, and check npm for updates.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"dsh",
|
|
9
9
|
"dsh-plugin",
|
|
10
|
+
"autoplan",
|
|
10
11
|
"deepseek-harness",
|
|
11
12
|
"cordis",
|
|
12
13
|
"model-routing",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
},
|
|
35
36
|
"meta": {
|
|
36
37
|
"title": "Model manager",
|
|
37
|
-
"description": "Assign models to planning, execution, vision and main roles, see which model each subagent used, auto-delegate, and get update notices."
|
|
38
|
+
"description": "Assign models to planning, execution, vision and main roles, see which model each subagent used, auto-delegate, run /autoplan (plan on the planning tier, then implement on main without an approval gate), and get update notices."
|
|
38
39
|
},
|
|
39
40
|
"exports": {
|
|
40
41
|
".": "./lib/index.js",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"client.js",
|
|
48
49
|
"locale/*.json",
|
|
49
50
|
"cordis.patch.yml",
|
|
51
|
+
"skills",
|
|
50
52
|
"README.md"
|
|
51
53
|
],
|
|
52
54
|
"peerDependencies": {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autoplan
|
|
3
|
+
description: Plan on the stronger planning tier, then implement immediately on the main tier without an approval gate. Use when the user invokes /autoplan, or asks to plan-and-implement in one shot instead of reviewing the plan first.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Work the request in two phases, back to back. Do not pause between them.
|
|
7
|
+
|
|
8
|
+
## Phase 1 — Plan (planning tier)
|
|
9
|
+
|
|
10
|
+
Gather the facts you need first — files, commands, docs. Never ask the user for anything you can look up yourself.
|
|
11
|
+
|
|
12
|
+
Dispatch the plan design as one delegation:
|
|
13
|
+
|
|
14
|
+
- Call `subagent_fork` with the description `plan: design the implementation plan for <short task name>`. The `plan:` prefix routes this unit to the planning tier's more capable model, and the fork inherits this conversation, so the planner already has the full context.
|
|
15
|
+
- Ask it for a decision-complete plan: the goal and success criteria, the changes grouped by file or subsystem, schema/API/data-flow impact, edge cases and failure modes, the tests to add or run, and explicit assumptions where the request was ambiguous.
|
|
16
|
+
- If `subagent_fork` is not available to you, use `subagent` with the same `plan:` description and a self-contained prompt carrying every fact the planner needs.
|
|
17
|
+
- If you are already running as a delegated subagent, do not delegate again: write the plan yourself in a few lines and move on.
|
|
18
|
+
|
|
19
|
+
Do not ask the user to approve, review, or adjust the plan. Do not enter plan mode for this, and never route it through `exit_plan_mode` — the whole point is that implementation does not wait on sign-off.
|
|
20
|
+
|
|
21
|
+
If the delegation fails or comes back empty, retry once. If it still fails, write a short plan yourself and continue. Never stall waiting for a plan.
|
|
22
|
+
|
|
23
|
+
## Phase 2 — Implement (main tier)
|
|
24
|
+
|
|
25
|
+
Start implementing the moment the plan comes back.
|
|
26
|
+
|
|
27
|
+
- Do not ask for confirmation or permission, and do not ask the user to choose between options you can decide yourself. Make the sensible choice, record the assumption, and carry on. The user can correct course on the result.
|
|
28
|
+
- Implement it yourself, or dispatch independent parts as plain (execution-tier) units per the active delegation policy. Label only image, screenshot, or OCR work with `vision:`.
|
|
29
|
+
- Follow the plan as written. Where reality forces a deviation, deviate minimally and note it.
|
|
30
|
+
- Keep the harness's normal safety surface: approval prompts for risky operations, sandbox limits, and destructive-operation confirmations are not part of what this skill skips. Only plan review is.
|
|
31
|
+
|
|
32
|
+
## Finish
|
|
33
|
+
|
|
34
|
+
Report what was implemented, the checks or tests you ran and their results, any deviation from the plan, and the assumptions the plan made on the user's behalf.
|