dsh-lean-router 1.0.3 → 1.0.5
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/README.en.md +3 -3
- package/README.md +3 -3
- package/cordis.patch.yml +8 -0
- package/docs/HANDOFF-2026-11-22.md +155 -0
- package/docs/agents/domain.md +38 -0
- package/docs/agents/issue-tracker.md +44 -0
- package/docs/agents/triage-labels.md +13 -0
- package/docs/architecture.en.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/changelog.en.md +25 -1
- package/docs/changelog.md +26 -1
- package/docs/install.en.md +1 -1
- package/docs/install.md +1 -1
- package/docs/quickstart.en.md +5 -5
- package/docs/quickstart.md +5 -5
- package/docs//345/267/245/345/205/267/351/201/256/350/224/275-/346/216/245/347/272/277/350/257/264/346/230/216.md +4 -4
- package/lib/bands.js +18 -6
- package/lib/client.js +213 -0
- package/lib/index.js +38 -4
- package/lib/router.js +75 -15
- package/lib/skills-panel.js +322 -0
- package/package.json +11 -5
- package/presets/base/frag-router.patch.yml +8 -0
- package/test/package.test.mjs +3 -1
- package/test/router.test.mjs +5 -1
- package/test/skills-panel.test.mjs +114 -0
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@ A DeepSeek Harness (DSH) cordis plugin tuned for DeepSeek V4.1 Flash: **one plug
|
|
|
6
6
|
|
|
7
7
|
> This package documents bilingually with the **"Chinese default + English `.en.md` files"** scheme: Chinese is the first language (README.md and docs/*.md), English lives in same-directory `.en.md` files (this file ↔ [README.md](./README.md)). All three upstream projects follow the same "Chinese README + README.en.md" convention.
|
|
8
8
|
|
|
9
|
-
> Status: **v1.0.
|
|
9
|
+
> Status: **v1.0.4 published** (npm: [dsh-lean-router](https://www.npmjs.com/package/dsh-lean-router) · GitHub Release [v1.0.4](https://github.com/ShawnSun-debug/dsh-lean-router/releases/tag/v1.0.4) · CI green; real-machine DSH profile install smoke record: [docs/release-checklist.md](docs/release-checklist.md)).
|
|
10
10
|
|
|
11
11
|
## Layers at a glance
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ A DeepSeek Harness (DSH) cordis plugin tuned for DeepSeek V4.1 Flash: **one plug
|
|
|
21
21
|
|
|
22
22
|
## Target DSH
|
|
23
23
|
|
|
24
|
-
engines: `>=0.2.1-rc.5 <0.2.
|
|
24
|
+
engines: `>=0.2.1-rc.5 <0.2.4-0` (measured baseline 0.2.3-alpha.2, still compatible back to 0.2.1-rc.5). DSH is in developer preview; breaking changes are handled by the engines gate + the doctor self-check + a warn banner, never by silent degradation.
|
|
25
25
|
|
|
26
26
|
## Install
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ Not published yet; start with a local link (both paths in [docs/quickstart.en.md
|
|
|
29
29
|
|
|
30
30
|
~~~powershell
|
|
31
31
|
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
32
|
-
# once published: dsh plugin --profile desktop add npm:dsh-lean-router@1.0.
|
|
32
|
+
# once published: dsh plugin --profile desktop add npm:dsh-lean-router@1.0.4
|
|
33
33
|
~~~
|
|
34
34
|
|
|
35
35
|
The package depends on `@deepseek-ai/dsh-tool-executor-native`; if missing, the masking layer fails loudly — the executor stub throws an error with install guidance on the first `describe` (lib/toolface/executor.js L57-63). Follow it with `npm install` or re-add via `dsh plugin add`.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> 本包双语文档采用 **「中文默认 + 英文 `.en.md` 独立文件」** 方案:中文是第一语言(README.md 与 docs/*.md),英文版同目录 `.en.md`(本文件 ↔ [README.en.md](./README.en.md))。三个上游项目也遵循「中文 README + README.en.md」惯例。
|
|
8
8
|
|
|
9
|
-
> 状态:**v1.0.
|
|
9
|
+
> 状态:**v1.0.4 已发布**(npm:[dsh-lean-router](https://www.npmjs.com/package/dsh-lean-router) · GitHub Release [v1.0.4](https://github.com/ShawnSun-debug/dsh-lean-router/releases/tag/v1.0.4) · CI 绿;真机安装冒烟记录见 [docs/release-checklist.md](docs/release-checklist.md))。
|
|
10
10
|
|
|
11
11
|
## 功能一图
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
## 目标 DSH
|
|
23
23
|
|
|
24
|
-
engines:`>=0.2.1-rc.5 <0.2.
|
|
24
|
+
engines:`>=0.2.1-rc.5 <0.2.4-0`(实测基线 0.2.3-alpha.2,兼容回 0.2.1-rc.5)。DSH 处于 developer preview,破坏性变更将以 engines 闸 + doctor 自检 + warn 黄条应对,不做静默降级。
|
|
25
25
|
|
|
26
26
|
## 安装
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ engines:`>=0.2.1-rc.5 <0.2.3-0`(实测基线 0.2.2-rc.5)。DSH 处于 deve
|
|
|
29
29
|
|
|
30
30
|
~~~powershell
|
|
31
31
|
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
32
|
-
# 发布后:dsh plugin --profile desktop add npm:dsh-lean-router@1.0.
|
|
32
|
+
# 发布后:dsh plugin --profile desktop add npm:dsh-lean-router@1.0.4
|
|
33
33
|
~~~
|
|
34
34
|
|
|
35
35
|
依赖 `@deepseek-ai/dsh-tool-executor-native`;缺失时工具遮蔽层不静默——executor stub 首次 `describe` 抛出含安装指引的错误(lib/toolface/executor.js L57-63),按提示 `npm install` 或用 `dsh plugin add` 重装即可。
|
package/cordis.patch.yml
CHANGED
|
@@ -569,12 +569,20 @@
|
|
|
569
569
|
# 入口子路径 dsh-lean-router/router 需要 package.json exports 增补 "./router": "./lib/router.js"
|
|
570
570
|
# (package.json 为共享文件,由 master 统一集成;见 lib/router.js ROUTER_INJECTION_NOTES.patchEntry)
|
|
571
571
|
- insert:
|
|
572
|
+
# 1.0.5 修:宿主层裸包名行(对照 dsh-cost-meter 的 "one host row")。
|
|
573
|
+
# 没有这一行,客户端模块扫描看不到 dsh.client -> 客户端 bundle 不加载 -> 无顶栏按钮。
|
|
574
|
+
# config.provider=false:不重复注册 skill provider(预设层已注册)。
|
|
575
|
+
- id: lean-router-client-host
|
|
576
|
+
name: dsh-lean-router
|
|
572
577
|
- id: lean-router-router
|
|
573
578
|
name: dsh-lean-router/router
|
|
574
579
|
config:
|
|
575
580
|
hooks: true
|
|
576
581
|
commands: false
|
|
577
582
|
diligenceEvery: 10
|
|
583
|
+
# 1.0.5 修:每轮门控必须开,否则 skillgate 不跑 -> 审计零条目、审计文件从不生成。
|
|
584
|
+
# 依据 lib/router.js:345(cfg.hooks && cfg.gate 才建 runner)与 lib/router.js:194。
|
|
585
|
+
gate: true
|
|
578
586
|
- id: lean-router-commands
|
|
579
587
|
name: dsh-lean-router/router
|
|
580
588
|
config:
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# 交接:dsh-lean-router(技能面板 B 路进行中)
|
|
2
|
+
|
|
3
|
+
日期:2026-11-22 | 仓库:`D:\Agent Workspace\dsh-lean-router`(branch main)
|
|
4
|
+
|
|
5
|
+
## 一句话现状
|
|
6
|
+
|
|
7
|
+
1.0.4 **已发布到 npm 并装进用户 dsh**(`/band` 可视化改造 + 技能面板阶段 1 客户端骨架);**正等用户重启验证顶栏「技能」按钮**。
|
|
8
|
+
|
|
9
|
+
## 立即要做的(下个会话第一件事)
|
|
10
|
+
|
|
11
|
+
**问用户:重启 dsh 后,顶栏右侧有没有出现「技能」按钮,点了会不会弹出「技能面板 · 骨架」。**
|
|
12
|
+
|
|
13
|
+
- 出现 → 阶段 1 成功,直接进阶段 2(接 31 技能真实数据)
|
|
14
|
+
- 没出现 → 查客户端加载日志;重点怀疑 `dsh.client` 扫描是否覆盖到本包
|
|
15
|
+
- 白屏/报错 → **立刻回滚**(见文末「回滚」),再用更小的步子重试
|
|
16
|
+
|
|
17
|
+
## 已完成
|
|
18
|
+
|
|
19
|
+
### A. /band 可视化改造(1.0.4,已发布 npm)
|
|
20
|
+
|
|
21
|
+
按用户三选定的样式改完,实机预览已确认:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
▲ react · 已按首条消息分类,关键词不再改带 · 可选 spec / react / weak
|
|
25
|
+
|
|
26
|
+
| 档位 | 定位 | 工具面 |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| auto | 按首条用户消息自动分类 | — |
|
|
29
|
+
| spec | 先查后改(读优先) | 窄 |
|
|
30
|
+
| **▲ react** | 直接产出(写优先) | 宽 |
|
|
31
|
+
| weak | 交给模型自判 | 窄 |
|
|
32
|
+
|
|
33
|
+
最近一次自动分类:react(build 词 6 · fix 词 0;命中 写一个、游戏、从零)
|
|
34
|
+
用法:/band spec | react | weak | auto · /band react task=发布 MVP · /band help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
改动点:
|
|
38
|
+
- `lib/bands.js`:新增 `explainClassification(text)` → `{band, reactHits, specHits, signals}`;`classifyTask` 变成它的薄封装(分类结果与 1.0.3 逐字符一致)
|
|
39
|
+
- `lib/router.js`:state 增加 `manual`(手动指定 vs 自动分类)与 `last`(最近一次关键词分类结果);`/band` 无参 = `/band help` 输出状态面板;改档确认 = `▲ x · 已切换`
|
|
40
|
+
- `test/router.test.mjs`:断言升级为「第一行是状态 / 有三带表格 / 当前档位粗体 ▲ / 无消息时明确说明」
|
|
41
|
+
- 版本与文档 bump 到 1.0.4(package.json、README 双语、changelog 双语、quickstart 双语)
|
|
42
|
+
- `npm run verify` PASS,`npm test` 203/202 pass/0 fail/1 skip
|
|
43
|
+
|
|
44
|
+
### B. 技能面板:阶段 1 客户端骨架(提交 `0b1fc3e`)
|
|
45
|
+
|
|
46
|
+
- 新增 `lib/client.js`(约 4.3KB):顶栏「技能」按钮 + 用 `ReactDOM.createPortal` 挂到 body 的全屏浮层
|
|
47
|
+
- `package.json`:加 `dsh.client = { platform: "web" }` 与 `exports["./client"] = { default: "./lib/client.js" }`
|
|
48
|
+
- 离线验证全过:`node --check` 通过;用假 `__ModuleLoader__` + fake react 跑通「load 被调用 → factory 返回 apply → 注册到 `conversation.session.header.utilities` → 组件可渲染」
|
|
49
|
+
- **通过 npm 正式安装**:`dsh plugin --profile desktop add npm:dsh-lean-router@1.0.4`(exit 0,1.0.3 → 1.0.4);已安装副本核对:`dsh.client` ✓、`exports['./client']` ✓、`lib/client.js` 4295B ✓、patch 无 `ptc-runtime` ✓
|
|
50
|
+
- ⚠️ 早期手工部署时的备份 `package.json.orig-1.0.3` **已被 npm 安装清掉**,别再指望它
|
|
51
|
+
|
|
52
|
+
## 阻塞项
|
|
53
|
+
|
|
54
|
+
### ~~1. npm 发布 403~~(已解决)
|
|
55
|
+
|
|
56
|
+
旧的 granular token 能 `whoami` 但无发布所需的 2FA bypass 权限 → `npm publish` 403。用户提供了一个新的 granular token 后**发布成功**(exit 0,75 秒后 registry 可下载)。注意:那个 token 已出现在对话记录里,**用户被建议去 npmjs.com 撤销**;下次发布若再 403,须在生成 token 时勾上「Bypass two-factor authentication」。
|
|
57
|
+
|
|
58
|
+
### 2. 阶段 1 真机验证(等用户重启)
|
|
59
|
+
|
|
60
|
+
## 技能面板方案(已与用户拍板)
|
|
61
|
+
|
|
62
|
+
用户明确要求:**不要侧边栏、不要命令输出,要独立面板** → 选 B 路「dsh 内置 tab/浮层面板」,接受 2–3 天成本。
|
|
63
|
+
|
|
64
|
+
阶段划分(每阶段单独验收):
|
|
65
|
+
|
|
66
|
+
| 阶段 | 内容 | 验收 | 状态 |
|
|
67
|
+
|---|---|---|---|
|
|
68
|
+
| 1 | 客户端插件骨架(按钮 + 空面板) | 重启后能看到按钮与面板 | 代码完成,**等用户重启验证** |
|
|
69
|
+
| 2 | 数据通道:31 技能 + 审计统计 | 面板里看到 31 个技能名 | 未开始 |
|
|
70
|
+
| 3 | 面板 UI:分组表 + 开关 + 命中分 + 历史统计 + 6 条工作流 | 可日常使用 | 未开始 |
|
|
71
|
+
|
|
72
|
+
面板必须显示的四类信息(用户点名):31 技能清单+功能说明、每个技能开关(model/user/关闭)、本轮/最近命中分与依据、历史命中统计(哪些从没用过)。
|
|
73
|
+
|
|
74
|
+
### 已确认的 6 套一键工作流
|
|
75
|
+
|
|
76
|
+
| 名字 | 技能序列 |
|
|
77
|
+
|---|---|
|
|
78
|
+
| 审查 review | code-review → grilling |
|
|
79
|
+
| 提质 harden | improve-codebase-architecture → codebase-design → domain-modeling |
|
|
80
|
+
| 修 bug fix | diagnosing-bugs → tdd → code-review |
|
|
81
|
+
| 计划 plan | grilling → to-spec → to-tickets |
|
|
82
|
+
| 开工 build | implement → tdd → code-review → pr |
|
|
83
|
+
| 复盘 retro | retro(会话级) |
|
|
84
|
+
|
|
85
|
+
## 客户端插件技术契约(本次逆向所得,别重新踩)
|
|
86
|
+
|
|
87
|
+
- 入口文件 `lib/client.js`,形式:`window.__ModuleLoader__.load({ id: "包名", factory: (require) => { ... return { apply } } })`
|
|
88
|
+
- `factory(require)` 里的 `require` 取**宿主提供的模块**:`react`、`react-dom`、`react/jsx-runtime`、`@deepseek-ai/dsh-client-ui-primitives` 等;插件自身依赖不打包
|
|
89
|
+
- 插件导出 `{ apply, inject }`(cordis 形);`apply` 可为 generator,`yield` 的 effect 卸载时自动回收
|
|
90
|
+
- UI 注册:`ctx.slots.register({ name, id, order }, Component)`;另有 `ctx.inject(slotName, () => ctx.register({...}, C))` 写法(dsh-cost-meter 用后者)
|
|
91
|
+
- 正文视图 API 另有一条:`ctx.uiConversation.views.register({ target, ... })`(dsh-client-ui-trajectory 用),但它是会话事件流视图,静态面板不建议走
|
|
92
|
+
- 加载条件:`dsh-client-modules` 扫描**宿主 Loader entries** 中声明了 `dsh.client` 的包,且要求 `exports["./client"]` 存在,否则抛「client bundle not found; run `pnpm run build` before launch」
|
|
93
|
+
- 参考实现(npm 安装目录里可反编译看):`dsh-cost-meter`、`dsh-ops`、`dsh-smooth-stream`
|
|
94
|
+
|
|
95
|
+
### 可用的非侧边栏 slot(已枚举 614 个中的关键几个)
|
|
96
|
+
|
|
97
|
+
- `conversation.session.header.utilities` ← 顶栏工具区(当前阶段 1 用它)
|
|
98
|
+
- `conversation.input.overlay` ← 输入框上方浮层(官方 `/` 命令面板同位置)
|
|
99
|
+
- `shell.overlay` ← 全屏遮罩层
|
|
100
|
+
- `conversation.chat.turnTail` ← 每条回答下方
|
|
101
|
+
- `settings.section` ← 设置页分区
|
|
102
|
+
- `conversation.session.header.views.actions` ← 正文 tab 切换区
|
|
103
|
+
|
|
104
|
+
## 数据通路(阶段 2 直接用)
|
|
105
|
+
|
|
106
|
+
- 技能目录:`ctx.skills.list({ scope: agent })`(宿主侧)→ 含 name/description/invocation
|
|
107
|
+
- 技能开关与中文分类:`assets/skills.matrix.json`(`_meta` + `skills[]`,每项有 `model`/`user`/`scenario`/`scenarioZh`/`note`;计数 13 both / 10 modelOnly / 8 userOnly)
|
|
108
|
+
- 最近一轮命中:`getAuditChannel().entries()`(内存环形 256 条,每条形如 `{seq, kind:"skillgate-round", scores, decision, band, complex}`)
|
|
109
|
+
- 历史统计:审计 JSONL 落盘,读法见 `lib/audit-sink.js` 的 `readAuditEntries`,`lib/audit-commands.js` 已用它做 `/lean-audit stats`
|
|
110
|
+
- **审计已开启**:`cordis.patch.yml:585` 是 `audit: true`,所以面板一开始就有真实数据(用户特意要求确认这点)
|
|
111
|
+
|
|
112
|
+
## 关键文件
|
|
113
|
+
|
|
114
|
+
- `lib/router.js`:`/band` `/skill` `/lean-audit` 注册与实现;`capture`(状态机)、`guideTextFor`(近场文本)
|
|
115
|
+
- `lib/bands.js`:三带配置表、关键词词表、`classifyTask`/`explainClassification`、`parseRouterDirective`
|
|
116
|
+
- `lib/skillgate.js`:打分/分档/裁决/软降/审计通道(`createAuditChannel`、`getAuditChannel`、`round`)
|
|
117
|
+
- `lib/gate-runner.js`:每轮门控接线(`gate: true` 才创建)
|
|
118
|
+
- `lib/client.js`:**新增**,客户端插件
|
|
119
|
+
- `cordis.patch.yml`:装配产物(`presets/base/*.yml` + `scripts/integrate-preset.mjs` 生成,勿手改)
|
|
120
|
+
- `assets/skills.matrix.json`:31 技能开关与场景
|
|
121
|
+
- `assets/skills/`:31 个技能目录(frontmatter 里有英文 description)
|
|
122
|
+
|
|
123
|
+
## 陷阱与教训(都是这轮真实踩过的)
|
|
124
|
+
|
|
125
|
+
1. **preset 的 plugins 里绝不能挂宿主层服务插件**(如 `ptc-runtime`)——preset 在独立 scope 激活,重复挂载会让整条 preset 注册失败、从预设列表消失(1.0.3 事故)
|
|
126
|
+
2. **cordis 插件的 apply 不能返回普通对象**——返回值必须是 dispose 函数 / null / undefined / thenable,否则真宿主报 `Invalid effect`(1.0.2 事故)
|
|
127
|
+
3. **`dsh plugin add` 会做 overlay 校验**,YAML 缩进错会让整个安装回滚
|
|
128
|
+
4. **别信 CI 全绿**:模块测试与真机装配是两件事,上述两次事故 CI 都绿
|
|
129
|
+
5. **`ui/go.json` 不是 dsh 原生机制**——它是给第三方 dsh-Go 用的,而用户环境**没装 dsh-Go**(`@stardustlc` 是空目录),别指望它渲染面板
|
|
130
|
+
6. **`propose_action`(个性化页面)在本会话工具面里不存在**——虽然 `dsh-personalized-recommendations` 已装且工具真实存在,但没暴露出来,所以官方「页面卡片」通道走不通
|
|
131
|
+
7. **npm 发布**:默认 registry 是 npmmirror(只读),必须 `--registry=https://registry.npmjs.org`
|
|
132
|
+
8. 在 PowerShell 里重定向 YAML 用 `Out-File -Encoding utf8`(`*>` 会写 UTF-16,js-yaml 报 null byte)
|
|
133
|
+
|
|
134
|
+
## 回滚(客户端插件出问题时)
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
# 装回上一个可用版本(现在是唯一可靠的回滚路径)
|
|
138
|
+
& "D:\Deepseek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add npm:dsh-lean-router@1.0.3
|
|
139
|
+
```
|
|
140
|
+
仓库侧:`git revert 0b1fc3e`(客户端骨架)或 `git revert 2aad876`(/band 改造)。改完重启 dsh。
|
|
141
|
+
|
|
142
|
+
## 用户偏好(务必遵守)
|
|
143
|
+
|
|
144
|
+
- **先说结果,再解释**;中文;称呼「主人」
|
|
145
|
+
- **不确定就问**,每次提问用 `ask_user_question`(可批量、timeoutMs 给足)——用户明确说「试错的成本远远比问问题大」
|
|
146
|
+
- 讨厌「要展开才看得清」的 UI,喜欢一眼看清、可视化优先
|
|
147
|
+
- 系统侧操作(启动项、安装等)由助手代劳,不让用户手抄命令;但**涉及密码/2FA 必须用户本人**
|
|
148
|
+
- 长任务要分阶段通报,不要攒到最后
|
|
149
|
+
|
|
150
|
+
## 建议下个会话加载的技能
|
|
151
|
+
|
|
152
|
+
- `/handoff` — 再次交接时用
|
|
153
|
+
- `/ds-plan-loop` — 阶段 2/3 是多文件改造,先出带验收的编号计划
|
|
154
|
+
- `/ds-verify-loop` — 每次改客户端插件后跑最窄的真检查(离线 harness + 重启验证)
|
|
155
|
+
- `/ds-blast-radius` — 改 `lib/router.js` / `package.json` 前评估影响面
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# 领域文档
|
|
2
|
+
|
|
3
|
+
工程技能探索本仓库领域文档的方式。**布局:单上下文(single-context)。**
|
|
4
|
+
|
|
5
|
+
## 探索前先读
|
|
6
|
+
|
|
7
|
+
- 根目录 **`GLOSSARY.md`**(若存在)
|
|
8
|
+
- **`docs/adr/`** 下与你要动的区域相关的 ADR
|
|
9
|
+
- `docs/` 下已有的设计说明(架构、配置、路由、工具遮蔽、技能门控等),与当前课题相关时读
|
|
10
|
+
|
|
11
|
+
以上任一不存在就**静默继续**:不要提它们的缺失,也不要主动建议先建。`/domain-modeling`(经 `/grilling --docs` 与 `/improve-codebase-architecture` 到达)在术语或决策真正定案时才惰性创建。
|
|
12
|
+
|
|
13
|
+
## 文件结构
|
|
14
|
+
|
|
15
|
+
单上下文(本仓库):
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/
|
|
19
|
+
├── GLOSSARY.md
|
|
20
|
+
├── docs/adr/
|
|
21
|
+
│ ├── 0001-<决定>.md
|
|
22
|
+
│ └── 0002-<决定>.md
|
|
23
|
+
└── lib/ ← 实现
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
只有本仓库变成多包仓库(`pnpm-workspace.yaml` / `workspaces` / `packages/*`)时才改多上下文:根 `GLOSSARY-MAP.md` 指向各上下文的 `GLOSSARY.md`,`docs/adr/` 存系统级决策,`src/<context>/docs/adr/` 存局部决策。
|
|
27
|
+
|
|
28
|
+
## 用词表里的词汇
|
|
29
|
+
|
|
30
|
+
输出产物(issue 标题、重构提案、假设、测试名)里出现领域概念时,用 `GLOSSARY.md` 定义的那个词,不要漂移到它明确避开的同义词。
|
|
31
|
+
|
|
32
|
+
需要的概念词表里没有,这本身是信号:要么你在发明项目不用的语言(重新考虑),要么真有缺口(留给 `/domain-modeling`)。
|
|
33
|
+
|
|
34
|
+
## 撞 ADR 要显式指出
|
|
35
|
+
|
|
36
|
+
输出与既有 ADR 冲突时,明说,不要静默覆盖:
|
|
37
|
+
|
|
38
|
+
> _与 ADR-0007(<决定>)冲突,但值得重开,因为……_
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Issue tracker: GitHub
|
|
2
|
+
|
|
3
|
+
本仓库的 issue 与 spec 都放在 GitHub Issues。所有操作走 `gh` CLI。
|
|
4
|
+
|
|
5
|
+
## 约定
|
|
6
|
+
|
|
7
|
+
- **新建**:`gh issue create --title "..." --body "..."`(多行正文用 heredoc)
|
|
8
|
+
- **读取**:`gh issue view <n> --json number,title,body,labels,comments`
|
|
9
|
+
- **列出**:`gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'`
|
|
10
|
+
- **评论**:`gh issue comment <n> --body "..."`
|
|
11
|
+
- **加/删标签**:`gh issue edit <n> --add-label "..."` / `--remove-label "..."`
|
|
12
|
+
- **关闭**:先 `gh issue comment <n> --body "..."` 写说明,再 `gh issue close <n>`
|
|
13
|
+
|
|
14
|
+
### 子 issue 与阻塞
|
|
15
|
+
|
|
16
|
+
- **子 issue**:`gh issue create --parent <parent> ...`,或 `gh issue edit <parent> --add-sub-issue <child>`(gh 2.94+)。旧版:`gh api --method POST repos/<owner>/<repo>/issues/<parent>/sub_issues -F sub_issue_id=<child-db-id>`。用不了子 issue 时,子 issue 正文开头写 `Part of #<parent>`。
|
|
17
|
+
- **阻塞**:用 GitHub 原生 issue dependency(UI 可见)。`gh issue create --blocked-by <n>,<n> ...` 或 `gh issue edit <child> --add-blocked-by <blocker>`(gh 2.94+)。旧版:`gh api --method POST repos/<owner>/<repo>/issues/<child>/dependencies/blocked_by -F issue_id=<blocker-db-id>`,db-id 取 `gh api repos/<owner>/<repo>/issues/<n> --jq .id`。功能不可用时退化为正文开头写 `Blocked by: #<n>, #<n>`;所有阻塞者关闭才算解锁。
|
|
18
|
+
- **数未关闭阻塞者**:`gh api repos/<owner>/<repo>/issues/<n> --jq .issue_dependencies_summary.blocked_by`(0 即可开工)。用 `gh issue view <n> --json blockedBy` 时要过滤 `select(.state == "OPEN")`,否则会把已关闭的算进去。
|
|
19
|
+
|
|
20
|
+
## 安全边界
|
|
21
|
+
|
|
22
|
+
- 仓库由 `git remote -v` 推断;在克隆目录内运行 `gh` 会自动取。
|
|
23
|
+
- issue 只写进用户自己的仓库,不要写进 `mattpocock/skills`。
|
|
24
|
+
- fork 里 `gh` 可能默认指向 upstream,首次 `gh issue create` 前先 `gh repo view --json nameWithOwner` 核对。
|
|
25
|
+
|
|
26
|
+
## PR 作为分诊入口
|
|
27
|
+
|
|
28
|
+
**PR 作为请求入口:否。**(`/triage` 读这个开关;把外部 PR 当功能请求处理时改成 `yes`。)
|
|
29
|
+
|
|
30
|
+
设为 `yes` 时 PR 走同一套标签与状态机:`gh pr view <n> --comments`、`gh pr diff <n>`、`gh pr comment`、`gh pr edit --add-label`、`gh pr close`。GitHub 的 issue 与 PR 共用编号空间,裸 `#42` 先用 `gh pr view 42`、回落 `gh issue view 42`。
|
|
31
|
+
|
|
32
|
+
## 技能措辞对照
|
|
33
|
+
|
|
34
|
+
- "publish to the issue tracker" → 建一个 GitHub issue。
|
|
35
|
+
- "fetch the relevant ticket" → 按上面 **读取** 取。
|
|
36
|
+
|
|
37
|
+
## 寻路(wayfinder)操作
|
|
38
|
+
|
|
39
|
+
**地图**:单个 issue,带 `wayfinder:map` 标签,正文存 Notes / Decisions-so-far / Fog。
|
|
40
|
+
**子票**:作为地图的子 issue 挂上,带 `wayfinder:<type>` 标签(`research` / `prototype` / `grilling` / `task`);认领时 assign 给开工人。
|
|
41
|
+
|
|
42
|
+
- **前沿查询**:列出地图下未关闭的子票,丢掉有未关闭阻塞者或已有 assignee 的,按地图顺序取第一个。
|
|
43
|
+
- **认领**:`gh issue edit <n> --add-assignee @me`(会话的第一次写操作)。
|
|
44
|
+
- **解决**:`gh issue comment <n> --body "<答案>"` → `gh issue close <n>` → 把上下文指针(gist + 链接)追加到地图的 Decisions-so-far。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 分诊标签
|
|
2
|
+
|
|
3
|
+
技能用五个规范角色说话;本文件把角色映射到本仓库实际使用的标签串。
|
|
4
|
+
|
|
5
|
+
| 规范角色 | 本仓库标签 | 含义 |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `needs-triage` | `needs-triage` | 维护者需要评估 |
|
|
8
|
+
| `needs-info` | `needs-info` | 等报告者补充信息 |
|
|
9
|
+
| `ready-for-agent` | `ready-for-agent` | 规格已完整,可交给 AFK 代理 |
|
|
10
|
+
| `ready-for-human` | `ready-for-human` | 需要人来实现 |
|
|
11
|
+
| `wontfix` | `wontfix` | 不处理 |
|
|
12
|
+
|
|
13
|
+
技能提到某个角色(如 "apply the AFK-ready triage label")时,用上表对应的标签串。要改词表就改「本仓库标签」列。`wontfix` 此前已存在,其余四个由本次 setup 创建。
|
package/docs/architecture.en.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
~~~text
|
|
8
8
|
┌──────────────────────────────────────────────────────────────────────┐
|
|
9
|
-
│ DSH host (engines >=0.2.1-rc.5 <0.2.
|
|
9
|
+
│ DSH host (engines >=0.2.1-rc.5 <0.2.4-0) │
|
|
10
10
|
├──────────────────────────────────────────────────────────────────────┤
|
|
11
11
|
│ preset preset-lean-router (frag-preset.patch.yml snapshot = sole owner)│
|
|
12
12
|
│ │
|
package/docs/architecture.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
~~~text
|
|
8
8
|
┌─────────────────────────────────────────────────────────────────────┐
|
|
9
|
-
│ DSH 宿主(engines >=0.2.1-rc.5 <0.2.
|
|
9
|
+
│ DSH 宿主(engines >=0.2.1-rc.5 <0.2.4-0) │
|
|
10
10
|
├─────────────────────────────────────────────────────────────────────┤
|
|
11
11
|
│ 预设 preset-lean-router(frag-preset.patch.yml 并集快照 = 唯一生效行) │
|
|
12
12
|
│ │
|
package/docs/changelog.en.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
> English version of [changelog.md](./changelog.md). Versions follow package.json (currently 1.0.
|
|
3
|
+
> English version of [changelog.md](./changelog.md). Versions follow package.json (currently 1.0.5).
|
|
4
|
+
|
|
5
|
+
## 1.0.5 (2026-11-23)
|
|
6
|
+
|
|
7
|
+
### Adapt to the DSH 0.2.3 kernel (measured baseline 0.2.3-alpha.2)
|
|
8
|
+
|
|
9
|
+
- Fixed (critical): the `engines.dsh` upper bound goes from `<0.2.3-0` to `<0.2.4-0`. DSH's compatibility check (`evaluatePluginCompatibility` in `@deepseek-ai/dsh-app-boot`) calls `semver.satisfies(runtime, range, { includePrerelease: true })`; by semver prerelease precedence `0.2.3-0 < 0.2.3-alpha.2`, so the old range judged 0.2.3-alpha.2 incompatible and blocked both installation and activation. The widened range covers the whole 0.2.1-rc.5 through 0.2.3 line.
|
|
10
|
+
- Change: the `@deepseek-ai/dsh-tool-executor-native` dependency goes from `^0.2.2-alpha.3` to `>=0.2.2-alpha.3 <0.2.4-0`. Measured: 0.2.3-alpha.2 and 0.2.2-rc.5 are byte-identical in implementation (SHA256 over every file; only `package.json` differs), so the vendored executor needs no change.
|
|
11
|
+
- Change: the `@deepseek-ai/cordis` peer goes from `~4.1.0` to `>=4.1.0-0 <4.3.0-0`. The 0.2.3-alpha.2 host ships cordis 4.2.0-alpha.1, which the old range excluded (prerelease). cordis 4.2 only renames internal symbols (`symbols.config` to `symbols.metadata`) and reworks `ValidationError` issue paths; the **effect contract is unchanged**, and this package never imports cordis at runtime - it only uses its plugin shape - so no code change was needed.
|
|
12
|
+
- Re-checked, nothing broken: the client loading contract (`dsh-client-modules` scanning `dsh.client` plus `exports["./client"]`) is identical to 0.2.2, and all 26 `@deepseek-ai/dsh-*` plugins referenced by the patches still exist in 0.2.3.
|
|
13
|
+
|
|
14
|
+
### Skills panel, stage 1 (1.0.5 content that had only lived in commits, never published)
|
|
15
|
+
|
|
16
|
+
- New: the `/panel` command as the usable form of the skills panel (server-rendered, so it does not depend on a client slot); the client overlay now groups by scenario, adds sub-views, hides skills that are off everywhere and fixes column alignment.
|
|
17
|
+
- Fixed (on a real install): the package now loads at host scope so `dsh-client-modules` actually scans its client bundle; `react-dom` was dropped in favour of `ctx.inject`/`ctx.register`; a pure-DOM fallback tells "bundle never loaded" apart from "slot never mounted".
|
|
18
|
+
- Fixed: skill injection is now optional, so the host's patch row really applies; the per-turn skill gate is enabled.
|
|
19
|
+
|
|
20
|
+
## 1.0.4 (2026-11-22)
|
|
21
|
+
|
|
22
|
+
- New (skills panel, stage 1): client plugin skeleton - a "Skills" button in the session header plus a placeholder overlay panel (`lib/client.js`, `dsh.client.platform=web`, `exports['./client']`). The loading contract follows dsh's `window.__ModuleLoader__.load({ id, factory })`, UI registration goes through `ctx.slots.register`, and the panel is portalled onto `body` so it never depends on a sidebar. Stage 1 only proves the wiring; real data and one-click workflows arrive in later versions.
|
|
23
|
+
- Improved (visibility): `/band` output goes from three lines of plain English to a scannable layout - a one-line status first (e.g. `▲ react · 已按首条消息分类,关键词不再改带 · 可选 spec / react / weak`), a band comparison table in the middle (the current band marked `**▲ spec**` in bold), and "the last automatic classification" with its evidence (build/fix hit counts plus the matched words) at the end.
|
|
24
|
+
- New: `lib/bands.js` exports `explainClassification(text)`, returning the band, both hit counts and up to three matched words; `classifyTask` is now a thin wrapper over it, so results are identical to 1.0.3.
|
|
25
|
+
- New: the routing state gains `manual` and `last` fields, telling "explicitly set / auto-classified from the first message / not classified yet" apart. The near-field guide text is unchanged (the zero-write contract still holds).
|
|
26
|
+
- Change: `/band` with no arguments now equals `/band help` and prints the status panel; the set confirmation changes from `Router band set to x.` to `▲ x · 已切换`.
|
|
27
|
+
- Tests: the `/band` assertions now check "first line is the status / the band table exists / the current band is bold ▲ / a clear note when no message has arrived"; 203 tests green.
|
|
4
28
|
|
|
5
29
|
## 1.0.3 (2026-11-22)
|
|
6
30
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
# 变更记录(changelog)
|
|
2
2
|
|
|
3
|
-
> 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 1.0.
|
|
3
|
+
> 中文为主,英文版:[changelog.en.md](./changelog.en.md)。版本号遵循 package.json(当前 1.0.5)。
|
|
4
|
+
|
|
5
|
+
## 1.0.5 (2026-11-23)
|
|
6
|
+
|
|
7
|
+
### 适配 DSH 0.2.3 内核(实测基线 0.2.3-alpha.2)
|
|
8
|
+
|
|
9
|
+
- 修复(致命):`engines.dsh` 上限 `<0.2.3-0` → `<0.2.4-0`。DSH 的兼容性校验(`@deepseek-ai/dsh-app-boot` 的 `evaluatePluginCompatibility`)用 `semver.satisfies(runtime, range, { includePrerelease: true })`;按 semver 预发布优先级 `0.2.3-0 < 0.2.3-alpha.2`,旧范围把 0.2.3-alpha.2 判为不兼容,安装与激活都会被拦。放宽后 0.2.1-rc.5 至 0.2.3 全系列都满足。
|
|
10
|
+
- 变更:`dependencies` 的 `@deepseek-ai/dsh-tool-executor-native` 从 `^0.2.2-alpha.3` 放宽为 `>=0.2.2-alpha.3 <0.2.4-0`。实测 0.2.3-alpha.2 与 0.2.2-rc.5 的实现逐字节相同(全文件 SHA256 对比,仅 `package.json` 变),vendored executor 无需改动。
|
|
11
|
+
- 变更:`peerDependencies` 的 `@deepseek-ai/cordis` 从 `~4.1.0` 放宽为 `>=4.1.0-0 <4.3.0-0`。宿主 0.2.3-alpha.2 装的是 cordis 4.2.0-alpha.1,旧区间不含 4.2 的预发布。cordis 4.2 只改内部符号(`symbols.config` → `symbols.metadata`)与 `ValidationError` 的 issue 路径处理,**effect 契约未变**;本包运行时不 import cordis,仅用其插件形状,故无需改代码。
|
|
12
|
+
- 复核无破坏:客户端加载契约(`dsh-client-modules` 扫描 `dsh.client` + `exports["./client"]`)与 0.2.2 一致;补丁里引用的 26 个 `@deepseek-ai/dsh-*` 插件在 0.2.3 全部仍存在。
|
|
13
|
+
|
|
14
|
+
### 技能面板阶段 1(1.0.5 内容,此前只在提交里、未发布)
|
|
15
|
+
|
|
16
|
+
- 新增:`/panel` 命令作为技能面板的可用形态(服务端渲染,不依赖客户端 slot),并在客户端浮层上按场景分组、加子视图、隐藏全关技能、修列对齐。
|
|
17
|
+
- 修复(真机):包改在宿主作用域加载,客户端 bundle 才会被 `dsh-client-modules` 扫到;去掉 `react-dom` 依赖,改走 `ctx.inject`/`ctx.register`;补纯 DOM 兜底,用于区分「bundle 没加载」与「slot 没挂上」两种失败。
|
|
18
|
+
- 修复:技能注入改为可选,宿主那一行 patch 才真正 apply 成功;逐轮技能门控已启用。
|
|
19
|
+
|
|
20
|
+
## 1.0.4 (2026-11-22)
|
|
21
|
+
|
|
22
|
+
- 新增(技能面板阶段 1):客户端插件骨架 —— 顶栏「技能」按钮 + 占位浮层面板(`lib/client.js`、`dsh.client.platform=web`、`exports['./client']`)。加载契约对齐 dsh 的 `window.__ModuleLoader__.load({ id, factory })`,UI 注册走 `ctx.slots.register`;面板用 `ReactDOM.createPortal` 挂 body,不依赖侧边栏。本阶段只验链路,真实数据与一键工作流在后续版本接入。
|
|
23
|
+
- 改进(可视化):`/band` 从「三段英文纯文本」改成一眼看清的排版 —— 第一行一行状态(如 `▲ react · 已按首条消息分类,关键词不再改带 · 可选 spec / react / weak`),中间是三带差异表格(当前档位用 `**▲ spec**` 粗体标记),末尾是「最近一次自动分类」及其依据(build/fix 词命中数 + 命中的词)。
|
|
24
|
+
- 新增:`lib/bands.js` 导出 `explainClassification(text)`,返回带号 + 两路命中数 + 词样例(最多 3 个);`classifyTask` 改为它的薄封装,分类结果与 1.0.3 完全一致。
|
|
25
|
+
- 新增:路由状态增加 `manual` 与 `last` 字段,用于区分「手动指定 / 按首条消息自动分类 / 还没分类」三种来源。近场引导文本不变(零写入契约不变)。
|
|
26
|
+
- 变更:`/band`(无参)与 `/band help` 等价,都输出状态面板;改档确认从 `Router band set to x.` 改为 `▲ x · 已切换`。
|
|
27
|
+
- 测试:`/band` 断言升级为
|
|
28
|
+
「第一行是状态 / 有三带表格 / 当前档位粗体 ▲ / 无消息时明确说明」,203 测试全绿。
|
|
4
29
|
|
|
5
30
|
## 1.0.3 (2026-11-22)
|
|
6
31
|
|
package/docs/install.en.md
CHANGED
|
@@ -48,7 +48,7 @@ dsh --dump-config | Select-String "skill-lean-router" # expect no output
|
|
|
48
48
|
| Item | Value |
|
|
49
49
|
|---|---|
|
|
50
50
|
| Node.js | 24 (CI baseline; 22.12+ locally for `require` of ESM packages) |
|
|
51
|
-
| DSH | `>=0.2.1-rc.5 <0.2.
|
|
51
|
+
| DSH | `>=0.2.1-rc.5 <0.2.4-0` (`package.json#engines.dsh`) |
|
|
52
52
|
| Platform | Windows / macOS / Linux (CI verifies ubuntu-latest) |
|
|
53
53
|
|
|
54
54
|
## Troubleshooting
|
package/docs/install.md
CHANGED
|
@@ -48,7 +48,7 @@ dsh --dump-config | Select-String "skill-lean-router" # 期望无输出
|
|
|
48
48
|
| 项 | 值 |
|
|
49
49
|
|---|---|
|
|
50
50
|
| Node.js | 24(CI 口径;本地 22.12+ 起支持 `require` ESM 包) |
|
|
51
|
-
| DSH | `>=0.2.1-rc.5 <0.2.
|
|
51
|
+
| DSH | `>=0.2.1-rc.5 <0.2.4-0`(`package.json#engines.dsh`) |
|
|
52
52
|
| 平台 | Windows / macOS / Linux(CI 在 ubuntu-latest 验证) |
|
|
53
53
|
|
|
54
54
|
## 排错
|
package/docs/quickstart.en.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- DSH `>=0.2.1-rc.5 <0.2.
|
|
8
|
-
- The package is
|
|
7
|
+
- DSH `>=0.2.1-rc.5 <0.2.4-0` (measured baseline 0.2.3-alpha.2; see the engines field in package.json).
|
|
8
|
+
- The package is published on npm (`dsh-lean-router`), so Path B is recommended; use Path A when you edit the code. DSH is in developer preview; engine drift is handled by the engines gate + doctor self-check + a warn banner, never by silent degradation.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
-
### Path A: local link (
|
|
12
|
+
### Path A: local link (for development)
|
|
13
13
|
|
|
14
14
|
~~~powershell
|
|
15
15
|
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
@@ -17,10 +17,10 @@ dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
|
17
17
|
|
|
18
18
|
After restarting DSH, pick the **Lean router** preset (lean tier) or **Lean router (balance)** (weaker-constraint tier) for new sessions.
|
|
19
19
|
|
|
20
|
-
### Path B: npm install (
|
|
20
|
+
### Path B: npm install (recommended)
|
|
21
21
|
|
|
22
22
|
~~~powershell
|
|
23
|
-
dsh plugin --profile desktop add npm:dsh-lean-router@1.0.
|
|
23
|
+
dsh plugin --profile desktop add npm:dsh-lean-router@1.0.5
|
|
24
24
|
~~~
|
|
25
25
|
|
|
26
26
|
(Both paths match the output of scripts/install.mjs; the real installer, claim boundaries and `--uninstall` rollback belong to ticket 09.)
|
package/docs/quickstart.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## 前置条件
|
|
6
6
|
|
|
7
|
-
- DSH `>=0.2.1-rc.5 <0.2.
|
|
8
|
-
-
|
|
7
|
+
- DSH `>=0.2.1-rc.5 <0.2.4-0`(实测基线 0.2.3-alpha.2;见 package.json engines 字段)。
|
|
8
|
+
- 本包已发布到 npm(`dsh-lean-router`),推荐路径 B;改代码调试走路径 A。DSH 处于 developer preview,版本越界将以 engines 闸 + doctor 自检 + warn 黄条应对,不做静默降级。
|
|
9
9
|
|
|
10
10
|
## 安装
|
|
11
11
|
|
|
12
|
-
### 路径 A:本地 link
|
|
12
|
+
### 路径 A:本地 link(开发调试)
|
|
13
13
|
|
|
14
14
|
~~~powershell
|
|
15
15
|
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
@@ -17,10 +17,10 @@ dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
|
17
17
|
|
|
18
18
|
重启 DSH 后,新会话在预设列表选择 **Lean router**(lean 档)或 **Lean router (balance)**(弱约束精简档)。
|
|
19
19
|
|
|
20
|
-
### 路径 B:npm
|
|
20
|
+
### 路径 B:npm 安装(推荐)
|
|
21
21
|
|
|
22
22
|
~~~powershell
|
|
23
|
-
dsh plugin --profile desktop add npm:dsh-lean-router@1.0.
|
|
23
|
+
dsh plugin --profile desktop add npm:dsh-lean-router@1.0.5
|
|
24
24
|
~~~
|
|
25
25
|
|
|
26
26
|
(两条路径与 scripts/install.mjs 输出的说明一致;真安装器、认领边界与 `--uninstall` 回滚归票 09。)
|
|
@@ -69,10 +69,10 @@ scripts/build-bundle.mjs 生成,master 已合入并通过 build --check 反向
|
|
|
69
69
|
|
|
70
70
|
## 6. package.json 需 master 新增(本票禁改共享文件,由 master 统一加)
|
|
71
71
|
|
|
72
|
-
- dependencies: "@deepseek-ai/dsh-tool-executor-native": "
|
|
73
|
-
|
|
74
|
-
- peerDependencies(建议): "@deepseek-ai/cordis": "
|
|
75
|
-
|
|
72
|
+
- dependencies: "@deepseek-ai/dsh-tool-executor-native": ">=0.2.2-alpha.3 <0.2.4-0"
|
|
73
|
+
(1.0.5 起放宽到 0.2.3 线;0.2.3-alpha.2 与 0.2.2-rc.5 的实现逐字节相同,仅 package.json 变)
|
|
74
|
+
- peerDependencies(建议): "@deepseek-ai/cordis": ">=4.1.0-0 <4.3.0-0"
|
|
75
|
+
(宿主 0.2.3-alpha.2 装 cordis 4.2.0-alpha.1;旧 ~4.1.0 不含 4.2 预发布)
|
|
76
76
|
- exports 增加: "./toolface": "./lib/toolface/index.js"
|
|
77
77
|
(frag 行 name 'dsh-lean-router/toolface' 依赖 exports 子路径,
|
|
78
78
|
同形先例:@deepseek-ai/dsh-plugin-manager 的 './tools')
|
package/lib/bands.js
CHANGED
|
@@ -78,6 +78,23 @@ function countHits(regex, text) {
|
|
|
78
78
|
return [...text.matchAll(regex)].length;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* 分类的可解释版本(供 /band 展示"最近一次分类结果与依据"):
|
|
83
|
+
* 返回带号 + 两路命中数 + 命中的词样例(去重,最多 3 个)。
|
|
84
|
+
* @param {string} text 用户消息全文
|
|
85
|
+
* @returns {{band: "spec"|"react"|"weak", reactHits: number, specHits: number, signals: string[]}}
|
|
86
|
+
*/
|
|
87
|
+
export function explainClassification(text) {
|
|
88
|
+
if (typeof text !== "string" || text.length === 0) return { band: "weak", reactHits: 0, specHits: 0, signals: [] };
|
|
89
|
+
const reactWords = [...text.matchAll(REACT_HINT_RE)].map((m) => m[0]);
|
|
90
|
+
const specWords = [...text.matchAll(SPEC_HINT_RE)].map((m) => m[0]);
|
|
91
|
+
const reactHits = reactWords.length;
|
|
92
|
+
const specHits = specWords.length;
|
|
93
|
+
const band = reactHits > specHits ? "react" : specHits > reactHits ? "spec" : "weak";
|
|
94
|
+
const signals = [...new Set([...reactWords, ...specWords])].slice(0, 3);
|
|
95
|
+
return { band, reactHits, specHits, signals };
|
|
96
|
+
}
|
|
97
|
+
|
|
81
98
|
/**
|
|
82
99
|
* 按首条真实用户消息分类任务带(思想移植、实现重写):
|
|
83
100
|
* build 类证据占优 -> react;fix 类证据占优 -> spec;平票或无匹配 -> weak
|
|
@@ -86,12 +103,7 @@ function countHits(regex, text) {
|
|
|
86
103
|
* @returns {"spec"|"react"|"weak"}
|
|
87
104
|
*/
|
|
88
105
|
export function classifyTask(text) {
|
|
89
|
-
|
|
90
|
-
const react = countHits(REACT_HINT_RE, text);
|
|
91
|
-
const spec = countHits(SPEC_HINT_RE, text);
|
|
92
|
-
if (react > spec) return "react";
|
|
93
|
-
if (spec > react) return "spec";
|
|
94
|
-
return "weak";
|
|
106
|
+
return explainClassification(text).band;
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
/** 架构型词(深度任务启发):命中或长文本视为复杂任务(深度引导变体)。 */
|