dsh-wdx-relief 0.5.1 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 — 2026-11-17
4
+
5
+ - 新增 **工具调用泄漏守卫**(默认开启):模型把工具调用直接写成正文(strata serve 常见的 `<tool_call>` / `<function=NAME>` / `<parameter=NAME>`,以及 `<invoke>` / `antml:` 信封)、这一步没有任何工具卡、turn 却像「已完成」一样结束时,当场检测并在同一轮内注入纠正让模型用小块重发。
6
+ - 移植自 `@irwdone/dsh-tool-call-leak-fix`(MIT),并按本插件的 volatile Config 改造:配置改动即时生效;新增 `toolRepair` / `toolRepairLang` / `toolRepairMaxCorrections`(默认 2)/ `toolRepairDebugLog` 四个字段,设置页同步新增「工具调用守卫」分组(开关、语言、每轮上限、诊断日志)。
7
+ - 五个机制:分发前拒绝结构损坏或参数被清空的大调用;写入类工具自报空转时补提示;静默失败同轮自愈(第一次讲原因、第二次更硬更短,到上限即停);fork 会话首步简报;损坏步骤在模型可见 surface 上遮蔽(先自检 replace 语义,零模型调用)。
8
+ - Host 新增依赖 `tools` 服务;`node --test` 127 项通过(新增检测核心与宿主接线两组用例)。
9
+
10
+ ## 0.5.2 — 2026-11-14
11
+
12
+ - 修掉「预测看不到提问框」:输入框灰字预测的上下文里现在会带上 `ask_user_question` 的问答,
13
+ 渲染成「助手(提问)…」「用户(回答)…」两行。
14
+ - 前台回答写在工具结果的 `{"answers":[…]}` 里,排队回答是 `source.kind === 'user-question-reply'`
15
+ 的用户消息;这两种记录以前都被当成工具噪音丢掉,预测只能看到助手最后的「已写入…」,
16
+ 看起来就像助手没问过就把事做完了。
17
+ - 同一题只保留一条回答;坏 JSON、失败的工具结果和 `isError` 结果直接跳过。
18
+ - 预测 prompt 里补了一句说明,让模型把这两行当成已经发生的确认,而不是待确认。
19
+
3
20
  ## 0.5.1 — 2026-11-12
4
21
 
5
22
  - 修掉「又问了一轮,输入框上面那一行还是上一轮的」:摘要默认改成每轮都更新(`recapCooldownTurns` 默认 1,原来是 3),沿用旧行的相似度阈值从 0.7 提到 0.9,只有几乎没变化时才不动。
package/README.md CHANGED
@@ -1,54 +1,55 @@
1
1
  # WDX Relief
2
2
 
3
- 降低 DSH 日常使用心智负担的小功能集合。目前六个功能,**全部设置都在这个插件的配置里**。
3
+ A small collection of features that reduce the everyday mental load of using DSH. Seven features today, and **every setting lives in this plugin's own configuration**.
4
4
 
5
- > 侧边栏 **插件 → 已安装插件 → WDX Relief**,配置区在 bundle 页面下方。
6
- > 不往 DSH 的 Settings 导航里插入页面;字段都是插件自己的 `Config`,写入后持久化到 profile 的 `cordis.patch.yml`。
5
+ > Sidebar **Plugins → Installed plugins → WDX Relief**; the configuration area is below the bundle page.
6
+ > It does not add a page to DSH's Settings navigation; every field is the plugin's own `Config`, persisted to the profile's `cordis.patch.yml` after saving.
7
7
 
8
- ## 功能
8
+ ## Features
9
9
 
10
- - **输入框下一句预测**:对话结束后用灰字猜你接下来要发的话,<kbd>Tab</kbd> 填入;打字隐藏,<kbd>Esc</kbd> 忽略。
11
- - **输入框上的一行**(默认开启):逐轮显示「这一轮在做什么、到哪了」。默认只显示语义摘要(每几轮用一次便宜模型);活动流水、状态耗时、思考预览三项本地生成、零模型调用,按需开启。四类内容各有开关,这一行永不进入模型上下文。生成过的摘要会留在右侧 WDX Relief 面板里。
12
- - **WDX Relief 页面**(右侧栏,默认开启):和 WDX Git 一样出现在右侧栏的工具列表里。页面用三个 Tab:默认是「待跟进」,把过去会话里提醒过你、但你还没处理的事列成清单,点条目跳回原会话,每条的「×」可以清掉不想要的建议(可撤销,清掉记录只存在本地);「会话回顾」回看这个会话生成过的每一行摘要;「旁问」不进入主上下文。
13
- - **旁问**:Tab 里的输入框和 composer 一样是圆角卡片,底部可以选旁问专用模型(窄的时候只显示模型图标)、右侧圆形按钮发送;问答只留在面板里,不写会话、不写命令日志,也不进入模型上下文,不改变主会话模型。
14
- - **回复风格**:长度 **短 / 标准 / 详细**;风格 **默认 / 专业 / 亲和 / 直接 / 跟随我的风格**;可加最多 2000 字的自定义指令。
15
- - **便于行动**(默认开启):先给结果和下一步;能一句说清的不写一段,术语先用白话说明;保留风险、失败条件和已授权该做的工作。
10
+ - **Next-message prediction**: after a turn, grey text guesses what you'll send next; press <kbd>Tab</kbd> to accept. Typing hides it, <kbd>Esc</kbd> dismisses it.
11
+ - **The line above the input** (on by default): shows turn by turn "what this turn is doing and where it is". By default it shows only the semantic recap (a cheap model every few turns); activity feed, timing, and reasoning preview are generated locally with zero model calls and can be enabled as needed. Each of the four content types has its own switch, and this line never enters the model context. Generated recaps stay in the WDX Relief panel on the right.
12
+ - **WDX Relief page** (right sidebar, on by default): appears in the right sidebar's tool list just like WDX Git. It has three tabs: "Follow-ups" (default) lists things past sessions reminded you about that you haven't handled; click an item to jump back to that session, and the "×" on each clears unwanted suggestions (undoable; cleared records stay local). "Session review" looks back at every recap line generated in this session. "Ask aside" stays out of the main context.
13
+ - **Ask aside**: the tab's input is a rounded card like the composer, with a model picker for the aside at the bottom (only the model icon when narrow) and a circular send button on the right. The Q&A stays in the panel: it is not written to the session or the command log, does not enter the model context, and does not change the main session's model.
14
+ - **Reply style**: length **short / standard / detailed**; style **default / professional / friendly / blunt / follow my style**; up to 2000 characters of custom instructions.
15
+ - **Action-first** (on by default): result and next step first; one sentence when one suffices, plain-language explanations of terms; keeps risks, failure conditions, and work you've already authorized.
16
+ - **Tool-call leak guard** (on by default): when the model writes a tool call as literal text (`<tool_call>` / `<invoke>` envelope), the step produces no tool card, yet the turn closes normally, the guard detects it on the spot and injects a correction in the same turn so the model reissues the call. The damaged step is also voided on the model-visible surface, and a forked session gets a one-time brief telling it not to imitate broken history. Derived from `@irwdone/dsh-tool-call-leak-fix` (MIT). It can be switched on/off and tuned under "Tool-call guard" in the plugin settings.
16
17
 
