dsh-progress-union 0.7.3 → 0.7.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/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  本项目的所有值得记录的变更都写在这里。版本号遵循语义化版本。
4
4
 
5
+ ## 0.7.5 (2026-12-04)
6
+
7
+ **feat(settings):`ops.enabled` 等 v0.7.0 四组开关第一次有了真正可达的表单入口;ops 操作块不再把开关位钉在首帧。**
8
+
9
+ 真机回灌(沙箱宿主 0.2.2-rc.5 + 0.7.4):为了验「关掉 ops 后整块收起」,先往 profile 的 `cordis.patch.yml` 写 `ops: {enabled: false}`,重启后 `/progress-union/ops/providers` 照旧 `disabled:false`。同一条 patch 里 `assistant.mode: registered` 也已写了几个月,而 `configured` 回执一直是 `{mode:""}` —— 两个探针合起来指向同一个根因:**那条目的 `id` 写成了 `dsh-external/dsh-progress-union`,宿主里根本查无此串**。外部 bundle 的 patch 目标 id 是插件自身 `cordis.patch.yml` 里 `insert:` 的 **entry id**(本插件 = `progress-union`),既不是包名也不是 `dsh-external/<包名>`;且同层覆盖是**按键整体替换、不深合并**。改成 `id: progress-union` 后 `configured.mode` 立刻变 `registered`、`disabled` 立刻变 `true`。
10
+
11
+ 顺着这条线查下去又抓到一个更基本的缺口:**设置卡只渲染 `assistant` / `observer` / `todo` 三组**(`readField` 里写死三元,其余组一律落到 observer 的桶),宿主也不会为外部插件另生成通用表单 —— 两个座位(`settings.section` 与 `plugins.bundle.config`)实测都只有那 4 组 10 个控件,全 DOM 搜不到 `ops` 字样。也就是说 0.7.2 上线的「整块开关」和 download/toolGloss/notifyMajorChanges 一样,**只有 schema、没有用户可达的入口**。
12
+
13
+ - **`ProgressUnionSettings` 补两张卡**:「下载感知与工序」(`download.enabled` / `showSubBar` / `markBackground` / `ttlMs` + `toolGloss.enabled` / `softNarrate` / `maxLen`)与「LLM 操作与队列提醒」(`ops.enabled` + 顶层标量 `notifyMajorChanges`)。开关走 `commitNow` 即时落盘,数字走草稿由「保存」提交,与既有三组同构。
14
+ - **`readField` 改为组查表**(`buckets = { assistant, observer, todo, download, toolGloss, ops }`),`flush()` 同步补上三个新组的整体回写;此前若只接线开关不接回写,会表现成「拨了开关但从未落盘」。
15
+ - **`LlmOpsBlock` 定期重探开关位**:新增 `OPS_POLL_MS = 15000`,`setOff(true)` 与 `setOff(false)` 成对出现,设置页拨完无需重挂载就跟上;默认 provider/model 只在首次探测回填(`primed` ref),不覆用户手选。卸载收定时器。
16
+ - **文案**:zh/en 各 +17 键(`setDl*` / `setGloss*` / `setOps*` / `setNotifyMajor*`)。本插件只注册 `zh`/`en` 两语,其余语种按既有设计回退英文。
17
+ - **测试**:`test/settings.test.mjs` +2 用例并扩写 volatile 叶子清单(补 `download.*`/`toolGloss.*`/`notifyMajorChanges`/`ops.enabled`,漏一个就红):一张断言「有 volatile 就必须有表单入口」,一张断言开关位定期重探不钉首帧。`npm test` **244 pass / 0 fail**(242 → +2),零回归。
18
+
19
+
20
+ ## 0.7.4 (2026-12-04)
21
+
22
+ **fix(download):工具名本身就是解释器(实测 `pwsh`)时不再被 `isShell` 门拦下。**
23
+
24
+ 真机回灌(沙箱宿主 0.2.2-rc.5 + dsh-progress-union 0.7.3):改发 `curl.exe -L -o dl073/echarts.tgz http://registry.npmmirror.com/…`,面板 88 帧探针仍 `basis=""` / `subbar=NO-SUBBAR`。但板面 `current` 供出了真因:`自动同步:pwsh · command=New-Item -ItemType Directory -Force -Path dl073 | Out-Null; curl.exe -` —— 这行里的 `pwsh` 是 `lastTool.name`,即宿主把跑命令的工具直接报成解释器名,而不是 `Bash`。0.7.3 只修了命令词表,而 `classifyDownload` 在 `isShell` 那道门上就 `return null`,后面的首词归一与引号体拆分根本轮不到。
25
+
26
+ - **新增 `SHELL_INTERPRETERS` + `isShellToolName()`**:除工具名白名单外,再认一批「解释器即工具名」的形状(`sh/bash/zsh/ksh/dash/fish/nu/xonsh/busybox/pwsh/powershell/powershell_ise/cmd/command.com`),判定前先取 basename 并剥 `.exe/.cmd/.bat/.ps1`,所以 `C:\Program Files\PowerShell\7\pwsh.exe` 也算 shell 通道。
27
+ - **两处消费面同时接入**:`classifyDownload` 的 `isShell` 门改为 `isShellToolName(toolKey)`;`describeToolStep` 的 shell 分支同样改用它 —— 否则 Windows 会话里「工序人话」依旧退回 `pwsh` 裸名而不是一句话。
28
+ - **白名单补齐**:`SHELL_TOOL_NAMES` 补 `shell_exec / shell_run / run_shell / terminal_run`(宿主侧另一类常见命法)。
29
+ - **不放宽误判面**:`read_file` / `mcp__tools__fetch` 这类不在词表里的工具名,即使参数里带了 `command` 也仍然返回 `null`;解释器名但拿不出命令文本同样 `null`(软感知纪律不变)。
30
+ - **测试**:`test/download-classify.test.mjs` +3 用例(共 22):pwsh/powershell 工具名命中真机命令串、非 shell 工具名不得被解释器名规则误放、`describeToolStep('pwsh', …)` 出人话。`npm test` **242 pass / 0 fail**(239 → +3),零回归。
31
+
32
+
5
33
  ## 0.7.3 (2026-12-04)
