dsh-agent-control-center 0.4.0 → 0.5.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,89 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 — 2026-11-29
4
+
5
+ Closes the last gap in the v0.4 objective: the health module can now compare what
6
+ a profile declares with what the Loader is actually running.
7
+
8
+ ### Added
9
+
10
+ - **`health.drift()`** — declared-vs-running comparison built only from host
11
+ services: `pluginManager.listPlugins()` (enablement, fiber phase, startup
12
+ diagnostics), `configEditor.entries()` (which rows this profile's patch owns),
13
+ and `pluginManager.listBundles()` (bundles the profile asks for but the
14
+ installation cannot provide). Bundle inspection is opt-in (`includeBundles: true`)
15
+ because it walks every install location and costs seconds; the page turns it into
16
+ an explicit button.
17
+ * The patch file itself is never parsed: it may contain plugin secrets and the
18
+ read fence refuses it. The response states that instead of implying YAML was
19
+ read.
20
+ * `include:` entry-id prefixes are normalized before comparing with profile ids,
21
+ so a row is not reported as drift merely because the Loader and the patch name
22
+ it differently.
23
+ * Rows provided by a bundle or by the installation itself are counted
24
+ (`inProfileRows`) and explained in a note — they are normal, not drift.
25
+ * Drift kinds: `enabled-not-running`, `disabled-but-running`, `startup-failed`
26
+ (the only one that ranks `error`), `declared-not-installed`.
27
+ - **Health page drift block** with four tiles (plugin rows / addressable /
28
+ profile-owned / drift items), per-drift kind + detail + suggested action, a
29
+ bundle-check trigger, and the mandatory "the patch file is not parsed" note.
30
+ - `health.summary()` folds the drift counts in and ranks a failed plugin above
31
+ every warning.
32
+
33
+ ### Live findings on the acceptance profile
34
+
35
+ 225 plugin rows, 222 owned by the profile patch, 3 provided by bundles/installation;
36
+ with the bundle check enabled, two real drifts: `@deepseek-ai/dsh-subagent-claude-code`
37
+ and `@deepseek-ai/dsh-subagent-codex` are declared in the profile while the
38
+ installation reports `availability: missing`.
39
+
40
+ ### Tests
41
+
42
+ - 373 behaviour tests (365 → 373): eight for drift (clean profile, three drift
43
+ kinds, bundle accounting, `include:` normalization, missing services, throwing
44
+ manager). All green.
45
+
46
+ ## 0.4.1 — 2026-11-29
47
+
48
+ Compatibility release: DSH moved to `0.2.3-alpha.3` and renamed two host APIs the
49
+ plugin reads. Both are adapted, and that version is now a measured baseline.
50
+
51
+ ### Fixed
52
+
53
+ - **Tools registry rename**: 0.2.3 replaced `tools.definitions(scope)` /
54
+ `tools.schemas(scope)` with `getAll(scope)` / `get(name, scope)`. Module B (Tools)
55
+ and module E (Agent info) read the registry through `lib/core/tools-view.js`, and
56
+ the capability table accepts either complete method family, so `tools` is FULL on
57
+ both hosts instead of BLOCKED on the new one. `schemas()` disappearing now only
58
+ degrades the model-projection diagnostic.
59
+ - **Connection admission rename**: 0.2.2 exposed `connection.requestRejection()`;
60
+ 0.2.3 exposes `connection.admit()`, answering `{ rejection }` or `{ peer }`.
61
+ `lib/core/http.js` reads both, and `connection` counts as present under either.
62
+ - **`tools.detail` on scoped tools**: a name registered only in an Agent or preset
63
+ view used to report "the registry has no such name" while the same row said
64
+ registered + visible. The definition is now read from the scoped view and
65
+ `schemaSource`/`definitionAvailable` state where it came from.
66
+ - **Escape closed the Settings dialog**: pressing Escape while a tool row was
67
+ expanded (or while the search box held focus) closed the whole panel. The page
68
+ now consumes the Escape gesture in a window-capture listener, collapses the row
69
+ or clears the query, and leaves the dialog open.
70
+ - `MAX_TESTED` compared versions before the version parser was initialised; it now
71
+ computes after `compareVersions`, which the second `TESTED` entry exposed.
72
+
73
+ ### Changed
74
+
75
+ - `TESTED` now lists `0.2.2-rc.5` and `0.2.3-alpha.3`; `evaluate()` reports
76
+ `level: full`, `tested: true` on the new host (21/21 capabilities present,
77
+ 12 modules: 11 FULL + `recovery` PARTIAL by design).
78
+ - Tools history folds are shared between `summary` / `list` / `detail` with a
79
+ 60-second memo (`refresh: true` forces a re-read, `history.cached` reports
80
+ freshness). Repeat reads of the Tools page drop from ~5.4 s to milliseconds.
81
+
82
+ ### Tests
83
+
84
+ - 365 behaviour tests (361 → 365); live acceptance on `0.2.3-alpha.3`: 19/19
85
+ browser checks, 0 console errors, 12 pages.
86
+
3
87
  ## 0.4.0 — 2026-11-29
4
88
 
5
89
  Verified against DSH `0.2.2-rc.5` on an isolated profile. This release makes 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.0 acceptance run actually proved (details and evidence levels in
28
+ what the 0.5.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.0.tgz
63
+ dsh plugin --profile web add ./dsh-agent-control-center-0.5.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.0", …, "modules":[ … 12 entries … ]}}
74
+ # → {"ok":true,"value":{"version":"0.5.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.0` |
233
+ | Plugin version | `0.5.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.0 验收实际证明了什么
20
+ 运行期状态来自 `GET /__agent-control-center/health`;下表记录 0.5.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.0.tgz
52
+ dsh plugin --profile web add ./dsh-agent-control-center-0.5.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.0", …, "modules":[ … 12 项 … ]}}
63
+ # → {"ok":true,"value":{"version":"0.5.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.0` |
177
+ | 插件版本 | `0.5.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.0 (13 i18n fragments, 12 pages)
2
+ // DSH client module: dsh-agent-control-center@0.5.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.0"
9
+ const ACC_VERSION = "0.5.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
 
@@ -6511,6 +6567,7 @@ ACC.l10n = (function createL10n() {
6511
6567
  const STACK_STYLE = { display: 'flex', flexDirection: 'column', gap: '8px' }
6512
6568
  const COLUMN_STYLE = { display: 'flex', flexDirection: 'column', gap: '2px' }
6513
6569
  const SMALL_STYLE = { fontSize: '11px' }
6570
+ const FLEX_WRAP_STYLE = { display: 'flex', flexWrap: 'wrap', gap: '8px' }
6514
6571
  const BREAK_STYLE = { wordBreak: 'break-word' }
6515
6572
  const EMPTY_VALUE = '—'
6516
6573
 
@@ -6519,6 +6576,9 @@ ACC.l10n = (function createL10n() {
6519
6576
  /** Anomaly kind → shared tone; `unaddressable` rows are usable, only uneditable. */
6520
6577
  const ANOMALY_TONE = { 'duplicate-module': 'warn', unaddressable: 'warn' }
6521
6578
  /** Summary section id → navigation copy. */
6579
+
6580
+ /** Drift kinds carry their own tone: a startup failure is red, the rest amber. */
6581
+ const DRIFT_TONE = { 'startup-failed': 'danger', 'enabled-not-running': 'warn', 'disabled-but-running': 'warn', 'addressable-not-in-profile': 'warn', 'declared-not-installed': 'warn' }
6522
6582
  const BLOCK_KEYS = {
6523
6583
  plugins: 'health.block.plugins',
6524
6584
  settings: 'health.block.settings',
@@ -6584,6 +6644,26 @@ ACC.l10n = (function createL10n() {
6584
6644
  return t('health.anomalyActionGeneric')
6585
6645
  }
6586
6646
 
6647
+ /** @param {string} kind @param {Function} t @returns {string} */
6648
+ function driftKindLabel(kind, t) {
6649
+ if (kind === 'startup-failed') return t('health.driftKind.startup-failed')
6650
+ if (kind === 'enabled-not-running') return t('health.driftKind.enabled-not-running')
6651
+ if (kind === 'disabled-but-running') return t('health.driftKind.disabled-but-running')
6652
+ if (kind === 'addressable-not-in-profile') return t('health.driftKind.addressable-not-in-profile')
6653
+ if (kind === 'declared-not-installed') return t('health.driftKind.declared-not-installed')
6654
+ return t('health.driftKindUnknown')
6655
+ }
6656
+
6657
+ /** @param {string} kind @param {Function} t @returns {string} */
6658
+ function driftAction(kind, t) {
6659
+ if (kind === 'startup-failed') return t('health.driftAction.startup-failed')
6660
+ if (kind === 'enabled-not-running') return t('health.driftAction.enabled-not-running')
6661
+ if (kind === 'disabled-but-running') return t('health.driftAction.disabled-but-running')
6662
+ if (kind === 'addressable-not-in-profile') return t('health.driftAction.addressable-not-in-profile')
6663
+ if (kind === 'declared-not-installed') return t('health.driftAction.declared-not-installed')
6664
+ return t('health.anomalyActionGeneric')
6665
+ }
6666
+
6587
6667
  /** @param {string} kind @param {Function} t @returns {string} */
6588
6668
  function conflictKindLabel(kind, t) {
6589
6669
  return kind === 'duplicate-id' ? t('health.conflictKind.duplicate-id') : t('health.conflictKindUnknown')
@@ -6844,6 +6924,128 @@ ACC.l10n = (function createL10n() {
6844
6924
  )
6845
6925
  }
6846
6926
 
6927
+ /** @param {{ t: Function, drift: any }} props */
6928
+ function DriftNotice(props) {
6929
+ const t = props.t
6930
+ const drift = isRecord(props.drift) ? props.drift : {}
6931
+ const kind = textOf(drift.kind)
6932
+ return h(
6933
+ C.Notice,
6934
+ { tone: DRIFT_TONE[kind] || 'warn' },
6935
+ h(
6936
+ 'div',
6937
+ { style: { ...COLUMN_STYLE, gap: '3px' } },
6938
+ h('span', null, h('strong', null, `${t('health.driftKindLabel')}: ${driftKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`)),
6939
+ textOf(drift.detail).length > 0 ? h('div', { style: BREAK_STYLE }, textOf(drift.detail)) : null,
6940
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.anomalySuggestion')}: ${driftAction(kind, t)}`),
6941
+ ),
6942
+ )
6943
+ }
6944
+
6945
+ /** @param {{ t: Function, data: any, onDeep?: Function, loading?: boolean }} props */
6946
+ function DriftBody(props) {
6947
+ const t = props.t
6948
+ const data = isRecord(props.data) ? props.data : {}
6949
+ const drifts = Array.isArray(data.drifts) ? data.drifts : []
6950
+ const notes = Array.isArray(data.notes) ? data.notes : []
6951
+ const rows = typeof data.rows === 'number' ? data.rows : (Array.isArray(data.rows) ? data.rows.length : null)
6952
+ const mounted = typeof data.mountedRows === 'number' ? data.mountedRows : null
6953
+ const inProfile = typeof data.inProfileRows === 'number' ? data.inProfileRows : null
6954
+ const self = isRecord(data.self) ? data.self : null
6955
+ const source = textOf(data.source)
6956
+ return h(
6957
+ 'div',
6958
+ { style: STACK_STYLE },
6959
+ h(
6960
+ 'div',
6961
+ { className: 'acc-row', style: FLEX_WRAP_STYLE },
6962
+ h(StatusTile, { label: t('health.driftTileRows'), value: countText(rows) }),
6963
+ h(StatusTile, { label: t('health.driftTileMounted'), value: countText(mounted) }),
6964
+ h(StatusTile, { label: t('health.driftTileInProfile'), value: countText(inProfile) }),
6965
+ h(StatusTile, {
6966
+ label: t('health.driftTileCount'),
6967
+ value: countText(drifts.length),
6968
+ hint: drifts.length === 0 ? h(C.Badge, { tone: 'success' }, t('health.driftClean')) : h(C.Badge, { tone: 'warn' }, t('health.driftFound')),
6969
+ }),
6970
+ ),
6971
+ self === null
6972
+ ? null
6973
+ : h(
6974
+ 'div',
6975
+ { className: 'acc-muted', style: SMALL_STYLE },
6976
+ `${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}`,
6977
+ ),
6978
+ h(
6979
+ 'div',
6980
+ { className: 'acc-row' },
6981
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.source')}:`),
6982
+ h(C.Mono, { text: source.length > 0 ? source : EMPTY_VALUE }),
6983
+ ),
6984
+ drifts.length === 0
6985
+ ? h(C.Notice, { tone: 'success' }, t('health.driftEmpty'))
6986
+ : h(
6987
+ 'div',
6988
+ { style: STACK_STYLE },
6989
+ drifts.map((drift, index) => h(DriftNotice, { key: `drift-${index}`, t, drift })),
6990
+ ),
6991
+ props.onDeep === undefined || data.bundlesChecked === true
6992
+ ? null
6993
+ : h(
6994
+ 'div',
6995
+ { className: 'acc-row', style: { justifyContent: 'flex-start' } },
6996
+ h(
6997
+ C.Btn,
6998
+ { tone: 'ghost', onClick: props.onDeep, disabled: props.loading === true, title: t('health.driftCheckBundlesHint') },
6999
+ props.loading === true ? t('health.refreshing') : t('health.driftCheckBundles'),
7000
+ ),
7001
+ h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.driftCheckBundlesHint')),
7002
+ ),
7003
+ notes.length === 0
7004
+ ? null
7005
+ : h(
7006
+ 'div',
7007
+ { style: STACK_STYLE },
7008
+ h('div', { className: 'acc-section-title' }, t('health.driftNotes')),
7009
+ notes.map((note, index) =>
7010
+ h('div', { key: `note-${index}`, className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } }, String(note)),
7011
+ ),
7012
+ ),
7013
+ h(NoteLine, { t, text: data.note }),
7014
+ )
7015
+ }
7016
+
7017
+ /** @param {{ t: Function, gate: any, onGateRefresh: Function }} props */
7018
+ function DriftCard(props) {
7019
+ const t = props.t
7020
+ const gate = isRecord(props.gate) ? props.gate : {}
7021
+ const blocked = gate.available === false
7022
+ // Bundle inspection reads every install location and costs seconds, so it
7023
+ // is a deliberate extra step, not part of the first read.
7024
+ const [deep, setDeep] = ACC.useState(false)
7025
+ const state = ACC.useAsync(
7026
+ blocked
7027
+ ? gatedLoader(gate)
7028
+ : (context) => ACC.api('health.drift', deep ? { includeBundles: true } : {}, context),
7029
+ [deep],
7030
+ )
7031
+ return h(
7032
+ BlockCard,
7033
+ {
7034
+ t,
7035
+ title: t('health.driftTitle'),
7036
+ subtitle: t('health.driftSubtitle'),
7037
+ loading: state.status === 'loading',
7038
+ onRefresh: blocked ? props.onGateRefresh : state.reload,
7039
+ refreshLabel: t('health.refresh.drift'),
7040
+ },
7041
+ h(BlockContent, {
7042
+ t,
7043
+ state,
7044
+ render: (data) => h(DriftBody, { t, data, onDeep: () => setDeep(true), loading: state.status === 'loading' }),
7045
+ }),
7046
+ )
7047
+ }
7048
+
6847
7049
  /** @param {{ t: Function, anomaly: any }} props */
