@dreb/dashboard 2.57.0 → 2.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,13 +69,13 @@ Open `http://127.0.0.1:5343`.
69
69
  matching safe index links.
70
70
  - **Settings** — persistent defaults (provider-grouped model dropdown,
71
71
  thinking, queue modes, image handling, skill commands, transport,
72
- hide-thinking, compaction/retry), a scoped-models editor, per-agent model
72
+ hide-thinking, compaction/retry, and maximum concurrent subagents), a scoped-models editor, per-agent model
73
73
  fallback editor, and the global-only nested-context policy: an auditable trusted-roots list with
74
74
  revoke and simple add-by-path controls, plus a prominent expert trust-all
75
75
  warning. The Files view remains the primary trust-grant flow. Most defaults
76
76
  seed new sessions; opening Settings flushes pending writes and reloads durable
77
77
  global + project settings so external edits appear, while read/parse/write
78
- failures are shown instead of stale values. Trust changes are observed by
78
+ failures are shown instead of stale values. Maximum concurrent subagents defaults to 4; `0` starts new parents without the subagent tool and adds explicit self-execution guidance. Trust changes are observed by
79
79
  active processes for future lazy loads and cannot retract already injected
80
80
  context. Also includes dashboard-local preferences (thinking expansion,
81
81
  transcript image display mode, and notification permission), an appearance section with a curated-theme gallery