17
- ## 运行要求
18
+ ## Requirements
18
19
 
19
- - DSH Web profile;插件依赖 `connection` 与 `sessions` 服务。
20
- - 已配置默认模型。预测会把最近几轮对话作为 prompt 发给当前默认模型;旁问默认用当前会话模型,也可以在面板底部切到别的模型;「待跟进」会把近期会话的尾部片段发一次,做归并判断。三者都不写入会话日志、不触发 agent loop。
21
- - 语义摘要默认每 3 轮更新一次,先按你配置的便宜模型链尝试,再自动挑便宜模型,最后退回当前默认模型;模型失败时退回本地短拼接。活动流水、耗时、思考预览不调用模型。
20
+ - DSH Web profile; the plugin depends on the `connection`, `sessions`, and `tools` services.
21
+ - A default model configured. Prediction sends the last few turns to the current default model as a prompt; Ask aside uses the current session model by default and can be switched to another model at the bottom of the panel; Follow-ups sends one tail fragment from recent sessions for a merge decision. None of the three writes to the session log or triggers the agent loop.
22
+ - The semantic recap updates every 3 turns by default: it tries your configured cheap-model chain first, then picks a cheap model automatically, then falls back to the current default model; on model failure it falls back to a local short concatenation. Activity feed, timing, and reasoning preview make no model calls.
22
23
 
23
- ## 安装
24
+ ## Install
24
25
 
25
- 在 DSH 侧边栏 **插件 → 添加插件** 输入:
26
+ In the DSH sidebar, go to **Plugins → Add plugin** and enter:
26
27
 
27
28
  ```text
28
29
  dsh-wdx-relief
29
30
  ```
30
31
 
31
- 或让 agent 调:
32
+ Or have the agent call:
32
33
 
33
34
  ```text
34
35
  plugin_manager install_bundle target = "dsh-wdx-relief"
35
36
  ```
36
37
 
37
- 或命令行:
38
+ Or from the command line:
38
39
 
39
40
  ```bash
40
41
  dsh plugin --profile <profile> add dsh-wdx-relief
41
42
  ```
42
43
 
43
- 安装后启用;客户端模块会在下次页面加载时挂载。
44
+ Enable it after installing; the client module mounts on the next page load.
44
45
 
45
- 本地开发时用 `link:` 安装当前目录的方式见 [docs/guide.md](docs/guide.md)。
46
+ For local development with a `link:` install of the current directory, see [docs/guide.md](docs/guide.md).
46
47
 
47
- ## 开发
48
+ ## Development
48
49
 
49
50
  ```bash
50
51
  pnpm install
51
52
  pnpm test
52
53
  ```
53
54
 
