dsh-agent-control-center 0.1.0 → 0.3.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +217 -83
  3. package/README.zh.md +159 -58
  4. package/client.js +7660 -2005
  5. package/cordis.patch.yml +5 -0
  6. package/docs/01-CONTRACT.md +3 -2
  7. package/docs/05-ACCEPTANCE-EVIDENCE.md +81 -0
  8. package/docs/06-UX-OPTIMIZATION.md +57 -0
  9. package/docs/07-GUIDE.md +327 -0
  10. package/docs/08-COMPATIBILITY.md +202 -0
  11. package/docs/09-ARCHITECTURE.md +333 -0
  12. package/docs/ROADMAP.md +448 -0
  13. package/index.js +67 -2
  14. package/lib/core/cache.js +277 -0
  15. package/lib/core/compat.js +877 -0
  16. package/lib/core/errors.js +14 -1
  17. package/lib/core/http.js +22 -0
  18. package/lib/core/index.js +53 -2
  19. package/lib/core/paths.js +6 -0
  20. package/lib/core/registry.js +21 -5
  21. package/lib/core/util.js +4 -1
  22. package/lib/modules/a-agents.js +104 -4
  23. package/lib/modules/b-tools.js +169 -26
  24. package/lib/modules/f-diagnostics.js +109 -17
  25. package/lib/modules/g-templates.js +18 -0
  26. package/lib/modules/i-recovery.js +84 -23
  27. package/lib/modules/j-instruction.js +624 -0
  28. package/lib/modules/k-export.js +540 -0
  29. package/package.json +1 -1
  30. package/scripts/release.mjs +81 -0
  31. package/scripts/verify.mjs +12 -0
  32. package/src/client/app.js +684 -118
  33. package/src/client/i18n/agents.js +96 -0
  34. package/src/client/i18n/common.js +36 -0
  35. package/src/client/i18n/diagnostics.js +52 -0
  36. package/src/client/i18n/export.js +174 -0
  37. package/src/client/i18n/instruction.js +236 -0
  38. package/src/client/i18n/meta.js +72 -0
  39. package/src/client/i18n/overview.js +38 -0
  40. package/src/client/i18n/recovery.js +66 -0
  41. package/src/client/i18n/sessions.js +64 -0
  42. package/src/client/i18n/templates.js +88 -0
  43. package/src/client/i18n/tools.js +96 -0
  44. package/src/client/i18n/usage.js +42 -0
  45. package/src/client/kernel.js +327 -40
  46. package/src/client/pages/agents.js +637 -354
  47. package/src/client/pages/diagnostics.js +526 -177
  48. package/src/client/pages/export.js +664 -0
  49. package/src/client/pages/instruction.js +648 -0
  50. package/src/client/pages/meta.js +553 -193
  51. package/src/client/pages/overview.js +255 -34
  52. package/src/client/pages/recovery.js +332 -131
  53. package/src/client/pages/sessions.js +470 -307
  54. package/src/client/pages/templates.js +691 -381
  55. package/src/client/pages/tools.js +559 -206
  56. package/src/client/pages/usage.js +235 -57
