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.
Files changed (148) hide show
  1. package/NOTICE.md +2 -4
  2. package/README.en.md +47 -43
  3. package/README.md +45 -41
  4. package/cordis.patch.yml +4 -26
  5. package/docs/agents/domain.md +1 -1
  6. package/docs/architecture.en.md +51 -86
  7. package/docs/architecture.md +46 -77
  8. package/docs/changelog.en.md +32 -1
  9. package/docs/changelog.md +32 -1
  10. package/docs/configuration.en.md +25 -56
  11. package/docs/configuration.md +14 -45
  12. package/docs/install.en.md +2 -2
  13. package/docs/install.md +2 -2
  14. package/docs/quickstart.en.md +29 -34
  15. package/docs/quickstart.md +11 -16
  16. package/docs/release-checklist.en.md +3 -4
  17. package/docs/release-checklist.md +5 -6
  18. package/docs//350/267/257/347/224/261-/350/256/276/350/256/241/350/257/264/346/230/216.md +2 -2
  19. package/lib/index.js +9 -61
  20. package/lib/router.js +15 -148
  21. package/package.json +4 -15
  22. package/presets/base/frag-lean.patch.yml +1 -5
  23. package/presets/base/frag-preset.patch.yml +1 -3
  24. package/presets/base/frag-router.patch.yml +1 -12
  25. package/presets/base/frag-toolface.patch.yml +0 -2
  26. package/presets/base/lean-router.patch.yml +1 -4
  27. package/scripts/doctor.mjs +15 -10
  28. package/test/integration-preset.test.mjs +4 -3
  29. package/test/plugin-entry.test.mjs +15 -50
  30. package/test/router.test.mjs +7 -47
  31. package/assets/gating.weights.json +0 -13
  32. package/assets/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
  33. package/assets/skills/ask-matt/SKILL.md +0 -80
  34. package/assets/skills/ask-matt/agents/openai.yaml +0 -5
  35. package/assets/skills/chief-of-staff/SKILL.md +0 -76
  36. package/assets/skills/chief-of-staff/agents/openai.yaml +0 -5
  37. package/assets/skills/code-review/SKILL.md +0 -91
  38. package/assets/skills/code-review/agents/openai.yaml +0 -5
  39. package/assets/skills/codebase-design/DEEPENING.md +0 -37
  40. package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
  41. package/assets/skills/codebase-design/SKILL.md +0 -116
  42. package/assets/skills/codebase-design/agents/openai.yaml +0 -5
  43. package/assets/skills/diagnosing-bugs/SKILL.md +0 -140
  44. package/assets/skills/diagnosing-bugs/agents/openai.yaml +0 -5
  45. package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
  46. package/assets/skills/domain-modeling/ADR-FORMAT.md +0 -47
  47. package/assets/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
  48. package/assets/skills/domain-modeling/SKILL.md +0 -76
  49. package/assets/skills/domain-modeling/agents/openai.yaml +0 -5
  50. package/assets/skills/grilling/SKILL.md +0 -52
  51. package/assets/skills/grilling/agents/openai.yaml +0 -5
  52. package/assets/skills/handoff/SKILL.md +0 -17
  53. package/assets/skills/handoff/agents/openai.yaml +0 -5
  54. package/assets/skills/implement/SKILL.md +0 -55
  55. package/assets/skills/implement/agents/openai.yaml +0 -5
  56. package/assets/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
  57. package/assets/skills/improve-codebase-architecture/SKILL.md +0 -72
  58. package/assets/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
  59. package/assets/skills/loop-me/SKILL.md +0 -33
  60. package/assets/skills/loop-me/agents/openai.yaml +0 -5
  61. package/assets/skills/pr/CREDITS.md +0 -3
  62. package/assets/skills/pr/SKILL.md +0 -172
  63. package/assets/skills/pr/agents/openai.yaml +0 -5
  64. package/assets/skills/prototype/LOGIC.md +0 -67
  65. package/assets/skills/prototype/SKILL.md +0 -28
  66. package/assets/skills/prototype/UI.md +0 -112
  67. package/assets/skills/prototype/agents/openai.yaml +0 -5
  68. package/assets/skills/research/SKILL.md +0 -14
  69. package/assets/skills/research/agents/openai.yaml +0 -5
  70. package/assets/skills/retro/SKILL.md +0 -45
  71. package/assets/skills/retro/agents/openai.yaml +0 -5
  72. package/assets/skills/setup-matt-pocock-skills/SKILL.md +0 -121
  73. package/assets/skills/setup-matt-pocock-skills/agents/openai.yaml +0 -5
  74. package/assets/skills/setup-matt-pocock-skills/domain.md +0 -51
  75. package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -50
  76. package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -46
  77. package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -30
  78. package/assets/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
  79. package/assets/skills/setup-ts-deep-modules/SKILL.md +0 -103
  80. package/assets/skills/setup-ts-deep-modules/agents/openai.yaml +0 -5
  81. package/assets/skills/setup-ts-deep-modules/dependency-cruiser.config.cjs +0 -95
  82. package/assets/skills/software-factory/EXAMPLE-TASKS.md +0 -80
  83. package/assets/skills/software-factory/GIT-HOSTS.md +0 -84
  84. package/assets/skills/software-factory/OBSERVABILITY-PLATFORMS.md +0 -75
  85. package/assets/skills/software-factory/RUNNERS.md +0 -94
  86. package/assets/skills/software-factory/SKILL.md +0 -99
  87. package/assets/skills/software-factory/TICKET-TRACKERS.md +0 -85
  88. package/assets/skills/tdd/SKILL.md +0 -40
  89. package/assets/skills/tdd/agents/openai.yaml +0 -5
  90. package/assets/skills/tdd/mocking.md +0 -59
  91. package/assets/skills/tdd/tests.md +0 -77
  92. package/assets/skills/teach/GLOSSARY-FORMAT.md +0 -35
  93. package/assets/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
  94. package/assets/skills/teach/MISSION-FORMAT.md +0 -31
  95. package/assets/skills/teach/RESOURCES-FORMAT.md +0 -32
  96. package/assets/skills/teach/SKILL.md +0 -141
  97. package/assets/skills/teach/agents/openai.yaml +0 -5
  98. package/assets/skills/to-questionnaire/SKILL.md +0 -55
  99. package/assets/skills/to-questionnaire/agents/openai.yaml +0 -5
  100. package/assets/skills/to-spec/SKILL.md +0 -76
  101. package/assets/skills/to-spec/agents/openai.yaml +0 -5
  102. package/assets/skills/to-tickets/SKILL.md +0 -106
  103. package/assets/skills/to-tickets/agents/openai.yaml +0 -5
  104. package/assets/skills/triage/AGENT-BRIEF.md +0 -207
  105. package/assets/skills/triage/OUT-OF-SCOPE.md +0 -105
  106. package/assets/skills/triage/SKILL.md +0 -113
  107. package/assets/skills/triage/agents/openai.yaml +0 -5
  108. package/assets/skills/wait-what/SKILL.md +0 -8
  109. package/assets/skills/wait-what/agents/openai.yaml +0 -5
  110. package/assets/skills/wayfinder/SKILL.md +0 -129
  111. package/assets/skills/wayfinder/agents/openai.yaml +0 -5
  112. package/assets/skills/wizard/SKILL.md +0 -46
  113. package/assets/skills/wizard/agents/openai.yaml +0 -5
  114. package/assets/skills/wizard/template.sh +0 -223
  115. package/assets/skills/writing-beats/SKILL.md +0 -44
  116. package/assets/skills/writing-beats/agents/openai.yaml +0 -5
  117. package/assets/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
  118. package/assets/skills/writing-for-agents/SKILL.md +0 -83
  119. package/assets/skills/writing-for-agents/agents/openai.yaml +0 -5
  120. package/assets/skills/writing-fragments/SKILL.md +0 -80
  121. package/assets/skills/writing-fragments/agents/openai.yaml +0 -5
  122. package/assets/skills/writing-shape/SKILL.md +0 -59
  123. package/assets/skills/writing-shape/agents/openai.yaml +0 -5
  124. package/assets/skills.matrix.json +0 -311
  125. package/docs/HANDOFF-2026-11-22.md +0 -155
  126. package/docs/matrix.en.md +0 -57
  127. package/docs/matrix.md +0 -57
  128. 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
  129. package/docs//351/235/242/346/235/277-/350/256/276/350/256/241/350/257/264/346/230/216.md +0 -205
  130. package/lib/audit-commands.js +0 -289
  131. package/lib/audit-sink.js +0 -137
  132. package/lib/client.js +0 -276
  133. package/lib/gate-runner.js +0 -179
  134. package/lib/skill-provider.js +0 -167
  135. package/lib/skillgate.js +0 -396
  136. package/lib/skills-panel.js +0 -322
  137. package/scripts/check-drift.mjs +0 -24
  138. package/skills.manifest.json +0 -287
  139. package/test/audit-commands.test.mjs +0 -325
  140. package/test/audit-sink.test.mjs +0 -150
  141. package/test/client-plugin.test.mjs +0 -123
  142. package/test/gate-run.test.mjs +0 -173
  143. package/test/manifest.test.mjs +0 -25
  144. package/test/provider.test.mjs +0 -21
  145. package/test/skillgate-provider.test.mjs +0 -122
  146. package/test/skillgate.test.mjs +0 -217
  147. package/test/skills-panel.test.mjs +0 -114
  148. package/ui/go.json +0 -19