@@ -484,6 +484,7 @@ export interface SettingsDto {
484
484
  followUpMode?: "all" | "one-at-a-time";
485
485
  compactionEnabled?: boolean;
486
486
  retryEnabled?: boolean;
487
+ maxConcurrentSubagents?: number;
487
488
  imageAutoResize?: boolean;
488
489
  blockImages?: boolean;
489
490
  enableSkillCommands?: boolean;
@@ -510,7 +511,7 @@ export interface SettingsDto {
510
511
  enabledModelsSource: "default" | "global" | "project";
511
512
  }
512
513
  /** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels. */
513
- export type SettingsUpdateDto = Partial<Pick<SettingsDto, "defaultProvider" | "defaultModel" | "defaultThinkingLevel" | "steeringMode" | "followUpMode" | "compactionEnabled" | "retryEnabled" | "imageAutoResize" | "blockImages" | "enableSkillCommands" | "autoLoadNestedContext" | "trustedContextFolders" | "transport" | "hideThinkingBlock" | "agentModels" | "subagentArbiter">> & {
514
+ export type SettingsUpdateDto = Partial<Pick<SettingsDto, "defaultProvider" | "defaultModel" | "defaultThinkingLevel" | "steeringMode" | "followUpMode" | "compactionEnabled" | "retryEnabled" | "maxConcurrentSubagents" | "imageAutoResize" | "blockImages" | "enableSkillCommands" | "autoLoadNestedContext" | "trustedContextFolders" | "transport" | "hideThinkingBlock" | "agentModels" | "subagentArbiter">> & {
514
515
  enabledModels?: string[] | null;
515
516
  };
516
517
  export type SettingsSaveResultDto = SettingsDto & {
@@ -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,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,CAAC;CAClE;AAED,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,EAAE,mBAAmB,GAAG,I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AAC,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,oGAAoG;AACpG,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACtC,IAAI,CACH,WAAW,EACT,iBAAiB,GACjB,cAAc,GACd,sBAAsB,GACtB,cAAc,GACd,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,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,CAAA;CAAE,CAAC;AAExC,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\";\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\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/** 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\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\";\n\tguidePath?: string;\n}\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\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/** 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. */\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| \"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 };\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,KA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C;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\";\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\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/** 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\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\";\n\tguidePath?: string;\n}\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/** 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. */\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 };\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\";\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\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/** 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\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\";\n\tguidePath?: string;\n}\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\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/** 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. */\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| \"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 };\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\";\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\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/** 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\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\";\n\tguidePath?: string;\n}\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/** 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. */\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 };\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"]}
@@ -76,4 +76,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
76
76
 
77
77
  `)}function tn(e,t,n=`/${e}`){return t?(I(`Usage: ${n}`),!0):!1}function nn(){let t=document.createElement(`a`);t.href=$.exportHtmlUrl(e.sessionKey),t.download=``,document.body.append(t),t.click(),t.remove()}let rn={settings:async t=>{tn(`settings`,t)||e.store.navigate({screen:`settings`})},"scoped-models":async t=>{if(tn(`scoped-models`,t))return;let r=n()?.cwd;if(!r)throw Error(`Cannot open scoped models: the runtime project directory is unavailable`);e.store.navigate({screen:`settings`,target:`scoped-models`,cwd:r})},model:async e=>{m(e),f(!0)},export:async e=>{tn(`export`,e)||nn()},import:async e=>{Xe(e),Qe(void 0),Je(!0)},name:async t=>{t?await $.rename(e.sessionKey,t):w(!0)},session:async e=>{tn(`session`,e)||(v(!1),await Yt())},fork:async e=>{tn(`fork`,e)||await qt()},tree:async e=>{tn(`tree`,e)||await Ht()},new:async t=>{if(!tn(`new`,t)){if(dt()||ft()){I(`Wait for the current operation to finish before starting a new session.`);return}(await $.newSession(e.sessionKey)).cancelled?I(`New session cancelled.`):(await e.store.hydrateSession(e.sessionKey),await e.store.refreshDiskSessions())}},compact:async t=>{t?(await $.compact(e.sessionKey,t),I(`Compaction started.`)):S(!0)},dream:async t=>{let n=await $.dream(e.sessionKey,t||void 0);I(n.message)},resume:async e=>{tn(`resume`,e)||await Wt()},reload:async t=>{if(tn(`reload`,t))return;if(dt()||ft()){I(`Wait for the current operation to finish before reloading.`);return}await $.reload(e.sessionKey);let[{commands:n}]=await Promise.all([$.commands(e.sessionKey),e.store.hydrateSession(e.sessionKey)]);H(n),I(`Reloaded extensions, skills, prompts, themes, and settings.`)},quit:async e=>{tn(`quit`,e)||await sn()}};async function an(){let t=r().trim();if(!t&&ye().length===0&&_e().length===0)return;P(void 0),I(void 0);let n=il(t,se());if(n){if(ye().length>0||_e().length>0){I(`Remove attachments before running a built-in command; nothing was sent or discarded.`);return}try{await al(n,rn,I),i(``),Se(void 0)}catch(e){P(e instanceof Error?e.message:String(e))}return}let o=en(t||`Please review the attached item(s). `);try{let t=_e(),n=t.length>0?await Promise.all(t.map(async({blob:e,mimeType:t})=>({data:await Tt(e),mimeType:t}))):void 0;dt()?await $.prompt(e.sessionKey,o,a(),n):n?await $.prompt(e.sessionKey,o,void 0,n):await $.prompt(e.sessionKey,o),pl(e.sessionKey,o),Se(void 0),i(``),Dt(),be([]),bt()}catch(e){P(e instanceof Error?e.message:String(e))}}async function on(){c(!0);try{await $.abort(e.sessionKey),await It()}catch(e){P(e instanceof Error?e.message:String(e))}finally{c(!1)}}async function sn(){if(!l()){u(!0),P(void 0);try{await $.stopRuntime(e.sessionKey),await e.store.removeRuntime(e.sessionKey),e.store.navigate({screen:`fleet`})}catch(e){P(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function cn(t){try{t===`compaction`?await $.abortCompaction(e.sessionKey):t===`retry`&&await $.abortRetry(e.sessionKey)}catch(e){P(e instanceof Error?e.message:String(e))}}function ln(e){at?.querySelectorAll(`details.tool`).forEach(t=>{t.open=e})}let un=()=>Object.values(t()?.backgroundAgents??{}).filter(e=>e.status===`running`),dn=()=>Object.values(t()?.backgroundAgents??{}).filter(e=>e.status!==`running`),fn=()=>Object.values(t()?.backgroundAgents??{}).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt)),pn=()=>t()?.tasks??[],mn=()=>pn().filter(e=>e.status===`completed`).length,hn=()=>n()?.state.contextUsage??te()?.contextUsage,gn=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,_n=()=>t()?.sessionName??n()?.state.sessionName,vn=()=>_n()??t()?.title??e.sessionKey,yn=()=>{let e=n()?.cwd;if(!e)return;let t=ae();return`${ud(e)}${t?` (${t})`:``}`},bn=()=>{let e=yn(),t=_n();return e&&t?`${e} • ${t}`:e??t??`session`},xn=()=>{let e=te()?.tokens;if(!e)return;let t=[];return e.input&&t.push(`↑${sd(e.input)}`),e.output&&t.push(`↓${sd(e.output)}`),e.cacheRead&&t.push(`R${sd(e.cacheRead)}`),e.cacheWrite&&t.push(`W${sd(e.cacheWrite)}`),t.length>0?t.join(` `):void 0},Sn=()=>{let e=te()?.cost??0,t=n()?.state.usingSubscription??!1;if(!e&&!t)return;let r=`$${e.toFixed(3)}${t?` (sub)`:``}`,i=oe();return i!==void 0&&i>e&&(r+=`, today: $${i.toFixed(2)}`),r},Cn=()=>{let e=hn();if(e)return`ctx ${e.percent===null?`?`:`${e.percent.toFixed(0)}%`}/${sd(e.contextWindow)}`},wn=()=>ld(re(),n()?.state.model),Tn=()=>[xn(),Sn(),Cn(),wn()].filter(Boolean),En=()=>[...(he().steeringMessages??he().steering.map(e=>({text:e}))).map(e=>({kind:`steer`,text:e.images?.length?`${e.text} (${e.images.length} image(s))`:e.text})),...(he().followUpMessages??he().followUp.map(e=>({text:e}))).map(e=>({kind:`follow-up`,text:e.images?.length?`${e.text} (${e.images.length} image(s))`:e.text}))],Dn=()=>{let e=r();if(ce()||!e.startsWith(`/`))return;let t=e.slice(1);if(!/\s/.test(t))return t.toLowerCase()},On=N(()=>{let e=Dn();return e===void 0?[]:ol(se(),e)}),kn=()=>On().length>0,An=e=>{i(`/${e.name} `),le(!0),queueMicrotask(()=>Q?.focus())};return M(()=>{let e=On().length;U()>=e&&ue(Math.max(0,e-1))}),(()=>{var c=zu(),u=c.firstChild,k=u.firstChild,M=k.firstChild.nextSibling,N=M.nextSibling,I=u.nextSibling,R=I.firstChild,z=I.nextSibling,ee=z.firstChild,ne=ee.firstChild;Z(M,vn),Z(k,W(K,{get when(){return!_()},get children(){var e=hu();return Z(e,(()=>{var e=J(()=>!!n()?.cwd);return()=>e()?ud(n().cwd):void 0})()),e}}),N),Z(k,W(tt,{get store(){return e.store},class:`session-connection-indicator`}),N),Z(k,W(K,{get when(){return!_()},get children(){var t=_u(),r=t.firstChild,i=r.firstChild.nextSibling.nextSibling,a=r.nextSibling;a.firstChild.nextSibling;var o=a.nextSibling;return r.$$click=()=>f(!0),Z(i,()=>ad(n()?.state.model)),a.$$click=async()=>{let t=n()?.state.thinkingLevel??`off`,r=nd[(nd.indexOf(t)+1)%nd.length];try{await $.setThinking(e.sessionKey,r),e.store.setRuntimeThinkingLevel(e.sessionKey,r)}catch(e){P(e instanceof Error?e.message:String(e))}},Z(a,()=>n()?.state.thinkingLevel??`—`,null),Z(t,W(K,{get when(){return hn()},get children(){var e=gu();return e.firstChild.nextSibling,Z(e,(()=>{var e=J(()=>hn().percent===null);return()=>e()?`?`:`${hn().percent.toFixed(0)}%`})(),null),e}}),o),o.$$click=()=>g(!h()),j(()=>X(r,`title`,od(n()?.state.model))),t}}),N),N.$$click=()=>v(!_()),Z(N,()=>_()?`details ▾`:`details ▴`),Z(u,W(K,{get when(){return!_()},get children(){return[(()=>{var e=yu(),t=e.firstChild,n=t.nextSibling;return Z(t,bn),n.$$click=Yt,Z(n,W(G,{get each(){return Tn()},children:e=>(()=>{var t=Bu();return Z(t,e),t})()})),Z(e,W(K,{get when(){return $e()},get children(){var e=vu(),t=lt;return typeof t==`function`?Pe(t,e):lt=e,Z(e,W(K,{get when(){return rt()},get children(){var e=Gl();return Z(e,rt),e}}),null),Z(e,W(K,{get when(){return te()},get fallback(){return Vu()},children:e=>(()=>{var t=Hu(),n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling,i=r.nextSibling.nextSibling,a=i.firstChild,o=i.nextSibling.nextSibling,s=o.firstChild,c=o.nextSibling.nextSibling,l=c.firstChild,u=c.nextSibling.nextSibling,d=u.nextSibling.nextSibling;return d.firstChild,Z(n,()=>e().userMessages),Z(r,()=>e().assistantMessages),Z(i,()=>e().toolCalls,a),Z(i,()=>e().toolResults,null),Z(o,()=>sd(e().tokens.input),s),Z(o,()=>sd(e().tokens.output),null),Z(c,()=>sd(e().tokens.cacheRead),l),Z(c,()=>sd(e().tokens.cacheWrite),null),Z(u,()=>sd(e().tokens.total)),Z(d,()=>e().cost.toFixed(4),null),t})()}),null),e}}),null),e})(),W(K,{get when(){return h()},get children(){var t=Su(),r=t.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling,c=s.nextSibling,u=c.nextSibling,d=u.nextSibling;return i.$$click=()=>S(!0),a.$$click=()=>ln(!0),o.$$click=()=>ln(!1),s.$$click=()=>w(!0),c.$$click=qt,u.$$click=yt,Z(t,W(K,{get when(){return gn()},get children(){return[(()=>{var e=bu();return e.firstChild,e.$$click=()=>f(!0),Z(e,()=>ad(n()?.state.model),null),e})(),(()=>{var t=xu();return t.firstChild,t.$$click=async()=>{let t=n()?.state.thinkingLevel??`off`,r=nd[(nd.indexOf(t)+1)%nd.length];try{await $.setThinking(e.sessionKey,r),e.store.setRuntimeThinkingLevel(e.sessionKey,r)}catch(e){P(e instanceof Error?e.message:String(e))}},Z(t,()=>n()?.state.thinkingLevel??`—`,null),t})()]}}),d),d.$$click=sn,Z(d,()=>l()?`stopping runtime…`:`stop runtime`),j(t=>{var n=$.exportHtmlUrl(e.sessionKey),i=l();return n!==t.e&&X(r,`href`,t.e=n),i!==t.t&&(d.disabled=t.t=i),t},{e:void 0,t:void 0}),t}})]}}),null),Z(c,W(K,{get when(){return J(()=>!!(!_()&&n()?.state.modelFallbackMessage))()&&!D()},get children(){var e=Cu(),t=e.firstChild.firstChild;t.firstChild;var r=t.nextSibling;return Z(t,()=>n().state.modelFallbackMessage,null),r.$$click=()=>O(!0),e}}),I);var re=at;typeof re==`function`?Pe(re,I):at=I;var ie=ot;return typeof ie==`function`?Pe(ie,R):ot=R,Z(R,W(K,{get when(){return t()},get fallback(){return Uu()},get children(){return[W(G,{get each(){return t().widgets.above},children:e=>(()=>{var t=Wu();return Z(t,e),t})()}),W(xc,{get entries(){return t().entries},get resetKey(){return e.sessionKey},get imageScope(){return{runtimeKey:e.sessionKey}}}),W(K,{get when(){return t().uiRequests.find(e=>e.method===`ask`)},children:e=>W(bd,{get request(){return e()},onRespond:St,onStop:()=>void on(),get stopping(){return s()}})}),W(G,{get each(){return t().widgets.below},children:e=>(()=>{var t=Wu();return Z(t,e),t})()})]}})),ne.$$click=()=>b(!y()),Z(ne,()=>y()?`compose ▴`:`compose ▾`),Z(ee,W(K,{get when(){return y()},get children(){var e=wu();return Z(e,(()=>{var e=J(()=>!!ht());return()=>e()?`agent working — open controls to stop or steer`:J(()=>En().length>0)()?`${En().length} queued message(s)`:`composer hidden for transcript reading`})()),e}}),null),Z(z,W(K,{get when(){return!y()},get children(){var n=Lu(),c=n.firstChild,l=c.firstChild,u=l.nextSibling,d=u.firstChild,f=d.nextSibling,p=f.nextSibling,m=p.nextSibling,h=m.nextSibling;Z(n,W(K,{get when(){return pn().length>0},get children(){var e=Tu(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;r.nextSibling;var i=t.nextSibling;return Z(t,mn,n),Z(t,()=>pn().length,r),Z(i,W(G,{get each(){return pn()},children:e=>(()=>{var t=Gu(),n=t.firstChild;return Z(t,(()=>{var t=J(()=>e.status===`completed`);return()=>t()?`☑`:e.status===`in_progress`?`⧖`:`☐`})(),n),Z(t,()=>e.title,null),j(n=>{var r=e.status===`completed`,i=e.status===`in_progress`;return r!==n.e&&t.classList.toggle(`done`,n.e=r),i!==n.t&&t.classList.toggle(`active`,n.t=i),n},{e:void 0,t:void 0}),t})()})),j(()=>e.open=!gn()),e}}),c),Z(n,W(K,{get when(){return un().length+dn().length>0},get children(){var t=Eu(),n=t.firstChild,r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;i.nextSibling;var a=n.nextSibling;return Z(n,()=>un().length,r),Z(n,()=>dn().length,i),Z(a,W(G,{get each(){return fn()},children:t=>(()=>{var n=Ku(),r=n.firstChild,i=r.firstChild,a=i.nextSibling,o=a.firstChild;return r.$$click=()=>e.store.navigate({screen:`subagent`,key:e.sessionKey,agentId:t.agentId}),Z(i,(()=>{var e=J(()=>t.status===`running`);return()=>e()?`●`:t.status===`completed`?`✓`:`✕`})()),Z(a,()=>t.agentType,o),Z(a,()=>t.taskSummary,null),Z(a,W(K,{get when(){return t.arbitrations?.at(-1)},children:e=>e().status===`failure`?` · arbitration failed`:` · ${e().final?.model??e().proposed.model} @ ${e().final?.thinking??e().proposed.thinking}`}),null),j(()=>Ae(i,t.status===`running`?`live`:`done`)),n})()})),j(()=>t.open=!gn()),t}}),c),Z(n,W(K,{get when(){return ht()||(t()?.statusEntries.length??0)>0||A()||F()},get children(){var e=ju();return Z(e,W(K,{get when(){return dt()},get children(){var e=Du();return e.firstChild,Z(e,(()=>{var e=J(()=>!!t()?.workingText);return()=>e()?` — ${t().workingText}`:``})(),null),Z(e,(()=>{var e=J(()=>L()>2);return()=>e()?` (${L()}s)`:``})(),null),e}}),null),Z(e,W(G,{get each(){return t()?.statusEntries??[]},children:e=>(()=>{var t=Bu();return Z(t,()=>e.text,null),Z(t,W(K,{get when(){return e.key===`compaction`||e.key===`retry`},get children(){var t=qu();return t.$$click=()=>cn(e.key),t}}),null),j(()=>Ae(t,e.tone===`info`?`queued`:e.tone)),t})()}),null),Z(e,W(K,{get when(){return A()},get children(){var e=Ou();return Z(e,A),e}}),null),Z(e,W(K,{get when(){return F()},get children(){var e=ku();return Z(e,F),e}}),null),Z(e,W(K,{get when(){return ht()},get children(){var e=Au();return e.$$click=on,Z(e,()=>s()?`stopping…`:`■ stop`),j(()=>e.disabled=s()),e}}),null),e}}),c),Z(c,W(K,{get when(){return En().length>0},get children(){var e=Mu(),t=e.firstChild;return Z(e,W(G,{get each(){return En()},children:e=>(()=>{var t=Ju(),n=t.firstChild;return Z(n,()=>e.kind),Z(t,()=>e.text,null),j(()=>X(t,`title`,e.text)),t})()}),t),t.$$click=It,e}}),l),Z(c,W(K,{get when(){return ye().length>0||_e().length>0},get children(){var e=Nu();return Z(e,W(G,{get each(){return ye()},children:(e,t)=>(()=>{var n=Yu(),r=n.firstChild;r.firstChild;var i=r.nextSibling,a=i.nextSibling;return Z(r,()=>e.fileName,null),Z(i,()=>md(e.size)),a.$$click=()=>be(e=>e.filter((e,n)=>n!==t())),j(()=>X(n,`title`,e.path)),n})()}),null),Z(e,W(G,{get each(){return _e()},children:(e,t)=>(()=>{var n=Xu(),r=n.firstChild,i=r.nextSibling;return i.$$click=()=>Ot(t()),j(t=>{var i=`${e.fileName} (${md(e.size)})`,a=e.previewUrl,o=e.fileName;return i!==t.e&&X(n,`title`,t.e=i),a!==t.t&&X(r,`src`,t.t=a),o!==t.a&&X(r,`alt`,t.a=o),t},{e:void 0,t:void 0,a:void 0}),n})()}),null),e}}),l),Z(c,W(K,{get when(){return kn()},get children(){var e=Pu();return Z(e,W(G,{get each(){return On()},children:(e,t)=>(()=>{var n=Qu(),r=n.firstChild;r.firstChild;var i=r.nextSibling;return n.$$click=()=>An(e),n.addEventListener(`mouseenter`,()=>ue(t())),Z(r,()=>e.name,null),Z(n,W(K,{get when(){return e.description},get children(){var t=Zu();return Z(t,()=>e.description),t}}),i),Z(i,()=>e.source),j(e=>{var r=`command-option-${t()}`,i=U()===t(),a=U()===t();return r!==e.e&&X(n,`id`,e.e=r),i!==e.t&&X(n,`aria-selected`,e.t=i),a!==e.a&&n.classList.toggle(`selected`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),n})()})),e}}),l),l.$$keydown=t=>{if(kn()){if(t.key===`ArrowDown`){t.preventDefault(),ue((U()+1)%On().length);return}if(t.key===`ArrowUp`){t.preventDefault(),ue((U()-1+On().length)%On().length);return}if(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey&&!gn()){t.preventDefault();let e=On()[U()];e&&t.key===`Enter`&&r()===`/${e.name}`?(le(!0),an()):e&&An(e);return}if(t.key===`Escape`){t.preventDefault(),le(!0);return}}if((t.key===`ArrowUp`||t.key===`ArrowDown`)&&(r()===``||xe()!==void 0)){let n=fl(e.sessionKey);if(n.length>0){if(t.preventDefault(),t.key===`ArrowUp`){let e=xe()===void 0?n.length-1:Math.max(0,xe()-1);Se(e),i(n[e]??``)}else if(xe()!==void 0){let e=xe()+1;e>=n.length?(Se(void 0),i(``)):(Se(e),i(n[e]??``))}}return}t.key===`Enter`&&!t.shiftKey&&!gn()&&(t.preventDefault(),an())},l.$$input=e=>{le(!1),ue(0),Se(void 0),i(e.currentTarget.value),_d(e.currentTarget)},l.addEventListener(`paste`,e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e);t.length>0&&(e.preventDefault(),zt(t))});var g=Q;typeof g==`function`?Pe(g,l):Q=l,d.addEventListener(`change`,e=>{Vt(e.currentTarget.files??[]),e.currentTarget.value=``});var _=st;typeof _==`function`?Pe(_,d):st=d,f.addEventListener(`change`,e=>{zt(e.currentTarget.files??[]),e.currentTarget.value=``});var v=ct;return typeof v==`function`?Pe(v,f):ct=f,p.$$click=()=>st?.click(),m.$$click=()=>ct?.click(),Z(u,W(K,{get when(){return dt()},get children(){var e=Fu(),t=e.firstChild,n=t.nextSibling;return t.$$click=()=>o(`steer`),n.$$click=()=>o(`follow_up`),j(e=>{var r=a()===`steer`,i=a()===`follow_up`;return r!==e.e&&t.classList.toggle(`selected`,e.e=r),i!==e.t&&n.classList.toggle(`selected`,e.t=i),e},{e:void 0,t:void 0}),e}}),h),Z(u,W(K,{get when(){return t()?.suggestedCommand},get children(){var e=Iu(),n=e.firstChild.nextSibling;return e.$$click=()=>i(t().suggestedCommand),Z(n,()=>t().suggestedCommand),e}}),h),h.$$click=an,j(e=>{var t=dt()?`Message dreb — sends as steer while it works…`:`Message dreb…`,n=kn()?`command-listbox`:void 0,r=kn()?`command-option-${U()}`:void 0;return t!==e.e&&X(l,`placeholder`,e.e=t),n!==e.t&&X(l,`aria-controls`,e.t=n),r!==e.a&&X(l,`aria-activedescendant`,e.a=r),e},{e:void 0,t:void 0,a:void 0}),j(()=>l.value=r()),n}}),null),Z(c,W(K,{get when(){return t()?.uiRequests.find(e=>e.method!==`ask`)},keyed:!0,children:e=>W(vd,{request:e,onRespond:St})}),null),Z(c,W(K,{get when(){return d()},get children(){return W(Sd,{get sessionKey(){return e.sessionKey},get state(){return n()?.state},get initialFilter(){return p()},onClose:()=>{f(!1),m(``)},onSelected:t=>e.store.setRuntimeModel(e.sessionKey,t)})}}),null),Z(c,W(K,{get when(){return x()},get children(){return W(nt,{title:`compact context`,onDismiss:()=>S(!1),get actions(){return[(()=>{var e=yl();return e.$$click=()=>S(!1),e})(),(()=>{var t=$u();return t.$$click=async()=>{S(!1);try{await $.compact(e.sessionKey)}catch(e){P(e instanceof Error?e.message:String(e))}},t})()]},get children(){return Ru()}})}}),null),Z(c,W(K,{get when(){return T()},get children(){return W(xd,{get resources(){return de()},get error(){return pe()},onClose:()=>E(!1)})}}),null),Z(c,W(K,{get when(){return Ce()},get children(){return W(nt,{title:`fork from message`,onDismiss:()=>we(!1),get children(){return[W(K,{get when(){return Ee()},get children(){var e=Gl();return Z(e,Ee),e}}),W(K,{get when(){return Te().length>0},get fallback(){return ed()},get children(){var e=su();return Z(e,W(G,{get each(){return Te()},children:e=>(()=>{var t=uu(),n=t.firstChild,r=n.nextSibling;return t.$$click=()=>Jt(e.entryId),Z(n,()=>e.entryId),Z(r,()=>e.text),t})()})),e}})]}})}}),null),Z(c,W(K,{get when(){return Oe()},get children(){return W(wd,{get roots(){return ke()},get leafId(){return Me()},get loading(){return Fe()},get error(){return Le()},onClose:()=>Y(!1),onNavigate:Ut})}}),null),Z(c,W(K,{get when(){return ze()},get children(){return W(Td,{get sessions(){return Ve()},get loading(){return Ue()},get error(){return Ge()},onClose:()=>Be(!1),onResume:Gt})}}),null),Z(c,W(K,{get when(){return qe()},get children(){return W(Ed,{get initialPath(){return Ye()},get error(){return Ze()},onClose:()=>Je(!1),onImport:Kt})}}),null),Z(c,W(K,{get when(){return C()},get children(){return W(Od,{get current(){return _n()??``},onClose:()=>w(!1),onRename:async t=>{try{await $.rename(e.sessionKey,t),w(!1)}catch(e){P(e instanceof Error?e.message:String(e))}}})}}),null),j(e=>{var t=!!_(),n=_()?`show session details`:`hide session details`,r=!!y(),i=y()?`show composer and controls`:`hide composer and controls`;return t!==e.e&&u.classList.toggle(`collapsed`,e.e=t),n!==e.t&&X(N,`title`,e.t=n),r!==e.a&&z.classList.toggle(`collapsed`,e.a=r),i!==e.o&&X(ne,`title`,e.o=i),e},{e:void 0,t:void 0,a:void 0,o:void 0}),c})()}function Od(e){let[t,n]=k(e.current);return W(nt,{title:`rename session`,get onDismiss(){return e.onClose},get actions(){return[(()=>{var t=yl();return je(t,`click`,e.onClose,!0),t})(),(()=>{var n=td();return n.$$click=()=>e.onRename(t().trim()),j(()=>n.disabled=!t().trim()),n})()]},get children(){var e=_l(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e}})}ke([`input`,`click`,`keydown`]);var kd=Y(`<div class=settings-error>`),Ad=Y(`<p class=muted>Loading scoped models…`),jd=Y(`<section class="settings-section scoped-models-editor"tabindex=-1 aria-labelledby=scoped-models-heading><h2 id=scoped-models-heading>scoped models</h2><p class="muted small">Controls model cycling for new sessions only; running sessions are never changed. Writes always update global settings, while the selected context shows effective global-plus-project settings.</p><label class=scoped-models-context><span>project context</span><select><option value>global / home`),Md=Y(`<option>`),Nd=Y(`<div class=settings-warning>This project defines enabledModels in .dreb/settings.json and shadows global writes.`),Pd=Y(`<div class=scoped-models-toolbar><input type=search aria-label="Search available models"placeholder="search provider, model, or name…"><button type=button class="btn btn-small">enable all`),Fd=Y(`<div class=scoped-models-grid><div class=scoped-models-order><h3>cycling order</h3><p class="muted small"></p></div><div class=scoped-models-available><h3>available models`),Id=Y(`<span class="muted small">unsaved changes`),Ld=Y(`<span class="muted small">✓ saved`),Rd=Y(`<div class=scoped-models-actions><button type=button class="btn btn-small">reset</button><button type=button class="btn btn-primary btn-small">`),zd=Y(`<div class=settings-warning>`),Bd=Y(`<div class=scoped-model-order-row><span></span><div class=scoped-model-move-controls><button type=button>↑</button><button type=button>↓`),Vd=Y(`<p class="muted small">No matching models.`),Hd=Y(`<section class=scoped-model-provider><label class=scoped-model-provider-heading><input type=checkbox><span>`),Ud=Y(`<span class=model-name>`),Wd=Y(`<label class=scoped-model-choice><input type=checkbox><span class=model-id>`);function Gd(e){return`${e.provider}/${e.id}`}function Kd(e){let t=new Map;for(let n of e){let e=t.get(n.provider)??[];e.push(n),t.set(n.provider,e)}return[...t].map(([e,t])=>({provider:e,models:t}))}function qd(e){let[t,n]=k(``),[r,i]=k(!0),[a,o]=k([]),[s,c]=k(!1),[l,u]=k(!1),[d,f]=k(!1),[p,m]=k(),[h,g]=k([]),_,v,y,b=()=>e.cwd??``,[x,{mutate:S}]=F(b,async e=>{let t=e||void 0,[n,r]=await Promise.all([$.settings(t),$.settingsModels(t)]);return{cwd:e,settings:n,models:r.models}}),C=N(()=>{if(x.error)return;let e=x();return e?.cwd===b()?e:void 0});function w(e,t){let n=e.enabledModels===void 0;i(n),o(n?t.map(Gd):e.resolvedScopedModels.map(e=>`${e.provider}/${e.id}`)),c(!1),f(!1),m(void 0),g([])}let T=b();M(()=>{let e=b();e!==T&&(T=e,v=void 0,y=void 0,c(!1),f(!1),m(void 0),g([]))}),M(()=>{let e=C();!e||e.cwd===v&&e.settings===y||(v=e.cwd,y=e.settings,w(e.settings,e.models))}),M(()=>{!e.focused||!_||(_.scrollIntoView({block:`start`}),_.focus({preventScroll:!0}))});let E=N(()=>new Set(a())),D=N(()=>{let t=new Set(e.projectRoots);return e.cwd&&t.add(e.cwd),[...t].sort((e,t)=>e.localeCompare(t))}),O=N(()=>{let e=t().trim().toLowerCase();return Kd((C()?.models??[]).filter(t=>!e||`${t.provider}/${t.id} ${t.name??``}`.toLowerCase().includes(e)))}),A=N(()=>{if((C()?.models.length??0)===0)return`No available models were reported for this context.`;if(!r()&&a().length===0)return`At least one model must remain enabled.`}),P=N(()=>{let e=C()?.settings;if(!e?.enabledModels)return;let t=e.resolvedScopedModels.map(e=>`${e.provider}/${e.id}`);return e.enabledModels.length===t.length&&e.enabledModels.every((e,n)=>e===t[n])&&e.scopeWarnings.length===0?void 0:`Saving an edited legacy scope replaces patterns and per-pattern thinking suffixes with exact provider/model references.`});function I(e){let t=C()?.models.map(Gd)??[],n=t.length>0&&t.every(t=>e.includes(t));i(n),o(n?t:e),c(!0),f(!1),m(void 0)}function L(e){let t=r()?C()?.models.map(Gd)??[]:a();I(t.includes(e)?t.filter(t=>t!==e):[...t,e])}function R(e){let t=(C()?.models??[]).filter(t=>t.provider===e).map(Gd),n=r()?C()?.models.map(Gd)??[]:a();I(t.every(e=>n.includes(e))?n.filter(e=>!t.includes(e)):[...n,...t.filter(e=>!n.includes(e))])}function z(e,t){if(r())return;let n=e+t;if(n<0||n>=a().length)return;let i=[...a()];[i[e],i[n]]=[i[n],i[e]],o(i),c(!0),f(!1)}function ee(){let e=C();e&&w(e.settings,e.models)}async function te(){let e=C();if(!e||!s()||A())return;u(!0),m(void 0),g([]),f(!1);let t=e.cwd||void 0;try{let n=await $.saveSettings({enabledModels:r()?null:a()},t);if(b()!==e.cwd)return;v=e.cwd,y=n,S({cwd:e.cwd,settings:n,models:e.models}),w(n,e.models),g(n.warnings??[]),f(!0)}catch(t){b()===e.cwd&&m(t instanceof Error?t.message:String(t))}finally{u(!1)}}return(()=>{var i=jd(),o=i.firstChild.nextSibling.nextSibling.firstChild.nextSibling;o.firstChild;var c=_;return typeof c==`function`?Pe(c,i):_=i,o.addEventListener(`change`,t=>e.onCwdChange(t.currentTarget.value||void 0)),Z(o,W(G,{get each(){return D()},children:e=>(()=>{var t=Md();return t.value=e,Z(t,e),t})()}),null),Z(i,W(K,{get when(){return x.error},get children(){var e=kd();return Z(e,(()=>{var e=J(()=>x.error instanceof Error);return()=>e()?x.error.message:String(x.error)})()),e}}),null),Z(i,W(K,{get when(){return x.loading},get children(){return Ad()}}),null),Z(i,W(K,{get when(){return C()},children:e=>[W(K,{get when(){return e().settings.hasProjectEnabledModelsOverride},get children(){return Nd()}}),W(K,{get when(){return P()},children:e=>(()=>{var t=zd();return Z(t,e),t})()}),W(G,{get each(){return e().settings.scopeWarnings},children:e=>(()=>{var t=zd();return Z(t,()=>e.message),t})()}),W(G,{get each(){return h()},children:e=>(()=>{var t=zd();return Z(t,e),t})()}),W(K,{get when(){return p()},children:e=>(()=>{var t=kd();return Z(t,e),t})()}),W(K,{get when(){return A()},children:e=>(()=>{var t=kd();return Z(t,e),t})()}),(()=>{var i=Pd(),a=i.firstChild,o=a.nextSibling;return a.$$input=e=>n(e.currentTarget.value),o.$$click=()=>I(e().models.map(Gd)),j(()=>o.disabled=r()),j(()=>a.value=t()),i})(),(()=>{var t=Fd(),n=t.firstChild,i=n.firstChild.nextSibling,o=n.nextSibling;return o.firstChild,Z(i,(()=>{var e=J(()=>!!r());return()=>e()?`All available models, in registry order (future models included).`:`${a().length} enabled model${a().length===1?``:`s`}.`})()),Z(n,W(G,{get each(){return a()},children:(e,t)=>(()=>{var n=Bd(),i=n.firstChild,o=i.nextSibling.firstChild,s=o.nextSibling;return X(i,`title`,e),Z(i,e),o.$$click=()=>z(t(),-1),X(o,`aria-label`,`Move ${e} up`),s.$$click=()=>z(t(),1),X(s,`aria-label`,`Move ${e} down`),j(e=>{var n=r()||t()===0,i=r()||t()===a().length-1;return n!==e.e&&(o.disabled=e.e=n),i!==e.t&&(s.disabled=e.t=i),e},{e:void 0,t:void 0}),n})()}),null),Z(o,W(K,{get when(){return O().length>0},get fallback(){return Vd()},get children(){return W(G,{get each(){return O()},children:t=>(()=>{var n=Hd(),r=n.firstChild.firstChild,i=r.nextSibling;return r.addEventListener(`change`,()=>R(t.provider)),Z(i,()=>t.provider),Z(n,W(G,{get each(){return t.models},children:e=>{let t=Gd(e);return(()=>{var n=Wd(),r=n.firstChild,i=r.nextSibling;return X(n,`title`,t),r.addEventListener(`change`,()=>L(t)),Z(i,()=>e.id),Z(n,W(K,{get when(){return e.name},get children(){var t=Ud();return Z(t,()=>e.name),t}}),null),j(()=>r.checked=E().has(t)),n})()}}),null),j(()=>r.checked=e().models.filter(e=>e.provider===t.provider).every(e=>E().has(Gd(e)))),n})()})}}),null),t})(),(()=>{var e=Rd(),t=e.firstChild,n=t.nextSibling;return t.$$click=ee,n.$$click=()=>void te(),Z(n,()=>l()?`saving…`:`save`),Z(e,W(K,{get when(){return s()},get children(){return Id()}}),null),Z(e,W(K,{get when(){return d()},get children(){return Ld()}}),null),j(e=>{var r=!s()||l(),i=!s()||l()||!!A();return r!==e.e&&(t.disabled=e.e=r),i!==e.t&&(n.disabled=e.t=i),e},{e:void 0,t:void 0}),e})()]}),null),j(()=>o.value=e.cwd??``),i})()}ke([`input`,`click`]);var Jd=[{id:`default`,label:`entropist.ca`},{id:`dim`,label:`Dim`},{id:`solarized`,label:`Solarized`},{id:`gruvbox`,label:`Gruvbox`},{id:`qud`,label:`Caves of Qud`},{id:`vangogh`,label:`Van Gogh`},{id:`okabe`,label:`Colorblind-safe (Okabe-Ito)`},{id:`tol`,label:`Colorblind-safe (Paul Tol)`}],Yd=Jd.map(e=>e.id),Xd=[`system`,`light`,`dark`],Zd=`dreb.dashboard.theme`,Qd=`dreb.dashboard.colorMode`,$d=`default`,ef=`system`;function tf(e){return typeof e==`string`&&Yd.includes(e)}function nf(e){return typeof e==`string`&&Xd.includes(e)}function rf(){if(typeof window>`u`)return $d;try{let e=window.localStorage.getItem(Zd);return tf(e)?e:$d}catch{return $d}}function af(){if(typeof window>`u`)return ef;try{let e=window.localStorage.getItem(Qd);return nf(e)?e:ef}catch{return ef}}function of(e,t,n){if(!(typeof window>`u`))try{t===n?window.localStorage.removeItem(e):window.localStorage.setItem(e,t)}catch{}}var[sf,cf]=k(rf()),[lf,uf]=k(af()),df=sf,ff=lf;function pf(e){let t=e.defaultView??(typeof window<`u`?window:void 0);return!t||typeof t.getComputedStyle!=`function`?``:t.getComputedStyle(e.documentElement).getPropertyValue(`--bg`).trim()}function mf(e){try{let t=e??(typeof document<`u`?document:void 0);if(!t)return;let n=t.documentElement;if(!n)return;let r=sf(),i=lf();if(r===$d?n.removeAttribute(`data-theme`):n.setAttribute(`data-theme`,r),i===ef?n.removeAttribute(`data-color-mode`):n.setAttribute(`data-color-mode`,i),!(r!==$d||i!==ef))n.style.removeProperty(`color-scheme`);else{let e=i===`light`?`light`:i===`dark`?`dark`:`light dark`;n.style.setProperty(`color-scheme`,e)}}catch{}}function hf(e){try{let t=e??(typeof document<`u`?document:void 0);if(!t)return;let n=pf(t);if(!n)return;let r=t.querySelector(`meta[name="theme-color"]:not([media])`);if(!r){r=t.createElement(`meta`),r.setAttribute(`name`,`theme-color`);let e=t.head??t.getElementsByTagName(`head`)[0];e&&e.insertBefore(r,e.firstChild)}r.setAttribute(`content`,n)}catch{}}function gf(e){let t=tf(e)?e:$d;cf(t),of(Zd,t,$d),mf(),hf()}function _f(e){let t=nf(e)?e:ef;uf(t),of(Qd,t,ef),mf(),hf()}var vf=null,yf=!1;function bf(){lf()===ef&&hf()}function xf(e){e.key!==null&&e.key!==`dreb.dashboard.theme`&&e.key!==`dreb.dashboard.colorMode`||Sf()}function Sf(){cf(rf()),uf(af()),mf(),hf()}function Cf(){if(!(typeof window>`u`)){try{typeof window.matchMedia==`function`&&(vf=window.matchMedia(`(prefers-color-scheme: dark)`),typeof vf.addEventListener==`function`?vf.addEventListener(`change`,bf):typeof vf.addListener==`function`&&vf.addListener(bf))}catch{}try{window.addEventListener(`storage`,xf)}catch{}}}function wf(){Sf(),!yf&&(yf=!0,Cf())}var Tf=Y(`<div class=appearance-controls><div class=setting-row><span class=setting-label><span class=name>color mode</span><span class=hint>this browser only — “system” follows your OS light/dark preference</span></span><span class=setting-control><select id=pref-color-mode></select></span></div><div class=theme-gallery>`),Ef=Y(`<option>`),Df=Y(`<button type=button class=theme-card><div class=theme-card-preview><div class=theme-card-swatch><span class=theme-card-name></span><span class=theme-card-muted>The quick brown fox.</span></div><div class=theme-card-chips></div><pre class=theme-card-code><code class=hljs><span class=hljs-keyword>const</span> <span class=hljs-variable>count</span><span class=hljs-operator> = </span><span class=hljs-number>42</span><span class=hljs-punctuation>;</span>
78
78
  <span class=hljs-comment>// preview</span>
79
- <span class=hljs-function>render</span><span class=hljs-punctuation>(</span><span class=hljs-string>"ok"</span><span class=hljs-punctuation>)</span><span class=hljs-punctuation>;</span></code></pre></div><span class=theme-card-footer><span class=theme-card-title></span><span class=theme-card-state>`),Of=[`running`,`attention`,`idle`,`error`];function kf(){let e=()=>{let e=ff();return e===`system`?void 0:e};return(()=>{var t=Tf(),n=t.firstChild,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling;return r.addEventListener(`change`,e=>_f(e.currentTarget.value)),Z(r,W(G,{each:Xd,children:e=>(()=>{var t=Ef();return t.value=e,Z(t,e),t})()})),Z(i,W(G,{each:Jd,children:t=>{let n=()=>df()===t.id;return(()=>{var r=Df(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling.firstChild,l=c.nextSibling;return r.$$click=()=>gf(t.id),Z(o,()=>t.label),Z(s,W(G,{each:Of,children:e=>W(Qe,{status:e,label:``})})),Z(c,()=>t.label),Z(l,()=>n()?`✓ active`:`select`),j(i=>{var a=!!n(),o=t.id,s=t.id,c=e(),l=n(),u=n()?`true`:void 0,d=`use the ${t.label} theme`;return a!==i.e&&r.classList.toggle(`active`,i.e=a),o!==i.t&&X(r,`data-theme-card`,i.t=o),s!==i.a&&X(r,`data-theme`,i.a=s),c!==i.o&&X(r,`data-color-mode`,i.o=c),l!==i.i&&X(r,`aria-pressed`,i.i=l),u!==i.n&&X(r,`aria-current`,i.n=u),d!==i.s&&X(r,`title`,i.s=d),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r})()}})),j(()=>r.value=ff()),t})()}ke([`click`]);var Af=Y(`<select><option value=on>on</option><option value=off>off`),jf=Y(`<div class=field style=margin-bottom:8px><input type=text placeholder="search models…">`),Mf=Y(`<div class=model-list style=max-height:320px>`),Nf=Y(`<p class="muted small">No matching models.`),Pf=Y(`<section class=model-provider-group><div class=model-provider-heading>`),Ff=Y(`<span class=model-name>`),If=Y(`<span class=model-reasoning>think`),Lf=Y(`<button type=button class=model-row><span class=model-current></span><span class=model-id></span><span class=model-provider-badge>`),Rf=Y(`<div class=settings-error>`),zf=Y(`<div class=settings-warning>`),Bf=Y(`<p class="muted small"style=margin-bottom:16px>✓ saved`),Vf=Y(`<div class=settings-success>new pairing lifetime saved`),Hf=Y(`<div class=setting-row><span class=setting-label><span class=name>pairing code</span><span class=hint>new devices enter this in the pairing screen; it rotates every 30s</span></span><span class=setting-control><code style=font-size:var(--fs-h2);letter-spacing:0.08em>`),Uf=Y(`<p class="muted small"style=padding-top:8px>No remote devices paired. Launch with <code>--remote --allow &lt;identity&gt;</code> to enable Tailscale access.`),Wf=Y(`<p>This exits the dashboard server process and terminates <strong>all running sessions</strong>.`),Gf=Y(`<div class=screen-fill><main class="container settings-wrap"><h1>settings</h1><p class=settings-intro>Ordinary defaults apply only to new sessions. Dispatch Arbiter changes apply to subsequent child spawns. Context trust changes apply to subsequent lazy loads in live sessions; already injected content cannot be retracted. Writes go to the global settings file on the host.</p><section class=settings-section><h2>dashboard</h2><div class=appearance-block><div class="setting-row appearance-heading-row"><span class=setting-label><span class=name>appearance</span><span class=hint>this browser only — theme and light/dark mode are stored in localStorage and are independent of the TUI theme. Okabe-Ito and Paul Tol are colorblind-safe palettes.</span></span></div></div><div class=setting-row><label class=setting-label for=pref-image-display-mode><span class=name>tool-result images</span><span class=hint>this browser only — placeholders make no automatic request, previews are bounded to 1024 px and 256 KiB, and originals automatically transfer full files. Choosing originals is the informed network-data opt-in.</span></label><span class=setting-control><select id=pref-image-display-mode><option value=placeholders>placeholders</option><option value=previews>bounded previews</option><option value=originals>automatic originals</option></select></span></div><div class=setting-row><span class=setting-label><span class=name>always expand thinking</span><span class=hint>this browser only — stored in localStorage, not the host settings file</span></span><span class=setting-control><label class=checkbox-control><input id=pref-expand-thinking type=checkbox><span>open by default</span></label></span></div><div class=setting-row><span class=setting-label><span class=name>auto-expand tool cards</span><span class=hint>this browser only — stored in localStorage, not the host settings file</span></span><span class=setting-control style=display:grid;gap:6px></span></div><div class=setting-row><span class=setting-label><span class=name>needs-attention notifications</span><span class=hint></span></span><span class=setting-control><label class=checkbox-control><input id=pref-notifications type=checkbox><span></span></label></span></div><div class=setting-row><span class=setting-label><span class=name>restart dashboard service</span><span class=hint></span></span><span class=setting-control><button type=button class="btn btn-small btn-danger"></button></span></div></section><section class=settings-section><h2>devices</h2><div class=device-row><span>this machine <span class=this-device></span></span><span class=meta>local · always allowed</span></div><div class=setting-row><label class=setting-label for=pairing-ttl-days><span class=name>new pairing lifetime</span><span class=hint>applies only to devices paired after saving; existing expiry dates do not change</span></label><span class=setting-control><input id=pairing-ttl-days type=number min=1 max=3650 step=1><span>days</span><button type=button class="btn btn-small"></button></span></div></section><footer>dreb<!> · dashboard`),Kf=Y(`<div>`),qf=Y(`<p class=muted>`),Jf=Y(`<section class=settings-section><h2>model</h2><div class=setting-row><span class=setting-label><span class=name>default model</span><span class=hint>used by new sessions; validated against configured providers</span></span><span class=setting-control><button type=button class="btn btn-small model-picker-button"></button></span></div><div class=setting-row><span class=setting-label><span class=name>default thinking level</span><span class=hint></span></span><span class=setting-control><select></select></span></div><div class=setting-row><span class=setting-label><span class=name>transport</span><span class=hint>preferred model transport for new sessions</span></span><span class=setting-control><select>`),Yf=Y(`<section class="settings-section dispatch-arbiter-settings"><h2>dispatch arbiter</h2><p class="muted small"style=margin-bottom:8px>Global-only, fully headless pre-spawn routing. Project settings cannot change it. When enabled, invalid model, scope, guide, inference, or output prevents the affected child from spawning.</p><div class=setting-row><span class=setting-label><span class=name>enabled</span><span class=hint>disabled by default; fail closed when enabled</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>arbiter model</span><span class=hint>exact authenticated provider/model; no fallback</span></span><span class=setting-control><button type=button class="btn btn-small model-picker-button"></button></span></div><div class=setting-row><span class=setting-label><span class=name>arbiter thinking</span><span class=hint>validated against the selected arbiter model</span></span><span class=setting-control><select></select></span></div><div class=setting-row><label class=setting-label for=dispatch-arbiter-guide-path><span class=name>routing guide path</span><span class=hint>blank uses ~/.dreb/agent/model-routing-guide.md</span></label><span class=setting-control><input id=dispatch-arbiter-guide-path type=text placeholder=~/.dreb/agent/model-routing-guide.md></span></div><div data-testid=dispatch-arbiter-readiness><strong>status:</strong> `),Xf=Y(`<div class="setting-row agent-context-row"><span class=setting-label><span class=name>agent definition context</span><span class=hint>choose a project to include its .dreb/agents definitions</span></span><span class=setting-control><select><option value>global/home only`),Zf=Y(`<section class=settings-section><h2>agent models</h2><p class="muted small"style=margin-bottom:8px>Per-agent fallback lists. First available model wins; empty lists revert to the default model. Agent definitions are loaded from an explicit project context so project-local agents do not depend on which runtime opened first.`),Qf=Y(`<section class=settings-section><h2>images</h2><div class=setting-row><span class=setting-label><span class=name>auto-resize images</span><span class=hint>resize image inputs before sending them to providers</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>block images</span><span class=hint>prevent image inputs from being sent to providers</span></span><span class=setting-control>`),$f=Y(`<section class=settings-section><h2>queueing</h2><div class=setting-row><span class=setting-label><span class=name>steering delivery</span><span class=hint>deliver queued steers all at once, or one per turn</span></span><span class=setting-control><select></select></span></div><div class=setting-row><span class=setting-label><span class=name>follow-up delivery</span><span class=hint>deliver queued follow-ups all at once, or one per turn</span></span><span class=setting-control><select>`),ep=Y(`<section class=settings-section><h2>behavior</h2><div class=setting-row><span class=setting-label><span class=name>skill slash commands</span><span class=hint>register skills as slash commands in new sessions</span></span><span class=setting-control></span></div><div class=context-trust-subsection><h3>trusted context folders</h3><p class="muted small">Specific global roots that may lazy-load nested AGENTS.md/CLAUDE.md and all descendants.</p><div class="settings-warning context-trust-global-warning"><strong>Global-only policy.</strong> Project <code>.dreb/settings.json</code> cannot enable, disable, or extend nested-context trust. Only these global settings and the Files view can; a cloned repository cannot grant itself trust.</div><form class=trusted-context-folder-add><label for=trusted-context-folder-path>add folder by path</label><input id=trusted-context-folder-path type=text placeholder=/path/to/project><button type=submit class="btn btn-small"></button></form></div><div class=setting-row><span class=setting-label><span class=name>global expert nested-context trust</span><span class=hint>allow nested AGENTS.md/CLAUDE.md from any resolvable directory</span></span><span class=setting-control></span></div><div class="settings-warning context-expert-warning"><strong>Expert global override.</strong> Project <code>.dreb/settings.json</code> cannot enable, disable, or extend nested-context trust; a cloned repository cannot grant itself trust. When ON, nested instructions from any resolvable directory may load, including untrusted prompt-injection content. Leave this OFF and use trusted folders for projects you control.</div><div class=setting-row><span class=setting-label><span class=name>hide thinking blocks</span><span class=hint>hide raw thinking blocks in rendered transcripts</span></span><span class=setting-control>`),tp=Y(`<section class=settings-section><h2>reliability</h2><div class=setting-row><span class=setting-label><span class=name>auto-compaction</span><span class=hint>summarize old context when the window fills</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>auto-retry</span><span class=hint>retry transient stream errors (rate limits, 5xx)</span></span><span class=setting-control>`),np=Y(`<p class="muted small settings-footnote">TUI-only settings (cursor, editor) are managed in the terminal /settings menu. The dashboard appearance (theme + light/dark mode) is set here, per-browser, and is independent of the TUI theme.`),rp=Y(`<option>`),ip=Y(`<p class="muted small">No agent definitions found.`),ap=Y(`<div class=agent-model-editor><button type=button class="btn btn-small">add model…`),op=Y(`<div class=agent-model-row><div class=agent-model-summary><span class=agent-model-name></span><span class=agent-model-description></span></div><div class=agent-model-fallbacks></div><button type=button class="btn btn-small agent-model-edit">`),sp=Y(`<span class="muted small">default`),cp=Y(`<span class=agent-model-chip>. `),lp=Y(`<p class="muted small">Using the default model.`),up=Y(`<div class=agent-model-entry><span></span><div class=agent-model-entry-actions><button type=button class="btn btn-small">↑</button><button type=button class="btn btn-small">↓</button><button type=button class="btn btn-small">×`),dp=Y(`<p class="muted small trusted-context-empty">No trusted folders. Use the Files view to trust a project folder and its descendants.`),fp=Y(`<div class=trusted-context-folder-row><code></code><span class=meta>and all descendants</span><button type=button class="btn btn-small btn-danger">`),pp=Y(`<label class=checkbox-control><input type=checkbox><span>`),mp=Y(`<div class=device-row><span></span><span class=meta> · paired <!> · expires </span><span class=actions><button type=button class="btn btn-small btn-danger">unpair`),hp=Y(`<button type=button class="btn btn-small">cancel`),gp=Y(`<button type=button class="btn btn-small btn-danger">restart`),_p=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],vp=[`all`,`one-at-a-time`],yp=[`sse`,`websocket`,`auto`];function bp(e){return`${e.provider}/${e.id}`}function xp(e){let t=bp(e);return e.name?`${t} — ${e.name}`:t}function Sp(e){return e.defaultProvider&&e.defaultModel?`${e.defaultProvider}/${e.defaultModel}`:`choose model…`}function Cp(e,t){return`${e.provider}/${e.id} ${e.name??``}`.toLowerCase().includes(t)}function wp(){if(typeof Notification>`u`){if(window.isSecureContext===!1)return`insecure`;let e=/iPad|iPhone|iPod/.test(navigator.userAgent),t=navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches===!0;return e&&!t?`ios-install`:`unsupported`}return Notification.permission}function Tp(e){let t=new Map;for(let n of e){let e=t.get(n.provider)??[];e.push(n),t.set(n.provider,e)}return[...t.entries()].map(([e,t])=>({provider:e,models:t}))}function Ep(e,t,n){let r=t+n;if(r<0||r>=e.length)return e;let i=[...e];return[i[t],i[r]]=[i[r],i[t]],i}function Dp(e){return(()=>{var t=Af();return t.addEventListener(`change`,t=>{e.onChange(t.currentTarget.value===`on`)===!1&&(t.currentTarget.value=e.value?`on`:`off`)}),j(()=>t.value=e.value?`on`:`off`),t})()}function Op(e){let[t,n]=k(``),r=()=>new Set(e.selected??[]),i=N(()=>{let n=t().toLowerCase();return Tp(e.models.filter(e=>!n||Cp(e,n)).slice(0,100))}),a=e=>r().has(bp(e));return W(nt,{get title(){return e.title},get onDismiss(){return e.onClose},class:`model-picker-modal`,get children(){return[(()=>{var e=jf(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),(()=>{var t=Mf();return Z(t,W(K,{get when(){return i().length>0},get fallback(){return Nf()},get children(){return W(G,{get each(){return i()},children:t=>(()=>{var n=Pf(),r=n.firstChild;return Z(r,()=>t.provider),Z(n,W(G,{get each(){return t.models},children:t=>(()=>{var n=Lf(),r=n.firstChild,i=r.nextSibling,o=i.nextSibling;return n.$$click=()=>e.onPick(t),Z(r,()=>a(t)?`✓`:``),Z(i,()=>t.id),Z(n,W(K,{get when(){return t.name},get children(){var e=Ff();return Z(e,()=>t.name),e}}),o),Z(o,()=>t.provider),Z(n,W(K,{get when(){return t.reasoning},get children(){return If()}}),null),j(e=>{var r=!!a(t),i=xp(t);return r!==e.e&&n.classList.toggle(`current`,e.e=r),i!==e.t&&X(n,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()}),null),n})()})}})),t})()]}})}function kp(e){let[t,n]=k(),[r,i]=k([]),[a,o]=k(!1),[s,c]=k(),[l,u]=k(),[d,f]=k(),[p,m]=k(e.target===`scoped-models`?e.routeScopedModelsCwd:void 0);M(()=>{m(e.target===`scoped-models`?e.routeScopedModelsCwd:void 0)});let[h,g]=k(``),[_,v]=k(!1),[y,b]=k(wp()),[x,{mutate:S,refetch:C}]=F(async()=>{n(void 0);try{return await $.settings()}catch(e){n(e instanceof Error?e.message:String(e));return}}),[w]=F(x,async()=>{try{let{models:e}=await $.settingsModels();return e}catch(e){return n(e instanceof Error?e.message:String(e)),[]}}),T=N(()=>{let t=new Set;for(let n of e.store.fleet().runtimes)t.add(n.cwd);for(let n of e.store.fleet().diskSessions)t.add(n.cwd);return[...t].sort((e,t)=>e.localeCompare(t))}),[E]=F(()=>({settings:x(),cwd:d()}),async({cwd:e})=>{if(!x())return[];try{let{agentTypes:t}=await $.agentTypes(e);return t}catch(e){return n(e instanceof Error?e.message:String(e)),[]}}),[D,{refetch:O}]=F(async()=>{let{devices:e}=await $.devices();return e}),[A,P]=k(),[I,L]=k(!1),[ee,te]=k(!1),[ne,re]=k(``),[ie,{mutate:ae}]=F(async()=>{try{return await $.pairingSettings()}catch(e){P(e instanceof Error?e.message:String(e));return}});M(()=>{let e=ie();e&&re(String(e.pairingTtlDays))});async function B(){P(void 0),L(!1);let e=Number(ne());if(!Number.isSafeInteger(e)||e<1||e>3650){P(`pairing lifetime must be a whole number from 1 through 3650 days`);return}te(!0);try{let t=await $.savePairingSettings(e);ae(t),L(!0)}catch(e){P(e instanceof Error?e.message:String(e))}finally{te(!1)}}let[oe,V]=k(),se;function H(){se&&clearTimeout(se),se=void 0}function ce(e){H();let t=Math.max(250,e??3e4)+100;se=setTimeout(()=>void le(),t)}async function le(){try{let e=await $.pairingCode();if(!e.enabled||!e.code){V(void 0),H();return}V(e),ce(e.expiresInMs)}catch(e){console.warn(`pairing code unavailable`,e),V(void 0),H()}}let[U]=F(async()=>{try{let{version:e}=await $.version();return e}catch{return}}),[ue]=F(async()=>{try{return await $.serverInfo()}catch{return}}),[de,fe]=k(!1),[pe,me]=k(!1),[he,ge]=k();async function _e(){ge(void 0),me(!0);try{await $.restartServer()}catch(e){ge(e instanceof Error?e.message:String(e)),me(!1)}}async function ve(e){n(void 0),i([]),o(!1);try{let t=await $.saveSettings(e);S(t),i(t.warnings??[]),o(!0),setTimeout(()=>o(!1),2e3)}catch(e){n(e instanceof Error?e.message:String(e)),await C()}}let ye=Promise.resolve(),be;function xe(){return be??x()?.subagentArbiter??{}}function Se(e){let t={...xe(),...e};be=t;let r=x();r&&S({...r,subagentArbiter:t}),ye=ye.then(async()=>{n(void 0),i([]),o(!1);try{let e=await $.saveSettings({subagentArbiter:t});i(e.warnings??[]),o(!0),setTimeout(()=>o(!1),2e3),be===t?(be=e.subagentArbiter??void 0,S(e)):S({...e,subagentArbiter:be})}catch(e){let r=e instanceof Error?e.message:String(e),i=await C();n(r),be===t?be=i?.subagentArbiter??void 0:i&&S({...i,subagentArbiter:be})}})}async function Ce(e,t){await ve({agentModels:{[e]:t}})}async function we(e){n(void 0),v(!0);try{let t=await $.trustContextFolder(e);S(t.settings),g(``)}catch(e){n(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function Te(e){n(void 0),v(!0);try{let t=await $.removeTrustedContextFolder(e);S(t.settings)}catch(e){n(e instanceof Error?e.message:String(e))}finally{v(!1)}}function q(e){return x()?.agentModels?.[e]??[]}function Ee(e){let t=e.subagentArbiter;return t?.enabled===!0?typeof t.model!=`string`||!t.model.trim()?{ready:!1,message:`not ready — choose an arbiter model`}:t.thinking!==void 0&&!_p.some(e=>e===t.thinking)?{ready:!1,message:`not ready — arbiter thinking setting is invalid`}:t.guidePath!==void 0&&typeof t.guidePath!=`string`?{ready:!1,message:`not ready — routing guide path is invalid`}:t.guidePath?.trim()?{ready:!0,message:`enabled — live scope and guide are validated before every child spawn`}:{ready:!0,message:`enabled — using ~/.dreb/agent/model-routing-guide.md; live scope/guide checked at dispatch`}:{ready:!1,message:`disabled`}}async function De(){typeof Notification>`u`||b(await Notification.requestPermission())}R(()=>void le()),z(H);let Oe=()=>e.store.auth();return(()=>{var i=Gf(),o=i.firstChild,v=o.firstChild.nextSibling.nextSibling,b=v.firstChild.nextSibling;b.firstChild;var S=b.nextSibling,C=S.firstChild.nextSibling.firstChild,k=S.nextSibling,M=k.firstChild.nextSibling.firstChild.firstChild,N=k.nextSibling,P=N.firstChild.nextSibling,F=N.nextSibling,R=F.firstChild,z=R.firstChild.nextSibling,te=R.nextSibling.firstChild.firstChild,ae=te.nextSibling,V=F.nextSibling.firstChild,se=V.firstChild.nextSibling,H=V.nextSibling.firstChild,ce=v.nextSibling,le=ce.firstChild.nextSibling,me=le.firstChild.firstChild.nextSibling,ge=le.nextSibling.firstChild.nextSibling.firstChild,ye=ge.nextSibling.nextSibling,be=ce.nextSibling,Y=be.firstChild.nextSibling;return Y.nextSibling,Z(i,W(et,{get store(){return e.store},active:`settings`}),o),Z(o,W(K,{get when(){return t()},get children(){var e=Rf();return Z(e,t),e}}),v),Z(o,W(K,{get when(){return r().length>0},get children(){var e=zf();return Z(e,W(G,{get each(){return r()},children:e=>(()=>{var t=Kf();return Z(t,e),t})()})),e}}),v),Z(o,W(K,{get when(){return a()},get children(){return Bf()}}),v),Z(o,W(K,{get when(){return x()},get fallback(){return(()=>{var e=qf();return Z(e,()=>t()?`Settings could not be loaded — see the error above.`:`Loading settings…`),e})()},children:t=>[(()=>{var e=Jf(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling,a=i.firstChild,o=a.firstChild.nextSibling,s=a.nextSibling.firstChild,l=i.nextSibling.firstChild.nextSibling.firstChild;return r.$$click=()=>c({kind:`default`}),Z(r,()=>Sp(t())),Z(o,()=>_p.join(` · `)),s.addEventListener(`change`,e=>ve({defaultThinkingLevel:e.currentTarget.value})),Z(s,W(G,{each:_p,children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),l.addEventListener(`change`,e=>ve({transport:e.currentTarget.value})),Z(l,W(G,{get each(){return[...yp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),j(()=>s.value=t().defaultThinkingLevel??`off`),j(()=>l.value=t().transport??`sse`),e})(),W(qd,{get cwd(){return p()},get projectRoots(){return T()},get focused(){return e.target===`scoped-models`},onCwdChange:t=>{m(t),e.store.navigate({screen:`settings`,target:`scoped-models`,...t?{cwd:t}:{}})}}),(()=>{var e=Yf(),r=e.firstChild.nextSibling.nextSibling,i=r.firstChild.nextSibling,a=r.nextSibling,o=a.firstChild.nextSibling.firstChild,s=a.nextSibling,l=s.firstChild.nextSibling.firstChild,u=s.nextSibling,d=u.firstChild.nextSibling.firstChild,f=u.nextSibling;return f.firstChild.nextSibling,Z(i,W(Dp,{get value(){return t().subagentArbiter?.enabled===!0},onChange:e=>{let t=xe();return e&&(typeof t.model!=`string`||!t.model.trim())?(n(`Choose an exact Dispatch Arbiter model before enabling it.`),c({kind:`arbiter`}),!1):(Se({enabled:e}),!0)}})),o.$$click=()=>c({kind:`arbiter`}),Z(o,(()=>{var e=J(()=>typeof t().subagentArbiter?.model==`string`);return()=>e()?t().subagentArbiter?.model:`choose model…`})()),l.addEventListener(`change`,e=>Se({thinking:e.currentTarget.value})),Z(l,W(G,{each:_p,children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),d.addEventListener(`change`,e=>{Se({guidePath:e.currentTarget.value.trim()||void 0})}),Z(f,()=>Ee(t()).message,null),j(()=>Ae(f,Ee(t()).ready?`settings-warning`:`muted small`)),j(()=>l.value=typeof t().subagentArbiter?.thinking==`string`&&_p.some(e=>e===t().subagentArbiter?.thinking)?t().subagentArbiter?.thinking:`off`),j(()=>d.value=typeof t().subagentArbiter?.guidePath==`string`?t().subagentArbiter?.guidePath:``),e})(),(()=>{var e=Zf();return e.firstChild.nextSibling,Z(e,W(K,{get when(){return T().length>0},get children(){var e=Xf(),t=e.firstChild.nextSibling.firstChild;return t.firstChild,t.addEventListener(`change`,e=>f(e.currentTarget.value||void 0)),Z(t,W(G,{get each(){return T()},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()}),null),j(()=>X(t,`title`,d()??`global/home only`)),j(()=>t.value=d()??``),e}}),null),Z(e,W(K,{get when(){return(E()??[]).length>0},get fallback(){return ip()},get children(){return W(G,{get each(){return E()??[]},children:e=>{let n=()=>t().agentModels?.[e.name]??[];return(()=>{var t=op(),r=t.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,s=o.nextSibling;return Z(i,()=>e.name),Z(a,()=>e.description),Z(o,W(K,{get when(){return n().length>0},get fallback(){return sp()},get children(){return W(G,{get each(){return n()},children:(e,t)=>(()=>{var n=cp(),r=n.firstChild;return Z(n,()=>t()+1,r),Z(n,e,null),n})()})}})),s.$$click=()=>u(l()===e.name?void 0:e.name),Z(s,()=>l()===e.name?`done`:`edit`),Z(t,W(K,{get when(){return l()===e.name},get children(){var t=ap(),r=t.firstChild;return Z(t,W(K,{get when(){return n().length>0},get fallback(){return lp()},get children(){return W(G,{get each(){return n()},children:(t,r)=>(()=>{var i=up(),a=i.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,c=s.nextSibling;return Z(a,t),o.$$click=()=>void Ce(e.name,Ep(n(),r(),-1)),s.$$click=()=>void Ce(e.name,Ep(n(),r(),1)),c.$$click=()=>void Ce(e.name,n().filter((e,t)=>t!==r())),j(e=>{var t=r()===0,i=r()===n().length-1;return t!==e.e&&(o.disabled=e.e=t),i!==e.t&&(s.disabled=e.t=i),e},{e:void 0,t:void 0}),i})()})}}),r),r.$$click=()=>c({kind:`agent`,agentName:e.name}),t}}),null),t})()}})}}),null),e})(),(()=>{var e=Qf(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Dp,{get value(){return t().imageAutoResize!==!1},onChange:e=>ve({imageAutoResize:e})})),Z(i,W(Dp,{get value(){return t().blockImages===!0},onChange:e=>ve({blockImages:e})})),e})(),(()=>{var e=$f(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling.firstChild.nextSibling.firstChild;return r.addEventListener(`change`,e=>ve({steeringMode:e.currentTarget.value})),Z(r,W(G,{get each(){return[...vp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),i.addEventListener(`change`,e=>ve({followUpMode:e.currentTarget.value})),Z(i,W(G,{get each(){return[...vp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),j(()=>r.value=t().steeringMode??`all`),j(()=>i.value=t().followUpMode??`all`),e})(),(()=>{var e=ep(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling,a=i.firstChild.nextSibling.nextSibling.nextSibling,o=a.firstChild.nextSibling,s=o.nextSibling,c=i.nextSibling,l=c.firstChild.nextSibling,u=c.nextSibling.nextSibling.firstChild.nextSibling;return Z(r,W(Dp,{get value(){return t().enableSkillCommands!==!1},onChange:e=>ve({enableSkillCommands:e})})),Z(i,W(K,{get when(){return(t().trustedContextFolders??[]).length>0},get fallback(){return dp()},get children(){return W(G,{get each(){return t().trustedContextFolders??[]},children:e=>(()=>{var t=fp(),n=t.firstChild,r=n.nextSibling.nextSibling;return Z(n,e),r.$$click=()=>void Te(e),Z(r,()=>_()?`revoking…`:`revoke trust`),j(()=>r.disabled=_()),t})()})}}),a),a.addEventListener(`submit`,e=>{e.preventDefault();let t=h().trim();t&&we(t)}),o.$$input=e=>g(e.currentTarget.value),Z(s,()=>_()?`trusting…`:`trust folder`),Z(l,W(Dp,{get value(){return t().autoLoadNestedContext===!0},onChange:e=>ve({autoLoadNestedContext:e})})),Z(u,W(Dp,{get value(){return t().hideThinkingBlock===!0},onChange:e=>ve({hideThinkingBlock:e})})),j(()=>s.disabled=_()||!h().trim()),j(()=>o.value=h()),e})(),(()=>{var e=tp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Dp,{get value(){return t().compactionEnabled!==!1},onChange:e=>ve({compactionEnabled:e})})),Z(i,W(Dp,{get value(){return t().retryEnabled!==!1},onChange:e=>ve({retryEnabled:e})})),e})(),np()]}),v),Z(b,W(kf,{}),null),C.addEventListener(`change`,e=>rs(e.currentTarget.value)),M.addEventListener(`change`,e=>ns(e.currentTarget.checked)),Z(P,W(G,{each:Ro,children:e=>(()=>{var t=pp(),n=t.firstChild,r=n.nextSibling;return n.addEventListener(`change`,t=>is(e,t.currentTarget.checked)),X(n,`id`,`pref-tool-expand-${e}`),Z(r,e),j(()=>n.checked=as(e)),t})()})),Z(z,(()=>{var e=J(()=>y()===`denied`);return()=>e()?`blocked by browser settings — re-enable notifications in site permissions`:J(()=>y()===`insecure`)()?`this page is not a secure context — notifications need HTTPS. Run the server with --https (tailscale cert <host>.<tailnet>.ts.net) and open it via the https:// hostname`:J(()=>y()===`ios-install`)()?`iOS notifications need the installed PWA — tap Share → Add to Home Screen, then open dreb from the home screen icon`:y()===`unsupported`?`browser notifications are unavailable in this environment`:`show a notification when the tab needs input (Android/desktop need the app installed on mobile; works over HTTPS or localhost)`})()),te.addEventListener(`change`,e=>{e.currentTarget.checked&&De()}),Z(ae,()=>y()===`granted`?`enabled`:`enable notifications`),Z(se,()=>ue()?.supervised?`restarts the server process (a supervisor respawns it with the latest build) — kills all running sessions`:`exits the server process — only auto-restarts if run under a supervisor (systemd, pm2, …); otherwise the dashboard goes down. kills all running sessions`),H.$$click=()=>fe(!0),Z(H,()=>pe()?`restarting…`:`restart`),Z(v,W(K,{get when(){return he()},get children(){var e=Rf();return Z(e,he),e}}),null),Z(me,()=>Oe()?.mode===`local`?`local`:`host`),ge.$$input=e=>{re(e.currentTarget.value),L(!1)},ye.$$click=()=>void B(),Z(ye,()=>ee()?`saving…`:`save`),Z(ce,W(K,{get when(){return I()},get children(){return Vf()}}),null),Z(ce,W(K,{get when(){return A()},get children(){var e=Rf();return Z(e,A),e}}),null),Z(ce,W(K,{get when(){return J(()=>!!oe()?.enabled)()&&oe()?.code},get children(){var e=Hf(),t=e.firstChild.nextSibling.firstChild;return Z(t,()=>oe().code),e}}),null),Z(ce,W(G,{get each(){return D()??[]},children:e=>(()=>{var t=mp(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.nextSibling;a.nextSibling;var o=r.nextSibling.firstChild;return Z(n,()=>e.device??e.id),Z(r,()=>e.identity,i),Z(r,()=>it(e.createdAt),a),Z(r,()=>e.expiresAt.slice(0,10),null),o.$$click=async()=>{await $.unpair(e.id),await O()},t})()}),null),Z(ce,W(K,{get when(){return(D()??[]).length===0},get children(){return Uf()}}),null),Z(be,(()=>{var e=J(()=>!!ue()?.version);return()=>e()?` v${ue().version}`:J(()=>!!U())()?` v${U()}`:``})(),Y),Z(be,W(K,{get when(){return ue()?.startedAt},get children(){return[` · server build, up `,J(()=>it(ue().startedAt))]}}),null),Z(i,W(K,{get when(){return de()},get children(){return W(nt,{title:`restart dashboard service?`,onDismiss:()=>fe(!1),get actions(){return[(()=>{var e=hp();return e.$$click=()=>fe(!1),e})(),(()=>{var e=gp();return e.$$click=()=>{fe(!1),_e()},e})()]},get children(){var e=Wf();return e.firstChild.nextSibling.nextSibling,Z(e,()=>ue()?.supervised?` A supervisor is detected — the server should respawn automatically with the latest build.`:` No supervisor was detected — the dashboard will NOT come back on its own; you'll need to relaunch it manually.`,null),e}})}}),null),Z(i,W(K,{get when(){return s()},children:e=>{let t=()=>{let t=e();return t.kind==="default"?`select default model`:t.kind===`arbiter`?`select Dispatch Arbiter model`:`add model for ${t.agentName}`},n=()=>{let t=e();return t.kind==="default"?x()?.defaultProvider&&x()?.defaultModel?[`${x().defaultProvider}/${x().defaultModel}`]:[]:t.kind===`arbiter`?x()?.subagentArbiter?.model?[x().subagentArbiter.model]:[]:q(t.agentName)};return W(Op,{get title(){return t()},get models(){return w()??[]},get selected(){return n()},onClose:()=>c(void 0),onPick:t=>{let n=e();if(c(void 0),n.kind==="default"){ve({defaultProvider:t.provider,defaultModel:t.id});return}if(n.kind===`arbiter`){Se({model:bp(t)});return}let r=bp(t),i=q(n.agentName);i.includes(r)||Ce(n.agentName,[...i,r])}})}}),null),j(e=>{var t=y()===`denied`||y()===`unsupported`||y()===`ios-install`||y()===`insecure`,n=pe(),r=ee()||ie.loading;return t!==e.e&&(te.disabled=e.e=t),n!==e.t&&(H.disabled=e.t=n),r!==e.a&&(ye.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),j(()=>C.value=ts()),j(()=>M.checked=es()),j(()=>te.checked=y()===`granted`),j(()=>ge.value=ne()),i})()}ke([`input`,`click`]);var Ap=Y(`<div class="status-line arbitration-history">`),jp=Y(`<p class=pair-error>`),Mp=Y(`<div class=status-line><span class=working>● working`),Np=Y(`<output class=pending-chips aria-label="pending subagent steering messages">`),Pp=Y(`<div class=composer><textarea placeholder="Steer this subagent…"></textarea><div class=composer-row><span class=muted>steering delivery: </span><button type=button class="btn btn-primary btn-small send">`),Fp=Y(`<div class=session-screen><header class=session-bar><div class=session-bar-inner><a class=back>← </a><span class=agent-type>subagent · </span><span class=title></span><span class=right></span></div></header><main class=chat><div class=chat-inner></div></main><footer class=dock><div class=dock-inner>`),Ip=Y(`<span>arbiter: `),Lp=Y(`<p class=muted>`),Rp=Y(`<div class=readonly-note>This subagent is no longer running; its transcript is read-only.`),zp=Y(`<span class=pending-chip>steer: `);function Bp(e){let t=e.step===void 0?``:`step ${e.step}: `;return e.status===`failure`?`${t}failed — ${e.errorMessage??e.errorCode??`unknown error`}`:!e.final||e.changed.length===0?`${t}kept ${e.proposed.agent} · ${e.proposed.model} · ${e.proposed.thinking}`:`${t}${e.changed.join(`, `)} changed → ${e.final.agent} · ${e.final.model} · ${e.final.thinking}`}function Vp(e){let t=()=>e.store.sessions[e.sessionKey],n=N(()=>t()?.backgroundAgents[e.agentId]),r=()=>t()?.subagents[e.agentId],i=N(()=>e.store.fleet().runtimes.find(t=>t.key===e.sessionKey)),a=()=>i()?.state.sessionName??e.sessionKey,[o,s]=k(),[c,l]=k(``),[u,d]=k(!1),[f,p]=k(),[m,h]=k(),[g,_]=k({steering:[],followUp:[]}),v=()=>n()?.status===`running`,y=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,b,x,S,C=Mo({scroller:()=>b});R(()=>{let t=new AbortController;e.store.hydrateSubagent(e.sessionKey,e.agentId,t.signal).catch(e=>{t.signal.aborted&&sl(e)||s(e instanceof Error?e.message:String(e))}),z(()=>t.abort())}),M(()=>{e.store.revisions[e.sessionKey],C.notifyContentChanged()}),R(()=>{C.observeContent(S),C.observeViewport(b),b&&z(Po(C,b,{keyboard:`window`}))}),z(()=>C.dispose());async function w(){if(v())try{let t=await $.subagentPending(e.sessionKey,e.agentId);h(t.steeringMode),_(t.pending),p(void 0)}catch(e){p(e instanceof Error?e.message:String(e))}}R(()=>{w();let e=window.setInterval(()=>{v()&&w()},1e3);z(()=>window.clearInterval(e))}),M(()=>{c(),x&&queueMicrotask(()=>x&&_d(x))});async function T(){let t=c();if(!(!t.trim()||u()||!v())){d(!0),p(void 0);try{await $.steerSubagent(e.sessionKey,e.agentId,t),l(``),await w()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(()=>{var t=Fp(),i=t.firstChild,s=i.firstChild.firstChild;s.firstChild;var d=s.nextSibling;d.firstChild;var p=d.nextSibling,h=p.nextSibling,_=i.nextSibling,C=_.firstChild,w=_.nextSibling.firstChild;Z(s,a,null),Z(d,()=>n()?.agentType??`unknown`,null),Z(p,()=>n()?.taskSummary??e.agentId),Z(h,W(K,{get when(){return n()?.status===`running`},get fallback(){return W(Qe,{get status(){return n()?.status===`failed`?`error`:`idle`},get label(){return n()?.status}})},get children(){return W(Qe,{status:`running`})}}));var E=b;typeof E==`function`?Pe(E,_):b=_;var D=S;return typeof D==`function`?Pe(D,C):S=C,Z(C,W(K,{get when(){return(n()?.arbitrations?.length??0)>0},get children(){var e=Ap();return Z(e,W(G,{get each(){return n()?.arbitrations??[]},children:e=>(()=>{var t=Ip();return t.firstChild,Z(t,()=>Bp(e),null),j(()=>Ae(t,e.status===`failure`?`error-reason`:`muted`)),t})()})),e}}),null),Z(C,W(K,{get when(){return o()},get children(){var e=jp();return Z(e,o),e}}),null),Z(C,W(K,{get when(){return J(()=>!!r())()&&r().entries.length>0},get fallback(){return(()=>{var e=Lp();return Z(e,()=>n()?`waiting for output from this agent…`:`no data for this agent — it may not have started writing its session log yet.`),e})()},get children(){return W(xc,{get entries(){return r().entries},get who(){return n()?.agentType??`agent`},userLabel:`task from parent`,get resetKey(){return`${e.sessionKey}:${e.agentId}`},get imageScope(){return{runtimeKey:e.sessionKey,agentId:e.agentId}}})}}),null),Z(w,W(K,{get when(){return r()?.streaming},get children(){return Mp()}}),null),Z(w,W(K,{get when(){return v()},get fallback(){return Rp()},get children(){return[W(K,{get when(){return f()},get children(){var e=jp();return Z(e,f),e}}),W(K,{get when(){return g().steering.length>0},get children(){var e=Np();return Z(e,W(G,{get each(){return g().steering},children:e=>(()=>{var t=zp();return t.firstChild,Z(t,e,null),t})()})),e}}),(()=>{var e=Pp(),t=e.firstChild,n=t.nextSibling.firstChild;n.firstChild;var r=n.nextSibling;t.$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!y()&&(e.preventDefault(),T())},t.$$input=e=>{l(e.currentTarget.value),_d(e.currentTarget)};var i=x;return typeof i==`function`?Pe(i,t):x=t,Z(n,()=>m()??`loading…`,null),r.$$click=()=>void T(),Z(r,()=>u()?`sending…`:`steer ↵`),j(e=>{var n=u(),i=u()||c().trim().length===0;return n!==e.e&&(t.disabled=e.e=n),i!==e.t&&(r.disabled=e.t=i),e},{e:void 0,t:void 0}),j(()=>t.value=c()),e})()]}}),null),j(()=>X(s,`href`,`#/session/${e.sessionKey}`)),t})()}ke([`input`,`keydown`,`click`]);var Hp=Symbol(`store-raw`),Up=Symbol(`store-node`),Wp=Symbol(`store-has`),Gp=Symbol(`store-self`);function Kp(e){let t=e[p];if(!t&&(Object.defineProperty(e,p,{value:t=new Proxy(e,em)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function qp(e){let t;return typeof e==`object`&&!!e&&(e[p]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Jp(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Hp])return n;if(!qp(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Jp(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Jp(i,t))!==i&&(e[a]=r))}return e}function Yp(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Xp(e,t,n){if(e[t])return e[t];let[r,i]=k(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Zp(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===p||t===Up?n:(delete n.value,delete n.writable,n.get=()=>e[p][t],n)}function Qp(e){ee()&&Xp(Yp(e,Up),Gp)()}function $p(e){return Qp(e),Reflect.ownKeys(e)}var em={get(e,t,n){if(t===Hp)return e;if(t===p)return n;if(t===m)return Qp(e),n;let r=Yp(e,Up),i=r[t],a=i?i():e[t];if(t===Up||t===Wp||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);ee()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Xp(r,t,a)())}return qp(a)?Kp(a):a},has(e,t){return t===Hp||t===p||t===m||t===Up||t===Wp||t===`__proto__`?!0:(ee()&&Xp(Yp(e,Wp),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:$p,getOwnPropertyDescriptor:Zp};function tm(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[Wp]&&e[Wp][t]&&i!==void 0&&e[Wp][t].$()):(e[t]=n,e[Wp]&&e[Wp][t]&&i===void 0&&e[Wp][t].$());let o=Yp(e,Up),s;if((s=Xp(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Xp(o,`length`,a))&&s.$(e.length)}(s=o[Gp])&&s.$()}function nm(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];rm(i)||tm(e,i,t[i])}}function rm(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function im(e,t){if(typeof t==`function`&&(t=t(e)),t=Jp(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&tm(e,n,r)}tm(e,`length`,r)}else nm(e,t)}function am(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&rm(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)am(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&am(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)am(e,[r].concat(t),n);return}else if(t.length>1){am(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Jp(a),r===void 0||qp(i)&&qp(a)&&!Array.isArray(a)?nm(i,a):tm(e,r,a))}function om(...[e,t]){let n=Jp(e||{}),r=Array.isArray(n),i=Kp(n);function a(...e){I(()=>{r&&e.length===1?im(n,e[0]):am(n,e)})}return[i,a]}var sm=new WeakMap,cm={get(e,t){if(t===Hp)return e;let n=e[t];if(t===p||t===m||t===Up||t===Wp||t===`__proto__`)return n;let r;return qp(n)?sm.get(n)||(sm.set(n,r=new Proxy(n,cm)),r):n},set(e,t,n){return tm(e,t,Jp(n)),!0},deleteProperty(e,t){return tm(e,t,void 0,!0),!0}};function lm(e){return t=>{if(qp(t)){let n;(n=sm.get(t))||sm.set(t,n=new Proxy(t,cm)),e(n)}return t}}function um(){let[e,t=``]=window.location.hash.replace(/^#\/?/,``).split(`?`,2),[n,...r]=e.split(`/`);if(n===`session`&&r[0])return r[1]===`subagent`&&r[2]?{screen:`subagent`,key:r[0],agentId:r[2]}:{screen:`session`,key:r[0]};if(n===`files`)return{screen:`files`,path:r.length?decodeURIComponent(r.join(`/`)):void 0};if(n===`memories`)return{screen:`memories`};if(n===`settings`){if(r[0]===`scoped-models`){let e=new URLSearchParams(t).get(`cwd`)||void 0;return{screen:`settings`,target:`scoped-models`,...e?{cwd:e}:{}}}return{screen:`settings`}}return n===`pairing`?{screen:`pairing`}:{screen:`fleet`}}function dm(e){switch(e.screen){case`fleet`:return`#/`;case`session`:return`#/session/${e.key}`;case`subagent`:return`#/session/${e.key}/subagent/${e.agentId}`;case`files`:return e.path?`#/files/${encodeURIComponent(e.path)}`:`#/files`;case`memories`:return`#/memories`;case`settings`:return e.target===`scoped-models`?`#/settings/scoped-models${e.cwd?`?cwd=${encodeURIComponent(e.cwd)}`:``}`:`#/settings`;case`pairing`:return`#/pairing`}}var fm=2e3,pm=3*1024*1024,mm=fm,hm=pm,gm=3e4,_m=1e4,vm=1e3,ym=3e4,bm=5e3,xm=5*6e4,Sm=2147e6,Cm=new TextEncoder;function wm(e,t,n){e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`);let r=n.retryAttempt??0;if(n.isRetrying&&r>0){let t=e.entries.findLast(e=>e.kind===`assistant`&&e.stopReason===`error`),n=t?.errorMessage?` — ${t.errorMessage}`:``;e.statusEntries.push({key:`retry`,text:`retrying (attempt ${r})${n}`,tone:`warning`})}on(e,t,n.isStreaming||n.isRetrying||n.isCompacting)}function Tm(){let[e,t]=om({}),[n,r]=om({}),[i,a]=k(um()),[o,s]=k({runtimes:[],diskSessions:[]}),[c,l]=k(),[u,d]=k(),[f,p]=k(),[m,h]=k(!1),[g,_]=k(),[v,y]=k({state:`disconnected`,attempt:0}),b=()=>v().state===`connected`,[x,S]=k([]),C=new Map,w=new Map,T=new Map,E=0,D=0,O,A,j,M,N=!1,P=0,F=!1,I,L=0,R=new Map,z=new Map,ee=new Map,te=0,ne=0,re,ie,ae,B=0,oe=new Set,V=!1;window.addEventListener(`hashchange`,()=>a(um()));function se(e){window.location.hash=dm(e)}function H(e){return n[e]??0}function ce(e){return C.get(e)??0}function le(e){return w.get(e)??0}function U(e){w.set(e,le(e)+1)}function ue(e){C.set(e,ce(e)+1)}function de(e){return{revision:H(e),generation:ce(e),epoch:E}}function fe(e,t){return ce(e)===t.generation&&E===t.epoch}function pe(e,t){return H(e)===t.revision&&fe(e,t)}function me(e,t){t&&T.get(e)!==t||(T.delete(e),t&&(t.queued=[],t.queuedBytes=0))}function he(e){r(e,H(e)+1)}function ge(n){e[n]||t(n,Bt(n))}function _e(e,n){ge(e),t(e,lm(n)),he(e)}function ve(e){me(e),ue(e),w.delete(e),t(e,void 0),r(e,void 0),ml(e)}function ye(){let e=um();return e.screen===`session`||e.screen===`subagent`?e.key:void 0}function be(e,t=`info`){--D,S(n=>[...n,{id:D,text:e,tone:t}].slice(-20))}function xe(){ie!==void 0&&clearTimeout(ie),ie=void 0,ae=void 0,B=0}function Se(e){if(V||ae!==e)return;let t=e-Date.now();if(t<=0){ie=void 0,K(e);return}ie=setTimeout(()=>Se(e),Math.min(t,Sm))}function Ce(e){if(xe(),!e)return;let t=Date.parse(e);if(!Number.isFinite(t)){be(`Dashboard returned an invalid pairing-expiry check time`,`error`);return}ae=t,Se(t)}function W(e){if(V||ae!==e)return;B+=1;let t=Math.min(10,B-1),n=Math.min(xm,bm*2**t);ie=setTimeout(()=>{ie=void 0,!V&&ae===e&&K(e)},n)}function we(e){e.pairingExpiryWarning&&be(`This device pairing expires on ${e.pairingExpiryWarning.expiresAt.slice(0,10)}. Re-pair before then to avoid losing remote access.`,`warning`)}function G(e){_(e),we(e),Ce(e.pairingExpiryCheckAt)}async function K(e){try{let t=await $.auth();if(V)return;if(ae!==e){we(t);return}if((t.pairingExpiryCheckAt?Date.parse(t.pairingExpiryCheckAt):void 0)===e&&e<=Date.now()){_(t),we(t),W(e);return}G(t)}catch(t){if(V||ae!==e)return;if(t?.status===401||t?.status===403){xe(),_({mode:`remote`,needsPairing:t?.body?.needsPairing??!1,identity:t?.body?.identity,error:t?.message}),se({screen:`pairing`});return}B===0&&be(`Could not check pairing expiry: ${t instanceof Error?t.message:String(t)}`,`error`),W(e)}}function Te(e){return R.get(e)??0}function q(e,t,n){let r=new Map(e.map(e=>[e.key,JSON.stringify(e.state)])),i=new Map(t.map(e=>[e.key,JSON.stringify(e.state)]));for(let e of new Set([...r.keys(),...i.keys()])){if(r.get(e)===i.get(e))continue;let t=Te(e)+1;R.set(e,t),n===void 0?z.set(e,t):ee.set(e,Math.max(ee.get(e)??-1,n))}}function J(e,t){s(n=>{let r=e(n);return L+=1,q(n.runtimes,r.runtimes,t),r})}function Ee(e){oe.clear(),J(()=>e)}function De(e,t){let n=new Set(e.filter(e=>!oe.has(e.key)).map(e=>e.key)),r=n.size!==o().runtimes.length||o().runtimes.some(e=>!n.has(e.key));J(t=>{let n=new Map(t.runtimes.map(e=>[e.key,e]));return{...t,runtimes:e.filter(e=>!oe.has(e.key)).map(e=>{let t=n.get(e.key);return{...e,state:{...e.state,contextUsage:t?.state.contextUsage??e.state.contextUsage},...t?.stats===void 0?{}:{stats:t.stats},...t?.lastAssistantText===void 0?{}:{lastAssistantText:t.lastAssistantText}}})}},t),r&&ke().catch(()=>{})}function Oe(e){let t=oe.has(e);return oe.add(e),t?(ve(e),Promise.resolve()):(J(t=>({...t,runtimes:t.runtimes.filter(t=>t.key!==e)})),ve(e),ke())}function Y(){let e=++te,t=L;return $.fleet().then(n=>{e!==te||t!==L||(Ee(n),l(void 0))},n=>{throw e===te&&t===L&&l(n instanceof Error?n.message:String(n)),n})}function ke(){let e=++ne;return $.sessions().then(t=>{e===ne&&(J(e=>({...e,diskSessions:t.sessions})),l(void 0))},t=>{throw e===ne&&l(t instanceof Error?t.message:String(t)),t})}function X(e){oe.delete(e.key),J(t=>{let n=t.runtimes.findIndex(t=>t.key===e.key);if(n===-1)return{...t,runtimes:[...t.runtimes,e]};let r=[...t.runtimes];return r[n]=e,{...t,runtimes:r}})}function Ae(e,t,n,r){if(o().runtimes.some(t=>t.key===e)){if(n!==void 0&&Te(e)!==n){let t=z.get(e)??0,i=ee.get(e);if(t>n||i===void 0||i>r)return}J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:t}:n)}))}}function je(e,t){J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,model:t}}:n)}))}function Me(e,t){J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,thinkingLevel:t}}:n)}))}function Ne(e,t,n){return{...e,state:{...e.state,...t.contextUsage===void 0?{}:{contextUsage:t.contextUsage},messageCount:n?e.state.messageCount:t.totalMessages},stats:{tokensTotal:t.tokens.total,cost:t.cost}}}function Pe(e){let t=new AbortController,n,r=new Promise((r,i)=>{n=setTimeout(()=>{let n=Error(`Stats request for runtime ${e} timed out after ${_m} ms`);i(n),t.abort(n)},_m)});return Promise.race([$.stats(e,t.signal),r]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Z(){if(re)return re;let e=o().runtimes.map(e=>e.key),t=new Map(e.map(e=>[e,Te(e)])),n=e.map(e=>Pe(e)),r=Promise.allSettled(n).then(n=>{let r=new Map,i=[];for(let[t,a]of n.entries())a.status===`fulfilled`?r.set(e[t],a.value):i.push(a.reason instanceof Error?a.reason.message:String(a.reason));r.size>0&&J(e=>({...e,runtimes:e.runtimes.map(e=>{let n=r.get(e.key),i=t.get(e.key),a=i===void 0||Te(e.key)!==i;return n?Ne(e,n,a):e})})),d(i.length>0?i.join(`; `):void 0)}).finally(()=>{re===r&&(re=void 0)});return re=r,r}function Fe(e){return Cm.encode(JSON.stringify(e)).byteLength}function Ie(e){e.queued=[],e.queuedBytes=0}function Le(){j!==void 0&&clearTimeout(j),j=void 0}function Re(){return Math.min(ym,vm*2**Math.max(0,P-1))}function ze(){if(V||j!==void 0)return;P+=1;let e=Re();h(!1),M||=v(),y(t=>t.state===`auth_failed`?t:(N=!0,{...t,state:`retrying`,attempt:Math.max(t.attempt,P),retryDelayMs:e,retryAt:Date.now()+e})),j=setTimeout(()=>{j=void 0,We()},e)}function Be(){let e=M,t=N;M=void 0,N=!1,!(!t||e?.state!==`connected`||v().state!==`retrying`)&&y({state:`connected`,attempt:e.attempt,lastAppliedSeq:e.lastAppliedSeq})}function Ve(e){let t=e.event?.type;if(t===`fleet_snapshot`)De(e.event.runtimes,e.seq);else if(t===`disk_sessions_changed`)ke().catch(()=>{});else if(t===`runtime_removed`){if(e.key){let t=ye()===e.key;Oe(e.key).catch(()=>{}),t&&(be(`session ${e.key} was stopped`,`warning`),se({screen:`fleet`}))}}else e.key&&(_e(e.key,t=>dn(t,e.event)),t===`tasks_update`&&U(e.key))}function He(e){let t=e.subagent;_e(e.key,n=>{let r=e.messages;if(n.entries=Jt(r),n.tasks=(e.state.tasks??[]).map(e=>({...e})),n.streaming=e.state.isStreaming,n.compacting=e.state.isCompacting,n.sessionName=e.state.sessionName,n.model=e.state.model?.id,n.contextUsage=e.state.contextUsage,n.uiRequests=(e.pendingExtensionUiRequests??[]).map(e=>zt(e)).filter(e=>e!==void 0),n.statusEntries=[],n.suggestedCommand=void 0,n.lastError=void 0,n.widgets={above:[],below:[]},n.toasts=[],n.title=void 0,n.composerPrefill=void 0,wm(n,r,e.state),n.streaming?(n.workingSince=Date.now(),n.workingText=`working`):(n.workingSince=void 0,n.workingText=void 0),n.backgroundAgents=Object.fromEntries(e.backgroundAgents.map(e=>[e.agentId,e])),$t(n),t){let r=e.backgroundAgents.find(e=>e.agentId===t.agentId)??t.agent;n.backgroundAgents[t.agentId]=r,n.subagents[t.agentId]={agentId:t.agentId,entries:Jt(t.messages),streaming:r.status===`running`}}en(n)}),U(e.key)}function Ue(e,t){if(A!==e||e.state!==`active`||e.barrierSeq===void 0)return;Le(),P=0,Be();let n=e.barrierSeq;if(I=n,Ee(t.fleet),l(void 0),t.active)He(t.active);else{let e=ye();e&&(ve(e),be(`session ${e} was stopped`,`warning`),se({screen:`fleet`}))}let r=[...e.queued].sort((e,t)=>e.seq-t.seq),i=t.active?.subagent;if(i&&t.active)for(let e of r)e.seq>i.barrierSeq&&e.seq<=n&&e.key===t.active.key&&e.event.type===`background_agent_event`&&String(e.event.agentId)===i.agentId&&Ve(e);for(let e of r)e.seq>n&&Ve(e);Ie(e),A=void 0,h(!1),p(void 0)}function We(e=!1){if(V)return Promise.resolve();if(O)return(e||A?.state===`failed`)&&(F=!0),O;Le();let t=i(),n=t.screen===`session`||t.screen===`subagent`?t.key:void 0,r=t.screen===`subagent`?t.agentId:void 0,a={queued:[],queuedBytes:0,state:`active`,controller:new AbortController};A=a,E+=1;for(let[e,t]of T)me(e,t);h(!0),p(void 0);let o=setTimeout(()=>a.controller.abort(`Dashboard recovery timed out`),gm),s=$.resync(n,r,a.controller.signal).then(e=>{a.barrierSeq=e.barrierSeq,Ue(a,e)}).catch(e=>{if(A!==a)return;a.state=`failed`,Ie(a);let t=a.controller.signal.reason;p(typeof t==`string`?t:e instanceof Error?e.message:String(e)),ze(),j===void 0&&h(!1)}).finally(()=>{clearTimeout(o),O===s&&(O=void 0),!V&&F&&(F=!1,We())});return O=s,s}function Ge(){return We(!0)}function Ke(e){if(e.event?.type===`dashboard_resync`){We(!0);return}if(A){if(A.state===`failed`)throw ze(),Error(`Dashboard recovery is failed; refusing to acknowledge live envelope before resync succeeds`);let t=Fe(e);if(A.queued.length>=fm||A.queuedBytes+t>pm){Ie(A),A.state=`failed`;let e=`Dashboard recovery queue overflowed; waiting for a newer authoritative snapshot`;throw p(e),A.controller.abort(e),ze(),j===void 0&&h(!1),Error(e)}A.queued.push(e),A.queuedBytes+=t;return}if(I!==void 0&&e.seq<=I)return;let t=e.key?T.get(e.key):void 0;if(t){let n=Fe(e);if(t.queued.length>=mm||t.queuedBytes+n>hm)throw me(e.key,t),Error(`Dashboard hydration queue overflowed for ${e.key}; refusing an incomplete snapshot replay`);t.queued.push(e),t.queuedBytes+=n}Ve(e)}let qe;async function Je(){V=!1;try{G(await $.auth())}catch(e){_({mode:`remote`,needsPairing:e?.body?.needsPairing??!1,identity:e?.body?.identity,error:e?.message}),se({screen:`pairing`});return}await Y().catch(()=>{}),qe=_t({onEnvelope:Ke,onAuthStatus:G,onStatusChange:e=>{N=!1,M=e.state===`connected`?e:void 0,y(e)},onRecovery:()=>{We()}})}function Ye(){V=!0,qe?.(),xe(),Le(),M=void 0,N=!1,F=!1;let e=A;A=void 0,e&&Ie(e),e?.controller.abort(`Dashboard stopped`);for(let[e,t]of T)me(e,t)}function Xe(t){if(x().some(e=>e.id===t)){S(e=>e.filter(e=>e.id!==t));return}for(let[n,r]of Object.entries(e))if(r.toasts.some(e=>e.id===t)){_e(n,e=>fn(e,t));return}}async function Ze(e,t){me(e);let n=Te(e),r={guard:de(e),queued:[],queuedBytes:0};T.set(e,r);let i=()=>me(e,r);t?.addEventListener(`abort`,i,{once:!0}),t?.aborted&&i();try{let i=await $.hydrate(e,t);if(t?.aborted||T.get(e)!==r||!fe(e,r.guard))return;_e(e,e=>{let t=i.messages;e.entries=Jt(t),e.backgroundAgents=Object.fromEntries(i.backgroundAgents.map(e=>[e.agentId,e])),$t(e),e.streaming=i.state.isStreaming,e.compacting=i.state.isCompacting,e.tasks=(i.state.tasks??[]).map(e=>({...e})),i.state.isStreaming?(e.workingSince=Date.now(),e.workingText=`working`):(e.workingSince=void 0,e.workingText=void 0),e.uiRequests=(i.pendingExtensionUiRequests??[]).map(e=>zt(e)).filter(e=>e!==void 0),wm(e,t,i.state),en(e)}),U(e),Ae(e,i.state,n,i.barrierSeq);for(let e of[...r.queued].sort((e,t)=>e.seq-t.seq))e.seq>i.barrierSeq&&Ve(e)}finally{t?.removeEventListener(`abort`,i),me(e,r)}}async function Qe(e,t,n){let r=de(e),{agent:i,messages:a}=await $.subagentMessages(e,t,n);n?.aborted||!pe(e,r)||_e(e,e=>{e.backgroundAgents[t]=i;let n=e.subagents[t];n||(n={agentId:t,entries:[],streaming:i.status===`running`},e.subagents[t]=n),a.length>0&&(n.entries=Jt(a)),n.streaming=i.status===`running`})}return{sessions:e,revisions:n,route:i,navigate:se,fleet:o,fleetError:c,fleetStatsError:u,refreshFleet:Y,refreshDiskSessions:ke,refreshFleetStats:Z,removeRuntime:Oe,upsertRuntime:X,setRuntimeModel:je,setRuntimeThinkingLevel:Me,resyncing:m,resyncError:f,retryResync:Ge,auth:g,connected:b,connection:v,notices:x,start:Je,stop:Ye,dismissToast:Xe,resolveUiRequest(e,t){_e(e,e=>pn(e,t))},hydrateSession:Ze,hydrateSubagent:Qe}}var Em=5e3;function Dm(e){let t;return Promise.race([e,new Promise((e,n)=>{t=setTimeout(()=>n(Error(`service worker not ready`)),Em)})]).finally(()=>{t&&clearTimeout(t)})}function Om(){let e=Tm();R(()=>{e.start(),`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,t=>{if(t.data?.type===`navigate-session`&&typeof t.data.sessionKey==`string`){let n=t.data.sessionKey,r=!!e.sessions[n]||e.fleet().runtimes.some(e=>e.key===n);e.navigate(r?{screen:`session`,key:n}:{screen:`fleet`})}}),navigator.serviceWorker.register(`./sw.js`).catch(e=>{console.warn(`dashboard: service worker registration failed`,e)}))}),z(()=>e.stop());let t=new Set,n=new Set,r=t=>!!(e.fleet().runtimes.find(e=>e.key===t)?.needsAttention||e.sessions[t]?.needsAttention);M(()=>{let i=new Map;for(let t of e.fleet().runtimes)t.needsAttention&&i.set(t.key,{name:t.state.sessionName??t.state.sessionId.slice(0,8),reason:`needs attention`});for(let t of Object.values(e.sessions))t.needsAttention&&i.set(t.key,{name:t.sessionName??t.title??t.key,reason:tn(t.uiRequests)??t.statusEntries.find(e=>e.tone===`error`)?.text??`needs attention`});let a=i.size>0,o=e.route(),s=o.screen===`session`||o.screen===`subagent`?o.key:void 0,c=s?e.sessions[s]:void 0,l=s?e.fleet().runtimes.find(e=>e.key===s):void 0,u=c?.title??c?.sessionName??l?.state.sessionName,d=u?`${u} — dreb`:`dreb`;document.title=a?`◆ ${d}`:d;for(let[e,a]of i)n.has(e)||t.has(e)||typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`&&`serviceWorker`in navigator&&(t.add(e),Dm(navigator.serviceWorker.ready).then(t=>t.showNotification(`dreb — ${a.name}`,{body:a.reason,tag:e,data:{sessionKey:e}})).then(()=>{t.delete(e),r(e)?n.add(e):n.delete(e)}).catch(n=>{t.delete(e),console.warn(`dashboard: showNotification failed`,n)}));for(let e of[...n])i.has(e)||n.delete(e);for(let e of[...t])i.has(e)||t.delete(e)});let i=()=>[...Object.values(e.sessions).flatMap(e=>e.toasts.map(t=>({...t,sessionKey:e.key}))),...e.notices()].slice(-5);return[W(Te,{get fallback(){return W(Zn,{store:e})},get children(){return[W(q,{get when(){return e.route().screen===`session`},get children(){return W(Dd,{store:e,get sessionKey(){return e.route().key}})}}),W(q,{get when(){return e.route().screen===`subagent`},get children(){return W(Vp,{store:e,get sessionKey(){return e.route().key},get agentId(){return e.route().agentId}})}}),W(q,{get when(){return e.route().screen===`files`},get children(){return W(Lt,{store:e,get initialPath(){return e.route().path}})}}),W(q,{get when(){return e.route().screen===`memories`},get children(){return W(Zc,{store:e})}}),W(q,{get when(){return e.route().screen===`settings`},get children(){return W(kp,{store:e,get target(){return e.route().target},get routeScopedModelsCwd(){return e.route().cwd}})}}),W(q,{get when(){return e.route().screen===`pairing`},get children(){return W(rl,{store:e})}})]}}),W(rt,{get toasts(){return i()},onDismiss:t=>e.dismissToast(t)})]}wf();var km=document.getElementById(`root`);if(!km)throw Error(`dashboard: #root element missing from index.html`);Oe(()=>W(Om,{}),km);
79
+ <span class=hljs-function>render</span><span class=hljs-punctuation>(</span><span class=hljs-string>"ok"</span><span class=hljs-punctuation>)</span><span class=hljs-punctuation>;</span></code></pre></div><span class=theme-card-footer><span class=theme-card-title></span><span class=theme-card-state>`),Of=[`running`,`attention`,`idle`,`error`];function kf(){let e=()=>{let e=ff();return e===`system`?void 0:e};return(()=>{var t=Tf(),n=t.firstChild,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling;return r.addEventListener(`change`,e=>_f(e.currentTarget.value)),Z(r,W(G,{each:Xd,children:e=>(()=>{var t=Ef();return t.value=e,Z(t,e),t})()})),Z(i,W(G,{each:Jd,children:t=>{let n=()=>df()===t.id;return(()=>{var r=Df(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling.firstChild,l=c.nextSibling;return r.$$click=()=>gf(t.id),Z(o,()=>t.label),Z(s,W(G,{each:Of,children:e=>W(Qe,{status:e,label:``})})),Z(c,()=>t.label),Z(l,()=>n()?`✓ active`:`select`),j(i=>{var a=!!n(),o=t.id,s=t.id,c=e(),l=n(),u=n()?`true`:void 0,d=`use the ${t.label} theme`;return a!==i.e&&r.classList.toggle(`active`,i.e=a),o!==i.t&&X(r,`data-theme-card`,i.t=o),s!==i.a&&X(r,`data-theme`,i.a=s),c!==i.o&&X(r,`data-color-mode`,i.o=c),l!==i.i&&X(r,`aria-pressed`,i.i=l),u!==i.n&&X(r,`aria-current`,i.n=u),d!==i.s&&X(r,`title`,i.s=d),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r})()}})),j(()=>r.value=ff()),t})()}ke([`click`]);var Af=Y(`<select><option value=on>on</option><option value=off>off`),jf=Y(`<div class=field style=margin-bottom:8px><input type=text placeholder="search models…">`),Mf=Y(`<div class=model-list style=max-height:320px>`),Nf=Y(`<p class="muted small">No matching models.`),Pf=Y(`<section class=model-provider-group><div class=model-provider-heading>`),Ff=Y(`<span class=model-name>`),If=Y(`<span class=model-reasoning>think`),Lf=Y(`<button type=button class=model-row><span class=model-current></span><span class=model-id></span><span class=model-provider-badge>`),Rf=Y(`<div class=settings-error>`),zf=Y(`<div class=settings-warning>`),Bf=Y(`<p class="muted small"style=margin-bottom:16px>✓ saved`),Vf=Y(`<div class=settings-success>new pairing lifetime saved`),Hf=Y(`<div class=setting-row><span class=setting-label><span class=name>pairing code</span><span class=hint>new devices enter this in the pairing screen; it rotates every 30s</span></span><span class=setting-control><code style=font-size:var(--fs-h2);letter-spacing:0.08em>`),Uf=Y(`<p class="muted small"style=padding-top:8px>No remote devices paired. Launch with <code>--remote --allow &lt;identity&gt;</code> to enable Tailscale access.`),Wf=Y(`<p>This exits the dashboard server process and terminates <strong>all running sessions</strong>.`),Gf=Y(`<div class=screen-fill><main class="container settings-wrap"><h1>settings</h1><p class=settings-intro>Ordinary defaults apply only to new sessions. Dispatch Arbiter changes apply to subsequent child spawns. Context trust changes apply to subsequent lazy loads in live sessions; already injected content cannot be retracted. Writes go to the global settings file on the host.</p><section class=settings-section><h2>dashboard</h2><div class=appearance-block><div class="setting-row appearance-heading-row"><span class=setting-label><span class=name>appearance</span><span class=hint>this browser only — theme and light/dark mode are stored in localStorage and are independent of the TUI theme. Okabe-Ito and Paul Tol are colorblind-safe palettes.</span></span></div></div><div class=setting-row><label class=setting-label for=pref-image-display-mode><span class=name>tool-result images</span><span class=hint>this browser only — placeholders make no automatic request, previews are bounded to 1024 px and 256 KiB, and originals automatically transfer full files. Choosing originals is the informed network-data opt-in.</span></label><span class=setting-control><select id=pref-image-display-mode><option value=placeholders>placeholders</option><option value=previews>bounded previews</option><option value=originals>automatic originals</option></select></span></div><div class=setting-row><span class=setting-label><span class=name>always expand thinking</span><span class=hint>this browser only — stored in localStorage, not the host settings file</span></span><span class=setting-control><label class=checkbox-control><input id=pref-expand-thinking type=checkbox><span>open by default</span></label></span></div><div class=setting-row><span class=setting-label><span class=name>auto-expand tool cards</span><span class=hint>this browser only — stored in localStorage, not the host settings file</span></span><span class=setting-control style=display:grid;gap:6px></span></div><div class=setting-row><span class=setting-label><span class=name>needs-attention notifications</span><span class=hint></span></span><span class=setting-control><label class=checkbox-control><input id=pref-notifications type=checkbox><span></span></label></span></div><div class=setting-row><span class=setting-label><span class=name>restart dashboard service</span><span class=hint></span></span><span class=setting-control><button type=button class="btn btn-small btn-danger"></button></span></div></section><section class=settings-section><h2>devices</h2><div class=device-row><span>this machine <span class=this-device></span></span><span class=meta>local · always allowed</span></div><div class=setting-row><label class=setting-label for=pairing-ttl-days><span class=name>new pairing lifetime</span><span class=hint>applies only to devices paired after saving; existing expiry dates do not change</span></label><span class=setting-control><input id=pairing-ttl-days type=number min=1 max=3650 step=1><span>days</span><button type=button class="btn btn-small"></button></span></div></section><footer>dreb<!> · dashboard`),Kf=Y(`<div>`),qf=Y(`<p class=muted>`),Jf=Y(`<section class=settings-section><h2>model</h2><div class=setting-row><span class=setting-label><span class=name>default model</span><span class=hint>used by new sessions; validated against configured providers</span></span><span class=setting-control><button type=button class="btn btn-small model-picker-button"></button></span></div><div class=setting-row><span class=setting-label><span class=name>default thinking level</span><span class=hint></span></span><span class=setting-control><select></select></span></div><div class=setting-row><span class=setting-label><span class=name>transport</span><span class=hint>preferred model transport for new sessions</span></span><span class=setting-control><select>`),Yf=Y(`<section class="settings-section dispatch-arbiter-settings"><h2>dispatch arbiter</h2><p class="muted small"style=margin-bottom:8px>Global-only, fully headless pre-spawn routing. Project settings cannot change it. When enabled, invalid model, scope, guide, inference, or output prevents the affected child from spawning.</p><div class=setting-row><span class=setting-label><span class=name>enabled</span><span class=hint>disabled by default; fail closed when enabled</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>arbiter model</span><span class=hint>exact authenticated provider/model; no fallback</span></span><span class=setting-control><button type=button class="btn btn-small model-picker-button"></button></span></div><div class=setting-row><span class=setting-label><span class=name>arbiter thinking</span><span class=hint>validated against the selected arbiter model</span></span><span class=setting-control><select></select></span></div><div class=setting-row><label class=setting-label for=dispatch-arbiter-guide-path><span class=name>routing guide path</span><span class=hint>blank uses ~/.dreb/agent/model-routing-guide.md</span></label><span class=setting-control><input id=dispatch-arbiter-guide-path type=text placeholder=~/.dreb/agent/model-routing-guide.md></span></div><div data-testid=dispatch-arbiter-readiness><strong>status:</strong> `),Xf=Y(`<div class="setting-row agent-context-row"><span class=setting-label><span class=name>agent definition context</span><span class=hint>choose a project to include its .dreb/agents definitions</span></span><span class=setting-control><select><option value>global/home only`),Zf=Y(`<section class=settings-section><h2>agent models</h2><p class="muted small"style=margin-bottom:8px>Per-agent fallback lists. First available model wins; empty lists revert to the default model. Agent definitions are loaded from an explicit project context so project-local agents do not depend on which runtime opened first.`),Qf=Y(`<section class=settings-section><h2>images</h2><div class=setting-row><span class=setting-label><span class=name>auto-resize images</span><span class=hint>resize image inputs before sending them to providers</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>block images</span><span class=hint>prevent image inputs from being sent to providers</span></span><span class=setting-control>`),$f=Y(`<section class=settings-section><h2>queueing</h2><div class=setting-row><span class=setting-label><span class=name>steering delivery</span><span class=hint>deliver queued steers all at once, or one per turn</span></span><span class=setting-control><select></select></span></div><div class=setting-row><span class=setting-label><span class=name>follow-up delivery</span><span class=hint>deliver queued follow-ups all at once, or one per turn</span></span><span class=setting-control><select>`),ep=Y(`<section class=settings-section><h2>behavior</h2><div class=setting-row><span class=setting-label><span class=name>skill slash commands</span><span class=hint>register skills as slash commands in new sessions</span></span><span class=setting-control></span></div><div class=setting-row><label class=setting-label for=max-concurrent-subagents><span class=name>max concurrent subagents</span><span class=hint>new parent sessions only; 0 removes the subagent tool (default 4)</span></label><span class=setting-control><input id=max-concurrent-subagents type=number min=0 step=1></span></div><div class=context-trust-subsection><h3>trusted context folders</h3><p class="muted small">Specific global roots that may lazy-load nested AGENTS.md/CLAUDE.md and all descendants.</p><div class="settings-warning context-trust-global-warning"><strong>Global-only policy.</strong> Project <code>.dreb/settings.json</code> cannot enable, disable, or extend nested-context trust. Only these global settings and the Files view can; a cloned repository cannot grant itself trust.</div><form class=trusted-context-folder-add><label for=trusted-context-folder-path>add folder by path</label><input id=trusted-context-folder-path type=text placeholder=/path/to/project><button type=submit class="btn btn-small"></button></form></div><div class=setting-row><span class=setting-label><span class=name>global expert nested-context trust</span><span class=hint>allow nested AGENTS.md/CLAUDE.md from any resolvable directory</span></span><span class=setting-control></span></div><div class="settings-warning context-expert-warning"><strong>Expert global override.</strong> Project <code>.dreb/settings.json</code> cannot enable, disable, or extend nested-context trust; a cloned repository cannot grant itself trust. When ON, nested instructions from any resolvable directory may load, including untrusted prompt-injection content. Leave this OFF and use trusted folders for projects you control.</div><div class=setting-row><span class=setting-label><span class=name>hide thinking blocks</span><span class=hint>hide raw thinking blocks in rendered transcripts</span></span><span class=setting-control>`),tp=Y(`<section class=settings-section><h2>reliability</h2><div class=setting-row><span class=setting-label><span class=name>auto-compaction</span><span class=hint>summarize old context when the window fills</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>auto-retry</span><span class=hint>retry transient stream errors (rate limits, 5xx)</span></span><span class=setting-control>`),np=Y(`<p class="muted small settings-footnote">TUI-only settings (cursor, editor) are managed in the terminal /settings menu. The dashboard appearance (theme + light/dark mode) is set here, per-browser, and is independent of the TUI theme.`),rp=Y(`<option>`),ip=Y(`<p class="muted small">No agent definitions found.`),ap=Y(`<div class=agent-model-editor><button type=button class="btn btn-small">add model…`),op=Y(`<div class=agent-model-row><div class=agent-model-summary><span class=agent-model-name></span><span class=agent-model-description></span></div><div class=agent-model-fallbacks></div><button type=button class="btn btn-small agent-model-edit">`),sp=Y(`<span class="muted small">default`),cp=Y(`<span class=agent-model-chip>. `),lp=Y(`<p class="muted small">Using the default model.`),up=Y(`<div class=agent-model-entry><span></span><div class=agent-model-entry-actions><button type=button class="btn btn-small">↑</button><button type=button class="btn btn-small">↓</button><button type=button class="btn btn-small">×`),dp=Y(`<p class="muted small trusted-context-empty">No trusted folders. Use the Files view to trust a project folder and its descendants.`),fp=Y(`<div class=trusted-context-folder-row><code></code><span class=meta>and all descendants</span><button type=button class="btn btn-small btn-danger">`),pp=Y(`<label class=checkbox-control><input type=checkbox><span>`),mp=Y(`<div class=device-row><span></span><span class=meta> · paired <!> · expires </span><span class=actions><button type=button class="btn btn-small btn-danger">unpair`),hp=Y(`<button type=button class="btn btn-small">cancel`),gp=Y(`<button type=button class="btn btn-small btn-danger">restart`),_p=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],vp=[`all`,`one-at-a-time`],yp=[`sse`,`websocket`,`auto`];function bp(e){return`${e.provider}/${e.id}`}function xp(e){let t=bp(e);return e.name?`${t} — ${e.name}`:t}function Sp(e){return e.defaultProvider&&e.defaultModel?`${e.defaultProvider}/${e.defaultModel}`:`choose model…`}function Cp(e,t){return`${e.provider}/${e.id} ${e.name??``}`.toLowerCase().includes(t)}function wp(){if(typeof Notification>`u`){if(window.isSecureContext===!1)return`insecure`;let e=/iPad|iPhone|iPod/.test(navigator.userAgent),t=navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches===!0;return e&&!t?`ios-install`:`unsupported`}return Notification.permission}function Tp(e){let t=new Map;for(let n of e){let e=t.get(n.provider)??[];e.push(n),t.set(n.provider,e)}return[...t.entries()].map(([e,t])=>({provider:e,models:t}))}function Ep(e,t,n){let r=t+n;if(r<0||r>=e.length)return e;let i=[...e];return[i[t],i[r]]=[i[r],i[t]],i}function Dp(e){return(()=>{var t=Af();return t.addEventListener(`change`,t=>{e.onChange(t.currentTarget.value===`on`)===!1&&(t.currentTarget.value=e.value?`on`:`off`)}),j(()=>t.value=e.value?`on`:`off`),t})()}function Op(e){let[t,n]=k(``),r=()=>new Set(e.selected??[]),i=N(()=>{let n=t().toLowerCase();return Tp(e.models.filter(e=>!n||Cp(e,n)).slice(0,100))}),a=e=>r().has(bp(e));return W(nt,{get title(){return e.title},get onDismiss(){return e.onClose},class:`model-picker-modal`,get children(){return[(()=>{var e=jf(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),(()=>{var t=Mf();return Z(t,W(K,{get when(){return i().length>0},get fallback(){return Nf()},get children(){return W(G,{get each(){return i()},children:t=>(()=>{var n=Pf(),r=n.firstChild;return Z(r,()=>t.provider),Z(n,W(G,{get each(){return t.models},children:t=>(()=>{var n=Lf(),r=n.firstChild,i=r.nextSibling,o=i.nextSibling;return n.$$click=()=>e.onPick(t),Z(r,()=>a(t)?`✓`:``),Z(i,()=>t.id),Z(n,W(K,{get when(){return t.name},get children(){var e=Ff();return Z(e,()=>t.name),e}}),o),Z(o,()=>t.provider),Z(n,W(K,{get when(){return t.reasoning},get children(){return If()}}),null),j(e=>{var r=!!a(t),i=xp(t);return r!==e.e&&n.classList.toggle(`current`,e.e=r),i!==e.t&&X(n,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()}),null),n})()})}})),t})()]}})}function kp(e){let[t,n]=k(),[r,i]=k([]),[a,o]=k(!1),[s,c]=k(),[l,u]=k(),[d,f]=k(),[p,m]=k(e.target===`scoped-models`?e.routeScopedModelsCwd:void 0);M(()=>{m(e.target===`scoped-models`?e.routeScopedModelsCwd:void 0)});let[h,g]=k(``),[_,v]=k(!1),[y,b]=k(wp()),[x,{mutate:S,refetch:C}]=F(async()=>{n(void 0);try{return await $.settings()}catch(e){n(e instanceof Error?e.message:String(e));return}}),[w]=F(x,async()=>{try{let{models:e}=await $.settingsModels();return e}catch(e){return n(e instanceof Error?e.message:String(e)),[]}}),T=N(()=>{let t=new Set;for(let n of e.store.fleet().runtimes)t.add(n.cwd);for(let n of e.store.fleet().diskSessions)t.add(n.cwd);return[...t].sort((e,t)=>e.localeCompare(t))}),[E]=F(()=>({settings:x(),cwd:d()}),async({cwd:e})=>{if(!x())return[];try{let{agentTypes:t}=await $.agentTypes(e);return t}catch(e){return n(e instanceof Error?e.message:String(e)),[]}}),[D,{refetch:O}]=F(async()=>{let{devices:e}=await $.devices();return e}),[A,P]=k(),[I,L]=k(!1),[ee,te]=k(!1),[ne,re]=k(``),[ie,{mutate:ae}]=F(async()=>{try{return await $.pairingSettings()}catch(e){P(e instanceof Error?e.message:String(e));return}});M(()=>{let e=ie();e&&re(String(e.pairingTtlDays))});async function B(){P(void 0),L(!1);let e=Number(ne());if(!Number.isSafeInteger(e)||e<1||e>3650){P(`pairing lifetime must be a whole number from 1 through 3650 days`);return}te(!0);try{let t=await $.savePairingSettings(e);ae(t),L(!0)}catch(e){P(e instanceof Error?e.message:String(e))}finally{te(!1)}}let[oe,V]=k(),se;function H(){se&&clearTimeout(se),se=void 0}function ce(e){H();let t=Math.max(250,e??3e4)+100;se=setTimeout(()=>void le(),t)}async function le(){try{let e=await $.pairingCode();if(!e.enabled||!e.code){V(void 0),H();return}V(e),ce(e.expiresInMs)}catch(e){console.warn(`pairing code unavailable`,e),V(void 0),H()}}let[U]=F(async()=>{try{let{version:e}=await $.version();return e}catch{return}}),[ue]=F(async()=>{try{return await $.serverInfo()}catch{return}}),[de,fe]=k(!1),[pe,me]=k(!1),[he,ge]=k();async function _e(){ge(void 0),me(!0);try{await $.restartServer()}catch(e){ge(e instanceof Error?e.message:String(e)),me(!1)}}async function ve(e){n(void 0),i([]),o(!1);try{let t=await $.saveSettings(e);S(t),i(t.warnings??[]),o(!0),setTimeout(()=>o(!1),2e3)}catch(e){n(e instanceof Error?e.message:String(e)),await C()}}let ye=Promise.resolve(),be;function xe(){return be??x()?.subagentArbiter??{}}function Se(e){let t={...xe(),...e};be=t;let r=x();r&&S({...r,subagentArbiter:t}),ye=ye.then(async()=>{n(void 0),i([]),o(!1);try{let e=await $.saveSettings({subagentArbiter:t});i(e.warnings??[]),o(!0),setTimeout(()=>o(!1),2e3),be===t?(be=e.subagentArbiter??void 0,S(e)):S({...e,subagentArbiter:be})}catch(e){let r=e instanceof Error?e.message:String(e),i=await C();n(r),be===t?be=i?.subagentArbiter??void 0:i&&S({...i,subagentArbiter:be})}})}async function Ce(e,t){await ve({agentModels:{[e]:t}})}async function we(e){n(void 0),v(!0);try{let t=await $.trustContextFolder(e);S(t.settings),g(``)}catch(e){n(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function Te(e){n(void 0),v(!0);try{let t=await $.removeTrustedContextFolder(e);S(t.settings)}catch(e){n(e instanceof Error?e.message:String(e))}finally{v(!1)}}function q(e){return x()?.agentModels?.[e]??[]}function Ee(e){let t=e.subagentArbiter;return t?.enabled===!0?typeof t.model!=`string`||!t.model.trim()?{ready:!1,message:`not ready — choose an arbiter model`}:t.thinking!==void 0&&!_p.some(e=>e===t.thinking)?{ready:!1,message:`not ready — arbiter thinking setting is invalid`}:t.guidePath!==void 0&&typeof t.guidePath!=`string`?{ready:!1,message:`not ready — routing guide path is invalid`}:t.guidePath?.trim()?{ready:!0,message:`enabled — live scope and guide are validated before every child spawn`}:{ready:!0,message:`enabled — using ~/.dreb/agent/model-routing-guide.md; live scope/guide checked at dispatch`}:{ready:!1,message:`disabled`}}async function De(){typeof Notification>`u`||b(await Notification.requestPermission())}R(()=>void le()),z(H);let Oe=()=>e.store.auth();return(()=>{var i=Gf(),o=i.firstChild,v=o.firstChild.nextSibling.nextSibling,b=v.firstChild.nextSibling;b.firstChild;var S=b.nextSibling,C=S.firstChild.nextSibling.firstChild,k=S.nextSibling,M=k.firstChild.nextSibling.firstChild.firstChild,N=k.nextSibling,P=N.firstChild.nextSibling,F=N.nextSibling,R=F.firstChild,z=R.firstChild.nextSibling,te=R.nextSibling.firstChild.firstChild,ae=te.nextSibling,V=F.nextSibling.firstChild,se=V.firstChild.nextSibling,H=V.nextSibling.firstChild,ce=v.nextSibling,le=ce.firstChild.nextSibling,me=le.firstChild.firstChild.nextSibling,ge=le.nextSibling.firstChild.nextSibling.firstChild,ye=ge.nextSibling.nextSibling,be=ce.nextSibling,Y=be.firstChild.nextSibling;return Y.nextSibling,Z(i,W(et,{get store(){return e.store},active:`settings`}),o),Z(o,W(K,{get when(){return t()},get children(){var e=Rf();return Z(e,t),e}}),v),Z(o,W(K,{get when(){return r().length>0},get children(){var e=zf();return Z(e,W(G,{get each(){return r()},children:e=>(()=>{var t=Kf();return Z(t,e),t})()})),e}}),v),Z(o,W(K,{get when(){return a()},get children(){return Bf()}}),v),Z(o,W(K,{get when(){return x()},get fallback(){return(()=>{var e=qf();return Z(e,()=>t()?`Settings could not be loaded — see the error above.`:`Loading settings…`),e})()},children:t=>[(()=>{var e=Jf(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling,a=i.firstChild,o=a.firstChild.nextSibling,s=a.nextSibling.firstChild,l=i.nextSibling.firstChild.nextSibling.firstChild;return r.$$click=()=>c({kind:`default`}),Z(r,()=>Sp(t())),Z(o,()=>_p.join(` · `)),s.addEventListener(`change`,e=>ve({defaultThinkingLevel:e.currentTarget.value})),Z(s,W(G,{each:_p,children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),l.addEventListener(`change`,e=>ve({transport:e.currentTarget.value})),Z(l,W(G,{get each(){return[...yp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),j(()=>s.value=t().defaultThinkingLevel??`off`),j(()=>l.value=t().transport??`sse`),e})(),W(qd,{get cwd(){return p()},get projectRoots(){return T()},get focused(){return e.target===`scoped-models`},onCwdChange:t=>{m(t),e.store.navigate({screen:`settings`,target:`scoped-models`,...t?{cwd:t}:{}})}}),(()=>{var e=Yf(),r=e.firstChild.nextSibling.nextSibling,i=r.firstChild.nextSibling,a=r.nextSibling,o=a.firstChild.nextSibling.firstChild,s=a.nextSibling,l=s.firstChild.nextSibling.firstChild,u=s.nextSibling,d=u.firstChild.nextSibling.firstChild,f=u.nextSibling;return f.firstChild.nextSibling,Z(i,W(Dp,{get value(){return t().subagentArbiter?.enabled===!0},onChange:e=>{let t=xe();return e&&(typeof t.model!=`string`||!t.model.trim())?(n(`Choose an exact Dispatch Arbiter model before enabling it.`),c({kind:`arbiter`}),!1):(Se({enabled:e}),!0)}})),o.$$click=()=>c({kind:`arbiter`}),Z(o,(()=>{var e=J(()=>typeof t().subagentArbiter?.model==`string`);return()=>e()?t().subagentArbiter?.model:`choose model…`})()),l.addEventListener(`change`,e=>Se({thinking:e.currentTarget.value})),Z(l,W(G,{each:_p,children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),d.addEventListener(`change`,e=>{Se({guidePath:e.currentTarget.value.trim()||void 0})}),Z(f,()=>Ee(t()).message,null),j(()=>Ae(f,Ee(t()).ready?`settings-warning`:`muted small`)),j(()=>l.value=typeof t().subagentArbiter?.thinking==`string`&&_p.some(e=>e===t().subagentArbiter?.thinking)?t().subagentArbiter?.thinking:`off`),j(()=>d.value=typeof t().subagentArbiter?.guidePath==`string`?t().subagentArbiter?.guidePath:``),e})(),(()=>{var e=Zf();return e.firstChild.nextSibling,Z(e,W(K,{get when(){return T().length>0},get children(){var e=Xf(),t=e.firstChild.nextSibling.firstChild;return t.firstChild,t.addEventListener(`change`,e=>f(e.currentTarget.value||void 0)),Z(t,W(G,{get each(){return T()},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()}),null),j(()=>X(t,`title`,d()??`global/home only`)),j(()=>t.value=d()??``),e}}),null),Z(e,W(K,{get when(){return(E()??[]).length>0},get fallback(){return ip()},get children(){return W(G,{get each(){return E()??[]},children:e=>{let n=()=>t().agentModels?.[e.name]??[];return(()=>{var t=op(),r=t.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,s=o.nextSibling;return Z(i,()=>e.name),Z(a,()=>e.description),Z(o,W(K,{get when(){return n().length>0},get fallback(){return sp()},get children(){return W(G,{get each(){return n()},children:(e,t)=>(()=>{var n=cp(),r=n.firstChild;return Z(n,()=>t()+1,r),Z(n,e,null),n})()})}})),s.$$click=()=>u(l()===e.name?void 0:e.name),Z(s,()=>l()===e.name?`done`:`edit`),Z(t,W(K,{get when(){return l()===e.name},get children(){var t=ap(),r=t.firstChild;return Z(t,W(K,{get when(){return n().length>0},get fallback(){return lp()},get children(){return W(G,{get each(){return n()},children:(t,r)=>(()=>{var i=up(),a=i.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,c=s.nextSibling;return Z(a,t),o.$$click=()=>void Ce(e.name,Ep(n(),r(),-1)),s.$$click=()=>void Ce(e.name,Ep(n(),r(),1)),c.$$click=()=>void Ce(e.name,n().filter((e,t)=>t!==r())),j(e=>{var t=r()===0,i=r()===n().length-1;return t!==e.e&&(o.disabled=e.e=t),i!==e.t&&(s.disabled=e.t=i),e},{e:void 0,t:void 0}),i})()})}}),r),r.$$click=()=>c({kind:`agent`,agentName:e.name}),t}}),null),t})()}})}}),null),e})(),(()=>{var e=Qf(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Dp,{get value(){return t().imageAutoResize!==!1},onChange:e=>ve({imageAutoResize:e})})),Z(i,W(Dp,{get value(){return t().blockImages===!0},onChange:e=>ve({blockImages:e})})),e})(),(()=>{var e=$f(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling.firstChild.nextSibling.firstChild;return r.addEventListener(`change`,e=>ve({steeringMode:e.currentTarget.value})),Z(r,W(G,{get each(){return[...vp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),i.addEventListener(`change`,e=>ve({followUpMode:e.currentTarget.value})),Z(i,W(G,{get each(){return[...vp]},children:e=>(()=>{var t=rp();return t.value=e,Z(t,e),t})()})),j(()=>r.value=t().steeringMode??`all`),j(()=>i.value=t().followUpMode??`all`),e})(),(()=>{var e=ep(),r=e.firstChild.nextSibling,i=r.firstChild.nextSibling,a=r.nextSibling,o=a.firstChild.nextSibling.firstChild,s=a.nextSibling,c=s.firstChild.nextSibling.nextSibling.nextSibling,l=c.firstChild.nextSibling,u=l.nextSibling,d=s.nextSibling,f=d.firstChild.nextSibling,p=d.nextSibling.nextSibling.firstChild.nextSibling;return Z(i,W(Dp,{get value(){return t().enableSkillCommands!==!1},onChange:e=>ve({enableSkillCommands:e})})),o.addEventListener(`change`,e=>{let r=e.currentTarget.value.trim(),i=r.length>0?Number(r):NaN;if(!Number.isSafeInteger(i)||i<0){n(`Max concurrent subagents must be a non-negative whole number`),e.currentTarget.value=String(t().maxConcurrentSubagents??4);return}ve({maxConcurrentSubagents:i})}),Z(s,W(K,{get when(){return(t().trustedContextFolders??[]).length>0},get fallback(){return dp()},get children(){return W(G,{get each(){return t().trustedContextFolders??[]},children:e=>(()=>{var t=fp(),n=t.firstChild,r=n.nextSibling.nextSibling;return Z(n,e),r.$$click=()=>void Te(e),Z(r,()=>_()?`revoking…`:`revoke trust`),j(()=>r.disabled=_()),t})()})}}),c),c.addEventListener(`submit`,e=>{e.preventDefault();let t=h().trim();t&&we(t)}),l.$$input=e=>g(e.currentTarget.value),Z(u,()=>_()?`trusting…`:`trust folder`),Z(f,W(Dp,{get value(){return t().autoLoadNestedContext===!0},onChange:e=>ve({autoLoadNestedContext:e})})),Z(p,W(Dp,{get value(){return t().hideThinkingBlock===!0},onChange:e=>ve({hideThinkingBlock:e})})),j(()=>u.disabled=_()||!h().trim()),j(()=>o.value=t().maxConcurrentSubagents??4),j(()=>l.value=h()),e})(),(()=>{var e=tp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Dp,{get value(){return t().compactionEnabled!==!1},onChange:e=>ve({compactionEnabled:e})})),Z(i,W(Dp,{get value(){return t().retryEnabled!==!1},onChange:e=>ve({retryEnabled:e})})),e})(),np()]}),v),Z(b,W(kf,{}),null),C.addEventListener(`change`,e=>rs(e.currentTarget.value)),M.addEventListener(`change`,e=>ns(e.currentTarget.checked)),Z(P,W(G,{each:Ro,children:e=>(()=>{var t=pp(),n=t.firstChild,r=n.nextSibling;return n.addEventListener(`change`,t=>is(e,t.currentTarget.checked)),X(n,`id`,`pref-tool-expand-${e}`),Z(r,e),j(()=>n.checked=as(e)),t})()})),Z(z,(()=>{var e=J(()=>y()===`denied`);return()=>e()?`blocked by browser settings — re-enable notifications in site permissions`:J(()=>y()===`insecure`)()?`this page is not a secure context — notifications need HTTPS. Run the server with --https (tailscale cert <host>.<tailnet>.ts.net) and open it via the https:// hostname`:J(()=>y()===`ios-install`)()?`iOS notifications need the installed PWA — tap Share → Add to Home Screen, then open dreb from the home screen icon`:y()===`unsupported`?`browser notifications are unavailable in this environment`:`show a notification when the tab needs input (Android/desktop need the app installed on mobile; works over HTTPS or localhost)`})()),te.addEventListener(`change`,e=>{e.currentTarget.checked&&De()}),Z(ae,()=>y()===`granted`?`enabled`:`enable notifications`),Z(se,()=>ue()?.supervised?`restarts the server process (a supervisor respawns it with the latest build) — kills all running sessions`:`exits the server process — only auto-restarts if run under a supervisor (systemd, pm2, …); otherwise the dashboard goes down. kills all running sessions`),H.$$click=()=>fe(!0),Z(H,()=>pe()?`restarting…`:`restart`),Z(v,W(K,{get when(){return he()},get children(){var e=Rf();return Z(e,he),e}}),null),Z(me,()=>Oe()?.mode===`local`?`local`:`host`),ge.$$input=e=>{re(e.currentTarget.value),L(!1)},ye.$$click=()=>void B(),Z(ye,()=>ee()?`saving…`:`save`),Z(ce,W(K,{get when(){return I()},get children(){return Vf()}}),null),Z(ce,W(K,{get when(){return A()},get children(){var e=Rf();return Z(e,A),e}}),null),Z(ce,W(K,{get when(){return J(()=>!!oe()?.enabled)()&&oe()?.code},get children(){var e=Hf(),t=e.firstChild.nextSibling.firstChild;return Z(t,()=>oe().code),e}}),null),Z(ce,W(G,{get each(){return D()??[]},children:e=>(()=>{var t=mp(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.nextSibling;a.nextSibling;var o=r.nextSibling.firstChild;return Z(n,()=>e.device??e.id),Z(r,()=>e.identity,i),Z(r,()=>it(e.createdAt),a),Z(r,()=>e.expiresAt.slice(0,10),null),o.$$click=async()=>{await $.unpair(e.id),await O()},t})()}),null),Z(ce,W(K,{get when(){return(D()??[]).length===0},get children(){return Uf()}}),null),Z(be,(()=>{var e=J(()=>!!ue()?.version);return()=>e()?` v${ue().version}`:J(()=>!!U())()?` v${U()}`:``})(),Y),Z(be,W(K,{get when(){return ue()?.startedAt},get children(){return[` · server build, up `,J(()=>it(ue().startedAt))]}}),null),Z(i,W(K,{get when(){return de()},get children(){return W(nt,{title:`restart dashboard service?`,onDismiss:()=>fe(!1),get actions(){return[(()=>{var e=hp();return e.$$click=()=>fe(!1),e})(),(()=>{var e=gp();return e.$$click=()=>{fe(!1),_e()},e})()]},get children(){var e=Wf();return e.firstChild.nextSibling.nextSibling,Z(e,()=>ue()?.supervised?` A supervisor is detected — the server should respawn automatically with the latest build.`:` No supervisor was detected — the dashboard will NOT come back on its own; you'll need to relaunch it manually.`,null),e}})}}),null),Z(i,W(K,{get when(){return s()},children:e=>{let t=()=>{let t=e();return t.kind==="default"?`select default model`:t.kind===`arbiter`?`select Dispatch Arbiter model`:`add model for ${t.agentName}`},n=()=>{let t=e();return t.kind==="default"?x()?.defaultProvider&&x()?.defaultModel?[`${x().defaultProvider}/${x().defaultModel}`]:[]:t.kind===`arbiter`?x()?.subagentArbiter?.model?[x().subagentArbiter.model]:[]:q(t.agentName)};return W(Op,{get title(){return t()},get models(){return w()??[]},get selected(){return n()},onClose:()=>c(void 0),onPick:t=>{let n=e();if(c(void 0),n.kind==="default"){ve({defaultProvider:t.provider,defaultModel:t.id});return}if(n.kind===`arbiter`){Se({model:bp(t)});return}let r=bp(t),i=q(n.agentName);i.includes(r)||Ce(n.agentName,[...i,r])}})}}),null),j(e=>{var t=y()===`denied`||y()===`unsupported`||y()===`ios-install`||y()===`insecure`,n=pe(),r=ee()||ie.loading;return t!==e.e&&(te.disabled=e.e=t),n!==e.t&&(H.disabled=e.t=n),r!==e.a&&(ye.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),j(()=>C.value=ts()),j(()=>M.checked=es()),j(()=>te.checked=y()===`granted`),j(()=>ge.value=ne()),i})()}ke([`input`,`click`]);var Ap=Y(`<div class="status-line arbitration-history">`),jp=Y(`<p class=pair-error>`),Mp=Y(`<div class=status-line><span class=working>● working`),Np=Y(`<output class=pending-chips aria-label="pending subagent steering messages">`),Pp=Y(`<div class=composer><textarea placeholder="Steer this subagent…"></textarea><div class=composer-row><span class=muted>steering delivery: </span><button type=button class="btn btn-primary btn-small send">`),Fp=Y(`<div class=session-screen><header class=session-bar><div class=session-bar-inner><a class=back>← </a><span class=agent-type>subagent · </span><span class=title></span><span class=right></span></div></header><main class=chat><div class=chat-inner></div></main><footer class=dock><div class=dock-inner>`),Ip=Y(`<span>arbiter: `),Lp=Y(`<p class=muted>`),Rp=Y(`<div class=readonly-note>This subagent is no longer running; its transcript is read-only.`),zp=Y(`<span class=pending-chip>steer: `);function Bp(e){let t=e.step===void 0?``:`step ${e.step}: `;return e.status===`failure`?`${t}failed — ${e.errorMessage??e.errorCode??`unknown error`}`:!e.final||e.changed.length===0?`${t}kept ${e.proposed.agent} · ${e.proposed.model} · ${e.proposed.thinking}`:`${t}${e.changed.join(`, `)} changed → ${e.final.agent} · ${e.final.model} · ${e.final.thinking}`}function Vp(e){let t=()=>e.store.sessions[e.sessionKey],n=N(()=>t()?.backgroundAgents[e.agentId]),r=()=>t()?.subagents[e.agentId],i=N(()=>e.store.fleet().runtimes.find(t=>t.key===e.sessionKey)),a=()=>i()?.state.sessionName??e.sessionKey,[o,s]=k(),[c,l]=k(``),[u,d]=k(!1),[f,p]=k(),[m,h]=k(),[g,_]=k({steering:[],followUp:[]}),v=()=>n()?.status===`running`,y=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,b,x,S,C=Mo({scroller:()=>b});R(()=>{let t=new AbortController;e.store.hydrateSubagent(e.sessionKey,e.agentId,t.signal).catch(e=>{t.signal.aborted&&sl(e)||s(e instanceof Error?e.message:String(e))}),z(()=>t.abort())}),M(()=>{e.store.revisions[e.sessionKey],C.notifyContentChanged()}),R(()=>{C.observeContent(S),C.observeViewport(b),b&&z(Po(C,b,{keyboard:`window`}))}),z(()=>C.dispose());async function w(){if(v())try{let t=await $.subagentPending(e.sessionKey,e.agentId);h(t.steeringMode),_(t.pending),p(void 0)}catch(e){p(e instanceof Error?e.message:String(e))}}R(()=>{w();let e=window.setInterval(()=>{v()&&w()},1e3);z(()=>window.clearInterval(e))}),M(()=>{c(),x&&queueMicrotask(()=>x&&_d(x))});async function T(){let t=c();if(!(!t.trim()||u()||!v())){d(!0),p(void 0);try{await $.steerSubagent(e.sessionKey,e.agentId,t),l(``),await w()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(()=>{var t=Fp(),i=t.firstChild,s=i.firstChild.firstChild;s.firstChild;var d=s.nextSibling;d.firstChild;var p=d.nextSibling,h=p.nextSibling,_=i.nextSibling,C=_.firstChild,w=_.nextSibling.firstChild;Z(s,a,null),Z(d,()=>n()?.agentType??`unknown`,null),Z(p,()=>n()?.taskSummary??e.agentId),Z(h,W(K,{get when(){return n()?.status===`running`},get fallback(){return W(Qe,{get status(){return n()?.status===`failed`?`error`:`idle`},get label(){return n()?.status}})},get children(){return W(Qe,{status:`running`})}}));var E=b;typeof E==`function`?Pe(E,_):b=_;var D=S;return typeof D==`function`?Pe(D,C):S=C,Z(C,W(K,{get when(){return(n()?.arbitrations?.length??0)>0},get children(){var e=Ap();return Z(e,W(G,{get each(){return n()?.arbitrations??[]},children:e=>(()=>{var t=Ip();return t.firstChild,Z(t,()=>Bp(e),null),j(()=>Ae(t,e.status===`failure`?`error-reason`:`muted`)),t})()})),e}}),null),Z(C,W(K,{get when(){return o()},get children(){var e=jp();return Z(e,o),e}}),null),Z(C,W(K,{get when(){return J(()=>!!r())()&&r().entries.length>0},get fallback(){return(()=>{var e=Lp();return Z(e,()=>n()?`waiting for output from this agent…`:`no data for this agent — it may not have started writing its session log yet.`),e})()},get children(){return W(xc,{get entries(){return r().entries},get who(){return n()?.agentType??`agent`},userLabel:`task from parent`,get resetKey(){return`${e.sessionKey}:${e.agentId}`},get imageScope(){return{runtimeKey:e.sessionKey,agentId:e.agentId}}})}}),null),Z(w,W(K,{get when(){return r()?.streaming},get children(){return Mp()}}),null),Z(w,W(K,{get when(){return v()},get fallback(){return Rp()},get children(){return[W(K,{get when(){return f()},get children(){var e=jp();return Z(e,f),e}}),W(K,{get when(){return g().steering.length>0},get children(){var e=Np();return Z(e,W(G,{get each(){return g().steering},children:e=>(()=>{var t=zp();return t.firstChild,Z(t,e,null),t})()})),e}}),(()=>{var e=Pp(),t=e.firstChild,n=t.nextSibling.firstChild;n.firstChild;var r=n.nextSibling;t.$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!y()&&(e.preventDefault(),T())},t.$$input=e=>{l(e.currentTarget.value),_d(e.currentTarget)};var i=x;return typeof i==`function`?Pe(i,t):x=t,Z(n,()=>m()??`loading…`,null),r.$$click=()=>void T(),Z(r,()=>u()?`sending…`:`steer ↵`),j(e=>{var n=u(),i=u()||c().trim().length===0;return n!==e.e&&(t.disabled=e.e=n),i!==e.t&&(r.disabled=e.t=i),e},{e:void 0,t:void 0}),j(()=>t.value=c()),e})()]}}),null),j(()=>X(s,`href`,`#/session/${e.sessionKey}`)),t})()}ke([`input`,`keydown`,`click`]);var Hp=Symbol(`store-raw`),Up=Symbol(`store-node`),Wp=Symbol(`store-has`),Gp=Symbol(`store-self`);function Kp(e){let t=e[p];if(!t&&(Object.defineProperty(e,p,{value:t=new Proxy(e,em)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function qp(e){let t;return typeof e==`object`&&!!e&&(e[p]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Jp(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Hp])return n;if(!qp(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Jp(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Jp(i,t))!==i&&(e[a]=r))}return e}function Yp(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Xp(e,t,n){if(e[t])return e[t];let[r,i]=k(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Zp(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===p||t===Up?n:(delete n.value,delete n.writable,n.get=()=>e[p][t],n)}function Qp(e){ee()&&Xp(Yp(e,Up),Gp)()}function $p(e){return Qp(e),Reflect.ownKeys(e)}var em={get(e,t,n){if(t===Hp)return e;if(t===p)return n;if(t===m)return Qp(e),n;let r=Yp(e,Up),i=r[t],a=i?i():e[t];if(t===Up||t===Wp||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);ee()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Xp(r,t,a)())}return qp(a)?Kp(a):a},has(e,t){return t===Hp||t===p||t===m||t===Up||t===Wp||t===`__proto__`?!0:(ee()&&Xp(Yp(e,Wp),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:$p,getOwnPropertyDescriptor:Zp};function tm(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[Wp]&&e[Wp][t]&&i!==void 0&&e[Wp][t].$()):(e[t]=n,e[Wp]&&e[Wp][t]&&i===void 0&&e[Wp][t].$());let o=Yp(e,Up),s;if((s=Xp(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Xp(o,`length`,a))&&s.$(e.length)}(s=o[Gp])&&s.$()}function nm(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];rm(i)||tm(e,i,t[i])}}function rm(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function im(e,t){if(typeof t==`function`&&(t=t(e)),t=Jp(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&tm(e,n,r)}tm(e,`length`,r)}else nm(e,t)}function am(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&rm(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)am(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&am(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)am(e,[r].concat(t),n);return}else if(t.length>1){am(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Jp(a),r===void 0||qp(i)&&qp(a)&&!Array.isArray(a)?nm(i,a):tm(e,r,a))}function om(...[e,t]){let n=Jp(e||{}),r=Array.isArray(n),i=Kp(n);function a(...e){I(()=>{r&&e.length===1?im(n,e[0]):am(n,e)})}return[i,a]}var sm=new WeakMap,cm={get(e,t){if(t===Hp)return e;let n=e[t];if(t===p||t===m||t===Up||t===Wp||t===`__proto__`)return n;let r;return qp(n)?sm.get(n)||(sm.set(n,r=new Proxy(n,cm)),r):n},set(e,t,n){return tm(e,t,Jp(n)),!0},deleteProperty(e,t){return tm(e,t,void 0,!0),!0}};function lm(e){return t=>{if(qp(t)){let n;(n=sm.get(t))||sm.set(t,n=new Proxy(t,cm)),e(n)}return t}}function um(){let[e,t=``]=window.location.hash.replace(/^#\/?/,``).split(`?`,2),[n,...r]=e.split(`/`);if(n===`session`&&r[0])return r[1]===`subagent`&&r[2]?{screen:`subagent`,key:r[0],agentId:r[2]}:{screen:`session`,key:r[0]};if(n===`files`)return{screen:`files`,path:r.length?decodeURIComponent(r.join(`/`)):void 0};if(n===`memories`)return{screen:`memories`};if(n===`settings`){if(r[0]===`scoped-models`){let e=new URLSearchParams(t).get(`cwd`)||void 0;return{screen:`settings`,target:`scoped-models`,...e?{cwd:e}:{}}}return{screen:`settings`}}return n===`pairing`?{screen:`pairing`}:{screen:`fleet`}}function dm(e){switch(e.screen){case`fleet`:return`#/`;case`session`:return`#/session/${e.key}`;case`subagent`:return`#/session/${e.key}/subagent/${e.agentId}`;case`files`:return e.path?`#/files/${encodeURIComponent(e.path)}`:`#/files`;case`memories`:return`#/memories`;case`settings`:return e.target===`scoped-models`?`#/settings/scoped-models${e.cwd?`?cwd=${encodeURIComponent(e.cwd)}`:``}`:`#/settings`;case`pairing`:return`#/pairing`}}var fm=2e3,pm=3*1024*1024,mm=fm,hm=pm,gm=3e4,_m=1e4,vm=1e3,ym=3e4,bm=5e3,xm=5*6e4,Sm=2147e6,Cm=new TextEncoder;function wm(e,t,n){e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`);let r=n.retryAttempt??0;if(n.isRetrying&&r>0){let t=e.entries.findLast(e=>e.kind===`assistant`&&e.stopReason===`error`),n=t?.errorMessage?` — ${t.errorMessage}`:``;e.statusEntries.push({key:`retry`,text:`retrying (attempt ${r})${n}`,tone:`warning`})}on(e,t,n.isStreaming||n.isRetrying||n.isCompacting)}function Tm(){let[e,t]=om({}),[n,r]=om({}),[i,a]=k(um()),[o,s]=k({runtimes:[],diskSessions:[]}),[c,l]=k(),[u,d]=k(),[f,p]=k(),[m,h]=k(!1),[g,_]=k(),[v,y]=k({state:`disconnected`,attempt:0}),b=()=>v().state===`connected`,[x,S]=k([]),C=new Map,w=new Map,T=new Map,E=0,D=0,O,A,j,M,N=!1,P=0,F=!1,I,L=0,R=new Map,z=new Map,ee=new Map,te=0,ne=0,re,ie,ae,B=0,oe=new Set,V=!1;window.addEventListener(`hashchange`,()=>a(um()));function se(e){window.location.hash=dm(e)}function H(e){return n[e]??0}function ce(e){return C.get(e)??0}function le(e){return w.get(e)??0}function U(e){w.set(e,le(e)+1)}function ue(e){C.set(e,ce(e)+1)}function de(e){return{revision:H(e),generation:ce(e),epoch:E}}function fe(e,t){return ce(e)===t.generation&&E===t.epoch}function pe(e,t){return H(e)===t.revision&&fe(e,t)}function me(e,t){t&&T.get(e)!==t||(T.delete(e),t&&(t.queued=[],t.queuedBytes=0))}function he(e){r(e,H(e)+1)}function ge(n){e[n]||t(n,Bt(n))}function _e(e,n){ge(e),t(e,lm(n)),he(e)}function ve(e){me(e),ue(e),w.delete(e),t(e,void 0),r(e,void 0),ml(e)}function ye(){let e=um();return e.screen===`session`||e.screen===`subagent`?e.key:void 0}function be(e,t=`info`){--D,S(n=>[...n,{id:D,text:e,tone:t}].slice(-20))}function xe(){ie!==void 0&&clearTimeout(ie),ie=void 0,ae=void 0,B=0}function Se(e){if(V||ae!==e)return;let t=e-Date.now();if(t<=0){ie=void 0,K(e);return}ie=setTimeout(()=>Se(e),Math.min(t,Sm))}function Ce(e){if(xe(),!e)return;let t=Date.parse(e);if(!Number.isFinite(t)){be(`Dashboard returned an invalid pairing-expiry check time`,`error`);return}ae=t,Se(t)}function W(e){if(V||ae!==e)return;B+=1;let t=Math.min(10,B-1),n=Math.min(xm,bm*2**t);ie=setTimeout(()=>{ie=void 0,!V&&ae===e&&K(e)},n)}function we(e){e.pairingExpiryWarning&&be(`This device pairing expires on ${e.pairingExpiryWarning.expiresAt.slice(0,10)}. Re-pair before then to avoid losing remote access.`,`warning`)}function G(e){_(e),we(e),Ce(e.pairingExpiryCheckAt)}async function K(e){try{let t=await $.auth();if(V)return;if(ae!==e){we(t);return}if((t.pairingExpiryCheckAt?Date.parse(t.pairingExpiryCheckAt):void 0)===e&&e<=Date.now()){_(t),we(t),W(e);return}G(t)}catch(t){if(V||ae!==e)return;if(t?.status===401||t?.status===403){xe(),_({mode:`remote`,needsPairing:t?.body?.needsPairing??!1,identity:t?.body?.identity,error:t?.message}),se({screen:`pairing`});return}B===0&&be(`Could not check pairing expiry: ${t instanceof Error?t.message:String(t)}`,`error`),W(e)}}function Te(e){return R.get(e)??0}function q(e,t,n){let r=new Map(e.map(e=>[e.key,JSON.stringify(e.state)])),i=new Map(t.map(e=>[e.key,JSON.stringify(e.state)]));for(let e of new Set([...r.keys(),...i.keys()])){if(r.get(e)===i.get(e))continue;let t=Te(e)+1;R.set(e,t),n===void 0?z.set(e,t):ee.set(e,Math.max(ee.get(e)??-1,n))}}function J(e,t){s(n=>{let r=e(n);return L+=1,q(n.runtimes,r.runtimes,t),r})}function Ee(e){oe.clear(),J(()=>e)}function De(e,t){let n=new Set(e.filter(e=>!oe.has(e.key)).map(e=>e.key)),r=n.size!==o().runtimes.length||o().runtimes.some(e=>!n.has(e.key));J(t=>{let n=new Map(t.runtimes.map(e=>[e.key,e]));return{...t,runtimes:e.filter(e=>!oe.has(e.key)).map(e=>{let t=n.get(e.key);return{...e,state:{...e.state,contextUsage:t?.state.contextUsage??e.state.contextUsage},...t?.stats===void 0?{}:{stats:t.stats},...t?.lastAssistantText===void 0?{}:{lastAssistantText:t.lastAssistantText}}})}},t),r&&ke().catch(()=>{})}function Oe(e){let t=oe.has(e);return oe.add(e),t?(ve(e),Promise.resolve()):(J(t=>({...t,runtimes:t.runtimes.filter(t=>t.key!==e)})),ve(e),ke())}function Y(){let e=++te,t=L;return $.fleet().then(n=>{e!==te||t!==L||(Ee(n),l(void 0))},n=>{throw e===te&&t===L&&l(n instanceof Error?n.message:String(n)),n})}function ke(){let e=++ne;return $.sessions().then(t=>{e===ne&&(J(e=>({...e,diskSessions:t.sessions})),l(void 0))},t=>{throw e===ne&&l(t instanceof Error?t.message:String(t)),t})}function X(e){oe.delete(e.key),J(t=>{let n=t.runtimes.findIndex(t=>t.key===e.key);if(n===-1)return{...t,runtimes:[...t.runtimes,e]};let r=[...t.runtimes];return r[n]=e,{...t,runtimes:r}})}function Ae(e,t,n,r){if(o().runtimes.some(t=>t.key===e)){if(n!==void 0&&Te(e)!==n){let t=z.get(e)??0,i=ee.get(e);if(t>n||i===void 0||i>r)return}J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:t}:n)}))}}function je(e,t){J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,model:t}}:n)}))}function Me(e,t){J(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,thinkingLevel:t}}:n)}))}function Ne(e,t,n){return{...e,state:{...e.state,...t.contextUsage===void 0?{}:{contextUsage:t.contextUsage},messageCount:n?e.state.messageCount:t.totalMessages},stats:{tokensTotal:t.tokens.total,cost:t.cost}}}function Pe(e){let t=new AbortController,n,r=new Promise((r,i)=>{n=setTimeout(()=>{let n=Error(`Stats request for runtime ${e} timed out after ${_m} ms`);i(n),t.abort(n)},_m)});return Promise.race([$.stats(e,t.signal),r]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Z(){if(re)return re;let e=o().runtimes.map(e=>e.key),t=new Map(e.map(e=>[e,Te(e)])),n=e.map(e=>Pe(e)),r=Promise.allSettled(n).then(n=>{let r=new Map,i=[];for(let[t,a]of n.entries())a.status===`fulfilled`?r.set(e[t],a.value):i.push(a.reason instanceof Error?a.reason.message:String(a.reason));r.size>0&&J(e=>({...e,runtimes:e.runtimes.map(e=>{let n=r.get(e.key),i=t.get(e.key),a=i===void 0||Te(e.key)!==i;return n?Ne(e,n,a):e})})),d(i.length>0?i.join(`; `):void 0)}).finally(()=>{re===r&&(re=void 0)});return re=r,r}function Fe(e){return Cm.encode(JSON.stringify(e)).byteLength}function Ie(e){e.queued=[],e.queuedBytes=0}function Le(){j!==void 0&&clearTimeout(j),j=void 0}function Re(){return Math.min(ym,vm*2**Math.max(0,P-1))}function ze(){if(V||j!==void 0)return;P+=1;let e=Re();h(!1),M||=v(),y(t=>t.state===`auth_failed`?t:(N=!0,{...t,state:`retrying`,attempt:Math.max(t.attempt,P),retryDelayMs:e,retryAt:Date.now()+e})),j=setTimeout(()=>{j=void 0,We()},e)}function Be(){let e=M,t=N;M=void 0,N=!1,!(!t||e?.state!==`connected`||v().state!==`retrying`)&&y({state:`connected`,attempt:e.attempt,lastAppliedSeq:e.lastAppliedSeq})}function Ve(e){let t=e.event?.type;if(t===`fleet_snapshot`)De(e.event.runtimes,e.seq);else if(t===`disk_sessions_changed`)ke().catch(()=>{});else if(t===`runtime_removed`){if(e.key){let t=ye()===e.key;Oe(e.key).catch(()=>{}),t&&(be(`session ${e.key} was stopped`,`warning`),se({screen:`fleet`}))}}else e.key&&(_e(e.key,t=>dn(t,e.event)),t===`tasks_update`&&U(e.key))}function He(e){let t=e.subagent;_e(e.key,n=>{let r=e.messages;if(n.entries=Jt(r),n.tasks=(e.state.tasks??[]).map(e=>({...e})),n.streaming=e.state.isStreaming,n.compacting=e.state.isCompacting,n.sessionName=e.state.sessionName,n.model=e.state.model?.id,n.contextUsage=e.state.contextUsage,n.uiRequests=(e.pendingExtensionUiRequests??[]).map(e=>zt(e)).filter(e=>e!==void 0),n.statusEntries=[],n.suggestedCommand=void 0,n.lastError=void 0,n.widgets={above:[],below:[]},n.toasts=[],n.title=void 0,n.composerPrefill=void 0,wm(n,r,e.state),n.streaming?(n.workingSince=Date.now(),n.workingText=`working`):(n.workingSince=void 0,n.workingText=void 0),n.backgroundAgents=Object.fromEntries(e.backgroundAgents.map(e=>[e.agentId,e])),$t(n),t){let r=e.backgroundAgents.find(e=>e.agentId===t.agentId)??t.agent;n.backgroundAgents[t.agentId]=r,n.subagents[t.agentId]={agentId:t.agentId,entries:Jt(t.messages),streaming:r.status===`running`}}en(n)}),U(e.key)}function Ue(e,t){if(A!==e||e.state!==`active`||e.barrierSeq===void 0)return;Le(),P=0,Be();let n=e.barrierSeq;if(I=n,Ee(t.fleet),l(void 0),t.active)He(t.active);else{let e=ye();e&&(ve(e),be(`session ${e} was stopped`,`warning`),se({screen:`fleet`}))}let r=[...e.queued].sort((e,t)=>e.seq-t.seq),i=t.active?.subagent;if(i&&t.active)for(let e of r)e.seq>i.barrierSeq&&e.seq<=n&&e.key===t.active.key&&e.event.type===`background_agent_event`&&String(e.event.agentId)===i.agentId&&Ve(e);for(let e of r)e.seq>n&&Ve(e);Ie(e),A=void 0,h(!1),p(void 0)}function We(e=!1){if(V)return Promise.resolve();if(O)return(e||A?.state===`failed`)&&(F=!0),O;Le();let t=i(),n=t.screen===`session`||t.screen===`subagent`?t.key:void 0,r=t.screen===`subagent`?t.agentId:void 0,a={queued:[],queuedBytes:0,state:`active`,controller:new AbortController};A=a,E+=1;for(let[e,t]of T)me(e,t);h(!0),p(void 0);let o=setTimeout(()=>a.controller.abort(`Dashboard recovery timed out`),gm),s=$.resync(n,r,a.controller.signal).then(e=>{a.barrierSeq=e.barrierSeq,Ue(a,e)}).catch(e=>{if(A!==a)return;a.state=`failed`,Ie(a);let t=a.controller.signal.reason;p(typeof t==`string`?t:e instanceof Error?e.message:String(e)),ze(),j===void 0&&h(!1)}).finally(()=>{clearTimeout(o),O===s&&(O=void 0),!V&&F&&(F=!1,We())});return O=s,s}function Ge(){return We(!0)}function Ke(e){if(e.event?.type===`dashboard_resync`){We(!0);return}if(A){if(A.state===`failed`)throw ze(),Error(`Dashboard recovery is failed; refusing to acknowledge live envelope before resync succeeds`);let t=Fe(e);if(A.queued.length>=fm||A.queuedBytes+t>pm){Ie(A),A.state=`failed`;let e=`Dashboard recovery queue overflowed; waiting for a newer authoritative snapshot`;throw p(e),A.controller.abort(e),ze(),j===void 0&&h(!1),Error(e)}A.queued.push(e),A.queuedBytes+=t;return}if(I!==void 0&&e.seq<=I)return;let t=e.key?T.get(e.key):void 0;if(t){let n=Fe(e);if(t.queued.length>=mm||t.queuedBytes+n>hm)throw me(e.key,t),Error(`Dashboard hydration queue overflowed for ${e.key}; refusing an incomplete snapshot replay`);t.queued.push(e),t.queuedBytes+=n}Ve(e)}let qe;async function Je(){V=!1;try{G(await $.auth())}catch(e){_({mode:`remote`,needsPairing:e?.body?.needsPairing??!1,identity:e?.body?.identity,error:e?.message}),se({screen:`pairing`});return}await Y().catch(()=>{}),qe=_t({onEnvelope:Ke,onAuthStatus:G,onStatusChange:e=>{N=!1,M=e.state===`connected`?e:void 0,y(e)},onRecovery:()=>{We()}})}function Ye(){V=!0,qe?.(),xe(),Le(),M=void 0,N=!1,F=!1;let e=A;A=void 0,e&&Ie(e),e?.controller.abort(`Dashboard stopped`);for(let[e,t]of T)me(e,t)}function Xe(t){if(x().some(e=>e.id===t)){S(e=>e.filter(e=>e.id!==t));return}for(let[n,r]of Object.entries(e))if(r.toasts.some(e=>e.id===t)){_e(n,e=>fn(e,t));return}}async function Ze(e,t){me(e);let n=Te(e),r={guard:de(e),queued:[],queuedBytes:0};T.set(e,r);let i=()=>me(e,r);t?.addEventListener(`abort`,i,{once:!0}),t?.aborted&&i();try{let i=await $.hydrate(e,t);if(t?.aborted||T.get(e)!==r||!fe(e,r.guard))return;_e(e,e=>{let t=i.messages;e.entries=Jt(t),e.backgroundAgents=Object.fromEntries(i.backgroundAgents.map(e=>[e.agentId,e])),$t(e),e.streaming=i.state.isStreaming,e.compacting=i.state.isCompacting,e.tasks=(i.state.tasks??[]).map(e=>({...e})),i.state.isStreaming?(e.workingSince=Date.now(),e.workingText=`working`):(e.workingSince=void 0,e.workingText=void 0),e.uiRequests=(i.pendingExtensionUiRequests??[]).map(e=>zt(e)).filter(e=>e!==void 0),wm(e,t,i.state),en(e)}),U(e),Ae(e,i.state,n,i.barrierSeq);for(let e of[...r.queued].sort((e,t)=>e.seq-t.seq))e.seq>i.barrierSeq&&Ve(e)}finally{t?.removeEventListener(`abort`,i),me(e,r)}}async function Qe(e,t,n){let r=de(e),{agent:i,messages:a}=await $.subagentMessages(e,t,n);n?.aborted||!pe(e,r)||_e(e,e=>{e.backgroundAgents[t]=i;let n=e.subagents[t];n||(n={agentId:t,entries:[],streaming:i.status===`running`},e.subagents[t]=n),a.length>0&&(n.entries=Jt(a)),n.streaming=i.status===`running`})}return{sessions:e,revisions:n,route:i,navigate:se,fleet:o,fleetError:c,fleetStatsError:u,refreshFleet:Y,refreshDiskSessions:ke,refreshFleetStats:Z,removeRuntime:Oe,upsertRuntime:X,setRuntimeModel:je,setRuntimeThinkingLevel:Me,resyncing:m,resyncError:f,retryResync:Ge,auth:g,connected:b,connection:v,notices:x,start:Je,stop:Ye,dismissToast:Xe,resolveUiRequest(e,t){_e(e,e=>pn(e,t))},hydrateSession:Ze,hydrateSubagent:Qe}}var Em=5e3;function Dm(e){let t;return Promise.race([e,new Promise((e,n)=>{t=setTimeout(()=>n(Error(`service worker not ready`)),Em)})]).finally(()=>{t&&clearTimeout(t)})}function Om(){let e=Tm();R(()=>{e.start(),`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,t=>{if(t.data?.type===`navigate-session`&&typeof t.data.sessionKey==`string`){let n=t.data.sessionKey,r=!!e.sessions[n]||e.fleet().runtimes.some(e=>e.key===n);e.navigate(r?{screen:`session`,key:n}:{screen:`fleet`})}}),navigator.serviceWorker.register(`./sw.js`).catch(e=>{console.warn(`dashboard: service worker registration failed`,e)}))}),z(()=>e.stop());let t=new Set,n=new Set,r=t=>!!(e.fleet().runtimes.find(e=>e.key===t)?.needsAttention||e.sessions[t]?.needsAttention);M(()=>{let i=new Map;for(let t of e.fleet().runtimes)t.needsAttention&&i.set(t.key,{name:t.state.sessionName??t.state.sessionId.slice(0,8),reason:`needs attention`});for(let t of Object.values(e.sessions))t.needsAttention&&i.set(t.key,{name:t.sessionName??t.title??t.key,reason:tn(t.uiRequests)??t.statusEntries.find(e=>e.tone===`error`)?.text??`needs attention`});let a=i.size>0,o=e.route(),s=o.screen===`session`||o.screen===`subagent`?o.key:void 0,c=s?e.sessions[s]:void 0,l=s?e.fleet().runtimes.find(e=>e.key===s):void 0,u=c?.title??c?.sessionName??l?.state.sessionName,d=u?`${u} — dreb`:`dreb`;document.title=a?`◆ ${d}`:d;for(let[e,a]of i)n.has(e)||t.has(e)||typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`&&`serviceWorker`in navigator&&(t.add(e),Dm(navigator.serviceWorker.ready).then(t=>t.showNotification(`dreb — ${a.name}`,{body:a.reason,tag:e,data:{sessionKey:e}})).then(()=>{t.delete(e),r(e)?n.add(e):n.delete(e)}).catch(n=>{t.delete(e),console.warn(`dashboard: showNotification failed`,n)}));for(let e of[...n])i.has(e)||n.delete(e);for(let e of[...t])i.has(e)||t.delete(e)});let i=()=>[...Object.values(e.sessions).flatMap(e=>e.toasts.map(t=>({...t,sessionKey:e.key}))),...e.notices()].slice(-5);return[W(Te,{get fallback(){return W(Zn,{store:e})},get children(){return[W(q,{get when(){return e.route().screen===`session`},get children(){return W(Dd,{store:e,get sessionKey(){return e.route().key}})}}),W(q,{get when(){return e.route().screen===`subagent`},get children(){return W(Vp,{store:e,get sessionKey(){return e.route().key},get agentId(){return e.route().agentId}})}}),W(q,{get when(){return e.route().screen===`files`},get children(){return W(Lt,{store:e,get initialPath(){return e.route().path}})}}),W(q,{get when(){return e.route().screen===`memories`},get children(){return W(Zc,{store:e})}}),W(q,{get when(){return e.route().screen===`settings`},get children(){return W(kp,{store:e,get target(){return e.route().target},get routeScopedModelsCwd(){return e.route().cwd}})}}),W(q,{get when(){return e.route().screen===`pairing`},get children(){return W(rl,{store:e})}})]}}),W(rt,{get toasts(){return i()},onDismiss:t=>e.dismissToast(t)})]}wf();var km=document.getElementById(`root`);if(!km)throw Error(`dashboard: #root element missing from index.html`);Oe(()=>W(Om,{}),km);
@@ -55,7 +55,7 @@
55
55
  } catch (e) {}
56
56
  })();
57
57
  </script>
58
- <script type="module" crossorigin src="./assets/index-DKq1kEAm.js"></script>
58
+ <script type="module" crossorigin src="./assets/index-BWSwMHec.js"></script>
59
59
  <link rel="stylesheet" crossorigin href="./assets/index-DVDGUEPU.css">
60
60
  </head>
61
61
  <body>
package/dist/static/sw.js CHANGED
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  // Replaced at build time; see vite.config.ts generateBundle hook.
17
- const SW_CACHE_VERSION = "2.57.0";
17
+ const SW_CACHE_VERSION = "2.58.0";
18
18
  const SHELL_CACHE = `dreb-dashboard-shell-v${SW_CACHE_VERSION}`;
19
19
 
20
20
  // Shell assets (HTML, JS, CSS) get a network-first strategy. The dashboard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/dashboard",
3
- "version": "2.57.0",
3
+ "version": "2.58.0",
4
4
  "description": "Web dashboard for dreb — fleet overview, chat parity, subagent observability",
5
5
  "license": "MIT",
6
6
  "type": "module",