dsh-lean-router 1.1.0 → 2.1.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/adr/0001-token-ledger-durable-usage.md +11 -0
- 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 +41 -1
- package/docs/changelog.md +41 -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/bands.js +4 -2
- package/lib/index.js +9 -61
- package/lib/router.js +15 -148
- package/lib/token-ledger/index.js +147 -0
- package/lib/token-ledger/live.js +184 -0
- package/package.json +5 -14
- 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-bands.test.mjs +26 -0
- package/test/router.test.mjs +7 -47
- package/test/token-ledger-live.test.mjs +351 -0
- package/test/token-ledger.test.mjs +264 -0
- 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 -203
- 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 -117
- 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/docs/architecture.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 架构(architecture)
|
|
2
2
|
|
|
3
|
-
>
|
|
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)
|
|
14
|
-
│ -
|
|
15
|
-
│ -
|
|
16
|
-
│ -
|
|
17
|
-
│ -
|
|
18
|
-
│
|
|
19
|
-
│ -
|
|
20
|
-
│
|
|
21
|
-
│
|
|
22
|
-
│ -
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
│
|
|
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
|
-
|
|
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
|
-
|
|
29
|
+
## ① lean 层(lib/lean/)
|
|
64
30
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
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
|
-
|
|
39
|
+
## ② toolface 层(lib/toolface/)
|
|
72
40
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
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
|
-
##
|
|
48
|
+
## ③ router 层(lib/router.js · lib/bands.js)
|
|
77
49
|
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
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
|
|
88
|
-
| lib/
|
|
89
|
-
| lib/
|
|
90
|
-
| lib/
|
|
91
|
-
| lib/
|
|
92
|
-
| presets/base
|
|
93
|
-
| scripts/ | build-bundle /
|
|
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 |
|
package/docs/changelog.en.md
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
> English version of [changelog.md](./changelog.md). Versions follow package.json (currently
|
|
3
|
+
> English version of [changelog.md](./changelog.md). Versions follow package.json (currently 2.1.0).
|
|
4
|
+
|
|
5
|
+
## 2.1.0 (2026-11-29)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Standalone token ledger** under `lib/token-ledger/`: `createMemoryUsageAdapter` (dedupe and sort by session/turn/step/seq, range reads and subscriptions), `captureRequestSnapshot` (metadata and hashes only; raw prompts and tool output are rejected) and `createTokenReport` (real Usage kept apart from attribution, explicit assertions produce `pass`/`successRate`/`reasons`).
|
|
10
|
+
- **Live Usage adapter** in `lib/token-ledger/live.js`: subscribes to the host's `session/event` and keeps only `assistant/message` events that carry `usage`; `hydrate` backfills through the half-open `snapshotEvents` range; missing services, logger failures and subscription errors all degrade to skip, and `dispose` is idempotent.
|
|
11
|
+
- **Package exports** `./token-ledger` and `./token-ledger/live`.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Band-specific reasoning opener**: the spec `guideText` now asks reasoning and the first reply to start with "We need …" and name the gap before acting; react asks to start with "I'm doing …" and name the action; weak adds no forced opener. `personaText`, `ROUTER_PROMPT` and the preset shards are untouched.
|
|
16
|
+
|
|
17
|
+
### Notes
|
|
18
|
+
|
|
19
|
+
- The ledger only replays durable Usage and never re-runs a model; the live adapter is not mounted in the preset yet, so nothing is captured at runtime.
|
|
20
|
+
- Host 0.2.2-rc.5 has no costMeter service, so per-request Usage must come from `session/event`, never from cost-meter aggregates.
|
|
21
|
+
|
|
22
|
+
## 2.0.0 (2026-11-29)
|
|
23
|
+
|
|
24
|
+
**Breaking: the skills subsystem is removed.** Three layers remain - lean token saving, router thinking-chain routing and toolface tool masking.
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- **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.
|
|
29
|
+
- **Audit and panel**: `lib/audit-sink.js`, `lib/audit-commands.js` and `ui/go.json` are gone; the `/lean-audit` command is retired.
|
|
30
|
+
- **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.
|
|
31
|
+
- **The `/skill` command** is retired; the router keeps only `/band`.
|
|
32
|
+
- The `npm run drift` script and `scripts/check-drift.mjs` are gone (there are no skill copies left to drift).
|
|
33
|
+
- Docs `docs/matrix.md`, `docs/matrix.en.md`, `docs/技能门控-设计说明.md`, `docs/面板-设计说明.md` and `docs/HANDOFF-2026-11-22.md` are deleted.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- `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.
|
|
38
|
+
- `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.
|
|
39
|
+
- 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.
|
|
40
|
+
|
|
41
|
+
### Tests
|
|
42
|
+
|
|
43
|
+
- 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.
|
|
4
44
|
|
|
5
45
|
## 1.1.0 (2026-11-25)
|
|
6
46
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# 变更记录(changelog)
|
|
2
2
|
|
|
3
|
-
> 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前
|
|
3
|
+
> 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 2.1.0)。
|
|
4
|
+
|
|
5
|
+
## 2.1.0 (2026-11-29)
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- **独立 token 账本库** `lib/token-ledger/`:`createMemoryUsageAdapter`(按 session/turn/step/seq 去重排序、范围读取与订阅)、`captureRequestSnapshot`(只保留元数据与哈希,拒绝原始 prompt 与工具输出)、`createTokenReport`(真实 Usage 与归因分离,显式断言产出 `pass`/`successRate`/`reasons`)。
|
|
10
|
+
- **live Usage adapter** `lib/token-ledger/live.js`:订阅宿主 `session/event`,只收带 `usage` 的 `assistant/message`;`hydrate` 用 `snapshotEvents` 半开区间补录;服务缺失、logger 异常与订阅失败均降级跳过,`dispose` 幂等。
|
|
11
|
+
- **包导出** `./token-ledger` 与 `./token-ledger/live`。
|
|
12
|
+
|
|
13
|
+
### 变更
|
|
14
|
+
|
|
15
|
+
- **思考句式按 band 分流**:spec 带 `guideText` 末尾要求推理与回复第一句以 "We need …" 开头并先陈述缺口;react 带要求以 "I'm doing …" 开头并直接说明动作;weak 不加强制句式。`personaText`、`ROUTER_PROMPT` 与分片未改动。
|
|
16
|
+
|
|
17
|
+
### 说明
|
|
18
|
+
|
|
19
|
+
- 账本当前只做 durable Usage 回放,不重跑模型;live adapter 尚未挂载到预设,运行时不会自动采集。
|
|
20
|
+
- 本机宿主 0.2.2-rc.5 无 costMeter 服务,历史记录不得以 cost-meter 聚合数据充当逐请求 Usage。
|
|
21
|
+
|
|
22
|
+
## 2.0.0 (2026-11-29)
|
|
23
|
+
|
|
24
|
+
**破坏性变更:技能子系统整体移除。** 这一版只剩三层——lean 省 token、router 思考链路由、toolface 工具遮蔽。
|
|
25
|
+
|
|
26
|
+
### 移除
|
|
27
|
+
|
|
28
|
+
- **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 行一并摘掉。
|
|
29
|
+
- **审计与面板**:`lib/audit-sink.js`、`lib/audit-commands.js`、`ui/go.json` 删除;`/lean-audit` 命令下线。
|
|
30
|
+
- **技能面板 UI**:`lib/skills-panel.js`、`lib/client.js` 删除;`/panel` 命令下线;`package.json` 去掉 `exports["./client"]` 与 `dsh.client` 声明(不再产出客户端 bundle)。
|
|
31
|
+
- **`/skill` 命令**下线;router 只保留 `/band`。
|
|
32
|
+
- `npm run drift` 脚本与 `scripts/check-drift.mjs` 删除(不再有技能副本可漂移)。
|
|
33
|
+
- 文档 `docs/matrix.md`、`docs/matrix.en.md`、`docs/技能门控-设计说明.md`、`docs/面板-设计说明.md`、`docs/HANDOFF-2026-11-22.md` 删除。
|
|
34
|
+
|
|
35
|
+
### 变更
|
|
36
|
+
|
|
37
|
+
- `lib/index.js` 收敛为合法空插件(`inject = []`、`apply()` 返回 undefined);宿主层不再需要 `lean-router-client-host` 行。
|
|
38
|
+
- `lib/router.js` 的 `inject` 从 `["agents","systemPrompt","commands","skills"]` 收为前三项;`gate` / `audit` / `auditPath` / `weightsPath` 仍被接受但无行为(兼容旧 patch 配置,不再让插件启动失败)。
|
|
39
|
+
- doctor 从 7 项改为 11 项,并新增两条防回流检查:patch 不得再出现 `skill-lean-router` 与 `lean-router-client-host`。
|
|
40
|
+
|
|
41
|
+
### 测试
|
|
42
|
+
|
|
43
|
+
- 删除 9 个技能相关测试文件;router / plugin-entry / integration-preset 断言同步收敛。当前 `npm test`:157 tests / 156 pass / 1 skip / 0 fail;`npm run verify` PASS。
|
|
4
44
|
|
|
5
45
|
## 1.1.0 (2026-11-25)
|
|
6
46
|
|
package/docs/configuration.en.md
CHANGED
|
@@ -1,88 +1,57 @@
|
|
|
1
1
|
# Configuration reference
|
|
2
2
|
|
|
3
|
-
>
|
|
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
|
-
|
|
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
|
-
|
|
7
|
+
## Plugin-row config (patch row -> module)
|
|
8
8
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
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
|
-
-
|
|
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 |
|
|
23
|
+
| Command | What it does |
|
|
41
24
|
|---|---|
|
|
42
|
-
| npm test | node --test test
|
|
43
|
-
| npm run build |
|
|
44
|
-
| npm run
|
|
45
|
-
| npm run
|
|
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
|
|
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 |
|
|
34
|
+
| Command | Layer | What it does |
|
|
53
35
|
|---|---|---|
|
|
54
|
-
| /band | router | view
|
|
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
|
|
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
|
-
|
|
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 |
|
|
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
|
-
##
|
|
55
|
+
## Exports subpaths (package.json)
|
|
87
56
|
|
|
88
|
-
`.` / `./package.json` / `./router` / `./toolface` / `./lean/delivery-gate` / `./lean/tool-concurrency` — the four
|
|
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).
|
package/docs/configuration.md
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
# 配置参考(configuration)
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **插件行 config**、**命令与环境变量**、**exports 子路径**。所有配置经 patch 行 config 传入 `apply(ctx, options)`,未知键一律报错(失败尽早)。英文版:[configuration.en.md](./configuration.en.md)。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> 2.0.0 起技能子系统的门控权重与审计配置已移除;`gate` / `audit` / `auditPath` / `weightsPath` 仍被接受但无行为,只为兼容旧 patch 配置而不让插件启动失败。
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
25
|
+
| npm test | `node --test "test/*.test.mjs"` |
|
|
43
26
|
| npm run build | 重拼 cordis.patch.yml(base + 4 分片固定顺序) |
|
|
44
|
-
| npm run
|
|
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
|
|
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` 等)。
|
package/docs/install.en.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 "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
43
|
+
dsh --dump-config | Select-String "lean-router-router" # 期望无输出
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
## 要求
|