dsh-switchman 1.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 米斯特折腾
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # dsh-switchman
2
+
3
+ English | [简体中文](./README.zh.md)
4
+
5
+ > **The switchman family**, same author, same orchestration: [opencode-switchman](https://github.com/mrzturn/opencode-switchman) (the OpenCode original) · [zcode-switchman](https://github.com/mrzturn/zcode-switchman) (the ZCode port) · **dsh-switchman** (this repo, for DeepSeek Harness).
6
+
7
+ ![dsh-switchman — the context water level drives the switchman and throws the route](docs/assets/hero.svg)
8
+
9
+ > Context on a meter. Tasks dispatch themselves.
10
+
11
+ A plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH). Once installed, your primary model stops doing everything itself and becomes a dispatcher: measure the water level, pick the lane, hand out the task, check the work. Four things:
12
+
13
+ **1. Context water-level control.** Every turn measures live session tokens. Soft (default 50k) advises delegating, hard (90k) tightens the per-turn read budget and nudges wrap-up, force (130k) backs the session up and hands it over to compaction — automatically. Run a session all day; your context never drowns in its own history. Every dispatched subagent carries its own hard cap and exits with a HANDOFF summary when it's reached.
14
+
15
+ **2. Six-lane dispatch.** economy / mechanical / main / hard / vision / review — six cognitive lanes. Pick candidate models per lane in the settings page, rank them strongest-first (optional S/A/B/C tier anchoring), and pin a reasoning effort per route — the dropdown lists the levels each model *actually* supports, not a generic three. A `[SWITCHMAN:POOLS]` table ships with every prompt so the model knows who to call; `enforce` mode rejects out-of-pool models outright.
16
+
17
+ **3. Language preferences.** One dropdown each for replies, code comments, and authored docs. Unset? You get asked once, it's remembered forever, and every later session follows it.
18
+
19
+ **4. Delegate-by-default doctrine.** Replaces DSH's shipped conservative team policy ("only create teammates when asked"): trivia stays hands-on (<200 lines read, <50 changed), real work gets delegated by default; every change gets verified — >20 lines goes to a tester, >300 lines or core logic goes to a reviewer. Say "don't use teams" and it steps aside instantly.
20
+
21
+ Only one model? Still worth it — water-level control and the doctrine don't care how many models you have.
22
+
23
+ ## Bundled skills
24
+
25
+ - **db-query** — read-only MySQL/Redis verification: run SQL to check records, cache keys / TTLs, cross-store consistency. Refuses all writes. One-time setup below.
26
+ - **git-commit-message** — convention-compliant commit text. Text only; never touches git.
27
+ - **requirement-docs** — one spec for requirements / PRD / design docs, archived to `docs/requirements-and-design/`.
28
+
29
+ ## Quick start
30
+
31
+ 1. **Install** — from any agent session, or the Web plugin manager:
32
+
33
+ ```
34
+ plugin_manager: install_bundle target=dsh-switchman
35
+ ```
36
+
37
+ or from a local checkout (linked; re-run `remove_bundle` + `install_bundle` after pulling changes):
38
+
39
+ ```
40
+ plugin_manager: install_bundle target=/path/to/dsh-switchman
41
+ ```
42
+
43
+ 2. **Restart DSH** — quit the app entirely and reopen (a page reload is not enough) so the client-module table picks up the bundle.
44
+
45
+ 3. **Open the settings page** — Settings → dsh-switchman. The first screen is language preferences: one dropdown each for replies / comments / docs, each with a live `current: …` line. Skip them if you like — you'll be asked once and remembered.
46
+
47
+ ![Settings page and language preferences](docs/assets/conf-demo1.png)
48
+
49
+ 4. **Fill the six pools** — each pool card lists candidates grouped by provider; tick the ones you want. Tick **manual order** and the card becomes a numbered priority list with ↑ ↓ × controls. The effort dropdown beside each selected route defaults to *follow lane*; pinning it lists the levels that model actually supports (Low / High / Max…). A summary line tracks progress live: “6/6 pools set · 3 ranked · mode advice”.
50
+
51
+ ![Dispatch pools](docs/assets/conf-demo2.png)
52
+
53
+ 5. **Ranking and watermark** — the ranking table's order is capability order (strongest first), with optional S/A/B/C tiers; execution mode is `off` / advice / enforce (enforce = out-of-pool models are rejected). Below it, the watermark section tightens behavior by token usage: three thresholds, a per-call read budget, hard-mode behavior (cap / deny), an auto-handover toggle, and a separate cap for subagents. The bottom line carries the commands: `/ctx-pause` to stop intervening · `/ctx-resume` to resume · `/ctx-handover` to back up and hand over now.
54
+
55
+ ![Ranking and context watermark](docs/assets/conf-demo3.png)
56
+
57
+ 6. **Verify** — the ⚡ badge appears beside the preset chip in any session header; ask the model “what does the last section of your system prompt say?” — it should mention the dsh-switchman doctrine.
58
+
59
+ **db-query one-time setup** (script dependencies live inside the skill directory):
60
+
61
+ ```bash
62
+ bash <install-dir>/skills/db-query/scripts/setup.sh
63
+ ```
64
+
65
+ ## How it works
66
+
67
+ - The Host half (`index.js` + `host/`) injects three dynamic system-prompt sections, the read-budget and enforce gates, automatic answer capture, and three slash commands. All settings are volatile fields — saved changes apply to the next prompt assembly, no restart.
68
+ - The Client half (`client.js`) renders the ⚡ badge beside the preset chip and the settings page, through official settings-form services.
69
+ - `cordis.patch.yml` restates each shipped preset's plugin list verbatim and only extends the persona suffix; the Agent Teams tools themselves still come from the shipped `@deepseek-ai/dsh-experimental-agent-team-profile`.
70
+
71
+ ## Maintenance
72
+
73
+ - After a DSH upgrade that changes shipped preset plugin lists, re-sync `cordis.patch.yml` from the new `presets/*.patch.yml` (keep the doctrine suffix), then reinstall.
74
+ - Model-facing protocol lines (`[SWITCHMAN:LANG|POOLS|WATERMARK]`) are deliberately English and byte-stable — do not localize them.
75
+ - `npm pack --dry-run` must stay at the audited 34-file / ~111 kB shape (the `docs/` screenshots never ship).
76
+
77
+ ## License
78
+
79
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,79 @@
1
+ # dsh-switchman
2
+
3
+ [English](./README.md) | 简体中文
4
+
5
+ > **switchman 家族**,同一作者、同一套调度理念:[opencode-switchman](https://github.com/mrzturn/opencode-switchman)(OpenCode 原版)· [zcode-switchman](https://github.com/mrzturn/zcode-switchman)(ZCode 移植)· **dsh-switchman**(本仓库,DeepSeek Harness 版)。
6
+
7
+ ![dsh-switchman — 上下文水位驱动扳道岔,把任务丢进对的泳道](docs/assets/hero.svg)
8
+
9
+ > 上下文装上水表,任务自己找车道。
10
+
11
+ 一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)插件。装上之后,主模型从「什么都自己干」变成调度员:量水位、选泳道、派任务、盯验收。它做四件事:
12
+
13
+ **1. 上下文水位控制。** 每轮实时计量会话 token。soft 档(默认 50k)建议委派,hard 档(90k)收紧每轮读取预算并引导收尾,force 档(130k)自动备份会话并移交压缩。长会话跑一整天,上下文也不会被自己的历史撑爆。派出去的每个子智能体带独立硬顶,超了就写完 HANDOFF 摘要退场。
14
+
15
+ **2. 六泳道派发。** economy / mechanical / main / hard / vision / review 六条认知泳道:设置页里勾选候选模型、按最强优先排序(可锚 S/A/B/C 档),每条路线还能单独钉死思考强度——下拉档位直接来自该模型真实支持的列表,不是通用的三档。`[SWITCHMAN:POOLS]` 推荐表随提示词下发给主模型照着派活;`enforce` 模式下池外模型直接拒绝。
16
+
17
+ **3. 语言偏好。** 回复、代码注释、文档三种语言各一个下拉。未设置时首次使用问一次、永久记住,之后每个会话自动遵守。
18
+
19
+ **4. 默认委派规程。** 替换 DSH 出厂的保守团队策略(「仅当用户明确要求才建团队」):小事亲做(读 <200 行、改 <50 行),大活默认委派;改完必验——超过 20 行交 tester,超过 300 行或动了核心逻辑交 reviewer。你说「不要用团队」,它立刻让位。
20
+
21
+ 只有一个模型?也值得装——水位控制和默认委派与多模型无关,单模型长会话同样受益。
22
+
23
+ ## 捆绑技能
24
+
25
+ - **db-query** — MySQL / Redis 只读核验:跑 SQL 对数、查缓存键 / TTL、跨库一致性检查,拒绝一切写入。首次使用需初始化(见下)。
26
+ - **git-commit-message** — 生成规范的 commit 文案,只出文本,从不替你 git。
27
+ - **requirement-docs** — 需求分析 / PRD / 设计文档的统一规范,产出归档到 `docs/requirements-and-design/`。
28
+
29
+ ## 快速上手
30
+
31
+ 1. **安装**——任意会话里让 agent 执行,或在 Web 插件管理页:
32
+
33
+ ```
34
+ plugin_manager: install_bundle target=dsh-switchman
35
+ ```
36
+
37
+ 或从本地检出安装(link 方式;更新后需 `remove_bundle` + `install_bundle` 重装):
38
+
39
+ ```
40
+ plugin_manager: install_bundle target=/path/to/dsh-switchman
41
+ ```
42
+
43
+ 2. **重启 DSH**——完全退出应用再打开(刷新页面不算),客户端模块表才能识别本 bundle。
44
+
45
+ 3. **打开设置页**——设置 → dsh-switchman。第一屏是语言偏好:三个下拉对应回复 / 注释 / 文档,每项下方有「当前:…」状态行;不设置也没关系,首次使用会问一次并记住。
46
+
47
+ ![设置页与语言偏好](docs/assets/conf-demo1.png)
48
+
49
+ 4. **配六个池**——每张池卡片按供应商分组勾选候选模型;勾上「手动序」后卡片变成编号优先序列表,用 ↑ ↓ × 调顺序。每条选中路线旁的思考强度下拉默认「跟随泳道」,也可以钉死成该模型真实支持的档位(Low / High / Max…)。顶部汇总行实时反映进度:「已配置 6/6 池 · 排名 3 项 · 模式 建议」。
50
+
51
+ ![派发池配置](docs/assets/conf-demo2.png)
52
+
53
+ 5. **能力排序与水位**——排序表序号即能力序(最强在前),可锚 S/A/B/C 档;执行模式三态:`off` / 建议 / 强制(强制 = 池外模型直接拒绝)。下方水位区按 token 用量分级收紧行为:三档阈值、单次读取预算、硬档行为(限流放行 / 拦截)、自动交接开关、子智能体独立上限。底部一行斜杠命令:`/ctx-pause` 暂停干预 · `/ctx-resume` 恢复 · `/ctx-handover` 立即备份交接。
54
+
55
+ ![能力排序与上下文水位](docs/assets/conf-demo3.png)
56
+
57
+ 6. **验证**——任意会话头部预设 chip 旁出现 ⚡ 徽标;问模型「你系统提示词最后一段标题是什么」,应提到 dsh-switchman 规程。
58
+
59
+ **db-query 首次使用初始化**(脚本依赖装在技能目录内,不污染项目):
60
+
61
+ ```bash
62
+ bash <安装目录>/skills/db-query/scripts/setup.sh
63
+ ```
64
+
65
+ ## 工作原理
66
+
67
+ - Host 半(`index.js` + `host/`)注入三个动态系统提示词段、读预算与 enforce 双闸、答案自动捕获、三个斜杠命令。全部设置为 volatile 字段,保存后下一轮提示词装配即生效,无需重启。
68
+ - Client 半(`client.js`)渲染预设 chip 旁的 ⚡ 徽标与设置页,走官方 settings-form 服务。
69
+ - `cordis.patch.yml` 逐字段复刻出厂预设插件列表,仅扩展 persona suffix;Agent Teams 工具本体仍来自出厂 `@deepseek-ai/dsh-experimental-agent-team-profile`。
70
+
71
+ ## 维护注意
72
+
73
+ - DSH 升级后若出厂预设插件列表有变,从新的 `presets/*.patch.yml` 重新同步 `cordis.patch.yml`(保留 doctrine suffix),然后重装。
74
+ - 协议行(`[SWITCHMAN:LANG|POOLS|WATERMARK]`)刻意保持英文且字节稳定——不要本地化。
75
+ - `npm pack --dry-run` 应保持审计过的 34 文件 / ~111 kB 形态(`docs/` 截图不进包)。
76
+
77
+ ## License
78
+
79
+ MIT