@@ -1,8 +1,6 @@
1
- # 架构总览(architecture)
1
+ # 架构(architecture)
2
2
 
3
- > 六层一图:**lean → toolface → router → skillgate → audit → panel**,全部收敛在一张 cordis 插件卡(一个预设 + 少量顶层行)。中文为主,英文版是 [architecture.en.md](./architecture.en.md)。
4
-
5
- ## 六层图
3
+ > 三层一图:**lean → toolface → router**,全部收敛在一张 cordis 插件卡(一个预设 + 少量顶层行)。中文为主,英文版是 [architecture.en.md](./architecture.en.md)。
6
4
 
7
5
  ~~~text
8
6
  ┌─────────────────────────────────────────────────────────────────────┐
@@ -10,88 +8,59 @@
10
8
  ├─────────────────────────────────────────────────────────────────────┤
11
9
  │ 预设 preset-lean-router(frag-preset.patch.yml 并集快照 = 唯一生效行) │
12
10
  │ │
13
- │ ① lean 层(票 03) compaction 组 + delegation 组 + persona │
14
- │ - 机制1 轮次压缩 thresholdRatio 0.25 / retainTokens 20000 │
15
- │ - 机制2 输出裁剪 8192/4096/1024(host 执行) │
16
- │ - 机制3 关 6 插件 delegation 组 + 顶层 tool-plugin-manager │
17
- │ - 机制4 行为纪律 lean 13 条 + 3 软门 + 自检钩 / balance 3 条 │
18
- │ - 加料 交付门 lean-delivery-gate(enabled:false, 2 轮) │
19
- │ - 加料 并发标记 lean-concurrency(glob/grep isConcurrencySafe)│
20
- │ ② toolface 层(票 04) dsh-lean-router/toolface │
21
- │ - 遮蔽 ['mcp__'] + 预设外全部;code_run 传输;meta 4 工具 │
22
- │ - executor:describe() 掩蔽 + execute() 拒绝直呼 │
23
- │ ③ router 层(票 05) 两实例 lean-router-router / lean-router-commands │
24
- │ - 首轮捕获 [router] band=…;三带近场引导;/band /skill │
25
- │ ④ skillgate 层(票 06) skill-lean-router provider + 每轮门控 │
26
- │ - 31 技能全量打分 → 分档 → ds-* 裁决 → 8k 软降 → 近场渲染 │
27
- │ ⑤ audit(票 07 在飞) 内存环形缓冲(256 条)+ 订阅通道 │
28
- │ ⑥ panel(票 07 在飞) ui/go.json 面板卡片(进行中,未验收) │
11
+ │ ① lean 层(票 03) │
12
+ │ - 轮次压缩:thresholdRatio 0.25 / retainTokens 20000 / retries 1 │
13
+ │ - 工具输出裁剪:8192 / 4096 / 1024 + marker │
14
+ │ - 关 6 个冗余插件;行为纪律双档(lean 13 / balance 3) │
15
+ │ - plan-mode v1 并入 │
16
+ │ ② toolface 层(票 04) │
17
+ │ - describe() 只留预设自有工具 + code_run(遮蔽 mcp__ 与预设外) │
18
+ │ - execute() 拒绝直呼被遮蔽名;程序内经 code_tools_search 发现调用 │
19
+ │ ③ router 层(票 05) │
20
+ │ - 首轮捕获 [router] band=…;三带近场引导;/band │
21
+ ├─────────────────────────────────────────────────────────────────────┤
22
+ │ 顶层行:preset-lean-router-balance / lean-delivery-gate / │
23
+ │ lean-concurrency / lean-router-router / lean-router-commands │
29
24
  └─────────────────────────────────────────────────────────────────────┘
30
25
  ~~~
31
26
 
