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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-lean-router",
3
- "version": "1.0.9",
4
- "description": "lean 省 token × 思考链路由 × code_run 工具遮蔽 × mattpocock 技能自动调用的 DSH cordis 插件(单 bundle:预设+配套技能)",
3
+ "version": "2.0.0",
4
+ "description": "lean 省 token × 思考链路由 × code_run 工具遮蔽的 DSH cordis 插件(单 bundle:预设)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -10,18 +10,12 @@
10
10
  "./router": "./lib/router.js",
11
11
  "./toolface": "./lib/toolface/index.js",
12
12
  "./lean/delivery-gate": "./lib/lean/delivery-gate.js",
13
- "./lean/tool-concurrency": "./lib/lean/tool-concurrency.js",
14
- "./client": {
15
- "default": "./lib/client.js"
16
- }
13
+ "./lean/tool-concurrency": "./lib/lean/tool-concurrency.js"
17
14
  },
18
15
  "files": [
19
16
  "lib",
20
17
  "presets",
21
- "assets",
22
- "ui",
23
18
  "docs",
24
- "skills.manifest.json",
25
19
  "cordis.patch.yml",
26
20
  "scripts",
27
21
  "test",
@@ -42,16 +36,12 @@
42
36
  "scripts": {
43
37
  "test": "node --test \"test/*.test.mjs\"",
44
38
  "build": "node scripts/build-bundle.mjs",
45
- "drift": "node scripts/check-drift.mjs",
46
39
  "doctor": "node scripts/doctor.mjs",
47
40
  "verify": "node scripts/verify.mjs"
48
41
  },
49
42
  "dsh": {
50
43
  "bundle": {
51
44
  "patch": "./cordis.patch.yml"
52
- },
53
- "client": {
54
- "platform": "web"
55
45
  }
56
46
  },
57
47
  "keywords": [
@@ -59,8 +49,7 @@
59
49
  "agent-preset",
60
50
  "lean",
61
51
  "router",
62
- "codemode",
63
- "skills"
52
+ "codemode"
64
53
  ],
65
54
  "dependencies": {
66
55
  "@deepseek-ai/dsh-tool-executor-native": ">=0.2.2-alpha.3 <0.2.4-0"
@@ -17,7 +17,7 @@
17
17
  config:
18
18
  id: lean-router
19
19
  name: Lean router
20
- description: "lean 省 token × 思考链路由 × code_run 遮蔽 × mattpocock 技能自动调用(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
20
+ description: "lean 省 token × 思考链路由 × code_run 遮蔽(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
21
21
  order: 30
22
22
  plugins:
23
23
  # 机制 4 · 行为纪律(persona 双档;lean 档 13 条硬规则 + 3 软门 + 自检题钩子)
@@ -106,8 +106,6 @@
106
106
  name: '@deepseek-ai/dsh-tool-jobs'
107
107
  - id: skill-filesystem
108
108
  name: '@deepseek-ai/dsh-skill-filesystem'
109
- - id: skill-lean-router
110
- name: dsh-lean-router
111
109
  - id: tool-skill
112
110
  name: '@deepseek-ai/dsh-tool-skill'
113
111
  - id: command-goal
@@ -284,8 +282,6 @@
284
282
  name: '@deepseek-ai/dsh-tool-jobs'
285
283
  - id: skill-filesystem
286
284
  name: '@deepseek-ai/dsh-skill-filesystem'
287
- - id: skill-lean-router
288
- name: dsh-lean-router
289
285
  - id: tool-skill
290
286
  name: '@deepseek-ai/dsh-tool-skill'
291
287
  - id: command-goal
@@ -9,7 +9,7 @@
9
9
  config:
10
10
  id: lean-router
11
11
  name: Lean router
12
- description: "lean 省 token × 思考链路由 × code_run 遮蔽 × mattpocock 技能自动调用(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
12
+ description: "lean 省 token × 思考链路由 × code_run 遮蔽(lean 档:13 条纪律 + 3 软门 + 自检题钩子)。"
13
13
  order: 30
14
14
  plugins:
15
15
  - id: persona
@@ -100,8 +100,6 @@
100
100
  name: '@deepseek-ai/dsh-tool-jobs'
101
101
  - id: skill-filesystem
102
102
  name: '@deepseek-ai/dsh-skill-filesystem'
103
- - id: skill-lean-router
104
- name: dsh-lean-router
105
103
  - id: tool-skill
106
104
  name: '@deepseek-ai/dsh-tool-skill'
107
105
  - id: command-goal
@@ -1,28 +1,17 @@
1
1
  # dsh-lean-router 票 05 路由层分片(顶层列表续项;由 scripts/build-bundle.mjs 续接进 cordis.patch.yml)
2
2
  # 钩子行:agent/inbox/claimed 首轮捕获 + 近场引导 dynamic context + 勤勉自检
3
- # 命令行:/band 显式改档、/skill 技能与 invocation 列表(宿主 ctx.commands 缝)
3
+ # 命令行:/band 显式改档(宿主 ctx.commands 缝)
4
4
  # 入口子路径 dsh-lean-router/router 需要 package.json exports 增补 "./router": "./lib/router.js"
5
5
  # (package.json 为共享文件,由 master 统一集成;见 lib/router.js ROUTER_INJECTION_NOTES.patchEntry)
6
6
  - insert:
7
- # 1.0.5 修:宿主层裸包名行(对照 dsh-cost-meter 的 "one host row")。
8
- # 没有这一行,客户端模块扫描看不到 dsh.client -> 客户端 bundle 不加载 -> 无顶栏按钮。
9
- # config.provider=false:不重复注册 skill provider(预设层已注册)。
10
- - id: lean-router-client-host
11
- name: dsh-lean-router
12
7
  - id: lean-router-router
13
8
  name: dsh-lean-router/router
14
9
  config:
15
10
  hooks: true
16
11
  commands: false
17
12
  diligenceEvery: 10
18
- # 1.0.5 修:每轮门控必须开,否则 skillgate 不跑 -> 审计零条目、审计文件从不生成。
19
- # 依据 lib/router.js:345(cfg.hooks && cfg.gate 才建 runner)与 lib/router.js:194。
20
- gate: true
21
13
  - id: lean-router-commands
22
14
  name: dsh-lean-router/router
23
15
  config:
24
16
  hooks: false
25
17
  commands: true
26
- # master 集成(票 07 §9.1):审计落盘开;auditPath/weightsPath 省略 = 默认值
27
- # (注意不能传空串:lib/router.js:145-149 对空串抛错,缺省语义见 §9.1 修正版)
28
- audit: true
@@ -37,8 +37,6 @@
37
37
  name: '@deepseek-ai/dsh-tool-jobs'
38
38
  - id: skill-filesystem
39
39
  name: '@deepseek-ai/dsh-skill-filesystem'
40
- - id: skill-lean-router
41
- name: dsh-lean-router
42
40
  - id: tool-skill
43
41
  name: '@deepseek-ai/dsh-tool-skill'
44
42
  - id: command-goal
@@ -2,14 +2,13 @@
2
2
  # TODO(ticket-03 lean 层):compaction 0.25/20000、tool-result pruner 4096/1024、关 6 插件、lean13/balance3 persona、plan-mode v1、delivery-gate、glob/grep 并发标记
3
3
  # TODO(ticket-04 工具遮蔽层):codemode executor 遮蔽行 + code_run 传输 + meta 4 工具 + 常驻 ptc-runtime
4
4
  # TODO(ticket-05 路由层):首轮 inbox.claim 捕获 + [router] band/task 分类指令 + pre-step 近场引导 + 3 软门 + /band
5
- # TODO(ticket-06 技能门控层):skill provider rank 配置 + 每轮评分放行 + 8k 软降级 + 审计
6
5
  - insert:
7
6
  - id: preset-lean-router
8
7
  name: '@deepseek-ai/dsh-agent-preset'
9
8
  config:
10
9
  id: lean-router
11
10
  name: Lean router
12
- description: "lean 省 token × 思考链路由 × code_run 遮蔽 × mattpocock 技能自动调用(v1.0.0 骨架)"
11
+ description: "lean 省 token × 思考链路由 × code_run 遮蔽(2.0.0)"
13
12
  order: 30
14
13
  plugins:
15
14
  - id: persona
@@ -37,8 +36,6 @@
37
36
  name: '@deepseek-ai/dsh-tool-jobs'
38
37
  - id: skill-filesystem
39
38
  name: '@deepseek-ai/dsh-skill-filesystem'
40
- - id: skill-lean-router
41
- name: dsh-lean-router
42
39
  - id: tool-skill
43
40
  name: '@deepseek-ai/dsh-tool-skill'
44
41
  - id: command-goal
@@ -1,5 +1,5 @@
1
- // dsh-lean-router - 体检(票 02 骨架版;票 04/06 将加四层接缝自检)
2
- import { readFile, readdir } from "node:fs/promises";
1
+ // dsh-lean-router - 体检(2.0.0:技能子系统下线后只剩结构自检)
2
+ import { readFile, access } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -8,20 +8,25 @@ const ROOT = fileURLToPath(new URL("..", import.meta.url));
8
8
  export async function doctor() {
9
9
  const lines = []; let fail = 0;
10
10
  const ok = (name, cond, extra) => { lines.push((cond ? "[PASS] " : "[FAIL] ") + name + (extra ? " | " + extra : "")); if (!cond) fail++; };
11
+ const exists = async (rel) => { try { await access(join(ROOT, rel)); return true; } catch { return false; } };
12
+
11
13
  const pkg = JSON.parse(await readFile(join(ROOT, "package.json"), "utf8"));
12
14
  ok("package.name", pkg.name === "dsh-lean-router", pkg.name);
13
15
  ok("package.engines.dsh", typeof (pkg.engines ?? {}).dsh === "string" && pkg.engines.dsh.includes("0.2.1-rc.5"), pkg.engines?.dsh);
16
+
14
17
  const patch = await readFile(join(ROOT, "cordis.patch.yml"), "utf8").catch(() => null);
15
18
  ok("cordis.patch.yml 存在", !!patch);
16
19
  ok("patch 含预设行", !!patch && patch.includes("preset-lean-router"));
17
- const manifest = JSON.parse(await readFile(join(ROOT, "skills.manifest.json"), "utf8"));
18
- ok("manifest 31 技能", manifest.skills.length === 31, String(manifest.skills.length));
19
- const dirs = (await readdir(join(ROOT, "assets", "skills"), { withFileTypes: true })).filter(d => d.isDirectory());
20
- ok("assets/skills 目录数", dirs.length === 31, String(dirs.length));
21
- const matrix = JSON.parse(await readFile(join(ROOT, "assets", "skills.matrix.json"), "utf8"));
22
- const c = { both: 0, modelOnly: 0, userOnly: 0 };
23
- for (const s of matrix.skills) { if (s.model && s.user) c.both++; else if (s.model) c.modelOnly++; else c.userOnly++; }
24
- ok("矩阵计数 13/10/8", c.both === 13 && c.modelOnly === 10 && c.userOnly === 8, JSON.stringify(c));
20
+ ok("patch 含路由行", !!patch && patch.includes("lean-router-router"));
21
+ // 2.0.0 移除的子系统不得回流:技能 provider 行与客户端宿主行都已下线。
22
+ ok("patch 无技能 provider 行", !!patch && !patch.includes("skill-lean-router"));
23
+ ok("patch 无客户端宿主行", !!patch && !patch.includes("lean-router-client-host"));
24
+
25
+ ok("lib/router.js 存在", await exists("lib/router.js"));
26
+ ok("lib/lean/index.js 存在", await exists("lib/lean/index.js"));
27
+ ok("lib/toolface/index.js 存在", await exists("lib/toolface/index.js"));
28
+ ok("客户端 bundle 已移除", !(await exists("lib/client.js")));
29
+
25
30
  console.log(lines.join("\n"));
26
31
  return fail === 0;
27
32
  }
@@ -26,15 +26,16 @@ function suffixBlock(text) {
26
26
  return out.join('\n');
27
27
  }
28
28
 
29
- test('frag-preset 是 preset 行唯一生效 owner:21 行并集、无重复、toolface 收尾', () => {
29
+ test('frag-preset 是 preset 行唯一生效 owner:20 行并集、无重复、toolface 收尾', () => {
30
30
  const ids = frag.split(/\r?\n/).filter(l => /^ - id: /.test(l)).map(l => /^ - id: (.+)$/.exec(l)[1].trim());
31
- assert.equal(ids.length, 21, '并集行数 = 覆写块 20 + toolface(ptc-runtime 属宿主层,不进 preset)');
31
+ assert.equal(ids.length, 20, '并集行数 = 覆写块 19 + toolface(2.0.0 移除 skill-lean-router;ptc-runtime 属宿主层,不进 preset)');
32
32
  assert.equal(new Set(ids).size, ids.length, '无重复 id');
33
33
  assert.equal(ids[ids.length - 1], 'toolface', 'toolface 最后(遮蔽面与 preset 同行生效)');
34
34
  assert.ok(!ids.includes('ptc-runtime'), 'ptc-runtime 由宿主 dsh-base 挂载,放进 preset 会让整条 preset 激活失败(1.0.3 事故回归)');
35
- for (const id of ['persona', 'agent-instructions', 'skill-filesystem', 'skill-lean-router', 'planning', 'compaction', 'delegation', 'tool-todo', 'tool-web', 'present', 'toolface']) {
35
+ for (const id of ['persona', 'agent-instructions', 'skill-filesystem', 'planning', 'compaction', 'delegation', 'tool-todo', 'tool-web', 'present', 'toolface']) {
36
36
  assert.ok(ids.includes(id), '缺行: ' + id);
37
37
  }
38
+ assert.ok(!ids.includes('skill-lean-router'), '2.0.0 起不再挂 lean-router 技能 provider 行');
38
39
  assert.ok(!ids.includes('preset-lean-router-balance'), 'balance 是独立行,不在并集行 id 内');
39
40
  assert.ok(!ids.includes('lean-delivery-gate') && !ids.includes('lean-concurrency'), '交付门/并发标记是独立行,不在并集行 id 内');
40
41
  });
@@ -1,61 +1,26 @@
1
- // dsh-lean-router 1.0.6 —— 包入口(lib/index.js)的 cordis 契约回归。
2
- // 背景(0.2.3 真机):inject 写成 { required: [], optional: ["skills"] } 会被 cordis 当成
3
- // 两个叫 required / optional 的服务,宿主层那行永远 PENDING,apply 不跑,客户端 bundle
4
- // 不被扫描,顶栏按钮不出现。cordis 的 inject 只有两种形状:
5
- // Inject<M> = (keyof M)[] | { [K in keyof M]?: M[K] } (registry.ts L19)
1
+ // dsh-lean-router 2.0.0 —— 包入口(lib/index.js)的 cordis 契约回归。
2
+ // 2.0.0 起技能子系统下线,入口只剩一个合法插件形状;保留本测试是因为历史上两次真机事故都出在这里:
3
+ // 1.0.6: inject 写成 { required: [], optional: [...] } → 被当成两个服务名,宿主行永远 PENDING。
4
+ // 1.0.2: apply 返回普通对象 → cordis 抛 Invalid effect,整条 preset 不注册。
6
5
  import test from "node:test";
7
6
  import assert from "node:assert/strict";
8
- import { tmpdir } from "node:os";
9
- import { join } from "node:path";
10
7
 
11
8
  import * as entry from "../lib/index.js";
12
9
 
13
- /** 把 homedir() 指向临时目录,避免自检日志写进真实用户目录。 */
14
- function withTempHome(fn) {
15
- const saved = process.env.USERPROFILE;
16
- process.env.USERPROFILE = join(tmpdir(), "dsh-lean-router-test-home");
17
- try {
18
- return fn();
19
- } finally {
20
- if (saved === undefined) delete process.env.USERPROFILE;
21
- else process.env.USERPROFILE = saved;
22
- }
23
- }
24
-
25
- test("inject 是 cordis 认的形状,不能出现 required/optional 键", () => {
26
- if (Array.isArray(entry.inject)) return;
27
- assert.equal(typeof entry.inject, "object", "inject 必须是数组或服务名映射");
28
- const keys = Object.keys(entry.inject);
29
- assert.ok(
30
- !keys.includes("required") && !keys.includes("optional"),
31
- "inject 被当成服务名映射后出现了 required/optional 键:" + keys.join(","),
32
- );
10
+ test("包可被导入,且有 name / inject / apply", () => {
11
+ assert.equal(typeof entry.name, "string");
12
+ assert.ok(Array.isArray(entry.inject), "inject 必须是服务名数组或服务名映射,不能是 { required, optional }");
13
+ assert.equal(typeof entry.apply, "function");
33
14
  });
34
15
 
35
- test("宿主作用域:provider:false 时不碰 skills,apply 返回 undefined", () => {
36
- withTempHome(() => {
37
- const ctx = { inject() { throw new Error("provider:false 不该调用 ctx.inject"); } };
38
- assert.equal(entry.apply(ctx, { provider: false }), undefined);
39
- });
40
- });
41
-
42
- test("预设作用域:用 ctx.inject 等 skills 就绪,而不是把它写进必需依赖", () => {
43
- withTempHome(() => {
44
- const calls = [];
45
- const ctx = { inject(deps, cb) { calls.push({ deps, cb }); } };
46
- assert.equal(entry.apply(ctx, {}), undefined, "apply 不能把 ctx.inject 的 fiber 当 effect 交回去");
47
- assert.equal(calls.length, 1);
48
- assert.deepEqual(calls[0].deps, ["skills"]);
49
- let registered = null;
50
- calls[0].cb({ skills: { registerProvider(factory) { registered = factory; } } });
51
- assert.equal(typeof registered, "function", "skills 就绪后必须注册 provider");
52
- });
16
+ test("inject 里不出现 required / optional 这类伪服务名", () => {
17
+ const keys = Array.isArray(entry.inject) ? entry.inject : Object.keys(entry.inject);
18
+ assert.ok(!keys.includes("required") && !keys.includes("optional"), "inject 键:" + keys.join(","));
53
19
  });
54
20
 
55
- test("没有 ctx.inject 时退化为直接注册(老宿主兼容)", () => {
56
- withTempHome(() => {
57
- let registered = null;
58
- entry.apply({ skills: { registerProvider(factory) { registered = factory; } } }, {});
59
- assert.equal(typeof registered, "function");
21
+ test("apply 返回 undefined,且不读任何服务属性(cordis 会因未 inject 直接抛)", () => {
22
+ const ctx = new Proxy({}, {
23
+ get(_t, key) { throw new Error("apply 不该读 ctx." + String(key)); },
60
24
  });
25
+ assert.equal(entry.apply(ctx, {}), undefined);
61
26
  });
@@ -5,10 +5,10 @@ import assert from "node:assert/strict";
5
5
 
6
6
  import { BANDS, GUIDE_CONTEXT_NAME, internals, apply } from "../lib/router.js";
7
7
 
8
- const { capture, guideTextFor, executeBandCommand, executeSkillCommand } = internals;
8
+ const { capture, guideTextFor, executeBandCommand } = internals;
9
9
 
10
- /** 最小假 ctx:on / systemPrompt.context / commands.register / skills 全部可观测。 */
11
- function makeCtx(skills) {
10
+ /** 最小假 ctx:on / systemPrompt.context / commands.register 全部可观测。 */
11
+ function makeCtx() {
12
12
  const handlers = new Map();
13
13
  const contexts = new Map();
14
14
  const commands = new Map();
@@ -30,33 +30,10 @@ function makeCtx(skills) {
30
30
  return () => {};
31
31
  },
32
32
  },
33
- skills,
34
33
  };
35
34
  return { ctx, handlers, contexts, commands };
36
35
  }
37
36
 
38
- function fakeSkills() {
39
- return {
40
- async list() {
41
- return [
42
- { name: "tdd", description: "Test-driven development", invocation: { modelInvocable: true, userInvocable: false } },
43
- { name: "retro", description: "Retrospective", invocation: { modelInvocable: false, userInvocable: true } },
44
- ];
45
- },
46
- async get(name) {
47
- if (name !== "tdd") return undefined;
48
- return {
49
- name: "tdd",
50
- description: "Test-driven development",
51
- invocation: { modelInvocable: true, userInvocable: false },
52
- provider: "lean-router",
53
- source: "bundled",
54
- resourceBase: { kind: "directory", path: "/skills/tdd" },
55
- };
56
- },
57
- };
58
- }
59
-
60
37
  async function emitClaimed(ctx, handlers, agent, message, turn) {
61
38
  for (const handler of handlers.get("agent/inbox/claimed") ?? []) await handler({ agent, message, turn });
62
39
  }
@@ -66,7 +43,7 @@ const agentA = { session: {} };
66
43
  const agentB = { session: {} };
67
44
 
68
45
  async function routedSetup(options) {
69
- const { ctx, handlers, contexts, commands } = makeCtx(fakeSkills());
46
+ const { ctx, handlers, contexts, commands } = makeCtx();
70
47
  assert.equal(apply(ctx, options), undefined, 'apply must not return a plain object (cordis "Invalid effect")');
71
48
  return { ctx, handlers, contexts, commands };
72
49
  }
@@ -76,14 +53,15 @@ test("apply 默认注册 hooks 与 commands", async () => {
76
53
  assert.ok(handlers.has("agent/inbox/claimed"));
77
54
  assert.ok(contexts.has(GUIDE_CONTEXT_NAME));
78
55
  assert.ok(commands.has("band"));
79
- assert.ok(commands.has("skill"));
56
+ // 2.0.0:/skill /panel /lean-audit 随技能子系统一起下线,只保留 /band。
57
+ assert.equal(commands.size, 1);
80
58
  });
81
59
 
82
60
  test("每个命令的 input hint 都非空(宿主 normalizeDefinition 会抛 TypeError)", async () => {
83
61
  // 1.0.6 回归:/panel 曾用 input:{hint:""},0.2.3 真机报
84
62
  // TypeError: command "panel" input hint must not be empty,整条 lean-router-commands 不激活。
85
63
  const { commands } = await routedSetup({});
86
- assert.ok(commands.size >= 4, "band / skill / panel / lean-audit 都应注册");
64
+ assert.ok(commands.size >= 1, "至少要有 /band");
87
65
  for (const [name, def] of commands) {
88
66
  if (def.input === undefined) continue;
89
67
  assert.equal(typeof def.input.hint, "string", name + " 的 input.hint 必须是字符串");
@@ -99,7 +77,6 @@ test("options 分流:hooks:false 只留命令;commands:false 只留钩子",
99
77
  const b = await routedSetup({ commands: false });
100
78
  assert.ok(b.handlers.has("agent/inbox/claimed"));
101
79
  assert.ok(!b.commands.has("band"));
102
- assert.ok(!b.commands.has("skill"));
103
80
  });
104
81
 
105
82
  test("resolveOptions:未知键报错、diligenceEvery 校验", async () => {
@@ -219,23 +196,6 @@ test("/band:显示/改档/auto 回退/非法值报错", async () => {
219
196
  assert.equal(band.handler({}).kind, "error");
220
197
  });
221
198
 
222
- test("/skill:列表与详情走 skills 服务,未知技能报错", async () => {
223
- const { ctx, commands } = await routedSetup({});
224
- const skill = commands.get("skill");
225
- const list = await skill.handler({ agent: agentA, rawInput: "" });
226
- assert.equal(list.kind, "success");
227
- assert.ok(list.text.includes("tdd [model]"));
228
- assert.ok(list.text.includes("retro [user]"));
229
- const detail = await skill.handler({ agent: agentA, rawInput: "tdd" });
230
- assert.equal(detail.kind, "success");
231
- assert.ok(detail.text.includes("provider: lean-router"));
232
- assert.ok(detail.text.includes("/skills/tdd"));
233
- const unknown = await skill.handler({ agent: agentA, rawInput: "nope" });
234
- assert.equal(unknown.kind, "error");
235
- const noAgent = await skill.handler({});
236
- assert.equal(noAgent.kind, "error");
237
- });
238
-
239
199
  test("capture/guideTextFor 内部实现直调(状态隔离:两个 agent 互不影响)", () => {
240
200
  const states = new WeakMap();
241
201
  const changedA = capture(states, agentA, userMessage("修复报错"), 1, true);
@@ -1,13 +0,0 @@
1
- {
2
- "version": 1,
3
- "sceneMap": {
4
- "react": { "engineering": 2, "process": 1 },
5
- "spec": { "engineering": 2, "research": 1 },
6
- "weak": {}
7
- },
8
- "complexBoost": { "engineering": 1 },
9
- "autoScore": 2,
10
- "hintScore": 1,
11
- "tokenBudget": 8000,
12
- "charsPerToken": 4
13
- }
@@ -1,55 +0,0 @@
1
- # Phase boundaries
2
-
3
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *"ok, we're done with that"*.
4
-
5
- The **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.
6
-
7
- ## The five options
8
-
9
- | Option | What it does |
10
- | ------------ | --------------------------------------------------------------- |
11
- | **Continue** | Stay in the session. No context switch at all. |
12
- | **`/clear`** | Empty the context window and start from nothing. |
13
- | **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |
14
- | **Subagent** | Send the task to its own context window and get a report back. |
15
- | **`/compact`** | Compress this context and seed a fresh session with the summary. |
16
-
17
- ## The tree
18
-
19
- Work top to bottom at the boundary. The first **yes** wins.
20
-
21
- **1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.
22
-
23
- **2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.
24
-
25
- The cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.
26
-
27
- **3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:
28
-
29
- - swapping to a **new harness** (Claude → Codex),
30
- - moving to a **new directory** or repo,
31
- - sending the work to a **colleague**,
32
- - or forking a side task you found **mid-phase** without derailing what you're doing.
33
-
34
- That list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.
35
-
36
- **4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.
37
-
38
- **5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.
39
-
40
- `/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.
41
-
42
- ## Primary and secondary sources
43
-
44
- Every move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:
45
-
46
- | Source | Information | Noise | Room to move |
47
- | --------------------------------- | ----------- | ----- | ------------ |
48
- | Primary (Continue) | Full | Lots | Little |
49
- | Secondary (`/compact`, `/handoff`) | Lossy | Less | Lots |
50
-
51
- This is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.
52
-
53
- ## These are judgement calls
54
-
55
- The questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.
@@ -1,80 +0,0 @@
1
- ---
2
- name: ask-matt
3
- description: Ask which /command fits your situation. A router over the installed skills, all of which are invoked by the user, never by the model.
4
- disable-model-invocation: true
5
- user-invocable: true
6
- ---
7
-
8
- # Ask Matt
9
-
10
- You don't remember every skill, so ask. Describe the situation and get back **one next `/command` to type**, and why.
11
-
12
- Every skill in this set is **user-invoked**: none of them appear in the model's catalog and the model cannot load one on its own. Only the user typing `/name` brings a skill in. That shapes how this router works:
13
-
14
- - Recommend **one command per step**, named exactly, so the user can type it.
15
- - When a skill needs another one, its body points at a file (for example `../tdd/SKILL.md`) that you can read directly. Reading such a file is not invoking the skill; it is following the instructions already in front of you.
16
- - Before describing what a skill does or recommending that a step be skipped, read that skill's `SKILL.md`. The summaries here are for orientation only.
17
-
18
- A **flow** is a path through the skills. Most paths run along one **main flow**, and a few **on-ramps** merge onto it.
19
-
20
- ## The main flow: idea → ship
21
-
22
- 1. **`/grilling`** sharpens the idea by interview. With `--docs` it is stateful: decisions land in `GLOSSARY.md` and ADRs as you go. Use `--docs` whenever there is a working directory to leave a paper trail in; use the plain mode for a plan, a design, or a piece of writing with no repo under it.
23
- 2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype:
24
- - **`/handoff`** out, then open a fresh session against that file,
25
- - **`/prototype`** to answer the question with throwaway code,
26
- - **`/handoff`** back what you learned, and reference it from the original idea thread.
27
- 3. **Branch: is this a multi-session build?**
28
- - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**.
29
- - **No** → **`/implement`** right here, in the same context window.
30
- 4. **`/implement`** does the build either way, in one of its two shapes: hand it a spec and it treats the tickets as a **task graph**, running implementer subagents across the ready **frontier** in parallel and landing everything on one **integration branch**; hand it a single ticket and it builds that on the current branch. Both drive `/tdd` (one red-green slice at a time) and close with `/code-review`.
31
- 5. **`/pr`** shapes the body when the work goes up as a pull request: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call.
32
- 6. **`/retro`** closes the loop. It looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards.
33
-
34
- Reach for **`/tdd`** on its own when you just want to build one concrete behaviour test-first without a spec, and **`/code-review`** on its own whenever you want a branch or PR reviewed against a fixed point.
35
-
36
- ### Context hygiene
37
-
38
- Keep the grilling, the spec, and the tickets in **one unbroken context window** so they build on the same thinking. Each `/implement` then starts fresh from the ticket. Run `/retro` in the session it looks back on, before you clear.
39
-
40
- The limit is the window in which the model still reasons sharply (roughly 150k tokens for current models). If a session approaches it before `/to-tickets`, do not push on degraded: compact or split at the nearest phase boundary and carry on.
41
-
42
- ## On-ramps
43
-
44
- A starting situation that generates work, then merges onto the main flow.
45
-
46
- - **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which `/implement` later picks up. Triage is only for issues **you didn't create**: bug reports, incoming requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so don't triage them.
47
- - **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. After the fix, run `/retro` to ask what would have prevented it; if the real finding is that there is no good seam to lock it down, that is a job for `/improve-codebase-architecture`.
48
- - **A huge, foggy effort, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of decision tickets and resolves them one at a time, producing **decisions, not deliverables**, until the fog clears. Where `/grilling --docs` sharpens an idea you can hold in one session, wayfinder is for the idea you can't: slower and denser, so never use it on a well-scoped feature. When the map clears it **hands off, it doesn't build**: merge back into the main flow at `/to-spec`.
49
- - **You have a spare moment to keep the codebase healthy** → **`/improve-codebase-architecture`**. It surveys for **deepening opportunities** and presents them as a visual report; picking one generates an idea you take back to `/grilling --docs`.
50
-
51
- ## Vocabulary underneath
52
-
53
- Two references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem, or follow them when a skill above points at them.
54
-
55
- - **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. This is the discipline `/grilling --docs` drives to keep `GLOSSARY.md` a clean glossary.
56
- - **`/codebase-design`**: the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
57
-
58
- ## Phase boundaries
59
-
60
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the boundary between two of them you have five options, and picking between them is the fuzziest decision in this whole map: **continue**, **clear** the window, **`/handoff`** a portable file, send a **subagent**, or **compact**. Read [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree, the reasoning behind each branch, and why "Continue" is the one to rule out first. `/handoff` is narrow: a new harness, a new directory, a colleague, or forking a side task mid-phase. What it buys is portability.
61
-
62
- ## Standalone
63
-
64
- Off the main flow entirely.
65
-
66
- - **`/research`**: delegate reading legwork to a background agent. It investigates against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. Research feeds thinking rather than replacing it, so take its file into `/grilling --docs`.
67
- - **`/prototype`**: a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch, pointed at from the implementation issue.
68
- - **`/wizard`**: for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar dashboard, running a one-off migration. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and secrets, so the procedure stops being something you re-explain every time. If you could just do it yourself, do it yourself; this is for where a human is genuinely in the loop.
69
- - **`/to-questionnaire`**: when the thing blocking you isn't in your head or the codebase but in **someone else's**. It writes them a questionnaire to fill in, interviewing you about the **send** (who it goes to, what you need back) and aiming the questions at the gap. What comes back is material for `/grilling --docs` or `/to-spec`.
70
- - **`/wait-what`**: the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary.
71
- - **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.
72
- - **`/writing-for-agents`**: the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.
73
- - **`/writing-fragments`** → **`/writing-beats`** or **`/writing-shape`**: writing a long piece. Fragments is explore (mine raw material, no structure). Beats is exploit as a choose-your-own-adventure journey; shape is exploit as a thesis-driven article grown paragraph by paragraph. Both read `../_shared/WRITING-MECHANICS.md` for the grounding accounting they share.
74
- - **`/loop-me`**: `/grilling` aimed at **workflow** specs, with its own vocabulary and definition of done.
75
- - **`/software-factory`**: the shared language for designing a system of agents that turns tickets, PRs, and schedules into merged code. Vocabulary, not a process.
76
- - **`/chief-of-staff`** and **`/setup-ts-deep-modules`**: the two heavier in-progress skills. Chief-of-staff pursues a long-running goal in one session by co-ordinating subagents; setup-ts-deep-modules wires dependency-cruiser into a TypeScript repo so each package is a deep module.
77
-
78
- ## Precondition
79
-
80
- **`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
@@ -1,5 +0,0 @@
1
- interface:
2
- display_name: "Ask Matt"
3
- short_description: "Find the right skill or workflow"
4
- policy:
5
- allow_implicit_invocation: false