メインコンテンツへスキップ
2

dsh-agent-control-center

240xu/dsh-agent-control-center

DSH Agent Control Center: AGENTS.md editing with backups, tool inventory, sessions, real token usage, agent metadata, diagnostics and templates in one settings page.

インストール

dsh plugin --profile web add github:240xu/dsh-agent-control-center

README

dsh-agent-control-center

English | 中文

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.

![Agent Control Center overview page](docs/assets/overview.png

Instruction preview: docs/assets/instruction.png.)

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).

PageWhat it gives youStateWhy / data source
Overviewenvironment, host capabilities, module states, key counts, links into every pageFULLEvery 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.mdinstruction-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), budgetFULLReal 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).
Toolsread-only inventory with three independent states (registered / visible to an agent / called in history), error clusters, recent failuresFULL42-tool inventory and history aggregation verified; the module never executes a tool to probe it. PARTIAL when sessionQuery is missing (history statistics unavailable).
Sessionslist, title/id search (with documented full-text fallback), workspace grouping, batched archive/unarchive, expandable detail with real activity statistics and lineagePARTIALListing, 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.
Usagereal 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 listFULLTotals, 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 infolive agents, presets, default model, redacted export, field-level diff, import previewFULLAgents/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.
Diagnostics22 probes across ten groups with evidence/impact/action, Markdown and JSON export, safe repairs limited to the plugin's own storage, post-repair re-checkFULLBaseline run: 19 ok / 2 warn / 1 unknown. Egress probing stays unknown permanently: the plugin never sends a network request to find out.
Instruction previewread-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 diffFULLLive 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 exportread-only Markdown/JSON export of one session inside a byte budget (256 KiB default, 1 MiB cap), cut at event boundaries with truncated/omittedEventsFULLLive 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 defaultFULLVerified 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 healthread-only audit of the plugin inventory, settings namespaces (secrets redacted), settings.section id conflicts (static scan of installed client bundles) and the live compatibility verdictFULLLive 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 trendsize samples recorded whenever a files-side view is generated, grouped by local day (10-minute throttle per directory, 500-sample cap, 180-day retention)FULLLive instance: sampling persisted to the plugin state and the trend returned the recorded day.
Templatessix bundled templates in five categories, source and rendered preview, variable fill, line-level diff, apply through the AGENTS.md save pipeline, user-template CRUDFULLApply was verified end-to-end through the AGENTS.md pipeline (backup + read-back hash). Templates are data only; executable content is rejected.
Restart & Resumeread-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 bootPARTIALDetection 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/health and POST /__agent-control-center/api. Only application/json bodies 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-site must not be cross-site, and a present Origin must match the request Host. 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 fs service with replaceIfVersion (optimistic lock), an explicit caller sandboxPolicy, 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 absolute storageDir), directories 0700, files 0600. JSON documents are written atomically (temp file + fsync + rename). Corrupt documents are quarantined, never silently overwritten; documents with a newer unknown version switch the plugin to read-only for that document.
  • Audit and redaction. audit.jsonl records {ts, op, target, result, detail} only — never file bodies, session bodies, or credential values. Diagnostics call settings.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 (dependencies is empty; the client only require('react')), and never calls a model. The aiAnalysisEnabled field 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; aiAnalysisEnabled is reserved and not implemented.
  • No host settings/credentials writes. 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 as not_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.

FieldDefaultMeaning
enabledtrueTurn 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.
exposeDeletefalseReserved. Deletion stays hidden while the host has no API; this flag only allows the UI to offer it.
maxBackups20Pre-write backups kept per instruction file (1–200).
usageRetentionDays180Local-day retention of the usage ledger (7–730).
usageReplaySessions200Sessions replayed on cold start (1–2000).
usageReplayDays30Days replayed on cold start (1–365).
aiAnalysisEnabledfalseReserved. 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.

Version and compatibility

ItemValue
Plugin version0.21.1
DSH range>=0.2.1-rc.1 <0.3.0 (engines.dsh and dsh.compatibility.dsh)
Verified againstDSH 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)
Profilesweb, desktop (same Web client)
Storage document versionsstate.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

関連プラグイン