6
34
 
7
35
  **fix(download):Windows 宿主上 `curl.exe` / `Invoke-WebRequest` / `pwsh -Command "…"` 全漏识别,下载子条根本不出来。**
package/README.md CHANGED
@@ -268,7 +268,7 @@ assistant:
268
268
  ## 开发与测试
269
269
 
270
270
  ```bash
271
- npm test # node --test test/*.test.mjs(239 用例,纯 mock ctx,无需宿主进程)
271
+ npm test # node --test test/*.test.mjs(244 用例,纯 mock ctx,无需宿主进程)
272
272
  ```
273
273
 
274
274
  ## 冷启动接续(v0.6.2)
@@ -293,6 +293,8 @@ npm test # node --test test/*.test.mjs(239 用例,纯 mock ctx,无需宿
293
293
 
294
294
  **Windows 宿主形状(v0.7.3)**:DSH 的 Bash 工具在 Windows 上实落 pwsh,命令名常带 `.exe` 后缀与路径前缀,真下载还常被裹在 `pwsh -Command "…"` 的引号体里。分类器因此做三件事:首词先过 `normalizeHead`(剥引号 → 取 basename → 去 `.exe/.cmd/.bat/.ps1`),shell 包层的引号体额外再切一段(只拆一层),下载器词表补 PowerShell 自有的 `Invoke-WebRequest/iwr/Invoke-RestMethod/irm/Start-BitsTransfer`。反例仍然拦得住:`git.exe status`、`New-Item -ItemType Directory`、`pwsh -Command "Get-Process …"` 依旧返回 `null`。
295
295
 
296
+ **工具名即解释器(v0.7.4)**:上面那些只修到命令串,而真机上更靠外的一道门是工具名本身——宿主在 Windows 上报的是 `pwsh` 而不是 `Bash`,不在 shell 名单里时整条识别直接结束。现在 `isShellToolName()` 先取 basename 并剥 `.exe/.cmd/.bat/.ps1`,再比对解释器集(`pwsh/powershell/sh/bash/zsh/ksh/dash/fish/nu/xonsh/busybox/cmd`),`classifyDownload` 的 `isShell` 门与 `describeToolStep` 的 shell 分支共用它,所以子条与工序人话在 `pwsh` 会话里一起活过来。不在词表里的工具名(`read_file` 等)即使带 `command` 仍不算 shell 通道。
297
+
296
298
  ## 下载子进度条(v0.7.0)
297
299
 
298
300
  输入框上方的迷你条在主条行之后渲染一行子条,真值全部来自本插件自解析 `tool/result`(`parseProgress` 覆盖 wget/curl 的 `45%` 与 `12.3MB/27.8MB`、pip/uv 单尾单位、git `Receiving objects: 62%`、pnpm `[3/12]`),**零跨插件依赖**。
@@ -310,7 +312,16 @@ npm test # node --test test/*.test.mjs(239 用例,纯 mock ctx,无需宿
310
312
 
311
313
  选模型口径同 prime-memory:`GET /ops/providers` 读宿主 `llm.listProviders()` 与默认模型选择,宿主没给服务时退回设置页里的 `assistant.provider/model`(下拉显示「沿用设置页」),不报错。落盘走同一条 `callAssistant → parseProposal → applyChanges(origin:'ops')` 通道:改动截 8 条、未知 id 与空 title 丢弃、模型答非 JSON 返 502 且**板 revision 不动**、未配置模型返 400。`origin:'ops'` 不算「主模型刚刚同过步」,催办计时不被侧边栏操作抹平。
312
314
 