32
- ### ① lean 层(lib/lean/,参数 + 纯函数端口;执行归宿主插件)
33
-
34
- - **机制 1 轮次压缩**:`lib/lean/compaction.js` L20-25 给出口径 `thresholdRatio: 0.25, retainTokens: 20000, compactionRetries: 1, auto: true`(照抄 flash 实测);真实压缩由宿主 `@deepseek-ai/dsh-compaction-basic` 执行。host 默认是 0.8(1M 窗口 = 800k 才触发),lean 取 0.25 = 250k 触发;2026-11-09 实测 109 个运行峰值中位 20k、最大 126k——这颗旋钮目前是安全网而非降本手段(cordis.patch.yml L197-200 注释原文,frag-lean.patch.yml L147-150 同文)。
35
- - **机制 2 工具输出裁剪**:`lib/lean/pruner.js` L22-26 口径 `thresholdChars: 8192, headChars: 4096, tailChars: 1024`;保留头(结构)+ 尾(结论),中段替换为固定 marker(`PRUNE_MARKER`,L19)。执行归宿主 `dsh-compaction-tool-result-pruner`;`pruneText()` 是同判据纯函数端口。
36
- - **机制 3 关 6 插件**:`lib/lean/disabled.js` L16-23 清单 = `tool-subagent-codex`、`tool-subagent-claude-code`、`workflow-ptc`、`tool-workflow`、`tool-ralph`、`tool-plugin-manager`;`disabled: true` 行不加载,工具 schema 不进系统提示。
37
- - **机制 4 行为纪律**:`lib/lean/persona-text.js`——lean 档 13 条硬规则 + 3 软门(CLARIFY→PLAN→DELIVER)+ 自检钩(勤勉 ~每 10 轮 / 合上书);balance 档 3 条。规则 7 删去 flash 的 "run_code is the only tool"(本包是 native+code_run 面),其余逐条照抄。
38
- - **plan-mode v1**:`lib/lean/plan-mode.js` 逐行照抄 flash(L93-107);末段 PTC `run_code` 句**保留 flash 原文**(本包裁定,见 changelog)。
39
- - **加料 · 交付门**:`lib/lean/delivery-gate.js`——工作区有 verify.ps1/verify.sh 时回合收尾自动验收;失败把尾部输出 steer 回灌,同会话最多 `maxRounds`(默认 2)次;两次最小间隔 `MIN_GAP_MS = 15000`(L55);默认关(`enabled: false`,`DSH_DELIVERY_GATE=0/1` 环境变量可强控);缺宿主 `dsh-llm` 包时脚本照跑、回灌显式跳过。
40
- - **加料 · 并发标记**:`lib/lean/tool-concurrency.js`——给 glob/grep 的已注册定义补 `isConcurrencySafe = () => true`,让原生多调用真正并行;500ms 快扫(前 60s)→ 5s 兜底;`DSH_LEAN_ROUTER_CONCURRENCY=0`(兼容 `DSH_FLASH_PRESETS_CONCURRENCY=0`)关闭。
41
-
42
- ### ② toolface 层(lib/toolface/,vendored codemode 0.3.0 @ f9758ec)
43
-
44
- 四个职责(lib/toolface/index.js L17-27):注册发现工具、注册 `code_run` 传输、安装遮蔽 executor、供应 Code Mode 说明段。
45
-
46
- - **遮蔽规则**:`rules.js` L16 `DEFAULT_HIDDEN_PREFIXES = ['mcp__']`;L19 四个 meta 工具 `code_tools_list / code_tools_search / code_tools_describe / code_debug`;L45 `DEFAULT_RUN_TOOL_NAME = 'code_run'`(`run_code` 是 DSH 保留名,注册表拒绝注册);L69 `maxParallelSubCalls: 10`。另有 scope 规则(`nativeScope: true`):预设 scope 之外(全局层 MCP/bundle、agent 层工具集)一律遮蔽。
47
- - **三视图归因**:`scope.js` L87-113 用注册表公开的 `get(name, scope)` 解析 global/preset/agent 三个名字集合,判定「这个工具是不是本预设的」;无 scope 标签时归因惰性、只按名规则遮蔽。
48
- - **executor 接缝**:`executor.js` L124-188——`describe()` 先按 `isMaskedName` 过滤再交给原生 executor(模型请求面 = 预设组合 + 传输工具);`execute()` 对模型直呼被遮蔽名**派发前**拒绝并提示 `code_tools_search`(L226-228);`code_run` 本身永远放行(L222)。程序子调用经 signal 上的 `Symbol.for('dsh-codemode.nested')` 标记 + `:ptc:` 调用号双保险放行(L92-97)。
49
- - **传输**:`transport.js`——`code_run` 工具把 TypeScript 程序交给 `ptcRuntime` 服务执行;子调用经注册表公开 `execute()` 走完整管线(校验/策略/审批),并发由 `pool.js` 有序池(parallel 上限 10,exclusive 障碍)复现;程序结束 `abandon()+drain()` 防迟到子调用(L317-323)。
50
- - **retention**:`retention.js`——retained REPL 环境按 (agent, provider) 记账,双清理层(agent-scope effect + 插件卸载 dispose)让泄漏不可表达。
51
- - **缺依赖 stub**:见 [quickstart.md](./quickstart.md)「stub 引导行为」。
52
-
53
- ### ③ router 层(lib/router.js + lib/bands.js)
54
-
55
- - **三带**:`bands.js` L10 `BAND_IDS = ["spec","react","weak"]`。spec=inspect-and-plan(读向窄面)、react=hands-on-production(写向宽面)、weak=model-routed(唯一内路由窗口,few-shot 分类指令)。思想移植 routing-suite 实测(V4.1 Flash:neutral + classify few-shot + 三锚 = 路由 96%、单任务 100%),**实现重写、未搬其代码**。
56
- - **显式指令**:`bands.js` L114-124 解析 `[router] band=<spec|react|weak|auto> [task=…]`;`auto` 清除覆盖回退自动。
57
- - **首轮捕获**:`router.js` L234 只认 `agent/inbox/claimed` 且 `message.source.kind === 'user'`;已路由后保持路径承诺(关键词不改带)。
58
- - **近场引导**:`router.js` L237-245 注册 dynamic context `lean-router:guide`(order 220);同一带内文本恒定 → 宿主判等零写 → 不污染缓存。不走 pre-step append(那会 durable 写历史)。
59
- - **勤勉自检**:`diligenceEvery` 默认 10(L36);轮次号入文,非整除轮文本不变。
60
- - **命令**:`/band`、`/skill`(L249-260);预设内两实例分流:`lean-router-router`(hooks:true, commands:false, diligenceEvery:10)+ `lean-router-commands`(hooks:false, commands:true)(frag-router.patch.yml)。
61
- - **继承会话**:`skipInherited` 默认 true——子代理/fork 继承历史则跳过路由。
27
+ > 2.0.0 移除了原 ④ skillgate、⑤ audit、⑥ panel 三层:不再内置 31 技能、不再每轮打分门控、不再有审计通道与技能面板 UI。
62
28
 
63
- ### ④ skillgate 层(lib/skillgate.js + lib/skill-provider.js)
29
+ ## ① lean 层(lib/lean/)
64
30
 
65
- - **provider**:`skill-provider.js` L22 `DEFAULT_RANK = 350`(压过 ~/.dsh/skills 的 400,接管同名技能 invocation 开关)。两级来源:同名技能优先 `~/.dsh/skills`(tier user),缺失回 `assets/skills` 副本(tier bundled);invocation 一律按 `assets/skills.matrix.json`(model/user 主人拍板)。
66
- - **门控关闭 = 一切不变**:`list()` 默认返回全量 31 技能;门控只在调用方显式传 `list({ leanGate: state })` 时生效(L141-147)。
67
- - **每轮管线**(`skillgate.js` L286-331):`scoreSkills`(31 全量打分:信号 A 场景映射 + complexBoost + 信号 B 关键词逐个 +1)→ `classifyTiers`(`autoScore 2`/`hintScore 1` 分档,L44-45)→ `arbitrate`(ds-* 活跃时 engineering 场景 mattpocock 技能 auto→hint,L55-58)→ `degrade`(注入估算超 `tokenBudget 8000`(L46)时低分 auto→hint,个数不设上限)→ `renderAdmission`(英文近场文本,`lean-router:skills` 通道)→ audit 留痕。
68
- - **缓存回退**:宿主 `SkillRegistry.collect()` 按 (cwd, scopeChain, revision) 缓存,`provider.list()` 只在未命中时被调——每轮门控因此走注入缝而非重调 list,审计条目标注 `mode: "fallback-cached-list"`(L311)。
69
- - **审计**:`AUDIT_FORMAT_VERSION = 1`(L26);`createAuditChannel`(L250-279)为内存环形缓冲(默认 256 条)+ 订阅通道,**不落盘**——面板消费归票 07。
31
+ - **入口**:`lib/lean/index.js`,由预设并集快照内的行加载。
32
+ - **轮次压缩**:`compaction.js`,阈值 0.25 / 保留 20000 tokens / 重试 1 次 / 自动触发。
33
+ - **输出裁剪**:`pruner.js`,按工具分档 8192 / 4096 / 1024 字符并加截断 marker。
34
+ - **关插件**:`disabled.js` 列出并关掉 6 个冗余插件。
35
+ - **行为纪律**:`persona-text.js` 提供 lean 13 条与 balance 3 条两档 suffix。
36
+ - **plan-mode v1**:`plan-mode.js`(照抄上游 flash 政策段)。
37
+ - **加料件**:`delivery-gate.js`(默认关,2 轮交付门)与 `tool-concurrency.js`(glob/grep 并发标记,默认开),各自独立顶层行。
70
38
 