package/CHANGELOG.md CHANGED
@@ -1,5 +1,121 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 — 2026-11-29
4
+
5
+ Verified against DSH `0.2.2-rc.5` on an isolated profile. This release answers the
6
+ question the 0.2.x pages could not: *what does the model actually receive?*
7
+
8
+ ### Added
9
+
10
+ - **Instruction preview (module J, page 11)**: two read-only views.
11
+ *By files* reassembles the exact host format (`<system-reminder>` frame,
12
+ per-chain byte budget, `omitted`/`truncated` markers, compact-intro fallback)
13
+ and reports whether the result is byte-exact (`exact`). *By session* replays a
14
+ real session log and returns the `agent-instructions` blocks the host wrote,
15
+ verbatim, with `seq`/time/`baseline` flags — no reconstruction, no guessing.
16
+ A **compare** view shows the byte delta and explains it (files changed after the
17
+ baseline, truncation, or a different budget).
18
+ - **Session export (module K, page 12)**: read-only Markdown or JSON export of one
19
+ session's timeline inside a byte budget (256 KiB default, 1 MiB hard cap).
20
+ Events are appended one at a time and the export stops *before* an event that
21
+ would overflow, so a truncated export never contains half an event
22
+ (`truncated` + `omittedEvents` state the cut). Tool results keep their error
23
+ flag and a bounded preview; usage comes from the host's own counters. Fences
24
+ inside message text are escaped. Nothing is deleted, archived, or uploaded.
25
+ - **`agents.render`**: module A now exposes the host-format instruction text it
26
+ already knew how to compose, so the preview does not re-implement discovery or
27
+ budget logic.
28
+ - **Navigation groups**: the settings nav is grouped into *Sessions & insights* →
29
+ *Editing & instructions* → *Maintenance* (insight first so the landing page
30
+ stays first). Wide layout shows group headings, the mid tab bar shows group
31
+ separators, and the narrow `<select>` uses `optgroup`. Every page declares its
32
+ group explicitly; order-based inference remains as a fallback.
33
+
34
+ ### Changed
35
+
36
+ - Contract tests, the verify module table and the health payload now expect
37
+ **11 modules** instead of 9.
38
+ - `probe()` for the two new modules returns an empty `detail` on FULL, matching
39
+ the documented rule that a healthy module carries no explanation.
40
+ - Two page icons (`file-text`, `download`) were added to the icon table; unknown
41
+ names still fall back to the dot glyph.
42
+
43
+ ### Tests
44
+
45
+ - 332 behaviour tests (309 → 332): 12 for instruction preview, 11 for session
46
+ export, plus the updated contract/registry expectations. All green.
47
+
48
+ ## 0.2.0 — 2026-11-29
49
+
50
+ Verified against DSH `0.2.2-rc.5`. Everything below was exercised on an isolated
51
+ `accverify` profile; the numbers in the acceptance report come from that run.
52
+
53
+ ### Added
54
+
55
+ - **Read-through cache** for the three expensive read-only views: `tools.list`
56
+ (~5.5 s -> ~0.07 s on a hit), `diagnostics.run` (seconds -> ~14 ms), and
57
+ `recovery.scan` (seconds -> ~8 ms). Same-key concurrency shares one scan,
58
+ errors are never cached, `refresh: true` bypasses, `cacheTtlMs` tunes the TTL
59
+ (null = module defaults, number = all, object = one module, 0 = off), and each
60
+ module warms up after activation without blocking it.
61
+ - **Compatibility layer** (`lib/core/compat.js`): version detection from
62
+ `profileContext`/argv/`DSH_INSTALL_DIR`, semver comparison, a capability ->
63
+ module requirement matrix, and a verdict exposed as `compat` in `/health`
64
+ (`full|degraded|unsupported`, `tested`, `readOnly`, per-module reasons). Host
65
+ write methods are refused with 403 while the verdict is read-only, so an
66
+ untested host version cannot corrupt host files; plugin-owned storage keeps
67
+ working.
68
+ - **Refusals are audited**: a denied request now appends `http.rejected` to the
69
+ plugin audit log instead of leaving no trail.
70
+ - **Documentation and community files**: rewritten `README.md`/`README.zh.md`,
71
+ `docs/07-GUIDE.md` (task-oriented user guide), `docs/08-COMPATIBILITY.md`,
72
+ `docs/09-ARCHITECTURE.md`, `CONTRIBUTING.md`, `SECURITY.md`, issue forms, PR
73
+ template, CODEOWNERS, `.editorconfig`, `.nvmrc`, `.gitattributes`.
74
+ - **Release tooling**: `scripts/release.mjs` (gates -> version -> tag -> push ->
75
+ publish) and a CI workflow that runs the build, the full suite, the contract
76
+ gate and a packed-artifact smoke on Node 22 and 24.
77
+ - **Product roadmap** (`docs/ROADMAP.md`) with IA review, three release
78
+ proposals, and the capabilities the host cannot support.
79
+
80
+ ### Changed
81
+
82
+ - **UI/UX overhaul (two rounds, browser-verified)**: per-page titles and
83
+ descriptions, icon navigation with text status pills, contrast-safe semantic
84
+ colours (44 measurements, minimum 4.93:1 light / 5.09:1 dark), unified
85
+ loading/error/empty states, sticky table heads, row hover, truncation with
86
+ `title`, focus rings, reduced-motion support, responsive breakpoints driven by
87
+ the panel width, English UI without Chinese leakage (host text is mapped per
88
+ id, raw text stays in a labelled `Raw` region), line-level diff confirmation
89
+ before writing AGENTS.md or applying a template, plural-aware confirmations,
90
+ actionable empty states, scan progress with a cancel button, and unique
91
+ accessible names for repeated controls.
92
+ - `sessions.archive`/`unarchive` confirm through the host dialog; archive stays
93
+ the only session action because the host still exposes no delete API.
94
+ - Recovery scan ranges are capped at the backend limit (120 -> 100) and every
95
+ explicit refresh now bypasses the cache.
96
+
97
+ ### Fixed
98
+
99
+ - **Security**: `templates.preview` was an arbitrary-file read primitive inside
100
+ the read roots (could return `~/.dsh/.credentials.yaml` and `~/.npmrc`); it is
101
+ now restricted to real instruction files. Instruction files reached through a
102
+ symlink are refused instead of reading/writing their target, and the path
103
+ fence denies `$DSH_HOME` credentials, provider keys, profiles, storage and
104
+ skills. The fallback HTTP fence now rejects non-loopback `Host` headers (DNS
105
+ rebinding). Internal error hints are sanitized before they reach the page.
106
+ - Registry `refresh()` re-probes modules, so a module that reported BLOCKED
107
+ before its host service mounted recovers instead of staying blocked for the
108
+ process lifetime.
109
+ - `util.redact` covers hyphenated key prefixes (`sk-...`), so provider keys
110
+ cannot reach the audit log in plaintext.
111
+ - The audit list, health aggregate and `updateState` edge cases found by the new
112
+ contract suite.
113
+
114
+ ### Tests
115
+
116
+ - 153 -> **309** behaviour tests (contract, capability matrix, HTTP limits,
117
+ storage atomicity, compatibility, cache, security). All green.
118
+
3
119
  ## 0.1.0 — 2026-11-28
