@@ -136,20 +136,17 @@ Typical log locations:
136136
137137The Diagnostics tab shows the current in-memory gateway log plus a bounded previous-session tail read from ` main.log ` at startup. First-run or unreadable log files must not block boot; return an empty previous-session tail and continue.
138138
139- ## Agent Monitor (in-process)
140-
141- > ** Status (FEA-1503):** the agent monitor is FULLY FIRST-PARTY and IN-PROCESS.
142- > The third-party agent-monitor vendor tool is GONE — no sidecar, no generated
143- > tree, no vendor dependency, no vendor-generated hook handler.
144- > ` src/main/agent-monitor-listener.ts ` (` AgentHookListener ` ) owns
145- > ` 127.0.0.1:4820 ` in the main process and writes through the ` node:sqlite `
146- > repository (` src/main/database/ ` ) via the hook lifecycle state machine
147- > (` database/lifecycle.ts ` ). The renderer is a first-party React app
148- > (` src/renderer/ ` ) — there is NO iframe. The first-party collection layer
149- > (` src/main/collectors/ ` ) imports historical sessions on boot and watches the
150- > live transcript files of all five agent CLIs, writing through the same DB. The
151- > cloud relay and cost-reconciliation worker read that DB through the shared
152- > connection.
139+ ## Agent Monitor
140+
141+ > ** Status (FEA-1504):** Agent Monitor has three boot modes. The default user
142+ > experience is the legacy sidecar-backed dashboard (` agentMonitorEnabled=true ` ,
143+ > ` agentDashboardDesignSystemEnabled=false ` ): pnpm-managed upstream packages are
144+ > materialized into ` .generated/agent-monitor ` , shipped unpacked, and rendered in
145+ > the legacy iframe shell. The in-process design-system dashboard is a Labs
146+ > opt-in only. When ` agentDashboardDesignSystemEnabled ` is not the literal
147+ > boolean ` true ` , the main process must not load ` src/main/database/ ` ,
148+ > ` src/main/collectors/ ` , ` AgentHookListener ` , ` desktop:db:* ` , or the ` app:// `
149+ > design renderer path.
153150
154151The desktop app provides local Claude Code (and opt-in Codex) session/agent
155152observability. It powers the ** Dashboard** and the agent nav items (Sessions,
@@ -158,22 +155,27 @@ is gated by the persisted `agentMonitorEnabled` desktop setting, which
158155** defaults ON** ; when disabled, the agent nav items are hidden and only the
159156Gateway section remains.
160157
161- - ** Hook listener:** ` src/main/agent-monitor-listener.ts ` binds ` 127.0.0.1:4820 `
162- in the main process and accepts the hook payload (` POST /api/hooks/event ` ,
163- ` GET /api/health ` ). Each event is gated by the FEA-1407 sandbox check,
164- harness-stamped from ` __provider ` , and applied by the lifecycle state machine
165- in one ` BEGIN IMMEDIATE ` transaction. Started from ` startAgentCapture() ` (boot
166- + the enable path) ** only when ` agentMonitorEnabled ` is true** , before the
167- gateway-start try-block; a bind failure (EADDRINUSE) degrades to "no monitor"
168- rather than blocking boot.
169- - ** Collection layer (` src/main/collectors/ ` ):** ` CollectorManager ` runs a
170- best-effort boot bulk import and live file watchers for all five agent CLIs,
171- writing through the first-party ` importSession ` into the same in-process DB.
172- It is started/stopped alongside the listener (and stopped in ` shutdown() `
173- BEFORE ` agentDatabase.close() ` so a late fs-watch import can't hit a closed
174- DB). Every parsed session is sandbox-gated (FEA-1407, fail-closed) before any
175- write. Import is idempotent via a per-(session, event_type) high-water-mark on
176- ` created_at ` . Watchers self-heal if a data dir doesn't exist at boot.
158+ - ** Legacy sidecar (default):** ` src/main/agent-monitor-sidecar.ts ` launches the
159+ generated Claude-Code-Agent-Monitor runtime tree. ` build:agent-monitor `
160+ materializes the tree from pnpm-managed upstream packages; package/stage logic
161+ must keep ` .generated/agent-monitor ` available for default users.
162+ - ** Design-system runtime (Labs opt-in):** ` src/main/agent-dashboard-design-system-runtime.ts `
163+ is the only module allowed to import ` src/main/database/ ` ,
164+ ` src/main/collectors/ ` , ` AgentHookListener ` , or register ` desktop:db:* ` . It is
165+ reached only through ` await import() ` after boot mode resolves to
166+ ` design-system ` .
167+ - ** Disabled mode:** ` agentMonitorEnabled=false ` starts no sidecar, no
168+ design-system runtime, no dashboard-derived sync source, and no
169+ dashboard-derived cost source.
170+ - ** Hook listener:** in design-system mode, ` src/main/agent-monitor-listener.ts `
171+ binds ` 127.0.0.1:4820 ` in the main process and accepts the hook payload
172+ (` POST /api/hooks/event ` , ` GET /api/health ` ). Each event is gated by the
173+ FEA-1407 sandbox check, harness-stamped from ` __provider ` , and applied by the
174+ lifecycle state machine.
175+ - ** Collection layer (` src/main/collectors/ ` ):** design-system mode uses
176+ ` CollectorManager ` for best-effort boot bulk import and live file watchers for
177+ all five agent CLIs, writing through the first-party ` importSession ` into the
178+ same in-process DB.
177179- ** Fixed port (differs from the gateway):** ` 127.0.0.1:4820 `
178180 (` AGENT_MONITOR_PORT ` in ` src/shared/contracts.ts ` ). It MUST be fixed — the
179181 hook handler POSTs to ` 127.0.0.1:${CLAUDE_DASHBOARD_PORT||4820} ` , baked into
0 commit comments