313
- **整块开关 `ops.enabled`(v0.7.2,默认开)**:关掉后 `GET /ops/providers` 直接报 `disabled:true` 且**不再打宿主 `listProviders`**,客户端据此把「LLM 操作」块整块收起(不是一堆禁用按钮,也不是报错);`POST /ops` 的 refine / mutate / ask 一律 **403**,唯独 `validate` 照常 200 —— 它是零 token 的本地板面体检,与花不花钱无关。该键与 `download.*` / `toolGloss.*` 同级:逐叶子 `.volatile()`、`DEFAULT_CONFIG.ops`、`flatSection('ops', …)` 三处齐全,设置页改完即生效,老 profile 零迁移。默认模型仍只走 `assistant.*` 与宿主当前选择,本开关不提供 `defaultProvider/defaultModel` 覆盖(计划里的那两个字段由宿主选择器承担,避免第二套模型配置面)。
315
+ **整块开关 `ops.enabled`(v0.7.2,默认开)**:关掉后 `GET /ops/providers` 直接报 `disabled:true` 且**不再打宿主 `listProviders`**,客户端据此把「LLM 操作」块整块收起(不是一堆禁用按钮,也不是报错);`POST /ops` 的 refine / mutate / ask 一律 **403**,唯独 `validate` 照常 200 —— 它是零 token 的本地板面体检,与花不花钱无关。该键与 `download.*` / `toolGloss.*` / `notifyMajorChanges` 同级:逐叶子 `.volatile()`、`DEFAULT_CONFIG.ops`、`flatSection('ops', …)` 三处齐全。表单入口从 **v0.7.5** 起真的存在(见下一节);开关关掉时服务端的 403 / `disabled` 判定是即时的,客户端块的隐去靠一次轮询重探(最多 15s),无需重加载页面。默认模型仍只走 `assistant.*` 与宿主当前选择,本开关不提供 `defaultProvider/defaultModel` 覆盖(计划里的那两个字段由宿主选择器承担,避免第二套模型配置面)。
316
+
317
+ ## 设置页开关(v0.7.5)
318
+
319
+ 设置 → 插件 → dsh-progress-union(与右侧栏「进度板」分区是同一张卡)现在共 6 组:除原有的辅助 LLM / 观察者 / 官方 todo 同步外,新增两张:
320
+
321
+ - **下载感知与工序**:`download.enabled`(关掉即观察块不出 `⬇` 行、快照 `download.active` 恒为 false)、`download.showSubBar`(不再下发 download 字段)、`download.markBackground`(后台徽标)、`download.ttlMs`(一次下载算「还在跑」的窗口),以及 `toolGloss.enabled` / `toolGloss.softNarrate` / `toolGloss.maxLen`(关掉后「最近动作」逐字退回 0.6.x 的 `name×count`)。
322
+ - **LLM 操作与队列提醒**:`ops.enabled`(整块开关)与 `notifyMajorChanges`(结构性变更是否落输入队列)。
323
+
324
+ 开关类拨完即落盘(走宿主 `configForms` 句柄的 `scope.set(顶层键, 整组值)`),数字类进草稿、点「保存」提交。两个坑已经踩实:**一**是 `scope.set` 按顶层键**整体替换**、不深合并,所以代码里永远先 `{ ...旧组, ...改字段 }` 再写;**二**是从 profile 的 `cordis.patch.yml` 手工覆盖时,条目 `id` 必须是插件自身 `insert:` 里的 **entry id**(本插件 = `progress-union`),写成包名或 `dsh-external/<包名>` 会整段静默不下发(不报错,只是配置始终是默认值)。
314
325
 
315
326
  ## 重大变更落输入队列(v0.7.0)
316
327
 
