dsh-reconcile 0.1.7 → 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 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.6):**
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.6 # 钉版本
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 全绿**,客户端冒烟 **10/10 场景**通过。覆盖打分表 16 项、TASK.md 解析/回写 14 项、三种证据判定 16 项、
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 ?? '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reconcile",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "交账 — fact-first clarification, heuristic ambiguity scoring, and an evidence-backed end-of-task reconciliation ledger",
6
6
  "license": "MIT",
@@ -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}`)