4
120
 
5
121
  First release, verified against DSH `0.2.2-rc.5` (web profile).
package/README.md CHANGED
@@ -2,120 +2,254 @@
2
2
 
3
3
  [English](README.md) | [中文](README.zh.md)
4
4
 
5
- One control centre for a DeepSeek Harness profile: edit and back up `AGENTS.md`,
6
- inspect tools, browse and archive sessions, read real token usage, export agent
7
- metadata, run diagnostics, and apply templates — all from one settings page,
8
- with no fake data and no writes outside the plugin's own directory.
9
-
10
- Target: DSH `>=0.2.1-rc.1 <0.3.0` (`peerDependencies`: `@deepseek-ai/cordis`).
11
- Developed and verified against DSH **0.2.2-rc.5**.
5
+ **One settings page for a DeepSeek Harness profile.** Nine pages in one
6
+ `Settings → Agent Control Center` section: edit and back up `AGENTS.md`, inspect
7
+ tools, browse and archive sessions, read real token usage, export agent
8
+ metadata, run diagnostics, apply templates, and detect interrupted sessions.
9
+
10
+ The plugin uses only official host services, never fabricates data, never makes
11
+ network requests or spawns subprocesses, and keeps all of its own state in one
12
+ directory under `$DSH_HOME`. It is deliberately read-only where the host gives no
13
+ safe write path.
14
+
15
+ Targets DSH `>=0.2.1-rc.1 <0.3.0`; developed and verified against **DSH 0.2.2-rc.5**.
16
+
17
+ ![Agent Control Center overview page](docs/assets/overview.png)
18
+
19
+ *The Overview page on a real DSH 0.2.2-rc.5 deployment: environment, 21/21 host
20
+ capabilities present, module states, and counts that link to their pages.
21
+ Screenshots live in `docs/assets/` and are excluded from the npm tarball.*
22
+
23
+ ## Pages and status
24
+
25
+ Runtime state comes from `GET /__agent-control-center/health`; the table records
26
+ what the 0.3.0 acceptance run actually proved (details and evidence levels in
27
+ [docs/05-ACCEPTANCE-EVIDENCE.md](docs/05-ACCEPTANCE-EVIDENCE.md)).
28
+
29
+ | Page | What it gives you | State | Why / data source |
30
+ |---|---|---|---|
31
+ | **Overview** | environment, host capabilities, module states, key counts, links into every page | FULL | Every number comes from a host service or a sibling module summary; an unavailable source is labelled with a reason, never shown as `0`. Verified on a real deployment. |
32
+ | **AGENTS.md** | instruction-chain discovery, byte-exact read (hash/bytes/EOL/BOM), version-guarded edit, pre-write backups, restore, unified diff, 11 checks (10 deterministic plus one heuristic conflict suggestion), budget | FULL | Real file read/save/backup/restore and a real 409 were verified; writes go through the host `fs` service with its version guard. Degrades to PARTIAL only when neither `sessionQuery` nor `sessions` exists (working directory falls back). |
33
+ | **Tools** | read-only inventory with three independent states (registered / visible to an agent / called in history), error clusters, recent failures | FULL | 42-tool inventory and history aggregation verified; the module never executes a tool to probe it. PARTIAL when `sessionQuery` is missing (history statistics unavailable). |
34
+ | **Sessions** | list, title/id search (with documented full-text fallback), workspace grouping, batched archive/unarchive, expandable detail with real activity statistics and lineage | PARTIAL | Listing, search, archive state and detail statistics were verified; the archive **write** round-trip was only exercised against fake services (no real sessions were touched). This deployment disables the session full-text index (`openAt: never`), so searches fall back to title/id substrings and the page says so. **No delete**: the host exposes no public session-delete API. |
35
+ | **Usage** | real token accounting (input / cache read / cache write / output / calls), local-day trend 30 days, provider/model split, date picker, retention, collection switch | FULL | Totals, idempotent replay, date-key validation and pruning were verified. Only a live "+1 call" before/after one real model call was not verified (it would consume a paid call). |
36
+ | **Agent info** | live agents, presets, default model, redacted export, field-level diff, import preview | FULL | Agents/presets/default model, redacted export and diff verified. Host configuration import is **BLOCKED by design**: the host has no safe public write path, so import writes only this plugin's own state and says so. |
37
+ | **Diagnostics** | 22 probes across ten groups with evidence/impact/action, Markdown and JSON export, safe repairs limited to the plugin's own storage, post-repair re-check | FULL | Baseline run: 19 ok / 2 warn / 1 unknown. Egress probing stays `unknown` permanently: the plugin never sends a network request to find out. |
38
+ | **Instruction preview** | read-only view of what the model received: files-side reassembly (labelled approximate, per-chain budget) vs the session-side bytes the host recorded, plus a byte diff | FULL | Live instance: files side 76,621 B exact (both chains inside budget); session side returned 29 recorded blocks (verifying the exact path); a drift of −19,483 B between a June baseline and today's files is surfaced with an explanation. |
39
+ | **Session export** | read-only Markdown/JSON export of one session inside a byte budget (256 KiB default, 1 MiB cap), cut at event boundaries with `truncated`/`omittedEvents` | FULL | Live instance: a 19,345-event session exported 262,069 B and reported 12,623 omitted events; no delete/archive/upload path exists. |
40
+ | **Templates** | six bundled templates in five categories, source and rendered preview, variable fill, line-level diff, apply through the AGENTS.md save pipeline, user-template CRUD | FULL | Apply was verified end-to-end through the AGENTS.md pipeline (backup + read-back hash). Templates are data only; executable content is rejected. |
41
+ | **Restart & Resume** | read-only detection of interrupted sessions from recorded event semantics, with evidence and confidence; never resumes anything | PARTIAL | Detection-only by design. Event-semantics detection was verified on a real corpus with no false positives; the `kill -9` crash scene itself was not reproduced (it needs an isolated profile and explicit authorization). |
42
+
43
+ Legend: **FULL** = verified end-to-end on a real deployment. **PARTIAL** = works
44
+ but a documented part is limited by the host or could not be fully verified.
45
+ **BLOCKED** = deliberately hidden or degraded because the host exposes no safe
46
+ capability; the page states the reason.
12
47
 