71
- ### ⑤ audit + ⑥ panel(票 07,进行中)
39
+ ## ② toolface 层(lib/toolface/)
72
40
 
73
- - audit 侧:skillgate 决策流接 sink、审计流 JSONL 落盘为票 07 的在飞工作;本包 v1 代码里的审计通道是内存环形缓冲(上述)。
74
- - panel 侧:`ui/go.json` 面板卡片(决策行 + 全量得分表折叠 + token 对比 + 黄条)**进行中,未验收**;本票(08)不修改 `ui/**`。
41
+ - **规则**:`rules.js` —— 遮蔽判据(`hiddenPrefixes` 默认 `['mcp__']`)与 `normalizeConfig` 校验。
42
+ - **作用域**:`scope.js` —— 决定哪些工具属于「预设自有」。
43
+ - **发现**:`discovery.js` —— 4 个 meta 工具(`code_tools_search` 等)。
44
+ - **传输**:`transport.js` —— `code_run` 把 TypeScript 程序交给 `ptcRuntime` 服务执行;子调用经注册表公开 `execute()` 走完整管线(校验/策略/审批)。
45
+ - **池**:`pool.js` —— 有序并发池(parallel 上限 10,exclusive 障碍);程序结束 `abandon()+drain()` 防迟到子调用。
46
+ - **执行器**:`executor.js` —— `describe()` 是模型请求面本身;`execute()` 派发前拒绝直呼被遮蔽名;真正的执行委托给 `@deepseek-ai/dsh-tool-executor-native`(缺失时退化为安装提示 stub)。
75
47
 
76
- ## 预设行与 patch 装配
48
+ ## ③ router 层(lib/router.js · lib/bands.js)
77
49
 
78
- - `scripts/build-bundle.mjs` 按 HEADER + `presets/base/lean-router.patch.yml` + `frag-lean → frag-toolface → frag-router → frag-preset` 顺序拼出根 `cordis.patch.yml`(847 行);`npm run build -- --check` 反向逐字节校验。
79
- - **frag-preset.patch.yml 是唯一生效 preset 行**(master 集成产物,scripts/integrate-preset.mjs 生成):cordis patch 对 preset 行是键级整体替换,frag-lean/frag-toolface 的同 id 覆写互相清场,frag-preset 把 base 12 行 + lean 行 + toolface 行收敛为并集快照排在最后。其 lean persona suffix 末段已替换为 ROUTER_PROMPT( Routing: before acting on any new task, classify it…)。
80
- - **balance 行**(frag-lean insert)3 条纪律,v1 **不拼路由指令**(suffix 末行是占位注释)。
81
- - 预设之外还有 4 个顶层行:`lean-delivery-gate`(enabled:false, maxRounds:2)、`lean-concurrency`(enabled:true)、`lean-router-router`、`lean-router-commands`。
50
+ - **三带**:`bands.js` —— spec(先查后改,读优先)/ react(直接产出,写优先)/ weak(交给模型自判)。
51
+ - **首轮捕获**:`agent/inbox/claimed` 只认 `source.kind === 'user'`;`[router] band=… task=…` 显式指令优先于关键词分类。
52
+ - **近场引导**:`ctx.systemPrompt.context()` 注册 dynamic context(order 220);同一带内文本恒定,宿主判等零写入。
53
+ - **勤勉自检**:每 `diligenceEvery`(默认 10)轮在引导文本尾部追加轮次提醒。
54
+ - **命令**:`/band`(L249-260);预设内两实例分流:`lean-router-router`(hooks:true, commands:false, diligenceEvery:10)+ `lean-router-commands`(hooks:false, commands:true)(frag-router.patch.yml)。
82
55
 
83
- ## 目录索引
56
+ ## 文件职责
84
57
 
85
- | 路径 | 内容 |
58
+ | 文件 | 职责 |
86
59
  |---|---|
