@dreb/dashboard 2.63.0 → 2.64.1
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/README.md +2 -2
- package/dist/server/dashboard-images.d.ts +1 -0
- package/dist/server/dashboard-images.d.ts.map +1 -1
- package/dist/server/dashboard-images.js +19 -1
- package/dist/server/dashboard-images.js.map +1 -1
- package/dist/server/runtime-pool.d.ts.map +1 -1
- package/dist/server/runtime-pool.js +8 -1
- package/dist/server/runtime-pool.js.map +1 -1
- package/dist/shared/protocol.d.ts +2 -1
- package/dist/shared/protocol.d.ts.map +1 -1
- package/dist/shared/protocol.js.map +1 -1
- package/dist/static/assets/{index-G6JRpiHt.js → index-BBB1DnzN.js} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/static/sw.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-pool.js","sourceRoot":"","sources":["../../src/server/runtime-pool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAA+C,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAIN,+BAA+B,GAK/B,MAAM,uBAAuB,CAAC;AAE/B,6FAA6F;AAC7F,MAAM,UAAU,kBAAkB,GAAW;IAC5C,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;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,cAAc,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC;YACzC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,iBAAiB;YACjB,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;YACnD,YAAY,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE;SACzD,CAAC;IAAA,CACF;CACD","sourcesContent":["/**\n * RPC runtime pool — one `dreb --mode rpc` child process per live session.\n *\n * dreb's RPC mode is strictly one-session-per-process (switch_session repoints\n * the same process; it never multiplexes), so the pool spawns N children keyed\n * by an opaque runtime key. The telegram bridge is the in-repo precedent.\n */\n\nimport { randomBytes } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport { RpcClient, type RpcDashboardSnapshot, type RpcExitInfo } from \"@dreb/coding-agent/rpc\";\nimport {\n\ttype BackgroundAgentDto,\n\ttype FleetRuntimeSnapshotDto,\n\ttype FleetSnapshotEventDto,\n\tMAX_COMPLETED_BACKGROUND_AGENTS,\n\ttype RuntimeInfoDto,\n\ttype RuntimeStatsSummaryDto,\n\ttype SessionStateDto,\n\ttype SubagentArbitrationDto,\n} from \"../shared/protocol.js\";\n\n/** Resolve the absolute path to the dreb CLI (RpcClient defaults to a cwd-relative path). */\nexport function resolveDrebCliPath(): string {\n\tconst resolved = import.meta.resolve(\"@dreb/coding-agent\");\n\treturn join(dirname(fileURLToPath(resolved)), \"cli.js\");\n}\n\nfunction formatRpcExit(info: RpcExitInfo): string {\n\tif (info.error) return `RPC process failed: ${info.error.message}`;\n\treturn `RPC process exited (code ${info.code}, signal ${info.signal})`;\n}\n\nexport type RuntimeEventListener = (key: string, event: Record<string, unknown>) => void;\n\n/** Listener for coalesced, synchronous fleet runtime snapshots. */\nexport type FleetSnapshotListener = (event: FleetSnapshotEventDto) => void;\n\nexport { MAX_COMPLETED_BACKGROUND_AGENTS };\n\ntype DashboardSnapshotClient = RpcClient & { getDashboardSnapshot(): Promise<RpcDashboardSnapshot> };\n\nexport interface DashboardRuntimeSnapshot {\n\tkey: string;\n\tbarrierSeq: number;\n\tsnapshot: RpcDashboardSnapshot;\n}\n\nexport interface RuntimeHandle {\n\tkey: string;\n\tcwd: string;\n\tclient: RpcClient;\n\t/** Session start time (ms epoch) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: number;\n\tlastActivity: number;\n\t/** Needs-attention sources, keyed so they can be cleared independently. */\n\tattention: Map<string, string>;\n\t/** Last runtime-level error, persisted server-side so fleet refreshes stay honest. */\n\terror?: string;\n\t/** Provider error currently responsible for error/attention; retry may clear only this source. */\n\tproviderError?: string;\n\t/** Last authoritative state, patched only with event-derivable fields between RPC reads. */\n\tlastState?: SessionStateDto;\n\t/** Monotonic revision for confirmed model/thinking mutations. */\n\tsettingsRevision: number;\n\t/** Resume-path fallback; events must never invent or overwrite session identity. */\n\tsessionFileFallback?: string;\n\t/** Background agents seen via events (agentId → latest info). */\n\tbackgroundAgents: Map<string, BackgroundAgentDto>;\n}\n\nexport const DEFAULT_DASHBOARD_BARRIER_TTL_MS = 5 * 60_000;\nexport const DEFAULT_DASHBOARD_BARRIER_LIMIT = 1000;\nexport const DEFAULT_FLEET_SNAPSHOT_DEBOUNCE_MS = 200;\n\n/** Events that mutate a field carried by the lightweight fleet snapshot. */\nconst FLEET_SNAPSHOT_EVENT_TYPES = new Set([\n\t\"agent_start\",\n\t\"agent_end\",\n\t\"auto_compaction_start\",\n\t\"auto_compaction_end\",\n\t\"auto_retry_start\",\n\t\"auto_retry_end\",\n\t\"background_agent_start\",\n\t\"background_agent_end\",\n\t\"subagent_arbitration\",\n\t\"extension_ui_request\",\n\t\"extension_ui_response_handled\",\n\t\"message_end\",\n\t\"message_start\",\n\t\"parent_paused_for_background_agents\",\n\t\"runtime_removed\",\n\t\"session_name_changed\",\n\t\"suggest_next\",\n\t\"tasks_update\",\n]);\n\nexport interface RuntimePoolOptions {\n\tcliPath?: string;\n\t/** Extra args for every runtime (e.g. --provider). */\n\tbaseArgs?: string[];\n\t/** RpcClient factory override for tests. */\n\tclientFactory?: (options: { cliPath: string; cwd: string; args: string[] }) => RpcClient;\n\tlogger?: (line: string) => void;\n\t/** Bounds unclaimed RPC snapshot ordering records. */\n\tdashboardBarrierTtlMs?: number;\n\tdashboardBarrierLimit?: number;\n\t/** Injectable clock for deterministic barrier-expiry tests. */\n\tnow?: () => number;\n\t/** Coalescing delay for event-derived fleet snapshot emissions. */\n\tfleetSnapshotDebounceMs?: number;\n}\n\ninterface DashboardBarrier {\n\tseq: number;\n\trecordedAt: number;\n}\n\nexport class RuntimePool {\n\tprivate readonly runtimes = new Map<string, RuntimeHandle>();\n\tprivate readonly listeners: RuntimeEventListener[] = [];\n\tprivate readonly fleetSnapshotListeners: FleetSnapshotListener[] = [];\n\tprivate readonly cliPath: string;\n\tprivate readonly baseArgs: string[];\n\tprivate readonly clientFactory: (options: { cliPath: string; cwd: string; args: string[] }) => RpcClient;\n\tprivate readonly logger: (line: string) => void;\n\t/**\n\t * A single lazily-spawned utility runtime used to service settings/model/\n\t * agent-type endpoints when no user session is live. Kept out of `runtimes`\n\t * (and therefore out of the fleet) so it never shows as a session card.\n\t */\n\tprivate readonly utilities = new Map<string, RuntimeHandle>();\n\tprivate readonly utilityPromises = new Map<string, Promise<RuntimeHandle>>();\n\tprivate readonly starting = new Set<RuntimeHandle>();\n\tprivate readonly startupPromises = new Set<Promise<unknown>>();\n\tprivate readonly exitedHandles = new WeakSet<RuntimeHandle>();\n\t/** Snapshot ordering records observed synchronously from RpcClient stdout. */\n\tprivate readonly dashboardBarriers = new Map<string, DashboardBarrier>();\n\tprivate readonly dashboardBarrierTtlMs: number;\n\tprivate readonly dashboardBarrierLimit: number;\n\tprivate readonly now: () => number;\n\tprivate readonly fleetSnapshotDebounceMs: number;\n\tprivate dashboardBarrierPruneTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate fleetSnapshotTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate closing = false;\n\n\tconstructor(options: RuntimePoolOptions = {}) {\n\t\tthis.cliPath = options.cliPath ?? resolveDrebCliPath();\n\t\tthis.baseArgs = options.baseArgs ?? [];\n\t\tthis.clientFactory =\n\t\t\toptions.clientFactory ?? ((o) => new RpcClient({ cliPath: o.cliPath, cwd: o.cwd, args: o.args }));\n\t\tthis.logger = options.logger ?? ((line) => console.warn(`[dashboard] ${line}`));\n\t\tthis.dashboardBarrierTtlMs = options.dashboardBarrierTtlMs ?? DEFAULT_DASHBOARD_BARRIER_TTL_MS;\n\t\tthis.dashboardBarrierLimit = options.dashboardBarrierLimit ?? DEFAULT_DASHBOARD_BARRIER_LIMIT;\n\t\tthis.now = options.now ?? Date.now;\n\t\tthis.fleetSnapshotDebounceMs = options.fleetSnapshotDebounceMs ?? DEFAULT_FLEET_SNAPSHOT_DEBOUNCE_MS;\n\t}\n\n\t/** Subscribe to events from every runtime, tagged with the runtime key. */\n\tonEvent(listener: RuntimeEventListener): () => void {\n\t\tthis.listeners.push(listener);\n\t\treturn () => {\n\t\t\tconst i = this.listeners.indexOf(listener);\n\t\t\tif (i !== -1) this.listeners.splice(i, 1);\n\t\t};\n\t}\n\n\t/** Subscribe to debounced, in-memory fleet snapshots. */\n\tonFleetSnapshot(listener: FleetSnapshotListener): () => void {\n\t\tthis.fleetSnapshotListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst i = this.fleetSnapshotListeners.indexOf(listener);\n\t\t\tif (i !== -1) this.fleetSnapshotListeners.splice(i, 1);\n\t\t};\n\t}\n\n\t/**\n\t * Build the fleet's live-runtime view without RPC or disk access. Map\n\t * insertion order is retained intentionally; the UI owns presentation order.\n\t */\n\tfleetSnapshot(): FleetRuntimeSnapshotDto[] {\n\t\treturn [...this.runtimes.values()].map((handle) => this.describeFleetRuntime(handle));\n\t}\n\n\tlist(): RuntimeHandle[] {\n\t\treturn [...this.runtimes.values()];\n\t}\n\n\tget(key: string): RuntimeHandle | undefined {\n\t\treturn this.runtimes.get(key);\n\t}\n\n\t/** Apply a confirmed model mutation to both the child and the pool snapshot. */\n\tasync setModel(\n\t\thandle: RuntimeHandle,\n\t\tprovider: string,\n\t\tmodelId: string,\n\t): Promise<{\n\t\tmodel: { provider: string; id: string };\n\t\tthinkingLevel: string;\n\t\tavailableThinkingLevels: string[];\n\t\tsettingsRevision: number;\n\t}> {\n\t\tconst model = await handle.client.setModel(provider, modelId);\n\t\tconst state = await handle.client.getState();\n\t\thandle.lastState = {\n\t\t\t...this.fallbackState(handle),\n\t\t\tmodel,\n\t\t\tthinkingLevel: state.thinkingLevel,\n\t\t\tavailableThinkingLevels: state.availableThinkingLevels,\n\t\t};\n\t\thandle.settingsRevision += 1;\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t\treturn {\n\t\t\tmodel,\n\t\t\tthinkingLevel: state.thinkingLevel,\n\t\t\tavailableThinkingLevels: state.availableThinkingLevels,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t};\n\t}\n\n\t/** Apply a confirmed thinking mutation to both the child and the pool snapshot. */\n\tasync setThinkingLevel(\n\t\thandle: RuntimeHandle,\n\t\tlevel: Parameters<RpcClient[\"setThinkingLevel\"]>[0],\n\t): Promise<{ ok: true; settingsRevision: number }> {\n\t\tawait handle.client.setThinkingLevel(level);\n\t\thandle.lastState = { ...this.fallbackState(handle), thinkingLevel: level };\n\t\thandle.settingsRevision += 1;\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t\treturn { ok: true, settingsRevision: handle.settingsRevision };\n\t}\n\n\t/**\n\t * Record the EventHub sequence synchronously when the RPC snapshot marker\n\t * arrives. The marker line precedes its response on stdout, so this runs\n\t * before the RpcClient response continuation even across separate chunks.\n\t */\n\trecordDashboardBarrier(runtimeKey: string, snapshotId: string, seq: number): void {\n\t\tthis.pruneDashboardBarriers();\n\t\tthis.dashboardBarriers.set(this.dashboardBarrierKey(runtimeKey, snapshotId), { seq, recordedAt: this.now() });\n\t\tthis.pruneDashboardBarriers();\n\t}\n\n\t/**\n\t * Capture a parent-session recovery snapshot and pair it with the sequence\n\t * captured at its RPC marker. This deliberately does not infer ordering from\n\t * await: later EventHub publications naturally have higher sequence numbers.\n\t */\n\tasync snapshotDashboard(handle: RuntimeHandle): Promise<DashboardRuntimeSnapshot> {\n\t\tconst snapshot = await (handle.client as DashboardSnapshotClient).getDashboardSnapshot();\n\t\tthis.pruneDashboardBarriers();\n\t\tconst barrierKey = this.dashboardBarrierKey(handle.key, snapshot.snapshotId);\n\t\tconst barrier = this.dashboardBarriers.get(barrierKey);\n\t\tthis.dashboardBarriers.delete(barrierKey);\n\t\tthis.scheduleDashboardBarrierPrune();\n\t\tif (!barrier) {\n\t\t\tthrow new Error(`Dashboard snapshot ${snapshot.snapshotId} arrived without its ordering barrier`);\n\t\t}\n\t\t// This is an authoritative RPC baseline, so it may legitimately lower the\n\t\t// count after a fork/rewind instead of retaining an event-derived maximum.\n\t\thandle.lastState = snapshot.state;\n\t\tthis.scheduleFleetSnapshot();\n\t\treturn { key: handle.key, barrierSeq: barrier.seq, snapshot };\n\t}\n\n\tprivate dashboardBarrierKey(runtimeKey: string, snapshotId: string): string {\n\t\treturn `${runtimeKey}\\0${snapshotId}`;\n\t}\n\n\tprivate pruneDashboardBarriers(): void {\n\t\tconst oldestAllowed = this.now() - this.dashboardBarrierTtlMs;\n\t\tfor (const [snapshotId, barrier] of this.dashboardBarriers) {\n\t\t\tif (barrier.recordedAt < oldestAllowed) this.dashboardBarriers.delete(snapshotId);\n\t\t}\n\t\twhile (this.dashboardBarriers.size > this.dashboardBarrierLimit) {\n\t\t\tconst oldest = this.dashboardBarriers.keys().next().value;\n\t\t\tif (oldest === undefined) break;\n\t\t\tthis.dashboardBarriers.delete(oldest);\n\t\t}\n\t\tthis.scheduleDashboardBarrierPrune();\n\t}\n\n\tprivate scheduleDashboardBarrierPrune(): void {\n\t\tif (this.dashboardBarrierPruneTimer) clearTimeout(this.dashboardBarrierPruneTimer);\n\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\tlet oldest: DashboardBarrier | undefined;\n\t\tfor (const barrier of this.dashboardBarriers.values()) {\n\t\t\tif (!oldest || barrier.recordedAt < oldest.recordedAt) oldest = barrier;\n\t\t}\n\t\tif (!oldest) return;\n\t\tconst delay = Math.max(1, oldest.recordedAt + this.dashboardBarrierTtlMs - this.now() + 1);\n\t\tthis.dashboardBarrierPruneTimer = setTimeout(() => {\n\t\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\t\tthis.pruneDashboardBarriers();\n\t\t}, delay);\n\t\tthis.dashboardBarrierPruneTimer.unref?.();\n\t}\n\n\tprivate scheduleFleetSnapshot(): void {\n\t\tif (this.closing) return;\n\t\tif (this.fleetSnapshotTimer) clearTimeout(this.fleetSnapshotTimer);\n\t\tthis.fleetSnapshotTimer = setTimeout(() => {\n\t\t\tthis.fleetSnapshotTimer = undefined;\n\t\t\tif (this.closing) return;\n\t\t\tconst event: FleetSnapshotEventDto = { type: \"fleet_snapshot\", runtimes: this.fleetSnapshot() };\n\t\t\tfor (const listener of this.fleetSnapshotListeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(event);\n\t\t\t\t} catch {\n\t\t\t\t\t// An SSE bridge subscriber must not break the pool's event loop.\n\t\t\t\t}\n\t\t\t}\n\t\t}, this.fleetSnapshotDebounceMs);\n\t\tthis.fleetSnapshotTimer.unref?.();\n\t}\n\n\t/** Spawn a new runtime in `cwd`, optionally opening an existing session file. */\n\tasync create(cwd: string, sessionPath?: string): Promise<RuntimeHandle> {\n\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\tconst key = randomBytes(6).toString(\"hex\");\n\t\tconst args = [\"--ui\", \"dashboard\", ...this.baseArgs];\n\t\tif (sessionPath) args.push(\"--session\", sessionPath);\n\t\tconst client = this.clientFactory({ cliPath: this.cliPath, cwd, args });\n\t\tconst handle: RuntimeHandle = {\n\t\t\tkey,\n\t\t\tcwd,\n\t\t\tclient,\n\t\t\tcreatedAt: this.now(),\n\t\t\tlastActivity: this.now(),\n\t\t\tattention: new Map(),\n\t\t\tsettingsRevision: 0,\n\t\t\tsessionFileFallback: sessionPath,\n\t\t\tbackgroundAgents: new Map(),\n\t\t};\n\t\tclient.onEvent((event) => this.handleEvent(handle, event as unknown as Record<string, unknown>));\n\t\tclient.onExit((info) => this.handleRuntimeExit(handle, info));\n\n\t\tconst startup = this.startSessionRuntime(handle);\n\t\tthis.startupPromises.add(startup);\n\t\ttry {\n\t\t\treturn await startup;\n\t\t} finally {\n\t\t\tthis.startupPromises.delete(startup);\n\t\t}\n\t}\n\n\tprivate async startSessionRuntime(handle: RuntimeHandle): Promise<RuntimeHandle> {\n\t\tthis.starting.add(handle);\n\t\ttry {\n\t\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\t\tawait handle.client.start();\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tawait this.seedBackgroundAgents(handle);\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tthis.runtimes.set(handle.key, handle);\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t\treturn handle;\n\t\t} finally {\n\t\t\tthis.starting.delete(handle);\n\t\t}\n\t}\n\n\t/** Stop a runtime and remove it from the pool. */\n\tasync stop(key: string): Promise<boolean> {\n\t\tconst handle = this.runtimes.get(key);\n\t\tif (!handle) return false;\n\t\tthis.handleEvent(handle, { type: \"runtime_removed\" });\n\t\tthis.runtimes.delete(key);\n\t\tthis.scheduleFleetSnapshot();\n\t\tawait handle.client.stop();\n\t\treturn true;\n\t}\n\n\t/**\n\t * Return any live runtime suitable for process-global settings work, spawning\n\t * a hidden utility runtime (in the home directory) if no user session exists.\n\t * This is what lets the settings page — models, agent types, defaults — work\n\t * with zero sessions open, instead of 503-ing.\n\t */\n\tasync ensureUtilityRuntime(cwd = homedir()): Promise<RuntimeHandle> {\n\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\tconst existing = this.utilities.get(cwd);\n\t\tif (existing) return existing;\n\t\tlet promise = this.utilityPromises.get(cwd);\n\t\tif (!promise) {\n\t\t\tconst args = [\"--ui\", \"dashboard\", ...this.baseArgs];\n\t\t\tconst client = this.clientFactory({ cliPath: this.cliPath, cwd, args });\n\t\t\tconst handle: RuntimeHandle = {\n\t\t\t\tkey: `utility:${cwd}`,\n\t\t\t\tcwd,\n\t\t\t\tclient,\n\t\t\t\tcreatedAt: this.now(),\n\t\t\t\tlastActivity: this.now(),\n\t\t\t\tattention: new Map(),\n\t\t\t\tsettingsRevision: 0,\n\t\t\t\tbackgroundAgents: new Map(),\n\t\t\t};\n\t\t\tconst startup = this.startUtilityRuntime(cwd, handle);\n\t\t\tthis.startupPromises.add(startup);\n\t\t\tpromise = startup\n\t\t\t\t.catch((err) => {\n\t\t\t\t\t// Allow a retry on the next request instead of caching the failure.\n\t\t\t\t\tthis.utilityPromises.delete(cwd);\n\t\t\t\t\tthrow err;\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.startupPromises.delete(startup);\n\t\t\t\t});\n\t\t\tthis.utilityPromises.set(cwd, promise);\n\t\t}\n\t\treturn promise;\n\t}\n\n\tprivate async startUtilityRuntime(cwd: string, handle: RuntimeHandle): Promise<RuntimeHandle> {\n\t\tthis.starting.add(handle);\n\t\ttry {\n\t\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\t\tawait handle.client.start();\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tthis.utilities.set(cwd, handle);\n\t\t\treturn handle;\n\t\t} finally {\n\t\t\tthis.starting.delete(handle);\n\t\t}\n\t}\n\n\tasync stopAll(): Promise<void> {\n\t\tthis.closing = true;\n\t\tif (this.dashboardBarrierPruneTimer) clearTimeout(this.dashboardBarrierPruneTimer);\n\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\tif (this.fleetSnapshotTimer) clearTimeout(this.fleetSnapshotTimer);\n\t\tthis.fleetSnapshotTimer = undefined;\n\t\tthis.fleetSnapshotListeners.length = 0;\n\t\tthis.dashboardBarriers.clear();\n\t\tconst handles = new Set<RuntimeHandle>([\n\t\t\t...this.runtimes.values(),\n\t\t\t...this.utilities.values(),\n\t\t\t...this.starting.values(),\n\t\t]);\n\t\tconst startupPromises = new Set<Promise<unknown>>([...this.startupPromises, ...this.utilityPromises.values()]);\n\t\tthis.runtimes.clear();\n\t\tthis.utilities.clear();\n\t\tthis.utilityPromises.clear();\n\t\tawait Promise.allSettled([...handles].map((handle) => handle.client.stop()));\n\t\tawait Promise.allSettled([...startupPromises]);\n\t}\n\n\tprivate handleRuntimeExit(handle: RuntimeHandle, info: RpcExitInfo): void {\n\t\tif (this.closing || this.exitedHandles.has(handle) || !this.isLiveHandle(handle)) return;\n\t\tthis.exitedHandles.add(handle);\n\t\tconst message = formatRpcExit(info);\n\t\tthis.recordRuntimeError(handle, message);\n\t\tthis.logger(`runtime ${handle.key} ${message}`);\n\t\tthis.handleEvent(handle, { type: \"agent_end\", messages: [], aborted: true, errorMessage: message });\n\t}\n\n\tprivate isLiveHandle(handle: RuntimeHandle): boolean {\n\t\treturn (\n\t\t\tthis.runtimes.get(handle.key) === handle ||\n\t\t\tthis.utilities.get(handle.cwd) === handle ||\n\t\t\tthis.starting.has(handle)\n\t\t);\n\t}\n\n\tprivate handleEvent(handle: RuntimeHandle, event: Record<string, unknown>): void {\n\t\tconst type = event.type as string;\n\t\tif (type !== \"dashboard_snapshot_barrier\") {\n\t\t\thandle.lastActivity = this.now();\n\t\t\tthis.updateStateFromEvent(handle, event, type);\n\t\t}\n\n\t\t// Track needs-attention sources: extension UI requests, parent\n\t\t// paused, error states.\n\t\tif (type === \"extension_ui_request\") {\n\t\t\tconst method = event.method as string;\n\t\t\tif (\n\t\t\t\tmethod === \"select\" ||\n\t\t\t\tmethod === \"confirm\" ||\n\t\t\t\tmethod === \"input\" ||\n\t\t\t\tmethod === \"editor\" ||\n\t\t\t\tmethod === \"ask\"\n\t\t\t) {\n\t\t\t\thandle.attention.set(`ui:${event.id}`, `extension ${method} awaiting response`);\n\t\t\t}\n\t\t}\n\t\tif (type === \"extension_ui_response_handled\") {\n\t\t\thandle.attention.delete(`ui:${event.id}`);\n\t\t}\n\t\tif (type === \"agent_start\") {\n\t\t\t// A new turn clears prior UI-request attention (requests were resolved or timed out).\n\t\t\tfor (const k of [...handle.attention.keys()]) {\n\t\t\t\tif (k.startsWith(\"ui:\")) handle.attention.delete(k);\n\t\t\t}\n\t\t\thandle.attention.delete(\"paused\");\n\t\t\thandle.attention.delete(\"suggest\");\n\t\t\thandle.attention.delete(\"error\");\n\t\t\thandle.error = undefined;\n\t\t\thandle.providerError = undefined;\n\t\t}\n\t\tif (type === \"suggest_next\") {\n\t\t\t// suggest_next as the ending action = \"your move\": mark needs-attention\n\t\t\t// so the fleet card doesn't read idle. Cleared on the next agent_start.\n\t\t\thandle.attention.set(\"suggest\", \"suggested command awaiting\");\n\t\t}\n\t\tif (type === \"parent_paused_for_background_agents\") {\n\t\t\thandle.attention.set(\"paused\", `paused — ${event.runningAgentCount} background agents running`);\n\t\t}\n\t\tif (type === \"agent_end\") {\n\t\t\thandle.attention.delete(\"paused\");\n\t\t\tif (event.errorMessage) this.recordRuntimeError(handle, String(event.errorMessage));\n\t\t}\n\t\tif (type === \"message_end\") {\n\t\t\tconst message = event.message;\n\t\t\tif (message && typeof message === \"object\" && !Array.isArray(message)) {\n\t\t\t\tconst assistant = message as Record<string, unknown>;\n\t\t\t\tif (assistant.role === \"assistant\" && assistant.stopReason === \"error\") {\n\t\t\t\t\tconst rawError = assistant.errorMessage;\n\t\t\t\t\tconst error = typeof rawError === \"string\" && rawError.trim().length > 0 ? rawError : \"Unknown error\";\n\t\t\t\t\tthis.recordProviderError(handle, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (type === \"auto_retry_start\") this.clearProviderError(handle);\n\t\tif (type === \"auto_compaction_start\" && event.reason === \"overflow\") this.clearProviderError(handle);\n\t\tif (type === \"auto_retry_end\" && event.success === false && event.finalError) {\n\t\t\tthis.recordProviderError(handle, String(event.finalError));\n\t\t} else if (type === \"auto_retry_end\" && event.success === true) {\n\t\t\tthis.clearProviderError(handle);\n\t\t}\n\t\tif (type === \"auto_compaction_end\" && event.errorMessage) {\n\t\t\tthis.recordRuntimeError(handle, String(event.errorMessage));\n\t\t}\n\n\t\t// Track background agents from lifecycle events.\n\t\tif (type === \"background_agent_start\") {\n\t\t\thandle.backgroundAgents.set(event.agentId as string, {\n\t\t\t\tagentId: event.agentId as string,\n\t\t\t\tagentType: event.agentType as string,\n\t\t\t\ttaskSummary: event.taskSummary as string,\n\t\t\t\tstartedAt: new Date().toISOString(),\n\t\t\t\tstatus: \"running\",\n\t\t\t\tsessionDir: event.sessionDir as string | undefined,\n\t\t\t});\n\t\t}\n\t\tif (type === \"subagent_arbitration\") {\n\t\t\tconst existing = handle.backgroundAgents.get(event.agentId as string);\n\t\t\tif (existing) {\n\t\t\t\tconst record: SubagentArbitrationDto = {\n\t\t\t\t\tstatus: event.status as SubagentArbitrationDto[\"status\"],\n\t\t\t\t\tproposed: event.proposed as SubagentArbitrationDto[\"proposed\"],\n\t\t\t\t\tfinal: (event.final as SubagentArbitrationDto[\"final\"]) ?? null,\n\t\t\t\t\tchanged: (event.changed as SubagentArbitrationDto[\"changed\"]) ?? [],\n\t\t\t\t\tstep: event.step as number | undefined,\n\t\t\t\t\terrorCode: event.errorCode as string | undefined,\n\t\t\t\t\terrorMessage: event.errorMessage as string | undefined,\n\t\t\t\t};\n\t\t\t\texisting.arbitrations = [...(existing.arbitrations ?? []), record];\n\t\t\t\tif (record.status === \"success\" && record.final) existing.agentType = record.final.agent;\n\t\t\t}\n\t\t}\n\t\tif (type === \"background_agent_end\") {\n\t\t\tconst existing = handle.backgroundAgents.get(event.agentId as string);\n\t\t\tif (existing) {\n\t\t\t\texisting.status = event.success ? \"completed\" : \"failed\";\n\t\t\t\texisting.sessionFile = (event.sessionFile as string | undefined) ?? existing.sessionFile;\n\t\t\t\tthis.pruneCompletedBackgroundAgents(handle);\n\t\t\t}\n\t\t}\n\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener(handle.key, event);\n\t\t\t} catch {\n\t\t\t\t// A broken SSE subscriber must not break event distribution.\n\t\t\t}\n\t\t}\n\t\tif (this.runtimes.get(handle.key) === handle && FLEET_SNAPSHOT_EVENT_TYPES.has(type)) {\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t}\n\t}\n\n\t/**\n\t * Events intentionally patch only fields they can prove. Session identity,\n\t * session file, configuration, and context usage remain from the last RPC\n\t * baseline (or the stable creation fallback) until a later reconciliation.\n\t */\n\tprivate updateStateFromEvent(handle: RuntimeHandle, event: Record<string, unknown>, type: string): void {\n\t\tconst state = this.fallbackState(handle);\n\t\tswitch (type) {\n\t\t\tcase \"agent_start\": {\n\t\t\t\tconst model = event.model;\n\t\t\t\tif (\n\t\t\t\t\tmodel &&\n\t\t\t\t\ttypeof model === \"object\" &&\n\t\t\t\t\ttypeof (model as Record<string, unknown>).provider === \"string\" &&\n\t\t\t\t\ttypeof (model as Record<string, unknown>).id === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tconst nextModel = model as { provider: string; id: string };\n\t\t\t\t\tstate.model =\n\t\t\t\t\t\tstate.model?.provider === nextModel.provider && state.model.id === nextModel.id\n\t\t\t\t\t\t\t? { ...state.model, ...nextModel }\n\t\t\t\t\t\t\t: nextModel;\n\t\t\t\t}\n\t\t\t\tstate.isStreaming = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"agent_end\":\n\t\t\t\tstate.isStreaming = false;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_compaction_start\":\n\t\t\t\tstate.isCompacting = true;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_compaction_end\":\n\t\t\t\tstate.isCompacting = false;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_retry_start\":\n\t\t\t\tstate.isRetrying = true;\n\t\t\t\tstate.retryAttempt = typeof event.attempt === \"number\" ? event.attempt : state.retryAttempt;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_retry_end\":\n\t\t\t\tstate.isRetrying = false;\n\t\t\t\tstate.retryAttempt = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"tasks_update\":\n\t\t\t\tif (Array.isArray(event.tasks)) state.tasks = [...event.tasks] as SessionStateDto[\"tasks\"];\n\t\t\t\tbreak;\n\t\t\tcase \"session_name_changed\":\n\t\t\t\tif (typeof event.name === \"string\") state.sessionName = event.name;\n\t\t\t\tbreak;\n\t\t\tcase \"message_start\":\n\t\t\t\tstate.messageCount += 1;\n\t\t\t\tbreak;\n\t\t}\n\t\thandle.lastState = state;\n\t}\n\n\tprivate recordRuntimeError(handle: RuntimeHandle, message: string): void {\n\t\thandle.error = message;\n\t\thandle.attention.set(\"error\", message);\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t}\n\n\tprivate recordProviderError(handle: RuntimeHandle, message: string): void {\n\t\thandle.providerError = message;\n\t\tthis.recordRuntimeError(handle, message);\n\t}\n\n\tprivate clearProviderError(handle: RuntimeHandle): void {\n\t\tconst providerError = handle.providerError;\n\t\tif (providerError === undefined) return;\n\t\thandle.providerError = undefined;\n\t\tif (handle.error === providerError) handle.error = undefined;\n\t\tif (handle.attention.get(\"error\") === providerError) handle.attention.delete(\"error\");\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t}\n\n\tprivate pruneCompletedBackgroundAgents(handle: RuntimeHandle): void {\n\t\tconst evictable = [...handle.backgroundAgents.values()]\n\t\t\t.map((agent, index) => {\n\t\t\t\tconst startedAtMs = Date.parse(agent.startedAt);\n\t\t\t\treturn { agent, index, startedAtMs: Number.isFinite(startedAtMs) ? startedAtMs : 0 };\n\t\t\t})\n\t\t\t.filter(({ agent }) => agent.status !== \"running\")\n\t\t\t.sort((a, b) => a.startedAtMs - b.startedAtMs || a.index - b.index);\n\t\tconst excess = evictable.length - MAX_COMPLETED_BACKGROUND_AGENTS;\n\t\tif (excess <= 0) return;\n\t\tfor (const { agent } of evictable.slice(0, excess)) {\n\t\t\thandle.backgroundAgents.delete(agent.agentId);\n\t\t}\n\t}\n\n\tprivate fallbackState(handle: RuntimeHandle): SessionStateDto {\n\t\tconst previous = handle.lastState;\n\t\treturn {\n\t\t\t...previous,\n\t\t\tsessionId: previous?.sessionId ?? handle.key,\n\t\t\ttasks: previous?.tasks ? [...previous.tasks] : [],\n\t\t\tthinkingLevel: previous?.thinkingLevel ?? \"off\",\n\t\t\tavailableThinkingLevels: previous?.availableThinkingLevels ? [...previous.availableThinkingLevels] : [\"off\"],\n\t\t\tisStreaming: previous?.isStreaming ?? false,\n\t\t\tisRetrying: previous?.isRetrying ?? false,\n\t\t\tretryAttempt: previous?.retryAttempt ?? 0,\n\t\t\tisCompacting: previous?.isCompacting ?? false,\n\t\t\tsteeringMode: previous?.steeringMode ?? \"all\",\n\t\t\tfollowUpMode: previous?.followUpMode ?? \"all\",\n\t\t\tsessionFile: previous?.sessionFile ?? handle.sessionFileFallback,\n\t\t\tautoCompactionEnabled: previous?.autoCompactionEnabled ?? false,\n\t\t\tmessageCount: previous?.messageCount ?? 0,\n\t\t\tpendingMessageCount: previous?.pendingMessageCount ?? 0,\n\t\t};\n\t}\n\n\tprivate describeFleetRuntime(handle: RuntimeHandle): FleetRuntimeSnapshotDto {\n\t\tconst state = this.fallbackState(handle);\n\t\treturn {\n\t\t\tkey: handle.key,\n\t\t\tcwd: handle.cwd,\n\t\t\tstate,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t\tbackgroundAgents: [...handle.backgroundAgents.values()].map((agent) => ({ ...agent })),\n\t\t\tneedsAttention: handle.attention.size > 0,\n\t\t\terror: handle.error,\n\t\t\tcreatedAt: new Date(handle.createdAt).toISOString(),\n\t\t\tlastActivity: new Date(handle.lastActivity).toISOString(),\n\t\t};\n\t}\n\n\tprivate async seedBackgroundAgents(handle: RuntimeHandle): Promise<void> {\n\t\ttry {\n\t\t\tconst agents = (await handle.client.listBackgroundAgents()) as unknown as BackgroundAgentDto[];\n\t\t\tfor (const agent of agents) {\n\t\t\t\thandle.backgroundAgents.set(agent.agentId, agent);\n\t\t\t}\n\t\t\tthis.pruneCompletedBackgroundAgents(handle);\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} background-agent registry unavailable: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Snapshot a runtime for the fleet endpoint. */\n\tasync describe(handle: RuntimeHandle): Promise<RuntimeInfoDto> {\n\t\tconst previousFleetRuntime =\n\t\t\tthis.runtimes.get(handle.key) === handle ? this.describeFleetRuntime(handle) : undefined;\n\t\tlet fleetRuntimeEnriched = false;\n\t\tlet state: SessionStateDto;\n\t\ttry {\n\t\t\tconst authoritative = (await handle.client.getState()) as unknown as SessionStateDto;\n\t\t\tconst fallback = this.fallbackState(handle);\n\t\t\tstate = {\n\t\t\t\t...fallback,\n\t\t\t\t...authoritative,\n\t\t\t\tsessionId: authoritative.sessionId ?? fallback.sessionId,\n\t\t\t\tsessionFile: authoritative.sessionFile ?? fallback.sessionFile,\n\t\t\t\ttasks: authoritative.tasks ?? fallback.tasks,\n\t\t\t};\n\t\t\thandle.lastState = state;\n\t\t\tfleetRuntimeEnriched = true;\n\t\t\tif (handle.error?.startsWith(\"RPC process\")) {\n\t\t\t\thandle.error = undefined;\n\t\t\t\thandle.attention.delete(\"error\");\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.recordRuntimeError(handle, message);\n\t\t\tthis.logger(`runtime ${handle.key} state unavailable for fleet card: ${message}`);\n\t\t\tstate = this.fallbackState(handle);\n\t\t}\n\t\tlet stats: RuntimeStatsSummaryDto | undefined;\n\t\ttry {\n\t\t\tconst sessionStats = await handle.client.getSessionStats();\n\t\t\tstats = { tokensTotal: sessionStats.tokens.total, cost: sessionStats.cost };\n\t\t\tif (sessionStats.contextUsage) {\n\t\t\t\thandle.lastState = { ...this.fallbackState(handle), contextUsage: sessionStats.contextUsage };\n\t\t\t\tfleetRuntimeEnriched = true;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} stats unavailable for fleet card: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t\tlet lastAssistantText: string | undefined;\n\t\ttry {\n\t\t\tconst text = await handle.client.getLastAssistantText();\n\t\t\tlastAssistantText = text ? text.slice(0, 200) : undefined;\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} last assistant text unavailable for fleet card: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\tfleetRuntimeEnriched &&\n\t\t\tpreviousFleetRuntime &&\n\t\t\tthis.runtimes.get(handle.key) === handle &&\n\t\t\t!isDeepStrictEqual(previousFleetRuntime, this.describeFleetRuntime(handle))\n\t\t) {\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t}\n\t\treturn {\n\t\t\tkey: handle.key,\n\t\t\tcwd: handle.cwd,\n\t\t\tstate,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t\tstats,\n\t\t\tbackgroundAgents: [...handle.backgroundAgents.values()],\n\t\t\tneedsAttention: handle.attention.size > 0,\n\t\t\terror: handle.error,\n\t\t\tlastAssistantText,\n\t\t\tcreatedAt: new Date(handle.createdAt).toISOString(),\n\t\t\tlastActivity: new Date(handle.lastActivity).toIS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AAA,CACF;CACD","sourcesContent":["/**\n * RPC runtime pool — one `dreb --mode rpc` child process per live session.\n *\n * dreb's RPC mode is strictly one-session-per-process (switch_session repoints\n * the same process; it never multiplexes), so the pool spawns N children keyed\n * by an opaque runtime key. The telegram bridge is the in-repo precedent.\n */\n\nimport { randomBytes } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { isDeepStrictEqual } from \"node:util\";\nimport { RpcClient, type RpcDashboardSnapshot, type RpcExitInfo } from \"@dreb/coding-agent/rpc\";\nimport {\n\ttype BackgroundAgentDto,\n\ttype FleetRuntimeSnapshotDto,\n\ttype FleetSnapshotEventDto,\n\tMAX_COMPLETED_BACKGROUND_AGENTS,\n\ttype RuntimeInfoDto,\n\ttype RuntimeStatsSummaryDto,\n\ttype SessionStateDto,\n\ttype SubagentArbitrationDto,\n} from \"../shared/protocol.js\";\n\n/** Resolve the absolute path to the dreb CLI (RpcClient defaults to a cwd-relative path). */\nexport function resolveDrebCliPath(): string {\n\tconst resolved = import.meta.resolve(\"@dreb/coding-agent\");\n\treturn join(dirname(fileURLToPath(resolved)), \"cli.js\");\n}\n\nfunction formatRpcExit(info: RpcExitInfo): string {\n\tif (info.error) return `RPC process failed: ${info.error.message}`;\n\tconst tail = info.stderrTail?.trim();\n\t// When the child aborted on its own (e.g. the stdout backpressure guard),\n\t// its stderr tail carries the actual reason — surface it instead of a bare\n\t// exit code. The tail may be multi-line; the existing UI already renders\n\t// multi-line error messages (e.g. timeouts embed full stderr).\n\treturn tail\n\t\t? `RPC process exited (code ${info.code}, signal ${info.signal}). Stderr tail: ${tail}`\n\t\t: `RPC process exited (code ${info.code}, signal ${info.signal})`;\n}\n\nexport type RuntimeEventListener = (key: string, event: Record<string, unknown>) => void;\n\n/** Listener for coalesced, synchronous fleet runtime snapshots. */\nexport type FleetSnapshotListener = (event: FleetSnapshotEventDto) => void;\n\nexport { MAX_COMPLETED_BACKGROUND_AGENTS };\n\ntype DashboardSnapshotClient = RpcClient & { getDashboardSnapshot(): Promise<RpcDashboardSnapshot> };\n\nexport interface DashboardRuntimeSnapshot {\n\tkey: string;\n\tbarrierSeq: number;\n\tsnapshot: RpcDashboardSnapshot;\n}\n\nexport interface RuntimeHandle {\n\tkey: string;\n\tcwd: string;\n\tclient: RpcClient;\n\t/** Session start time (ms epoch) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: number;\n\tlastActivity: number;\n\t/** Needs-attention sources, keyed so they can be cleared independently. */\n\tattention: Map<string, string>;\n\t/** Last runtime-level error, persisted server-side so fleet refreshes stay honest. */\n\terror?: string;\n\t/** Provider error currently responsible for error/attention; retry may clear only this source. */\n\tproviderError?: string;\n\t/** Last authoritative state, patched only with event-derivable fields between RPC reads. */\n\tlastState?: SessionStateDto;\n\t/** Monotonic revision for confirmed model/thinking mutations. */\n\tsettingsRevision: number;\n\t/** Resume-path fallback; events must never invent or overwrite session identity. */\n\tsessionFileFallback?: string;\n\t/** Background agents seen via events (agentId → latest info). */\n\tbackgroundAgents: Map<string, BackgroundAgentDto>;\n}\n\nexport const DEFAULT_DASHBOARD_BARRIER_TTL_MS = 5 * 60_000;\nexport const DEFAULT_DASHBOARD_BARRIER_LIMIT = 1000;\nexport const DEFAULT_FLEET_SNAPSHOT_DEBOUNCE_MS = 200;\n\n/** Events that mutate a field carried by the lightweight fleet snapshot. */\nconst FLEET_SNAPSHOT_EVENT_TYPES = new Set([\n\t\"agent_start\",\n\t\"agent_end\",\n\t\"auto_compaction_start\",\n\t\"auto_compaction_end\",\n\t\"auto_retry_start\",\n\t\"auto_retry_end\",\n\t\"background_agent_start\",\n\t\"background_agent_end\",\n\t\"subagent_arbitration\",\n\t\"extension_ui_request\",\n\t\"extension_ui_response_handled\",\n\t\"message_end\",\n\t\"message_start\",\n\t\"parent_paused_for_background_agents\",\n\t\"runtime_removed\",\n\t\"session_name_changed\",\n\t\"suggest_next\",\n\t\"tasks_update\",\n]);\n\nexport interface RuntimePoolOptions {\n\tcliPath?: string;\n\t/** Extra args for every runtime (e.g. --provider). */\n\tbaseArgs?: string[];\n\t/** RpcClient factory override for tests. */\n\tclientFactory?: (options: { cliPath: string; cwd: string; args: string[] }) => RpcClient;\n\tlogger?: (line: string) => void;\n\t/** Bounds unclaimed RPC snapshot ordering records. */\n\tdashboardBarrierTtlMs?: number;\n\tdashboardBarrierLimit?: number;\n\t/** Injectable clock for deterministic barrier-expiry tests. */\n\tnow?: () => number;\n\t/** Coalescing delay for event-derived fleet snapshot emissions. */\n\tfleetSnapshotDebounceMs?: number;\n}\n\ninterface DashboardBarrier {\n\tseq: number;\n\trecordedAt: number;\n}\n\nexport class RuntimePool {\n\tprivate readonly runtimes = new Map<string, RuntimeHandle>();\n\tprivate readonly listeners: RuntimeEventListener[] = [];\n\tprivate readonly fleetSnapshotListeners: FleetSnapshotListener[] = [];\n\tprivate readonly cliPath: string;\n\tprivate readonly baseArgs: string[];\n\tprivate readonly clientFactory: (options: { cliPath: string; cwd: string; args: string[] }) => RpcClient;\n\tprivate readonly logger: (line: string) => void;\n\t/**\n\t * A single lazily-spawned utility runtime used to service settings/model/\n\t * agent-type endpoints when no user session is live. Kept out of `runtimes`\n\t * (and therefore out of the fleet) so it never shows as a session card.\n\t */\n\tprivate readonly utilities = new Map<string, RuntimeHandle>();\n\tprivate readonly utilityPromises = new Map<string, Promise<RuntimeHandle>>();\n\tprivate readonly starting = new Set<RuntimeHandle>();\n\tprivate readonly startupPromises = new Set<Promise<unknown>>();\n\tprivate readonly exitedHandles = new WeakSet<RuntimeHandle>();\n\t/** Snapshot ordering records observed synchronously from RpcClient stdout. */\n\tprivate readonly dashboardBarriers = new Map<string, DashboardBarrier>();\n\tprivate readonly dashboardBarrierTtlMs: number;\n\tprivate readonly dashboardBarrierLimit: number;\n\tprivate readonly now: () => number;\n\tprivate readonly fleetSnapshotDebounceMs: number;\n\tprivate dashboardBarrierPruneTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate fleetSnapshotTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate closing = false;\n\n\tconstructor(options: RuntimePoolOptions = {}) {\n\t\tthis.cliPath = options.cliPath ?? resolveDrebCliPath();\n\t\tthis.baseArgs = options.baseArgs ?? [];\n\t\tthis.clientFactory =\n\t\t\toptions.clientFactory ?? ((o) => new RpcClient({ cliPath: o.cliPath, cwd: o.cwd, args: o.args }));\n\t\tthis.logger = options.logger ?? ((line) => console.warn(`[dashboard] ${line}`));\n\t\tthis.dashboardBarrierTtlMs = options.dashboardBarrierTtlMs ?? DEFAULT_DASHBOARD_BARRIER_TTL_MS;\n\t\tthis.dashboardBarrierLimit = options.dashboardBarrierLimit ?? DEFAULT_DASHBOARD_BARRIER_LIMIT;\n\t\tthis.now = options.now ?? Date.now;\n\t\tthis.fleetSnapshotDebounceMs = options.fleetSnapshotDebounceMs ?? DEFAULT_FLEET_SNAPSHOT_DEBOUNCE_MS;\n\t}\n\n\t/** Subscribe to events from every runtime, tagged with the runtime key. */\n\tonEvent(listener: RuntimeEventListener): () => void {\n\t\tthis.listeners.push(listener);\n\t\treturn () => {\n\t\t\tconst i = this.listeners.indexOf(listener);\n\t\t\tif (i !== -1) this.listeners.splice(i, 1);\n\t\t};\n\t}\n\n\t/** Subscribe to debounced, in-memory fleet snapshots. */\n\tonFleetSnapshot(listener: FleetSnapshotListener): () => void {\n\t\tthis.fleetSnapshotListeners.push(listener);\n\t\treturn () => {\n\t\t\tconst i = this.fleetSnapshotListeners.indexOf(listener);\n\t\t\tif (i !== -1) this.fleetSnapshotListeners.splice(i, 1);\n\t\t};\n\t}\n\n\t/**\n\t * Build the fleet's live-runtime view without RPC or disk access. Map\n\t * insertion order is retained intentionally; the UI owns presentation order.\n\t */\n\tfleetSnapshot(): FleetRuntimeSnapshotDto[] {\n\t\treturn [...this.runtimes.values()].map((handle) => this.describeFleetRuntime(handle));\n\t}\n\n\tlist(): RuntimeHandle[] {\n\t\treturn [...this.runtimes.values()];\n\t}\n\n\tget(key: string): RuntimeHandle | undefined {\n\t\treturn this.runtimes.get(key);\n\t}\n\n\t/** Apply a confirmed model mutation to both the child and the pool snapshot. */\n\tasync setModel(\n\t\thandle: RuntimeHandle,\n\t\tprovider: string,\n\t\tmodelId: string,\n\t): Promise<{\n\t\tmodel: { provider: string; id: string };\n\t\tthinkingLevel: string;\n\t\tavailableThinkingLevels: string[];\n\t\tsettingsRevision: number;\n\t}> {\n\t\tconst model = await handle.client.setModel(provider, modelId);\n\t\tconst state = await handle.client.getState();\n\t\thandle.lastState = {\n\t\t\t...this.fallbackState(handle),\n\t\t\tmodel,\n\t\t\tthinkingLevel: state.thinkingLevel,\n\t\t\tavailableThinkingLevels: state.availableThinkingLevels,\n\t\t};\n\t\thandle.settingsRevision += 1;\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t\treturn {\n\t\t\tmodel,\n\t\t\tthinkingLevel: state.thinkingLevel,\n\t\t\tavailableThinkingLevels: state.availableThinkingLevels,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t};\n\t}\n\n\t/** Apply a confirmed thinking mutation to both the child and the pool snapshot. */\n\tasync setThinkingLevel(\n\t\thandle: RuntimeHandle,\n\t\tlevel: Parameters<RpcClient[\"setThinkingLevel\"]>[0],\n\t): Promise<{ ok: true; settingsRevision: number }> {\n\t\tawait handle.client.setThinkingLevel(level);\n\t\thandle.lastState = { ...this.fallbackState(handle), thinkingLevel: level };\n\t\thandle.settingsRevision += 1;\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t\treturn { ok: true, settingsRevision: handle.settingsRevision };\n\t}\n\n\t/**\n\t * Record the EventHub sequence synchronously when the RPC snapshot marker\n\t * arrives. The marker line precedes its response on stdout, so this runs\n\t * before the RpcClient response continuation even across separate chunks.\n\t */\n\trecordDashboardBarrier(runtimeKey: string, snapshotId: string, seq: number): void {\n\t\tthis.pruneDashboardBarriers();\n\t\tthis.dashboardBarriers.set(this.dashboardBarrierKey(runtimeKey, snapshotId), { seq, recordedAt: this.now() });\n\t\tthis.pruneDashboardBarriers();\n\t}\n\n\t/**\n\t * Capture a parent-session recovery snapshot and pair it with the sequence\n\t * captured at its RPC marker. This deliberately does not infer ordering from\n\t * await: later EventHub publications naturally have higher sequence numbers.\n\t */\n\tasync snapshotDashboard(handle: RuntimeHandle): Promise<DashboardRuntimeSnapshot> {\n\t\tconst snapshot = await (handle.client as DashboardSnapshotClient).getDashboardSnapshot();\n\t\tthis.pruneDashboardBarriers();\n\t\tconst barrierKey = this.dashboardBarrierKey(handle.key, snapshot.snapshotId);\n\t\tconst barrier = this.dashboardBarriers.get(barrierKey);\n\t\tthis.dashboardBarriers.delete(barrierKey);\n\t\tthis.scheduleDashboardBarrierPrune();\n\t\tif (!barrier) {\n\t\t\tthrow new Error(`Dashboard snapshot ${snapshot.snapshotId} arrived without its ordering barrier`);\n\t\t}\n\t\t// This is an authoritative RPC baseline, so it may legitimately lower the\n\t\t// count after a fork/rewind instead of retaining an event-derived maximum.\n\t\thandle.lastState = snapshot.state;\n\t\tthis.scheduleFleetSnapshot();\n\t\treturn { key: handle.key, barrierSeq: barrier.seq, snapshot };\n\t}\n\n\tprivate dashboardBarrierKey(runtimeKey: string, snapshotId: string): string {\n\t\treturn `${runtimeKey}\\0${snapshotId}`;\n\t}\n\n\tprivate pruneDashboardBarriers(): void {\n\t\tconst oldestAllowed = this.now() - this.dashboardBarrierTtlMs;\n\t\tfor (const [snapshotId, barrier] of this.dashboardBarriers) {\n\t\t\tif (barrier.recordedAt < oldestAllowed) this.dashboardBarriers.delete(snapshotId);\n\t\t}\n\t\twhile (this.dashboardBarriers.size > this.dashboardBarrierLimit) {\n\t\t\tconst oldest = this.dashboardBarriers.keys().next().value;\n\t\t\tif (oldest === undefined) break;\n\t\t\tthis.dashboardBarriers.delete(oldest);\n\t\t}\n\t\tthis.scheduleDashboardBarrierPrune();\n\t}\n\n\tprivate scheduleDashboardBarrierPrune(): void {\n\t\tif (this.dashboardBarrierPruneTimer) clearTimeout(this.dashboardBarrierPruneTimer);\n\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\tlet oldest: DashboardBarrier | undefined;\n\t\tfor (const barrier of this.dashboardBarriers.values()) {\n\t\t\tif (!oldest || barrier.recordedAt < oldest.recordedAt) oldest = barrier;\n\t\t}\n\t\tif (!oldest) return;\n\t\tconst delay = Math.max(1, oldest.recordedAt + this.dashboardBarrierTtlMs - this.now() + 1);\n\t\tthis.dashboardBarrierPruneTimer = setTimeout(() => {\n\t\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\t\tthis.pruneDashboardBarriers();\n\t\t}, delay);\n\t\tthis.dashboardBarrierPruneTimer.unref?.();\n\t}\n\n\tprivate scheduleFleetSnapshot(): void {\n\t\tif (this.closing) return;\n\t\tif (this.fleetSnapshotTimer) clearTimeout(this.fleetSnapshotTimer);\n\t\tthis.fleetSnapshotTimer = setTimeout(() => {\n\t\t\tthis.fleetSnapshotTimer = undefined;\n\t\t\tif (this.closing) return;\n\t\t\tconst event: FleetSnapshotEventDto = { type: \"fleet_snapshot\", runtimes: this.fleetSnapshot() };\n\t\t\tfor (const listener of this.fleetSnapshotListeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(event);\n\t\t\t\t} catch {\n\t\t\t\t\t// An SSE bridge subscriber must not break the pool's event loop.\n\t\t\t\t}\n\t\t\t}\n\t\t}, this.fleetSnapshotDebounceMs);\n\t\tthis.fleetSnapshotTimer.unref?.();\n\t}\n\n\t/** Spawn a new runtime in `cwd`, optionally opening an existing session file. */\n\tasync create(cwd: string, sessionPath?: string): Promise<RuntimeHandle> {\n\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\tconst key = randomBytes(6).toString(\"hex\");\n\t\tconst args = [\"--ui\", \"dashboard\", ...this.baseArgs];\n\t\tif (sessionPath) args.push(\"--session\", sessionPath);\n\t\tconst client = this.clientFactory({ cliPath: this.cliPath, cwd, args });\n\t\tconst handle: RuntimeHandle = {\n\t\t\tkey,\n\t\t\tcwd,\n\t\t\tclient,\n\t\t\tcreatedAt: this.now(),\n\t\t\tlastActivity: this.now(),\n\t\t\tattention: new Map(),\n\t\t\tsettingsRevision: 0,\n\t\t\tsessionFileFallback: sessionPath,\n\t\t\tbackgroundAgents: new Map(),\n\t\t};\n\t\tclient.onEvent((event) => this.handleEvent(handle, event as unknown as Record<string, unknown>));\n\t\tclient.onExit((info) => this.handleRuntimeExit(handle, info));\n\n\t\tconst startup = this.startSessionRuntime(handle);\n\t\tthis.startupPromises.add(startup);\n\t\ttry {\n\t\t\treturn await startup;\n\t\t} finally {\n\t\t\tthis.startupPromises.delete(startup);\n\t\t}\n\t}\n\n\tprivate async startSessionRuntime(handle: RuntimeHandle): Promise<RuntimeHandle> {\n\t\tthis.starting.add(handle);\n\t\ttry {\n\t\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\t\tawait handle.client.start();\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tawait this.seedBackgroundAgents(handle);\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tthis.runtimes.set(handle.key, handle);\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t\treturn handle;\n\t\t} finally {\n\t\t\tthis.starting.delete(handle);\n\t\t}\n\t}\n\n\t/** Stop a runtime and remove it from the pool. */\n\tasync stop(key: string): Promise<boolean> {\n\t\tconst handle = this.runtimes.get(key);\n\t\tif (!handle) return false;\n\t\tthis.handleEvent(handle, { type: \"runtime_removed\" });\n\t\tthis.runtimes.delete(key);\n\t\tthis.scheduleFleetSnapshot();\n\t\tawait handle.client.stop();\n\t\treturn true;\n\t}\n\n\t/**\n\t * Return any live runtime suitable for process-global settings work, spawning\n\t * a hidden utility runtime (in the home directory) if no user session exists.\n\t * This is what lets the settings page — models, agent types, defaults — work\n\t * with zero sessions open, instead of 503-ing.\n\t */\n\tasync ensureUtilityRuntime(cwd = homedir()): Promise<RuntimeHandle> {\n\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\tconst existing = this.utilities.get(cwd);\n\t\tif (existing) return existing;\n\t\tlet promise = this.utilityPromises.get(cwd);\n\t\tif (!promise) {\n\t\t\tconst args = [\"--ui\", \"dashboard\", ...this.baseArgs];\n\t\t\tconst client = this.clientFactory({ cliPath: this.cliPath, cwd, args });\n\t\t\tconst handle: RuntimeHandle = {\n\t\t\t\tkey: `utility:${cwd}`,\n\t\t\t\tcwd,\n\t\t\t\tclient,\n\t\t\t\tcreatedAt: this.now(),\n\t\t\t\tlastActivity: this.now(),\n\t\t\t\tattention: new Map(),\n\t\t\t\tsettingsRevision: 0,\n\t\t\t\tbackgroundAgents: new Map(),\n\t\t\t};\n\t\t\tconst startup = this.startUtilityRuntime(cwd, handle);\n\t\t\tthis.startupPromises.add(startup);\n\t\t\tpromise = startup\n\t\t\t\t.catch((err) => {\n\t\t\t\t\t// Allow a retry on the next request instead of caching the failure.\n\t\t\t\t\tthis.utilityPromises.delete(cwd);\n\t\t\t\t\tthrow err;\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.startupPromises.delete(startup);\n\t\t\t\t});\n\t\t\tthis.utilityPromises.set(cwd, promise);\n\t\t}\n\t\treturn promise;\n\t}\n\n\tprivate async startUtilityRuntime(cwd: string, handle: RuntimeHandle): Promise<RuntimeHandle> {\n\t\tthis.starting.add(handle);\n\t\ttry {\n\t\t\tif (this.closing) throw new Error(\"Runtime pool is closing\");\n\t\t\tawait handle.client.start();\n\t\t\tif (this.closing) {\n\t\t\t\tawait handle.client.stop();\n\t\t\t\tthrow new Error(\"Runtime pool is closing\");\n\t\t\t}\n\t\t\tthis.utilities.set(cwd, handle);\n\t\t\treturn handle;\n\t\t} finally {\n\t\t\tthis.starting.delete(handle);\n\t\t}\n\t}\n\n\tasync stopAll(): Promise<void> {\n\t\tthis.closing = true;\n\t\tif (this.dashboardBarrierPruneTimer) clearTimeout(this.dashboardBarrierPruneTimer);\n\t\tthis.dashboardBarrierPruneTimer = undefined;\n\t\tif (this.fleetSnapshotTimer) clearTimeout(this.fleetSnapshotTimer);\n\t\tthis.fleetSnapshotTimer = undefined;\n\t\tthis.fleetSnapshotListeners.length = 0;\n\t\tthis.dashboardBarriers.clear();\n\t\tconst handles = new Set<RuntimeHandle>([\n\t\t\t...this.runtimes.values(),\n\t\t\t...this.utilities.values(),\n\t\t\t...this.starting.values(),\n\t\t]);\n\t\tconst startupPromises = new Set<Promise<unknown>>([...this.startupPromises, ...this.utilityPromises.values()]);\n\t\tthis.runtimes.clear();\n\t\tthis.utilities.clear();\n\t\tthis.utilityPromises.clear();\n\t\tawait Promise.allSettled([...handles].map((handle) => handle.client.stop()));\n\t\tawait Promise.allSettled([...startupPromises]);\n\t}\n\n\tprivate handleRuntimeExit(handle: RuntimeHandle, info: RpcExitInfo): void {\n\t\tif (this.closing || this.exitedHandles.has(handle) || !this.isLiveHandle(handle)) return;\n\t\tthis.exitedHandles.add(handle);\n\t\tconst message = formatRpcExit(info);\n\t\tthis.recordRuntimeError(handle, message);\n\t\tthis.logger(`runtime ${handle.key} ${message}`);\n\t\tthis.handleEvent(handle, { type: \"agent_end\", messages: [], aborted: true, errorMessage: message });\n\t}\n\n\tprivate isLiveHandle(handle: RuntimeHandle): boolean {\n\t\treturn (\n\t\t\tthis.runtimes.get(handle.key) === handle ||\n\t\t\tthis.utilities.get(handle.cwd) === handle ||\n\t\t\tthis.starting.has(handle)\n\t\t);\n\t}\n\n\tprivate handleEvent(handle: RuntimeHandle, event: Record<string, unknown>): void {\n\t\tconst type = event.type as string;\n\t\tif (type !== \"dashboard_snapshot_barrier\") {\n\t\t\thandle.lastActivity = this.now();\n\t\t\tthis.updateStateFromEvent(handle, event, type);\n\t\t}\n\n\t\t// Track needs-attention sources: extension UI requests, parent\n\t\t// paused, error states.\n\t\tif (type === \"extension_ui_request\") {\n\t\t\tconst method = event.method as string;\n\t\t\tif (\n\t\t\t\tmethod === \"select\" ||\n\t\t\t\tmethod === \"confirm\" ||\n\t\t\t\tmethod === \"input\" ||\n\t\t\t\tmethod === \"editor\" ||\n\t\t\t\tmethod === \"ask\"\n\t\t\t) {\n\t\t\t\thandle.attention.set(`ui:${event.id}`, `extension ${method} awaiting response`);\n\t\t\t}\n\t\t}\n\t\tif (type === \"extension_ui_response_handled\") {\n\t\t\thandle.attention.delete(`ui:${event.id}`);\n\t\t}\n\t\tif (type === \"agent_start\") {\n\t\t\t// A new turn clears prior UI-request attention (requests were resolved or timed out).\n\t\t\tfor (const k of [...handle.attention.keys()]) {\n\t\t\t\tif (k.startsWith(\"ui:\")) handle.attention.delete(k);\n\t\t\t}\n\t\t\thandle.attention.delete(\"paused\");\n\t\t\thandle.attention.delete(\"suggest\");\n\t\t\thandle.attention.delete(\"error\");\n\t\t\thandle.error = undefined;\n\t\t\thandle.providerError = undefined;\n\t\t}\n\t\tif (type === \"suggest_next\") {\n\t\t\t// suggest_next as the ending action = \"your move\": mark needs-attention\n\t\t\t// so the fleet card doesn't read idle. Cleared on the next agent_start.\n\t\t\thandle.attention.set(\"suggest\", \"suggested command awaiting\");\n\t\t}\n\t\tif (type === \"parent_paused_for_background_agents\") {\n\t\t\thandle.attention.set(\"paused\", `paused — ${event.runningAgentCount} background agents running`);\n\t\t}\n\t\tif (type === \"agent_end\") {\n\t\t\thandle.attention.delete(\"paused\");\n\t\t\tif (event.errorMessage) this.recordRuntimeError(handle, String(event.errorMessage));\n\t\t}\n\t\tif (type === \"message_end\") {\n\t\t\tconst message = event.message;\n\t\t\tif (message && typeof message === \"object\" && !Array.isArray(message)) {\n\t\t\t\tconst assistant = message as Record<string, unknown>;\n\t\t\t\tif (assistant.role === \"assistant\" && assistant.stopReason === \"error\") {\n\t\t\t\t\tconst rawError = assistant.errorMessage;\n\t\t\t\t\tconst error = typeof rawError === \"string\" && rawError.trim().length > 0 ? rawError : \"Unknown error\";\n\t\t\t\t\tthis.recordProviderError(handle, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (type === \"auto_retry_start\") this.clearProviderError(handle);\n\t\tif (type === \"auto_compaction_start\" && event.reason === \"overflow\") this.clearProviderError(handle);\n\t\tif (type === \"auto_retry_end\" && event.success === false && event.finalError) {\n\t\t\tthis.recordProviderError(handle, String(event.finalError));\n\t\t} else if (type === \"auto_retry_end\" && event.success === true) {\n\t\t\tthis.clearProviderError(handle);\n\t\t}\n\t\tif (type === \"auto_compaction_end\" && event.errorMessage) {\n\t\t\tthis.recordRuntimeError(handle, String(event.errorMessage));\n\t\t}\n\n\t\t// Track background agents from lifecycle events.\n\t\tif (type === \"background_agent_start\") {\n\t\t\thandle.backgroundAgents.set(event.agentId as string, {\n\t\t\t\tagentId: event.agentId as string,\n\t\t\t\tagentType: event.agentType as string,\n\t\t\t\ttaskSummary: event.taskSummary as string,\n\t\t\t\tstartedAt: new Date().toISOString(),\n\t\t\t\tstatus: \"running\",\n\t\t\t\tsessionDir: event.sessionDir as string | undefined,\n\t\t\t});\n\t\t}\n\t\tif (type === \"subagent_arbitration\") {\n\t\t\tconst existing = handle.backgroundAgents.get(event.agentId as string);\n\t\t\tif (existing) {\n\t\t\t\tconst record: SubagentArbitrationDto = {\n\t\t\t\t\tstatus: event.status as SubagentArbitrationDto[\"status\"],\n\t\t\t\t\tproposed: event.proposed as SubagentArbitrationDto[\"proposed\"],\n\t\t\t\t\tfinal: (event.final as SubagentArbitrationDto[\"final\"]) ?? null,\n\t\t\t\t\tchanged: (event.changed as SubagentArbitrationDto[\"changed\"]) ?? [],\n\t\t\t\t\tstep: event.step as number | undefined,\n\t\t\t\t\terrorCode: event.errorCode as string | undefined,\n\t\t\t\t\terrorMessage: event.errorMessage as string | undefined,\n\t\t\t\t};\n\t\t\t\texisting.arbitrations = [...(existing.arbitrations ?? []), record];\n\t\t\t\tif (record.status === \"success\" && record.final) existing.agentType = record.final.agent;\n\t\t\t}\n\t\t}\n\t\tif (type === \"background_agent_end\") {\n\t\t\tconst existing = handle.backgroundAgents.get(event.agentId as string);\n\t\t\tif (existing) {\n\t\t\t\texisting.status = event.success ? \"completed\" : \"failed\";\n\t\t\t\texisting.sessionFile = (event.sessionFile as string | undefined) ?? existing.sessionFile;\n\t\t\t\tthis.pruneCompletedBackgroundAgents(handle);\n\t\t\t}\n\t\t}\n\n\t\tfor (const listener of this.listeners) {\n\t\t\ttry {\n\t\t\t\tlistener(handle.key, event);\n\t\t\t} catch {\n\t\t\t\t// A broken SSE subscriber must not break event distribution.\n\t\t\t}\n\t\t}\n\t\tif (this.runtimes.get(handle.key) === handle && FLEET_SNAPSHOT_EVENT_TYPES.has(type)) {\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t}\n\t}\n\n\t/**\n\t * Events intentionally patch only fields they can prove. Session identity,\n\t * session file, configuration, and context usage remain from the last RPC\n\t * baseline (or the stable creation fallback) until a later reconciliation.\n\t */\n\tprivate updateStateFromEvent(handle: RuntimeHandle, event: Record<string, unknown>, type: string): void {\n\t\tconst state = this.fallbackState(handle);\n\t\tswitch (type) {\n\t\t\tcase \"agent_start\": {\n\t\t\t\tconst model = event.model;\n\t\t\t\tif (\n\t\t\t\t\tmodel &&\n\t\t\t\t\ttypeof model === \"object\" &&\n\t\t\t\t\ttypeof (model as Record<string, unknown>).provider === \"string\" &&\n\t\t\t\t\ttypeof (model as Record<string, unknown>).id === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tconst nextModel = model as { provider: string; id: string };\n\t\t\t\t\tstate.model =\n\t\t\t\t\t\tstate.model?.provider === nextModel.provider && state.model.id === nextModel.id\n\t\t\t\t\t\t\t? { ...state.model, ...nextModel }\n\t\t\t\t\t\t\t: nextModel;\n\t\t\t\t}\n\t\t\t\tstate.isStreaming = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"agent_end\":\n\t\t\t\tstate.isStreaming = false;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_compaction_start\":\n\t\t\t\tstate.isCompacting = true;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_compaction_end\":\n\t\t\t\tstate.isCompacting = false;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_retry_start\":\n\t\t\t\tstate.isRetrying = true;\n\t\t\t\tstate.retryAttempt = typeof event.attempt === \"number\" ? event.attempt : state.retryAttempt;\n\t\t\t\tbreak;\n\t\t\tcase \"auto_retry_end\":\n\t\t\t\tstate.isRetrying = false;\n\t\t\t\tstate.retryAttempt = 0;\n\t\t\t\tbreak;\n\t\t\tcase \"tasks_update\":\n\t\t\t\tif (Array.isArray(event.tasks)) state.tasks = [...event.tasks] as SessionStateDto[\"tasks\"];\n\t\t\t\tbreak;\n\t\t\tcase \"session_name_changed\":\n\t\t\t\tif (typeof event.name === \"string\") state.sessionName = event.name;\n\t\t\t\tbreak;\n\t\t\tcase \"message_start\":\n\t\t\t\tstate.messageCount += 1;\n\t\t\t\tbreak;\n\t\t}\n\t\thandle.lastState = state;\n\t}\n\n\tprivate recordRuntimeError(handle: RuntimeHandle, message: string): void {\n\t\thandle.error = message;\n\t\thandle.attention.set(\"error\", message);\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t}\n\n\tprivate recordProviderError(handle: RuntimeHandle, message: string): void {\n\t\thandle.providerError = message;\n\t\tthis.recordRuntimeError(handle, message);\n\t}\n\n\tprivate clearProviderError(handle: RuntimeHandle): void {\n\t\tconst providerError = handle.providerError;\n\t\tif (providerError === undefined) return;\n\t\thandle.providerError = undefined;\n\t\tif (handle.error === providerError) handle.error = undefined;\n\t\tif (handle.attention.get(\"error\") === providerError) handle.attention.delete(\"error\");\n\t\tif (this.runtimes.get(handle.key) === handle) this.scheduleFleetSnapshot();\n\t}\n\n\tprivate pruneCompletedBackgroundAgents(handle: RuntimeHandle): void {\n\t\tconst evictable = [...handle.backgroundAgents.values()]\n\t\t\t.map((agent, index) => {\n\t\t\t\tconst startedAtMs = Date.parse(agent.startedAt);\n\t\t\t\treturn { agent, index, startedAtMs: Number.isFinite(startedAtMs) ? startedAtMs : 0 };\n\t\t\t})\n\t\t\t.filter(({ agent }) => agent.status !== \"running\")\n\t\t\t.sort((a, b) => a.startedAtMs - b.startedAtMs || a.index - b.index);\n\t\tconst excess = evictable.length - MAX_COMPLETED_BACKGROUND_AGENTS;\n\t\tif (excess <= 0) return;\n\t\tfor (const { agent } of evictable.slice(0, excess)) {\n\t\t\thandle.backgroundAgents.delete(agent.agentId);\n\t\t}\n\t}\n\n\tprivate fallbackState(handle: RuntimeHandle): SessionStateDto {\n\t\tconst previous = handle.lastState;\n\t\treturn {\n\t\t\t...previous,\n\t\t\tsessionId: previous?.sessionId ?? handle.key,\n\t\t\ttasks: previous?.tasks ? [...previous.tasks] : [],\n\t\t\tthinkingLevel: previous?.thinkingLevel ?? \"off\",\n\t\t\tavailableThinkingLevels: previous?.availableThinkingLevels ? [...previous.availableThinkingLevels] : [\"off\"],\n\t\t\tisStreaming: previous?.isStreaming ?? false,\n\t\t\tisRetrying: previous?.isRetrying ?? false,\n\t\t\tretryAttempt: previous?.retryAttempt ?? 0,\n\t\t\tisCompacting: previous?.isCompacting ?? false,\n\t\t\tsteeringMode: previous?.steeringMode ?? \"all\",\n\t\t\tfollowUpMode: previous?.followUpMode ?? \"all\",\n\t\t\tsessionFile: previous?.sessionFile ?? handle.sessionFileFallback,\n\t\t\tautoCompactionEnabled: previous?.autoCompactionEnabled ?? false,\n\t\t\tmessageCount: previous?.messageCount ?? 0,\n\t\t\tpendingMessageCount: previous?.pendingMessageCount ?? 0,\n\t\t};\n\t}\n\n\tprivate describeFleetRuntime(handle: RuntimeHandle): FleetRuntimeSnapshotDto {\n\t\tconst state = this.fallbackState(handle);\n\t\treturn {\n\t\t\tkey: handle.key,\n\t\t\tcwd: handle.cwd,\n\t\t\tstate,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t\tbackgroundAgents: [...handle.backgroundAgents.values()].map((agent) => ({ ...agent })),\n\t\t\tneedsAttention: handle.attention.size > 0,\n\t\t\terror: handle.error,\n\t\t\tcreatedAt: new Date(handle.createdAt).toISOString(),\n\t\t\tlastActivity: new Date(handle.lastActivity).toISOString(),\n\t\t};\n\t}\n\n\tprivate async seedBackgroundAgents(handle: RuntimeHandle): Promise<void> {\n\t\ttry {\n\t\t\tconst agents = (await handle.client.listBackgroundAgents()) as unknown as BackgroundAgentDto[];\n\t\t\tfor (const agent of agents) {\n\t\t\t\thandle.backgroundAgents.set(agent.agentId, agent);\n\t\t\t}\n\t\t\tthis.pruneCompletedBackgroundAgents(handle);\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} background-agent registry unavailable: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Snapshot a runtime for the fleet endpoint. */\n\tasync describe(handle: RuntimeHandle): Promise<RuntimeInfoDto> {\n\t\tconst previousFleetRuntime =\n\t\t\tthis.runtimes.get(handle.key) === handle ? this.describeFleetRuntime(handle) : undefined;\n\t\tlet fleetRuntimeEnriched = false;\n\t\tlet state: SessionStateDto;\n\t\ttry {\n\t\t\tconst authoritative = (await handle.client.getState()) as unknown as SessionStateDto;\n\t\t\tconst fallback = this.fallbackState(handle);\n\t\t\tstate = {\n\t\t\t\t...fallback,\n\t\t\t\t...authoritative,\n\t\t\t\tsessionId: authoritative.sessionId ?? fallback.sessionId,\n\t\t\t\tsessionFile: authoritative.sessionFile ?? fallback.sessionFile,\n\t\t\t\ttasks: authoritative.tasks ?? fallback.tasks,\n\t\t\t};\n\t\t\thandle.lastState = state;\n\t\t\tfleetRuntimeEnriched = true;\n\t\t\tif (handle.error?.startsWith(\"RPC process\")) {\n\t\t\t\thandle.error = undefined;\n\t\t\t\thandle.attention.delete(\"error\");\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tthis.recordRuntimeError(handle, message);\n\t\t\tthis.logger(`runtime ${handle.key} state unavailable for fleet card: ${message}`);\n\t\t\tstate = this.fallbackState(handle);\n\t\t}\n\t\tlet stats: RuntimeStatsSummaryDto | undefined;\n\t\ttry {\n\t\t\tconst sessionStats = await handle.client.getSessionStats();\n\t\t\tstats = { tokensTotal: sessionStats.tokens.total, cost: sessionStats.cost };\n\t\t\tif (sessionStats.contextUsage) {\n\t\t\t\thandle.lastState = { ...this.fallbackState(handle), contextUsage: sessionStats.contextUsage };\n\t\t\t\tfleetRuntimeEnriched = true;\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} stats unavailable for fleet card: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t\tlet lastAssistantText: string | undefined;\n\t\ttry {\n\t\t\tconst text = await handle.client.getLastAssistantText();\n\t\t\tlastAssistantText = text ? text.slice(0, 200) : undefined;\n\t\t} catch (err) {\n\t\t\tthis.logger(\n\t\t\t\t`runtime ${handle.key} last assistant text unavailable for fleet card: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\tfleetRuntimeEnriched &&\n\t\t\tpreviousFleetRuntime &&\n\t\t\tthis.runtimes.get(handle.key) === handle &&\n\t\t\t!isDeepStrictEqual(previousFleetRuntime, this.describeFleetRuntime(handle))\n\t\t) {\n\t\t\tthis.scheduleFleetSnapshot();\n\t\t}\n\t\treturn {\n\t\t\tkey: handle.key,\n\t\t\tcwd: handle.cwd,\n\t\t\tstate,\n\t\t\tsettingsRevision: handle.settingsRevision,\n\t\t\tstats,\n\t\t\tbackgroundAgents: [...handle.backgroundAgents.values()],\n\t\t\tneedsAttention: handle.attention.size > 0,\n\t\t\terror: handle.error,\n\t\t\tlastAssistantText,\n\t\t\tcreatedAt: new Date(handle.createdAt).toISOString(),\n\t\t\tlastActivity: new Date(handle.lastActivity).toISOString(),\n\t\t};\n\t}\n}\n"]}
|
|
@@ -499,6 +499,7 @@ export interface SettingsDto {
|
|
|
499
499
|
steeringMode?: "all" | "one-at-a-time";
|
|
500
500
|
followUpMode?: "all" | "one-at-a-time";
|
|
501
501
|
compactionEnabled?: boolean;
|
|
502
|
+
continueAfterAutoCompaction?: boolean;
|
|
502
503
|
retryEnabled?: boolean;
|
|
503
504
|
maxConcurrentSubagents?: number;
|
|
504
505
|
imageAutoResize?: boolean;
|
|
@@ -529,7 +530,7 @@ export interface SettingsDto {
|
|
|
529
530
|
enabledModelsSource: "default" | "global" | "project";
|
|
530
531
|
}
|
|
531
532
|
/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */
|
|
532
|
-
export type SettingsUpdateDto = Partial<Pick<SettingsDto, "defaultProvider" | "defaultModel" | "defaultThinkingLevel" | "steeringMode" | "followUpMode" | "compactionEnabled" | "retryEnabled" | "maxConcurrentSubagents" | "imageAutoResize" | "blockImages" | "enableSkillCommands" | "autoLoadNestedContext" | "trustedContextFolders" | "transport" | "hideThinkingBlock" | "agentModels" | "subagentArbiter">> & {
|
|
533
|
+
export type SettingsUpdateDto = Partial<Pick<SettingsDto, "defaultProvider" | "defaultModel" | "defaultThinkingLevel" | "steeringMode" | "followUpMode" | "compactionEnabled" | "continueAfterAutoCompaction" | "retryEnabled" | "maxConcurrentSubagents" | "imageAutoResize" | "blockImages" | "enableSkillCommands" | "autoLoadNestedContext" | "trustedContextFolders" | "transport" | "hideThinkingBlock" | "agentModels" | "subagentArbiter">> & {
|
|
533
534
|
enabledModels?: string[] | null;
|
|
534
535
|
tabTitle?: TabTitleSettingsUpdateDto;
|
|
535
536
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD,uFAAuF;AACvF,MAAM,WAAW,cA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,CAAC;IAC/B,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iFAAiF;IACjF,oBAAoB,EAAE,cAAc,EAAE,CAAC;IACvC,0DAA0D;IAC1D,aAAa,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,+BAA+B,EAAE,OAAO,CAAC;IACzC,mBAAmB,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CACtD;AAED,6JAA6J;AAC7J,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACtC,IAAI,CACH,WAAW,EACT,iBAAiB,GACjB,cAAc,GACd,sBAAsB,GACtB,cAAc,GACd,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,wBAAwB,GACxB,iBAAiB,GACjB,aAAa,GACb,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,WAAW,GACX,mBAAmB,GACnB,aAAa,GACb,iBAAiB,CACnB,CACD,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE1E,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,oEAAoE;AACpE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;CAC1E;AAED,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACp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MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tcontinueAfterAutoCompaction?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"continueAfterAutoCompaction\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAgDlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,oFAAoF;AACpF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;AAkF9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAgDlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,oFAAoF;AACpF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;AAkF9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tcontinueAfterAutoCompaction?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"continueAfterAutoCompaction\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|