@ljwei-stak/dsh-model-router 0.22.1 → 0.23.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.23.0 — 2026-10-23
4
+
5
+ - Return an observable Host job when a workbench execution starts. Show elapsed time, the current work package and per-package states, with status reads and cancellation through the typed desktop gateway.
6
+ - Propagate cancellation to API streams and official CLI teams, wait for execution cleanup, retain completed results and reported usage, and prevent cancelled editable worktrees from starting integration. Closing the panel does not cancel execution.
7
+ - Keep preview and permission checks before job acceptance, preserve legacy synchronous execution helpers, and cover job lifecycles, gateway boundaries, cancellation accounting and UI races with offline fixtures.
8
+
9
+ - Preserve the incomplete-history budget marker when a corrupt-state recovery fails before a later read or write commits its pending notice, so missing charge history cannot become a zero-spend assumption.
10
+
11
+ ## 0.22.2 — 2026-10-19
12
+
13
+ - Render the README's mathematical symbols and expressions in running prose as inline math in both languages, while retaining code formatting for actual API fields. Keep ordinary display equations on one line.
14
+ - Write the routing weights, quality floors and other decimal values with a leading zero throughout both READMEs, without changing their values.
15
+ - Extend the README checks to inline formula pairing, mathematical symbols accidentally formatted as code, and omitted decimal zeros. Actual-page acceptance covers complete explanatory paragraphs and the weight table in addition to display formulas.
16
+
3
17
  ## 0.22.1 — 2026-10-19
4
18
 
5
19
  - Render the English and Chinese README accounting, planning, latency and assignment formulas with GitHub math fences instead of plain text code blocks. Keep ordinary equations on one line using short symbols explained in prose; reserve line breaks for the latency function's conditions. Escape currency dollar signs and document the historical P90 latency branch already used by the router.
package/README.i18n.yaml CHANGED
@@ -1,4 +1,4 @@
1
1
  # README translation pairing for this repository.
2
2
  # Reviewed together; Git blob hashes identify the exact synchronized texts.
3
- README.md: f0c518807e357f4d3637224a437b417e99698d63
4
- README.zh.md: b1b0fee72beefd31cdb4085ee4902dd4b899b21d
3
+ README.md: da3995c07c716f6ac776b93e0753c67afd4e5057
4
+ README.zh.md: fa5f947d45c7473c4ec9fed6670f37b797a39ff5
package/README.md CHANGED
@@ -2,15 +2,53 @@
2
2
 
3
3
  [English](README.md) · [简体中文](README.zh.md)
4
4
 