87
- | lib/index.js | cordis 插件入口(skill provider 挂载,rank 350) |
88
- | lib/lean/ | lean 层 8 模块(参数/纯函数/插件对象) |
89
- | lib/toolface/ | toolface 层 8 模块(vendored codemode) |
90
- | lib/router.js, lib/bands.js | 路由层 |
91
- | lib/skillgate.js, lib/skill-provider.js | 门控与 provider |
92
- | presets/base/ | 1 模板 + 4 分片(frag-lean/frag-toolface/frag-router/frag-preset) |
93
- | scripts/ | build-bundle / check-drift / doctor / integrate-preset / install / verify |
94
- | assets/skills/ + skills.matrix.json + skills.manifest.json | 31 技能内置副本与双开矩阵 |
95
- | test/ | 20 个测试文件 |
96
- | docs/ | 双语文档(本目录)+ 4 篇中文设计说明(上游票产出,保留中文) |
97
- | ui/ | 票 07 面板(进行中,本票未动) |
60
+ | lib/index.js | cordis 插件入口(包根;2.0.0 起为空实现,只保留合法插件形状) |
61
+ | lib/bands.js | 三带定义与关键词分类 |
62
+ | lib/router.js | 路由层:捕获 / 近场引导 / 勤勉自检 / `/band` |
63
+ | lib/lean/* | 轮次压缩、输出裁剪、关插件、行为纪律、plan-mode、交付门、并发标记 |
64
+ | lib/toolface/* | 工具遮蔽、`code_run` 传输、发现工具、并发池、执行器 |
65
+ | presets/base/*.patch.yml | 分片;`scripts/build-bundle.mjs` 拼成 cordis.patch.yml |
66
+ | scripts/ | build-bundle / doctor / verify / install / integrate-preset |
@@ -1,6 +1,37 @@
1
1
  # Changelog
2
2
 
3
- > English version of [changelog.md](./changelog.md). Versions follow package.json (currently 1.0.9).
3
+ > English version of [changelog.md](./changelog.md). Versions follow package.json (currently 2.0.0).
4
+
5
+ ## 2.0.0 (2026-11-29)
6
+
7
+ **Breaking: the skills subsystem is removed.** Three layers remain - lean token saving, router thinking-chain routing and toolface tool masking.
8
+
9
+ ### Removed
10
+
11
+ - **mattpocock skill collaboration**: `lib/skillgate.js` (per-turn scoring of all 31 skills, tiering, ds-* arbitration, 8k soft degrade), `lib/skill-provider.js` (rank-350 provider, two-level sources), `lib/gate-runner.js` (pre-step gating), `assets/skills/` (the 31 bundled skill bodies), `assets/skills.matrix.json`, `assets/gating.weights.json` and `skills.manifest.json` are gone, and the `skill-lean-router` provider row is dropped from the preset union snapshot.
12
+ - **Audit and panel**: `lib/audit-sink.js`, `lib/audit-commands.js` and `ui/go.json` are gone; the `/lean-audit` command is retired.
13
+ - **Skills panel UI**: `lib/skills-panel.js` and `lib/client.js` are gone; the `/panel` command is retired; `package.json` no longer declares `exports["./client"]` or `dsh.client`, so no client bundle is produced.
14
+ - **The `/skill` command** is retired; the router keeps only `/band`.
15
+ - The `npm run drift` script and `scripts/check-drift.mjs` are gone (there are no skill copies left to drift).
16
+ - Docs `docs/matrix.md`, `docs/matrix.en.md`, `docs/技能门控-设计说明.md`, `docs/面板-设计说明.md` and `docs/HANDOFF-2026-11-22.md` are deleted.
17
+
18
+ ### Changed
19
+
20
+ - `lib/index.js` is now a valid no-op plugin (`inject = []`, `apply()` returns undefined); the host no longer needs a `lean-router-client-host` row.
21
+ - `lib/router.js` drops `skills` from its `inject` list (`["agents","systemPrompt","commands"]`). `gate` / `audit` / `auditPath` / `weightsPath` are still accepted with no behaviour, so an old patch config cannot stop the plugin from starting.
22
+ - doctor grew from 7 checks to 11, including two anti-regression checks: the patch must not contain `skill-lean-router` or `lean-router-client-host` again.
23
+
24
+ ### Tests
25
+
26
+ - Nine skill-related test files were deleted; the router, plugin-entry and integration-preset assertions were narrowed accordingly. Current `npm test`: 157 tests / 156 pass / 1 skip / 0 fail; `npm run verify` PASS.
27
+
28
+ ## 1.1.0 (2026-11-25)
29
+
30
+ - Changed (surface, decided by the user): the skills panel moves from "header button + body overlay" to a **right sidebar tab**. The overlay had to be opened, covered the conversation and could not sit side by side, so it was never a usable form; the 1.0.9 `#lean-router-panel` overlay is dropped entirely.
31
+ - New: the right-sidebar contract follows the real examples `@modusensus/dsh-mneme` and `dsh-cost-meter` - the tab type and its guide entry go to `sidebarRightTabs.register({ id, kind, title, guide })` (checked with `get(id)` first, because the host throws `tab type id … is already registered`), and the body and title go to `sidebar.right.pane.tab` / `sidebar.right.pane.tab.title` with a `{ name, key }` spec.
32
+ - New: the header "Skills" button stays as a shortcut and opens the tab through `ctx.get("sidebarRight").openTab(kind)`.
33
+ - Fixed: the opener now resolves `sidebarRight` from the scoped ctx delivered by `ctx.inject(["slots"])`, so it cannot hit the "service not registered yet" timing trap again.
34
+ - Constraint: nothing is appended to `document.body` any more; this version is the shell only (a title and two lines), and every style inherits host theme tokens instead of hard-coded colours. 224 tests green.
4
35
 
5
36
  ## 1.0.9 (2026-11-24)
6
37
 
package/docs/changelog.md CHANGED
@@ -1,6 +1,37 @@
1
1
  # 变更记录(changelog)
2
2
 
3
- > 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 1.0.9)。
3
+ > 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 2.0.0)。
4
+
5
+ ## 2.0.0 (2026-11-29)
6
+
7
+ **破坏性变更:技能子系统整体移除。** 这一版只剩三层——lean 省 token、router 思考链路由、toolface 工具遮蔽。
8
+
9
+ ### 移除
10
+
11
+ - **mattpocock 技能深度合作**:`lib/skillgate.js`(每轮 31 技能全量打分、分档、ds-* 裁决、8k 软降级)、`lib/skill-provider.js`(rank 350 provider、两级来源)、`lib/gate-runner.js`(pre-step 门控接线)、`assets/skills/`(31 个技能正文副本)、`assets/skills.matrix.json`、`assets/gating.weights.json`、`skills.manifest.json` 全部删除;预设并集快照里的 `skill-lean-router` provider 行一并摘掉。
12
+ - **审计与面板**:`lib/audit-sink.js`、`lib/audit-commands.js`、`ui/go.json` 删除;`/lean-audit` 命令下线。
13
+ - **技能面板 UI**:`lib/skills-panel.js`、`lib/client.js` 删除;`/panel` 命令下线;`package.json` 去掉 `exports["./client"]` 与 `dsh.client` 声明(不再产出客户端 bundle)。
14
+ - **`/skill` 命令**下线;router 只保留 `/band`。
15
+ - `npm run drift` 脚本与 `scripts/check-drift.mjs` 删除(不再有技能副本可漂移)。
16
+ - 文档 `docs/matrix.md`、`docs/matrix.en.md`、`docs/技能门控-设计说明.md`、`docs/面板-设计说明.md`、`docs/HANDOFF-2026-11-22.md` 删除。
17
+
18
+ ### 变更
19
+
20
+ - `lib/index.js` 收敛为合法空插件(`inject = []`、`apply()` 返回 undefined);宿主层不再需要 `lean-router-client-host` 行。
21
+ - `lib/router.js` 的 `inject` 从 `["agents","systemPrompt","commands","skills"]` 收为前三项;`gate` / `audit` / `auditPath` / `weightsPath` 仍被接受但无行为(兼容旧 patch 配置,不再让插件启动失败)。
22
+ - doctor 从 7 项改为 11 项,并新增两条防回流检查:patch 不得再出现 `skill-lean-router` 与 `lean-router-client-host`。
23
+
24
+ ### 测试
25
+
26
+ - 删除 9 个技能相关测试文件;router / plugin-entry / integration-preset 断言同步收敛。当前 `npm test`:157 tests / 156 pass / 1 skip / 0 fail;`npm run verify` PASS。
27
+
28
+ ## 1.1.0 (2026-11-25)
29
+
30
+ - 变更(形态,用户拍板):技能面板从「顶栏按钮 + body 浮层」改为**右侧栏标签页**。浮层要点开、会遮挡主对话、不能并排,本身就不是可用形态,1.0.9 的 `#lean-router-panel` 浮层实现整体废弃。
31
+ - 新增:按真机范例 `@modusensus/dsh-mneme` 与 `dsh-cost-meter` 的契约接入右栏 —— 类型与引导挂 `sidebarRightTabs.register({ id, kind, title, guide })`(注册前先 `get(id)` 查重,宿主对重复 id 会抛 `tab type id … is already registered`);正文与标题挂 `sidebar.right.pane.tab` / `sidebar.right.pane.tab.title`,spec 用 `{ name, key }` 关联类型。
32
+ - 新增:顶栏「技能」按钮保留为快捷入口,点击走 `ctx.get("sidebarRight").openTab(kind)` 直接打开右栏标签。
33
+ - 修复:opener 改用 `ctx.inject(["slots"])` 就绪后的 scoped ctx 取 `sidebarRight`,避免又踩「服务还没注册」的时机坑。
34
+ - 约束:不再往 `document.body` 追加任何元素;当前版本只做壳(标题 + 两行说明),样式全部继承宿主主题 token,不写死颜色。224 测试全绿。
4
35
 
5
36
  ## 1.0.9 (2026-11-24)
6
37
 
@@ -1,88 +1,57 @@
1
1
  # Configuration reference
2
2
 
3
- > Three blocks: **gate weights**, **audit**, **commands & environment variables**. All configuration flows in through patch-row configs; unknown keys throw (fail early). Chinese original: [configuration.md](./configuration.md).
3
+ > **Plugin-row config**, **commands and environment variables**, **exports subpaths**. Every option reaches `apply(ctx, options)` through a patch row's config, and an unknown key is an error (fail early). Chinese original: [configuration.md](./configuration.md).
4
4
 
5
- ## Gate weights (lib/skillgate.js)
5
+ > Since 2.0.0 the skills subsystem's gate weights and audit settings are gone. `gate` / `audit` / `auditPath` / `weightsPath` are still accepted but do nothing, so an old patch config cannot stop the plugin from starting.
6
6
 
7
- The default gate config lives in `DEFAULT_GATE_CONFIG` (skillgate.js L43-59), validated by `resolveGateConfig` (L64-98, unknown keys throw):
7
+ ## Plugin-row config (patch row -> module)
8
8
 
9
- | Key | Default | Meaning |
10
- |---|---|---|
11
- | autoScore | 2 | score >= autoScore -> auto (near-field auto-mount) |
12
- | hintScore | 1 | hintScore <= score < autoScore -> hint (near-field hint); requires autoScore >= hintScore |
13
- | tokenBudget | 8000 | soft cap on the injection estimate; over-budget low-score autos drop to hint (no count cap) |
14
- | charsPerToken | 4 | token estimate denominator (about 4 chars/token) |
15
- | maxTaskTextChars | 4000 | truncation length of task text used for scoring |
16
- | sceneMap | react: engineering+2/process+1; spec: engineering+2/research+1; weak: {} | Signal A: band -> scenario points |
17
- | complexBoost | engineering: 1 | added when isComplexTask fires |
18
- | arbitration | engineering prefer ds; process prefer mattpocock | ds-* scene arbitration table |
19
-
20
- Score formula: `score = scenePoints + complexBoost + keyword hit count` (each matched keyword adds +1, counted per keyword not per occurrence, skillgate.js L124-153).
21
-
22
- Arbitration only demotes tiers and never flips invocation: when ds-* skills are active, mattpocock skills in `prefer: "ds"` scenes drop auto->hint (L161-178).
23
-
24
- Soft degradation: `degrade` demotes autos to hints in ascending score order (ties broken by name, deterministic) until the estimate fits tokenBudget (L203-222). **The 8k soft degradation is v1 behavior.**
25
-
26
- Gate config path: `makeProvider({ gateConfig })` (skill-provider.js L138) — the `skill-lean-router` patch row's options flow into `lib/index.js apply(ctx, options)` (currently only `rank`; every gateConfig key is configurable via the patch row's config).
27
-
28
- ## Audit
9
+ | patch row id | name | config keys | defaults |
10
+ |---|---|---|---|
11
+ | lean-router-router | dsh-lean-router/router | diligenceEvery / hooks / commands / guideOrder / skipInherited | 10 / true / false / 220 / true |
12
+ | lean-router-commands | dsh-lean-router/router | same | 10 / false / true / 220 / true |
13
+ | lean-delivery-gate | dsh-lean-router/lean/delivery-gate | enabled / scripts / maxRounds / timeoutMs / tailChars | false / [verify.ps1,verify.sh] / 2 / 900000 / 1200 |
14
+ | lean-concurrency | dsh-lean-router/lean/tool-concurrency | toolConcurrency{enabled, tools, sweepMs} | true / [glob,grep] / 500 |
15
+ | toolface | dsh-lean-router/toolface | hiddenPrefixes / metaTools / runToolName / guard / sdkSection / debug / searchLimit / maxDescriptionChars / maxParallelSubCalls / nativeScope / nativeTools / hiddenTools | ['mcp__'] / four meta tools / code_run / true / true / true / 8 / 240 / 10 / true / [] / [] (listed in full in frag-preset.patch.yml) |
29
16
 
30
- - Format version: every entry carries `v: 1` (`AUDIT_FORMAT_VERSION`, skillgate.js L26; format changes must bump it).
31
- - Channel: `createAuditChannel({ capacity })` — in-memory ring buffer (default 256 entries) with `push/entries/drain/subscribe` (L250-279). **Not persisted.**
32
- - Injection: `makeProvider({ audit })` (skill-provider.js L117 comment: the audit channel is injected via makeProvider, consumed by ticket 07).
33
- - Entry shape (`round()`, L313-328): `v / ts / kind:"skillgate-round" / turn / task{band,complex,head} / config{autoScore,hintScore,tokenBudget,charsPerToken} / dsActive / scores (all 31, score + signals) / decision (admitted sets + arbitrations + degradations + estTokens) / estimateText`; decision.mode is always `"fallback-cached-list"` (L311).
34
- - **Audit panel (ticket 07) is in progress**: persisting the audit JSONL (gate decision stream to a sink) and the `ui/go.json` panel card (decision rows + collapsed full-score table + token comparison + warning banner) belong to ticket 07's in-flight work; v1 makes no promise about them.
17
+ Tool-surface config validation: `normalizeConfig` (rules.js L88-125; fewer than two `metaTools` falls back to the whole default table).
35
18
 
36
19
  ## Commands and environment variables
37
20
 
38
21
  ### npm scripts (package.json)
39
22
 
40
- | Command | Purpose |
23
+ | Command | What it does |
41
24
  |---|---|
42
- | npm test | node --test test/ (20 test files) |
43
- | npm run build | re-assemble cordis.patch.yml (base + 4 fragments in fixed order) |
44
- | npm run drift | drift check between assets/skills copies and ~/.dsh/skills (warn-only) |
45
- | npm run doctor | 7 structural self-checks (below) |
46
- | npm run verify | build --check (cordis.patch.yml byte-identical regeneration) + doctor |
25
+ | npm test | `node --test "test/*.test.mjs"` |
26
+ | npm run build | rebuild cordis.patch.yml (base + 4 fragments, fixed order) |
27
+ | npm run doctor | 11 structural checks |
28
+ | npm run verify | build --check (cordis.patch.yml byte-identical) + doctor |
47
29
 
48
- doctor's 7 checks: package.name, package.engines.dsh, cordis.patch.yml exists, patch contains the preset row, manifest has 31 skills, assets/skills has 31 directories, matrix counts 13/10/8 (scripts/doctor.mjs L12-24).
30
+ doctor's 11 checks: package.name, package.engines.dsh, cordis.patch.yml exists, patch has the preset row, patch has the router row, patch has no skill-provider row, patch has no client-host row, lib/router.js exists, lib/lean/index.js exists, lib/toolface/index.js exists, the client bundle is gone (scripts/doctor.mjs).
49
31
 
50
32
  ### Session commands
51
33
 
52
- | Command | Layer | Meaning |
34
+ | Command | Layer | What it does |
53
35
  |---|---|---|
54
- | /band | router | view/switch band; `/band spec`, `/band auto`, `/band react task <one line>` |
55
- | /skill | router | list skills with [model/user] flags; `/skill <name>` for details (provider/source/resource dir) |
36
+ | /band | router | view or switch the band; `/band spec`, `/band auto`, `/band react task <one line>` |
56
37
  | /compact | lean | trigger context compaction manually |
57
38
 
58
- ### First user message directive
39
+ ### First-message directive
59
40
 
60
41
  ~~~text
61
42
  [router] band=spec|react|weak|auto [task=<one line>]
62
43
  ~~~
63
44
 
64
- Explicit directives take precedence over keyword classification (human in the loop); `auto` clears the override and returns to automatic.
45
+ The explicit directive wins over keyword classification (human in the loop); `auto` clears the override and returns to automatic classification.
65
46
 
66
47
  ### Environment variables
67
48
 
68
49
  | Variable | Effect |
69
50
  |---|---|
70
51
  | DSH_DELIVERY_GATE=0 | force the delivery gate off |
71
- | DSH_DELIVERY_GATE=1 | force on when config.enabled is absent |
72
- | DSH_LEAN_ROUTER_CONCURRENCY=0 | disable concurrency marking (also accepts DSH_FLASH_PRESETS_CONCURRENCY=0) |
73
-
74
- ## Plugin-row config summary (patch row -> module)
75
-
76
- | patch row id | name | config keys | defaults |
77
- |---|---|---|---|
78
- | lean-router-router | dsh-lean-router/router | diligenceEvery / hooks / commands / guideOrder / skipInherited | 10 / true / false / 220 / true (router.js L134-147) |
79
- | lean-router-commands | dsh-lean-router/router | same keys | 10 / false / true / 220 / true |
80
- | lean-delivery-gate | dsh-lean-router/lean/delivery-gate | enabled / scripts / maxRounds / timeoutMs / tailChars | false / [verify.ps1,verify.sh] / 2 / 900000 / 1200 (delivery-gate.js L191) |
81
- | lean-concurrency | dsh-lean-router/lean/tool-concurrency | toolConcurrency{enabled, tools, sweepMs} | true / [glob,grep] / 500 |
82
- | toolface | dsh-lean-router/toolface | hiddenPrefixes / metaTools / runToolName / guard / sdkSection / debug / searchLimit / maxDescriptionChars / maxParallelSubCalls / nativeScope / nativeTools / hiddenTools | ['mcp__'] / four meta / code_run / true / true / true / 8 / 240 / 10 / true / [] / [] (frag-preset.patch.yml L236-263 lists all explicitly) |
83
-
84
- Toolface config validation: normalizeConfig (rules.js L88-125; a metaTools list shorter than 2 falls back to the defaults wholesale).
52
+ | DSH_DELIVERY_GATE=1 | force it on when config.enabled is absent |
53
+ | DSH_LEAN_ROUTER_CONCURRENCY=0 | turn the concurrency markers off (also accepts DSH_FLASH_PRESETS_CONCURRENCY=0) |
85
54
 
86
- ## exports subpaths (package.json)
55
+ ## Exports subpaths (package.json)
87
56
 
88
- `.` / `./package.json` / `./router` / `./toolface` / `./lean/delivery-gate` / `./lean/tool-concurrency` — the four feature subpaths back the `name` fields of the router instances and the two add-on plugin rows (`dsh-lean-router/router` etc.).
57
+ `.` / `./package.json` / `./router` / `./toolface` / `./lean/delivery-gate` / `./lean/tool-concurrency` — the four functional subpaths match the `name` fields of the router's two instances and the two add-on rows (`dsh-lean-router/router` and friends).
@@ -1,37 +1,20 @@
1
1
  # 配置参考(configuration)
2
2
 
3
- > 三块:**门控权重**、**审计**、**命令与环境变量**。所有配置经 patch 行 config 传入,未知键一律报错(失败尽早)。英文版:[configuration.en.md](./configuration.en.md)。
3
+ > **插件行 config**、**命令与环境变量**、**exports 子路径**。所有配置经 patch 行 config 传入 `apply(ctx, options)`,未知键一律报错(失败尽早)。英文版:[configuration.en.md](./configuration.en.md)。
4
4
 
5
- ## 门控权重(lib/skillgate.js)
5
+ > 2.0.0 起技能子系统的门控权重与审计配置已移除;`gate` / `audit` / `auditPath` / `weightsPath` 仍被接受但无行为,只为兼容旧 patch 配置而不让插件启动失败。
6
6
 
7
- 默认门控配置在 `DEFAULT_GATE_CONFIG`(skillgate.js L43-59),经 `resolveGateConfig` 校验(L64-98,未知键抛错):
8
-
9
- | 键 | 默认 | 说明 |
10
- |---|---|---|
11
- | autoScore | 2 | score ≥ autoScore → auto(近场自动挂载) |
12
- | hintScore | 1 | hintScore ≤ score < autoScore → hint(近场提示);约束 autoScore ≥ hintScore |
13
- | tokenBudget | 8000 | 注入估算 token 软上限,超了把低分 auto 降 hint(个数不设上限) |
14
- | charsPerToken | 4 | token 估算分母(约 4 字符/token) |
15
- | maxTaskTextChars | 4000 | 参与打分的任务文本截断长度 |
16
- | sceneMap | react: engineering+2/process+1;spec: engineering+2/research+1;weak: {} | 信号 A:路由带 → 场景加分 |
17
- | complexBoost | engineering: 1 | isComplexTask 时叠加 |
18
- | arbitration | engineering prefer ds;process prefer mattpocock | ds-* 场景裁决表 |
19
-
20
- 打分公式:`score = scenePoints + complexBoost + 命中关键词个数`(每个命中关键词 +1,按个数不按出现次数,skillgate.js L124-153)。
21
-
22
- 裁决只降档不改 invocation:ds-* 技能活跃时,`prefer: "ds"` 场景里的 mattpocock 技能 auto→hint(L161-178)。
23
-
24
- 软降级:`degrade` 按得分升序(同分按名字序,确定性)把 auto 降为 hint,直到估算 ≤ tokenBudget(L203-222)。**8k 软降级是 v1 现状**。
25
-
26
- 门控配置传入路径:`makeProvider({ gateConfig })`(skill-provider.js L138)——patch 行 `skill-lean-router` 的 options 即 `lib/index.js apply(ctx, options)` 的 options(目前仅 `rank`;gateConfig 全键可配,改动走 patch 行 config)。
7
+ ## 插件行 config 一览(patch 行 → 模块)
27
8
 
28
- ## 审计(audit 路径)
9
+ | patch 行 id | name | config 键 | 默认 |
10
+ |---|---|---|---|
11
+ | lean-router-router | dsh-lean-router/router | diligenceEvery / hooks / commands / guideOrder / skipInherited | 10 / true / false / 220 / true |
12
+ | lean-router-commands | dsh-lean-router/router | 同上 | 10 / false / true / 220 / true |
13
+ | lean-delivery-gate | dsh-lean-router/lean/delivery-gate | enabled / scripts / maxRounds / timeoutMs / tailChars | false / [verify.ps1,verify.sh] / 2 / 900000 / 1200 |
14
+ | lean-concurrency | dsh-lean-router/lean/tool-concurrency | toolConcurrency{enabled, tools, sweepMs} | true / [glob,grep] / 500 |
15
+ | toolface | dsh-lean-router/toolface | hiddenPrefixes / metaTools / runToolName / guard / sdkSection / debug / searchLimit / maxDescriptionChars / maxParallelSubCalls / nativeScope / nativeTools / hiddenTools | ['mcp__'] / 四 meta / code_run / true / true / true / 8 / 240 / 10 / true / [] / [](frag-preset.patch.yml 显式全列) |
29
16
 
30
- - 格式版本:每条审计带 `v: 1`(`AUDIT_FORMAT_VERSION`,skillgate.js L26;格式变更必须升版本)。
31
- - 通道:`createAuditChannel({ capacity })`——内存环形缓冲(默认 256 条)+ `push/entries/drain/subscribe`(L250-279)。**不落盘**。
32
- - 注入:`makeProvider({ audit })`(skill-provider.js L117 注释:审计通道经 makeProvider 注入,票 07 消费)。
33
- - 条目内容(`round()`,L313-328):`v / ts / kind:"skillgate-round" / turn / task{band,complex,head} / config{autoScore,hintScore,tokenBudget,charsPerToken} / dsActive / scores(31 全量得分+信号) / decision(放行集合+裁决+降级+estTokens) / estimateText`;decision.mode 恒为 `"fallback-cached-list"`(L311)。
34
- - **audit 面板(票 07)进行中**:审计流 JSONL 落盘(skillgate 决策流接 sink)与 `ui/go.json` 面板卡片(决策行 + 全量得分表折叠 + token 对比 + 黄条)属于票 07 的在飞工作,v1 文档不作承诺。
17
+ 工具面 config 校验:`normalizeConfig`(rules.js L88-125,`metaTools` 少于 2 个整表回落默认)。
35
18
 
36
19
  ## 命令与环境变量
37
20
 
@@ -39,20 +22,18 @@
39
22
 
40
23
  | 命令 | 作用 |
41
24
  |---|---|
42
- | npm test | node --test test/(20 个测试文件) |
25
+ | npm test | `node --test "test/*.test.mjs"` |
43
26
  | npm run build | 重拼 cordis.patch.yml(base + 4 分片固定顺序) |
44
- | npm run drift | assets/skills 副本与 ~/.dsh/skills 漂移检查(warn-only) |
45
- | npm run doctor | 7 项结构自检(见下) |
27
+ | npm run doctor | 11 项结构自检 |
46
28
  | npm run verify | build --check(cordis.patch.yml 反向逐字节一致)+ doctor |
47
29
 
48
- doctor 7 项:package.name、package.engines.dsh、cordis.patch.yml 存在、patch 含预设行、manifest 31 技能、assets/skills 目录数 31、矩阵计数 13/10/8(scripts/doctor.mjs L12-24)。
30
+ doctor 11 项:package.name、package.engines.dsh、cordis.patch.yml 存在、patch 含预设行、patch 含路由行、patch 无技能 provider 行、patch 无客户端宿主行、lib/router.js 存在、lib/lean/index.js 存在、lib/toolface/index.js 存在、客户端 bundle 已移除(scripts/doctor.mjs)。
49
31
 
50
32
  ### 会话命令
51
33
 
52
34
  | 命令 | 层 | 说明 |
53
35
  |---|---|---|
54
36
  | /band | router | 查看/切换路由带;`/band spec`、`/band auto`、`/band react task <一行>` |
55
- | /skill | router | 列出技能与 [model/user] 开关;`/skill <name>` 看详情(provider/source/资源目录) |
56
37
  | /compact | lean | 手动触发上下文压缩 |
57
38
 
58
39
  ### 首条用户消息指令
@@ -71,18 +52,6 @@ doctor 7 项:package.name、package.engines.dsh、cordis.patch.yml 存在、pa
71
52
  | DSH_DELIVERY_GATE=1 | config.enabled 缺省时强制开 |
72
53
  | DSH_LEAN_ROUTER_CONCURRENCY=0 | 关并发标记(兼容 DSH_FLASH_PRESETS_CONCURRENCY=0) |
73
54
 
74
- ## 插件行 config 一览(patch 行 → 模块)
75
-
76
- | patch 行 id | name | config 键 | 默认 |
77
- |---|---|---|---|
78
- | lean-router-router | dsh-lean-router/router | diligenceEvery / hooks / commands / guideOrder / skipInherited | 10 / true / false / 220 / true(router.js L134-147) |
79
- | lean-router-commands | dsh-lean-router/router | 同上 | 10 / false / true / 220 / true |
80
- | lean-delivery-gate | dsh-lean-router/lean/delivery-gate | enabled / scripts / maxRounds / timeoutMs / tailChars | false / [verify.ps1,verify.sh] / 2 / 900000 / 1200(delivery-gate.js L191) |
81
- | lean-concurrency | dsh-lean-router/lean/tool-concurrency | toolConcurrency{enabled, tools, sweepMs} | true / [glob,grep] / 500 |
82
- | toolface | dsh-lean-router/toolface | hiddenPrefixes / metaTools / runToolName / guard / sdkSection / debug / searchLimit / maxDescriptionChars / maxParallelSubCalls / nativeScope / nativeTools / hiddenTools | ['mcp__'] / 四 meta / code_run / true / true / true / 8 / 240 / 10 / true / [] / [](frag-preset.patch.yml L236-263 显式全列) |
83
-
84
- 工具面 config 校验:normalizeConfig(rules.js L88-125,metaTools 少于 2 个整表回落默认)。
85
-
86
55
  ## exports 子路径(package.json)
87
56
 
88
57
  `.` / `./package.json` / `./router` / `./toolface` / `./lean/delivery-gate` / `./lean/tool-concurrency`——四个功能子路径分别对应 router 两实例与两个加料件插件行的 `name` 字段(`dsh-lean-router/router` 等)。
@@ -7,7 +7,7 @@
7
7
  ```powershell
8
8
  npm i -g dsh-lean-router
9
9
  dsh plugin install dsh-lean-router
10
- dsh --dump-config | Select-String "skill-lean-router"
10
+ dsh --dump-config | Select-String "lean-router-router"
11
11
  ```
12
12
 
13
13
  ## Option 2: local tarball (offline / pre-release self-test)
@@ -40,7 +40,7 @@ npm run build # generate bundle (cordis.patch.yml)
40
40
  ```powershell
41
41
  dsh plugin uninstall dsh-lean-router
42
42
  npm uninstall -g dsh-lean-router
43
- dsh --dump-config | Select-String "skill-lean-router" # expect no output
43
+ dsh --dump-config | Select-String "lean-router-router" # expect no output
44
44
  ```
45
45
 
46
46
  ## Requirements
package/docs/install.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ```powershell
8
8
  npm i -g dsh-lean-router
9
9
  dsh plugin install dsh-lean-router
10
- dsh --dump-config | Select-String "skill-lean-router"
10
+ dsh --dump-config | Select-String "lean-router-router"
11
11
  ```
12
12
 
13
13
  ## 方式二:本地 tarball 安装(离线 / 首发前自测)
@@ -40,7 +40,7 @@ npm run build # 生成 bundle(cordis.patch.yml)
40
40
  ```powershell
41
41
  dsh plugin uninstall dsh-lean-router
42
42
  npm uninstall -g dsh-lean-router
43
- dsh --dump-config | Select-String "skill-lean-router" # 期望无输出
43
+ dsh --dump-config | Select-String "lean-router-router" # 期望无输出
44
44
  ```
45
45
 
46
46
  ## 要求