dsh-agent-control-center 0.4.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,85 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 — 2026-11-29
4
+
5
+ Two things the 0.5.0 report called out as still open: the Tools page first paint, and
6
+ proof that the write path actually writes correctly.
7
+
8
+ ### Changed
9
+
10
+ - **Tools first paint: 5.5 s → 90 ms.** The page now sends two parallel requests
11
+ instead of one: a registry-only `tools.list({includeHistory:false})` that paints
12
+ the list as soon as it arrives (~150 ms server-side), and the history-bearing
13
+ request whose result swaps in when it is ready (~4 s on 357 sessions). Until it
14
+ arrives the page says the call history is still loading instead of holding the
15
+ whole page. Measured with a MutationObserver (grid appeared 90 ms after the nav
16
+ click; history filled at 3,970 ms).
17
+ - A registry-only read must not touch sessions at all: new unit test asserts `listSessions`
18
+ throws and `readSession` is never called on that path.
19
+
20
+ ### Added
21
+
22
+ - `scripts/interaction-regression.py` — the 12-page interaction regression as a
23
+ repeatable script (`--token` / `--base` / `--out`), asserting one or two real
24
+ interactions per page (24 assertions).
25
+ - `scripts/write-regression.py` — the write-path end-to-end regression: save →
26
+ on-disk bytes → backup → stale-hash refusal → restore → exact original bytes.
27
+ It refuses to run on a missing file, so it can never create an instruction file.
28
+ - `docs/15-WRITE-REGRESSION.md` and `docs/16-TOOLS-FIRST-PAINT.md` record what was
29
+ measured, including the part that is **not** covered yet (browser-driven writes).
30
+
31
+ ### Verified
32
+
33
+ - 374 behaviour tests green; `verify: ok`.
34
+ - Write E2E **11/11** on `0.2.3-alpha.3`: 17,855-byte instruction file saved,
35
+ backed up, restored byte-identically (sha256 `4c5ad6e8…`), stale-hash write refused
36
+ with "disk not overwritten", repo left clean.
37
+ - Tools first paint 90 ms (was 4–5.5 s), history fills without blocking, 0 console
38
+ errors.
39
+
40
+ ## 0.5.0 — 2026-11-29
41
+
42
+ Closes the last gap in the v0.4 objective: the health module can now compare what
43
+ a profile declares with what the Loader is actually running.
44
+
45
+ ### Added
46
+
47
+ - **`health.drift()`** — declared-vs-running comparison built only from host
48
+ services: `pluginManager.listPlugins()` (enablement, fiber phase, startup
49
+ diagnostics), `configEditor.entries()` (which rows this profile's patch owns),
50
+ and `pluginManager.listBundles()` (bundles the profile asks for but the
51
+ installation cannot provide). Bundle inspection is opt-in (`includeBundles: true`)
52
+ because it walks every install location and costs seconds; the page turns it into
53
+ an explicit button.
54
+ * The patch file itself is never parsed: it may contain plugin secrets and the
55
+ read fence refuses it. The response states that instead of implying YAML was
56
+ read.
57
+ * `include:` entry-id prefixes are normalized before comparing with profile ids,
58
+ so a row is not reported as drift merely because the Loader and the patch name
59
+ it differently.
60
+ * Rows provided by a bundle or by the installation itself are counted
61
+ (`inProfileRows`) and explained in a note — they are normal, not drift.
62
+ * Drift kinds: `enabled-not-running`, `disabled-but-running`, `startup-failed`
63
+ (the only one that ranks `error`), `declared-not-installed`.
64
+ - **Health page drift block** with four tiles (plugin rows / addressable /
65
+ profile-owned / drift items), per-drift kind + detail + suggested action, a
66
+ bundle-check trigger, and the mandatory "the patch file is not parsed" note.
67
+ - `health.summary()` folds the drift counts in and ranks a failed plugin above
68
+ every warning.
69
+
70
+ ### Live findings on the acceptance profile
71
+
72
+ 225 plugin rows, 222 owned by the profile patch, 3 provided by bundles/installation;
73
+ with the bundle check enabled, two real drifts: `@deepseek-ai/dsh-subagent-claude-code`
74
+ and `@deepseek-ai/dsh-subagent-codex` are declared in the profile while the
75
+ installation reports `availability: missing`.
76
+
77
+ ### Tests
78
+
79
+ - 373 behaviour tests (365 → 373): eight for drift (clean profile, three drift
80
+ kinds, bundle accounting, `include:` normalization, missing services, throwing
81
+ manager). All green.
82
+
3
83
  ## 0.4.1 — 2026-11-29
4
84
 
5
85
  Compatibility release: DSH moved to `0.2.3-alpha.3` and renamed two host APIs the
package/README.md CHANGED
@@ -25,7 +25,7 @@ Screenshots live in `docs/assets/` and are excluded from the npm tarball.*
25
25
  ## Pages and status
26
26
 
27
27
  Runtime state comes from `GET /__agent-control-center/health`; the table records
28
- what the 0.4.1 acceptance run actually proved (details and evidence levels in
28
+ what the 0.6.0 acceptance run actually proved (details and evidence levels in
29
29
  [docs/05-ACCEPTANCE-EVIDENCE.md](docs/05-ACCEPTANCE-EVIDENCE.md)).
30
30
 
31
31
  | Page | What it gives you | State | Why / data source |
@@ -60,7 +60,7 @@ dsh plugin --profile web add dsh-agent-control-center
60
60
 
61
61
  # 2) from a packed tarball
62
62
  npm pack
63
- dsh plugin --profile web add ./dsh-agent-control-center-0.4.1.tgz
63
+ dsh plugin --profile web add ./dsh-agent-control-center-0.6.0.tgz
64
64
 
65
65
  # 3) from a local checkout
66
66
  dsh plugin --profile web add /absolute/path/to/dsh-agent-control-center
@@ -71,7 +71,7 @@ Then restart the Web GUI (the Host half mounts its HTTP route at boot) and open
71
71
 
72
72
  ```bash
73
73
  curl -s http://127.0.0.1:<gui-port>/__agent-control-center/health
74
- # → {"ok":true,"value":{"version":"0.4.1", …, "modules":[ … 12 entries … ]}}
74
+ # → {"ok":true,"value":{"version":"0.6.0", …, "modules":[ … 12 entries … ]}}
75
75
  ```
76
76
 
77
77
  Uninstall with `dsh plugin --profile web remove dsh-agent-control-center`.
@@ -230,7 +230,7 @@ version cannot land.
230
230
 
231
231
  | Item | Value |
232
232
  |---|---|
233
- | Plugin version | `0.4.1` |
233
+ | Plugin version | `0.6.0` |
234
234
  | DSH range | `>=0.2.1-rc.1 <0.3.0` (`engines.dsh` and `dsh.compatibility.dsh`) |
235
235
  | Verified against | DSH `0.2.2-rc.5` (web profile), Node `v24.22.2`, Linux x86_64 |
236
236
  | Node | `>=22.19` (CI: 22 and 24) |
package/README.zh.md CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  ## 页面与状态
19
19
 
20
- 运行期状态来自 `GET /__agent-control-center/health`;下表记录 0.4.1 验收实际证明了什么
20
+ 运行期状态来自 `GET /__agent-control-center/health`;下表记录 0.6.0 验收实际证明了什么
21
21
  (逐条证据与等级见 [docs/05-ACCEPTANCE-EVIDENCE.md](docs/05-ACCEPTANCE-EVIDENCE.md))。
22
22
 
23
23
  | 页面 | 提供什么 | 状态 | 依据 / 数据来源 |
@@ -49,7 +49,7 @@ dsh plugin --profile web add dsh-agent-control-center
49
49
 
50
50
  # 2) 从打包产物安装
51
51
  npm pack
52
- dsh plugin --profile web add ./dsh-agent-control-center-0.4.1.tgz
52
+ dsh plugin --profile web add ./dsh-agent-control-center-0.6.0.tgz
53
53
 
54
54
  # 3) 从本地 checkout 安装
55
55
  dsh plugin --profile web add /绝对路径/dsh-agent-control-center
@@ -60,7 +60,7 @@ dsh plugin --profile web add /绝对路径/dsh-agent-control-center
60
60
 
61
61
  ```bash
62
62
  curl -s http://127.0.0.1:<GUI端口>/__agent-control-center/health
63
- # → {"ok":true,"value":{"version":"0.4.1", …, "modules":[ … 12 项 … ]}}
63
+ # → {"ok":true,"value":{"version":"0.6.0", …, "modules":[ … 12 项 … ]}}
64
64
  ```
65
65
 
66
66
  卸载:`dsh plugin --profile web remove dsh-agent-control-center`。
@@ -174,7 +174,7 @@ node scripts/release.mjs patch|minor|major [--dry-run] [--notes "text"]
174
174
 
175
175
  | 项 | 值 |
176
176
  |---|---|
177
- | 插件版本 | `0.4.1` |
177
+ | 插件版本 | `0.6.0` |
178
178
  | 宿主区间 | `>=0.2.1-rc.1 <0.3.0`(`engines.dsh` 与 `dsh.compatibility.dsh`) |
179
179
  | 验证环境 | DSH `0.2.2-rc.5`(web profile)、Node `v24.22.2`、Linux x86_64 |
180
180
  | Node | `>=22.19`(CI:22 与 24) |
package/client.js CHANGED
@@ -1,12 +1,12 @@
1
1
  // Generated by scripts/build-client.mjs from src/client/ — do not edit.
2
- // DSH client module: dsh-agent-control-center@0.4.1 (13 i18n fragments, 12 pages)
2
+ // DSH client module: dsh-agent-control-center@0.6.0 (13 i18n fragments, 12 pages)
3
3
  window.__ModuleLoader__.load({
4
4
  id: "dsh-agent-control-center",
5
5
  factory(require) {
6
6
  'use strict'
7
7
  const React = require('react')
8
8
  const h = React.createElement
9
- const ACC_VERSION = "0.4.1"
9
+ const ACC_VERSION = "0.6.0"
10
10
  /* ---- kernel.js ---- */
11
11
  /* ---------------------------------------------------------------------------
12
12
  * ACC kernel — shared runtime attached to every page script.
@@ -1789,6 +1789,34 @@ ACC.addI18n({
1789
1789
  'health.refresh.plugins': '刷新插件清单',
1790
1790
  'health.refresh.settings': '刷新设置命名空间',
1791
1791
  'health.refresh.sections': '刷新分区扫描结果',
1792
+ 'health.driftTitle': '声明与运行时(漂移)',
1793
+ 'health.driftSubtitle': 'profile 声明的插件行与 Loader 实际运行状态;不解析 patch 文件本身',
1794
+ 'health.driftTileRows': '插件行',
1795
+ 'health.driftTileMounted': 'profile 可寻址',
1796
+ 'health.driftTileInProfile': 'profile 管辖',
1797
+ 'health.driftTileCount': '漂移项',
1798
+ 'health.driftClean': '无漂移',
1799
+ 'health.driftFound': '有漂移',
1800
+ 'health.driftSelf': '本插件行',
1801
+ 'health.driftSelfEnabled': '启用',
1802
+ 'health.driftYes': '是',
1803
+ 'health.driftEmpty': '声明的插件行都在运行状态,未发现漂移。',
1804
+ 'health.driftCheckBundles': '检查 bundle 安装状态',
1805
+ 'health.driftCheckBundlesHint': '会读取每个安装位置,通常需要数秒',
1806
+ 'health.driftNotes': '说明',
1807
+ 'health.driftKindLabel': '类型',
1808
+ 'health.driftKindUnknown': '未知漂移类型',
1809
+ 'health.driftKind.startup-failed': '启动失败',
1810
+ 'health.driftKind.enabled-not-running': '已启用但未运行',
1811
+ 'health.driftKind.disabled-but-running': '已停用但仍在运行',
1812
+ 'health.driftKind.addressable-not-in-profile': '可寻址但不在 profile',
1813
+ 'health.driftKind.declared-not-installed': '声明未安装',
1814
+ 'health.driftAction.startup-failed': '修好该插件的配置或依赖,然后在 DSH 原生插件页重载',
1815
+ 'health.driftAction.enabled-not-running': '确认该模块是否加载失败(看 Diagnostics),必要时重载 profile',
1816
+ 'health.driftAction.disabled-but-running': '重载 profile 才会真正卸载该行',
1817
+ 'health.driftAction.addressable-not-in-profile': '确认该行来自哪一层 patch(bundle/内置/include)',
1818
+ 'health.driftAction.declared-not-installed': '重新安装该 bundle,或从 profile 移除该行',
1819
+ 'health.refresh.drift': '刷新漂移对比',
1792
1820
  'health.refresh.compat': '刷新兼容性结论',
1793
1821
  'health.refresh.host': '刷新宿主通道',
1794
1822
 
@@ -1915,6 +1943,34 @@ ACC.addI18n({
1915
1943
  'health.refresh.plugins': 'Refresh plugin inventory',
1916
1944
  'health.refresh.settings': 'Refresh settings namespaces',
1917
1945
  'health.refresh.sections': 'Refresh section scan',
1946
+ 'health.driftTitle': 'Declared vs running (drift)',
1947
+ 'health.driftSubtitle': 'Plugin rows the profile declares against what the Loader actually runs; the patch file itself is not parsed',
1948
+ 'health.driftTileRows': 'Plugin rows',
1949
+ 'health.driftTileMounted': 'Addressable',
1950
+ 'health.driftTileInProfile': 'Profile-owned',
1951
+ 'health.driftTileCount': 'Drift items',
1952
+ 'health.driftClean': 'No drift',
1953
+ 'health.driftFound': 'Drift found',
1954
+ 'health.driftSelf': 'This plugin row',
1955
+ 'health.driftSelfEnabled': 'Enabled',
1956
+ 'health.driftYes': 'yes',
1957
+ 'health.driftEmpty': 'Every declared plugin row matches its running state.',
1958
+ 'health.driftCheckBundles': 'Check bundle installation',
1959
+ 'health.driftCheckBundlesHint': 'Reads every install location; usually takes seconds',
1960
+ 'health.driftNotes': 'Notes',
1961
+ 'health.driftKindLabel': 'Kind',
1962
+ 'health.driftKindUnknown': 'Unknown drift kind',
1963
+ 'health.driftKind.startup-failed': 'Startup failed',
1964
+ 'health.driftKind.enabled-not-running': 'Enabled but not running',
1965
+ 'health.driftKind.disabled-but-running': 'Disabled but still running',
1966
+ 'health.driftKind.addressable-not-in-profile': 'Addressable outside the profile',
1967
+ 'health.driftKind.declared-not-installed': 'Declared but not installed',
1968
+ 'health.driftAction.startup-failed': 'Fix that plugin configuration or dependency, then reload it from the native plugin page',
1969
+ 'health.driftAction.enabled-not-running': 'Check whether the module failed to load (Diagnostics) and reload the profile',
1970
+ 'health.driftAction.disabled-but-running': 'Reloading the profile is what actually unloads this row',
1971
+ 'health.driftAction.addressable-not-in-profile': 'Check which patch layer provides this row (bundle, built-in, include)',
1972
+ 'health.driftAction.declared-not-installed': 'Reinstall that bundle or remove the row from the profile',
1973
+ 'health.refresh.drift': 'Refresh drift comparison',
1918
1974
  'health.refresh.compat': 'Refresh compatibility verdict',
1919
1975
  'health.refresh.host': 'Refresh host channel',
1920
1976
 
@@ -3627,6 +3683,7 @@ ACC.addI18n({
3627
3683
  'tools.scanned': '已扫描会话',
3628
3684
  'tools.available': '可用',
3629
3685
  'tools.historyTruncated': '统计已截断',
3686
+ 'tools.historyLoading': '历史调用统计加载中:上面已是注册表实时结果,本块稍后填充(扫描会话需要数秒)',
3630
3687
  'tools.historyEmpty': '扫描窗口内没有任何工具调用记录',
3631
3688
  'tools.truncatedList': '清单已截断',
3632
3689
  'tools.calls': '调用次数',
@@ -3789,6 +3846,7 @@ ACC.addI18n({
3789
3846
  'tools.scanned': 'sessions scanned',
3790
3847
  'tools.available': 'Available',
3791
3848
  'tools.historyTruncated': 'statistics truncated',
3849
+ 'tools.historyLoading': 'Loading call history: the registry above is live; this block fills in after scanning sessions',
3792
3850
  'tools.historyEmpty': 'No tool call events in the scanned window',
3793
3851
  'tools.truncatedList': 'inventory truncated',
3794
3852
  'tools.calls': 'Calls',
@@ -6511,6 +6569,7 @@ ACC.l10n = (function createL10n() {
6511
6569
  const STACK_STYLE = { display: 'flex', flexDirection: 'column', gap: '8px' }
6512
6570
  const COLUMN_STYLE = { display: 'flex', flexDirection: 'column', gap: '2px' }
6513
6571
  const SMALL_STYLE = { fontSize: '11px' }
6572
+ const FLEX_WRAP_STYLE = { display: 'flex', flexWrap: 'wrap', gap: '8px' }
6514
6573
  const BREAK_STYLE = { wordBreak: 'break-word' }
6515
6574
  const EMPTY_VALUE = '—'
6516
6575
 
@@ -6519,6 +6578,9 @@ ACC.l10n = (function createL10n() {
6519
6578
  /** Anomaly kind → shared tone; `unaddressable` rows are usable, only uneditable. */
6520
6579
  const ANOMALY_TONE = { 'duplicate-module': 'warn', unaddressable: 'warn' }
6521
6580
  /** Summary section id → navigation copy. */
6581
+
6582
+ /** Drift kinds carry their own tone: a startup failure is red, the rest amber. */
6583
+ const DRIFT_TONE = { 'startup-failed': 'danger', 'enabled-not-running': 'warn', 'disabled-but-running': 'warn', 'addressable-not-in-profile': 'warn', 'declared-not-installed': 'warn' }
6522
6584
  const BLOCK_KEYS = {
6523
6585
  plugins: 'health.block.plugins',
6524
6586
  settings: 'health.block.settings',
@@ -6584,6 +6646,26 @@ ACC.l10n = (function createL10n() {
6584
6646
  return t('health.anomalyActionGeneric')
6585
6647
  }
6586
6648
 
6649
+ /** @param {string} kind @param {Function} t @returns {string} */
6650
+ function driftKindLabel(kind, t) {
6651
+ if (kind === 'startup-failed') return t('health.driftKind.startup-failed')
6652
+ if (kind === 'enabled-not-running') return t('health.driftKind.enabled-not-running')
6653
+ if (kind === 'disabled-but-running') return t('health.driftKind.disabled-but-running')
6654
+ if (kind === 'addressable-not-in-profile') return t('health.driftKind.addressable-not-in-profile')
6655
+ if (kind === 'declared-not-installed') return t('health.driftKind.declared-not-installed')
6656
+ return t('health.driftKindUnknown')
6657
+ }
6658
+
6659
+ /** @param {string} kind @param {Function} t @returns {string} */
6660
+ function driftAction(kind, t) {
6661
+ if (kind === 'startup-failed') return t('health.driftAction.startup-failed')
6662
+ if (kind === 'enabled-not-running') return t('health.driftAction.enabled-not-running')
6663
+ if (kind === 'disabled-but-running') return t('health.driftAction.disabled-but-running')
6664
+ if (kind === 'addressable-not-in-profile') return t('health.driftAction.addressable-not-in-profile')
6665
+ if (kind === 'declared-not-installed') return t('health.driftAction.declared-not-installed')
6666
+ return t('health.anomalyActionGeneric')
6667
+ }
6668
+
6587
6669
  /** @param {string} kind @param {Function} t @returns {string} */
6588
6670
  function conflictKindLabel(kind, t) {
6589
6671
  return kind === 'duplicate-id' ? t('health.conflictKind.duplicate-id') : t('health.conflictKindUnknown')
@@ -6844,6 +6926,128 @@ ACC.l10n = (function createL10n() {
6844
6926
  )
6845
6927
  }
6846
6928
 
6929
+ /** @param {{ t: Function, drift: any }} props */
6930
+ function DriftNotice(props) {
6931
+ const t = props.t
6932
+ const drift = isRecord(props.drift) ? props.drift : {}
6933
+ const kind = textOf(drift.kind)
6934
+ return h(
6935
+ C.Notice,
6936
+ { tone: DRIFT_TONE[kind] || 'warn' },
6937
+ h(
6938
+ 'div',
6939
+ { style: { ...COLUMN_STYLE, gap: '3px' } },
6940
+ h('span', null, h('strong', null, `${t('health.driftKindLabel')}: ${driftKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`)),
6941
+ textOf(drift.detail).length > 0 ? h('div', { style: BREAK_STYLE }, textOf(drift.detail)) : null,
6942
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.anomalySuggestion')}: ${driftAction(kind, t)}`),
6943
+ ),
6944
+ )
6945
+ }
6946
+
6947
+ /** @param {{ t: Function, data: any, onDeep?: Function, loading?: boolean }} props */
6948
+ function DriftBody(props) {
6949
+ const t = props.t
6950
+ const data = isRecord(props.data) ? props.data : {}
6951
+ const drifts = Array.isArray(data.drifts) ? data.drifts : []
6952
+ const notes = Array.isArray(data.notes) ? data.notes : []
6953
+ const rows = typeof data.rows === 'number' ? data.rows : (Array.isArray(data.rows) ? data.rows.length : null)
6954
+ const mounted = typeof data.mountedRows === 'number' ? data.mountedRows : null
6955
+ const inProfile = typeof data.inProfileRows === 'number' ? data.inProfileRows : null
6956
+ const self = isRecord(data.self) ? data.self : null
6957
+ const source = textOf(data.source)
6958
+ return h(
6959
+ 'div',
6960
+ { style: STACK_STYLE },
6961
+ h(
6962
+ 'div',
6963
+ { className: 'acc-row', style: FLEX_WRAP_STYLE },
6964
+ h(StatusTile, { label: t('health.driftTileRows'), value: countText(rows) }),
6965
+ h(StatusTile, { label: t('health.driftTileMounted'), value: countText(mounted) }),
6966
+ h(StatusTile, { label: t('health.driftTileInProfile'), value: countText(inProfile) }),
6967
+ h(StatusTile, {
6968
+ label: t('health.driftTileCount'),
6969
+ value: countText(drifts.length),
6970
+ hint: drifts.length === 0 ? h(C.Badge, { tone: 'success' }, t('health.driftClean')) : h(C.Badge, { tone: 'warn' }, t('health.driftFound')),
6971
+ }),
6972
+ ),
6973
+ self === null
6974
+ ? null
6975
+ : h(
6976
+ 'div',
6977
+ { className: 'acc-muted', style: SMALL_STYLE },
6978
+ `${t('health.driftSelf')}: ${textOf(self.entryId) || EMPTY_VALUE} · ${t('health.driftSelfEnabled')} ${self.enabled === true ? t('health.yes') : self.enabled === false ? t('health.no') : EMPTY_VALUE} · ${textOf(self.fiberPhase) || EMPTY_VALUE}`,
6979
+ ),
6980
+ h(
6981
+ 'div',
6982
+ { className: 'acc-row' },
6983
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.source')}:`),
6984
+ h(C.Mono, { text: source.length > 0 ? source : EMPTY_VALUE }),
6985
+ ),
6986
+ drifts.length === 0
6987
+ ? h(C.Notice, { tone: 'success' }, t('health.driftEmpty'))
6988
+ : h(
6989
+ 'div',
6990
+ { style: STACK_STYLE },
6991
+ drifts.map((drift, index) => h(DriftNotice, { key: `drift-${index}`, t, drift })),
6992
+ ),
6993
+ props.onDeep === undefined || data.bundlesChecked === true
6994
+ ? null
6995
+ : h(
6996
+ 'div',
6997
+ { className: 'acc-row', style: { justifyContent: 'flex-start' } },
6998
+ h(
6999
+ C.Btn,
7000
+ { tone: 'ghost', onClick: props.onDeep, disabled: props.loading === true, title: t('health.driftCheckBundlesHint') },
7001
+ props.loading === true ? t('health.refreshing') : t('health.driftCheckBundles'),
7002
+ ),
7003
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.driftCheckBundlesHint')),
7004
+ ),
7005
+ notes.length === 0
7006
+ ? null
7007
+ : h(
7008
+ 'div',
7009
+ { style: STACK_STYLE },
7010
+ h('div', { className: 'acc-section-title' }, t('health.driftNotes')),
7011
+ notes.map((note, index) =>
7012
+ h('div', { key: `note-${index}`, className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } }, String(note)),
7013
+ ),
7014
+ ),
7015
+ h(NoteLine, { t, text: data.note }),
7016
+ )
7017
+ }
7018
+
7019
+ /** @param {{ t: Function, gate: any, onGateRefresh: Function }} props */
7020
+ function DriftCard(props) {
7021
+ const t = props.t
7022
+ const gate = isRecord(props.gate) ? props.gate : {}
7023
+ const blocked = gate.available === false
7024
+ // Bundle inspection reads every install location and costs seconds, so it
7025
+ // is a deliberate extra step, not part of the first read.
7026
+ const [deep, setDeep] = ACC.useState(false)
7027
+ const state = ACC.useAsync(
7028
+ blocked
7029
+ ? gatedLoader(gate)
7030
+ : (context) => ACC.api('health.drift', deep ? { includeBundles: true } : {}, context),
7031
+ [deep],
7032
+ )
7033
+ return h(
7034
+ BlockCard,
7035
+ {
7036
+ t,
7037
+ title: t('health.driftTitle'),
7038
+ subtitle: t('health.driftSubtitle'),
7039
+ loading: state.status === 'loading',
7040
+ onRefresh: blocked ? props.onGateRefresh : state.reload,
7041
+ refreshLabel: t('health.refresh.drift'),
7042
+ },
7043
+ h(BlockContent, {
7044
+ t,
7045
+ state,
7046
+ render: (data) => h(DriftBody, { t, data, onDeep: () => setDeep(true), loading: state.status === 'loading' }),
7047
+ }),
7048
+ )
7049
+ }
7050
+
6847
7051
  /** @param {{ t: Function, anomaly: any }} props */
6848
7052
  function AnomalyNotice(props) {
6849
7053
  const t = props.t
@@ -7305,6 +7509,7 @@ ACC.l10n = (function createL10n() {
7305
7509
  h(PluginsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7306
7510
  h(SettingsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7307
7511
  h(SectionsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7512
+ h(DriftCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7308
7513
  h(CompatCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7309
7514
  )
7310
7515
  }
@@ -12247,11 +12452,21 @@ ACC.l10n = (function createL10n() {
12247
12452
  // One-shot bypass flags: the first load may use the cache, an explicit
12248
12453
  // Refresh must see fresh host state.
12249
12454
  const forceList = ACC.useRef(false)
12455
+ const forceHistory = ACC.useRef(false)
12250
12456
  const forceDetail = ACC.useRef(false)
12457
+ // The page paints from the registry view, which answers in well under a
12458
+ // second; the history fold scans sessions and takes seconds, so it is a
12459
+ // second request whose result swaps in when it arrives. Both start at once,
12460
+ // so waiting for the history never delays the first paint.
12251
12461
  const list = ACC.useAsync((context) => {
12252
12462
  const refresh = forceList.current
12253
12463
  forceList.current = false
12254
- return ACC.api('tools.list', { days, agentId: agentId.length > 0 ? agentId : undefined, includePresets: true, ...(refresh ? { refresh: true } : {}) }, context)
12464
+ return ACC.api('tools.list', { days, agentId: agentId.length > 0 ? agentId : undefined, includePresets: true, includeHistory: false, ...(refresh ? { refresh: true } : {}) }, context)
12465
+ }, [days, agentId])
12466
+ const historyLoad = ACC.useAsync((context) => {
12467
+ const refresh = forceHistory.current
12468
+ forceHistory.current = false
12469
+ return ACC.api('tools.list', { days, agentId: agentId.length > 0 ? agentId : undefined, includePresets: true, includeHistory: true, ...(refresh ? { refresh: true } : {}) }, context)
12255
12470
  }, [days, agentId])
12256
12471
  const detail = ACC.useAsync(
12257
12472
  (context) => {
@@ -12313,7 +12528,9 @@ ACC.l10n = (function createL10n() {
12313
12528
 
12314
12529
  if (list.status === 'loading') return h(C.Loading, { label: t('common.loading') })
12315
12530
  if (list.status === 'error') return h(C.ErrorBox, { error: list.error, onRetry: list.reload, label: t('tools.loadFailed') })
12316
- const data = list.data
12531
+ const data = historyLoad.status === 'ready' ? historyLoad.data : list.data
12532
+ // A history failure keeps the registry view usable and says why.
12533
+ const historyPending = historyLoad.status === 'loading'
12317
12534
  if (data.available === false) {
12318
12535
  return h(C.Empty, {
12319
12536
  title: t('tools.registryUnavailable'),
@@ -12352,8 +12569,10 @@ ACC.l10n = (function createL10n() {
12352
12569
  key: 'r',
12353
12570
  onClick: () => {
12354
12571
  forceList.current = true
12572
+ forceHistory.current = true
12355
12573
  if (selected.length > 0) forceDetail.current = true
12356
12574
  list.reload()
12575
+ historyLoad.reload()
12357
12576
  if (selected.length > 0) detail.reload()
12358
12577
  },
12359
12578
  ariaLabel: t('tools.refreshList'),
@@ -12436,7 +12655,9 @@ ACC.l10n = (function createL10n() {
12436
12655
  ),
12437
12656
  ),
12438
12657
  h(InfoPanel, { t, items: [t('tools.statusLegend'), t('tools.probeNotice'), t('tools.hostNotesFold')] }),
12439
- history.available === false
12658
+ historyPending
12659
+ ? h(C.Notice, { tone: 'info' }, t('tools.historyLoading'))
12660
+ : history.available === false
12440
12661
  ? h(
12441
12662
  'div',
12442
12663
  { className: 'acc-muted', style: { fontSize: '11px', display: 'flex', flexDirection: 'column', gap: '2px' } },
@@ -39,7 +39,7 @@ dsh-agent-control-center/
39
39
  | HTTP 前缀 | `/__agent-control-center`(GET `/health`,POST `/api`) |
40
40
  | 自有存储 | `$DSH_HOME/dsh-agent-control-center/` |
41
41
  | locale 命名空间 | `acc` |
42
- | 版本 | `0.4.1` |
42
+ | 版本 | `0.6.0` |
43
43
  | 兼容声明 | `dsh.compatibility.dsh = ">=0.2.1-rc.1 <0.3.0"`,`engines.dsh` 同区间 |
44
44
 
45
45
  `package.json` 关键字段(照抄,勿改语义):
@@ -363,3 +363,74 @@ curl -s http://127.0.0.1:38080/__agent-control-center/health
363
363
 
364
364
  - **Tools 首屏仍 5.5 s(冷)**:历史折叠默认扫 25 个会话、5 s 时间预算;热读 11 ms。下一步计划把历史统计拆成首屏后加载(页面先出注册表,历史徽标随后填充),而不是降低默认扫描上限。
365
365
  - `tools.schemas()` 在 0.2.3 不再公开,因此 `schemaProjection` 诊断项在新宿主上恒为 `available:false`(已标注原因,不影响工具清单与 schema 详情)。
366
+
367
+ ---
368
+
369
+ # 附:0.5.0 验收补充(2026-11-29,宿主 0.2.3-alpha.3)
370
+
371
+ 0.5.0 补齐 v0.4 目标的最后一项:**声明与运行时的漂移对比**。
372
+
373
+ ## 测试
374
+
375
+ - `node --test tests/*.test.mjs` → **373 / 373 pass**(0.4.1 为 365)。
376
+ - 新增 8 个 `health.drift` 用例:干净 profile、三种漂移类型、bundle 记账、
377
+ `include:` 前缀归一、服务缺失降级、manager 抛错兜底。
378
+ - 说明:整套测试在极端 CPU 争用下(同时构建客户端 + 跑浏览器)曾出现 1–2 个
379
+ 瞬时失败,随后连续 3 次全量重跑(每次约 2.8–3.0 s)均 373/373 通过。
380
+
381
+ ## 真机(隔离 profile `accverify`)
382
+
383
+ | 项 | 结果 |
384
+ |---|---|
385
+ | `health.drift`(默认,不查 bundle) | 225 行 / 222 行受 profile 管辖 / 3 行由 bundle 或安装自带 / 0 漂移;`self: {entryId:'include:agent-control-center', profileId:'agent-control-center', inProfile:true, enabled:true, fiberPhase:'active'}` |
386
+ | `health.drift({includeBundles:true})` | 6.6 s,新增 **2 条真实漂移**:`@deepseek-ai/dsh-subagent-claude-code`、`@deepseek-ai/dsh-subagent-codex` 在 profile 中声明但 `availability:'missing'` |
387
+ | `health.summary` | `drift:{rows:225, mounted:222, count:2}`;`worst:{severity:'warn',id:'plugins'}`;`compat:full` |
388
+
389
+ ## 未验证 / 已知限制
390
+
391
+ - 漂移对比**不解析 `cordis.patch.yml`**:该文件可能含插件密钥,围栏按设计拒绝。因此
392
+ 「声明」一侧来自 `pluginManager` 与 `configEditor` 的投影,无法覆盖「patch 里写了但
393
+ Loader 从未见过」的行(两类服务都看不到它们)。
394
+ - bundle 检查单次 6.6 s,因此默认关闭;页面用按钮显式触发。
395
+
396
+ ---
397
+
398
+ # 附:0.6.0 验收补充(2026-11-29,宿主 0.2.3-alpha.3)
399
+
400
+ 0.6.0 处理 0.5.0 报告里挂着的两项:Tools 首屏 5.5 s,以及写路径的端到端证据。
401
+
402
+ ## 测试
403
+
404
+ - `node --test tests/*.test.mjs` → **374 / 374 pass**(0.5.0 为 373)。
405
+ - 新增 1 个契约用例:注册表视图(`includeHistory:false`)**完全不读会话**——
406
+ 让 `listSessions` 直接抛错并断言 `readSession` 零调用。
407
+
408
+ ## Tools 首屏(真机,357 个会话)
409
+
410
+ | 指标 | 改前 | 改后 |
411
+ |---|---|---|
412
+ | 首屏出现工具行 | 5,561 ms(接受脚本)/ 4,125 ms(轮询测量) | **90 ms**(MutationObserver) |
413
+ | 历史块填充 | 阻塞首屏 | 3,970 ms,不阻塞 |
414
+
415
+ 浏览器侧 0 console error;历史未到达时显示「历史调用统计加载中」而不是整页 Loading。
416
+
417
+ ## 写路径 E2E(真机,脚本 `scripts/write-regression.py`)
418
+
419
+ `11 / 11` 通过,目标为 17,855 字节的既有指令文件:
420
+
421
+ - 保存接受 → 磁盘内容**逐字节**等于提交内容;备份 3 → 4 条;
422
+ - 过期 `expectedHash` 再次保存被拒(`conflict`,提示「磁盘未被覆盖」);
423
+ - 从最新备份恢复 → 17,855 字节、sha256 回到 `4c5ad6e8…`;恢复自身也留下备份;
424
+ - 结束后仓库 `git status` 干净、sha256 与测试前一致。
425
+
426
+ ## 交互回归脚本化
427
+
428
+ `scripts/interaction-regression.py` 固化 12 页 24 条断言(`--token/--base/--out`),
429
+ 0.5.0 的成绩 24/24 可用该脚本复跑;它不进 `verify.mjs`(需要 Playwright + 运行中的宿主)。
430
+
431
+ ## 未验证 / 已知限制
432
+
433
+ - **浏览器驱动的写路径尚未覆盖**:UI 编辑器展示的是组装后视图(实测 41,104 字符 ≠ 文件 17,855 字节),
434
+ 按原文 hash 比对必然失败;这一轮只做到 API 级 E2E。详见 `docs/15-WRITE-REGRESSION.md`。
435
+ - 写路径要求目标是**会话工作目录内的既有指令文件**;`/tmp` fixture 不是会话 cwd 时写入会被拒(既有边界)。
436
+ - Tools 历史块仍需 3.9–5.4 s(冷);本轮只解决了「不阻塞首屏」,没有降低扫描成本。
package/docs/07-GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 用户指南:从「我想做什么」出发
2
2
 
3
- > 适用版本 **0.4.1**,目标宿主 DSH **0.2.2-rc.5**(兼容区间 `>=0.2.1-rc.1 <0.3.0`)。
3
+ > 适用版本 **0.6.0**,目标宿主 DSH **0.2.2-rc.5**(兼容区间 `>=0.2.1-rc.1 <0.3.0`)。
4
4
  > 本文按**任务**组织,只描述本插件在真实界面上能做什么、失败时看到什么、提示是什么意思。
5
5
  > 安装、权限边界、配置字段和刻意限制见 [README.zh.md](../README.zh.md);
6
6
  > 内部实现(模块、请求流、存储、扩展点)见 [09-ARCHITECTURE.md](09-ARCHITECTURE.md);
@@ -42,7 +42,7 @@ DSH Web GUI (browser)
42
42
 
43
43
  ### 2.1 入口 `index.js`
44
44
 
45
- - 导出:`name`、`VERSION`(`0.4.1`,与 `package.json` 同步)、`HTTP_PREFIX`(`/__agent-control-center`)、`inject = []`、`apply(ctx, rawConfig)`。
45
+ - 导出:`name`、`VERSION`(`0.6.0`,与 `package.json` 同步)、`HTTP_PREFIX`(`/__agent-control-center`)、`inject = []`、`apply(ctx, rawConfig)`。
46
46
  - `inject = []` 是硬约束:**任何宿主服务缺失都不阻止插件激活**,只让对应模块降级为 PARTIAL/BLOCKED。
47
47
  - 启动序列(`apply`):
48
48
  1. `normalizeConfig(rawConfig)`:未知字段/类型错误/越界 → **加载期直接抛错**(fail loud,不做静默兜底);
@@ -24,13 +24,30 @@
24
24
 
25
25
  **局限必须记住**:静态扫描只覆盖构建产物里的字面量,运行时动态生成 id 的插件会漏检;本插件自己的 bundle 若以 `link:` 安装在 `$DSH_HOME` 之外(被路径围栏拒绝读取),则改用插件内常量 `agent-control-center` 补一行并标 `scanned:false`。
26
26
 
27
+ ## 声明 vs 运行时(漂移)
28
+
29
+ `health.drift()` 比较 **profile 声明的插件行** 与 **Loader 实际运行状态**,证据来自两个宿主服务:
30
+
31
+ | 证据 | 服务 | 能证明什么 |
32
+ |---|---|---|
33
+ | 每行是否启用、运行时相位、启动错误 | `pluginManager.listPlugins()` | 声明为启用却不在 `active`、声明停用却仍在跑、启动失败 |
34
+ | 哪些行能被 profile patch 寻址 | `configEditor.entries()` | 行是否受本 profile 的 patch 管辖(`include:` 前缀会被归一) |
35
+ | 声明了但装不上的 bundle | `pluginManager.listBundles()` | `availability:'missing'` 的 bundle |
36
+
37
+ **不解析 `cordis.patch.yml`**:该文件可能含插件密钥,路径围栏按设计拒绝读取。因此「声明」一侧取自上面两个服务的投影,响应里的 `note` 明说这一点,不会假装读到了 YAML。
38
+
39
+ 漂移类型:`enabled-not-running`、`disabled-but-running`、`startup-failed`(唯一映射到 `error` 级)、`declared-not-installed`。bundle 检查需要显式 `includeBundles:true`(读取每个安装位置要数秒,页面把它做成一个按钮)。
40
+
41
+ 真机(0.2.3-alpha.3,2026-11-29):225 行 / 222 行受 profile 管辖 / 3 行由 bundle 或安装自带提供;开启 bundle 检查后发现 **2 条真实漂移**:`@deepseek-ai/dsh-subagent-claude-code` 与 `@deepseek-ai/dsh-subagent-codex` 声明在 profile 里但安装目录中不存在(`availability=missing`)。
42
+
27
43
  ## API
28
44
 
29
45
  - `health.plugins()` → `{available, source:'pluginManager', items:[{entryId,moduleName,patchId,readOnlyReason}], anomalies:[{kind,detail}]}`
30
46
  - `health.settings()` → `{available, namespaces:[{ns,revision,autoGenerate,hasValue,secretKeys}], own:{ns:'acc',declared,enabled}, redactionVerified, note}`
31
47
  - `health.sections()` → `{available, method:'static-scan', scanned:{packages,files}, sections:[{id,owner,file}], conflicts:[{kind,id,owners,suggestion}], own, note}`
32
48
  - `health.compat()` → `{available, level, version, readOnly, reasons, source}`
33
- - `health.summary()` → `{generatedAt, plugins:{total,anomalies}, settings:{...}, sections:{count,conflicts}, compat:{level,readOnly}, worst:{severity,id}}`
49
+ - `health.drift()` → `{available, rows:[{entryId,moduleName,enabled,fiberPhase,addressable,inProfile}], mountedRows, inProfileRows, bundlesChecked, self, drifts:[{kind,id,detail,suggestion}], notes, note}`
50
+ - `health.summary()` → `{generatedAt, plugins:{total,anomalies}, settings:{...}, sections:{count,conflicts}, drift:{rows,mounted,count}, compat:{level,readOnly}, worst:{severity,id}}`
34
51
 
35
52
  ## 真机观察(accverify,2026-11-29,12 模块)
36
53