dsh-agent-control-center
240xu/dsh-agent-control-center
同一设置页支持 AGENTS.md 编辑与备份、工具清单、会话、真实 token 用量、Agent 元数据、诊断与模板。
安装
dsh plugin --profile web add github:240xu/dsh-agent-control-centerREADME
dsh-agent-control-center
One settings page for a DeepSeek Harness profile. Nine pages in one
Settings → Agent Control Center section: edit and back up AGENTS.md, inspect
tools, browse and archive sessions, read real token usage, export agent
metadata, run diagnostics, apply templates, and detect interrupted sessions.
The plugin uses only official host services, never fabricates data, never spawns
subprocesses, and keeps all of its own state in one directory under $DSH_HOME. It
is deliberately read-only where the host gives no safe write path. The one exception
to "no network" is opt-in: the subscription-window block calls the configured
provider's quota endpoint, makes no request at all while quotaProviders is empty,
and never logs or returns the credential.
Targets DSH >=0.2.1-rc.1 <0.3.0; developed and verified against DSH 0.2.2-rc.5.

The Overview page on a real DSH 0.2.2-rc.5 deployment: environment, 21/21 host
capabilities present, module states, and counts that link to their pages.
Screenshots live in docs/assets/ and are excluded from the npm tarball.
Pages and status
Runtime state comes from GET /__agent-control-center/health; the table records
what the latest acceptance run actually proved (details and evidence levels in
docs/05-ACCEPTANCE-EVIDENCE.md).
| Page | What it gives you | State | Why / data source |
|---|---|---|---|
| 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. |
| 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). |
| 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). |
| 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. |
| Usage | real token accounting (input / cache read / cache write / output / calls), local-day trend 30 days, date picker, retention, collection switch, usage by provider with inline model rows and a cross-provider model table, optional cost from a user-supplied price list | FULL | Totals, idempotent replay, date-key validation and pruning were verified live; the provider/model rollups read the same ledger and were verified against the real 30-day corpus (11 providers, 9 models, 16 unpriced pairs listed explicitly). Cost is only shown when usagePrices is configured; no price list ships with the plugin. |
| 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. |
| 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. |
| 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. |
| 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. |
| Subscription windows & balances (Usage page) | 13 providers: Claude subscription, ChatGPT/Codex, Z.ai/Zhipu coding plan, Command Code, OpenCode Go, MiniMax, Gemini Code Assist, GitHub Copilot, OpenRouter, DeepSeek, Moonshot, xAI, Xiaomi MiMo — each with its rolling windows or account balance, reset countdown and plan label; opt-in and offline by default | FULL | Verified end to end: 10 providers answered against a local mock that speaks every protocol (10/10), plus 20 unit tests over URLs, auth headers, field mapping, 401/429/500, cache and negative cache. Only OpenRouter/DeepSeek/Moonshot/xAI/Zhipu endpoints are publicly documented; the rest are the vendor client's private endpoints. |
| Plugin health | read-only audit of the plugin inventory, settings namespaces (secrets redacted), settings.section id conflicts (static scan of installed client bundles) and the live compatibility verdict | FULL | Live instance: 206 plugin rows (5 unaddressable build-ins), 22 settings namespaces with redactionVerified true, section inventory with 0 conflicts, compat full @ 0.2.2-rc.5. |
| Instruction trend | size samples recorded whenever a files-side view is generated, grouped by local day (10-minute throttle per directory, 500-sample cap, 180-day retention) | FULL | Live instance: sampling persisted to the plugin state and the trend returned the recorded day. |
| 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. |
| Restart & Resume | read-only detection of interrupted sessions from recorded event semantics, with evidence and confidence; manual continuation (one confirmed click appends a new user turn through sessionController.prompt); automatic continuation switch (off / notify / auto) with one bounded pass per boot | PARTIAL | Detection and the manual path were verified on the real corpus (candidates classified, subagent sessions refused). The automatic pass was verified in notify mode on the live host; the crash-and-reboot scene that would make auto act was not reproduced (it needs an isolated profile and explicit authorization). Every write is confirm-gated, attempt-capped and audited. |
Legend: FULL = verified end-to-end on a real deployment. PARTIAL = works but a documented part is limited by the host or could not be fully verified. BLOCKED = deliberately hidden or degraded because the host exposes no safe capability; the page states the reason.
Install
Use the host's official plugin entry (never hand-edit the profile). web and
desktop profiles are supported; the desktop app loads the same Web client.
# 1) from npm
dsh plugin --profile web add dsh-agent-control-center
# 2) from a packed tarball
npm pack
dsh plugin --profile web add ./dsh-agent-control-center-0.21.1.tgz
# 3) from a local checkout
dsh plugin --profile web add /absolute/path/to/dsh-agent-control-center
Then restart the Web GUI (the Host half mounts its HTTP route at boot) and open Settings → Agent Control Center. Verify the channel without the browser:
curl -s http://127.0.0.1:<gui-port>/__agent-control-center/health
# → {"ok":true,"value":{"version":"0.21.1", …, "modules":[ … 14 entries … ]}}
Uninstall with dsh plugin --profile web remove dsh-agent-control-center.
To disable without uninstalling, set the row's enabled to false (no channel,
no storage writes). The data directory is left in place on uninstall; delete it
manually to remove all plugin data.
The git checkout can be ahead of the published npm version; see CHANGELOG.md.
Permissions and security boundaries
This plugin runs in-process inside the DSH host and therefore shares its privileges. It is not a sandbox. What it does enforce:
- Transport. Exactly one HTTP prefix is mounted through the host Web server:
GET /__agent-control-center/healthandPOST /__agent-control-center/api. Onlyapplication/jsonbodies are accepted (1 MiB cap, 10 s read timeout), and the method name must resolve in the plugin's registry — unknown methods are 404. - Request fence. Every request first goes through the host's
connection.requestRejection(request)guard when that service exists. When it does not, the plugin checks its own fallback: the peer address must be loopback,sec-fetch-sitemust not becross-site, and a presentOriginmust match the requestHost. Requests that pass the fence are treated as authenticated local requests, which is why destructive methods (save, restore, archive, template apply, import apply, diagnostics fix) also require this level. - No plugin CSRF token. The client relies on same-origin credentials
(
credentials: 'same-origin') and the host's own session handling. Do not put the GUI behind an unauthenticated reverse proxy: the plugin's fence is not a substitute for the host's auth. - Filesystem fence. Paths are normalised through
realpath(missing tails resolve against the nearest existing ancestor) and must stay strictly inside an allowed root. Writes additionally require the exact file to be on the allow-list produced by instruction-chain discovery. Symlink escapes are rejected. - Writes go through the host. Saving or restoring an instruction file uses
the host
fsservice withreplaceIfVersion(optimistic lock), an explicit callersandboxPolicy, and a strict order: back up first → write → read back and compare → roll back from the backup on mismatch. A failed backup refuses the write. - Storage. Plugin data lives in
$DSH_HOME/dsh-agent-control-center/(overridable by an absolutestorageDir), directories0700, files0600. JSON documents are written atomically (temp file + fsync + rename). Corrupt documents are quarantined, never silently overwritten; documents with a newer unknownversionswitch the plugin to read-only for that document. - Audit and redaction.
audit.jsonlrecords{ts, op, target, result, detail}only — never file bodies, session bodies, or credential values. Diagnostics callsettings.describe({ redactSecrets: true }), read credential metadata only, and never read credential values. Exports and report files carry no secrets, no session titles and no session bodies; preset YAML is masked line by line. - No outbound activity. The plugin issues no HTTP requests, opens no
subprocesses, loads no third-party runtime code (
dependenciesis empty; the client onlyrequire('react')), and never calls a model. TheaiAnalysisEnabledfield is reserved and the entry point is not shipped.
Deliberate limits
- No session deletion. DSH 0.2.2-rc.5 exposes no public session-delete API (no session-query write method, no persistence delete, no remote action), so the page hides deletion and says why. Archiving is the supported action.
- Full-text search may be disabled. This deployment configures the
session-query index with
openAt: never; the page probes by calling the search provider and falls back to case-insensitive title/id substring matching, labelled in the UI. It does not pretend coverage it does not have. - Detection only, no automatic resume. The Restart & Resume page reads session events and reports candidates with evidence. It never resumes, injects messages, appends events, bypasses the write lock, or wakes sessions. Continue in the host's own session UI.
- No cost estimation, no provider balance/plan. No trustworthy price list or currency is available, so no money is displayed.
- No AI analysis. The plugin never calls a model;
aiAnalysisEnabledis reserved and not implemented. - No host
settings/credentialswrites. Agent-info import writes only this plugin's state; host configuration has no safe public write path for that document format, so it is reported asnot_supported, not faked. - AGENTS.md edits only touch discovered chain files. New files are not created; writes are version-guarded and backed up first. Files above the host's single-file limit are read-only here.
- Multi-tab editing is optimistic. Another tab or process changing the file first makes the later save return 409 without overwriting anything.
- Single-process status. "Not live" means "not in this host process's memory"; it does not prove the session is not running elsewhere.
- Performance. First loads are not instant: on the acceptance deployment the Tools page took ~5.6 s and the recovery scan ~17 s over 340 sessions (both have loading/progress states and bounded scans). Usage history can only replay what the host can read; the page states the statistics start point.
Configuration
Row agent-control-center in cordis.patch.yml. Unknown fields, wrong types or
out-of-range values fail loudly at load instead of silently defaulting.
| Field | Default | Meaning |
|---|---|---|
enabled | true | Turn the whole plugin off: no HTTP channel, no storage writes. |
storageDir | "" | Absolute storage root; empty means $DSH_HOME/dsh-agent-control-center. Must be absolute. |
exposeDelete | false | Reserved. Deletion stays hidden while the host has no API; this flag only allows the UI to offer it. |
maxBackups | 20 | Pre-write backups kept per instruction file (1–200). |
usageRetentionDays | 180 | Local-day retention of the usage ledger (7–730). |
usageReplaySessions | 200 | Sessions replayed on cold start (1–2000). |
usageReplayDays | 30 | Days replayed on cold start (1–365). |
aiAnalysisEnabled | false | Reserved. The AI entry point is not shipped; the plugin makes no model calls. |
Storage
$DSH_HOME/dsh-agent-control-center/ # 0700; storageDir overrides
├── state.json # settings, ignored checks, import snapshots (version 1)
├── usage-ledger.json # idempotent token ledger: per-session cursor + per-local-day totals
├── audit.jsonl # append-only audit (rotates at 4 MiB); no contents, no credentials
├── backups/<key>/ # <timestamp>.md + <timestamp>.md.meta.json per save, capped by maxBackups
├── templates/ # user templates (JSON)
├── cache/ # reserved for derived data; safe to delete
└── tmp/ # atomic-write temp area and diagnostics probes; safe to clean
Uninstalling the plugin leaves this directory untouched. The plugin writes outside it only when you explicitly save/restore an instruction file or archive/unarchive sessions — always through host services, with the caller's sandbox policy, version guard and a pre-write backup.
Development
Node >=22.19 (.nvmrc pins 22.19; CI also runs 24). There are no runtime
dependencies, so no install step is needed:
node scripts/build-client.mjs # concatenate src/client → client.js + syntax/factory/i18n/size self-checks
node --test tests/*.test.mjs # behaviour suite
node scripts/verify.mjs # contract gate: required files, module completeness, forbidden client patterns, package metadata
npm run verify runs the build first. CI (.github/workflows/ci.yml) runs build
→ node --test → verify → a packed-tarball smoke check on Node 22 and 24.
Tests never touch the real $DSH_HOME and never use the network.
Release (maintainers, after updating CHANGELOG.md):
node scripts/release.mjs patch|minor|major [--dry-run] [--notes "text"]
It runs build → full tests → verify, bumps the version, packs, commits, tags, pushes and publishes to npm, stopping at the first failure so a half-released version cannot land.
- Contribution rules: CONTRIBUTING.md
- Security policy and reporting: SECURITY.md
- Architecture, request flow, storage layout and extension points: docs/09-ARCHITECTURE.md
- Task-oriented user guide (Chinese): docs/07-GUIDE.md
- Internal contract and host-capability facts: docs/01-CONTRACT.md
- Usage analytics (provider/model rollups, cost config, prior art): docs/21-USAGE-ANALYTICS.md
- Automatic continuation (design, guards, what is infeasible without host support): docs/20-AUTO-CONTINUE.md
Version and compatibility
| Item | Value |
|---|---|
| Plugin version | 0.21.1 |
| DSH range | >=0.2.1-rc.1 <0.3.0 (engines.dsh and dsh.compatibility.dsh) |
| Verified against | DSH 0.2.2-rc.5 (web profile), Node v24.22.2, Linux x86_64 |
| Node | >=22.19 (CI: 22 and 24) |
| Host peer | @deepseek-ai/cordis ^4.0.1 (provided by the host) |
| Profiles | web, desktop (same Web client) |
| Storage document versions | state.json 1, usage-ledger.json 1, backup metadata 1, template schemaVersion 1 |
Version windows, the capability dependency matrix and the upgrade checklist are in docs/08-COMPATIBILITY.md (Chinese).
DSH public APIs are pre-stable. The plugin is defensive about that — a missing
service degrades one module instead of failing activation, and /health plus the
Diagnostics page report what is actually present — but a host upgrade outside the
declared range can still change the wiring. Storage documents with a newer
unknown version put the plugin into read-only mode for that document instead of
overwriting it.
Attribution and license
Behaviour specifications were modelled on dsh-archived-sessions (MIT,
Zephyr-vibe) and @linxin666/dsh-usage (Apache-2.0, linxin666). This is an
independent implementation: no copied source, no runtime dependency, no access to
their storage. See LICENSE and
docs/02-REFERENCE-PROVENANCE.md.
MIT © 240xu