13
48
  ## Install
14
49
 
15
- Use the host's official plugin entry (never hand-edit the profile):
50
+ Use the host's official plugin entry (never hand-edit the profile). `web` and
51
+ `desktop` profiles are supported; the desktop app loads the same Web client.
16
52
 
17
53
  ```bash
18
- # from npm
54
+ # 1) from npm
19
55
  dsh plugin --profile web add dsh-agent-control-center
20
56
 
21
- # or from a checkout / tarball
57
+ # 2) from a packed tarball
58
+ npm pack
59
+ dsh plugin --profile web add ./dsh-agent-control-center-0.3.0.tgz
60
+
61
+ # 3) from a local checkout
22
62
  dsh plugin --profile web add /absolute/path/to/dsh-agent-control-center
23
- npm pack && dsh plugin --profile web add ./dsh-agent-control-center-0.1.0.tgz
24
63
  ```
25
64
 
26
- Then restart the Web GUI (the Host half mounts an HTTP channel at boot) and open
27
- **Settings → Agent Control Center**. Uninstall with
28
- `dsh plugin --profile web remove dsh-agent-control-center`.
65
+ Then restart the Web GUI (the Host half mounts its HTTP route at boot) and open
66
+ **Settings → Agent Control Center**. Verify the channel without the browser:
29
67
 
