dsh-lean-router 1.0.9 → 2.0.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/NOTICE.md +2 -4
- package/README.en.md +47 -43
- package/README.md +45 -41
- package/cordis.patch.yml +4 -26
- package/docs/agents/domain.md +1 -1
- package/docs/architecture.en.md +51 -86
- package/docs/architecture.md +46 -77
- package/docs/changelog.en.md +32 -1
- package/docs/changelog.md +32 -1
- package/docs/configuration.en.md +25 -56
- package/docs/configuration.md +14 -45
- package/docs/install.en.md +2 -2
- package/docs/install.md +2 -2
- package/docs/quickstart.en.md +29 -34
- package/docs/quickstart.md +11 -16
- package/docs/release-checklist.en.md +3 -4
- package/docs/release-checklist.md +5 -6
- package/docs//350/267/257/347/224/261-/350/256/276/350/256/241/350/257/264/346/230/216.md +2 -2
- package/lib/index.js +9 -61
- package/lib/router.js +15 -148
- package/package.json +4 -15
- package/presets/base/frag-lean.patch.yml +1 -5
- package/presets/base/frag-preset.patch.yml +1 -3
- package/presets/base/frag-router.patch.yml +1 -12
- package/presets/base/frag-toolface.patch.yml +0 -2
- package/presets/base/lean-router.patch.yml +1 -4
- package/scripts/doctor.mjs +15 -10
- package/test/integration-preset.test.mjs +4 -3
- package/test/plugin-entry.test.mjs +15 -50
- package/test/router.test.mjs +7 -47
- package/assets/gating.weights.json +0 -13
- package/assets/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
- package/assets/skills/ask-matt/SKILL.md +0 -80
- package/assets/skills/ask-matt/agents/openai.yaml +0 -5
- package/assets/skills/chief-of-staff/SKILL.md +0 -76
- package/assets/skills/chief-of-staff/agents/openai.yaml +0 -5
- package/assets/skills/code-review/SKILL.md +0 -91
- package/assets/skills/code-review/agents/openai.yaml +0 -5
- package/assets/skills/codebase-design/DEEPENING.md +0 -37
- package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
- package/assets/skills/codebase-design/SKILL.md +0 -116
- package/assets/skills/codebase-design/agents/openai.yaml +0 -5
- package/assets/skills/diagnosing-bugs/SKILL.md +0 -140
- package/assets/skills/diagnosing-bugs/agents/openai.yaml +0 -5
- package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
- package/assets/skills/domain-modeling/ADR-FORMAT.md +0 -47
- package/assets/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
- package/assets/skills/domain-modeling/SKILL.md +0 -76
- package/assets/skills/domain-modeling/agents/openai.yaml +0 -5
- package/assets/skills/grilling/SKILL.md +0 -52
- package/assets/skills/grilling/agents/openai.yaml +0 -5
- package/assets/skills/handoff/SKILL.md +0 -17
- package/assets/skills/handoff/agents/openai.yaml +0 -5
- package/assets/skills/implement/SKILL.md +0 -55
- package/assets/skills/implement/agents/openai.yaml +0 -5
- package/assets/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/assets/skills/improve-codebase-architecture/SKILL.md +0 -72
- package/assets/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
- package/assets/skills/loop-me/SKILL.md +0 -33
- package/assets/skills/loop-me/agents/openai.yaml +0 -5
- package/assets/skills/pr/CREDITS.md +0 -3
- package/assets/skills/pr/SKILL.md +0 -172
- package/assets/skills/pr/agents/openai.yaml +0 -5
- package/assets/skills/prototype/LOGIC.md +0 -67
- package/assets/skills/prototype/SKILL.md +0 -28
- package/assets/skills/prototype/UI.md +0 -112
- package/assets/skills/prototype/agents/openai.yaml +0 -5
- package/assets/skills/research/SKILL.md +0 -14
- package/assets/skills/research/agents/openai.yaml +0 -5
- package/assets/skills/retro/SKILL.md +0 -45
- package/assets/skills/retro/agents/openai.yaml +0 -5
- package/assets/skills/setup-matt-pocock-skills/SKILL.md +0 -121
- package/assets/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
- package/assets/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -50
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
- package/assets/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/assets/skills/setup-ts-deep-modules/SKILL.md +0 -103
- package/assets/skills/setup-ts-deep-modules/agents/openai.yaml +0 -5
- package/assets/skills/setup-ts-deep-modules/dependency-cruiser.config.cjs +0 -95
- package/assets/skills/software-factory/EXAMPLE-TASKS.md +0 -80
- package/assets/skills/software-factory/GIT-HOSTS.md +0 -84
- package/assets/skills/software-factory/OBSERVABILITY-PLATFORMS.md +0 -75
- package/assets/skills/software-factory/RUNNERS.md +0 -94
- package/assets/skills/software-factory/SKILL.md +0 -99
- package/assets/skills/software-factory/TICKET-TRACKERS.md +0 -85
- package/assets/skills/tdd/SKILL.md +0 -40
- package/assets/skills/tdd/agents/openai.yaml +0 -5
- package/assets/skills/tdd/mocking.md +0 -59
- package/assets/skills/tdd/tests.md +0 -77
- package/assets/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/assets/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/assets/skills/teach/MISSION-FORMAT.md +0 -31
- package/assets/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/assets/skills/teach/SKILL.md +0 -141
- package/assets/skills/teach/agents/openai.yaml +0 -5
- package/assets/skills/to-questionnaire/SKILL.md +0 -55
- package/assets/skills/to-questionnaire/agents/openai.yaml +0 -5
- package/assets/skills/to-spec/SKILL.md +0 -76
- package/assets/skills/to-spec/agents/openai.yaml +0 -5
- package/assets/skills/to-tickets/SKILL.md +0 -106
- package/assets/skills/to-tickets/agents/openai.yaml +0 -5
- package/assets/skills/triage/AGENT-BRIEF.md +0 -207
- package/assets/skills/triage/OUT-OF-SCOPE.md +0 -105
- package/assets/skills/triage/SKILL.md +0 -113
- package/assets/skills/triage/agents/openai.yaml +0 -5
- package/assets/skills/wait-what/SKILL.md +0 -8
- package/assets/skills/wait-what/agents/openai.yaml +0 -5
- package/assets/skills/wayfinder/SKILL.md +0 -129
- package/assets/skills/wayfinder/agents/openai.yaml +0 -5
- package/assets/skills/wizard/SKILL.md +0 -46
- package/assets/skills/wizard/agents/openai.yaml +0 -5
- package/assets/skills/wizard/template.sh +0 -223
- package/assets/skills/writing-beats/SKILL.md +0 -44
- package/assets/skills/writing-beats/agents/openai.yaml +0 -5
- package/assets/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
- package/assets/skills/writing-for-agents/SKILL.md +0 -83
- package/assets/skills/writing-for-agents/agents/openai.yaml +0 -5
- package/assets/skills/writing-fragments/SKILL.md +0 -80
- package/assets/skills/writing-fragments/agents/openai.yaml +0 -5
- package/assets/skills/writing-shape/SKILL.md +0 -59
- package/assets/skills/writing-shape/agents/openai.yaml +0 -5
- package/assets/skills.matrix.json +0 -311
- package/docs/HANDOFF-2026-11-22.md +0 -155
- package/docs/matrix.en.md +0 -57
- package/docs/matrix.md +0 -57
- package/docs//346/212/200/350/203/275/351/227/250/346/216/247-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -134
- package/docs//351/235/242/346/235/277-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -205
- package/lib/audit-commands.js +0 -289
- package/lib/audit-sink.js +0 -137
- package/lib/client.js +0 -276
- package/lib/gate-runner.js +0 -179
- package/lib/skill-provider.js +0 -167
- package/lib/skillgate.js +0 -396
- package/lib/skills-panel.js +0 -322
- package/scripts/check-drift.mjs +0 -24
- package/skills.manifest.json +0 -287
- package/test/audit-commands.test.mjs +0 -325
- package/test/audit-sink.test.mjs +0 -150
- package/test/client-plugin.test.mjs +0 -123
- package/test/gate-run.test.mjs +0 -173
- package/test/manifest.test.mjs +0 -25
- package/test/provider.test.mjs +0 -21
- package/test/skillgate-provider.test.mjs +0 -122
- package/test/skillgate.test.mjs +0 -217
- package/test/skills-panel.test.mjs +0 -114
- package/ui/go.json +0 -19
package/NOTICE.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# NOTICE
|
|
2
2
|
|
|
3
|
-
本包(dsh-lean-router
|
|
3
|
+
本包(dsh-lean-router)站在三个上游的肩膀上,均按 MIT 或其声明的许可条款再分发。本表是**贡献映射表**:上游 → 贡献到本包的层 → 本包中的承载文件。各上游的 LICENSE 全文保留在其原仓库;以下仅摘录 MIT 声明的版权行(非全文)。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 三上游致谢表
|
|
6
6
|
|
|
7
7
|
| 上游 | 版本 / 基线 | 贡献到本包的层 | 本包承载位置 | 许可(版权行摘录) |
|
|
8
8
|
|---|---|---|---|---|
|
|
9
9
|
| dsh-flash-presets(LarryE135) | 0.3.2 | lean 四机制(轮次压缩/输出裁剪/关插件/行为纪律)、plan-mode v1、delivery-gate、glob/grep 并发标记、preset 双档形态 | lib/lean/*(compaction/pruner/disabled/persona-text/plan-mode/delivery-gate/tool-concurrency)、presets/base/frag-lean.patch.yml | MIT — Copyright (c) 2026 LarryE135 |
|
|
10
10
|
| dsh-codemode(dsh-codemode contributors) | 0.3.0,main @ f9758ec | toolface 掩蔽接缝(ToolExecutor describe/execute)、code_run 传输与并发池、meta 发现 4 工具、三视图 scope 归因、retention 双清理 | lib/toolface/*(8 模块 file-for-file vendored,适配点以注释标注)、presets/base/frag-toolface.patch.yml | MIT — Copyright (c) 2026 dsh-codemode contributors |
|
|
11
11
|
| dsh-routing-suite(yjh051108) | 0.3.3(@dsh-external/dsh-super-injector) | 思考链路由**思想**(行为带分类、近场引导、反稀释勤勉自检的轻量化)——只移植实测结论,未搬运其旧线代码 | lib/router.js、lib/bands.js(实现重写,头部注明思想来源) | MIT — Copyright (c) 2026 yjh051108 |
|
|
12
|
-
| mattpocock skills | 31 个技能正文 | skills 数据源与内置副本兜底、门控层评分数据 | assets/skills/(31 目录)、assets/skills.matrix.json、skills.manifest.json | MIT(沿用既有 NOTICE 口径;正文经主人引入本地 ~/.dsh/skills,本包以内置副本作 vendored fallback) |
|
|
13
12
|
|
|
14
13
|
## 逐文件 vendored 映射(摘要)
|
|
15
14
|
|
|
@@ -20,6 +19,5 @@
|
|
|
20
19
|
- **lib/lean/disabled.js**:flash-lean-ptc-v3.patch.yml L155-202 的 6 行 disabled 清单照抄。
|
|
21
20
|
- **lib/toolface/**(8 模块):upstream dsh-codemode 0.3.0 lib/{index,rules,executor,discovery,scope,pool,retention,transport}.js,file-for-file vendored @ f9758ec;适配:插件名/日志前缀改本包、native executor 依赖动态 import + 安装提示 stub、Symbol 键与 TAG 标注。
|
|
22
21
|
- **lib/router.js / lib/bands.js**:routing-suite 思想移植(非代码);关键实测结论(三带 persona 非连续、V4.1 Flash 阈值型最优解)已在 bands.js L1-7 头注注明。
|
|
23
|
-
- **assets/skills/**:mattpocock 31 技能正文副本(tier bundled 兜底;一级来源仍是 ~/.dsh/skills 同名目录)。
|
|
24
22
|
|
|
25
23
|
按 MIT 要求,各上游的版权与许可声明随再分发保留;对本包的修改(适配点)均在文件头部注明,未删除上游署名信息。
|
package/README.en.md
CHANGED
|
@@ -1,69 +1,73 @@
|
|
|
1
1
|
# dsh-lean-router
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A DeepSeek Harness (DSH) cordis plugin tuned for DeepSeek V4.1 Flash: **one plugin card** fusing three layers — the lean token-saving four mechanisms (flash-presets measured tuning), `code_run` tool masking (the codemode seam), and thinking-chain routing across three bands (routing-suite ideas).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Chinese version: [README.md](./README.md).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## The three layers
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Layers at a glance
|
|
12
|
-
|
|
13
|
-
| Layer | Modules | One line |
|
|
9
|
+
| Layer | Code | Job |
|
|
14
10
|
|---|---|---|
|
|
15
|
-
| lean
|
|
16
|
-
| toolface
|
|
17
|
-
| router
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| panel (ticket 07, in flight) | ui/ | panel card (decision rows + score table + token comparison + banner), **not accepted yet** |
|
|
11
|
+
| lean | lib/lean/ | turn compaction (thresholdRatio 0.25 / retainTokens 20000), tool-output pruning (8192/4096/1024), six redundant plugins turned off, two behaviour-discipline tiers (lean 13 rules / balance 3 rules), plan-mode v1, plus two add-ons: the delivery gate and glob/grep concurrency markers |
|
|
12
|
+
| toolface | lib/toolface/ | hides every tool the preset does not own from the **model-facing request** (`mcp__` prefix plus everything outside the preset) and keeps `code_run` as the only transport; a program can still discover and call the masked tools |
|
|
13
|
+
| router | lib/router.js · lib/bands.js | spec/react/weak bands + the `[router] band=` directive + near-field guides (zero-write) + a diligence reminder every 10 turns + the `/band` command |
|
|
14
|
+
|
|
15
|
+
> Since 2.0.0 the **skills subsystem is gone entirely**: no bundled mattpocock 31 skills, no per-turn scoring gate, no audit channel and no skills panel UI. See the [changelog](./docs/changelog.en.md).
|
|
21
16
|
|
|
22
17
|
## Target DSH
|
|
23
18
|
|
|
24
|
-
engines: `>=0.2.1-rc.5 <0.2.4-0` (measured baseline 0.2.3-alpha.2, still compatible back to 0.2.1-rc.5). DSH is in developer preview; breaking changes are handled by the engines gate
|
|
19
|
+
engines: `>=0.2.1-rc.5 <0.2.4-0` (measured baseline 0.2.3-alpha.2, still compatible back to 0.2.1-rc.5). DSH is in developer preview; breaking changes are handled by the engines gate and the doctor self-check, never by silent degradation.
|
|
25
20
|
|
|
26
21
|
## Install
|
|
27
22
|
|
|
28
|
-
Not published yet; start with a local link (both paths in [docs/quickstart.en.md](docs/quickstart.en.md)):
|
|
29
|
-
|
|
30
23
|
~~~powershell
|
|
31
|
-
dsh plugin --profile desktop add
|
|
32
|
-
# once published: dsh plugin --profile desktop add npm:dsh-lean-router@1.0.4
|
|
24
|
+
dsh plugin --profile desktop add npm:dsh-lean-router@2.0.0
|
|
33
25
|
~~~
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
After restarting DSH, pick **Lean router** (the lean tier) or **Lean router (balance)** (the weaker-constraint tier) for new sessions. For local development install from a `link:` path; see [quickstart](docs/quickstart.en.md).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
1. Presets: **Lean router** (13 rules + 3 soft gates + routing) or **Lean router (balance)** (3 rules, no routing directives yet).
|
|
32
|
+
2. Explicit routing directive, written in the first real user message:
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
~~~text
|
|
35
|
+
[router] band=spec
|
|
36
|
+
[router] band=react task=split the home page into components
|
|
37
|
+
[router] band=auto
|
|
38
|
+
~~~
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
3. Commands: `/band` to view or switch the band, `/compact` for manual compaction.
|
|
41
|
+
4. Masking is automatic: the model's tool list only contains the preset's own tools plus `code_run`; MCP and out-of-preset tools are discovered inside a `code_run` program with `tools.code_tools_search(...)`.
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
## Docs
|
|
47
44
|
|
|
48
|
-
| Topic |
|
|
45
|
+
| Topic | English | 中文 |
|
|
49
46
|
|---|---|---|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
| Changelog | [
|
|
47
|
+
| Architecture | [architecture.en.md](docs/architecture.en.md) | [architecture.md](docs/architecture.md) |
|
|
48
|
+
| Configuration | [configuration.en.md](docs/configuration.en.md) | [configuration.md](docs/configuration.md) |
|
|
49
|
+
| Quickstart | [quickstart.en.md](docs/quickstart.en.md) | [quickstart.md](docs/quickstart.md) |
|
|
50
|
+
| Install | [install.en.md](docs/install.en.md) | [install.md](docs/install.md) |
|
|
51
|
+
| Changelog | [changelog.en.md](docs/changelog.en.md) | [changelog.md](docs/changelog.md) |
|
|
52
|
+
| Release checklist | [release-checklist.en.md](docs/release-checklist.en.md) | [release-checklist.md](docs/release-checklist.md) |
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
Internal engineering notes are Chinese only: [routing](docs/路由-设计说明.md) · [tool-masking wiring](docs/工具遮蔽-接线说明.md) · [disabled-plugin review](docs/复核-关插件清单.md).
|
|
55
|
+
|
|
56
|
+
## Self-check
|
|
57
|
+
|
|
58
|
+
~~~powershell
|
|
59
|
+
npm test # node --test "test/*.test.mjs"
|
|
60
|
+
npm run build # rebuild cordis.patch.yml (base + 4 fragments, fixed order)
|
|
61
|
+
npm run doctor # 11 structural checks
|
|
62
|
+
npm run verify # build --check (byte-identical) + doctor
|
|
63
|
+
~~~
|
|
57
64
|
|
|
58
|
-
##
|
|
65
|
+
## Current state (stated plainly)
|
|
59
66
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- **Gate fallback mode**: when the host skill-registry cache is serving, per-turn gating runs through the injection seam and audits are labeled `mode: "fallback-cached-list"`.
|
|
64
|
-
- **8k soft degradation**: when the gate injection estimate exceeds `tokenBudget 8000`, low-score skills drop a tier with no count cap.
|
|
65
|
-
- **Sole effective preset row**: the frag-preset.patch.yml union snapshot is the only effective preset row (cordis patches replace preset rows as whole keys).
|
|
67
|
+
- The balance preset carries no routing directives yet.
|
|
68
|
+
- The plan-mode policy paragraph keeps the upstream flash text (including the PTC `run_code` sentence).
|
|
69
|
+
- Tool masking depends on `@deepseek-ai/dsh-tool-executor-native`; when it is missing the executor degrades to an install-hint stub and the first `describe` throws instead of failing silently.
|
|
66
70
|
|
|
67
|
-
## License and
|
|
71
|
+
## License and credits
|
|
68
72
|
|
|
69
|
-
MIT, see [LICENSE](LICENSE). The
|
|
73
|
+
MIT, see [LICENSE](LICENSE). The upstream contribution map and license statements are in [NOTICE.md](NOTICE.md): dsh-flash-presets (LarryE135) · dsh-codemode (dsh-codemode contributors) · dsh-routing-suite (yjh051108).
|
package/README.md
CHANGED
|
@@ -1,69 +1,73 @@
|
|
|
1
1
|
# dsh-lean-router
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
为 DeepSeek V4.1 Flash 调校的 DeepSeek Harness(DSH)cordis 插件:**一张插件卡**里融合三层——lean 省 token 四机制(flash-presets 实测口径)、`code_run` 工具遮蔽(codemode 接缝)、思考链路由三带(routing-suite 思想)。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
英文版:[README.en.md](./README.en.md)。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 三层一览
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 功能一图
|
|
12
|
-
|
|
13
|
-
| 层 | 模块 | 一句话 |
|
|
9
|
+
| 层 | 代码 | 职责 |
|
|
14
10
|
|---|---|---|
|
|
15
|
-
| lean
|
|
16
|
-
| toolface
|
|
17
|
-
| router
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| panel(票 07 进行中) | ui/ | 面板卡片(决策行 + 得分表 + token 对比 + 黄条),**未验收** |
|
|
11
|
+
| lean | lib/lean/ | 轮次压缩(thresholdRatio 0.25 / retainTokens 20000)、工具输出裁剪(8192/4096/1024)、关 6 个冗余插件、行为纪律双档(lean 13 条 / balance 3 条)、plan-mode v1,外加两个加料件:交付门与 glob/grep 并发标记 |
|
|
12
|
+
| toolface | lib/toolface/ | 把预设不拥有的工具从**模型请求面**隐藏(`mcp__` 前缀 + 预设外全部),`code_run` 作为唯一传输;程序内仍可发现并调用被遮蔽的工具 |
|
|
13
|
+
| router | lib/router.js · lib/bands.js | spec/react/weak 三带 + `[router] band=` 显式指令 + 近场引导(零写入)+ 每 10 轮勤勉自检 + `/band` 命令 |
|
|
14
|
+
|
|
15
|
+
> 2.0.0 起**技能子系统已整体移除**:不再内置 mattpocock 31 技能、不再每轮打分门控、不再有审计通道与技能面板 UI。变更见 [changelog](./changelog.md)。
|
|
21
16
|
|
|
22
17
|
## 目标 DSH
|
|
23
18
|
|
|
24
|
-
engines:`>=0.2.1-rc.5 <0.2.4-0`(实测基线 0.2.3-alpha.2,兼容回 0.2.1-rc.5)。DSH 处于 developer preview,破坏性变更将以 engines 闸 + doctor
|
|
19
|
+
engines:`>=0.2.1-rc.5 <0.2.4-0`(实测基线 0.2.3-alpha.2,兼容回 0.2.1-rc.5)。DSH 处于 developer preview,破坏性变更将以 engines 闸 + doctor 自检应对,不做静默降级。
|
|
25
20
|
|
|
26
21
|
## 安装
|
|
27
22
|
|
|
28
|
-
未发布,先本地 link(两条路径详见 [docs/quickstart.md](docs/quickstart.md)):
|
|
29
|
-
|
|
30
23
|
~~~powershell
|
|
31
|
-
dsh plugin --profile desktop add
|
|
32
|
-
# 发布后:dsh plugin --profile desktop add npm:dsh-lean-router@1.0.4
|
|
24
|
+
dsh plugin --profile desktop add npm:dsh-lean-router@2.0.0
|
|
33
25
|
~~~
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
重启 DSH 后,新会话在预设列表选择 **Lean router**(lean 档)或 **Lean router (balance)**(弱约束精简档)。本地开发用 `link:` 路径安装,见 [quickstart](docs/quickstart.md)。
|
|
36
28
|
|
|
37
|
-
##
|
|
29
|
+
## 用法
|
|
38
30
|
|
|
39
|
-
1.
|
|
40
|
-
2.
|
|
41
|
-
3. 命令:`/band` 看切带、`/skill` 列技能、`/compact` 手动压缩。
|
|
42
|
-
4. 体检:`node scripts/doctor.mjs`(7 项自检)→ `npm run verify`(含 build --check 反向一致,与 doctor 合计 8 道把关)→ `npm test`。
|
|
31
|
+
1. 预设:**Lean router**(13 条纪律 + 3 软门 + 路由)或 **Lean router (balance)**(3 条纪律,暂不含路由指令)。
|
|
32
|
+
2. 显式路由指令(写在首条真实用户消息里):
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
~~~text
|
|
35
|
+
[router] band=spec
|
|
36
|
+
[router] band=react task=把首页拆成组件
|
|
37
|
+
[router] band=auto
|
|
38
|
+
~~~
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
3. 命令:`/band` 看切带、`/compact` 手动压缩。
|
|
41
|
+
4. 工具遮蔽是自动的:模型工具列表只出现预设自有工具 + `code_run`;MCP 与预设外插件工具在 `code_run` 程序内用 `tools.code_tools_search(...)` 发现后调用。
|
|
42
|
+
|
|
43
|
+
## 文档
|
|
47
44
|
|
|
48
45
|
| 主题 | 中文 | English |
|
|
49
46
|
|---|---|---|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
| 变更记录 | [
|
|
47
|
+
| 架构 | [architecture.md](docs/architecture.md) | [architecture.en.md](docs/architecture.en.md) |
|
|
48
|
+
| 配置 | [configuration.md](docs/configuration.md) | [configuration.en.md](docs/configuration.en.md) |
|
|
49
|
+
| 快速上手 | [quickstart.md](docs/quickstart.md) | [quickstart.en.md](docs/quickstart.en.md) |
|
|
50
|
+
| 安装 | [install.md](docs/install.md) | [install.en.md](docs/install.en.md) |
|
|
51
|
+
| 变更记录 | [changelog.md](docs/changelog.md) | [changelog.en.md](docs/changelog.en.md) |
|
|
52
|
+
| 发布清单 | [release-checklist.md](docs/release-checklist.md) | [release-checklist.en.md](docs/release-checklist.en.md) |
|
|
53
|
+
|
|
54
|
+
内部工程说明(中文):[路由-设计说明](docs/路由-设计说明.md) · [工具遮蔽-接线说明](docs/工具遮蔽-接线说明.md) · [复核-关插件清单](docs/复核-关插件清单.md)。
|
|
55
|
+
|
|
56
|
+
## 自检
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
~~~powershell
|
|
59
|
+
npm test # node --test "test/*.test.mjs"
|
|
60
|
+
npm run build # 重拼 cordis.patch.yml(base + 4 分片固定顺序)
|
|
61
|
+
npm run doctor # 11 项结构自检
|
|
62
|
+
npm run verify # build --check(cordis.patch.yml 反向逐字节一致)+ doctor
|
|
63
|
+
~~~
|
|
57
64
|
|
|
58
|
-
##
|
|
65
|
+
## 现状(如实标注)
|
|
59
66
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- **门控回退模式**:宿主技能目录缓存生效时,每轮门控走注入缝,审计标注 `mode: "fallback-cached-list"`。
|
|
64
|
-
- **8k 软降级**:门控注入估算超 `tokenBudget 8000` 时低分技能降档,个数不设上限。
|
|
65
|
-
- **预设行唯一生效**:frag-preset.patch.yml 并集快照是唯一生效 preset 行(cordis patch 键级整体替换语义)。
|
|
67
|
+
- balance 预设行暂不含路由指令。
|
|
68
|
+
- plan-mode 政策段保留 flash 原文(含 PTC `run_code` 句)。
|
|
69
|
+
- 工具遮蔽依赖 `@deepseek-ai/dsh-tool-executor-native`;缺失时 executor 退化为安装提示 stub,首次 `describe` 抛错而不静默。
|
|
66
70
|
|
|
67
71
|
## 许可与致谢
|
|
68
72
|
|
|
69
|
-
MIT,见 [LICENSE](LICENSE)
|
|
73
|
+
MIT,见 [LICENSE](LICENSE)。上游贡献映射与许可声明见 [NOTICE.md](NOTICE.md):dsh-flash-presets(LarryE135)· dsh-codemode(dsh-codemode contributors)· dsh-routing-suite(yjh051108)。
|
package/cordis.patch.yml
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
# TODO(ticket-03 lean 层):compaction 0.25/20000、tool-result pruner 4096/1024、关 6 插件、lean13/balance3 persona、plan-mode v1、delivery-gate、glob/grep 并发标记
|
|
6
6
|
# TODO(ticket-04 工具遮蔽层):codemode executor 遮蔽行 + code_run 传输 + meta 4 工具 + 常驻 ptc-runtime
|
|
7
7
|
# TODO(ticket-05 路由层):首轮 inbox.claim 捕获 + [router] band/task 分类指令 + pre-step 近场引导 + 3 软门 + /band
|
|
8
|
-
# TODO(ticket-06 技能门控层):skill provider rank 配置 + 每轮评分放行 + 8k 软降级 + 审计
|
|
9
8
|
- insert:
|
|
10
9
|
- id: preset-lean-router
|
|
11
10
|
name: '@deepseek-ai/dsh-agent-preset'
|
|
12
11
|
config:
|
|
13
12
|
id: lean-router
|
|
14
13
|
name: Lean router
|
|
15
|
-
description: "lean 省 token × 思考链路由 × code_run
|
|
14
|
+
description: "lean 省 token × 思考链路由 × code_run 遮蔽(2.0.0)"
|
|
16
15
|
order: 30
|
|
17
16
|
plugins:
|
|
18
17
|
- id: persona
|
|
@@ -40,8 +39,6 @@
|
|
|
40
39
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
41
40
|
- id: skill-filesystem
|
|
42
41
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
43
|
-
- id: skill-lean-router
|
|
44
|
-
name: dsh-lean-router
|
|
45
42
|
- id: tool-skill
|
|
46
43
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
47
44
|
- id: command-goal
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
config:
|
|
68
65
|
id: lean-router
|
|
69
66
|
name: Lean router
|
|
70
|
-
description: "lean 省 token × 思考链路由 × code_run
|
|
67
|
+
description: "lean 省 token × 思考链路由 × code_run 遮蔽(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
|
|
71
68
|
order: 30
|
|
72
69
|
plugins:
|
|
73
70
|
# 机制 4 · 行为纪律(persona 双档;lean 档 13 条硬规则 + 3 软门 + 自检题钩子)
|
|
@@ -156,8 +153,6 @@
|
|
|
156
153
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
157
154
|
- id: skill-filesystem
|
|
158
155
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
159
|
-
- id: skill-lean-router
|
|
160
|
-
name: dsh-lean-router
|
|
161
156
|
- id: tool-skill
|
|
162
157
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
163
158
|
- id: command-goal
|
|
@@ -334,8 +329,6 @@
|
|
|
334
329
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
335
330
|
- id: skill-filesystem
|
|
336
331
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
337
|
-
- id: skill-lean-router
|
|
338
|
-
name: dsh-lean-router
|
|
339
332
|
- id: tool-skill
|
|
340
333
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
341
334
|
- id: command-goal
|
|
@@ -527,8 +520,6 @@
|
|
|
527
520
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
528
521
|
- id: skill-filesystem
|
|
529
522
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
530
|
-
- id: skill-lean-router
|
|
531
|
-
name: dsh-lean-router
|
|
532
523
|
- id: tool-skill
|
|
533
524
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
534
525
|
- id: command-goal
|
|
@@ -565,32 +556,21 @@
|
|
|
565
556
|
debug: true
|
|
566
557
|
# dsh-lean-router 票 05 路由层分片(顶层列表续项;由 scripts/build-bundle.mjs 续接进 cordis.patch.yml)
|
|
567
558
|
# 钩子行:agent/inbox/claimed 首轮捕获 + 近场引导 dynamic context + 勤勉自检
|
|
568
|
-
# 命令行:/band
|
|
559
|
+
# 命令行:/band 显式改档(宿主 ctx.commands 缝)
|
|
569
560
|
# 入口子路径 dsh-lean-router/router 需要 package.json exports 增补 "./router": "./lib/router.js"
|
|
570
561
|
# (package.json 为共享文件,由 master 统一集成;见 lib/router.js ROUTER_INJECTION_NOTES.patchEntry)
|
|
571
562
|
- insert:
|
|
572
|
-
# 1.0.5 修:宿主层裸包名行(对照 dsh-cost-meter 的 "one host row")。
|
|
573
|
-
# 没有这一行,客户端模块扫描看不到 dsh.client -> 客户端 bundle 不加载 -> 无顶栏按钮。
|
|
574
|
-
# config.provider=false:不重复注册 skill provider(预设层已注册)。
|
|
575
|
-
- id: lean-router-client-host
|
|
576
|
-
name: dsh-lean-router
|
|
577
563
|
- id: lean-router-router
|
|
578
564
|
name: dsh-lean-router/router
|
|
579
565
|
config:
|
|
580
566
|
hooks: true
|
|
581
567
|
commands: false
|
|
582
568
|
diligenceEvery: 10
|
|
583
|
-
# 1.0.5 修:每轮门控必须开,否则 skillgate 不跑 -> 审计零条目、审计文件从不生成。
|
|
584
|
-
# 依据 lib/router.js:345(cfg.hooks && cfg.gate 才建 runner)与 lib/router.js:194。
|
|
585
|
-
gate: true
|
|
586
569
|
- id: lean-router-commands
|
|
587
570
|
name: dsh-lean-router/router
|
|
588
571
|
config:
|
|
589
572
|
hooks: false
|
|
590
573
|
commands: true
|
|
591
|
-
# master 集成(票 07 §9.1):审计落盘开;auditPath/weightsPath 省略 = 默认值
|
|
592
|
-
# (注意不能传空串:lib/router.js:145-149 对空串抛错,缺省语义见 §9.1 修正版)
|
|
593
|
-
audit: true
|
|
594
574
|
# dsh-lean-router frag-preset.patch.yml - master 集成产物(票 03/04/05/06 preset 行收敛)
|
|
595
575
|
# 唯一生效 owner:cordis patch 键级整体替换 + 本片在 FRAGMENTS 最后 → apply 时以本片为准。
|
|
596
576
|
# frag-lean / frag-toolface 的同 id 覆写保留原文件(其自测不动),apply 时被本片覆盖。
|
|
@@ -602,7 +582,7 @@
|
|
|
602
582
|
config:
|
|
603
583
|
id: lean-router
|
|
604
584
|
name: Lean router
|
|
605
|
-
description: "lean 省 token × 思考链路由 × code_run
|
|
585
|
+
description: "lean 省 token × 思考链路由 × code_run 遮蔽(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
|
|
606
586
|
order: 30
|
|
607
587
|
plugins:
|
|
608
588
|
- id: persona
|
|
@@ -693,8 +673,6 @@
|
|
|
693
673
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
694
674
|
- id: skill-filesystem
|
|
695
675
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
696
|
-
- id: skill-lean-router
|
|
697
|
-
name: dsh-lean-router
|
|
698
676
|
- id: tool-skill
|
|
699
677
|
name: '@deepseek-ai/dsh-tool-skill'
|
|
700
678
|
- id: command-goal
|
package/docs/agents/domain.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- 根目录 **`GLOSSARY.md`**(若存在)
|
|
8
8
|
- **`docs/adr/`** 下与你要动的区域相关的 ADR
|
|
9
|
-
- `docs/`
|
|
9
|
+
- `docs/` 下已有的设计说明(架构、配置、路由、工具遮蔽等),与当前课题相关时读
|
|
10
10
|
|
|
11
11
|
以上任一不存在就**静默继续**:不要提它们的缺失,也不要主动建议先建。`/domain-modeling`(经 `/grilling --docs` 与 `/improve-codebase-architecture` 到达)在术语或决策真正定案时才惰性创建。
|
|
12
12
|
|
package/docs/architecture.en.md
CHANGED
|
@@ -1,102 +1,67 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
## Six-layer diagram
|
|
3
|
+
> Three layers in one picture: **lean -> toolface -> router**, all inside a single cordis plugin card (one preset plus a few top-level rows). Chinese original: [architecture.md](./architecture.md).
|
|
6
4
|
|
|
7
5
|
~~~text
|
|
8
|
-
|
|
6
|
+
┌─────────────────────────────────────────────────────────────────────┐
|
|
9
7
|
│ DSH host (engines >=0.2.1-rc.5 <0.2.4-0) │
|
|
10
|
-
|
|
11
|
-
│ preset preset-lean-router (frag-preset.patch.yml
|
|
12
|
-
│
|
|
13
|
-
│
|
|
14
|
-
│
|
|
15
|
-
│
|
|
16
|
-
│
|
|
17
|
-
│
|
|
18
|
-
│
|
|
19
|
-
│
|
|
20
|
-
│
|
|
21
|
-
│
|
|
22
|
-
│
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
│
|
|
26
|
-
│
|
|
27
|
-
|
|
28
|
-
│ /band /skill │
|
|
29
|
-
│ (4) skillgate layer (ticket 06) skill-lean-router provider + per-turn │
|
|
30
|
-
│ - score all 31 -> tier -> ds-* arbitration -> 8k soft degrade -> │
|
|
31
|
-
│ near-field render │
|
|
32
|
-
│ (5) audit (ticket 07, in flight) in-memory ring buffer (256) + subs │
|
|
33
|
-
│ (6) panel (ticket 07, in flight) ui/go.json panel card (in progress) │
|
|
34
|
-
└──────────────────────────────────────────────────────────────────────┘
|
|
8
|
+
├─────────────────────────────────────────────────────────────────────┤
|
|
9
|
+
│ preset preset-lean-router (the union snapshot in frag-preset.patch.yml)│
|
|
10
|
+
│ │
|
|
11
|
+
│ 1) lean layer (ticket 03) │
|
|
12
|
+
│ - turn compaction: thresholdRatio 0.25 / retainTokens 20000 │
|
|
13
|
+
│ - tool-output pruning: 8192 / 4096 / 1024 + marker │
|
|
14
|
+
│ - six redundant plugins off; two discipline tiers (lean 13 / balance 3) │
|
|
15
|
+
│ - plan-mode v1 folded in │
|
|
16
|
+
│ 2) toolface layer (ticket 04) │
|
|
17
|
+
│ - describe() keeps only preset tools + code_run │
|
|
18
|
+
│ - execute() refuses direct calls to masked names │
|
|
19
|
+
│ 3) router layer (ticket 05) │
|
|
20
|
+
│ - first-turn [router] band= capture; three-band guides; /band │
|
|
21
|
+
├─────────────────────────────────────────────────────────────────────┤
|
|
22
|
+
│ top-level rows: preset-lean-router-balance / lean-delivery-gate / │
|
|
23
|
+
│ lean-concurrency / lean-router-router / │
|
|
24
|
+
│ lean-router-commands │
|
|
25
|
+
└─────────────────────────────────────────────────────────────────────┘
|
|
35
26
|
~~~
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **Mech 1, turn compaction**: lib/lean/compaction.js L20-25 pins the tuning `thresholdRatio: 0.25, retainTokens: 20000, compactionRetries: 1, auto: true` (copied from the flash measurements); actual compaction is done by the host `@deepseek-ai/dsh-compaction-basic`. The host default is 0.8 (an 800k trigger on a 1M window); lean uses 0.25 = 250k. Measured 2026-11-09 over 109 runs: peak context median 20k, max 126k — this knob is currently a safety net, not the token saver (cordis.patch.yml L197-200 comment, same text at frag-lean.patch.yml L147-150).
|
|
40
|
-
- **Mech 2, output pruning**: lib/lean/pruner.js L22-26 pins `thresholdChars: 8192, headChars: 4096, tailChars: 1024`; keep head (structure) + tail (conclusion), replace the middle with a fixed marker (`PRUNE_MARKER`, L19). Execution belongs to the host `dsh-compaction-tool-result-pruner`; `pruneText()` is a same-criteria pure-function port.
|
|
41
|
-
- **Mech 3, six disabled plugins**: lib/lean/disabled.js L16-23 lists `tool-subagent-codex`, `tool-subagent-claude-code`, `workflow-ptc`, `tool-workflow`, `tool-ralph`, `tool-plugin-manager`; `disabled: true` rows do not load and their schemas never reach the system prompt.
|
|
42
|
-
- **Mech 4, discipline persona**: lib/lean/persona-text.js — lean tier: 13 hard rules + 3 soft gates (CLARIFY→PLAN→DELIVER) + self-check hooks (diligence ~every 10 turns / close-the-book); balance tier: 3 rules. Rule 7 drops the flash-only "run_code is the only tool" clause (this package is native+code_run); everything else is verbatim.
|
|
43
|
-
- **plan-mode v1**: lib/lean/plan-mode.js is a line-for-line copy of the flash section (L93-107); the trailing PTC `run_code` sentence is **kept verbatim** (v1 ruling, see changelog).
|
|
44
|
-
- **Add-on, delivery gate**: lib/lean/delivery-gate.js — when the workspace has verify.ps1/verify.sh, the harness runs it when a turn stops; on failure it steers back the tail output, at most `maxRounds` (default 2) times per session; at least `MIN_GAP_MS = 15000` between runs (L55); off by default (`enabled: false`; `DSH_DELIVERY_GATE=0/1` overrides); with the host `dsh-llm` package missing, scripts still run and the steer-back is explicitly skipped.
|
|
45
|
-
- **Add-on, concurrency marking**: lib/lean/tool-concurrency.js — adds `isConcurrencySafe = () => true` to the registered glob/grep definitions so native multi-calls truly parallelize; 500ms fast sweep (first 60s) then a 5s backstop; disable with `DSH_LEAN_ROUTER_CONCURRENCY=0` (also accepts `DSH_FLASH_PRESETS_CONCURRENCY=0`).
|
|
46
|
-
|
|
47
|
-
### (2) toolface layer (lib/toolface/, vendored codemode 0.3.0 @ f9758ec)
|
|
48
|
-
|
|
49
|
-
Four jobs (lib/toolface/index.js L17-27): register the discovery tools, register the `code_run` transport, install the masking executor, and supply the Code Mode instructions.
|
|
50
|
-
|
|
51
|
-
- **Masking rules**: rules.js L16 `DEFAULT_HIDDEN_PREFIXES = ['mcp__']`; L19 the four meta tools `code_tools_list / code_tools_search / code_tools_describe / code_debug`; L45 `DEFAULT_RUN_TOOL_NAME = 'code_run'` (`run_code` is reserved by DSH and the registry refuses to register it); L69 `maxParallelSubCalls: 10`. A second, scope-based rule (`nativeScope: true`) masks everything outside the preset scope (global MCP/bundles, per-agent tool sets).
|
|
52
|
-
- **Three-view attribution**: scope.js L87-113 resolves global/preset/agent name sets through the registry's public `get(name, scope)` to answer "does the preset own this tool?"; without a scope tag attribution is inert and only the name rules apply.
|
|
53
|
-
- **Executor seam**: executor.js L124-188 — `describe()` filters with `isMaskedName` before delegating (the request surface = preset composition + transport); `execute()` denies model-direct calls to masked names **before dispatch**, hinting `code_tools_search` (L226-228); `code_run` itself is always allowed (L222). Program sub-calls are admitted via the `Symbol.for('dsh-codemode.nested')` signal marker plus the `:ptc:` call-id suffix (L92-97).
|
|
54
|
-
- **Transport**: transport.js — the `code_run` tool hands the TypeScript program to the `ptcRuntime` service; sub-calls go through the registry's public `execute()` with the full pipeline (validation/policy/approval), and pool.js reproduces the ordering contract (parallel cap 10, exclusive barrier); `abandon()+drain()` at program end stops late sub-calls (L317-323).
|
|
55
|
-
- **Retention**: retention.js — retained REPL environments are tracked per (agent, provider) with two cleanup layers (agent-scope effect + plugin-scope dispose), making the leak unrepresentable.
|
|
56
|
-
- **Missing-dependency stub**: see "Stub behavior" in [quickstart.en.md](./quickstart.en.md).
|
|
57
|
-
|
|
58
|
-
### (3) router layer (lib/router.js + lib/bands.js)
|
|
59
|
-
|
|
60
|
-
- **Three bands**: bands.js L10 `BAND_IDS = ["spec","react","weak"]`. spec = inspect-and-plan (read-first, narrow); react = hands-on-production (write-first, wide); weak = model-routed (the only inner-routing window, few-shot classification). The ideas are ported from routing-suite measurements (V4.1 Flash: neutral + classify few-shot + three anchors = 96% routing, 100% single-task completion); the **implementation is rewritten, no upstream code copied**.
|
|
61
|
-
- **Explicit directive**: bands.js L114-124 parses `[router] band=<spec|react|weak|auto> [task=...]`; `auto` clears the override and returns to automatic classification.
|
|
62
|
-
- **First-turn capture**: router.js L234 listens on `agent/inbox/claimed` and only accepts `message.source.kind === 'user'`; once routed, the band is kept (keywords never change it).
|
|
63
|
-
- **Near-field guide**: router.js L237-245 registers the dynamic context `lean-router:guide` (order 220); text is constant within a band → the host's equality check makes it a zero-write → cache stays warm. It deliberately avoids the pre-step append channel (which would durably write history).
|
|
64
|
-
- **Diligence self-check**: `diligenceEvery` defaults to 10 (L36); the turn number is embedded so text only changes when the check fires.
|
|
65
|
-
- **Commands**: `/band`, `/skill` (L249-260); the preset mounts two instances: `lean-router-router` (hooks:true, commands:false, diligenceEvery:10) + `lean-router-commands` (hooks:false, commands:true) (frag-router.patch.yml).
|
|
66
|
-
- **Inherited sessions**: `skipInherited` defaults to true — subagents/forks with inherited history skip routing.
|
|
28
|
+
> 2.0.0 removed the former 4) skillgate, 5) audit and 6) panel layers: no bundled 31 skills, no per-turn scoring gate, no audit channel and no skills panel UI.
|
|
67
29
|
|
|
68
|
-
|
|
30
|
+
## 1) lean layer (lib/lean/)
|
|
69
31
|
|
|
70
|
-
- **
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
73
|
-
- **
|
|
74
|
-
- **
|
|
32
|
+
- **Entry**: `lib/lean/index.js`, loaded by a row inside the preset union snapshot.
|
|
33
|
+
- **Turn compaction**: `compaction.js`, ratio 0.25 / retain 20000 tokens / one retry / automatic.
|
|
34
|
+
- **Output pruning**: `pruner.js`, 8192 / 4096 / 1024 characters per tool class with a truncation marker.
|
|
35
|
+
- **Disabled plugins**: `disabled.js` turns six redundant plugins off.
|
|
36
|
+
- **Behaviour discipline**: `persona-text.js` supplies the lean 13-rule and balance 3-rule suffixes.
|
|
37
|
+
- **plan-mode v1**: `plan-mode.js` (the upstream flash policy text).
|
|
38
|
+
- **Add-ons**: `delivery-gate.js` (off by default, two-round delivery gate) and `tool-concurrency.js` (glob/grep concurrency markers, on by default), each on its own top-level row.
|
|
75
39
|
|
|
76
|
-
|
|
40
|
+
## 2) toolface layer (lib/toolface/)
|
|
77
41
|
|
|
78
|
-
-
|
|
79
|
-
-
|
|
42
|
+
- **Rules**: `rules.js` - the masking predicate (`hiddenPrefixes`, default `['mcp__']`) and `normalizeConfig` validation.
|
|
43
|
+
- **Scope**: `scope.js` - decides which tools count as the preset's own.
|
|
44
|
+
- **Discovery**: `discovery.js` - the four meta tools (`code_tools_search` and friends).
|
|
45
|
+
- **Transport**: `transport.js` - `code_run` hands a TypeScript program to the `ptcRuntime` service; sub-calls go through the registry's public `execute()` so they keep the full pipeline (validation/policy/approval).
|
|
46
|
+
- **Pool**: `pool.js` - an ordered concurrency pool (parallel cap 10, exclusive barrier); a finished program runs `abandon()+drain()` against late sub-calls.
|
|
47
|
+
- **Executor**: `executor.js` - `describe()` *is* the model-facing request surface; `execute()` refuses direct calls to masked names before dispatch; real execution is delegated to `@deepseek-ai/dsh-tool-executor-native` (a missing dependency degrades to an install-hint stub).
|
|
80
48
|
|
|
81
|
-
##
|
|
49
|
+
## 3) router layer (lib/router.js - lib/bands.js)
|
|
82
50
|
|
|
83
|
-
-
|
|
84
|
-
- **
|
|
85
|
-
- **
|
|
86
|
-
-
|
|
51
|
+
- **Three bands**: `bands.js` - spec (inspect first, read-first) / react (produce directly, write-first) / weak (model-routed).
|
|
52
|
+
- **First-turn capture**: `agent/inbox/claimed` only accepts `source.kind === 'user'`; the `[router] band=... task=...` directive wins over keyword classification.
|
|
53
|
+
- **Near-field guide**: `ctx.systemPrompt.context()` registers a dynamic context (order 220); the text is constant within a band, so the host's equality check writes nothing.
|
|
54
|
+
- **Diligence reminder**: appended every `diligenceEvery` (default 10) turns.
|
|
55
|
+
- **Commands**: `/band`; the preset splits two instances: `lean-router-router` (hooks:true, commands:false, diligenceEvery:10) and `lean-router-commands` (hooks:false, commands:true) in frag-router.patch.yml.
|
|
87
56
|
|
|
88
|
-
##
|
|
57
|
+
## File responsibilities
|
|
89
58
|
|
|
90
|
-
|
|
|
59
|
+
| File | Responsibility |
|
|
91
60
|
|---|---|
|
|
92
|
-
| lib/index.js | cordis plugin entry (
|
|
93
|
-
| lib/
|
|
94
|
-
| lib/
|
|
95
|
-
| lib/
|
|
96
|
-
| lib/
|
|
97
|
-
| presets/base
|
|
98
|
-
| scripts/ | build-bundle /
|
|
99
|
-
| assets/skills/ + skills.matrix.json + skills.manifest.json | 31 bundled skill copies and the model/user matrix |
|
|
100
|
-
| test/ | 20 test files |
|
|
101
|
-
| docs/ | bilingual docs (this directory) + 4 Chinese design notes (from upstream tickets, kept in Chinese) |
|
|
102
|
-
| ui/ | ticket 07 panel (in progress; untouched by this ticket) |
|
|
61
|
+
| lib/index.js | cordis plugin entry (package root; a no-op since 2.0.0, kept as a valid plugin shape) |
|
|
62
|
+
| lib/bands.js | band definitions and keyword classification |
|
|
63
|
+
| lib/router.js | routing: capture / near-field guide / diligence / `/band` |
|
|
64
|
+
| lib/lean/* | compaction, pruning, disabled plugins, discipline, plan-mode, delivery gate, concurrency markers |
|
|
65
|
+
| lib/toolface/* | masking, `code_run` transport, discovery tools, pool, executor |
|
|
66
|
+
| presets/base/*.patch.yml | fragments that `scripts/build-bundle.mjs` assembles into cordis.patch.yml |
|
|
67
|
+
| scripts/ | build-bundle / doctor / verify / install / integrate-preset |
|