5
+ [![npm version](https://flat.badgen.net/npm/v/@ljwei-stak/dsh-model-router)](https://www.npmjs.com/package/@ljwei-stak/dsh-model-router) [![dshfind](https://dshfind.com/api/badge/alice-marx/dsh-model-router)](https://dshfind.com/en/plugins/alice-marx/dsh-model-router?ref=badge) [![Listed in the DSH plugin directory](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/alice-marx/dsh-model-router) [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
6
+
7
+ [![dshfind](https://dshfind.com/api/card/Alice-Marx/dsh-model-router)](https://dshfind.com/en/plugins/Alice-Marx/dsh-model-router?ref=badge)
8
+
9
+ Want release notes only? Click **Watch → Custom → Releases** (you do not need Watching all activity).
10
+
5
11
  A cost-aware model-routing workbench for **DeepSeek Harness Desktop**. Plan locally, compare configured routes, inspect execution permissions, and run dependent work packages through model APIs or supported official vendor CLIs.
6
12
 
7
- Current version: **0.22.1** (`@ljwei-stak/dsh-model-router`). Choose algorithm recommendations or manually assign each decomposed package to an exact model API or official tool, preserving dependencies, refreshed cost previews and retry targets. Routing now supports task-specific quality evidence, joint model/effort selection, historical P90 resource estimates and dependency-aware search. Manual mixed execution is read-only; tools use their configured default model, while the existing editable official-team workflow remains available. Compatibility remains **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**, including Hermes/Pi installation and terminal support; neither has a verified managed runner yet. Real vendor execution evidence remains tied to **0.20.0**, with no new model experiments in this release. The router and [GAL](https://github.com/Alice-Marx/deepseek-harness-galgame) have been independent plugins since 0.12.0.
13
+ Current version: **0.23.0** (`@ljwei-stak/dsh-model-router`). Workbench execution now shows live elapsed time and per-package progress, supports cancellation with completed results and reported costs retained, and reconnects to the active job when the panel is reopened. Choose algorithm recommendations or manually assign each decomposed package to an exact model API or official tool, preserving dependencies, refreshed cost previews and retry targets. Routing now supports task-specific quality evidence, joint model/effort selection, historical P90 resource estimates and dependency-aware search. Manual mixed execution is read-only; tools use their configured default model, while the existing editable official-team workflow remains available. Compatibility remains **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**, including Hermes/Pi installation and terminal support; neither has a verified managed runner yet. Real vendor execution evidence remains tied to **0.20.0**, with no new model experiments in this release. The router and [GAL](https://github.com/Alice-Marx/deepseek-harness-galgame) have been independent plugins since 0.12.0.
8
14
 
9
15
  Official CLI teamwork runs packages sequentially with dependency context and no automatic model-directory API fallback. Editable teams explicitly choose the Harness sandbox or the vendor CLI's normal environment. In the latter, Git worktrees collect edits but do not restrict OS access. CLIs retain their configured model unless explicitly mapped. See [real Windows validation and its limits](docs/releases/0.20.0-validation.md).
10
16
 
11
17
  Both README versions describe the same interfaces, formulas, defaults and limits. [Changelog](CHANGELOG.md) preserves release history. More walkthroughs: [workbench](docs/WORKBENCH_USER_GUIDE.zh.md), [installation](docs/INSTALLATION_GUIDE.zh.md), [migration](docs/archive/MIGRATION.md), and [experiment protocol](docs/ROUTING_SELFTEST_STEPS.zh.md).
12
18
 
13
- **Contents:** [Capabilities](#capabilities) · [Install](#install) · [Workbench](#workbench) · [Architecture](#architecture) · [Session tools](#session-tools) · [Official tools](#official-tools) · [Team lifecycle](#team-lifecycle) · [Costs](#costs) · [Routing algorithm](#routing) · [Data](#data) · [Development](#development) · [Troubleshooting](#troubleshooting)
19
+ <a id="quick-evaluation"></a>
20
+
21
+ ## Quick evaluation
22
+
23
+ **One-line value:** A cost-aware DSH workbench for planning tasks, routing model calls, and running dependent work packages with explicit execution permissions.
24
+
25
+ **Category:** **Models & Reasoning** (模型与推理), the best fit in the [community directory's category list](https://www.alldsh.com/categories/); this is a community taxonomy, not an official DSH classification.
26
+
27
+ **Install (DSH Plugin Hub / web profile):** With the DSH CLI available, install the published npm package with:
28
+
29
+ ```sh
30
+ dsh plugin --profile web add @ljwei-stak/dsh-model-router@0.23.0
31
+ ```
32
+
33
+ **Install in Harness Desktop:** Launch Desktop once to initialize its `desktop` profile, quit Desktop fully, then run:
34
+
35
+ ```sh
36
+ dsh plugin --profile desktop add @ljwei-stak/dsh-model-router@0.23.0
37
+ ```
38
+
39
+ You can also paste the package spec into **Harness Desktop → Plugins → Add plugin**. Restart Desktop after installation. A global `npm install -g` by itself does not register a Desktop plugin.
40
+
41
+ **Package and entry point:** [`@ljwei-stak/dsh-model-router@0.23.0` on npm](https://www.npmjs.com/package/@ljwei-stak/dsh-model-router) is published. The root [`package.json`](package.json) declares the package and bundle patch; [`.dsh-plugin/index.mjs`](.dsh-plugin/index.mjs) exports the required `apply(ctx)` entry point. License: [MIT](LICENSE).
42
+
43
+ **Configuration:** There is no supported import of a user-authored JSON/YAML configuration file. Configure providers, models, and credentials on Harness's **Models** page; configure routing profiles and preferences in the plugin settings. Persistent router state is stored in `$DSH_HOME/model-router/state.json` (default: `~/.dsh/model-router/state.json`). Provider CLIs retain their own login and configuration. The router does not copy API keys into model profiles or terminal logs.
44
+
45
+ **Screenshots and evidence:** The [workbench screenshot](docs/assets/workbench-task-preview.jpg) uses fixture models, prices, and health data; it is a simulated UI preview, not a live Harness or model run. See the [routing workflow diagram](docs/assets/routing-workflow.svg) for the execution flow. The [real Windows validation report](docs/releases/0.20.0-validation.md) documents specific 0.20.0 executions and their limits; 0.23.0 has no verified end-to-end vendor run. The [live progress screenshot](docs/assets/workbench-run-progress.png) is an offline simulation; see the [0.23.0 acceptance report](docs/releases/0.23.0-validation.md) for cancellation, recovery and validation boundaries.
46
+
47
+ **Permissions and risks:** Planning is local and makes no model call. Execution sends the selected task/context to the chosen model API or vendor CLI and may incur charges. The default Harness-restricted environment separates read-only runs from approved `workspace-write` runs. An explicitly selected `cli-native` editable team runs with the current OS user's permissions, outside the Harness process sandbox; a Git worktree collects changes but does not restrict OS access. External providers and CLI services apply their own data handling and billing terms.
48
+
49
+ **Compatibility:** Declared host support is DeepSeek Harness Desktop **0.2.0-rc.1**, **0.2.0-rc.2**, and **0.2.1-rc.2**. Node.js **>=22.19** and pnpm **10.34.6** are source development/build requirements, not plugin runtime prerequisites. Compatibility beyond the declared host versions is not claimed.
50
+
51
+ **Contents:** [Quick evaluation](#quick-evaluation) · [Capabilities](#capabilities) · [Install](#install) · [Workbench](#workbench) · [Architecture](#architecture) · [Session tools](#session-tools) · [Official tools](#official-tools) · [Team lifecycle](#team-lifecycle) · [Costs](#costs) · [Routing algorithm](#routing) · [Data](#data) · [Development](#development) · [Troubleshooting](#troubleshooting)
14
52
 
15
53
  <a id="capabilities"></a>
16
54
 
@@ -40,16 +78,16 @@ Generating a route recommendation is local: it does not start a vendor CLI or ma
40
78
  Open **Plugins → Add plugin** and enter:
41
79
 
42
80
  ```text
43
- @ljwei-stak/dsh-model-router@0.22.1
81
+ @ljwei-stak/dsh-model-router@0.23.0
44
82
  ```
45
83
 
46
- Use the official HTTPS npm source `https://registry.npmjs.org/` when a mirror lacks that exact version. Enable the plugin, then fully quit Harness (including its tray process) and restart it. Plugin details should show **0.22.1** and the sidebar should contain **模型路由** (Model Router). A global `npm install -g` alone does not register a Desktop plugin.
84
+ Use the official HTTPS npm source `https://registry.npmjs.org/` when a mirror lacks that exact version. Enable the plugin, then fully quit Harness (including its tray process) and restart it. Plugin details should show **0.23.0** and the sidebar should contain **模型路由** (Model Router). A global `npm install -g` alone does not register a Desktop plugin.
47
85
 
48
86
  You can instead install a local `.tgz` archive or its extracted inner `package` directory through the plugin manager. Both must contain `package.json` and `.dsh-plugin`. See [releases](https://github.com/Alice-Marx/dsh-model-router/releases) for archived builds, or build your own checkout below.
49
87
 
50
88
  ### Upgrade from the old package name
51
89
 
52
- The old name `@ljwei-stak/model-router-galgame` ended at 0.13.0. Remove that plugin entry while retaining your profile/application data, then add `@ljwei-stak/dsh-model-router@0.22.1`. Do not keep both entries installed: they share the internal plugin id `model-router-galgame` and tool names. The retained id lets existing router settings and history carry over.
90
+ The old name `@ljwei-stak/model-router-galgame` ended at 0.13.0. Remove that plugin entry while retaining your profile/application data, then add `@ljwei-stak/dsh-model-router@0.23.0`. Do not keep both entries installed: they share the internal plugin id `model-router-galgame` and tool names. The retained id lets existing router settings and history carry over.
53
91
 
54
92
  For the combined 0.11.x package, back up the profile and export the GAL saves you want to preserve before upgrading. Story playback, artwork, music and saves now belong to the independent `@ljwei-stak/dsh-galgame` package. The detailed save limitations are in [MIGRATION.md](docs/archive/MIGRATION.md).
55
93
 
@@ -79,6 +117,8 @@ Switching tabs keeps the panels mounted, preserving in-progress installation and
79
117
  5. In **在工作台执行**, choose **模型路由(只读)** for the existing routed executor, or first select **团队分工** and choose **官方工具协作**. For official teamwork, select **只读检查** (read-only) or **编辑文件** (edit files). Editable teams also choose **Harness 受限环境** (Harness sandbox, the default) or **厂商 CLI 正常环境** (normal vendor environment, outside the Harness sandbox). Enter an existing absolute workspace path, or reuse the last run's path. Click **预览执行计划**, review each package, its permissions and required confirmations, then explicitly confirm execution. The Host rechecks the plan before starting; changed conditions can require confirmation again.
80
118
  6. Inspect **执行记录与子任务** for the actual channel, response, failures, cost and ratings. Official teamwork replans using only installed CLIs ready for the selected permission mode. Edits require approval and a clean Git repository; successful worktree changes are conditionally integrated. An unavailable or failed CLI never silently becomes an API call in this mode.
81
119
 
120
+ After execution starts, the workbench shows elapsed time, the current package and each package's state. **取消执行** requests cancellation of the active call and stops later packages from starting; **正在取消** remains visible until the executor finishes cleanup. Completed results and reported usage remain in history. Cancelling cannot undo charges already incurred or changes already integrated. Closing the panel does not cancel a run; reopening it in the same browser session can reconnect while the Host retains that job. Host restarts clear these in-memory jobs, and completed ledger records remain available.
121
+
82
122
  Changing task text, planning mode, profiles, directory or relevant settings invalidates the prior recommendation. Changing execution inputs also discards the pending or completed preview, so execution requires a new preview of the current request. Previewing execution uses current Host state and can differ from a previous local plan.
83
123
 
84
124
  Example task:
@@ -151,6 +191,8 @@ Replace the workspace with an existing clean Git root. Call `previewRun(request)
151
191
 
152
192
  Native editing normally requires `workspace-write` and `unsandboxed`; an exceeded budget adds `over-budget`. Do not hardcode this list or populate it without consent. `startRun` replans and repeats preflight; it does not consume a frozen preview token. New confirmation requirements return `needs-confirmation` with `missing` and updated reasons. Changing task, mode, workspace or profiles requires a fresh preview. Workbench requests use saved route `cliModel` mappings; temporary `cliModelsJson` bindings belong to the session tool below.
153
193
 
194
+ An accepted `startRun` returns a job snapshot with `jobId`, `status` and `progress` before execution finishes. Poll `runStatus({ jobId })`; request cancellation with `cancelRun({ jobId })`. Job states are `running`, `cancelling`, `completed`, `cancelled` or `failed`. A terminal snapshot's `result` contains the final workbench response and ledger `runId` when saved. `completed` means the worker settled; inspect `result.status` for the actual task outcome. Progress contains package identities and states, not answer text. A failed poll does not establish that execution stopped, and clients must not retry `startRun` automatically.
195
+
154
196
  <a id="session-tools"></a>
155
197
 
156
198
  ## Session tools
@@ -322,7 +364,7 @@ A valid CLI-reported USD amount, including explicit zero, wins over token-price
322
364
  C_a = \frac{I_u p_i+O p_o+R p_r+W p_w}{10^6}
323
365
  ```
324
366
 
325
- `C_a` is `actualUsd`; `I_u`, `O`, `R`, and `W` correspond to `inputTokens`, `outputTokens`, `cacheReadTokens`, and `cacheWriteTokens`. `p_i`, `p_o`, `p_r`, and `p_w` are the matching input, output, cache-read and cache-write prices in USD per million tokens.
367
+ $`C_a`$ is `actualUsd`; $`I_u`$, $`O`$, $`R`$, and $`W`$ correspond to `inputTokens`, `outputTokens`, `cacheReadTokens`, and `cacheWriteTokens`. $`p_i`$, $`p_o`$, $`p_r`$, and $`p_w`$ are the matching input, output, cache-read and cache-write prices in USD per million tokens.
326
368
 
327
369
  These ledger counters are disjoint after adapter normalization; do not add cached tokens to an inclusive input count. Missing optional cache prices use the input price. Incomplete usage, absent prices or unknown/unmatched identity keep the amount `null`, not zero. Complete terminal evidence can survive a failed/cancelled/timed-out run; partial events are marked `usageIncomplete`.
328
370
 
@@ -338,7 +380,7 @@ The planner is a deterministic local heuristic, not a trained success predictor.
338
380
 
339
381
  ### Token and price estimate
340
382
 
341
- Without matching resource evidence, base input tokens are `max(80, ceil(text.length / 3.7))`, then adjusted by package-stage multipliers. Base output is 900, adjusted by stage/reasoning effort, with minimum 220. This is a text-length heuristic, not a vendor tokenizer. Sufficient matching, complete history replaces these heuristics with empirical P90 resource estimates, without applying effort or stage multipliers again. Let `I` be total estimated input, `R/W` the cached-read/write portions, `O` output, and prices USD per million tokens:
383
+ Without matching resource evidence, base input tokens are $`\max(80,\lceil n/3.7\rceil)`$, then adjusted by package-stage multipliers. Base output is 900, adjusted by stage/reasoning effort, with minimum 220. Here $`n`$ is the JavaScript `text.length` value. This is a text-length heuristic, not a vendor tokenizer. Sufficient matching, complete history replaces these heuristics with empirical P90 resource estimates, without applying effort or stage multipliers again. Let $`I`$ be total estimated input, $`R`$/$`W`$ the cached-read/write portions, $`O`$ output, and prices USD per million tokens:
342
384
 
343
385
  <!-- formula:planning-cost -->
344
386
  ```math
@@ -350,11 +392,11 @@ C = \frac{(I-R-W)p_i+O p_o+R p_r+W p_w}{10^6}
350
392
  U_c = \frac{1}{1+C/\max(C_{\mathrm{ref}},10^{-12})}
351
393
  ```
352
394
 
353
- `U_c` is `costUtility`. The price symbols are the same as above. `C_ref` uses fixed reference prices (input 1, output 5, cache read/write 1 USD/million), not a vendor offer. Fixed scaling prevents an unrelated expensive candidate from flattening all cost penalties. Unknown prices produce a public estimate of `null` and cost utility 0. Internal unconstrained search uses a cost sentinel of 0, but finite-budget assignment excludes unknown-price candidates; the sentinel never means free execution.
395
+ $`U_c`$ is `costUtility`. The price symbols are the same as above. $`C_{\mathrm{ref}}`$ uses fixed reference prices (input 1, output 5, cache read/write 1 USD/million), not a vendor offer. Fixed scaling prevents an unrelated expensive candidate from flattening all cost penalties. Unknown prices produce a public estimate of `null` and cost utility 0. Internal unconstrained search uses a cost sentinel of 0, but finite-budget assignment excludes unknown-price candidates; the sentinel never means free execution.
354
396
 
355
397
  ### Candidate objective and quality floors
356
398
 
357
- With normalized quality `q` and normalized latency, specialty, reasoning-fit and risk proxies:
399
+ With normalized quality $`q`$ and normalized latency, specialty, reasoning-fit and risk proxies:
358
400
 
359
401
  <!-- formula:latency-utility -->
360
402
  ```math
@@ -374,25 +416,25 @@ u = w_q q+w_c U_c+w_\ell L+w_s s+w_r r-w_k k-\alpha\max(0,f-q)+\Delta_p
374
416
  S = \sum_{j=1}^{n}u_j - 0.015\sum_{(i,j)\in E}\mathbf{1}[\rho_i\ne\rho_j]
375
417
  ```
376
418
 
377
- `L` is latency utility: `t` is the matching historical P90 duration in milliseconds; otherwise `ℓ` is the latency proxy and `e_ℓ` its effort multiplier. In the utility formula, `s/r/k` are specialty/reasoning-fit/risk, `f` is the quality floor, `α` is criticality, and `Δ_p` is the bounded `preferenceAdjustment`; the `w` terms are the corresponding weights. `S` is `assignmentScore`; `E` contains dependency edges, and `ρ_j` is package `j`'s `provider/model` route. The indicator is 1 when routes differ, otherwise 0.
419
+ $`L`$ is latency utility: $`t`$ is the matching historical P90 duration in milliseconds; otherwise $`\ell`$ is the latency proxy and $`e_\ell`$ its effort multiplier. In the utility formula, $`s`$/$`r`$/$`k`$ are specialty/reasoning-fit/risk, $`f`$ is the quality floor, $`\alpha`$ is criticality, and $`\Delta_p`$ is the bounded `preferenceAdjustment`; the $`w`$ terms are the corresponding weights. $`S`$ is `assignmentScore`; $`E`$ contains dependency edges, and $`\rho_j`$ is package $`j`$'s `provider/model` route. The indicator is 1 when routes differ, otherwise 0.
378
420
 
379
421
  Quality first uses sufficient matching objective task evidence, then falls back to task-category LiveBench, overall LiveBench, and profile/catalog estimates. Model and effort are compared jointly only when at least two API efforts have usable task evidence; observed duration can replace the latency proxy. Public-data refresh is opt-in. Human ratings affect only the bounded `preferenceAdjustment`; they cannot increase objective quality or satisfy its floor.
380
422
 
381
423
  | Package basis | Quality | Cost | Latency | Specialty | Reasoning | Risk |
382
424
  | --- | --- | --- | --- | --- | --- | --- |
383
- | Simple | .28 | .45 | .14 | .04 | .07 | .02 |
384
- | Balanced | .40 | .26 | .10 | .09 | .10 | .05 |
385
- | Complex | .48 | .14 | .06 | .14 | .11 | .07 |
386
- | Synthesis | .58 | .08 | .04 | .08 | .16 | .06 |
425
+ | Simple | 0.28 | 0.45 | 0.14 | 0.04 | 0.07 | 0.02 |
426
+ | Balanced | 0.40 | 0.26 | 0.10 | 0.09 | 0.10 | 0.05 |
427
+ | Complex | 0.48 | 0.14 | 0.06 | 0.14 | 0.11 | 0.07 |
428
+ | Synthesis | 0.58 | 0.08 | 0.04 | 0.08 | 0.16 | 0.06 |
387
429
 
388
- Base quality floors are **.75 / .78 / .82** for simple/balanced/complex tasks; critical complex packages raise the floor, and complex synthesis is at least .84. The economy preset multiplies quality/cost/latency weights by .75/1.6/1.1 and lowers the floor by .04. Quality-first multiplies quality/cost/specialty/reasoning by 1.35/.5/1.2/1.2 and raises the floor by .04. Tilted weights are renormalized to the original total; adjusted floors are clamped to [.5, .97]. Balanced applies no tilt.
430
+ Base quality floors are **0.75 / 0.78 / 0.82** for simple/balanced/complex tasks; critical complex packages raise the floor, and complex synthesis is at least 0.84. The economy preset multiplies quality/cost/latency weights by 0.75/1.6/1.1 and lowers the floor by 0.04. Quality-first multiplies quality/cost/specialty/reasoning by 1.35/0.5/1.2/1.2 and raises the floor by 0.04. Tilted weights are renormalized to the original total; adjusted floors are clamped to [0.5, 0.97]. Balanced applies no tilt.
389
431
 
390
432
  ### Candidate pruning and assignment search
391
433
 
392
434
  1. Prefer candidates meeting each package's floor. If none qualify, retain up to three highest-quality fallbacks and report relaxation.
393
435
  2. Keep at most **12 candidates per package**, including anchors for lowest known cost, greatest utility and highest quality. Local Pareto pruning is disabled when dependencies exist, because route identity affects handoffs.
394
436
  3. Validate unique package IDs and topological dependency order. Search the retained Cartesian space exactly when its size is at most **4,096**; otherwise use **beam width 256**. Search compresses dominated prefixes sharing the same future dependency boundary and ranks them using optimistic future handoffs. Remaining minimum costs prune infeasible prefixes; the beam protects the cheapest feasible prefix under a finite budget.
395
- 4. Compare assignments lexicographically: fewer relaxed packages, smaller quality shortfall, higher utility, lower cost, fewer route switches, then stable route order. Minimum-cost mode compares cost before utility. Each dependency crossing a `provider/model` route subtracts .015 from utility.
437
+ 4. Compare assignments lexicographically: fewer relaxed packages, smaller quality shortfall, higher utility, lower cost, fewer route switches, then stable route order. Minimum-cost mode compares cost before utility. Each dependency crossing a `provider/model` route subtracts 0.015 from utility.
396
438
  5. Report search metadata and feasibility. When a positive budget has no feasible assignment, a minimum-cost alternative can still be returned with `budgetFeasible: false`. A displayed plan is not proof that the budget is satisfied.
397
439
 
398
440
  “Exact” applies only to the retained candidate space and proxy objective. Candidate caps and beam pruning preclude a claim of global optimality over every configured model. Unit/synthetic tests establish mechanisms, not actual answer-quality gains. The public 2026-06-25 LiveBench score/cost tables used by the research audit are aggregate data; a paired per-question quality/cost matrix was not obtained, so no real routing gain is claimed. See [research](docs/ROUTING_RESEARCH.zh.md), [derivation/experiments](docs/ROUTING_DERIVATION_EXPERIMENTS.zh.md), and [validation protocol](docs/ROUTING_LIVEBENCH_VALIDATION.zh.md).
@@ -455,7 +497,7 @@ Open [the local preview](http://127.0.0.1:4173). It uses mock models, tools and
455
497
  | `experiment-plugin/` | Separate research experiment project; not shipped as part of the router plugin. |
456
498
  | `docs/` and dated reports | User documentation and historical verification records. |
457
499
 
458
- `check:readme` guards the six math blocks, matching formulas in both languages and the reviewed blob hashes. `npm test` and `prepack` run this check; render changes must also be viewed on GitHub. The math blocks use [GitHub-supported syntax](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions).
500
+ `check:readme` guards the six display formulas, inline mathematical symbols, leading zeros in decimals, matching formulas in both languages and the reviewed blob hashes. `npm test` and `prepack` run this check; render changes must also be viewed on GitHub. The math blocks use [GitHub-supported syntax](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions).
459
501
 
460
502
  `check:client` rebuilds in memory and compares the generated output with the committed bundle; `prepack` refuses a stale bundle. pnpm 10 has no `pnpm peers check` command: use the strict install above. Unavailable/incompatible host SDK packages may require the installed Harness runtime for local integration testing; [setup-harness-dev.mjs](scripts/setup-harness-dev.mjs) links missing SDK packages from an explicitly supplied Host `node_modules`, and [start-harness-preview.mjs](scripts/start-harness-preview.mjs) starts a separate local web Host profile. These helpers do not replace dependency verification or Desktop acceptance checks.
461
503
 
package/README.zh.md CHANGED
@@ -2,15 +2,53 @@
2
2
 
3
3
  [English](README.md) · [简体中文](README.zh.md)
4
4
 
5
+ [![npm 版本](https://flat.badgen.net/npm/v/@ljwei-stak/dsh-model-router)](https://www.npmjs.com/package/@ljwei-stak/dsh-model-router) [![dshfind](https://dshfind.com/api/badge/alice-marx/dsh-model-router?lang=zh)](https://dshfind.com/zh/plugins/alice-marx/dsh-model-router?ref=badge) [![已收录至 DSH 插件目录](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/alice-marx/dsh-model-router) [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
6
+
7
+ [![dshfind](https://dshfind.com/api/card/Alice-Marx/dsh-model-router?lang=zh)](https://dshfind.com/zh/plugins/Alice-Marx/dsh-model-router?ref=badge)
8
+
9
+ 想跟进版本更新?点右上角 **Watch → Custom → 勾选 Releases**(不必 Watching 全部活动)。
10
+
5
11
  面向 **DeepSeek Harness Desktop** 的成本感知模型路由工作台。在本地规划任务、比较已配置路线、检查执行权限,并通过模型 API 或支持的厂商官方 CLI 执行有依赖关系的工作包。
6
12
 
7
- 当前版本:**0.22.1**(`@ljwei-stak/dsh-model-router`)。新增“按算法推荐分配 / 手动调整分配”:拆分后的工作包可逐个指定模型 API 或官方工具,保留依赖、重新预览费用,并保存重跑目标。同时接入任务相关质量证据、模型与推理档位联合选择、历史资源 P90 估计与依赖感知搜索。手动混合执行当前只读;官方工具使用自身默认模型,原有官方团队编辑流程保留。继续兼容 **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**,沿用 Hermes/Pi 安装与终端支持;两者仍无经过验证的托管执行器。真实厂商执行证据仍见 **0.20.0** 报告,本版未新增模型实测。路由器与 [GAL](https://github.com/Alice-Marx/deepseek-harness-galgame) 自 0.12.0 起已拆分为独立插件。
13
+ 当前版本:**0.23.0**(`@ljwei-stak/dsh-model-router`)。工作台执行新增实时耗时、逐工作包进度和取消,保留已完成结果与已报告费用;关闭重开面板可接管原任务。支持“按算法推荐分配 / 手动调整分配”:拆分后的工作包可逐个指定模型 API 或官方工具,保留依赖、重新预览费用,并保存重跑目标。同时接入任务相关质量证据、模型与推理档位联合选择、历史资源 P90 估计与依赖感知搜索。手动混合执行当前只读;官方工具使用自身默认模型,原有官方团队编辑流程保留。继续兼容 **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**,沿用 Hermes/Pi 安装与终端支持;两者仍无经过验证的托管执行器。真实厂商执行证据仍见 **0.20.0** 报告,本版未新增模型实测。路由器与 [GAL](https://github.com/Alice-Marx/deepseek-harness-galgame) 自 0.12.0 起已拆分为独立插件。
8
14
 
9
15
  官方 CLI 协作按依赖顺序逐包执行、传递依赖上下文,不会自动回退到模型目录 API。可编辑团队需明确选择 Harness 沙箱或厂商 CLI 正常环境。后者通过 Git worktree 收集修改,但不限制操作系统访问。未显式设置模型映射时,各 CLI 沿用自身配置的模型。参见[真实 Windows 验证及其局限](docs/releases/0.20.0-validation.md)。
10
16
 
11
17
  两个 README 版本同步说明接口、公式、默认值与限制。[更新日志](CHANGELOG.md)保留版本历史。更多操作说明:[工作台](docs/WORKBENCH_USER_GUIDE.zh.md)、[安装](docs/INSTALLATION_GUIDE.zh.md)、[迁移](docs/archive/MIGRATION.md)、[实验规程](docs/ROUTING_SELFTEST_STEPS.zh.md)。
12
18
 
13
- **目录:** [功能](#capabilities) · [安装](#install) · [工作台](#workbench) · [架构](#architecture) · [会话工具](#session-tools) · [官方工具](#official-tools) · [团队生命周期](#team-lifecycle) · [费用](#costs) · [路由算法](#routing) · [数据](#data) · [开发](#development) · [排障](#troubleshooting)
19
+ <a id="quick-evaluation"></a>
20
+
21
+ ## 提交前快速评估
22
+
23
+ **一句话价值:** 面向 DSH 的成本感知模型路由工作台,可本地规划任务、选择模型路线,并在明确权限下执行有依赖关系的工作包。
24
+
25
+ **类别:** **模型与推理(Models & Reasoning)**,是[社区目录分类](https://www.alldsh.com/categories/)中最贴切的一类;这是社区分类,并非 DSH 官方分类。
26
+
27
+ **安装(DSH Plugin Hub / web profile):** 确保 DSH CLI 可用,然后安装已发布的 npm 包:
28
+
29
+ ```sh
30
+ dsh plugin --profile web add @ljwei-stak/dsh-model-router@0.23.0
31
+ ```
32
+
33
+ **安装到 Harness Desktop:** 首次先启动一次 Desktop 初始化 `desktop` 配置,再彻底退出 Desktop,运行:
34
+
35
+ ```sh
36
+ dsh plugin --profile desktop add @ljwei-stak/dsh-model-router@0.23.0
37
+ ```
38
+
39
+ 也可以在 **Harness Desktop → 插件 → 添加插件** 中粘贴包名。安装后重启 Desktop。单独运行全局 `npm install -g` 不会注册 Desktop 插件。
40
+
41
+ **发布包与入口:** [npm 上的 `@ljwei-stak/dsh-model-router@0.23.0`](https://www.npmjs.com/package/@ljwei-stak/dsh-model-router) 已发布。根目录[`package.json`](package.json)声明包名和 bundle patch;[`.dsh-plugin/index.mjs`](.dsh-plugin/index.mjs)导出所需的 `apply(ctx)` 入口。[许可证:MIT](LICENSE)。
42
+
43
+ **配置文件与配置入口:** 当前不支持导入用户编写的 JSON/YAML 配置文件。Provider、模型和凭据在 Harness **模型**页面配置;路由档案与偏好在插件设置中配置。路由器持久状态存于 `$DSH_HOME/model-router/state.json`(默认:`~/.dsh/model-router/state.json`)。Provider CLI 沿用各自的登录和配置;路由器不会把 API 密钥复制进模型档案或终端日志。
44
+
45
+ **截图与证据:** [工作台截图](docs/assets/workbench-task-preview.jpg)使用固定的模型、价格和健康状态数据,是模拟 UI 预览,不是实时 Harness 或模型运行。[路由流程图](docs/assets/routing-workflow.svg)展示执行路径。[真实 Windows 验证报告](docs/releases/0.20.0-validation.md)记录了 0.20.0 的具体执行及局限;0.23.0 尚无经过验证的端到端厂商运行。[实时进度截图](docs/assets/workbench-run-progress.png)是离线模拟;取消、重开恢复与验证边界见[0.23.0 验收报告](docs/releases/0.23.0-validation.md)。
46
+
47
+ **权限与风险:** 任务规划在本地完成,不调用模型。实际执行会把选定任务和上下文发送到所选模型 API 或厂商 CLI,并可能产生费用。默认使用 Harness 受限环境;只读运行不修改工作区,`workspace-write` 需要用户明确批准。明确选择 `cli-native` 的可编辑团队会在 Harness 进程沙箱之外,以当前操作系统用户权限运行;Git worktree 只收集修改,不限制操作系统访问。外部 Provider 和 CLI 服务各自适用其数据处理及计费规则。
48
+
49
+ **兼容性:** 声明支持 DeepSeek Harness Desktop **0.2.0-rc.1**、**0.2.0-rc.2**、**0.2.1-rc.2**。Node.js **>=22.19** 与 pnpm **10.34.6** 仅为源码开发/构建要求,不是插件运行时前置条件;不承诺超出上述 Host 版本的兼容性。
50
+
51
+ **目录:** [快速评估](#quick-evaluation) · [功能](#capabilities) · [安装](#install) · [工作台](#workbench) · [架构](#architecture) · [会话工具](#session-tools) · [官方工具](#official-tools) · [团队生命周期](#team-lifecycle) · [费用](#costs) · [路由算法](#routing) · [数据](#data) · [开发](#development) · [排障](#troubleshooting)
14
52
 
15
53
  <a id="capabilities"></a>
16
54
 
@@ -40,16 +78,16 @@
40
78
  打开 **插件 → 添加插件**,输入:
41
79
 
42
80
  ```text
43
- @ljwei-stak/dsh-model-router@0.22.1
81
+ @ljwei-stak/dsh-model-router@0.23.0
44
82
  ```
45
83
 
46
- 镜像缺少该精确版本时,使用官方 HTTPS npm 源 `https://registry.npmjs.org/`。启用插件,然后完全退出 Harness(包括托盘进程)并重启。插件详情应显示 **0.22.1**,侧栏应出现 **模型路由**。仅执行全局 `npm install -g` 不会把插件注册到 Desktop。
84
+ 镜像缺少该精确版本时,使用官方 HTTPS npm 源 `https://registry.npmjs.org/`。启用插件,然后完全退出 Harness(包括托盘进程)并重启。插件详情应显示 **0.23.0**,侧栏应出现 **模型路由**。仅执行全局 `npm install -g` 不会把插件注册到 Desktop。
47
85
 
48
86
  也可以通过插件管理器安装本地 `.tgz` 压缩包,或解压后的内部 `package` 目录。两者都必须包含 `package.json` 和 `.dsh-plugin`。历史构建见 [Releases](https://github.com/Alice-Marx/dsh-model-router/releases),也可按下文从源码构建。
49
87
 
50
88
  ### 从旧包名升级
51
89
 
52
- 旧名称 `@ljwei-stak/model-router-galgame` 停留在 0.13.0。保留配置档/应用数据,移除旧插件条目,再添加 `@ljwei-stak/dsh-model-router@0.22.1`。不要同时保留两条插件:它们共用内部插件 id `model-router-galgame` 和工具名。保留该 id 能让现有路由设置与历史记录继续使用。
90
+ 旧名称 `@ljwei-stak/model-router-galgame` 停留在 0.13.0。保留配置档/应用数据,移除旧插件条目,再添加 `@ljwei-stak/dsh-model-router@0.23.0`。不要同时保留两条插件:它们共用内部插件 id `model-router-galgame` 和工具名。保留该 id 能让现有路由设置与历史记录继续使用。
53
91
 
54
92
  从合包 0.11.x 升级前,先备份配置档,并导出需要保留的 GAL 存档。剧情播放、立绘、音乐与存档现属于独立的 `@ljwei-stak/dsh-galgame`。详细存档限制见 [MIGRATION.md](docs/archive/MIGRATION.md)。
55
93
 
@@ -79,6 +117,8 @@
79
117
  5. 在 **在工作台执行** 中,选择 **模型路由(只读)** 使用现有路由执行器;或先选择 **团队分工**,再选择 **官方工具协作**。官方协作可选择 **只读检查** 或 **编辑文件**。可编辑团队还需选择 **Harness 受限环境**(默认沙箱)或 **厂商 CLI 正常环境**(在 Harness 沙箱外运行)。填入已存在的工作区绝对路径,或沿用上次运行路径。点击 **预览执行计划**,查看各包、权限与所需确认,然后显式确认执行。Host 启动前会重新检查计划;条件变化可能要求重新确认。
80
118
  6. 在 **执行记录与子任务** 查看实际通道、回答、失败、费用与评分。官方协作仅使用已安装、且在所选权限模式下就绪的 CLI 重新规划。编辑需要批准和干净的 Git 仓库;成功的 worktree 修改有条件地合入。该模式下,不可用或失败的 CLI 不会静默变成 API 调用。
81
119
 
120
+ 执行开始后,工作台显示已耗时、当前工作包与每包状态。**取消执行**会请求停止当前调用,并阻止后续工作包启动;执行器完成收尾前持续显示**正在取消**。已完成结果和已报告用量仍保留在历史中。取消不能撤销已经产生的费用或已经整合的改动。关闭面板不会取消执行;同一浏览器会话重新打开后,可在 Host 仍保留该任务时重新连接。Host 重启会清除内存任务,已保存的历史记录仍可查看。
121
+
82
122
  修改任务文本、规划模式、路线配置、目录或相关设置,会使旧建议失效。修改执行输入也会丢弃待确认或已完成的预览,必须对当前请求重新预览。执行预览使用 Host 当前状态,因此可能与先前本地计划不同。
83
123
 
84
124
  任务示例:
@@ -151,6 +191,8 @@ flowchart TD
151
191
 
152
192
  正常环境编辑通常要求 `workspace-write` 和 `unsandboxed` 确认;超预算还会增加 `over-budget`。不要硬编码该列表,也不要未经同意自动填入。`startRun` 会重新规划和预检,不会消费一个冻结的预览令牌。出现新的确认要求时,返回 `needs-confirmation`,并给出 `missing` 与更新后的原因。修改任务、模式、工作区或路线配置后必须重新预览。工作台请求使用已保存路线的 `cliModel` 映射;临时 `cliModelsJson` 绑定属于下文的会话工具。
153
193
 
194
+ `startRun` 接受执行后,在任务完成前返回含 `jobId`、`status` 和 `progress` 的任务快照。通过 `runStatus({ jobId })` 读取状态,通过 `cancelRun({ jobId })` 请求取消。任务状态为 `running`、`cancelling`、`completed`、`cancelled` 或 `failed`。终态快照的 `result` 包含最终工作台响应,以及成功保存后的账本 `runId`。`completed` 表示后台执行已结束,任务实际结果仍查看 `result.status`。进度仅包含工作包身份与状态,不包含回答正文。读取状态失败不代表执行已停止,客户端不得因此自动重发 `startRun`。
195
+
154
196
  <a id="session-tools"></a>
155
197
 
156
198
  ## 会话工具
@@ -322,7 +364,7 @@ Coding-plan 密钥与端点保留在 Harness 供应商设置中。`plan-key` 配
322
364
  C_a = \frac{I_u p_i+O p_o+R p_r+W p_w}{10^6}
323
365
  ```
324
366
 
325
- `C_a` 对应 `actualUsd`;`I_u`、`O`、`R`、`W` 分别对应 `inputTokens`、`outputTokens`、`cacheReadTokens`、`cacheWriteTokens`,`p_i`、`p_o`、`p_r`、`p_w` 分别为输入、输出、缓存读取和缓存写入单价,单位为美元/百万 token。
367
+ $`C_a`$ 对应 `actualUsd`;$`I_u`$、$`O`$、$`R`$、$`W`$ 分别对应 `inputTokens`、`outputTokens`、`cacheReadTokens`、`cacheWriteTokens`,$`p_i`$、$`p_o`$、$`p_r`$、$`p_w`$ 分别为输入、输出、缓存读取和缓存写入单价,单位为美元/百万 token。
326
368
 
327
369
  经适配器归一化后,这些账本计数互不重叠;不要把缓存 token 再加到已包含缓存的输入计数中。缺少可选缓存单价时,使用输入单价。用量不完整、价格缺失或身份未知/不匹配时,金额保持 `null`,不是零。完整的终态证据可在失败、取消、超时后保留;部分事件标记为 `usageIncomplete`。
328
370
 
@@ -338,7 +380,7 @@ C_a = \frac{I_u p_i+O p_o+R p_r+W p_w}{10^6}
338
380
 
339
381
  ### Token 与价格估计
340
382
 
341
- 没有匹配资源证据时,基础输入 token 为 `max(80, ceil(text.length / 3.7))`,再乘以工作包阶段系数。基础输出为 900,按阶段/推理强度调整,最少 220。这是按文本长度估算,不是厂商 tokenizer。匹配的完整历史记录达到样本门槛后,改用经验 P90 资源估计,不再重复乘档位和阶段系数。令 `I` 为估计输入总数,`R/W` 为缓存读取/写入部分,`O` 为输出,价格单位为美元/百万 token:
383
+ 没有匹配资源证据时,基础输入 token 为 $`\max(80,\lceil n/3.7\rceil)`$,再乘以工作包阶段系数。基础输出为 900,按阶段/推理强度调整,最少 220。其中 $`n`$ 对应 JavaScript 的 `text.length`。这是按文本长度估算,不是厂商 tokenizer。匹配的完整历史记录达到样本门槛后,改用经验 P90 资源估计,不再重复乘档位和阶段系数。令 $`I`$ 为估计输入总数,$`R`$/$`W`$ 为缓存读取/写入部分,$`O`$ 为输出,价格单位为美元/百万 token:
342
384
 
343
385
  <!-- formula:planning-cost -->
344
386
  ```math
@@ -350,11 +392,11 @@ C = \frac{(I-R-W)p_i+O p_o+R p_r+W p_w}{10^6}
350
392
  U_c = \frac{1}{1+C/\max(C_{\mathrm{ref}},10^{-12})}
351
393
  ```
352
394
 
353
- `U_c` 对应 `costUtility`,单价符号与上文一致。`C_ref` 使用固定参考价(输入 1、输出 5、缓存读取/写入 1 美元/百万),不是厂商报价。固定尺度防止一个无关的昂贵候选把所有费用惩罚压平。未知价格的公开估计为 `null`,费用效用为 0。内部无预算约束搜索使用费用哨兵值 0,但有限预算分配会排除价格未知候选;哨兵值绝不代表执行免费。
395
+ $`U_c`$ 对应 `costUtility`,单价符号与上文一致。$`C_{\mathrm{ref}}`$ 使用固定参考价(输入 1、输出 5、缓存读取/写入 1 美元/百万),不是厂商报价。固定尺度防止一个无关的昂贵候选把所有费用惩罚压平。未知价格的公开估计为 `null`,费用效用为 0。内部无预算约束搜索使用费用哨兵值 0,但有限预算分配会排除价格未知候选;哨兵值绝不代表执行免费。
354
396
 
355
397
  ### 候选目标与质量下限
356
398
 
357
- 使用归一化质量 `q`,以及归一化延迟、领域匹配、推理匹配和风险代理值:
399
+ 使用归一化质量 $`q`$,以及归一化延迟、领域匹配、推理匹配和风险代理值:
358
400
 
359
401
  <!-- formula:latency-utility -->
360
402
  ```math
@@ -374,25 +416,25 @@ u = w_q q+w_c U_c+w_\ell L+w_s s+w_r r-w_k k-\alpha\max(0,f-q)+\Delta_p
374
416
  S = \sum_{j=1}^{n}u_j - 0.015\sum_{(i,j)\in E}\mathbf{1}[\rho_i\ne\rho_j]
375
417
  ```
376
418
 
377
- `L` 为延迟效用:`t` 是匹配历史的 P90 耗时,单位为毫秒;未知时使用延迟代理值 `ℓ` 及档位系数 `e_ℓ`。效用式中,`s/r/k` 分别是领域匹配、推理匹配和风险,`f` 为质量下限,`α` 为关键性,`Δ_p` 为有界的 `preferenceAdjustment`;各 `w` 为对应权重。`S` 对应 `assignmentScore`,`E` 为依赖边集合,`ρ_j` 为工作包 `j` 的 `provider/model` 路线;指示函数在路线不同时取 1,否则取 0。
419
+ $`L`$ 为延迟效用:$`t`$ 是匹配历史的 P90 耗时,单位为毫秒;未知时使用延迟代理值 $`\ell`$ 及档位系数 $`e_\ell`$。效用式中,$`s`$/$`r`$/$`k`$ 分别是领域匹配、推理匹配和风险,$`f`$ 为质量下限,$`\alpha`$ 为关键性,$`\Delta_p`$ 为有界的 `preferenceAdjustment`;各 $`w`$ 为对应权重。$`S`$ 对应 `assignmentScore`,$`E`$ 为依赖边集合,$`\rho_j`$ 为工作包 $`j`$ 的 `provider/model` 路线;指示函数在路线不同时取 1,否则取 0。
378
420
 
379
421
  质量优先使用足量且匹配的任务客观证据,再回退对应任务类别的 LiveBench 分数、整体 LiveBench、路线配置/目录估值。至少两个 API 档位各有可用任务证据时,才联合比较模型与档位;经验耗时可替换延迟代理项。公共数据刷新默认关闭,需主动启用。人工评分仅影响有界的 `preferenceAdjustment`,不能提高客观质量或满足质量下限。
380
422
 
381
423
  | 工作包基础类型 | 质量 | 费用 | 延迟 | 领域 | 推理 | 风险 |
382
424
  | --- | --- | --- | --- | --- | --- | --- |
383
- | 简单 | .28 | .45 | .14 | .04 | .07 | .02 |
384
- | 均衡 | .40 | .26 | .10 | .09 | .10 | .05 |
385
- | 复杂 | .48 | .14 | .06 | .14 | .11 | .07 |
386
- | 汇总 | .58 | .08 | .04 | .08 | .16 | .06 |
425
+ | 简单 | 0.28 | 0.45 | 0.14 | 0.04 | 0.07 | 0.02 |
426
+ | 均衡 | 0.40 | 0.26 | 0.10 | 0.09 | 0.10 | 0.05 |
427
+ | 复杂 | 0.48 | 0.14 | 0.06 | 0.14 | 0.11 | 0.07 |
428
+ | 汇总 | 0.58 | 0.08 | 0.04 | 0.08 | 0.16 | 0.06 |
387
429
 
388
- 简单/均衡/复杂任务的基础质量下限分别为 **.75 / .78 / .82**;关键复杂包会提高下限,复杂任务的汇总包至少为 .84。省钱预设把质量/费用/延迟权重分别乘以 .75/1.6/1.1,并把下限降低 .04。效果优先把质量/费用/领域/推理权重分别乘以 1.35/.5/1.2/1.2,并把下限提高 .04。倾斜后的权重重新归一化到原总量;调整后的下限限制在 [.5, .97]。均衡不作倾斜。
430
+ 简单/均衡/复杂任务的基础质量下限分别为 **0.75 / 0.78 / 0.82**;关键复杂包会提高下限,复杂任务的汇总包至少为 0.84。省钱预设把质量/费用/延迟权重分别乘以 0.75/1.6/1.1,并把下限降低 0.04。效果优先把质量/费用/领域/推理权重分别乘以 1.35/0.5/1.2/1.2,并把下限提高 0.04。倾斜后的权重重新归一化到原总量;调整后的下限限制在 [0.5, 0.97]。均衡不作倾斜。
389
431
 
390
432
  ### 候选裁剪与分配搜索
391
433
 
392
434
  1. 优先保留达到各工作包质量下限的候选。若没有合格候选,保留质量最高的至多三个回退候选,并报告约束放宽。
393
435
  2. 每包最多保留 **12 个候选**,包含最低已知费用、最大效用与最高质量的锚点。存在依赖时禁用局部 Pareto 裁剪,因为路线身份会影响交接。
394
436
  3. 验证工作包 ID 唯一且依赖按拓扑排序。保留候选的笛卡尔空间大小不超过 **4,096** 时精确搜索;否则采用 **beam width 256**。搜索按未来依赖的模型边界压缩被支配前缀,并用未来交接的乐观估计排序。剩余最小费用用于裁剪不可行前缀;有限预算时,beam 会保护最便宜的可行前缀。
395
- 4. 按字典序比较分配:更少放宽包、更小质量缺口、更高效用、更低费用、更少路线切换,最后稳定的路线顺序。最小费用模式先比较费用,再比较效用。每条跨越 `provider/model` 路线的依赖边从效用中扣除 .015。
437
+ 4. 按字典序比较分配:更少放宽包、更小质量缺口、更高效用、更低费用、更少路线切换,最后稳定的路线顺序。最小费用模式先比较费用,再比较效用。每条跨越 `provider/model` 路线的依赖边从效用中扣除 0.015。
396
438
  5. 报告搜索元数据与可行性。正预算下若不存在可行分配,仍可返回最小费用备选,但标记 `budgetFeasible: false`。显示了计划不代表预算已满足。
397
439
 
398
440
  “精确”仅适用于保留下来的候选空间与代理目标。候选上限和 beam 裁剪意味着不能声称在所有已配置模型上全局最优。单元/合成测试验证机制,不证明真实回答质量提升。研究审查使用的公开 2026-06-25 LiveBench 分数/费用表属于汇总数据;未取得逐题配对的质量/费用矩阵,因此不主张真实路由收益。参见[研究](docs/ROUTING_RESEARCH.zh.md)、[推导/实验](docs/ROUTING_DERIVATION_EXPERIMENTS.zh.md)与[验证规程](docs/ROUTING_LIVEBENCH_VALIDATION.zh.md)。
@@ -455,7 +497,7 @@ npm run preview:ui
455
497
  | `experiment-plugin/` | 独立研究实验项目,不随路由插件发布。 |
456
498
  | `docs/` 与带日期报告 | 用户文档与历史验证记录。 |
457
499
 
458
- `check:readme` 检查六个数学公式块、双语公式一致性和审阅后的 blob 哈希;`npm test` 与 `prepack` 均会执行。修改公式后还须在 GitHub 页面查看实际渲染。公式块采用 [GitHub 官方支持的语法](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions)。
500
+ `check:readme` 检查六个展示公式、正文行内数学符号、小数前导零、双语公式一致性和审阅后的 blob 哈希;`npm test` 与 `prepack` 均会执行。修改公式后还须在 GitHub 页面查看实际渲染。公式块采用 [GitHub 官方支持的语法](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions)。
459
501
 
460
502
  `check:client` 在内存中重建并比较已提交 bundle;`prepack` 会拒绝过期 bundle。pnpm 10 没有 `pnpm peers check` 命令:请使用上述严格安装。Host SDK 包不可用/不兼容时,本地集成测试可能需要已安装的 Harness 运行时;[setup-harness-dev.mjs](scripts/setup-harness-dev.mjs) 从显式提供的 Host `node_modules` 链接缺失 SDK 包,[start-harness-preview.mjs](scripts/start-harness-preview.mjs) 启动独立的本地 Web Host 配置档。这些辅助脚本不能代替依赖验证或 Desktop 验收。
461
503
 
@@ -1,8 +1,8 @@
1
1
  # DeepSeek Harness Desktop · 独立插件安装与验证
2
2
 
3
- 模型路由从 **0.12.0** 起独立发布;GAL 是独立的 **0.1.0** 插件。路由 **0.22.1** 声明支持官方 **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**。GAL 的兼容范围以其自身安装包为准。
3
+ 模型路由从 **0.12.0** 起独立发布;GAL 是独立的 **0.1.0** 插件。路由 **0.22.2** 声明支持官方 **DeepSeek Harness Desktop 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2**。GAL 的兼容范围以其自身安装包为准。
4
4
 
5
- 当前路由版本为 **0.22.1**,修复中英文 README 数学公式显示;0.22.1 新增算法推荐与手动工作包分配二选一,可逐包选择模型 API 或官方工具,并改进证据驱动规划与依赖搜索。手动混合执行目前只读;编辑文件继续走官方工具协作。沿用 Hermes/Pi 安装与终端支持、OpenCode 官方 V2 包和现有兼容声明。保留原插件 id、配置与运行记录;安装后完全退出 Harness(包括托盘)再重启。公开数据默认关闭,自动质量升级默认关闭。
5
+ 当前路由版本为 **0.22.2**,修复中英文 README 正文数学符号显示与小数格式;0.22.0 新增算法推荐与手动工作包分配二选一,可逐包选择模型 API 或官方工具,并改进证据驱动规划与依赖搜索。手动混合执行目前只读;编辑文件继续走官方工具协作。沿用 Hermes/Pi 安装与终端支持、OpenCode 官方 V2 包和现有兼容声明。保留原插件 id、配置与运行记录;安装后完全退出 Harness(包括托盘)再重启。公开数据默认关闭,自动质量升级默认关闭。
6
6
 
7
7
  [路由 README](../README.zh.md) · [迁移说明](archive/MIGRATION.md) · [独立 GAL README](https://github.com/Alice-Marx/deepseek-harness-galgame#readme)
8
8
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  | 需求 | 添加插件输入框 | 安装后的入口 |
12
12
  | --- | --- | --- |
13
- | 分析复杂度、按质量和费用选模型、调用官方工具 | `@ljwei-stak/dsh-model-router@0.22.1` | 模型路由 |
13
+ | 分析复杂度、按质量和费用选模型、调用官方工具 | `@ljwei-stak/dsh-model-router@0.22.2` | 模型路由 |
14
14
  | 剧情、立绘、音乐、存档、自由对话 | `@ljwei-stak/dsh-galgame@0.1.0` | Gal 模块 |
15
15
  | 两者都要 | 分别安装上面两个包 | 模型路由 + Gal 模块 |
16
16
 
@@ -24,7 +24,7 @@
24
24
  2. 在“包名、GitHub 仓库地址或本地目录路径”输入框填一个完整包名,例如:
25
25
 
26
26
  ```text
27
- @ljwei-stak/dsh-model-router@0.22.1
27
+ @ljwei-stak/dsh-model-router@0.22.2
28
28
  ```
29
29
 
30
30
  只想安装 GAL 时填写:
@@ -40,7 +40,7 @@
40
40
  ```
41
41
 
42
42
  4. 核对预览的包名、版本和宿主兼容信息,安装并启用。完全退出 Harness(包括托盘进程)再启动,确保 Host 加载新代码。
43
- 5. 检查插件详情与侧边栏:路由应为 **0.22.1 / 模型路由**;GAL 应为 **0.1.0 / Gal 模块**。仅装路由时没有 GAL 入口是预期行为。
43
+ 5. 检查插件详情与侧边栏:路由应为 **0.22.2 / 模型路由**;GAL 应为 **0.1.0 / Gal 模块**。仅装路由时没有 GAL 入口是预期行为。
44
44
 
45
45
  普通用户无需 `npm install -g`,该命令不会把插件注册到当前 Harness profile。
46
46
 
@@ -48,13 +48,13 @@
48
48
 
49
49
  进入对应 Release 下载 `.tgz`:
50
50
 
51
- - [模型路由 Releases](https://github.com/Alice-Marx/dsh-model-router/releases)(也可运行 `npm pack @ljwei-stak/dsh-model-router@0.22.1` 获取同一安装包)
51
+ - [模型路由 Releases](https://github.com/Alice-Marx/dsh-model-router/releases)(也可运行 `npm pack @ljwei-stak/dsh-model-router@0.22.2` 获取同一安装包)
52
52
  - [独立 GAL v0.1.0](https://github.com/Alice-Marx/deepseek-harness-galgame/releases/tag/v0.1.0)
53
53
 
54
54
  在“添加插件”填写下载文件的**绝对路径**,例如:
55
55
 
56
56
  ```text
57
- D:\Plugins\ljwei-stak-dsh-model-router-0.22.1.tgz
57
+ D:\Plugins\ljwei-stak-dsh-model-router-0.22.2.tgz
58
58
  ```
59
59
 
60
60
  ```text
@@ -64,7 +64,7 @@ D:\Plugins\ljwei-stak-dsh-galgame-0.1.0.tgz
64
64
  如附有 `.sha256` 文件,用 PowerShell 计算并比较摘要:
65
65
 
66
66
  ```powershell
67
- Get-FileHash -Algorithm SHA256 -LiteralPath 'D:\Plugins\ljwei-stak-dsh-model-router-0.22.1.tgz'
67
+ Get-FileHash -Algorithm SHA256 -LiteralPath 'D:\Plugins\ljwei-stak-dsh-model-router-0.22.2.tgz'
68
68
  Get-FileHash -Algorithm SHA256 -LiteralPath 'D:\Plugins\ljwei-stak-dsh-galgame-0.1.0.tgz'
69
69
  ```
70
70
 
@@ -74,7 +74,7 @@ Get-FileHash -Algorithm SHA256 -LiteralPath 'D:\Plugins\ljwei-stak-dsh-galgame-0
74
74
 
75
75
  1. 在旧合并插件的 GAL 播放器导出需要保留的剧情进度,并备份整个 Harness profile。每份 JSON 仅保存**当前剧情状态**,不含所有手动槽、设置、已读记录或本地音乐;重要槽位可依次读档再导出。
76
76
  2. 在**同一个 profile**安装独立 `@ljwei-stak/dsh-galgame@0.1.0`。
77
- 3. 0.13.0 起包名改为 `@ljwei-stak/dsh-model-router`(旧包名最后版本为 0.13.0,内容相同,之后不再更新):在插件管理器卸载原 `@ljwei-stak/model-router-galgame`(保留 profile 与应用数据),再添加 `@ljwei-stak/dsh-model-router@0.22.1`。不要两个同时安装(条目 id 与工具名相同);条目 id 未变,路由设置与执行记录会保留。完成两项更新后再玩剧情,避免同时操作旧合并入口和新入口。
77
+ 3. 0.13.0 起包名改为 `@ljwei-stak/dsh-model-router`(旧包名最后版本为 0.13.0,内容相同,之后不再更新):在插件管理器卸载原 `@ljwei-stak/model-router-galgame`(保留 profile 与应用数据),再添加 `@ljwei-stak/dsh-model-router@0.22.2`。不要两个同时安装(条目 id 与工具名相同);条目 id 未变,路由设置与执行记录会保留。完成两项更新后再玩剧情,避免同时操作旧合并入口和新入口。
78
78
  4. 现在路由与 GAL 各有一个入口。独立 GAL 沿用旧存档 localStorage 键,核对当前进度和三槽;更换 profile 或进度未恢复时,先切换到匹配剧目,再导入 JSON 备份。
79
79
  5. 后续分别更新需要的插件;只用路由可以不启用或不安装 GAL。保留 profile 与应用数据,卸载插件时不要清理故事数据。
80
80
 
@@ -82,7 +82,7 @@ GAL 核心只包含**《回声之城·正篇》**与**《旧城迁移篇:未
82
82
 
83
83
  ## 5. 模型路由第一次使用
84
84
 
85
- 工作台自 0.15.0 起分成**任务与执行、模型配置、官方工具、预算与安全**四页;0.22.1 沿用该布局。切换页面保留安装任务、终端会话和未完成的输入。
85
+ 工作台自 0.15.0 起分成**任务与执行、模型配置、官方工具、预算与安全**四页;0.22.2 沿用该布局。切换页面保留安装任务、终端会话和未完成的输入。
86
86
 
87
87
  1. 在 Harness 官方**模型**页配置供应商、模型与凭据。插件读取准确的 `provider/model` 目录,模型档案不保存 API Key。
88
88
  2. 在**模型配置**刷新目录,逐条填写自报质量评分、核对过的输入/输出单价(USD / 百万 token)和擅长方向;缺价留空。可选 `cliModel` 必须是该厂商 CLI 已验证接受的名字。可选 LiveBench 名称须准确对应版本与推理档位;它是用户确认的映射,不自动证明实际执行档位。
@@ -114,7 +114,7 @@ GAL 核心只包含**《回声之城·正篇》**与**《旧城迁移篇:未
114
114
  | 检查 | 预期 |
115
115
  | --- | --- |
116
116
  | 路由宿主版本 | 0.2.0-rc.1、0.2.0-rc.2 或 0.2.1-rc.2;包括 `rc` 后缀。 |
117
- | 路由独立安装 | 0.22.1 详情、模型路由入口、目录和模型档案可用;不出现旧合并 GAL 入口。 |
117
+ | 路由独立安装 | 0.22.2 详情、模型路由入口、目录和模型档案可用;不出现旧合并 GAL 入口。 |
118
118
  | GAL 独立安装 | 0.1.0 详情、Gal 模块入口、标题与两部核心剧情可用;不要求安装路由。 |
119
119
  | 共同安装 | 两个入口各一份,路由工具和 GAL 播放器均能使用。 |
120
120
  | 存档迁移 | 同 profile 可读旧键;跨 profile 用匹配剧目 JSON 导入;旧篇目的数据不覆盖。 |
@@ -129,7 +129,7 @@ GAL 核心只包含**《回声之城·正篇》**与**《旧城迁移篇:未
129
129
 
130
130
  ## 8. 开发者从完整源码构建
131
131
 
132
- 路由需要 Node.js **22.19+** 与 **pnpm 10.34.6**。从完整源码仓库根目录构建;当前源码版本为 0.22.1,复现已发布版本时检出对应发布标签。旧版(如 0.15.0)标签保留其当时内容。运行:
132
+ 路由需要 Node.js **22.19+** 与 **pnpm 10.34.6**。从完整源码仓库根目录构建;当前源码版本为 0.22.2,复现已发布版本时检出对应发布标签。旧版(如 0.15.0)标签保留其当时内容。运行:
133
133
 
134
134
  ```powershell
135
135
  pnpm install --frozen-lockfile --strict-peer-dependencies
@@ -1,6 +1,6 @@
1
1
  # 模型路由工作台:配置、规划与实际执行
2
2
 
3
- 适用版本:`@ljwei-stak/dsh-model-router@0.22.1`。声明兼容 DeepSeek Harness Desktop `0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2`。安装与开发见[中文 README](../README.zh.md),旧包迁移见[迁移说明](archive/MIGRATION.md)。
3
+ 适用版本:`@ljwei-stak/dsh-model-router@0.23.0`。声明兼容 DeepSeek Harness Desktop `0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-rc.2`。安装与开发见[中文 README](../README.zh.md),旧包迁移见[迁移说明](archive/MIGRATION.md)。
4
4
 
5
5
  0.22.0 新增“按算法推荐分配 / 手动调整分配”:生成任务建议后,可为每个工作包选择模型 API 或官方工具;修改后重新预览费用与渠道,再确认执行。任务依赖与重跑目标保留。手动混合执行当前只读,官方工具使用自身默认模型;编辑文件继续选择官方工具协作。详见[手动分配说明](MANUAL_TASK_ASSIGNMENT.zh.md)。Hermes 自定义程序目录、原配置/登录/历史位置,以及工具页顶部终端的行为继续保留。
6
6
 
@@ -93,6 +93,10 @@ Windows 独立工作树保存在用户私有临时目录中,按原仓库路径
93
93
  4. 明确确认执行后才调用模型/CLI。期间状态变化可能导致宿主拒绝旧确认,需重新审阅。
94
94
  5. 在下方**执行记录与子任务**看结果、状态、实际渠道、原始失败原因和费用。实际运行可能计费。
95
95
 
96
+ 执行期间会显示当前工作包、逐包状态、已处理数量和已耗时。点击**取消执行**后,先显示**正在取消**;后台收到请求后停止当前调用,等待进程或模型流收尾,再保存已完成结果、已报告用量和最终状态。取消不会撤销已经产生的费用;可编辑团队尚未整合时会保留独立工作树,取消后不开始新的整合步骤,已经完成的整合无法通过取消撤回。
97
+
98
+ 状态读取失败时保留当前任务并提示重试,不自动再次启动执行。关闭工作台仅停止界面读取;同一浏览器会话重新打开时可恢复仍在 Host 内存中的任务。Host 重启或任务快照被清理后,界面会提示查看执行记录,不能恢复尚未保存的运行过程。浏览器只保存任务 ID,不保存任务正文、回答或凭据。
99
+
96
100
  修改任务、规划模式、执行方式、任务权限、路由方案或工作区等输入后,正在请求或已经返回的旧预览会被丢弃。重新预览并核对当前请求后才能确认执行。官方协作不代替缺失的 CLI,不支持当前权限的工具也不会进入该模式的计划。
97
101
 
98
102
  **预览不会启动模型,确认会启动。** 模型 API 将任务文本发给供应商;CLI 可能读取工作区或其他其权限允许的文件。只读不等于所有 CLI 只能读取工作区,先看**预算与安全 → 安全边界**。
@@ -0,0 +1,30 @@
1
+ # 0.23.0 release acceptance
2
+
3
+ Date: 2026-10-23. Package: `@ljwei-stak/dsh-model-router@0.23.0`.
4
+
5
+ This release adds observable workbench execution and cancellation, retaining the plugin identity, saved configuration, execution history and supported DSH SDK versions. It also fixes the incomplete-history marker after a failed corrupt-state recovery.
6
+
7
+ ## Accepted behavior
8
+
9
+ - `startRun` returns a Host job snapshot after fresh preview, budget and permission checks; strict `runStatus` and `cancelRun` requests accept only a job ID. Existing internal synchronous execution helpers remain available.
10
+ - The workbench shows elapsed time, current package and individual package states. Status transport failures retry serially without losing cancellation. Old status/cancel responses cannot replace newer progress, a terminal result or another job.
11
+ - Cancellation reaches the same AbortSignal used by API streams and official CLI teams. The job stays cancelling until execution and cleanup settle. Already completed answers and reported usage/cost remain in the execution ledger, including cancellation during optional result review. Cancelled editable teams do not begin integration.
12
+ - Closing the panel does not cancel execution. Reopening in the same browser reconnects using only an opaque job ID in session storage. Reopening before the start acknowledgement waits for and takes over the original job, preventing duplicate launch. A failed launch is never automatically resubmitted.
13
+ - If corrupt-state recovery fails before it can commit a notice, a later read/write preserves the incomplete-history marker. Budget checks continue to treat lost cost history as incomplete.
14
+
15
+ ## Validation
16
+
17
+ - Full suite: 1035 tests, 1032 passed, 0 failed, 3 existing platform-dependent skips. Skipped PTY/process checks do not count as execution acceptance.
18
+ - Fifty new feature tests cover job lifecycle and capacity, a real Host and typed gateway with inert adapters, execution progress, cancellation accounting, optional review cancellation and UI races/reconnection.
19
+ - The strict frozen pnpm installation, actual client build, generated-client consistency, paired README checks, workbench preview compilation and `git diff --check` passed. README formulas were not changed.
20
+ - Browser inspection of the actual workbench component with offline fixtures covered running progress, cancelling cleanup and the final cancelled ledger. Screenshots were inspected; browser warning/error logs were empty. The [progress screenshot](../assets/workbench-run-progress.png) uses simulated tasks and prices.
21
+ - An independent GPT read-only review checked the runtime package file/import closure, strict RPCs, cancellation/accounting paths, sensitive-token patterns and the pending-start panel recovery race.
22
+ - The release process compares every package member against the exact release commit's Git blobs, then downloads the npm payload and GitHub Release asset to verify their bytes. Commit IDs and tarball hashes are recorded in the external publication audit.
23
+
24
+ ## Boundaries
25
+
26
+ Jobs are held in Host memory, with at most four active jobs and fifty retained snapshots. A Host restart loses live job snapshots; the workbench directs users to the persisted execution history instead of starting another job. Host disposal requests cancellation; a running adapter must honor its AbortSignal before cancellation can finish. Costs already incurred remain chargeable, and unavailable prices/usage remain unknown.
27
+
28
+ This release was not tested end to end in an installed DSH Desktop or with real paid provider/vendor CLI inference. No new provider execution claims are made. Earlier real execution evidence remains in the dated [0.20.0 report](0.20.0-validation.md), and Hermes/Pi managed execution remains unverified.
29
+
30
+ Upgrade by fully quitting Harness, including its tray and Host process, updating the plugin to 0.23.0, and restarting.