package/client.js CHANGED
@@ -24,7 +24,7 @@ window.__ModuleLoader__.load({
24
24
  var REPO_URL = "https://github.com/drscrewdriver/dsh-progress-union";
25
25
  var STAR_NS = "progress-union";
26
26
  var STAR_GEN = "v4"; /* ladder:gen */
27
- var STAR_VERSION = "0.7.3"; /* ladder:ver */
27
+ var STAR_VERSION = "0.7.5"; /* ladder:ver */
28
28
  var LANGS = ["zh", "en", "ja", "ko", "fr", "de", "it", "ru", "es", "pt"];
29
29
 
30
30
  // 三代共享:GitHub 单色 mark(octicon 轮廓,fill 随 currentColor)。
@@ -477,6 +477,23 @@ window.__ModuleLoader__.load({
477
477
  setTodoReconcileMs: '裁决最小间隔(毫秒)',
478
478
  setTodoThrottleMs: '镜像去抖(毫秒)',
479
479
  setTodoWriteNote: '写入事件:agent.session.append(\'todo/write\', { todos })(只读说明)',
480
+ setDlGroup: '下载感知与工序',
481
+ setDlBadge: '感知',
482
+ setDlHint: '下载只做软感知(识别 + 催办),绝不拦截工具;关掉后观察块逐字退回 0.6.x 文案。',
483
+ setDlEnabled: '启用下载感知',
484
+ setDlSubBar: '迷你条下方画下载子进度条',
485
+ setDlSubBarHint: '关掉即快照不再下发 download 字段;无真值时只走条纹时长态,绝不显示假百分比。',
486
+ setDlBg: '后台下载加徽标',
487
+ setDlTtlMs: '下载存活窗口(毫秒)',
488
+ setGlossEnabled: '工序说人话(最近动作改写成一句)',
489
+ setGlossNarrate: '追加一行叙述纪律(▸ 动作 → 本步目的)',
490
+ setGlossMaxLen: '工序句上限(字)',
491
+ setOpsGroup: 'LLM 操作与队列提醒',
492
+ setOpsBadge: '操作',
493
+ setOpsHint: '关掉即侧边栏「LLM 操作」整块收起:提供方不再枚举,细化/改板/问询返回 403;「校验」是零 token 的本地板面体检,照常可用。',
494
+ setOpsEnabled: '开放 LLM 任务操作',
495
+ setNotifyMajor: '结构性变更落输入队列(黄档)',
496
+ setNotifyMajorHint: '增删/重排任务时往队列插一条提醒,让模型先对齐板面;纯状态刷新不触发。',
480
497
  setSaved: '已保存',
481
498
  setFailed: '保存失败',
482
499
  setReadOnly: '当前 config 不可写',
@@ -677,6 +694,23 @@ window.__ModuleLoader__.load({
677
694
  setTodoReconcileMs: 'Reconcile min interval (ms)',
678
695
  setTodoThrottleMs: 'Mirror debounce (ms)',
679
696
  setTodoWriteNote: 'Write event: agent.session.append(\'todo/write\', { todos }) (read-only)',
697
+ setDlGroup: 'Downloads & step gloss',
698
+ setDlBadge: 'Awareness',
699
+ setDlHint: 'Download awareness stays soft (detect + nudge) and never blocks a tool; switching it off restores the pre-0.7 observer text verbatim.',
700
+ setDlEnabled: 'Enable download awareness',
701
+ setDlSubBar: 'Draw the download sub-bar under the mini bar',
702
+ setDlSubBarHint: 'Off stops emitting the download field in the snapshot. Without a real figure only the striped elapsed state shows — never a fake percentage.',
703
+ setDlBg: 'Badge background downloads',
704
+ setDlTtlMs: 'Download liveness window (ms)',
705
+ setGlossEnabled: 'Plain-language step gloss',
706
+ setGlossNarrate: 'Append one narration-discipline line (▸ action → purpose)',
707
+ setGlossMaxLen: 'Max gloss length (chars)',
708
+ setOpsGroup: 'LLM actions & queue notices',
709
+ setOpsBadge: 'Actions',
710
+ setOpsHint: 'Off collapses the sidebar “LLM actions” block: providers stop enumerating and refine/mutate/ask return 403. Validate is a zero-token local check and stays available.',
711
+ setOpsEnabled: 'Allow LLM board actions',
712
+ setNotifyMajor: 'Route structural changes into the input queue (yellow tier)',
713
+ setNotifyMajorHint: 'Inserts one queue message on add/remove/reorder so the model re-aligns the board; pure status refreshes never trigger it.',
680
714
  setSaved: 'Saved',
681
715
  setFailed: 'Save failed',
682
716
  setReadOnly: 'Current config is not writable',
@@ -1593,6 +1627,10 @@ window.__ModuleLoader__.load({
1593
1627
  return { response, body }
1594
1628
  }
1595
1629
 
1630
+ // ops 开关位的重探间隔:比快照轮询慢一档(省一次宿主 listProviders),
1631
+ // 但足够让设置页拨完开关后无需重挂载就跟上。
1632
+ const OPS_POLL_MS = 15000
1633
+
1596
1634
  async function fetchOpsProviders() {
1597
1635
  const response = await fetch(`${API}/ops/providers`, { method: 'GET', credentials: 'same-origin' })
1598
1636
  const body = await response.json().catch(() => null)
@@ -1635,23 +1673,38 @@ window.__ModuleLoader__.load({
1635
1673
  const [busy, setBusy] = useState('')
1636
1674
  const [out, setOut] = useState(null)
1637
1675
  const [off, setOff] = useState(false)
1676
+ const primed = useRef(false)
1638
1677
 
1678
+ // 开关位不能只信首帧:ops.enabled 是 volatile,设置页改完服务端立刻 403/放行,
1679
+ // 但客户端若在挂载前就拿到旧值,块会一直缺席(或一直留着)。因此按 OPS_POLL_MS
1680
+ // 重探一次,并只在首次探测时回填默认 provider/model,避免覆掉用户手选。
1639
1681
  useEffect(() => {
1640
1682
  let alive = true
1641
- fetchOpsProviders()
1642
- .then((data) => {
1643
- if (!alive) return
1644
- if (data.disabled) {
1645
- setOff(true)
1646
- return
1647
- }
1648
- setProviders(data.providers)
1649
- const d = data.default || {}
1650
- if (d.provider) setProvider(String(d.provider))
1651
- if (d.model) setModel(String(d.model))
1652
- })
1653
- .catch(() => {})
1654
- return () => { alive = false }
1683
+ const probe = () => {
1684
+ fetchOpsProviders()
1685
+ .then((data) => {
1686
+ if (!alive) return
1687
+ if (data.disabled) {
1688
+ setOff(true)
1689
+ return
1690
+ }
1691
+ // 改回开:块得自己回来,不能等重挂载。
1692
+ setOff(false)
1693
+ setProviders(data.providers)
1694
+ if (primed.current) return
1695
+ primed.current = true
1696
+ const d = data.default || {}
1697
+ if (d.provider) setProvider(String(d.provider))
1698
+ if (d.model) setModel(String(d.model))
1699
+ })
1700
+ .catch(() => {})
1701
+ }
1702
+ probe()
1703
+ const timer = setInterval(probe, OPS_POLL_MS)
1704
+ return () => {
1705
+ alive = false
1706
+ clearInterval(timer)
1707
+ }
1655
1708
  }, [sessionId])
1656
1709
 
1657
1710
  const active = providers.find((p) => p && p.id === provider) || null
@@ -2521,12 +2574,19 @@ window.__ModuleLoader__.load({
2521
2574
  const assistant = asObject(value.assistant)
2522
2575
  const observer = asObject(value.observer)
2523
2576
  const todo = asObject(value.todo)
2577
+ // v0.7.5:download/toolGloss/ops 三组也要能在设置卡里拨——此前只有
2578
+ // assistant/observer/todo 进了表单,导致 ops.enabled=false 这个整块开关
2579
+ // 没有用户可达的入口(宿主不会为外部插件另生成通用表单)。
2580
+ const download = asObject(value.download)
2581
+ const toolGloss = asObject(value.toolGloss)
2582
+ const ops = asObject(value.ops)
2583
+ const buckets = { assistant, observer, todo, download, toolGloss, ops }
2524
2584
 
2525
2585
  // 文本/数字走草稿(避免逐字符写盘),开关与分段直接落盘(即时生效)。
2526
2586
  const readField = (group, key, fallback) => {
2527
2587
  const bucket = draft[group]
2528
2588
  if (bucket && Object.prototype.hasOwnProperty.call(bucket, key)) return bucket[key]
2529
- const stored = (group === 'assistant' ? assistant : group === 'todo' ? todo : observer)[key]
2589
+ const stored = (buckets[group] || observer)[key]
2530
2590
  return stored === undefined || stored === null ? fallback : stored
2531
2591
  }
2532
2592
  const setDraftField = (group, key, v) => setDraft((prev) => ({ ...prev, [group]: { ...(prev[group] || {}), [key]: v } }))
@@ -2558,9 +2618,15 @@ window.__ModuleLoader__.load({
2558
2618
  const aKeys = dirtyKeys('assistant')
2559
2619
  const oKeys = dirtyKeys('observer')
2560
2620
  const todoKeys = dirtyKeys('todo')
2621
+ const dlKeys = dirtyKeys('download')
2622
+ const glossKeys = dirtyKeys('toolGloss')
2623
+ const opsKeys = dirtyKeys('ops')
2561
2624
  if (aKeys.length) await commit('assistant', { ...assistant, ...draft.assistant })
2562
2625
  if (oKeys.length) await commit('observer', { ...observer, ...draft.observer })
2563
2626
  if (todoKeys.length) await commit('todo', { ...todo, ...draft.todo })
2627
+ if (dlKeys.length) await commit('download', { ...download, ...draft.download })
2628
+ if (glossKeys.length) await commit('toolGloss', { ...toolGloss, ...draft.toolGloss })
2629
+ if (opsKeys.length) await commit('ops', { ...ops, ...draft.ops })
2564
2630
  setDraft({})
2565
2631
  }
2566
2632
 
@@ -2614,7 +2680,7 @@ window.__ModuleLoader__.load({
2614
2680
  },
2615
2681
  })
2616
2682
 
2617
- const hasDirty = dirtyKeys('assistant').length > 0 || dirtyKeys('observer').length > 0 || dirtyKeys('todo').length > 0 || Object.prototype.hasOwnProperty.call(draft, 'todoSync')
2683
+ const hasDirty = ['assistant', 'observer', 'todo', 'download', 'toolGloss', 'ops'].some((g) => dirtyKeys(g).length > 0) || Object.prototype.hasOwnProperty.call(draft, 'todoSync') || Object.prototype.hasOwnProperty.call(draft, 'notifyMajorChanges')
2618
2684
  const mode = readField('assistant', 'mode', '')
2619
2685
  const authority = readField('assistant', 'authority', 'both')
2620
2686
 
@@ -2655,6 +2721,28 @@ window.__ModuleLoader__.load({
2655
2721
  h(SettingsRow, { label: t('setAutoSyncThrottleMs') }, numberInput('observer', 'autoSyncThrottleMs', 60000, 1000, 'ms')),
2656
2722
  h(SettingsRow, { label: t('setMaxItems') }, numberInput('observer', 'maxItems', 12, 1, '项')),
2657
2723
  ),
2724
+ h(
2725
+ SettingsCard,
2726
+ { title: t('setDlGroup'), badge: t('setDlBadge'), hint: t('setDlHint'), defaultOpen: false },
2727
+ h(SettingsRow, { label: t('setDlEnabled') }, switchInput('download', download, 'enabled', true)),
2728
+ h(SettingsRow, { label: t('setDlSubBar'), hint: t('setDlSubBarHint') }, switchInput('download', download, 'showSubBar', true)),
2729
+ h(SettingsRow, { label: t('setDlBg') }, switchInput('download', download, 'markBackground', true)),
2730
+ h(SettingsRow, { label: t('setDlTtlMs') }, numberInput('download', 'ttlMs', 480000, 1000, 'ms')),
2731
+ h(SettingsRow, { label: t('setGlossEnabled') }, switchInput('toolGloss', toolGloss, 'enabled', true)),
2732
+ h(SettingsRow, { label: t('setGlossNarrate') }, switchInput('toolGloss', toolGloss, 'softNarrate', true)),
2733
+ h(SettingsRow, { label: t('setGlossMaxLen') }, numberInput('toolGloss', 'maxLen', 46, 1, '')),
2734
+ ),
2735
+ h(
2736
+ SettingsCard,
2737
+ { title: t('setOpsGroup'), badge: t('setOpsBadge'), hint: t('setOpsHint'), defaultOpen: false },
2738
+ h(SettingsRow, { label: t('setOpsEnabled') }, switchInput('ops', ops, 'enabled', true)),
2739
+ h(SettingsRow, { label: t('setNotifyMajor'), hint: t('setNotifyMajorHint') },
2740
+ h(SettingsSwitch, {
2741
+ checked: Object.prototype.hasOwnProperty.call(draft, 'notifyMajorChanges') ? draft.notifyMajorChanges : value.notifyMajorChanges !== false,
2742
+ disabled: !writable || busy,
2743
+ onChange: (v) => { setDraft((prev) => ({ ...prev, notifyMajorChanges: v })); void commit('notifyMajorChanges', v) },
2744
+ })),
2745
+ ),
2658
2746
  h(
2659
2747
  SettingsCard,
2660
2748
  { title: t('setTodoGroup'), badge: t('setTodoSync'), hint: t('setTodoHint'), defaultOpen: false },
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-progress-union",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "main": "./index.js",
5
5
  "description": "进度结合原型:board 槽位真相源(用户可编辑、diff+ack 增量同步、staleness nudge)× 鲸程时间引擎(step 计数、ETA 三档 board>todo>local>prior、悬浮迷你条),向压缩插件暴露只读三层进度锚点 progressAnchor(board 语义锚 + time 时间锚 + userEdits 未确认改动,service 与 HTTP 双平面),并在 0.6.0 起每回合落一版会话归档(handoff 规则摘要 + 重启注入一次)。",
6
6
  "engines": {
package/index.js CHANGED
@@ -173,11 +173,24 @@ export const inject = ['tools', 'systemPrompt', 'webServer', 'agents', 'commands
173
173
  // ============================================================================
174
174
 
175
175
  // 跑命令的工具名(跨宿主常见命名,大小写不敏感)。
176
- const SHELL_TOOL_NAMES = new Set(['bash', 'shell', 'terminal', 'terminal_send', 'terminal_exec', 'exec', 'execute', 'run', 'run_command', 'command', 'cmd'])
176
+ const SHELL_TOOL_NAMES = new Set(['bash', 'shell', 'terminal', 'terminal_send', 'terminal_exec', 'exec', 'execute', 'run', 'run_command', 'command', 'cmd', 'shell_exec', 'shell_run', 'run_shell', 'terminal_run'])
177
177
  // 本身就是「把东西拉到本地」语义的工具名(非 shell 通道)。
178
178
  const FETCH_TOOL_NAMES = new Set(['download', 'download_file', 'fetch_file', 'git_clone'])
179
179
  // 明确的后台执行器:走 shell 词表,但默认记为 background。
180
180
  const BACKGROUND_TOOL_NAMES = new Set(['background_exec', 'exec_background', 'shell_background', 'run_in_background', 'terminal_spawn'])
181
+ // 0.7.4 真机回灌:宿主会把「跑命令」的工具名直接报成解释器本身——Windows 上实测是
182
+ // `pwsh`(不是 `Bash`)。只列 bash/shell/terminal 家族的话 isShell=false,下载识别
183
+ // 与工序人话在第一道门就整体失效,UI 永远看不到子进度条。
184
+ const SHELL_INTERPRETERS = new Set(['sh', 'bash', 'zsh', 'ksh', 'dash', 'fish', 'nu', 'xonsh', 'busybox', 'pwsh', 'powershell', 'powershell_ise', 'cmd', 'command.com'])
185
+
186
+ /** 这个工具名是不是「跑一条命令」的通道(含后台执行器与解释器名形态)。 */
187
+ function isShellToolName(raw) {
188
+ const key = String(raw || '').toLowerCase()
189
+ if (!key) return false
190
+ if (SHELL_TOOL_NAMES.has(key) || BACKGROUND_TOOL_NAMES.has(key)) return true
191
+ const name = key.split(/[\\/]/).pop().replace(/\.(?:exe|cmd|bat|ps1)$/, '')
192
+ return SHELL_INTERPRETERS.has(name)
193
+ }
181
194
 
182
195
  // 包管理器 / 安装器的「动词」集合:只在这些动词后才是真正的下载/安装。
183
196
  // 排除 test/list/status/run/show/freeze —— 它们不产生网络拉取(误判会把每次 npm test 当下载)。
@@ -302,7 +315,7 @@ function classifyDownload(name, argsRaw) {
302
315
  return target ? { kind: 'download', target, background, command: '' } : null
303
316
  }
304
317
  // 后台执行器也是跑命令的通道,否则 `exec_background({command:'wget …'})` 会漏识别。
305
- const isShell = SHELL_TOOL_NAMES.has(toolKey) || BACKGROUND_TOOL_NAMES.has(toolKey)
318
+ const isShell = isShellToolName(toolKey)
306
319
  if (!isShell || !command) return null
307
320
 
308
321
  // 后台线索:独立的一个 &(两侧不是另一个 &,且自成一词)、nohup、--detach、> log &
@@ -584,7 +597,7 @@ function describeToolStep(name, argsRaw, maxLen) {
584
597
  try { const v = JSON.parse(String(u.argsRaw || '')); if (isObject(v)) o = v } catch (_err) {}
585
598
  const cap = Math.max(8, Number(maxLen) || 46)
586
599
  let out = ''
587
- if (SHELL_TOOL_NAMES.has(key) || BACKGROUND_TOOL_NAMES.has(key)) {
600
+ if (isShellToolName(key)) {
588
601
  const cmd = argText(o, ['command', 'cmd', 'input', 'text']) || (typeof u.argsRaw === 'string' ? u.argsRaw : '')
589
602
  out = glossCommand(cmd)
590
603
  } else if (FETCH_TOOL_NAMES.has(key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-progress-union",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "description": "进度结合原型:dsh-progress-board 槽位真相源 × 鲸程 widget 时间/ETA 引擎;向压缩插件暴露只读三层进度锚点(service + HTTP 双平面);0.6.0 起每回合落一版会话归档(handoff + 重启注入一次)。基于 l3j3y3/dsh-progress-board (MIT) 与 uuhihj/task-progress-bar dsh-progress-widget (MIT)。",
6
6
  "license": "MIT",
@@ -249,3 +249,36 @@ test('glossCommand:Windows 命令名给人话而不是退回 Bash×n', async (
249
249
  assert.match(glossCommand('Invoke-WebRequest -Uri https://x -OutFile y'), /下载文件/)
250
250
  assert.match(glossCommand('git.exe clone https://github.com/a/b'), /克隆|拉取/)
251
251
  })
252
+
253
+ // ── v0.7.4:工具名本身是解释器(宿主实测报成 `pwsh` 而不是 `Bash`)──
254
+ // 0.7.3 只修了命令词表,但 isShell 这道门在上一行就把整条判成非 shell,
255
+ // 所以下面这些形状在 0.7.3 上依旧全漏——这两个用例就是那次的真机回灌。
256
+ test('classifyDownload:工具名为 pwsh/powershell 时不再被 isShell 门拦下', () => {
257
+ const pwsh = (command) => ['pwsh', JSON.stringify({ command })]
258
+ const real = 'New-Item -ItemType Directory -Force -Path dl073 | Out-Null; curl.exe -L -o dl073/echarts.tgz http://registry.npmmirror.com/echarts/-/echarts-5.5.0.tgz'
259
+ const hit = classifyDownload(...pwsh(real))
260
+ assert.equal(hit?.kind, 'download', 'pwsh 工具名 + 分号后的 curl.exe 必须命中')
261
+ assert.equal(hit.target, 'echarts.tgz')
262
+
263
+ assert.equal(classifyDownload(...pwsh('wget https://example.com/a.bin')).kind, 'download')
264
+ const p2 = ['powershell', JSON.stringify({ command: 'Invoke-WebRequest -Uri https://example.com/files/big.iso -OutFile big.iso' })]
265
+ assert.equal(classifyDownload(...p2).target, 'big.iso')
266
+ const p3 = ['C:\\Program Files\\PowerShell\\7\\pwsh.exe', JSON.stringify({ command: 'git.exe clone https://github.com/a/b' })]
267
+ assert.equal(classifyDownload(...p3).kind, 'clone')
268
+ assert.equal(classifyDownload(...pwsh('npm install lodash')).kind, 'install')
269
+ })
270
+
271
+ test('classifyDownload:解释器名不得把非 shell 工具变成 shell', () => {
272
+ // read/search 这类工具名不在词表里,带了 command 字段也不许当下载通道。
273
+ assert.equal(classifyDownload('read_file', JSON.stringify({ command: 'curl -O https://x/a.bin' })), null)
274
+ assert.equal(classifyDownload('mcp__tools__fetch', JSON.stringify({ command: 'wget https://x/a.bin' })), null)
275
+ // 解释器名但拿不出命令文本 → 仍然 null,不臆造。
276
+ assert.equal(classifyDownload('pwsh', JSON.stringify({})), null)
277
+ })
278
+
279
+ test('describeToolStep:pwsh 工具名走 shell 分支而不是退回空串', async () => {
280
+ const { describeToolStep } = await import('../index.js')
281
+ const step = describeToolStep('pwsh', JSON.stringify({ command: 'New-Item -ItemType Directory -Force -Path d1 | Out-Null; curl.exe -L -o a.bin http://x/a.bin' }), 46)
282
+ assert.ok(step, 'pwsh 形态必须有人话')
283
+ assert.match(step, /建目录或文件|发 HTTP 请求|下载/)
284
+ })
@@ -51,6 +51,16 @@ test('Config:assistant / observer 的每个叶子都带 volatile(否则设
51
51
  'todoSync',
52
52
  'todo.maxReconcileIntervalMs',
53
53
  'todo.mirrorThrottleMs',
54
+ // v0.7.0 新增面:漏一个叶子就不会出现在宿主表单里,也不会热生效。
55
+ 'download.enabled',
56
+ 'download.ttlMs',
57
+ 'download.showSubBar',
58
+ 'download.markBackground',
59
+ 'toolGloss.enabled',
60
+ 'toolGloss.softNarrate',
61
+ 'toolGloss.maxLen',
62
+ 'notifyMajorChanges',
63
+ 'ops.enabled',
54
64
  ]
55
65
  for (const key of expected) {
56
66
  assert.ok(key in leaves, `缺少配置键 ${key}`)
@@ -79,4 +89,52 @@ test('客户端:设置卡双座位(settings.section + plugins.bundle.config
79
89
  assert.match(src, /function ProgressUnionSettings\(/, '设置卡组件必须在')
80
90
  assert.match(src, /scope\.subscribe/, '设置卡要订阅句柄快照')
81
91
  assert.match(src, /function ensureUnionSettingsStyle\(/, '样式要注入 document.head,否则设置页里裸奔')
92
+ })
93
+
94
+ /**
95
+ * v0.7.5 真机回灌:0.7.2 就把 ops.enabled 做成了「整块开关」,但设置卡只渲染
96
+ * assistant/observer/todo 三组——宿主不会为外部插件另生成通用表单,于是这个开关
97
+ * 根本没有用户可达的入口(实测:两个座位都是那 4 组 10 个控件,搜不到 ops)。
98
+ * download 组、toolGloss 组、notifyMajorChanges 同病。这里钉住「有 volatile 就必须有表单」。
99
+ */
100
+ test('设置卡:v0.7.0 四组开关真的有表单入口(不能只存 schema)', () => {
101
+ const file = fileURLToPath(new URL('../client.js', import.meta.url))
102
+ const src = fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n')
103
+ for (const call of [
104
+ "switchInput('download', download, 'enabled'",
105
+ "switchInput('download', download, 'showSubBar'",
106
+ "switchInput('download', download, 'markBackground'",
107
+ "numberInput('download', 'ttlMs'",
108
+ "switchInput('toolGloss', toolGloss, 'enabled'",
109
+ "switchInput('toolGloss', toolGloss, 'softNarrate'",
110
+ "numberInput('toolGloss', 'maxLen'",
111
+ "switchInput('ops', ops, 'enabled'",
112
+ "commit('notifyMajorChanges', v)",
113
+ ]) {
114
+ assert.ok(src.includes(call), `设置卡缺少表单接线:${call}`)
115
+ }
116
+ // 读值必须按组路由(旧实现写死三元,新组会全读到 observer 的桶里去)。
117
+ assert.match(src, /const buckets = \{ assistant, observer, todo, download, toolGloss, ops \}/, 'readField 需要组查表')
118
+ assert.match(src, /\(buckets\[group\] \|\| observer\)\[key\]/, 'readField 必须走组查表取值')
119
+ // 保存通道也得把新组写回去(不写 = 拨了开关但从未落盘,看着像“配置不下发”)。
120
+ for (const line of [
121
+ "await commit('download', { ...download, ...draft.download })",
122
+ "await commit('toolGloss', { ...toolGloss, ...draft.toolGloss })",
123
+ "await commit('ops', { ...ops, ...draft.ops })",
124
+ ]) {
125
+ assert.ok(src.includes(line), `flush() 未提交新组:${line}`)
126
+ }
127
+ // 双语齐(本插件只注册 zh/en,其余语种按设计回退英文)
128
+ assert.equal((src.match(/setOpsEnabled:/g) || []).length, 2, 'setOpsEnabled 需 zh/en 两份')
129
+ assert.equal((src.match(/setDlEnabled:/g) || []).length, 2, 'setDlEnabled 需 zh/en 两份')
130
+ })
131
+
132
+ test('ops 块开关位定期重探,不钉在首帧(热生效无需重挂载)', () => {
133
+ const file = fileURLToPath(new URL('../client.js', import.meta.url))
134
+ const src = fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n')
135
+ assert.match(src, /const OPS_POLL_MS = \d+/, '需要有重探间隔常量')
136
+ assert.match(src, /setInterval\(probe, OPS_POLL_MS\)/, '必须真的定时重探 providers 面')
137
+ assert.match(src, /if \(data\.disabled\) \{[\s\S]{0,80}?setOff\(true\)[\s\S]{0,40}?return[\s\S]{0,120}?setOff\(false\)/, '关掉要隐块,改回开要自动复现(不能只置 true)')
138
+ assert.match(src, /if \(primed\.current\) return/, '默认 provider/model 只在首次回填,不覆用户手选')
139
+ assert.match(src, /clearInterval\(timer\)/, '卸载必须收定时器')
82
140
  })