30
- ## What it does
68
+ ```bash
69
+ curl -s http://127.0.0.1:<gui-port>/__agent-control-center/health
70
+ # → {"ok":true,"value":{"version":"0.3.0", …, "modules":[ … 11 entries … ]}}
71
+ ```
31
72
 
32
- | Page | Capability | Data source |
33
- |---|---|---|
34
- | Overview | environment, module states, real counts, shortcuts | host services + sibling module summaries |
35
- | AGENTS.md | discover the instruction chain, read bytes/hash/EOL/BOM, edit with optimistic locking, back up, restore, diff, 11 deterministic checks, budget | `dsh-agent-instructions` rules + host `fs` with version guard |
36
- | Tools | read-only inventory with three states (registered / visible to an agent / called in history), error clusters, recent failures | `ctx.tools` + session event history |
37
- | Sessions | list, search (title + id), group by workspace, archive/unarchive in batches, expandable detail with real activity statistics and lineage | `sessionQuery`, `workspaceRegistry`, `sessionPersistence` |
38
- | Agent info | live agents, presets, default model, redacted export, field-level diff, import preview | `agents`, `agentPresets`, `agentDefaultModel` |
39
- | Usage | real token accounting (input / cache read / cache write / output / calls), local-day trend, provider/model split, date picker, retention | session events `assistant/message.usage`, idempotent ledger |
40
- | Diagnostics | 22 probes across host identity, capabilities, presets, instructions, tools, sessions, usage, configuration, storage, permissions; Markdown/JSON export; safe repairs only | host services + plugin storage |
41
- | Templates | built-in AGENTS.md / convention / persona / tooling / diagnostics templates, source+render preview, variable fill, diff-before-apply, user templates | bundled JSON + plugin storage, applied through the AGENTS.md save pipeline |
42
- | Restart & Resume | read-only detection of interrupted sessions (unclosed turns, unknown tool outcomes) with evidence; never resumes anything | `sessionQuery` + `dsh-session` repair semantics |
73
+ Uninstall with `dsh plugin --profile web remove dsh-agent-control-center`.
74
+ To disable without uninstalling, set the row's `enabled` to `false` (no channel,
75
+ no storage writes). The data directory is left in place on uninstall; delete it
76
+ manually to remove all plugin data.
77
+
78
+ The git checkout can be ahead of the published npm version; see
79
+ [CHANGELOG.md](CHANGELOG.md).
80
+
81
+ ## Permissions and security boundaries
82
+
83
+ This plugin runs **in-process inside the DSH host** and therefore shares its
84
+ privileges. It is not a sandbox. What it does enforce:
85
+
86
+ - **Transport.** Exactly one HTTP prefix is mounted through the host Web server:
87
+ `GET /__agent-control-center/health` and `POST /__agent-control-center/api`.
88
+ Only `application/json` bodies are accepted (1 MiB cap, 10 s read timeout), and
89
+ the method name must resolve in the plugin's registry — unknown methods are 404.
90
+ - **Request fence.** Every request first goes through the host's
91
+ `connection.requestRejection(request)` guard when that service exists. When it
92
+ does not, the plugin checks its own fallback: the peer address must be loopback,
93
+ `sec-fetch-site` must not be `cross-site`, and a present `Origin` must match the
94
+ request `Host`. Requests that pass the fence are treated as authenticated local
95
+ requests, which is why destructive methods (save, restore, archive, template
96
+ apply, import apply, diagnostics fix) also require this level.
97
+ - **No plugin CSRF token.** The client relies on same-origin credentials
98
+ (`credentials: 'same-origin'`) and the host's own session handling. Do not put
99
+ the GUI behind an unauthenticated reverse proxy: the plugin's fence is not a
100
+ substitute for the host's auth.
101
+ - **Filesystem fence.** Paths are normalised through `realpath` (missing tails
102
+ resolve against the nearest existing ancestor) and must stay strictly inside an
103
+ allowed root. Writes additionally require the exact file to be on the
104
+ allow-list produced by instruction-chain discovery. Symlink escapes are
105
+ rejected.
106
+ - **Writes go through the host.** Saving or restoring an instruction file uses
107
+ the host `fs` service with `replaceIfVersion` (optimistic lock), an explicit
108
+ caller `sandboxPolicy`, and a strict order: **back up first → write → read back
109
+ and compare → roll back from the backup on mismatch**. A failed backup refuses
110
+ the write.
111
+ - **Storage.** Plugin data lives in `$DSH_HOME/dsh-agent-control-center/`
112
+ (overridable by an absolute `storageDir`), directories `0700`, files `0600`.
113
+ JSON documents are written atomically (temp file + fsync + rename). Corrupt
114
+ documents are quarantined, never silently overwritten; documents with a newer
115
+ unknown `version` switch the plugin to read-only for that document.
116
+ - **Audit and redaction.** `audit.jsonl` records `{ts, op, target, result,
117
+ detail}` only — never file bodies, session bodies, or credential values.
118
+ Diagnostics call `settings.describe({ redactSecrets: true })`, read credential
119
+ *metadata* only, and never read credential values. Exports and report files
120
+ carry no secrets, no session titles and no session bodies; preset YAML is
121
+ masked line by line.
122
+ - **No outbound activity.** The plugin issues no HTTP requests, opens no
123
+ subprocesses, loads no third-party runtime code (`dependencies` is empty; the
124
+ client only `require('react')`), and never calls a model. The `aiAnalysisEnabled`
125
+ field is reserved and the entry point is not shipped.
43
126
 