54
- 完整的配置字段、实现细节、独立 web profile 安装方式和实机验证记录见 [docs/guide.md](docs/guide.md)。
55
+ For the full config fields, implementation details, standalone web-profile install, and on-device verification records, see [docs/guide.md](docs/guide.md).
package/README.zh.md ADDED
@@ -0,0 +1,55 @@
1
+ # WDX Relief
2
+
3
+ 降低 DSH 日常使用心智负担的小功能集合。目前七个功能,**全部设置都在这个插件的配置里**。
4
+
5
+ > 侧边栏 **插件 → 已安装插件 → WDX Relief**,配置区在 bundle 页面下方。
6
+ > 不往 DSH 的 Settings 导航里插入页面;字段都是插件自己的 `Config`,写入后持久化到 profile 的 `cordis.patch.yml`。
7
+
8
+ ## 功能
9
+
10
+ - **输入框下一句预测**:对话结束后用灰字猜你接下来要发的话,<kbd>Tab</kbd> 填入;打字隐藏,<kbd>Esc</kbd> 忽略。
11
+ - **输入框上的一行**(默认开启):逐轮显示「这一轮在做什么、到哪了」。默认只显示语义摘要(每几轮用一次便宜模型);活动流水、状态耗时、思考预览三项本地生成、零模型调用,按需开启。四类内容各有开关,这一行永不进入模型上下文。生成过的摘要会留在右侧 WDX Relief 面板里。
12
+ - **WDX Relief 页面**(右侧栏,默认开启):和 WDX Git 一样出现在右侧栏的工具列表里。页面用三个 Tab:默认是「待跟进」,把过去会话里提醒过你、但你还没处理的事列成清单,点条目跳回原会话,每条的「×」可以清掉不想要的建议(可撤销,清掉记录只存在本地);「会话回顾」回看这个会话生成过的每一行摘要;「旁问」不进入主上下文。
13
+ - **旁问**:Tab 里的输入框和 composer 一样是圆角卡片,底部可以选旁问专用模型(窄的时候只显示模型图标)、右侧圆形按钮发送;问答只留在面板里,不写会话、不写命令日志,也不进入模型上下文,不改变主会话模型。
14
+ - **回复风格**:长度 **短 / 标准 / 详细**;风格 **默认 / 专业 / 亲和 / 直接 / 跟随我的风格**;可加最多 2000 字的自定义指令。
15
+ - **便于行动**(默认开启):先给结果和下一步;能一句说清的不写一段,术语先用白话说明;保留风险、失败条件和已授权该做的工作。
16
+ - **工具调用泄漏守卫**(默认开启):模型把工具调用直接写成正文(`<tool_call>` / `<invoke>` 信封)、这一步没有任何工具卡、turn 却正常结束时,当场检测并在同一轮内注入纠正让模型重发;损坏的那一步还会在模型可见面上被作废,fork 出去的会话首步会收到一份「历史里的坏样本不要模仿」简报。可在设置页「工具调用守卫」分组里开关、改提示语言和每轮上限。源自 `@irwdone/dsh-tool-call-leak-fix`(MIT)。
17
+
18
+ ## 运行要求
19
+
20
+ - DSH Web profile;插件依赖 `connection`、`sessions` 与 `tools` 服务。
21
+ - 已配置默认模型。预测会把最近几轮对话作为 prompt 发给当前默认模型;旁问默认用当前会话模型,也可以在面板底部切到别的模型;「待跟进」会把近期会话的尾部片段发一次,做归并判断。三者都不写入会话日志、不触发 agent loop。
22
+ - 语义摘要默认每 3 轮更新一次,先按你配置的便宜模型链尝试,再自动挑便宜模型,最后退回当前默认模型;模型失败时退回本地短拼接。活动流水、耗时、思考预览不调用模型。
23
+
24
+ ## 安装
25
+
26
+ 在 DSH 侧边栏 **插件 → 添加插件** 输入:
27
+
28
+ ```text
29
+ dsh-wdx-relief
30
+ ```
31
+
32
+ 或让 agent 调:
33
+
34
+ ```text
35
+ plugin_manager install_bundle target = "dsh-wdx-relief"
36
+ ```
37
+
38
+ 或命令行:
39
+
40
+ ```bash
41
+ dsh plugin --profile <profile> add dsh-wdx-relief
42
+ ```
43
+
44
+ 安装后启用;客户端模块会在下次页面加载时挂载。
45
+
46
+ 本地开发时用 `link:` 安装当前目录的方式见 [docs/guide.md](docs/guide.md)。
47
+
48
+ ## 开发
49
+
50
+ ```bash
51
+ pnpm install
52
+ pnpm test
53
+ ```
54
+
55
+ 完整的配置字段、实现细节、独立 web profile 安装方式和实机验证记录见 [docs/guide.md](docs/guide.md)。
package/client/client.js CHANGED
@@ -43,6 +43,7 @@ window.__ModuleLoader__.load({
43
43
  var DISMISS_PATH = '/api/wdx-relief/today/dismiss'
44
44
  var RESTORE_PATH = '/api/wdx-relief/today/restore'
45
45
  var RECAP_PLACEMENTS = ['above', 'below']
46
+ var TOOLREPAIR_LANGS = ['zh', 'en']
46
47
  var MAX_CUSTOM_CHARS = 2000
47
48
  var SWITCH = primitives && primitives.Switch
48
49
  var MENU = primitives && primitives.Menu
@@ -238,6 +239,17 @@ window.__ModuleLoader__.load({
238
239
  'settings.recapModelChain.placeholder': 'deepseek-v4-flash, deepseek-chat',
239
240
  'settings.btwHint': '提示:右侧 WDX Relief 面板的「旁问」Tab 可以直接问当前模型,底部可以选旁问模型;问答不会进入主上下文。',
240
241
  'settings.summary': '预测下一句,输入框上给一行进度;右侧面板整理待跟进的事、回看历史摘要,并可旁问且不污染上下文。',
242
+ 'reply.group.toolRepair': '工具调用守卫',
243
+ 'settings.toolRepair.title': '工具调用泄漏守卫',
244
+ 'settings.toolRepair.description': '模型把工具调用写成正文、这一步没有工具卡却正常结束时,当场检测并在同一轮内纠正重发',
245
+ 'settings.toolRepairLang.title': '修复提示语言',
246
+ 'settings.toolRepairLang.description': '注入的纠正与拦截原因用中文还是英文',
247
+ 'settings.toolRepairLang.zh': '中文',
248
+ 'settings.toolRepairLang.en': 'English',
249
+ 'settings.toolRepairMaxCorrections.title': '每轮最多纠正次数',
250
+ 'settings.toolRepairMaxCorrections.description': '0 表示只标记不自动纠正;默认 2',
251
+ 'settings.toolRepairDebugLog.title': '诊断日志',
252
+ 'settings.toolRepairDebugLog.description': '输出检测、拦截与修复过程日志(默认关闭)',
241
253
  'turn.reasoning': '思考',
242
254
  'turn.pending': '还没回复',
243
255
  'turn.dismiss': '收起这一行',
@@ -363,6 +375,17 @@ window.__ModuleLoader__.load({
363
375
  'settings.recapModelChain.placeholder': 'deepseek-v4-flash, deepseek-chat',
364
376
  'settings.btwHint': 'Tip: the Aside tab in the WDX Relief panel asks the current model; pick a model at the bottom. The exchange never enters the model context.',
365
377
  'settings.summary': 'Predict the next message, keep a live line above the composer, and use the right panel for unanswered items, recap history, and side questions that stay out of context.',
378
+ 'reply.group.toolRepair': 'Tool-call guard',
379
+ 'settings.toolRepair.title': 'Tool-call leak guard',
380
+ 'settings.toolRepair.description': 'When a tool call is written as text, produces no tool card, yet the turn closes normally: detect it and inject a correction in the same turn',
381
+ 'settings.toolRepairLang.title': 'Correction language',
382
+ 'settings.toolRepairLang.description': 'Use Chinese or English for injected corrections and denial reasons',
383
+ 'settings.toolRepairLang.zh': '中文',
384
+ 'settings.toolRepairLang.en': 'English',
385
+ 'settings.toolRepairMaxCorrections.title': 'Max corrections per turn',
386
+ 'settings.toolRepairMaxCorrections.description': '0 means flag only, never auto-correct; default 2',
387
+ 'settings.toolRepairDebugLog.title': 'Diagnostic log',
388
+ 'settings.toolRepairDebugLog.description': 'Log detection, denials and repairs (off by default)',
366
389
  'turn.reasoning': 'Thinking',
367
390
  'turn.pending': 'no reply yet',
368
391
  'turn.dismiss': 'Hide this line',
@@ -2296,6 +2319,10 @@ window.__ModuleLoader__.load({
2296
2319
  return value === '' ? { kind: 'clear' } : { kind: 'set', value: value }
2297
2320
  },
2298
2321
  },
2322
+ { field: 'toolRepair', format: booleanText, parse: parseBoolean },
2323
+ choiceField('toolRepairLang', TOOLREPAIR_LANGS, 'zh'),
2324
+ numberField('toolRepairMaxCorrections', 2, 0, 10, 1),
2325
+ { field: 'toolRepairDebugLog', format: booleanText, parse: parseBoolean },
2299
2326
  ])
2300
2327
 
2301
2328
  var store = model.bind(function () {
@@ -2317,6 +2344,10 @@ window.__ModuleLoader__.load({
2317
2344
  actionable: model.field('actionable'),
2318
2345
  style: model.field('style'),
2319
2346
  customInstructions: model.field('customInstructions'),
2347
+ toolRepair: model.field('toolRepair'),
2348
+ toolRepairLang: model.field('toolRepairLang'),
2349
+ toolRepairMaxCorrections: model.field('toolRepairMaxCorrections'),
2350
+ toolRepairDebugLog: model.field('toolRepairDebugLog'),
2320
2351
  }
2321
2352
  })
2322
2353
 
@@ -2530,6 +2561,10 @@ window.__ModuleLoader__.load({
2530
2561
  var actionable = state.actionable || emptyField
2531
2562
  var style = state.style || emptyField
2532
2563
  var customInstructions = state.customInstructions || emptyField
2564
+ var toolRepair = state.toolRepair || emptyField
2565
+ var toolRepairLang = state.toolRepairLang || emptyField
2566
+ var toolRepairMaxCorrections = state.toolRepairMaxCorrections || emptyField
2567
+ var toolRepairDebugLog = state.toolRepairDebugLog || emptyField
2533
2568
 
2534
2569
  function edit(name, value) {
2535
2570
  if (typeof props.edit === 'function') props.edit(name, value)
@@ -2545,6 +2580,9 @@ window.__ModuleLoader__.load({
2545
2580
  var placementOptions = RECAP_PLACEMENTS.map(function (id) {
2546
2581
  return { id: id, label: tr(t, 'settings.recapPlacement.' + id, id === 'below' ? '输入框下方' : '输入框上方') }
2547
2582
  })
2583
+ var toolRepairLangOptions = TOOLREPAIR_LANGS.map(function (id) {
2584
+ return { id: id, label: tr(t, 'settings.toolRepairLang.' + id, id === 'en' ? 'English' : '中文') }
2585
+ })
2548
2586
  var styleOptions = STYLE_OPTIONS.map(function (id) {
2549
2587
  var name = tr(t, 'reply.style.' + id, id)
2550
2588
  return {
@@ -2737,6 +2775,54 @@ window.__ModuleLoader__.load({
2737
2775
  ])
2738
2776
  : null,
2739
2777
  ]),
2778
+ h('div', { key: 'toolRepair', className: 'wdxs-group' }, [
2779
+ h('div', { key: 'head', className: 'wdxs-groupHead' }, tr(t, 'reply.group.toolRepair', '工具调用守卫')),
2780
+ h(ToggleField, {
2781
+ key: 'toolRepair',
2782
+ t: t,
2783
+ title: tr(t, 'settings.toolRepair.title', '工具调用泄漏守卫'),
2784
+ description: tr(t, 'settings.toolRepair.description', ''),
2785
+ field: toolRepair,
2786
+ disabled: disabled,
2787
+ onChange: function (next) { edit('toolRepair', String(next)) },
2788
+ onReset: function () { reset('toolRepair') },
2789
+ }),
2790
+ h(SelectField, {
2791
+ key: 'toolRepairLang',
2792
+ t: t,
2793
+ title: tr(t, 'settings.toolRepairLang.title', '修复提示语言'),
2794
+ description: tr(t, 'settings.toolRepairLang.description', ''),
2795
+ options: toolRepairLangOptions,
2796
+ value: toolRepairLang.text || 'zh',
2797
+ overridden: toolRepairLang.overridden === true,
2798
+ disabled: disabled || toolRepair.text === 'false',
2799
+ onChange: function (next) { edit('toolRepairLang', next) },
2800
+ onReset: function () { reset('toolRepairLang') },
2801
+ }),
2802
+ h(NumberField, {
2803
+ key: 'toolRepairMaxCorrections',
2804
+ t: t,
2805
+ title: tr(t, 'settings.toolRepairMaxCorrections.title', '每轮最多纠正次数'),
2806
+ description: tr(t, 'settings.toolRepairMaxCorrections.description', ''),
2807
+ field: toolRepairMaxCorrections,
2808
+ min: 0,
2809
+ max: 10,
2810
+ step: 1,
2811
+ disabled: disabled || toolRepair.text === 'false',
2812
+ onChange: function (next) { edit('toolRepairMaxCorrections', next) },
2813
+ onReset: function () { reset('toolRepairMaxCorrections') },
2814
+ }),
2815
+ h(ToggleField, {
2816
+ key: 'toolRepairDebugLog',
2817
+ t: t,
2818
+ title: tr(t, 'settings.toolRepairDebugLog.title', '诊断日志'),
2819
+ description: tr(t, 'settings.toolRepairDebugLog.description', ''),
2820
+ field: toolRepairDebugLog,
2821
+ disabled: disabled || toolRepair.text === 'false',
2822
+ onChange: function (next) { edit('toolRepairDebugLog', String(next)) },
2823
+ onReset: function () { reset('toolRepairDebugLog') },
2824
+ }),
2825
+ ]),
2740
2826
  h('div', { key: 'length', className: 'wdxs-group' }, [
2741
2827
  h('div', { key: 'head', className: 'wdxs-groupHead' }, tr(t, 'reply.group.length', '回复长度')),
2742
2828
  h(SelectField, {
package/cordis.patch.yml CHANGED
@@ -6,6 +6,9 @@
6
6
  config:
7
7
  enabled: true
8
8
  recap: true
9
+ toolRepair: true
10
+ toolRepairLang: zh
11
+ toolRepairMaxCorrections: 2
9
12
  recapActivity: false
10
13
  recapTiming: false
11
14
  recapReasoning: false
package/docs/DETAIL.md ADDED
@@ -0,0 +1,52 @@
1
+ # WDX Relief
2
+
3
+ WDX Relief reduces the everyday friction of using DeepSeek Harness. Seven features, all configured in the plugin's own settings below the bundle page (**Plugins → Installed plugins → WDX Relief**); nothing is added to the DSH Settings navigation.
4
+
5
+ ![WDX Relief configuration](bundle-config.webp)
6
+
7
+ ## What it does
8
+
9
+ ### Next-message prediction
10
+
11
+ After a turn, grey text in the composer guesses what you are about to send. Press <kbd>Tab</kbd> to fill it in, keep typing to hide it, or press <kbd>Esc</kbd> to dismiss it. It sends the last few turns to the current default model and caches the result by session sequence; it does not write to the session log.
12
+
13
+ ### The line above the input
14
+
15
+ A per-turn line that answers "what is this turn doing, and where is it". It offers four independent content types:
16
+
17
+ - **Semantic recap** (on by default): a cheap model summarizes the latest turn every few turns.
18
+ - **Activity feed**, **timing**, **reasoning preview**: generated locally with zero model calls, off by default.
19
+
20
+ The line never enters the model context, and generated recaps are kept in the WDX Relief panel for review.
21
+
22
+ ### WDX Relief panel
23
+
24
+ A right-sidebar page with three tabs:
25
+
26
+ - **Follow-ups** (default): things past sessions raised that you have not acted on. Click an item to jump back to that session; "×" clears an unwanted suggestion (undoable, local only).
27
+ - **Session review**: every recap line generated in this session.
28
+ - **Ask aside**: a composer-style card with its own model picker. The Q&A stays in the panel — not in the session, not in the command log, not in the model context, and it does not change the main session model.
29
+
30
+ ### Reply style
31
+
32
+ Length **short / standard / detailed** and style **default / professional / friendly / blunt / follow my style**, plus up to 2000 characters of custom instructions. These are prompt-level preferences: they change how a reply is expressed, not the task, the facts, or the tool permissions.
33
+
34
+ ### Action-first
35
+
36
+ On by default: result and next step first, one sentence when one suffices, plain-language explanations of terms, while keeping risks, failure conditions, and work you have already authorized.
37
+
38
+ ### Tool-call leak guard
39
+
40
+ When the model writes a tool call as literal text (a `<tool_call>` / `<invoke>` envelope), the step produces no tool card, yet the turn closes as if finished, the guard detects it on the spot and injects a correction in the same turn so the model reissues the call in smaller chunks. The damaged step is voided on the model-visible surface, and a forked session gets a one-time brief telling it not to imitate broken history. At most two automatic corrections per turn by default; it can be disabled or lowered in the plugin settings under "Tool-call guard".
41
+
42
+ ## Install
43
+
44
+ In the DSH sidebar, go to **Plugins → Add plugin**, enter `dsh-wdx-relief`, then enable it. From a checkout, run `dsh plugin --profile <name> add ./dsh-wdx-relief`.
45
+
46
+ ## Requirements and limits
47
+
48
+ - DSH Web profile; the plugin depends on the `connection`, `sessions`, and `tools` services.
49
+ - A default model must be configured. Prediction, the semantic recap, Follow-ups, and Ask aside make model calls; activity feed, timing, and reasoning preview do not. The tool-call guard is zero-cost until it fires, then costs at most one extra model step (bounded by the correction limit).
50
+ - Reply style is a soft prompt constraint, not a hard length limit.
51
+ - Recaps are stored locally in `$DSH_HOME/wdx-relief/recaps.json` (up to 300 entries); clearing that file clears the history.
52
+ - Ask aside keeps answers in panel memory only; closing the panel or switching sessions clears them.
@@ -0,0 +1,52 @@
1
+ # WDX Relief
2
+
3
+ WDX Relief 降低 DeepSeek Harness 的日常使用摩擦。七个功能,全部配置在插件自己的设置里(**插件 → 已安装插件 → WDX Relief** 的 bundle 页面下方),不往 DSH 的 Settings 导航里加页面。
4
+
5
+ ![WDX Relief 配置页](bundle-config.webp)
6
+
7
+ ## 功能
8
+
9
+ ### 输入框下一句预测
10
+
11
+ 对话结束后,输入框用灰字猜你接下来要发的话。<kbd>Tab</kbd> 填入,继续打字隐藏,<kbd>Esc</kbd> 忽略。它把最近几轮发给当前默认模型,按会话序号缓存结果,不写入会话日志。
12
+
13
+ ### 输入框上的一行
14
+
15
+ 逐轮显示「这一轮在做什么、到哪了」,四类内容各有独立开关:
16
+
17
+ - **语义摘要**(默认开启):每几轮用一次便宜模型概括最近一轮。
18
+ - **活动流水**、**状态耗时**、**思考预览**:本地生成、零模型调用,默认关闭。
19
+
20
+ 这一行永不进入模型上下文,生成过的摘要会留在 WDX Relief 面板里。
21
+
22
+ ### WDX Relief 页面
23
+
24
+ 右侧栏页面,三个 Tab:
25
+
26
+ - **待跟进**(默认):过去会话里提醒过你、但你还没处理的事。点条目跳回原会话;「×」清掉不想要的建议(可撤销,只存在本地)。
27
+ - **会话回顾**:回看这个会话生成过的每一行摘要。
28
+ - **旁问**:和 composer 一样的圆角卡片,底部可以选旁问专用模型。问答只留在面板里——不写会话、不写命令日志、不进入模型上下文,也不改变主会话模型。
29
+
30
+ ### 回复风格
31
+
32
+ 长度 **短 / 标准 / 详细**,风格 **默认 / 专业 / 亲和 / 直接 / 跟随我的风格**,可加最多 2000 字自定义指令。这些是 prompt 层的偏好:只改变表达方式,不改变任务、事实或工具权限。
33
+
34
+ ### 便于行动
35
+
36
+ 默认开启:先给结果和下一步,能一句说清的不写一段,术语先用白话说明,同时保留风险、失败条件和已授权该做的工作。
37
+
38
+ ### 工具调用泄漏守卫
39
+
40
+ 模型把工具调用直接写成正文(`<tool_call>` / `<invoke>` 信封)、这一步没有任何工具卡、turn 却像「已完成」一样结束时,当场检测并在同一轮内注入纠正让模型用小块重发;损坏的那一步会在模型可见面上被作废,fork 出去的会话首步会收到一份简报,提示历史里的坏样本不要模仿。默认最多自动纠正两次,可在插件设置的「工具调用守卫」分组里关闭或调低。
41
+
42
+ ## 安装
43
+
44
+ 在 DSH 侧边栏 **插件 → 添加插件** 输入 `dsh-wdx-relief`,然后启用。从源码安装:`dsh plugin --profile <name> add ./dsh-wdx-relief`。
45
+
46
+ ## 运行要求与限制
47
+
48
+ - DSH Web profile;插件依赖 `connection`、`sessions` 与 `tools` 服务。
49
+ - 需要配置默认模型。预测、语义摘要、待跟进、旁问会调用模型;活动流水、耗时、思考预览不调用。工具调用守卫平时零开销,触发时最多多一次模型步(受纠正次数上限约束)。
50
+ - 回复风格是 prompt 软约束,不是硬性长度截断。
51
+ - 摘要存放在本地 `$DSH_HOME/wdx-relief/recaps.json`(最多 300 条);清空该文件即清空历史。
52
+ - 旁问回答只存在面板内存里;关闭面板或切换会话即清空。
package/docs/guide.md CHANGED
@@ -46,6 +46,12 @@ HMR 生效。
46
46
  | `actionable` | `true` | 便于行动:先结果/下一步、白话解释术语、保留风险 |
47
47
  | `style` | `default` | `default` / `professional` / `friendly` / `blunt` / `follow` |
48
48
  | `customInstructions` | `''` | 最多 2000 字 |
49
+ | `toolRepair` | `true` | 工具调用泄漏守卫总开关 |
50
+ | `toolRepairLang` | `zh` | 修复提示语言:`zh` / `en` |
51
+ | `toolRepairMaxCorrections` | `2` | 每轮最多自动纠正几次;`0` 关闭自动纠正 |
52
+ | `toolRepairDebugLog` | `false` | 输出工具调用修复的诊断日志 |
53
+
54
+ 工具调用守卫这四个字段在设置页有独立分组「工具调用守卫」:总开关、修复提示语言、每轮最多纠正次数、诊断日志,改动即时生效。
49
55
 
50
56
  旧版本的 `writingStyle` / `baseStyle` 仍保留在 schema 里做迁移:没有 `style` 时,`writingStyle: true` 映射为 `follow`,`baseStyle` 的 professional/friendly/blunt 映射到同名风格;设置页只写新的 `style`。
51
57
 
@@ -58,6 +64,9 @@ bundle 层只声明入口和输入层的开关,其余字段由 schema 默认
58
64
  config:
59
65
  enabled: true
60
66
  recap: true
67
+ toolRepair: true
68
+ toolRepairLang: zh
69
+ toolRepairMaxCorrections: 2
61
70
  recapActivity: false
62
71
  recapTiming: false
63
72
  recapReasoning: false
@@ -71,6 +80,9 @@ bundle 层只声明入口和输入层的开关,其余字段由 schema 默认
71
80
  空闲、空输入时以 350ms 防抖请求 `POST /api/wdx-relief/predict`。
72
81
  2. Host 用 `ctx.sessions.get(sessionId).deriveMessages()` 取最近几轮真人用户/助手文本,
73
82
  要求最后一条是助手消息;用 `agentDefaultModel` 的最低推理档位生成一条短句。
83
+ 提问框(`ask_user_question`)的问答会还原成「助手(提问)」「用户(回答)」两行:前台回答在
84
+ 工具结果的 `{"answers":[…]}` 里,排队回答是 `source.kind === 'user-question-reply'` 的用户消息;
85
+ 不还原的话,最近几轮看起来就像助手没问过就把事做完了(例如刚写完 11 条,预测却以为用户还没确认)。
74
86
  3. 结果按 `session.seq` 缓存;客户端把灰字绝对定位到 `[data-composer-input]` 的文字起点,
75
87
  Tab 通过标准 prop `inputActions.setDraft()` 写入 Lexical 编辑器。
76
88
  这条 Codex 式体验依赖 composer 的布局矩形,是本插件已知的 DOM 耦合点。
@@ -173,6 +185,34 @@ Host 在 `ctx.systemPrompt` 注册:
173
185
  按内容比例组织(句 > 段 > 清单)、术语先用白话说明、保留风险与失败条件、不复述、
174
186
  不把已获授权的工作交回用户。
175
187
 
188
+ ## 工具调用泄漏守卫
189
+
190
+ 解决一类静默失败:模型把工具调用**直接写成正文**(`<tool_call>` / `<function=NAME>` / `<parameter=NAME>`,
191
+ 或 `<invoke>` / `<parameter>`、`antml:` 前缀),这一步没有任何工具卡,agent loop 见 `toolCalls.length === 0`
192
+ 返回 `{kind:'completed'}`,turn 像「已完成」一样关闭。尤其在 strata 引擎 serve 的模型上出现过:
193
+ 信封落在正文里,对话直接结束,既不执行也不报错。
194
+
195
+ 实现移植自 `@irwdone/dsh-tool-call-leak-fix`(MIT),并按本插件的 volatile Config 语义改造(每次事件实时读配置):
196
+
197
+ - 纯检测核心在 `src/toolCallDetect.js`:零依赖、pure、永不抛错;结构分析前先做影子拷贝,
198
+ 剥掉命名空间前缀,并把 strata 方言(`tool_call` → `invoke`、`function` → `parameter`)折成同一种标记,
199
+ 所以配对、截断、尾部重复、头部开场等规则复用同一套逻辑。
200
+ - 宿主接线在 `src/toolCallRepair.js`,五个机制各挂一个已核实的接缝:
201
+ - **M2** `tools/pre-execute`:分发前扫描参数,尾部结束序列增殖 / 结构截断且体量够大(≥2000 字符或 ≥20 行)
202
+ 就拒绝并给出可操作原因;声明了必填参数却收到 `{}` 也拒。
203
+ - **M3** `tools/post-execute`:写入类工具自报空转(`noop:true`、`status:"noop"`、带内容却 `written:0`)时补一条提示。
204
+ - **M4** `session/event` + `agent/turn-stopping`:某步损坏**且**该步没有任何工具调用时,在 turn 即将关闭时
205
+ `agent.inject()` 一条纠正,让 turn 不关闭、同一轮内重发;第一次讲原因并要求小块重试,第二次更硬更短;
206
+ 每轮次数由 `toolRepairMaxCorrections` 限制(默认 2),到顶即停。
207
+ - **M7** `agent/pre-step`:fork 会话首步前注入一次简报,把继承来的孤立调用标记标为损坏、不要模仿。
208
+ - **M9** 会话 surface 替换:把损坏那一步在模型可见面上遮蔽成一条说明(日志保留原始事件),零模型调用;
209
+ 先用自建探针节点自检 `surfaceOp.replace` 语义,自检失败整个会话故障关闭。
210
+ - 消息用生产者自有 source kind(`runtime-context` / `plugin:dsh-wdx-relief`),符合 v4 session 格式。
211
+ - 单测:`test/toolCallDetect.test.mjs`(含 strata 样本、JSON 信封、反例)与 `test/toolCallRepair.test.mjs`
212
+ (M2/M3/M4/M7/M9 全链路 mock)。
213
+ - 设置页新增独立分组「工具调用守卫」:总开关、修复提示语言、每轮最多纠正次数、诊断日志;客户端表单字段与
214
+ `readToolRepairConfig` 读取的键一一对应,保存后 Host 侧下一个事件即按新值生效。
215
+
176
216
  ## 实机验证记录(DSH 0.2.2-rc.1,历史配置页)
177
217
 
178
218
  - 侧边栏「插件」→ **WDX Relief** bundle 页出现配置区:输入开关、回复长度、便于行动开关、回复风格、自定义指令;
@@ -212,4 +252,6 @@ Host 在 `ctx.systemPrompt` 注册:
212
252
  - 旁问的回答只存在面板内存里,不跨刷新/重开保留;这是为了不把问答写进任何持久存储。
213
253
  - 写作风格只看当前对话;没有跨会话风格档案,也不读取工作区文件或外部应用。
214
254
  - 风格设置全局生效,暂不支持 per-session。
255
+ - 工具调用守卫只能缩短故障窗口、把静默失败变成显式失败并在同一轮内重试,改不了模型本身的退化;触发时最多多一次模型步(受 `toolRepairMaxCorrections` 限制)。
256
+ - 工具调用守卫平时零开销,但正常引用 `<tool_call>` 字样、且该步没有任何工具调用的解释性回复,理论上可能被判定为泄漏并注入一次纠正(下一事件会立即取消待定记录,不会连续误伤)。
215
257
  - 灰字定位依赖 composer 的 DOM 属性(`data-composer-card/input/placeholder`),DSH 改版时需要同步。
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * dsh-wdx-relief — Host 入口。
3
3
  *
4
- * 六件事:
4
+ * 七件事:
5
5
  * 1. 注册认证路由 `POST /api/wdx-relief/predict`,按会话日志生成「下一句输入」;
6
6
  * 2. 注册认证路由 `POST /api/wdx-relief/recap`,按最近一轮生成「现在到哪」;
7
7
  * 3. 注册认证路由 `POST /api/wdx-relief/today`,整理「用户还没跟进的事」;
@@ -9,7 +9,8 @@
9
9
  * `POST /api/wdx-relief/recaps` 读取某会话生成过的回顾历史;
10
10
  * 4. 注册认证路由 `POST /api/wdx-relief/btw`,回答右侧面板里的旁问;
11
11
  * 5. 把所有设置暴露成 volatile Config,供设置页读写并即时生效;
12
- * 6. 注册 `wdx-relief:reply-style` system prompt section,把回复风格编译成短指令。
12
+ * 6. 注册 `wdx-relief:reply-style` system prompt section,把回复风格编译成短指令;
13
+ * 7. 挂载工具调用泄漏守卫:调用被写成正文、turn 静默结束时当场检测并在同一轮内纠正重发。
13
14
  *
14
15
  * 预测、回顾和旁问都走 ctx.llm,不写 session log、不触发 agent loop;
15
16
  * 回顾的模型调用直接从服务流式读取,不 append 消息、不注入上下文,
@@ -24,12 +25,13 @@ import { createPredictionService } from './src/prediction.js'
24
25
  import { createRecapService } from './src/recap.js'
25
26
  import { createRecapHistory } from './src/recapHistory.js'
26
27
  import { createTodayService } from './src/today.js'
28
+ import { installToolCallRepair } from './src/toolCallRepair.js'
27
29
  import { STYLE_VALUES, VERBOSITY_VALUES, buildStylePrompt } from './src/style.js'
28
30
 
29
31
  export const name = 'wdx-relief'
30
32
 
31
- /** connection 提供认证 fetch 路由;sessions 读取会话日志;agents 由旁问惰性读取当前会话模型。 */
32
- export const inject = ['connection', 'sessions']
33
+ /** connection 提供认证 fetch 路由;sessions 读取会话日志;agents 由旁问惰性读取当前会话模型;tools 提供执行前/后接缝。 */
34
+ export const inject = ['connection', 'sessions', 'tools']
33
35
 
34
36
  export const ROUTE_PATH = '/api/wdx-relief/predict'
35
37
  export const RECAP_PATH = '/api/wdx-relief/recap'
@@ -108,6 +110,22 @@ export const Config = Schema.object({
108
110
  .default('')
109
111
  .volatile()
110
112
  .description('只影响回复表达的额外指令'),
113
+ toolRepair: Schema.boolean()
114
+ .default(true)
115
+ .volatile()
116
+ .description('工具调用被写成正文、turn 静默结束时自动检测并在同一轮内纠正重发'),
117
+ toolRepairLang: Schema.union(['zh', 'en'])
118
+ .default('zh')
119
+ .volatile()
120
+ .description('工具调用修复提示语言'),
121
+ toolRepairMaxCorrections: Schema.number()
122
+ .default(2)
123
+ .volatile()
124
+ .description('每轮最多自动纠正几次(0 表示不自动纠正)'),
125
+ toolRepairDebugLog: Schema.boolean()
126
+ .default(false)
127
+ .volatile()
128
+ .description('输出工具调用修复的诊断日志'),
111
129
  })
112
130
 
113
131
  /** 回复风格段落在 system prompt 中的顺序:放在部署 persona 之后。 */
@@ -158,6 +176,34 @@ async function handleRequest(request, run) {
158
176
  }
159
177
  }
160
178
 
179
+ /**
180
+ * 读取 volatile Config 引用;缺失、非对象或 getter 抛错都回退 undefined,
181
+ * 由调用方给默认值。插件配置在旧 profile 里可能没有新字段。
182
+ */
183
+ function readVolatile(config, key) {
184
+ const ref = config && config[key]
185
+ try {
186
+ if (ref && typeof ref === 'object' && typeof ref.get === 'function') return ref.get()
187
+ } catch {
188
+ /* 配置读取失败按缺失处理 */
189
+ }
190
+ return undefined
191
+ }
192
+
193
+ /**
194
+ * 工具调用修复的实时配置切片;每次事件重新读取,volatile 改动立即生效。
195
+ */
196
+ function readToolRepairConfig(config) {
197
+ const lang = readVolatile(config, 'toolRepairLang')
198
+ const maxCorrections = readVolatile(config, 'toolRepairMaxCorrections')
199
+ return {
200
+ enabled: readVolatile(config, 'toolRepair') !== false,
201
+ lang: lang === 'en' ? 'en' : 'zh',
202
+ maxCorrectionsPerTurn: Number.isInteger(maxCorrections) && maxCorrections >= 0 ? maxCorrections : 2,
203
+ debugLog: readVolatile(config, 'toolRepairDebugLog') === true,
204
+ }
205
+ }
206
+
161
207
  /**
162
208
  * Host 插件主体。
163
209
  * @param {import('@deepseek-ai/cordis').Context} ctx
@@ -169,6 +215,8 @@ export function apply(ctx, config) {
169
215
  console.warn(`[wdx-relief] ${message}${detail === '' ? '' : `:${detail}`}`)
170
216
  }
171
217
 
218
+ installToolCallRepair(ctx, () => readToolRepairConfig(config), log)
219
+
172
220
  const defaultSelection = () => {
173
221
  try {
174
222
  return ctx.get('agentDefaultModel')?.currentSelection?.() ?? null
package/locale/en.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "WDX Relief",
4
- "description": "Take the friction out of daily DSH work: predict your next message, show a live turn line above the composer, and ask side questions in the right panel with a model picker—without polluting the model context."
4
+ "description": "Take the friction out of daily DSH work: predict your next message, show a live turn line above the composer, and ask side questions in the right panel with a model picker—without polluting the model context.",
5
+ "detail": "docs/DETAIL.md"
5
6
  }
6
7
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "WDX Relief",
4
- "description": "把 DSH 的日常摩擦降下来:下一个输入自动预测,输入框上逐轮给一行进度,右侧面板整理待跟进的事、回看历史摘要,并可选模型地旁问而不污染主上下文。"
4
+ "description": "把 DSH 的日常摩擦降下来:下一个输入自动预测,输入框上逐轮给一行进度,右侧面板整理待跟进的事、回看历史摘要,并可选模型地旁问而不污染主上下文。",
5
+ "detail": "docs/DETAIL.zh.md"
5
6
  }
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-wdx-relief",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Take the friction out of daily DSH work: predicted next messages, a live one-line turn recap above the composer, and sidebar side questions with a composer-style model picker that stay out of the model context.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -20,6 +20,7 @@
20
20
  "icon.svg",
21
21
  "icon.png",
22
22
  "README.md",
23
+ "README.zh.md",
23
24
  "CHANGELOG.md",
24
25
  "RELEASING.md",
25
26
  "LICENSE",