dsh-reconcile 0.1.6 → 0.1.8
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.md +4 -3
- package/client.js +5 -1
- package/index.js +7 -1
- package/package.json +1 -1
- package/test/client-smoke.mjs +3 -0
- package/test/selfcheck.mjs +3 -2
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ DeepSeek Harness 插件:**先核事实、再决定问不问、收工对账**
|
|
|
50
50
|
它**只让读数诚实,不足以打断**(乱码 30 分仍在不打断区),也不会误伤 `fix the login bug` 这类正常英文或中文请求。
|
|
51
51
|
每次打分把命中的信号与分值写进会话日志。
|
|
52
52
|
上一轮对账有未达标、这一轮又提同一件事(bigram 相似 ≥ 0.34)时记一次返工,供 `+15 同类请求曾返工` 使用。
|
|
53
|
+
- **收工对账**(会话归属):只有本会话真的调用过 econcile / probe_intent 或产生过对账结果时,收尾行才渲染;行内带任务名(交账 · <slug> · 未达标:N 项),避免把同工作区里别的任务留下的 TASK.md 显示到无关会话。
|
|
53
54
|
- **收工对账**:`TASK.md` 写「目标 / 关键约束 / 3~7 条可判定真假的验收项(command / file / manual)」;
|
|
54
55
|
插件自己跑判定,写 `TASK.evidence.json`;三态只有通过 / 未通过 / 未验证;收尾一行 `未达标:N 项` 由插件渲染。
|
|
55
56
|
|
|
@@ -71,11 +72,11 @@ DeepSeek Harness 插件:**先核事实、再决定问不问、收工对账**
|
|
|
71
72
|
|
|
72
73
|
## 安装
|
|
73
74
|
|
|
74
|
-
**从 npm 装(已发布 0.1.
|
|
75
|
+
**从 npm 装(已发布 0.1.7):**
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
78
|
dsh plugin --profile web add dsh-reconcile
|
|
78
|
-
dsh plugin --profile web add dsh-reconcile@0.1.
|
|
79
|
+
dsh plugin --profile web add dsh-reconcile@0.1.7 # 钉版本
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
npm 包页:<https://www.npmjs.com/package/dsh-reconcile>
|
|
@@ -145,7 +146,7 @@ node test/acceptance-intake.mjs # 乱码信号 + 维度提问的独立验收(
|
|
|
145
146
|
node test/client-smoke.mjs # 客户端冒烟:桩 React 里真渲染三个组件(抓「组件体引用未定义变量」这类运行时崩溃)
|
|
146
147
|
```
|
|
147
148
|
|
|
148
|
-
当前:**90/90 全绿**,客户端冒烟 **
|
|
149
|
+
当前:**90/90 全绿**,客户端冒烟 **11/11 场景**通过。覆盖打分表 16 项、TASK.md 解析/回写 14 项、三种证据判定 16 项、
|
|
149
150
|
evidence 覆盖与防伪造 13 项、骨架与返工 4 项、跨站拒绝 8 项、候选排序 7 项、客户端打分器对拍 2 项、作用域护栏 1 项、任务维度提问 8 项。
|
|
150
151
|
|
|
151
152
|
没有 `node` 的机器上,可以用 DSH 自带的 Electron 当 node:
|
package/client.js
CHANGED
|
@@ -534,6 +534,10 @@ function formatScore(result) {
|
|
|
534
534
|
}
|
|
535
535
|
const verdict = state.verdict
|
|
536
536
|
const task = state.task
|
|
537
|
+
// 归属:只在本会话真的用过交账(工具调用/对账)时才渲染这行。
|
|
538
|
+
// TASK.md 是**工作区**级的,同一工作区里别的任务留下的清单不该出现在这里。
|
|
539
|
+
const touched = Boolean(state.touched)
|
|
540
|
+
if (task && !touched) return null
|
|
537
541
|
if (!task && !(state.score && state.score.band === 'panel')) return null
|
|
538
542
|
|
|
539
543
|
const results = Array.isArray(verdict?.results) ? verdict.results : []
|
|
@@ -549,7 +553,7 @@ function formatScore(result) {
|
|
|
549
553
|
|
|
550
554
|
return h('div', { style: S.wrap, 'data-dsh-plugin': 'dsh-reconcile' },
|
|
551
555
|
h('div', { style: S.row },
|
|
552
|
-
h('span', { style: { ...S.badge } }, t('title')),
|
|
556
|
+
h('span', { style: { ...S.badge } }, task?.slug ? `${t('title')} · ${task.slug}` : t('title')),
|
|
553
557
|
task
|
|
554
558
|
? h('span', { style: zeroMet ? S.headlineOk : S.headline, 'data-reconcile-headline': '1' }, headline)
|
|
555
559
|
: h('span', { style: S.headline }, headline),
|
package/index.js
CHANGED
|
@@ -106,6 +106,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
106
106
|
|
|
107
107
|
const runCheck = async (agent, { skipCommands = false } = {}) => {
|
|
108
108
|
const io = ioFor(agent)
|
|
109
|
+
stateOf(agent?.session?.id).touched = true
|
|
109
110
|
if (skipCommands) io.skipCommands = true
|
|
110
111
|
const result = await reconcile(io)
|
|
111
112
|
const entry = stateOf(agent?.session?.id)
|
|
@@ -205,6 +206,9 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
205
206
|
quality: verdicts?.report?.quality ?? null,
|
|
206
207
|
score: entry.score ?? null,
|
|
207
208
|
probe: entry.probe ?? null,
|
|
209
|
+
// 本会话是否真的用过交账(工具调用/对账)。用于 UI 决定要不要渲染收尾行,
|
|
210
|
+
// 避免「同一个工作区里另一个任务留下的 TASK.md」被塞到无关会话。
|
|
211
|
+
touched: Boolean(entry.touched),
|
|
208
212
|
tampered: Boolean(entry.tampered),
|
|
209
213
|
band: task ? 'task' : (entry.score?.band ?? 'none'),
|
|
210
214
|
}
|
|
@@ -265,6 +269,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
265
269
|
const agent = exec.agent
|
|
266
270
|
if (!agent) throw new Error('reconcile 需要在一个会话里调用')
|
|
267
271
|
const action = String(args?.action ?? 'status')
|
|
272
|
+
stateOf(agent.session?.id).touched = true
|
|
268
273
|
const startedAt = Date.now()
|
|
269
274
|
log('info', 'reconcile start', { action })
|
|
270
275
|
try {
|
|
@@ -356,6 +361,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
356
361
|
const agent = exec.agent
|
|
357
362
|
if (!agent) throw new Error('probe_intent 需要在一个会话里调用')
|
|
358
363
|
const entry = stateOf(agent.session.id)
|
|
364
|
+
entry.touched = true
|
|
359
365
|
const request = typeof args?.request === 'string' && args.request.trim() !== ''
|
|
360
366
|
? args.request
|
|
361
367
|
: (entry.lastUserText ?? '')
|
|
@@ -451,7 +457,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
451
457
|
'1) 用户用了指代词(那个页面 / 上次那份数据 / 老样子 / 同上)时,**先调 probe_intent action=probe** 拿到带证据的候选,再 **action=ask** 带候选问;禁止凭印象猜目标,也不要先问「你指哪个」。',
|
|
452
458
|
'2) 写操作(改/加/删/重构/迁移)且目标或验收标准说不清时,先用 reconcile action=open 把 TASK.md 建起来(目标 + 关键约束 + 3~7 条可判定真假的验收项,每条带证据规格 command/file/manual)。空清单不算开始。',
|
|
453
459
|
'3) **只有当当前工作区存在 TASK.md(这次任务有验收清单)时,收工前才调 reconcile action=check**。判定只有「通过 / 未通过 / 未验证」三种,以插件跑出来的为准;你自己写的「已完成」不算数,也不要去改 TASK.evidence.json(会被覆盖)。',
|
|
454
|
-
'4)
|
|
460
|
+
'4) **不要自己写「未达标:N 项」这一行**。它由插件在答复之外的收尾行渲染(有清单的会话里你能看到),模型再写一遍只是重复。有未通过/未验证项时,直接在正文里说清是哪几项、为什么没过即可;也不要试图用别的话术冒充这个结论。',
|
|
455
461
|
'5) 证据要可追溯:文件写 `路径:行号`,命令写命令本身 + 退出码。不要写「已验证」。',
|
|
456
462
|
].join('\n'),
|
|
457
463
|
interpolate: false,
|
package/package.json
CHANGED
package/test/client-smoke.mjs
CHANGED
|
@@ -127,6 +127,7 @@ const taskState = {
|
|
|
127
127
|
headline: '未达标:1 项',
|
|
128
128
|
needsSkeleton: false,
|
|
129
129
|
band: 'task',
|
|
130
|
+
touched: true,
|
|
130
131
|
score: scoreObject,
|
|
131
132
|
}
|
|
132
133
|
|
|
@@ -147,6 +148,7 @@ const CASES = [
|
|
|
147
148
|
{ name: 'HeroHint/有分数', slot: 'conversation.hero.options', draft: '改一下那个页面', seed: [scoreObject] },
|
|
148
149
|
{ name: 'ReconcileTail/无状态', slot: 'conversation.chat.turnTail', draft: '', seed: [undefined] },
|
|
149
150
|
{ name: 'ReconcileTail/完整状态', slot: 'conversation.chat.turnTail', draft: '', seed: [taskState] },
|
|
151
|
+
{ name: 'ReconcileTail/有清单但本会话没用过(应不渲染)', slot: 'conversation.chat.turnTail', draft: '', seed: [{ ...taskState, touched: false }], expectNull: true },
|
|
150
152
|
{ name: 'ReconcileTail/读取失败', slot: 'conversation.chat.turnTail', draft: '', seed: [undefined, false, false, 'not found'] },
|
|
151
153
|
]
|
|
152
154
|
|
|
@@ -161,6 +163,7 @@ for (const testCase of CASES) {
|
|
|
161
163
|
assert.equal(typeof Component, 'function', `${testCase.name}: 拿不到组件函数`)
|
|
162
164
|
const out = Component(propsFor(testCase.draft))
|
|
163
165
|
assert.ok(out === null || typeof out === 'object', `${testCase.name}: 返回值既不是元素也不是 null(${typeof out})`)
|
|
166
|
+
if (testCase.expectNull) assert.equal(out, null, `${testCase.name}: 本应不渲染,却返回了元素`)
|
|
164
167
|
passed++
|
|
165
168
|
} catch (error) {
|
|
166
169
|
failures.push(`${testCase.name}: ${error?.name ?? 'Error'}: ${error?.message ?? error}`)
|
package/test/selfcheck.mjs
CHANGED
|
@@ -987,9 +987,10 @@ x
|
|
|
987
987
|
/* --------------------- 11. 提示词条件式规则 --------------------- */
|
|
988
988
|
{
|
|
989
989
|
const source = readFileSync(new URL('../index.js', import.meta.url), 'utf8')
|
|
990
|
-
test('
|
|
990
|
+
test('提示词:不要求模型写未达标行(由插件渲染,避免重复)', () => {
|
|
991
991
|
assert.match(source, /只有当当前工作区存在 TASK\.md/, '缺少「有清单才 check」的条件')
|
|
992
|
-
assert.match(source,
|
|
992
|
+
assert.match(source, /不要自己写「未达标/, '模型仍被要求自己写未达标行')
|
|
993
|
+
assert.match(source, /由插件在答复之外的收尾行渲染/, '没有说明这行由插件渲染')
|
|
993
994
|
})
|
|
994
995
|
}
|
|
995
996
|
|