44
127
  ## Deliberate limits
45
128
 
46
- - **No session deletion.** DSH 0.2.2-rc.5 exposes no public session-delete API;
47
- the page hides it and says so. Archiving is the supported action.
48
- - **No automatic resume.** The Restart & Resume page only reports candidates and
49
- tells you to continue in the host's own session UI. Nothing is injected or
50
- appended.
51
- - **No cost estimation / provider balance.** No trustworthy price list or
129
+ - **No session deletion.** DSH 0.2.2-rc.5 exposes no public session-delete API
130
+ (no session-query write method, no persistence delete, no remote action), so the
131
+ page hides deletion and says why. Archiving is the supported action.
132
+ - **Full-text search may be disabled.** This deployment configures the
133
+ session-query index with `openAt: never`; the page probes by calling the search
134
+ provider and falls back to case-insensitive title/id substring matching, labelled
135
+ in the UI. It does not pretend coverage it does not have.
136
+ - **Detection only, no automatic resume.** The Restart & Resume page reads session
137
+ events and reports candidates with evidence. It never resumes, injects messages,
138
+ appends events, bypasses the write lock, or wakes sessions. Continue in the
139
+ host's own session UI.
140
+ - **No cost estimation, no provider balance/plan.** No trustworthy price list or
52
141
  currency is available, so no money is displayed.
53
- - **Full-text search may be disabled.** When the deployment configures the
54
- session-query index with `openAt: never`, the page falls back to title/id
55
- substring matching and labels the degradation.
56
- - **No `settings`/`credentials` writes.** Agent-info import only writes the
57
- plugin's own state; host configuration is reported as unavailable rather than
58
- improvised.
59
- - **AGENTS.md editing only touches discovered chain files.** New files are not
60
- created; writes are version-guarded and backed up first.
142
+ - **No AI analysis.** The plugin never calls a model; `aiAnalysisEnabled` is
143
+ reserved and not implemented.
144
+ - **No host `settings`/`credentials` writes.** Agent-info import writes only this
145
+ plugin's state; host configuration has no safe public write path for that
146
+ document format, so it is reported as `not_supported`, not faked.
147
+ - **AGENTS.md edits only touch discovered chain files.** New files are not
148
+ created; writes are version-guarded and backed up first. Files above the host's
149
+ single-file limit are read-only here.
150
+ - **Multi-tab editing is optimistic.** Another tab or process changing the file
151
+ first makes the later save return 409 without overwriting anything.
152
+ - **Single-process status.** "Not live" means "not in this host process's memory";
153
+ it does not prove the session is not running elsewhere.
154
+ - **Performance.** First loads are not instant: on the acceptance deployment the
155
+ Tools page took ~5.6 s and the recovery scan ~17 s over 340 sessions (both have
156
+ loading/progress states and bounded scans). Usage history can only replay what
157
+ the host can read; the page states the statistics start point.
61
158
 