6848
7050
  function AnomalyNotice(props) {
6849
7051
  const t = props.t
@@ -7305,6 +7507,7 @@ ACC.l10n = (function createL10n() {
7305
7507
  h(PluginsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7306
7508
  h(SettingsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7307
7509
  h(SectionsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7510
+ h(DriftCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7308
7511
  h(CompatCard, { t, gate: gateView, onGateRefresh: gate.reload }),
7309
7512
  )
7310
7513
  }
@@ -11949,20 +12152,6 @@ ACC.l10n = (function createL10n() {
11949
12152
  return h(C.Btn, { tone: 'ghost', onClick: copy, title: label, 'aria-live': 'polite' }, label)
11950
12153
  }
11951
12154
 
11952
- /** Esc collapses the open detail panel while it is open. */
11953
- function useEscape(active, onEscape) {
11954
- ACC.useEffect(() => {
11955
- if (!active) return undefined
11956
- const handler = (event) => {
11957
- if (event.key !== 'Escape') return
11958
- event.stopPropagation()
11959
- onEscape()
11960
- }
11961
- document.addEventListener('keydown', handler)
11962
- return () => document.removeEventListener('keydown', handler)
11963
- }, [active, onEscape])
11964
- }
11965
-
11966
12155
  /** @param {{ value: unknown, onOpen: Function, t: Function }} props */
11967
12156
  function SourceBadge(props) {
11968
12157
  const source = props.value || {}
@@ -12277,7 +12466,42 @@ ACC.l10n = (function createL10n() {
12277
12466
  [selected, days, agentId],
12278
12467
  )
12279
12468
 
12280
- useEscape(selected.length > 0, ACC.useCallback(() => setSelected(''), []))
12469
+ // Escape closes the host Settings dialog. Local state (an open detail row or a
12470
+ // non-empty search) must consume the key first: a capture-phase listener runs
12471
+ // before the host's document-level handler, and stopPropagation keeps it from
12472
+ // reaching the dialog.
12473
+ ACC.useEffect(() => {
12474
+ // The host may close the Settings dialog from any of the three key events
12475
+ // at any level, so the whole Escape gesture is consumed here: keydown
12476
+ // decides whether the page owns it, keypress/keyup follow for the same
12477
+ // gesture so a later phase cannot reopen the dialog's close path.
12478
+ let ownedByPage = false
12479
+ const handler = (event) => {
12480
+ if (event.key !== 'Escape') return
12481
+ const input = searchRef.current
12482
+ if (event.type === 'keydown') {
12483
+ ownedByPage = selected !== '' || search !== '' || (input !== null && document.activeElement === input)
12484
+ }
12485
+ if (!ownedByPage) return
12486
+ event.preventDefault()
12487
+ event.stopPropagation()
12488
+ if (event.type !== 'keydown') return
12489
+ if (selected !== '') {
12490
+ setSelected('')
12491
+ return
12492
+ }
12493
+ if (search !== '') {
12494
+ setSearch('')
12495
+ return
12496
+ }
12497
+ if (input !== null) input.blur()
12498
+ }
12499
+ const types = ['keydown', 'keypress', 'keyup']
12500
+ for (const type of types) window.addEventListener(type, handler, true)
12501
+ return () => {
12502
+ for (const type of types) window.removeEventListener(type, handler, true)
12503
+ }
12504
+ }, [selected, search])
12281
12505
  ACC.useEffect(() => {
12282
12506
  const onKey = (event) => {
12283
12507
  if (event.key !== '/' || event.metaKey || event.ctrlKey || event.altKey) return
@@ -12363,7 +12587,12 @@ ACC.l10n = (function createL10n() {
12363
12587
  placeholder: t('tools.searchPlaceholder'),
12364
12588
  value: search,
12365
12589
  onChange: (event) => setSearch(event.target.value),
12366
- onKeyDown: (event) => { if (event.key === 'Escape') setSearch('') },
12590
+ onKeyDown: (event) => {
12591
+ if (event.key !== 'Escape') return
12592
+ // The page-level capture handler already clears the query; keep the
12593
+ // dialog open if it ever arrives here first.
12594
+ event.preventDefault()
12595
+ },
12367
12596
  'aria-label': t('tools.search'),
12368
12597
  style: { minWidth: '180px' },
12369
12598
  }),
@@ -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.0` |
42
+ | 版本 | `0.5.0` |
43
43
  | 兼容声明 | `dsh.compatibility.dsh = ">=0.2.1-rc.1 <0.3.0"`,`engines.dsh` 同区间 |
44
44
 
45
45
  `package.json` 关键字段(照抄,勿改语义):
@@ -313,7 +313,8 @@ curl -s http://127.0.0.1:38080/__agent-control-center/health
313
313
 
314
314
  - 导航 **12 项**、mid 布局 2 个组分隔符。
315
315
  - `Health check` 页:21,276 字符,4 个状态块(206 插件 / 22 命名空间 / 0 冲突 / compat full)、插件表、命名空间表、section 表、anomalies 与 note 全渲染,**0 错误态、0 console/pageerror**。
316
- - `Instruction preview` 页在 12 页下仍渲染 60,432 字符。
316
+ - `Instruction preview` 页在 12 页下仍渲染 60,432 字符(012 页共存无回归)。
317
+ - 验收脚本最终 **8/8**:首轮曾因固定等待 4s 而误判 Instruction 页(实际 60,432 字符、0 错误),改为轮询「Loading 消失」后通过。
317
318
  - 截图:`docs/assets/health.png`。
318
319
 
319
320
  ## 未验证 / 已知限制(0.4.0 新增部分)
@@ -321,4 +322,73 @@ curl -s http://127.0.0.1:38080/__agent-control-center/health
321
322
  - `health.sections` 是**静态扫描**:只覆盖构建产物里的字面量注册,注释中的 `settings.section` 与 `id:` 也会被计入(噪声可能);动态生成 id 的插件会漏检。
322
323
  - 本插件自身 bundle 若以 `link:` 装在被围栏拒绝的路径(当前即如此),其 section 行来自插件常量并标 `scanned:false`,不是扫描结果。
323
324
  - 「声明未装 / 装了未启用」两类异常仍由 `readOnlyReason` 与 profile patch 行间接推断,未读取插件运行态。
324
- - 逐页交互回归(11→12 页)本轮仍只覆盖渲染/空态/错误态与两组导航断言;逐页交互专项脚本此前由子代理在运行中被环境重启打断,未产出完整报告。
325
+ - 逐页交互回归:12 页首屏全部 0 错误态,但完整交互清单未跑完(子代理进程在环境重启后中断)。已采集的部分与问题清单见 `docs/13-PAGE-REGRESSION-0.4.0.md`;其中最实的问题是 **Tools 首屏 5.7 s**(`tools.list` 实测 5,407 ms / `tools.summary` 2,366 ms,357 个会话冷启动)。
326
+ - 「配置漂移」(profile 的 cordis.patch.yml 行 vs 运行时挂载)**未实现**:读取 `$DSH_HOME/profiles/<p>/cordis.patch.yml` 被路径围栏按设计拒绝(该文件可含插件密钥),本轮只放行了 `profiles/<p>/node_modules/**` 与目录遍历。要做这个功能必须先决定是否接受读取该文件,或改由 `configEditor` 提供等价信息。
327
+
328
+ ---
329
+
330
+ # 附:0.4.1 验收补充(2026-11-29,宿主 0.2.3-alpha.3)
331
+
332
+ 0.4.1 是一次兼容性发布:宿主从 `0.2.2-rc.5` 换成了 `0.2.3-alpha.3`(`/opt/dsh-0233`),两处被本插件读取的 API 改了名。
333
+
334
+ ## 漂移与适配
335
+
336
+ | 能力 | 0.2.2 | 0.2.3 | 适配 |
337
+ |---|---|---|---|
338
+ | tools | `definitions()` / `schemas()` | `getAll()` / `get()`(`schemas()` 不再公开) | `lib/core/tools-view.js` + `caps.js` 的 `ALTERNATES` |
339
+ | connection | `requestRejection()` | `admit()` → `{rejection}` / `{peer}` | `lib/core/http.js` |
340
+
341
+ 未适配时的实测症状:`tools` 能力缺失 → 模块 Tools **BLOCKED**、`tools.list` 404;`connection` 缺失 → 21 项能力只剩 20 项。
342
+
343
+ ## 真机(隔离 profile `accverify`,12 模块)
344
+
345
+ | 项 | 结果 |
346
+ |---|---|
347
+ | `/health` | `version 0.4.1`;宿主 `0.2.3-alpha.3`;`compat {level:'full', tested:true, readOnly:false, reasons:[]}`;能力 **21/21**;12 模块 **11 FULL + recovery PARTIAL** |
348
+ | `tools` 能力 | `{present:true, methods:['getAll','get']}` |
349
+ | `connection` 能力 | `{present:true, methods:['admit']}` |
350
+ | `tools.list` 冷 / 热 | 3,873 ms / **11 ms**(共享历史折叠 + 60 s memo;`refresh:true` 强制重扫) |
351
+ | `tools.detail`(scoped) | `schemaSource:'scoped'`、`definitionAvailable:true` —— 修复了「行说已注册、详情说注册表没有该名称」 |
352
+ | `instruction.trend` | 写入成功(`totalSamples:4`),证明写入路径在新宿主上仍可用 |
353
+ | `instruction.preview` | 136 ms,76,631 B,`exact:true` |
354
+
355
+ ## 浏览器(真实 Chrome headless,v0.4.1)
356
+
357
+ **19/19 通过**,0 console error、0 pageerror:
358
+
359
+ - 12 页全部渲染且 0 错误态;首屏:Overview 4 ms、Usage 30 ms、Restart 3 ms、Agent info 508 ms、Sessions 510 ms、Export 510 ms、Instruction 1,018 ms、Diagnostics 1,013 ms、AGENTS.md 1,190 ms、Health 1,561 ms、Tools 5,570 ms(冷历史扫描,见下「已知」)
360
+ - 展开一个真实工具行后按 Esc:**收起该行且 Settings 保持打开**;搜索框有内容时按 Esc:清空输入且 Settings 保持打开
361
+
362
+ ## 已知 / 未解决
363
+
364
+ - **Tools 首屏仍 5.5 s(冷)**:历史折叠默认扫 25 个会话、5 s 时间预算;热读 11 ms。下一步计划把历史统计拆成首屏后加载(页面先出注册表,历史徽标随后填充),而不是降低默认扫描上限。
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,因此默认关闭;页面用按钮显式触发。
package/docs/07-GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 用户指南:从「我想做什么」出发
2
2
 
3
- > 适用版本 **0.4.0**,目标宿主 DSH **0.2.2-rc.5**(兼容区间 `>=0.2.1-rc.1 <0.3.0`)。
3
+ > 适用版本 **0.5.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);