62
- ## Storage and residue
159
+ ## Configuration
63
160
 
64
- Everything lives under `$DSH_HOME/dsh-agent-control-center/`
65
- (overridable with the row's `storageDir` config):
161
+ Row `agent-control-center` in `cordis.patch.yml`. Unknown fields, wrong types or
162
+ out-of-range values **fail loudly at load** instead of silently defaulting.
66
163
 
67
- ```
68
- state.json settings + ignored issues + import records
69
- usage-ledger.json idempotent token ledger (version + per-session cursor)
70
- backups/<file-key>/ pre-write copies of every instruction-file save (*.md + *.meta.json)
71
- templates/ user templates
72
- audit.jsonl append-only audit (never file contents, never credentials)
73
- cache/ tmp/ derived data; safe to delete
164
+ | Field | Default | Meaning |
165
+ |---|---|---|
166
+ | `enabled` | `true` | Turn the whole plugin off: no HTTP channel, no storage writes. |
167
+ | `storageDir` | `""` | Absolute storage root; empty means `$DSH_HOME/dsh-agent-control-center`. Must be absolute. |
168
+ | `exposeDelete` | `false` | Reserved. Deletion stays hidden while the host has no API; this flag only allows the UI to offer it. |
169
+ | `maxBackups` | `20` | Pre-write backups kept per instruction file (1–200). |
170
+ | `usageRetentionDays` | `180` | Local-day retention of the usage ledger (7–730). |
171
+ | `usageReplaySessions` | `200` | Sessions replayed on cold start (1–2000). |
172
+ | `usageReplayDays` | `30` | Days replayed on cold start (1–365). |
173
+ | `aiAnalysisEnabled` | `false` | Reserved. The AI entry point is not shipped; the plugin makes no model calls. |
174
+
175
+ ## Storage
176
+
177
+ ```text
178
+ $DSH_HOME/dsh-agent-control-center/ # 0700; storageDir overrides
179
+ ├── state.json # settings, ignored checks, import snapshots (version 1)
180
+ ├── usage-ledger.json # idempotent token ledger: per-session cursor + per-local-day totals
181
+ ├── audit.jsonl # append-only audit (rotates at 4 MiB); no contents, no credentials
182
+ ├── backups/<key>/ # <timestamp>.md + <timestamp>.md.meta.json per save, capped by maxBackups
183
+ ├── templates/ # user templates (JSON)
184
+ ├── cache/ # reserved for derived data; safe to delete
185
+ └── tmp/ # atomic-write temp area and diagnostics probes; safe to clean
74
186
  ```
75
187
 
76
- Uninstalling the plugin leaves this directory untouched. Delete it manually to
77
- remove all plugin data; the host's own sessions, configuration, and other
78
- plugins' storage are never written.
188
+ Uninstalling the plugin leaves this directory untouched. The plugin writes
189
+ outside it only when you explicitly save/restore an instruction file or
190
+ archive/unarchive sessions — always through host services, with the caller's
191
+ sandbox policy, version guard and a pre-write backup.
79
192
 
80
- The plugin writes outside its directory only when you explicitly save an
81
- instruction file (the original content is backed up first), and it always goes
82
- through the host `fs` service with the caller's sandbox policy and version
83
- guard.
193
+ ## Development
84
194
 
85
- ## Configuration
195
+ Node `>=22.19` (`.nvmrc` pins `22.19`; CI also runs 24). There are **no runtime
196
+ dependencies**, so no install step is needed:
86
197
 
87
- Row `agent-control-center` in `cordis.patch.yml`:
198
+ ```bash
199
+ node scripts/build-client.mjs # concatenate src/client → client.js + syntax/factory/i18n/size self-checks
200
+ node --test tests/*.test.mjs # behaviour suite
201
+ node scripts/verify.mjs # contract gate: required files, module completeness, forbidden client patterns, package metadata
202
+ ```
88
203
 
89
- | Field | Default | Meaning |
90
- |---|---|---|
91
- | `enabled` | `true` | turn the whole plugin off (no channel, no storage) |
92
- | `storageDir` | `""` | absolute storage root; empty means `$DSH_HOME/dsh-agent-control-center` |
93
- | `exposeDelete` | `false` | reserved; deletion stays hidden while the host has no API |
94
- | `maxBackups` | `20` | pre-write backups kept per instruction file |
95
- | `usageRetentionDays` | `180` | local-day retention of the ledger (7–730) |
96
- | `usageReplaySessions` | `200` | sessions replayed on cold start |
97
- | `usageReplayDays` | `30` | days replayed on cold start |
98
- | `aiAnalysisEnabled` | `false` | reserved; the AI entry point is not shipped (no model calls from the plugin) |
99
-
100
- Dangerous behaviour is off by default: no deletion, no resume, no subprocesses,
101
- no outbound network requests from the plugin.
204
+ `npm run verify` runs the build first. CI (`.github/workflows/ci.yml`) runs build
205
+ → `node --test` → verify → a packed-tarball smoke check on Node 22 and 24.
206
+ Tests never touch the real `$DSH_HOME` and never use the network.
102
207
 
103
- ## Development
208
+ Release (maintainers, after updating `CHANGELOG.md`):
104
209
 
105
210
  ```bash
106
- node scripts/build-client.mjs # concatenates src/client into client.js + self-checks
107
- node --test tests/*.test.mjs # 153 behaviour tests
108
- node scripts/verify.mjs # contract gate: files, forbidden patterns, i18n parity
211
+ node scripts/release.mjs patch|minor|major [--dry-run] [--notes "text"]
109
212
  ```
110
213
 
111
- The client half is hand-written lazy-CJS (`window.__ModuleLoader__.load`) with no
112
- bundler; only `react` and the host UI primitives are required from the client
113
- module table. Host code is plain ESM under `lib/`.
114
-
115
- ## Attribution
214
+ It runs build → full tests → verify, bumps the version, packs, commits, tags,
215
+ pushes and publishes to npm, stopping at the first failure so a half-released
216
+ version cannot land.
217
+
218
+ - Contribution rules: [CONTRIBUTING.md](CONTRIBUTING.md)
219
+ - Security policy and reporting: [SECURITY.md](SECURITY.md)
220
+ - Architecture, request flow, storage layout and extension points:
221
+ [docs/09-ARCHITECTURE.md](docs/09-ARCHITECTURE.md)
222
+ - Task-oriented user guide (Chinese): [docs/07-GUIDE.md](docs/07-GUIDE.md)
223
+ - Internal contract and host-capability facts: [docs/01-CONTRACT.md](docs/01-CONTRACT.md)
224
+
225
+ ## Version and compatibility
226
+
227
+ | Item | Value |
228
+ |---|---|
229
+ | Plugin version | `0.3.0` |
230
+ | DSH range | `>=0.2.1-rc.1 <0.3.0` (`engines.dsh` and `dsh.compatibility.dsh`) |
231
+ | Verified against | DSH `0.2.2-rc.5` (web profile), Node `v24.22.2`, Linux x86_64 |
232
+ | Node | `>=22.19` (CI: 22 and 24) |
233
+ | Host peer | `@deepseek-ai/cordis ^4.0.1` (provided by the host) |
234
+ | Profiles | `web`, `desktop` (same Web client) |
235
+ | Storage document versions | `state.json` 1, `usage-ledger.json` 1, backup metadata 1, template `schemaVersion` 1 |
236
+
237
+ Version windows, the capability dependency matrix and the upgrade checklist are
238
+ in [docs/08-COMPATIBILITY.md](docs/08-COMPATIBILITY.md) (Chinese).
239
+
240
+ DSH public APIs are pre-stable. The plugin is defensive about that — a missing
241
+ service degrades one module instead of failing activation, and `/health` plus the
242
+ Diagnostics page report what is actually present — but a host upgrade outside the
243
+ declared range can still change the wiring. Storage documents with a newer
244
+ unknown version put the plugin into read-only mode for that document instead of
245
+ overwriting it.
246
+
247
+ ## Attribution and license
116
248
 
117
249
  Behaviour specifications were modelled on `dsh-archived-sessions` (MIT,
118
250
  Zephyr-vibe) and `@linxin666/dsh-usage` (Apache-2.0, linxin666). This is an
119
- independent implementation: no copied source, no runtime dependency, no access
120
- to their storage. See [LICENSE](LICENSE) and
251
+ independent implementation: no copied source, no runtime dependency, no access to
252
+ their storage. See [LICENSE](LICENSE) and
121
253
  [docs/02-REFERENCE-PROVENANCE.md](docs/02-REFERENCE-PROVENANCE.md).
254
+
255
+ MIT © 240xu