@dreb/dashboard 2.61.1 → 2.62.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 +1 -1
- package/dist/shared/protocol.d.ts +14 -1
- package/dist/shared/protocol.d.ts.map +1 -1
- package/dist/shared/protocol.js.map +1 -1
- package/dist/static/assets/{index-Baf7iJyp.js → index-UXklvNmU.js} +1 -1
- package/dist/static/index.html +1 -1
- package/dist/static/sw.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ 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, and maximum concurrent subagents), a scoped-models editor, per-agent model
|
|
72
|
+
hide-thinking, compaction/retry, and maximum concurrent subagents), automatic tab-title enable/model controls, 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
|
|
@@ -482,6 +482,16 @@ export interface SubagentArbiterSettingsDto {
|
|
|
482
482
|
thinking?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
483
483
|
guidePath?: string;
|
|
484
484
|
}
|
|
485
|
+
export interface TabTitleSettingsDto {
|
|
486
|
+
enabled?: boolean;
|
|
487
|
+
model?: string;
|
|
488
|
+
triggerAfter?: number;
|
|
489
|
+
maxTitleLength?: number;
|
|
490
|
+
}
|
|
491
|
+
/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */
|
|
492
|
+
export type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, "model"> & {
|
|
493
|
+
model?: string | null;
|
|
494
|
+
};
|
|
485
495
|
export interface SettingsDto {
|
|
486
496
|
defaultProvider?: string;
|
|
487
497
|
defaultModel?: string;
|
|
@@ -504,6 +514,8 @@ export interface SettingsDto {
|
|
|
504
514
|
agentModels?: Record<string, string[]>;
|
|
505
515
|
/** Global-only Dispatch Arbiter configuration. */
|
|
506
516
|
subagentArbiter?: SubagentArbiterSettingsDto | null;
|
|
517
|
+
/** Effective automatic tab-title configuration. */
|
|
518
|
+
tabTitle?: TabTitleSettingsDto;
|
|
507
519
|
/** Raw effective persisted patterns; absent means future-inclusive implicit all. */
|
|
508
520
|
enabledModels?: string[];
|
|
509
521
|
/** Effective persistent scope resolved by coding-agent core in cycling order. */
|
|
@@ -516,9 +528,10 @@ export interface SettingsDto {
|
|
|
516
528
|
hasProjectEnabledModelsOverride: boolean;
|
|
517
529
|
enabledModelsSource: "default" | "global" | "project";
|
|
518
530
|
}
|
|
519
|
-
/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels. */
|
|
531
|
+
/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */
|
|
520
532
|
export type SettingsUpdateDto = Partial<Pick<SettingsDto, "defaultProvider" | "defaultModel" | "defaultThinkingLevel" | "steeringMode" | "followUpMode" | "compactionEnabled" | "retryEnabled" | "maxConcurrentSubagents" | "imageAutoResize" | "blockImages" | "enableSkillCommands" | "autoLoadNestedContext" | "trustedContextFolders" | "transport" | "hideThinkingBlock" | "agentModels" | "subagentArbiter">> & {
|
|
521
533
|
enabledModels?: string[] | null;
|
|
534
|
+
tabTitle?: TabTitleSettingsUpdateDto;
|
|
522
535
|
};
|
|
523
536
|
export type SettingsSaveResultDto = SettingsDto & {
|
|
524
537
|
warnings?: string[];
|
|
@@ -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;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AoG;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,wBAAwB,GACxB,iBAAiB,GACjB,aAAa,GACb,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,WAAW,GACX,mBAAmB,GACnB,aAAa,GACb,iBAAiB,CACnB,CACD,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,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\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface 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
|
+
{"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,KAA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,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,wBAAwB,GACxB,iBAAiB,GACjB,aAAa,GACb,qBAAqB,GACrB,uBAAuB,GACvB,uBAAuB,GACvB,WAAW,GACX,mBAAmB,GACnB,aAAa,GACb,iBAAiB,CACnB,CACD,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE1E,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAgDlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,oFAAoF;AACpF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;AAkF9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface 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
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAgDlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtD,oFAAoF;AACpF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;AAkF9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC","sourcesContent":["/**\n * Wire types shared between the dashboard server and the browser client.\n *\n * These are standalone definitions (not imports from @dreb/coding-agent) so the\n * client bundle stays free of node-flavored type resolution. Server code maps\n * RPC DTOs onto these shapes; TypeScript structural typing enforces\n * compatibility at the mapping sites.\n */\n\n/** Maximum Unicode code points carried for an on-disk session's first-message preview. */\nexport const MAX_SESSION_PREVIEW_CHARACTERS = 256;\n\n/** Session metadata (mirrors RpcSessionInfo, with a bounded first-message preview). */\nexport interface SessionInfoDto {\n\tpath: string;\n\tid: string;\n\tcwd: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\tfirstMessage: string;\n}\n\n/** On-disk session inventory, independent of live runtime state. */\nexport interface SessionInventoryDto {\n\tsessions: SessionInfoDto[];\n}\n\nexport interface ArbitrationRouteDto {\n\tagent: string;\n\tmodel: string;\n\tthinking: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n}\n\nexport interface SubagentArbitrationDto {\n\tstatus: \"success\" | \"failure\";\n\tproposed: ArbitrationRouteDto;\n\tfinal: ArbitrationRouteDto | null;\n\tchanged: Array<\"agent\" | \"model\" | \"thinking\">;\n\tstep?: number;\n\terrorCode?: string;\n\terrorMessage?: string;\n}\n\n/** Background agent metadata (mirrors RpcBackgroundAgentInfo). */\nexport interface BackgroundAgentDto {\n\tagentId: string;\n\tagentType: string;\n\ttaskSummary: string;\n\tstartedAt: string;\n\tstatus: \"running\" | \"completed\" | \"failed\";\n\tsessionDir?: string;\n\tsessionFile?: string;\n\tcwd?: string;\n\tarbitrations?: SubagentArbitrationDto[];\n}\n\n/**\n * Shared eviction cap for completed/failed background agents. The server\n * prunes its registry to this bound and the client applies the same cap as\n * defense-in-depth — the two sides must agree on how many completed agents\n * survive, so the constant lives here.\n */\nexport const MAX_COMPLETED_BACKGROUND_AGENTS = 20;\n\n/** Maximum JSON prompt request body accepted by the dashboard server. */\nexport const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;\n\n/** Maximum accepted JSON body for optional, payload-free SSE client diagnostics. */\nexport const MAX_CLIENT_DIAGNOSTIC_BYTES = 4 * 1024;\n\nexport type EventConnectionState =\n\t| \"connecting\"\n\t| \"connected\"\n\t| \"retrying\"\n\t| \"resyncing\"\n\t| \"disconnected\"\n\t| \"auth_failed\";\n\n/**\n * Deliberately payload-free client connection telemetry. It is useful for\n * correlating stream failures with server logs, without sending prompts,\n * cookies, tool data, or SSE event contents back to the server.\n */\nexport interface ClientConnectionDiagnosticDto {\n\tconnectionId: string;\n\tstate: EventConnectionState;\n\tpreviousState?: EventConnectionState;\n\tattempt: number;\n\tdelayMs?: number;\n\tvisibility: \"visible\" | \"hidden\";\n\tlastAppliedSeq?: number;\n\theartbeatAgeMs?: number;\n\teventCount: number;\n\teventRatePerMinute: number;\n\tprocessingLagTotalMs: number;\n\tprocessingLagMaxMs: number;\n}\n\n/**\n * Inline images are base64-encoded inside the JSON prompt body. Base64 expands\n * raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =\n * 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the\n * remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw\n * image budget to the browser.\n */\nexport const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;\n\n/** Context usage (mirrors ContextUsage — the numbers the TUI footer shows). */\nexport interface ContextUsageDto {\n\ttokens: number | null;\n\tcontextWindow: number;\n\tpercent: number | null;\n}\n\nexport interface ScopedModelDto {\n\tprovider: string;\n\tid: string;\n\tname?: string;\n\treasoning?: boolean;\n\tthinkingLevel?: string;\n}\n\nexport interface SessionStatsDto {\n\tsessionFile?: string;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n\tcontextUsage?: ContextUsageDto;\n}\n\nexport interface PerformanceModelSummaryDto {\n\tprovider: string;\n\tmodelId: string;\n\trolling: { median: number; mean: number; count: number };\n\tdelta: {\n\t\tbaselineMedian: number;\n\t\trecentMedian: number;\n\t\tpercentDelta: number;\n\t\tdirection: \"above\" | \"below\" | \"stable\";\n\t\tbaselineCount: number;\n\t\trecentCount: number;\n\t};\n}\n\nexport interface PerformanceStatsDto {\n\tmodels: PerformanceModelSummaryDto[];\n}\n\nexport interface ResourcesDto {\n\tcontextFiles: Array<{ path: string }>;\n\tskills: Array<{ name: string; description: string }>;\n\textensions: Array<{ name?: string; path: string }>;\n\tpromptTemplates: Array<{ name: string; description?: string }>;\n\tsystemPromptPresent: boolean;\n}\n\nexport interface ImageAttachmentDto {\n\tdata: string;\n\tmimeType: string;\n}\n\n/**\n * Browser-facing reference to a validated tool-result raster image. Original\n * bytes remain behind authenticated runtime routes and never cross transcript\n * JSON or SSE payloads.\n */\nexport interface DashboardImageReferenceDto {\n\ttype: \"image_reference\";\n\t/** SHA-256 of the exact MIME type plus decoded original bytes. */\n\tid: string;\n\t/** Exact allowlisted original MIME type. */\n\tmimeType: \"image/png\" | \"image/jpeg\" | \"image/gif\" | \"image/webp\";\n\t/** Decoded original binary byte size. */\n\tsize: number;\n}\n\nexport const DASHBOARD_IMAGE_DISPLAY_MODES = [\"placeholders\", \"previews\", \"originals\"] as const;\nexport type DashboardImageDisplayMode = (typeof DASHBOARD_IMAGE_DISPLAY_MODES)[number];\n\nexport interface QueuedMessageDto {\n\ttext: string;\n\timages?: ImageAttachmentDto[];\n}\n\nexport interface PendingMessagesDto {\n\t/** Text-only compatibility view. */\n\tsteering: string[];\n\t/** Text-only compatibility view. */\n\tfollowUp: string[];\n\t/** Full queued payloads, including inline image attachments. */\n\tsteeringMessages?: QueuedMessageDto[];\n\t/** Full queued payloads, including inline image attachments. */\n\tfollowUpMessages?: QueuedMessageDto[];\n}\n\nexport interface CommandDto {\n\tname: string;\n\tdescription?: string;\n\tsource: \"extension\" | \"prompt\" | \"skill\" | \"builtin\";\n\t/** Built-ins with false are intercepted when typed but omitted from autocomplete. */\n\tdashboard?: boolean;\n}\n\nexport interface SessionTreeNodeDto {\n\tid: string;\n\tparentId: string | null;\n\ttype: string;\n\trole?: string;\n\tpreview: string;\n\ttimestamp: string;\n\tlabel?: string;\n\tchildren: SessionTreeNodeDto[];\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\n}\n\n/** Current task list (mirrors RpcSessionTask). */\nexport interface SessionTaskDto {\n\tid: string;\n\ttitle: string;\n\tstatus: \"pending\" | \"in_progress\" | \"completed\";\n}\n\n/** Live session state (mirrors RpcSessionState, model reduced to id fields). */\nexport interface SessionStateDto {\n\tmodel?: { provider: string; id: string; name?: string; reasoning?: boolean };\n\tscopedModels?: ScopedModelDto[];\n\tusingSubscription?: boolean;\n\t/** Current task list, atomically replaced by tasks_update events. */\n\ttasks: SessionTaskDto[];\n\tthinkingLevel: string;\n\t/** Model-aware levels available for selection and cycling. */\n\tavailableThinkingLevels: string[];\n\tisStreaming: boolean;\n\t/** True while automatic retry classification, backoff, or execution is active. */\n\tisRetrying?: boolean;\n\t/** Current automatic retry attempt, or 0 outside an emitted retry attempt. */\n\tretryAttempt?: number;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/**\n * Lightweight, event-derived live-runtime view for fleet SSE updates.\n *\n * Unlike RuntimeInfoDto, this deliberately excludes RPC-fetched stats and\n * assistant preview text: RuntimePool can build it synchronously from its\n * in-memory runtime registry.\n */\nexport interface FleetRuntimeSnapshotDto {\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Monotonic pool revision for confirmed model/thinking mutations. */\n\tsettingsRevision?: number;\n\tbackgroundAgents: BackgroundAgentDto[];\n\tneedsAttention: boolean;\n\terror?: string;\n\tcreatedAt: string;\n\tlastActivity: string;\n}\n\n/** Coalesced fleet update published on the dashboard SSE stream. */\nexport interface FleetSnapshotEventDto {\n\ttype: \"fleet_snapshot\";\n\truntimes: FleetRuntimeSnapshotDto[];\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\n}\n\n/** A single question inside an `ask` extension-UI request (mirrors RpcAskQuestion). */\nexport interface AskUiQuestionDto {\n\tquestion: string;\n\ttitle?: string;\n\toptions?: string[];\n\tallowFreeText?: boolean;\n\tmultiSelect?: boolean;\n\tmultiline?: boolean;\n}\n\n/** A blocking extension UI request that can be restored from a runtime snapshot. */\nexport interface ExtensionUiRequestDto {\n\ttype: \"extension_ui_request\";\n\tid: string;\n\tmethod: \"select\" | \"confirm\" | \"input\" | \"editor\" | \"ask\";\n\ttitle: string;\n\tmessage?: string;\n\toptions?: string[];\n\tprefill?: string;\n\tplaceholder?: string;\n\t/** For the `ask` method: one or more questions asked together as a single wizard. */\n\tquestions?: AskUiQuestionDto[];\n\ttimeout?: number;\n\t/** Absolute Unix timestamp in milliseconds when the runtime timeout fires. */\n\texpiresAt?: number;\n}\n\n/**\n * Atomic parent-session snapshot for drill-in hydration. Its barrier sequence\n * marks the SSE ordering point captured by the matching RPC snapshot marker.\n */\nexport interface RuntimeHydrationDto {\n\tkey: string;\n\tstate: SessionStateDto;\n\tmessages: unknown[];\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Dialogs still waiting for a host response at the snapshot boundary. */\n\tpendingExtensionUiRequests?: ExtensionUiRequestDto[];\n\tbarrierSeq: number;\n}\n\n/** Parent/subagent data restored by an authoritative recovery snapshot. */\nexport interface ActiveRuntimeSnapshotDto extends RuntimeHydrationDto {\n\tsubagent?: { agentId: string; agent: BackgroundAgentDto; messages: unknown[]; barrierSeq: number };\n}\n\n/** Fleet refresh plus the active runtime's explicitly ordered snapshot. */\nexport interface DashboardResyncDto {\n\tfleet: FleetDto;\n\tactive?: ActiveRuntimeSnapshotDto;\n\t/** The global barrier to await before applying the payload. */\n\tbarrierSeq: number;\n}\n\n/**\n * SSE envelope. Every event on the dashboard stream wraps a session event with\n * the runtime key it came from plus a monotonically increasing sequence number\n * used for Last-Event-ID catch-up on reconnect.\n */\nexport interface EventEnvelope {\n\tseq: number;\n\tkey: string;\n\t/** An AgentSessionEvent (or dashboard-synthesized event) as emitted by the runtime. */\n\tevent: Record<string, unknown>;\n}\n\n/** File listing entry. */\nexport interface FileEntryDto {\n\tname: string;\n\ttype: \"file\" | \"dir\" | \"symlink\" | \"other\";\n\tsize: number;\n\tmodified: string;\n}\n\n/** Directory listing response. */\nexport interface ContextTrustEvaluationDto {\n\t/** Canonical existing directory evaluated by the utility RPC runtime. */\n\tcanonicalTarget: string;\n\t/** Whether nested context is untrusted, granted by a root, or globally unrestricted. */\n\tstate: \"untrusted\" | \"trusted-root\" | \"unrestricted\";\n\t/** Canonical root granting trusted-root access, including inherited access. */\n\tgrantingRoot?: string;\n}\n\n/** Result of changing a context-trust root through the utility RPC runtime. */\nexport interface ContextTrustMutationResultDto {\n\tevaluation: ContextTrustEvaluationDto;\n\tsettings: SettingsDto;\n\taddedRoot?: string;\n\tremovedRoot?: string;\n}\n\n/** Result of removing a configured trusted-folder string exactly as stored. */\nexport interface TrustedFolderRemovalResultDto {\n\tsettings: SettingsDto;\n\tremovedFolder: string;\n}\n\n/** Directory listing response. */\nexport interface DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\n\t/** Current global nested-context trust for this canonical directory. */\n\tcontextTrust: ContextTrustEvaluationDto;\n}\n\nexport type MemoryScopeKindDto = \"global\" | \"project\";\nexport type MemoryEntryTypeDto = \"user-preferences\" | \"good-practices\" | \"project\" | \"navigation\";\n\nexport interface MemoryEntryMetadataDto {\n\tname: string;\n\tdescription: string;\n\ttype: MemoryEntryTypeDto;\n}\n\nexport interface MemoryScopeDto {\n\tid: string;\n\tkind: MemoryScopeKindDto;\n\tlabel: string;\n\tprojectRoot?: string;\n\tmemoryDir: string;\n\texists: boolean;\n}\n\nexport interface MemoryEntrySummaryDto {\n\tfile: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n\tmodified: string;\n\tsize: number;\n}\n\nexport interface MemoryListingDto {\n\tscope: MemoryScopeDto;\n\tindexContent: string | null;\n\tindexRevision: string | null;\n\tindexOverLimit: boolean;\n\tentries: MemoryEntrySummaryDto[];\n}\n\nexport interface MemoryDocumentDto {\n\tkind: \"index\" | \"entry\";\n\tfile: string;\n\tcontent: string;\n\trevision: string;\n\tmetadata?: MemoryEntryMetadataDto;\n\tmetadataError?: string;\n}\n\nexport interface MemoryMutationResultDto {\n\tlisting: MemoryListingDto;\n\tdocument?: MemoryDocumentDto;\n}\n\n/** Auth mode reported to the client. */\nexport interface AuthStatusDto {\n\tmode: \"local\" | \"remote\";\n\t/** Identity string for remote devices (e.g. Tailscale login name). */\n\tidentity?: string;\n\tdevice?: string;\n\t/** Present only when this auth check atomically claimed today's warning. */\n\tpairingExpiryWarning?: { expiresAt: string };\n\t/** Server-authoritative time for the next expiry-status check. */\n\tpairingExpiryCheckAt?: string;\n}\n\n/** Dashboard-auth-owned setting for future pairings. */\nexport interface PairingSettingsDto {\n\tpairingTtlDays: number;\n}\n\n/** Current rotating pairing code, readable only from the host/local dashboard. */\nexport interface PairingCodeDto {\n\tenabled: boolean;\n\tcode?: string;\n\texpiresInMs?: number;\n}\n\n/** A paired device (settings → devices). */\nexport interface PairedDeviceDto {\n\tid: string;\n\tidentity: string;\n\tdevice?: string;\n\tcreatedAt: string;\n\texpiresAt: string;\n}\n\n/** Dashboard settings snapshot (mirrors RpcSettingsSnapshot). */\nexport interface SubagentArbiterSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\tthinking?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\tguidePath?: string;\n}\n\nexport interface TabTitleSettingsDto {\n\tenabled?: boolean;\n\tmodel?: string;\n\ttriggerAfter?: number;\n\tmaxTitleLength?: number;\n}\n\n/** Partial tab-title update; `model: null` removes the pinned model, restoring Explore-agent routing. */\nexport type TabTitleSettingsUpdateDto = Omit<TabTitleSettingsDto, \"model\"> & { model?: string | null };\n\nexport interface SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\tmaxConcurrentSubagents?: number;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\t/** Global configured trusted context folders, including invalid legacy entries. */\n\ttrustedContextFolders?: string[];\n\t/** Canonical existing trusted roots currently enforced by the runtime. */\n\teffectiveTrustedContextRoots?: string[];\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n\t/** Global-only Dispatch Arbiter configuration. */\n\tsubagentArbiter?: SubagentArbiterSettingsDto | null;\n\t/** Effective automatic tab-title configuration. */\n\ttabTitle?: TabTitleSettingsDto;\n\t/** Raw effective persisted patterns; absent means future-inclusive implicit all. */\n\tenabledModels?: string[];\n\t/** Effective persistent scope resolved by coding-agent core in cycling order. */\n\tresolvedScopedModels: ScopedModelDto[];\n\t/** Resolver diagnostics for legacy persisted patterns. */\n\tscopeWarnings: Array<{ pattern: string; message: string }>;\n\thasProjectEnabledModelsOverride: boolean;\n\tenabledModelsSource: \"default\" | \"global\" | \"project\";\n}\n\n/** Dashboard settings mutation payload. Unlike a snapshot, null explicitly clears enabledModels, and tabTitle.model: null removes the pinned title model. */\nexport type SettingsUpdateDto = Partial<\n\tPick<\n\t\tSettingsDto,\n\t\t| \"defaultProvider\"\n\t\t| \"defaultModel\"\n\t\t| \"defaultThinkingLevel\"\n\t\t| \"steeringMode\"\n\t\t| \"followUpMode\"\n\t\t| \"compactionEnabled\"\n\t\t| \"retryEnabled\"\n\t\t| \"maxConcurrentSubagents\"\n\t\t| \"imageAutoResize\"\n\t\t| \"blockImages\"\n\t\t| \"enableSkillCommands\"\n\t\t| \"autoLoadNestedContext\"\n\t\t| \"trustedContextFolders\"\n\t\t| \"transport\"\n\t\t| \"hideThinkingBlock\"\n\t\t| \"agentModels\"\n\t\t| \"subagentArbiter\"\n\t>\n> & { enabledModels?: string[] | null; tabTitle?: TabTitleSettingsUpdateDto };\n\nexport type SettingsSaveResultDto = SettingsDto & { warnings?: string[] };\n\n/** Available model entry (mirrors ModelInfo). */\nexport interface ModelInfoDto {\n\tprovider: string;\n\tid: string;\n\tname: string;\n\tcontextWindow: number;\n\treasoning: boolean;\n}\n\n/** Agent definition metadata (mirrors RpcAgentTypeInfo). */\nexport interface AgentTypeDto {\n\tname: string;\n\tdescription: string;\n}\n"]}
|
|
@@ -76,4 +76,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
76
76
|
|
|
77
77
|
`)}function ln(e,t,n=`/${e}`){return t?(L(`Usage: ${n}`),!0):!1}function un(){let t=document.createElement(`a`);t.href=$.exportHtmlUrl(e.sessionKey),t.download=``,document.body.append(t),t.click(),t.remove()}let dn={settings:async t=>{ln(`settings`,t)||e.store.navigate({screen:`settings`})},"scoped-models":async t=>{if(ln(`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=>{h(e),p(!0)},export:async e=>{ln(`export`,e)||un()},import:async e=>{Ze(e),$e(void 0),Ye(!0)},name:async t=>{t?await $.rename(e.sessionKey,t):T(!0)},session:async e=>{ln(`session`,e)||(y(!1),await tn())},fork:async e=>{ln(`fork`,e)||await Qt()},tree:async e=>{ln(`tree`,e)||await qt()},new:async t=>{if(!ln(`new`,t)){if(ht()||gt()){L(`Wait for the current operation to finish before starting a new session.`);return}(await $.newSession(e.sessionKey)).cancelled?L(`New session cancelled.`):(await e.store.hydrateSession(e.sessionKey),await e.store.refreshDiskSessions())}},compact:async t=>{t?(await $.compact(e.sessionKey,t),L(`Compaction started.`)):C(!0)},dream:async t=>{let n=await $.dream(e.sessionKey,t||void 0);L(n.message)},resume:async e=>{ln(`resume`,e)||await Yt()},reload:async t=>{if(ln(`reload`,t))return;if(ht()||gt()){L(`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)]);ce(n),L(`Reloaded extensions, skills, prompts, themes, and settings.`)},quit:async e=>{ln(`quit`,e)||await mn()}};async function fn(){let t=i().trim();if(!t&&be().length===0&&U().length===0)return;F(void 0),L(void 0);let n=dl(t,H());if(n){if(be().length>0||U().length>0){L(`Remove attachments before running a built-in command; nothing was sent or discarded.`);return}try{await fl(n,dn,L),a(``),Ce(void 0)}catch(e){F(e instanceof Error?e.message:String(e))}return}let r=cn(t||`Please review the attached item(s). `);try{let t=U(),n=t.length>0?await Promise.all(t.map(async({blob:e,mimeType:t})=>({data:await At(e),mimeType:t}))):void 0;ht()?await $.prompt(e.sessionKey,r,o(),n):n?await $.prompt(e.sessionKey,r,void 0,n):await $.prompt(e.sessionKey,r),xl(e.sessionKey,r),Ce(void 0),a(``),Mt(),xe([]),Tt()}catch(e){F(e instanceof Error?e.message:String(e))}}async function pn(){l(!0);try{await $.abort(e.sessionKey),await Vt()}catch(e){F(e instanceof Error?e.message:String(e))}finally{l(!1)}}async function mn(){if(!u()){d(!0),F(void 0);try{await e.store.stopRuntime(e.sessionKey)}catch(e){F(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function hn(t){try{t===`compaction`?await $.abortCompaction(e.sessionKey):t===`retry`&&await $.abortRetry(e.sessionKey)}catch(e){F(e instanceof Error?e.message:String(e))}}function gn(e){it?.querySelectorAll(`details.tool`).forEach(t=>{t.open=e})}let _n=()=>mt()?[]:Object.values(t()?.backgroundAgents??{}).filter(e=>e.status===`running`),vn=()=>Object.values(t()?.backgroundAgents??{}).filter(e=>mt()||e.status!==`running`),yn=()=>Object.values(t()?.backgroundAgents??{}).sort((e,t)=>Date.parse(t.startedAt)-Date.parse(e.startedAt)),bn=()=>t()?.tasks??[],xn=()=>bn().filter(e=>e.status===`completed`).length,Sn=()=>ne()?.contextUsage??n()?.state.contextUsage,Cn=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,wn=()=>t()?.sessionName??n()?.state.sessionName,Tn=()=>wn()??t()?.title??e.sessionKey,En=()=>n()?.cwd??mt()?.cwd,Dn=()=>{let e=En();if(!e)return;let t=B();return`${vd(e)}${t?` (${t})`:``}`},On=()=>{let e=Dn(),t=wn();return e&&t?`${e} • ${t}`:e??t??`session`},kn=()=>{let e=ne()?.tokens;if(!e)return;let t=[];return e.input&&t.push(`↑${hd(e.input)}`),e.output&&t.push(`↓${hd(e.output)}`),e.cacheRead&&t.push(`R${hd(e.cacheRead)}`),e.cacheWrite&&t.push(`W${hd(e.cacheWrite)}`),t.length>0?t.join(` `):void 0},An=()=>{let e=ne()?.cost??0,t=n()?.state.usingSubscription??!1;if(!e&&!t)return;let r=`$${e.toFixed(3)}${t?` (sub)`:``}`,i=V();return i!==void 0&&i>e&&(r+=`, today: $${i.toFixed(2)}`),r},jn=()=>{let e=Sn();if(e)return`ctx ${e.percent===null?`?`:`${e.percent.toFixed(0)}%`}/${hd(e.contextWindow)}`},Mn=()=>_d(ie(),n()?.state.model),Nn=()=>[kn(),An(),jn(),Mn()].filter(Boolean),Pn=()=>[...(_e().steeringMessages??_e().steering.map(e=>({text:e}))).map(e=>({kind:`steer`,text:e.images?.length?`${e.text} (${e.images.length} image(s))`:e.text})),...(_e().followUpMessages??_e().followUp.map(e=>({text:e}))).map(e=>({kind:`follow-up`,text:e.images?.length?`${e.text} (${e.images.length} image(s))`:e.text}))],Fn=()=>{let e=i();if(le()||!e.startsWith(`/`))return;let t=e.slice(1);if(!/\s/.test(t))return t.toLowerCase()},In=N(()=>{let e=Fn();return e===void 0?[]:pl(H(),e)}),Ln=()=>In().length>0,Rn=e=>{a(`/${e.name} `),ue(!0),queueMicrotask(()=>lt?.focus())};M(()=>{let e=In().length;de()>=e&&fe(Math.max(0,e-1))});let zn=N(()=>{let r=[],i=mt();if(i&&!i.bannerDismissed){let t=i.resumeError?`\nResume failed: ${i.resumeError}`:``,n=[];i.cwd&&i.sessionFile&&n.push({label:i.resuming?`resuming…`:`Resume session`,run:()=>e.store.resumeClosedSession(e.sessionKey),disabled:i.resuming}),n.push({label:`Return to fleet`,run:()=>e.store.navigate({screen:`fleet`}),disabled:i.resuming}),r.push({key:`closed`,text:`session ${e.sessionKey} was closed${t}`,tone:i.resumeError?`error`:`warning`,onDismiss:()=>e.store.dismissClosedBanner(e.sessionKey),actions:n})}let a=n()?.state.modelFallbackMessage;a&&!O()&&r.push({key:`fallback`,text:a,tone:`warning`,onDismiss:()=>A(!0)});for(let n of t()?.statusEntries??[])n.dismissed||r.push({key:`status:${n.id}`,text:n.text,tone:n.tone,onDismiss:()=>e.store.dismissStatusBanner(e.sessionKey,n.id)});for(let n of t()?.toasts??[])r.push({key:`toast:${n.id}`,text:n.text,tone:n.tone,onDismiss:()=>e.store.dismissToast(n.id)});return P()&&r.push({key:`action-error`,text:P(),tone:`error`,onDismiss:()=>F(void 0)}),I()&&r.push({key:`action-notice`,text:I(),tone:`info`,onDismiss:()=>L(void 0)}),r});return(()=>{var l=Ku(),d=l.firstChild,O=d.firstChild,k=O.firstChild.nextSibling,A=k.nextSibling,M=d.nextSibling,N=M.firstChild,P=M.nextSibling,I=P.firstChild,L=I.firstChild;Z(k,Tn),Z(O,W(K,{get when(){return!v()},get children(){var e=Cu();return Z(e,(()=>{var e=J(()=>!!En());return()=>e()?vd(En()):void 0})()),e}}),A),Z(O,W(at,{get store(){return e.store},class:`session-connection-indicator`}),A),Z(O,W(K,{get when(){return J(()=>!v())()&&!mt()},get children(){var t=Tu(),i=t.firstChild,a=i.firstChild.nextSibling.nextSibling,o=i.nextSibling;o.firstChild.nextSibling;var s=o.nextSibling;return i.$$click=()=>p(!0),Z(a,()=>pd(n()?.state.model)),o.$$click=async()=>{let t=n()?.state.thinkingLevel??`off`,i=r(),a=i[(i.indexOf(t)+1)%i.length];try{let t=await $.setThinking(e.sessionKey,a);e.store.setRuntimeThinkingLevel(e.sessionKey,a,t.settingsRevision)}catch(e){F(e instanceof Error?e.message:String(e))}},Z(o,()=>n()?.state.thinkingLevel??`—`,null),Z(t,W(K,{get when(){return Sn()},get children(){var e=wu();return e.firstChild.nextSibling,Z(e,(()=>{var e=J(()=>Sn().percent===null);return()=>e()?`?`:`${Sn().percent.toFixed(0)}%`})(),null),e}}),s),s.$$click=()=>_(!g()),j(()=>X(i,`title`,md(n()?.state.model))),t}}),A),A.$$click=()=>y(!v()),Z(A,()=>v()?`details ▾`:`details ▴`),Z(d,W(K,{get when(){return!v()},get children(){return[(()=>{var e=Du(),t=e.firstChild,n=t.nextSibling;return Z(t,On),n.$$click=tn,Z(n,W(G,{get each(){return Nn()},children:e=>(()=>{var t=qu();return Z(t,e),t})()})),Z(e,W(K,{get when(){return et()},get children(){var e=Eu(),t=Q;return typeof t==`function`?Pe(t,e):Q=e,Z(e,W(K,{get when(){return nt()},get children(){var e=$l();return Z(e,nt),e}}),null),Z(e,W(K,{get when(){return ne()},get fallback(){return Ju()},children:e=>(()=>{var t=Yu(),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,()=>hd(e().tokens.input),s),Z(o,()=>hd(e().tokens.output),null),Z(c,()=>hd(e().tokens.cacheRead),l),Z(c,()=>hd(e().tokens.cacheWrite),null),Z(u,()=>hd(e().tokens.total)),Z(d,()=>e().cost.toFixed(4),null),t})()}),null),e}}),null),j(()=>n.disabled=!!mt()),e})(),W(K,{get when(){return g()},get children(){var t=Au(),i=t.firstChild,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling,c=s.nextSibling,l=c.nextSibling,d=l.nextSibling,f=d.nextSibling;return a.$$click=()=>C(!0),o.$$click=()=>gn(!0),s.$$click=()=>gn(!1),c.$$click=()=>T(!0),l.$$click=Qt,d.$$click=wt,Z(t,W(K,{get when(){return Cn()},get children(){return[(()=>{var e=Ou();return e.firstChild,e.$$click=()=>p(!0),Z(e,()=>pd(n()?.state.model),null),e})(),(()=>{var t=ku();return t.firstChild,t.$$click=async()=>{let t=n()?.state.thinkingLevel??`off`,i=r(),a=i[(i.indexOf(t)+1)%i.length];try{let t=await $.setThinking(e.sessionKey,a);e.store.setRuntimeThinkingLevel(e.sessionKey,a,t.settingsRevision)}catch(e){F(e instanceof Error?e.message:String(e))}},Z(t,()=>n()?.state.thinkingLevel??`—`,null),t})()]}}),f),f.$$click=mn,Z(f,()=>u()?`stopping runtime…`:`stop runtime`),j(t=>{var n=$.exportHtmlUrl(e.sessionKey),r=u();return n!==t.e&&X(i,`href`,t.e=n),r!==t.t&&(f.disabled=t.t=r),t},{e:void 0,t:void 0}),t}})]}}),null),Z(l,W(st,{get banners(){return zn()}}),M);var R=it;typeof R==`function`?Pe(R,M):it=M;var z=ct;return typeof z==`function`?Pe(z,N):ct=N,Z(N,W(K,{get when(){return t()},get fallback(){return Xu()},get children(){return[W(G,{get each(){return t().widgets.above},children:e=>(()=>{var t=Zu();return Z(t,e),t})()}),W(Oc,{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(Od,{get request(){return e()},onRespond:Dt,onStop:()=>void pn(),get stopping(){return c()}})}),W(G,{get each(){return t().widgets.below},children:e=>(()=>{var t=Zu();return Z(t,e),t})()})]}})),L.$$click=()=>x(!b()),Z(L,(()=>{var e=J(()=>!!mt());return()=>e()?`closed`:b()?`compose ▴`:`compose ▾`})()),Z(I,W(K,{get when(){return b()},get children(){var e=ju();return Z(e,(()=>{var e=J(()=>!!yt());return()=>e()?`agent working — open controls to stop or steer`:J(()=>Pn().length>0)()?`${Pn().length} queued message(s)`:`composer hidden for transcript reading`})()),e}}),null),Z(P,W(K,{get when(){return!b()},get children(){var n=Wu();return Z(n,W(K,{get when(){return bn().length>0||_n().length+vn().length>0||yt()||bt().length>0},get children(){var n=Lu();return Z(n,W(K,{get when(){return bn().length>0},get children(){var e=Mu(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.nextSibling.nextSibling;r.nextSibling;var i=t.nextSibling;return Z(t,xn,n),Z(t,()=>bn().length,r),Z(i,W(G,{get each(){return bn()},children:e=>(()=>{var t=Qu(),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=!Cn()),e}}),null),Z(n,W(K,{get when(){return _n().length+vn().length>0},get children(){var t=Nu(),n=t.firstChild,r=n.firstChild.nextSibling,i=r.nextSibling.nextSibling;i.nextSibling;var a=n.nextSibling;return Z(n,()=>_n().length,r),Z(n,()=>vn().length,i),Z(a,W(G,{get each(){return yn()},children:t=>(()=>{var n=$u(),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()?mt()?`○`:`●`: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`&&!mt()?`live`:`done`)),n})()})),j(()=>t.open=!Cn()),t}}),null),Z(n,W(K,{get when(){return yt()||bt().length>0},get children(){var e=Iu();return Z(e,W(K,{get when(){return ht()},get children(){var e=Pu();return e.firstChild,Z(e,(()=>{var e=J(()=>!!t()?.workingText);return()=>e()?` — ${t().workingText}`:``})(),null),Z(e,(()=>{var e=J(()=>ee()>2);return()=>e()?` (${ee()}s)`:``})(),null),e}}),null),Z(e,W(G,{get each(){return bt()},children:e=>(()=>{var t=ed();return t.firstChild,t.$$click=()=>hn(e.key),Z(t,()=>e.key,null),t})()}),null),Z(e,W(K,{get when(){return yt()},get children(){var e=Fu();return e.$$click=pn,Z(e,()=>c()?`stopping…`:`■ stop`),j(()=>e.disabled=c()),e}}),null),e}}),null),n}}),null),Z(n,W(K,{get when(){return!mt()},get fallback(){return td()},get children(){var n=Uu(),r=n.firstChild,c=r.nextSibling,l=c.firstChild,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling;Z(n,W(K,{get when(){return Pn().length>0},get children(){var e=Ru(),t=e.firstChild;return Z(e,W(G,{get each(){return Pn()},children:e=>(()=>{var t=nd(),n=t.firstChild;return Z(n,()=>e.kind),Z(t,()=>e.text,null),j(()=>X(t,`title`,e.text)),t})()}),t),t.$$click=Vt,e}}),r),Z(n,W(K,{get when(){return be().length>0||U().length>0},get children(){var e=zu();return Z(e,W(G,{get each(){return be()},children:(e,t)=>(()=>{var n=rd(),r=n.firstChild;r.firstChild;var i=r.nextSibling,a=i.nextSibling;return Z(r,()=>e.fileName,null),Z(i,()=>Sd(e.size)),a.$$click=()=>xe(e=>e.filter((e,n)=>n!==t())),j(()=>X(n,`title`,e.path)),n})()}),null),Z(e,W(G,{get each(){return U()},children:(e,t)=>(()=>{var n=id(),r=n.firstChild,i=r.nextSibling;return i.$$click=()=>Nt(t()),j(t=>{var i=`${e.fileName} (${Sd(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}}),r),Z(n,W(K,{get when(){return Ln()},get children(){var e=Bu();return Z(e,W(G,{get each(){return In()},children:(e,t)=>(()=>{var n=od(),r=n.firstChild;r.firstChild;var i=r.nextSibling;return n.$$click=()=>Rn(e),n.addEventListener(`mouseenter`,()=>fe(t())),Z(r,()=>e.name,null),Z(n,W(K,{get when(){return e.description},get children(){var t=ad();return Z(t,()=>e.description),t}}),i),Z(i,()=>e.source),j(e=>{var r=`command-option-${t()}`,i=de()===t(),a=de()===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}}),r),r.$$keydown=t=>{if(Ln()){if(t.key===`ArrowDown`){t.preventDefault(),fe((de()+1)%In().length);return}if(t.key===`ArrowUp`){t.preventDefault(),fe((de()-1+In().length)%In().length);return}if(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey&&!Cn()){t.preventDefault();let e=In()[de()];e&&t.key===`Enter`&&i()===`/${e.name}`?(ue(!0),fn()):e&&Rn(e);return}if(t.key===`Escape`){t.preventDefault(),ue(!0);return}}if((t.key===`ArrowUp`||t.key===`ArrowDown`)&&(i()===``||Se()!==void 0)){let n=bl(e.sessionKey);if(n.length>0){if(t.preventDefault(),t.key===`ArrowUp`){let e=Se()===void 0?n.length-1:Math.max(0,Se()-1);Ce(e),a(n[e]??``)}else if(Se()!==void 0){let e=Se()+1;e>=n.length?(Ce(void 0),a(``)):(Ce(e),a(n[e]??``))}}return}t.key===`Enter`&&!t.shiftKey&&!Cn()&&(t.preventDefault(),fn())},r.$$input=e=>{ue(!1),fe(0),Ce(void 0),a(e.currentTarget.value),Td(e.currentTarget)},r.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(),Wt(t))});var m=lt;typeof m==`function`?Pe(m,r):lt=r,l.addEventListener(`change`,e=>{Kt(e.currentTarget.files??[]),e.currentTarget.value=``});var h=ut;typeof h==`function`?Pe(h,l):ut=l,u.addEventListener(`change`,e=>{Wt(e.currentTarget.files??[]),e.currentTarget.value=``});var g=dt;return typeof g==`function`?Pe(g,u):dt=u,d.$$click=()=>ut?.click(),f.$$click=()=>dt?.click(),Z(c,W(K,{get when(){return ht()},get children(){var e=Vu(),t=e.firstChild,n=t.nextSibling;return t.$$click=()=>s(`steer`),n.$$click=()=>s(`follow_up`),j(e=>{var r=o()===`steer`,i=o()===`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}}),p),Z(c,W(K,{get when(){return t()?.suggestedCommand},get children(){var e=Hu(),n=e.firstChild.nextSibling;return e.$$click=()=>a(t().suggestedCommand),Z(n,()=>t().suggestedCommand),e}}),p),p.$$click=fn,j(e=>{var t=ht()?`Message dreb — sends as steer while it works…`:`Message dreb…`,n=Ln()?`command-listbox`:void 0,i=Ln()?`command-option-${de()}`:void 0;return t!==e.e&&X(r,`placeholder`,e.e=t),n!==e.t&&X(r,`aria-controls`,e.t=n),i!==e.a&&X(r,`aria-activedescendant`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),j(()=>r.value=i()),n}}),null),n}}),null),Z(l,W(K,{get when(){return t()?.uiRequests.find(e=>e.method!==`ask`)},keyed:!0,children:e=>W(Ed,{request:e,onRespond:Dt})}),null),Z(l,W(K,{get when(){return f()},get children(){return W(Ad,{get sessionKey(){return e.sessionKey},get state(){return n()?.state},get initialFilter(){return m()},onClose:()=>{p(!1),h(``)},onSelected:t=>e.store.setRuntimeModel(e.sessionKey,t)})}}),null),Z(l,W(K,{get when(){return S()},get children(){return W(ot,{title:`compact context`,onDismiss:()=>C(!1),get actions(){return[(()=>{var e=Dl();return e.$$click=()=>C(!1),e})(),(()=>{var t=sd();return t.$$click=async()=>{C(!1);try{await $.compact(e.sessionKey)}catch(e){F(e instanceof Error?e.message:String(e))}},t})()]},get children(){return Gu()}})}}),null),Z(l,W(K,{get when(){return E()},get children(){return W(kd,{get resources(){return pe()},get error(){return he()},onClose:()=>D(!1)})}}),null),Z(l,W(K,{get when(){return we()},get children(){return W(ot,{title:`fork from message`,onDismiss:()=>Te(!1),get children(){return[W(K,{get when(){return De()},get children(){var e=$l();return Z(e,De),e}}),W(K,{get when(){return q().length>0},get fallback(){return cd()},get children(){var e=hu();return Z(e,W(G,{get each(){return q()},children:e=>(()=>{var t=ld(),n=t.firstChild,r=n.nextSibling;return t.$$click=()=>en(e.entryId),Z(n,()=>e.role===`assistant`?`assistant`:`you`),Z(r,()=>e.text),t})()})),e}})]}})}}),null),Z(l,W(K,{get when(){return Y()},get children(){return W(Md,{get roots(){return je()},get leafId(){return Ne()},get loading(){return Ie()},get error(){return Re()},onClose:()=>ke(!1),onNavigate:Jt})}}),null),Z(l,W(K,{get when(){return Be()},get children(){return W(Nd,{get sessions(){return He()},get loading(){return We()},get error(){return Ke()},onClose:()=>Ve(!1),onResume:Xt})}}),null),Z(l,W(K,{get when(){return Je()},get children(){return W(Pd,{get initialPath(){return Xe()},get error(){return Qe()},onClose:()=>Ye(!1),onImport:Zt})}}),null),Z(l,W(K,{get when(){return w()},get children(){return W(Id,{get current(){return wn()??``},onClose:()=>T(!1),onRename:async t=>{try{await $.rename(e.sessionKey,t),T(!1)}catch(e){F(e instanceof Error?e.message:String(e))}}})}}),null),j(e=>{var t=!!v(),n=v()?`show session details`:`hide session details`,r=!!b(),i=mt()?`closed session transcript`:b()?`show composer and controls`:`hide composer and controls`,a=!!mt();return t!==e.e&&d.classList.toggle(`collapsed`,e.e=t),n!==e.t&&X(A,`title`,e.t=n),r!==e.a&&P.classList.toggle(`collapsed`,e.a=r),i!==e.o&&X(L,`title`,e.o=i),a!==e.i&&(L.disabled=e.i=a),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()}function Id(e){let[t,n]=k(e.current);return W(ot,{title:`rename session`,get onDismiss(){return e.onClose},get actions(){return[(()=>{var t=Dl();return je(t,`click`,e.onClose,!0),t})(),(()=>{var n=ud();return n.$$click=()=>e.onRename(t().trim()),j(()=>n.disabled=!t().trim()),n})()]},get children(){var e=Tl(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e}})}ke([`input`,`click`,`keydown`]);var Ld=Y(`<div class=settings-error>`),Rd=Y(`<p class=muted>Loading scoped models…`),zd=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`),Bd=Y(`<option>`),Vd=Y(`<div class=settings-warning>This project defines enabledModels in .dreb/settings.json and shadows global writes.`),Hd=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`),Ud=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`),Wd=Y(`<span class="muted small">unsaved changes`),Gd=Y(`<span class="muted small">✓ saved`),Kd=Y(`<div class=scoped-models-actions><button type=button class="btn btn-small">reset</button><button type=button class="btn btn-primary btn-small">`),qd=Y(`<div class=settings-warning>`),Jd=Y(`<div class=scoped-model-order-row><span></span><div class=scoped-model-move-controls><button type=button>↑</button><button type=button>↓`),Yd=Y(`<p class="muted small">No matching models.`),Xd=Y(`<section class=scoped-model-provider><label class=scoped-model-provider-heading><input type=checkbox><span>`),Zd=Y(`<span class=model-name>`),Qd=Y(`<label class=scoped-model-choice><input type=checkbox><span class=model-id>`);function $d(e){return`${e.provider}/${e.id}`}function ef(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 tf(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($d):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 ef((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($d)??[],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($d)??[]: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($d),n=r()?C()?.models.map($d)??[]: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=zd(),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=Bd();return t.value=e,Z(t,e),t})()}),null),Z(i,W(K,{get when(){return x.error},get children(){var e=Ld();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 Rd()}}),null),Z(i,W(K,{get when(){return C()},children:e=>[W(K,{get when(){return e().settings.hasProjectEnabledModelsOverride},get children(){return Vd()}}),W(K,{get when(){return P()},children:e=>(()=>{var t=qd();return Z(t,e),t})()}),W(G,{get each(){return e().settings.scopeWarnings},children:e=>(()=>{var t=qd();return Z(t,()=>e.message),t})()}),W(G,{get each(){return h()},children:e=>(()=>{var t=qd();return Z(t,e),t})()}),W(K,{get when(){return p()},children:e=>(()=>{var t=Ld();return Z(t,e),t})()}),W(K,{get when(){return A()},children:e=>(()=>{var t=Ld();return Z(t,e),t})()}),(()=>{var i=Hd(),a=i.firstChild,o=a.nextSibling;return a.$$input=e=>n(e.currentTarget.value),o.$$click=()=>I(e().models.map($d)),j(()=>o.disabled=r()),j(()=>a.value=t()),i})(),(()=>{var t=Ud(),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=Jd(),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 Yd()},get children(){return W(G,{get each(){return O()},children:t=>(()=>{var n=Xd(),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=$d(e);return(()=>{var n=Qd(),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=Zd();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($d(e)))),n})()})}}),null),t})(),(()=>{var e=Kd(),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 Wd()}}),null),Z(e,W(K,{get when(){return d()},get children(){return Gd()}}),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 nf=[{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)`}],rf=nf.map(e=>e.id),af=[`system`,`light`,`dark`],of=`dreb.dashboard.theme`,sf=`dreb.dashboard.colorMode`,cf=`default`,lf=`system`;function uf(e){return typeof e==`string`&&rf.includes(e)}function df(e){return typeof e==`string`&&af.includes(e)}function ff(){if(typeof window>`u`)return cf;try{let e=window.localStorage.getItem(of);return uf(e)?e:cf}catch{return cf}}function pf(){if(typeof window>`u`)return lf;try{let e=window.localStorage.getItem(sf);return df(e)?e:lf}catch{return lf}}function mf(e,t,n){if(!(typeof window>`u`))try{t===n?window.localStorage.removeItem(e):window.localStorage.setItem(e,t)}catch{}}var[hf,gf]=k(ff()),[_f,vf]=k(pf()),yf=hf,bf=_f;function xf(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 Sf(e){try{let t=e??(typeof document<`u`?document:void 0);if(!t)return;let n=t.documentElement;if(!n)return;let r=hf(),i=_f();if(r===cf?n.removeAttribute(`data-theme`):n.setAttribute(`data-theme`,r),i===lf?n.removeAttribute(`data-color-mode`):n.setAttribute(`data-color-mode`,i),!(r!==cf||i!==lf))n.style.removeProperty(`color-scheme`);else{let e=i===`light`?`light`:i===`dark`?`dark`:`light dark`;n.style.setProperty(`color-scheme`,e)}}catch{}}function Cf(e){try{let t=e??(typeof document<`u`?document:void 0);if(!t)return;let n=xf(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 wf(e){let t=uf(e)?e:cf;gf(t),mf(of,t,cf),Sf(),Cf()}function Tf(e){let t=df(e)?e:lf;vf(t),mf(sf,t,lf),Sf(),Cf()}var Ef=null,Df=!1;function Of(){_f()===lf&&Cf()}function kf(e){e.key!==null&&e.key!==`dreb.dashboard.theme`&&e.key!==`dreb.dashboard.colorMode`||Af()}function Af(){gf(ff()),vf(pf()),Sf(),Cf()}function jf(){if(!(typeof window>`u`)){try{typeof window.matchMedia==`function`&&(Ef=window.matchMedia(`(prefers-color-scheme: dark)`),typeof Ef.addEventListener==`function`?Ef.addEventListener(`change`,Of):typeof Ef.addListener==`function`&&Ef.addListener(Of))}catch{}try{window.addEventListener(`storage`,kf)}catch{}}}function Mf(){Af(),!Df&&(Df=!0,jf())}var Nf=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>`),Pf=Y(`<option>`),Ff=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>`),If=[`running`,`attention`,`idle`,`error`];function Lf(){let e=()=>{let e=bf();return e===`system`?void 0:e};return(()=>{var t=Nf(),n=t.firstChild,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling;return r.addEventListener(`change`,e=>Tf(e.currentTarget.value)),Z(r,W(G,{each:af,children:e=>(()=>{var t=Pf();return t.value=e,Z(t,e),t})()})),Z(i,W(G,{each:nf,children:t=>{let n=()=>yf()===t.id;return(()=>{var r=Ff(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling.firstChild,l=c.nextSibling;return r.$$click=()=>wf(t.id),Z(o,()=>t.label),Z(s,W(G,{each:If,children:e=>W(nt,{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=bf()),t})()}ke([`click`]);var Rf=Y(`<select><option value=on>on</option><option value=off>off`),zf=Y(`<div class=field style=margin-bottom:8px><input type=text placeholder="search models…">`),Bf=Y(`<div class=model-list style=max-height:320px>`),Vf=Y(`<p class="muted small">No matching models.`),Hf=Y(`<section class=model-provider-group><div class=model-provider-heading>`),Uf=Y(`<span class=model-name>`),Wf=Y(`<span class=model-reasoning>think`),Gf=Y(`<button type=button class=model-row><span class=model-current></span><span class=model-id></span><span class=model-provider-badge>`),Kf=Y(`<div class=settings-error>`),qf=Y(`<div class=settings-warning>`),Jf=Y(`<p class="muted small"style=margin-bottom:16px>✓ saved`),Yf=Y(`<div class=settings-success>new pairing lifetime saved`),Xf=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>`),Zf=Y(`<p class="muted small"style=padding-top:8px>No remote devices paired. Launch with <code>--remote --allow <identity></code> to enable Tailscale access.`),Qf=Y(`<p>This exits the dashboard server process and terminates <strong>all running sessions</strong>.`),$f=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`),ep=Y(`<div>`),tp=Y(`<p class=muted>`),np=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>`),rp=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> `),ip=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`),ap=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.`),op=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>`),sp=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>`),cp=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>`),lp=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>`),up=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.`),dp=Y(`<option>`),fp=Y(`<p class="muted small">No agent definitions found.`),pp=Y(`<div class=agent-model-editor><button type=button class="btn btn-small">add model…`),mp=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">`),hp=Y(`<span class="muted small">default`),gp=Y(`<span class=agent-model-chip>. `),_p=Y(`<p class="muted small">Using the default model.`),vp=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">×`),yp=Y(`<p class="muted small trusted-context-empty">No trusted folders. Use the Files view to trust a project folder and its descendants.`),bp=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">`),xp=Y(`<label class=checkbox-control><input type=checkbox><span>`),Sp=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`),Cp=Y(`<button type=button class="btn btn-small">cancel`),wp=Y(`<button type=button class="btn btn-small btn-danger">restart`),Tp=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Ep=[`all`,`one-at-a-time`],Dp=[`sse`,`websocket`,`auto`];function Op(e){return`${e.provider}/${e.id}`}function kp(e){let t=Op(e);return e.name?`${t} — ${e.name}`:t}function Ap(e){return e.defaultProvider&&e.defaultModel?`${e.defaultProvider}/${e.defaultModel}`:`choose model…`}function jp(e,t){return`${e.provider}/${e.id} ${e.name??``}`.toLowerCase().includes(t)}function Mp(){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 Np(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 Pp(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 Fp(e){return(()=>{var t=Rf();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 Ip(e){let[t,n]=k(``),r=()=>new Set(e.selected??[]),i=N(()=>{let n=t().toLowerCase();return Np(e.models.filter(e=>!n||jp(e,n)).slice(0,100))}),a=e=>r().has(Op(e));return W(ot,{get title(){return e.title},get onDismiss(){return e.onClose},class:`model-picker-modal`,get children(){return[(()=>{var e=zf(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),(()=>{var t=Bf();return Z(t,W(K,{get when(){return i().length>0},get fallback(){return Vf()},get children(){return W(G,{get each(){return i()},children:t=>(()=>{var n=Hf(),r=n.firstChild;return Z(r,()=>t.provider),Z(n,W(G,{get each(){return t.models},children:t=>(()=>{var n=Gf(),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=Uf();return Z(e,()=>t.name),e}}),o),Z(o,()=>t.provider),Z(n,W(K,{get when(){return t.reasoning},get children(){return Wf()}}),null),j(e=>{var r=!!a(t),i=kp(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 Lp(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(Mp()),[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[ue]=F(async()=>{try{let{version:e}=await $.version();return e}catch{return}}),[de]=F(async()=>{try{return await $.serverInfo()}catch{return}}),[fe,pe]=k(!1),[me,he]=k(!1),[ge,_e]=k();async function ve(){_e(void 0),he(!0);try{await $.restartServer()}catch(e){_e(e instanceof Error?e.message:String(e)),he(!1)}}async function U(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 U({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&&!Tp.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=$f(),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,he=le.firstChild.firstChild.nextSibling,_e=le.nextSibling.firstChild.nextSibling.firstChild,ye=_e.nextSibling.nextSibling,be=ce.nextSibling,Y=be.firstChild.nextSibling;return Y.nextSibling,Z(i,W(it,{get store(){return e.store},active:`settings`}),o),Z(o,W(K,{get when(){return t()},get children(){var e=Kf();return Z(e,t),e}}),v),Z(o,W(K,{get when(){return r().length>0},get children(){var e=qf();return Z(e,W(G,{get each(){return r()},children:e=>(()=>{var t=ep();return Z(t,e),t})()})),e}}),v),Z(o,W(K,{get when(){return a()},get children(){return Jf()}}),v),Z(o,W(K,{get when(){return x()},get fallback(){return(()=>{var e=tp();return Z(e,()=>t()?`Settings could not be loaded — see the error above.`:`Loading settings…`),e})()},children:t=>[(()=>{var e=np(),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,()=>Ap(t())),Z(o,()=>Tp.join(` · `)),s.addEventListener(`change`,e=>U({defaultThinkingLevel:e.currentTarget.value})),Z(s,W(G,{each:Tp,children:e=>(()=>{var t=dp();return t.value=e,Z(t,e),t})()})),l.addEventListener(`change`,e=>U({transport:e.currentTarget.value})),Z(l,W(G,{get each(){return[...Dp]},children:e=>(()=>{var t=dp();return t.value=e,Z(t,e),t})()})),j(()=>s.value=t().defaultThinkingLevel??`off`),j(()=>l.value=t().transport??`sse`),e})(),W(tf,{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=rp(),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(Fp,{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:Tp,children:e=>(()=>{var t=dp();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`&&Tp.some(e=>e===t().subagentArbiter?.thinking)?t().subagentArbiter?.thinking:`off`),j(()=>d.value=typeof t().subagentArbiter?.guidePath==`string`?t().subagentArbiter?.guidePath:``),e})(),(()=>{var e=ap();return e.firstChild.nextSibling,Z(e,W(K,{get when(){return T().length>0},get children(){var e=ip(),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=dp();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 fp()},get children(){return W(G,{get each(){return E()??[]},children:e=>{let n=()=>t().agentModels?.[e.name]??[];return(()=>{var t=mp(),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 hp()},get children(){return W(G,{get each(){return n()},children:(e,t)=>(()=>{var n=gp(),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=pp(),r=t.firstChild;return Z(t,W(K,{get when(){return n().length>0},get fallback(){return _p()},get children(){return W(G,{get each(){return n()},children:(t,r)=>(()=>{var i=vp(),a=i.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,c=s.nextSibling;return Z(a,t),o.$$click=()=>void Ce(e.name,Pp(n(),r(),-1)),s.$$click=()=>void Ce(e.name,Pp(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=op(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Fp,{get value(){return t().imageAutoResize!==!1},onChange:e=>U({imageAutoResize:e})})),Z(i,W(Fp,{get value(){return t().blockImages===!0},onChange:e=>U({blockImages:e})})),e})(),(()=>{var e=sp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling.firstChild.nextSibling.firstChild;return r.addEventListener(`change`,e=>U({steeringMode:e.currentTarget.value})),Z(r,W(G,{get each(){return[...Ep]},children:e=>(()=>{var t=dp();return t.value=e,Z(t,e),t})()})),i.addEventListener(`change`,e=>U({followUpMode:e.currentTarget.value})),Z(i,W(G,{get each(){return[...Ep]},children:e=>(()=>{var t=dp();return t.value=e,Z(t,e),t})()})),j(()=>r.value=t().steeringMode??`all`),j(()=>i.value=t().followUpMode??`all`),e})(),(()=>{var e=cp(),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(Fp,{get value(){return t().enableSkillCommands!==!1},onChange:e=>U({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}U({maxConcurrentSubagents:i})}),Z(s,W(K,{get when(){return(t().trustedContextFolders??[]).length>0},get fallback(){return yp()},get children(){return W(G,{get each(){return t().trustedContextFolders??[]},children:e=>(()=>{var t=bp(),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(Fp,{get value(){return t().autoLoadNestedContext===!0},onChange:e=>U({autoLoadNestedContext:e})})),Z(p,W(Fp,{get value(){return t().hideThinkingBlock===!0},onChange:e=>U({hideThinkingBlock:e})})),j(()=>u.disabled=_()||!h().trim()),j(()=>o.value=t().maxConcurrentSubagents??4),j(()=>l.value=h()),e})(),(()=>{var e=lp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Fp,{get value(){return t().compactionEnabled!==!1},onChange:e=>U({compactionEnabled:e})})),Z(i,W(Fp,{get value(){return t().retryEnabled!==!1},onChange:e=>U({retryEnabled:e})})),e})(),up()]}),v),Z(b,W(Lf,{}),null),C.addEventListener(`change`,e=>us(e.currentTarget.value)),M.addEventListener(`change`,e=>ls(e.currentTarget.checked)),Z(P,W(G,{each:Go,children:e=>(()=>{var t=xp(),n=t.firstChild,r=n.nextSibling;return n.addEventListener(`change`,t=>ds(e,t.currentTarget.checked)),X(n,`id`,`pref-tool-expand-${e}`),Z(r,e),j(()=>n.checked=fs(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,()=>de()?.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=()=>pe(!0),Z(H,()=>me()?`restarting…`:`restart`),Z(v,W(K,{get when(){return ge()},get children(){var e=Kf();return Z(e,ge),e}}),null),Z(he,()=>Oe()?.mode===`local`?`local`:`host`),_e.$$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 Yf()}}),null),Z(ce,W(K,{get when(){return A()},get children(){var e=Kf();return Z(e,A),e}}),null),Z(ce,W(K,{get when(){return J(()=>!!oe()?.enabled)()&&oe()?.code},get children(){var e=Xf(),t=e.firstChild.nextSibling.firstChild;return Z(t,()=>oe().code),e}}),null),Z(ce,W(G,{get each(){return D()??[]},children:e=>(()=>{var t=Sp(),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,()=>lt(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 Zf()}}),null),Z(be,(()=>{var e=J(()=>!!de()?.version);return()=>e()?` v${de().version}`:J(()=>!!ue())()?` v${ue()}`:``})(),Y),Z(be,W(K,{get when(){return de()?.startedAt},get children(){return[` · server build, up `,J(()=>lt(de().startedAt))]}}),null),Z(i,W(K,{get when(){return fe()},get children(){return W(ot,{title:`restart dashboard service?`,onDismiss:()=>pe(!1),get actions(){return[(()=>{var e=Cp();return e.$$click=()=>pe(!1),e})(),(()=>{var e=wp();return e.$$click=()=>{pe(!1),ve()},e})()]},get children(){var e=Qf();return e.firstChild.nextSibling.nextSibling,Z(e,()=>de()?.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(Ip,{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"){U({defaultProvider:t.provider,defaultModel:t.id});return}if(n.kind===`arbiter`){Se({model:Op(t)});return}let r=Op(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=me(),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=cs()),j(()=>M.checked=ss()),j(()=>te.checked=y()===`granted`),j(()=>_e.value=ne()),i})()}ke([`input`,`click`]);var Rp=Y(`<div class="status-line arbitration-history">`),zp=Y(`<p class=pair-error>`),Bp=Y(`<div class=status-line><span class=working>● working`),Vp=Y(`<output class=pending-chips aria-label="pending subagent steering messages">`),Hp=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">`),Up=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>`),Wp=Y(`<span>arbiter: `),Gp=Y(`<p class=muted>`),Kp=Y(`<div class=readonly-note>`),qp=Y(`<span class=pending-chip>steer: `);function Jp(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 Yp(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=()=>t()?.closed,y=()=>!v()&&n()?.status===`running`,b=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,x,S,C,w=zo({scroller:()=>x});R(()=>{let t=new AbortController;v()||e.store.hydrateSubagent(e.sessionKey,e.agentId,t.signal).catch(e=>{t.signal.aborted&&hl(e)||v()||s(e instanceof Error?e.message:String(e))}),z(()=>t.abort())}),M(()=>{e.store.revisions[e.sessionKey],w.notifyContentChanged()}),R(()=>{w.observeContent(C),w.observeViewport(x),x&&z(Vo(w,x,{keyboard:`window`}))}),z(()=>w.dispose());async function T(){if(y())try{let t=await $.subagentPending(e.sessionKey,e.agentId);h(t.steeringMode),_(t.pending),p(void 0)}catch(e){v()||p(e instanceof Error?e.message:String(e))}}R(()=>{T();let e=window.setInterval(()=>{y()&&T()},1e3);z(()=>window.clearInterval(e))}),M(()=>{c(),S&&queueMicrotask(()=>S&&Td(S))});async function E(){let t=c();if(!(!t.trim()||u()||!y())){d(!0),p(void 0);try{await $.steerSubagent(e.sessionKey,e.agentId,t),l(``),await T()}catch(e){v()||p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}let D=N(()=>{let n=[],r=v();if(r&&!r.bannerDismissed){let t=[];r.cwd&&r.sessionFile&&t.push({label:r.resuming?`resuming…`:`Resume session`,run:()=>e.store.resumeClosedSession(e.sessionKey),disabled:r.resuming}),t.push({label:`Return to fleet`,run:()=>e.store.navigate({screen:`fleet`}),disabled:r.resuming}),n.push({key:`closed`,text:`session ${e.sessionKey} was closed${r.resumeError?`\nResume failed: ${r.resumeError}`:``}`,tone:r.resumeError?`error`:`warning`,onDismiss:()=>e.store.dismissClosedBanner(e.sessionKey),actions:t})}for(let r of t()?.statusEntries??[])r.dismissed||n.push({key:`status:${r.id}`,text:r.text,tone:r.tone,onDismiss:()=>e.store.dismissStatusBanner(e.sessionKey,r.id)});for(let r of t()?.toasts??[])n.push({key:`toast:${r.id}`,text:r.text,tone:r.tone,onDismiss:()=>e.store.dismissToast(r.id)});return n});return(()=>{var t=Up(),i=t.firstChild,s=i.firstChild.firstChild;s.firstChild;var d=s.nextSibling;d.firstChild;var p=d.nextSibling,h=p.nextSibling,_=i.nextSibling,w=_.firstChild,T=_.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 y()},get fallback(){return W(nt,{get status(){return!v()&&n()?.status===`failed`?`error`:`idle`},get label(){return J(()=>!!v())()?`closed`:n()?.status}})},get children(){return W(nt,{status:`running`})}})),Z(t,W(st,{get banners(){return D()}}),_);var O=x;typeof O==`function`?Pe(O,_):x=_;var k=C;return typeof k==`function`?Pe(k,w):C=w,Z(w,W(K,{get when(){return(n()?.arbitrations?.length??0)>0},get children(){var e=Rp();return Z(e,W(G,{get each(){return n()?.arbitrations??[]},children:e=>(()=>{var t=Wp();return t.firstChild,Z(t,()=>Jp(e),null),j(()=>Ae(t,e.status===`failure`?`error-reason`:`muted`)),t})()})),e}}),null),Z(w,W(K,{get when(){return o()},get children(){var e=zp();return Z(e,o),e}}),null),Z(w,W(K,{get when(){return J(()=>!!r())()&&r().entries.length>0},get fallback(){return(()=>{var e=Gp();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(Oc,{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(T,W(K,{get when(){return r()?.streaming},get children(){return Bp()}}),null),Z(T,W(K,{get when(){return y()},get fallback(){return(()=>{var e=Kp();return Z(e,()=>v()?`This session is closed; the subagent transcript is read-only.`:`This subagent is no longer running; its transcript is read-only.`),e})()},get children(){return[W(K,{get when(){return f()},get children(){var e=zp();return Z(e,f),e}}),W(K,{get when(){return g().steering.length>0},get children(){var e=Vp();return Z(e,W(G,{get each(){return g().steering},children:e=>(()=>{var t=qp();return t.firstChild,Z(t,e,null),t})()})),e}}),(()=>{var e=Hp(),t=e.firstChild,n=t.nextSibling.firstChild;n.firstChild;var r=n.nextSibling;t.$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!b()&&(e.preventDefault(),E())},t.$$input=e=>{l(e.currentTarget.value),Td(e.currentTarget)};var i=S;return typeof i==`function`?Pe(i,t):S=t,Z(n,()=>m()??`loading…`,null),r.$$click=()=>void E(),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 Xp=Symbol(`store-raw`),Zp=Symbol(`store-node`),Qp=Symbol(`store-has`),$p=Symbol(`store-self`);function em(e){let t=e[p];if(!t&&(Object.defineProperty(e,p,{value:t=new Proxy(e,cm)}),!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 tm(e){let t;return typeof e==`object`&&!!e&&(e[p]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function nm(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Xp])return n;if(!tm(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=nm(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=nm(i,t))!==i&&(e[a]=r))}return e}function rm(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function im(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 am(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===p||t===Zp?n:(delete n.value,delete n.writable,n.get=()=>e[p][t],n)}function om(e){ee()&&im(rm(e,Zp),$p)()}function sm(e){return om(e),Reflect.ownKeys(e)}var cm={get(e,t,n){if(t===Xp)return e;if(t===p)return n;if(t===m)return om(e),n;let r=rm(e,Zp),i=r[t],a=i?i():e[t];if(t===Zp||t===Qp||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=im(r,t,a)())}return tm(a)?em(a):a},has(e,t){return t===Xp||t===p||t===m||t===Zp||t===Qp||t===`__proto__`?!0:(ee()&&im(rm(e,Qp),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:sm,getOwnPropertyDescriptor:am};function lm(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[Qp]&&e[Qp][t]&&i!==void 0&&e[Qp][t].$()):(e[t]=n,e[Qp]&&e[Qp][t]&&i===void 0&&e[Qp][t].$());let o=rm(e,Zp),s;if((s=im(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=im(o,`length`,a))&&s.$(e.length)}(s=o[$p])&&s.$()}function um(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];dm(i)||lm(e,i,t[i])}}function dm(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function fm(e,t){if(typeof t==`function`&&(t=t(e)),t=nm(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&&lm(e,n,r)}lm(e,`length`,r)}else um(e,t)}function pm(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&&dm(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)pm(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&pm(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)pm(e,[r].concat(t),n);return}else if(t.length>1){pm(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=nm(a),r===void 0||tm(i)&&tm(a)&&!Array.isArray(a)?um(i,a):lm(e,r,a))}function mm(...[e,t]){let n=nm(e||{}),r=Array.isArray(n),i=em(n);function a(...e){I(()=>{r&&e.length===1?fm(n,e[0]):pm(n,e)})}return[i,a]}var hm=new WeakMap,gm={get(e,t){if(t===Xp)return e;let n=e[t];if(t===p||t===m||t===Zp||t===Qp||t===`__proto__`)return n;let r;return tm(n)?hm.get(n)||(hm.set(n,r=new Proxy(n,gm)),r):n},set(e,t,n){return lm(e,t,nm(n)),!0},deleteProperty(e,t){return lm(e,t,void 0,!0),!0}};function _m(e){return t=>{if(tm(t)){let n;(n=hm.get(t))||hm.set(t,n=new Proxy(t,gm)),e(n)}return t}}function vm(){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 ym(e){return e.screen===`session`||e.screen===`subagent`?e.key:void 0}function bm(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 xm=2e3,Sm=3*1024*1024,Cm=xm,wm=Sm,Tm=3e4,Em=1e4,Dm=1e3,Om=3e4,km=5e3,Am=5*6e4,jm=2147e6,Mm=new TextEncoder;function Nm(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(nn({key:`retry`,text:`retrying (attempt ${r})${n}`,tone:`warning`}))}pn(e,t,n.isStreaming||n.isRetrying||n.isCompacting)}function Pm(){let[e,t]=mm({}),[n,r]=mm({}),[i,a]=k(vm()),[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=new Map,ne=new Map,re=0,ie=0,ae,B,oe,V=0,se=new Set,H=!1;function ce(t,n){let r=ym(t);!r||r===ym(n)||!e[r]?.closed||Se(r)}function le(){let e=vm();ce(i(),e),a(e)}window.addEventListener(`hashchange`,le);function ue(e){ce(i(),e),window.location.hash=bm(e)}function de(e){return n[e]??0}function fe(e){return C.get(e)??0}function pe(e){return w.get(e)??0}function me(e){w.set(e,pe(e)+1)}function he(e){C.set(e,fe(e)+1)}function ge(e){return{revision:de(e),generation:fe(e),epoch:E}}function _e(e,t){return fe(e)===t.generation&&E===t.epoch}function ve(e,t){return de(e)===t.revision&&_e(e,t)}function U(e,t){t&&T.get(e)!==t||(T.delete(e),t&&(t.queued=[],t.queuedBytes=0))}function ye(e){r(e,de(e)+1)}function be(n){e[n]||t(n,Gt(n))}function xe(e,n){be(e),t(e,_m(n)),ye(e)}function Se(e){U(e),he(e),w.delete(e),t(e,void 0),r(e,void 0),Sl(e)}function Ce(){return ym(vm())}function W(e,t=`info`){--D,S(n=>[...n,{id:D,text:e,tone:t}].slice(-20))}function we(){B!==void 0&&clearTimeout(B),B=void 0,oe=void 0,V=0}function G(e){if(H||oe!==e)return;let t=e-Date.now();if(t<=0){B=void 0,Ee(e);return}B=setTimeout(()=>G(e),Math.min(t,jm))}function K(e){if(we(),!e)return;let t=Date.parse(e);if(!Number.isFinite(t)){W(`Dashboard returned an invalid pairing-expiry check time`,`error`);return}oe=t,G(t)}function Te(e){if(H||oe!==e)return;V+=1;let t=Math.min(10,V-1),n=Math.min(Am,km*2**t);B=setTimeout(()=>{B=void 0,!H&&oe===e&&Ee(e)},n)}function q(e){e.pairingExpiryWarning&&W(`This device pairing expires on ${e.pairingExpiryWarning.expiresAt.slice(0,10)}. Re-pair before then to avoid losing remote access.`,`warning`)}function J(e){_(e),q(e),K(e.pairingExpiryCheckAt)}async function Ee(e){try{let t=await $.auth();if(H)return;if(oe!==e){q(t);return}if((t.pairingExpiryCheckAt?Date.parse(t.pairingExpiryCheckAt):void 0)===e&&e<=Date.now()){_(t),q(t),Te(e);return}J(t)}catch(t){if(H||oe!==e)return;if(t?.status===401||t?.status===403){we(),_({mode:`remote`,needsPairing:t?.body?.needsPairing??!1,identity:t?.body?.identity,error:t?.message}),ue({screen:`pairing`});return}V===0&&W(`Could not check pairing expiry: ${t instanceof Error?t.message:String(t)}`,`error`),Te(e)}}function De(e){return R.get(e)??0}function Oe(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=De(e)+1;R.set(e,t),n===void 0?z.set(e,t):ee.set(e,Math.max(ee.get(e)??-1,n))}}function Y(e,t){s(n=>{let r=e(n);return L+=1,Oe(n.runtimes,r.runtimes,t),r})}function ke(e){se.clear(),te.clear(),ne.clear(),Y(()=>e)}function X(e,t){let n=te.get(e.key);if(!n)return e.state;let r={...e.state},i=e.settingsRevision??0;return n.model&&(i>=n.model.settingsRevision?delete n.model:r.model=t?.state.model??n.model.value),n.thinkingLevel&&(i>=n.thinkingLevel.settingsRevision?delete n.thinkingLevel:r.thinkingLevel=t?.state.thinkingLevel??n.thinkingLevel.value),n.availableThinkingLevels&&(i>=n.availableThinkingLevels.settingsRevision?delete n.availableThinkingLevels:r.availableThinkingLevels=t?.state.availableThinkingLevels??n.availableThinkingLevels.value),n.model===void 0&&n.thinkingLevel===void 0&&n.availableThinkingLevels===void 0&&te.delete(e.key),r}function Ae(e,t){let n=new Set(e.filter(e=>!se.has(e.key)).map(e=>e.key)),r=n.size!==o().runtimes.length||o().runtimes.some(e=>!n.has(e.key));Y(t=>{let n=new Map(t.runtimes.map(e=>[e.key,e]));return{...t,runtimes:e.filter(e=>!se.has(e.key)).map(e=>{let t=n.get(e.key);return{...e,state:{...X(e,t),contextUsage:t?.state.contextUsage??e.state.contextUsage},...t?.stats===void 0?{}:{stats:t.stats},...t?.lastAssistantText===void 0?{}:{lastAssistantText:t.lastAssistantText}}})}},t),r&&Le().catch(()=>{})}function je(e,t){U(e),he(e),xe(e,e=>{let n=e.closed;e.closed={...t?.cwd||n?.cwd?{cwd:n?.cwd??t?.cwd}:{},...t?.state.sessionFile||n?.sessionFile?{sessionFile:n?.sessionFile??t?.state.sessionFile}:{},...n?.bannerDismissed?{bannerDismissed:!0}:{},...n?.resuming?{resuming:!0}:{},...n?.resumeError?{resumeError:n.resumeError}:{}},e.streaming=!1,e.compacting=!1,e.workingSince=void 0,e.workingText=void 0,e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`&&e.key!==`paused`&&e.key!==`compaction`),e.suggestedCommand=void 0,e.uiRequests=[];for(let t of Object.values(e.subagents))t.streaming=!1;cn(e)})}function Me(e,t,n=!0){let r=t??o().runtimes.find(t=>t.key===e),i=se.has(e);return se.add(e),te.delete(e),ne.delete(e),i||Y(t=>({...t,runtimes:t.runtimes.filter(t=>t.key!==e)})),Ce()===e?je(e,r):Se(e),i||!n?Promise.resolve():Le()}async function Ne(e){let t=o().runtimes.find(t=>t.key===e);try{await $.stopRuntime(e)}catch(t){if(se.has(e))return;throw t}await Me(e,t)}function Pe(t,n){e[t]?.statusEntries.some(e=>e.id===n)&&xe(t,e=>{let t=e.statusEntries.find(e=>e.id===n);t&&(t.dismissed=!0)})}function Z(t){e[t]?.closed&&xe(t,e=>{e.closed&&(e.closed.bannerDismissed=!0)})}async function Fe(t){let n=e[t]?.closed;if(!n||n.resuming)return;if(!n.cwd||!n.sessionFile){xe(t,e=>{e.closed&&(e.closed.resumeError=`This closed session has no captured resume path.`)});return}let r=n.cwd,i=n.sessionFile;xe(t,e=>{e.closed&&(e.closed.resuming=!0,e.closed.resumeError=void 0)});let a;try{a=await $.createRuntime(r,{sessionPath:i})}catch(n){let r=n instanceof Error?n.message:String(n);if(!e[t]?.closed)return;xe(t,e=>{e.closed&&(e.closed.resuming=!1,e.closed.resumeError=r,e.closed.bannerDismissed=!1)});return}Re(a),Le().catch(()=>{}),ue({screen:`session`,key:a.key})}function Ie(){let e=++re,t=L;return $.fleet().then(n=>{e!==re||t!==L||(ke(n),l(void 0))},n=>{throw e===re&&t===L&&l(n instanceof Error?n.message:String(n)),n})}function Le(){let e=++ie;return $.sessions().then(t=>{e===ie&&(Y(e=>({...e,diskSessions:t.sessions})),l(void 0))},t=>{throw e===ie&&l(t instanceof Error?t.message:String(t)),t})}function Re(e){se.delete(e.key),Y(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 ze(e,t,n,r){if(o().runtimes.some(t=>t.key===e)){if(n!==void 0&&De(e)!==n){let t=z.get(e)??0,i=ee.get(e);if(t>n||i===void 0||i>r)return}Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:t}:n)}))}}function Be(e,t){let n=o().runtimes.find(t=>t.key===e),r=te.get(e)??{};(n?.settingsRevision??0)>=t.settingsRevision?(delete r.model,delete r.thinkingLevel,delete r.availableThinkingLevels):(r.model={value:t.model,settingsRevision:t.settingsRevision},r.thinkingLevel={value:t.thinkingLevel,settingsRevision:t.settingsRevision},r.availableThinkingLevels={value:[...t.availableThinkingLevels],settingsRevision:t.settingsRevision}),r.model===void 0&&r.thinkingLevel===void 0&&r.availableThinkingLevels===void 0?te.delete(e):te.set(e,r),!((n?.settingsRevision??0)>=t.settingsRevision)&&Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,model:t.model,thinkingLevel:t.thinkingLevel,availableThinkingLevels:[...t.availableThinkingLevels]}}:n)}))}function Ve(e,t,n){let r=o().runtimes.find(t=>t.key===e),i=te.get(e)??{};(r?.settingsRevision??0)>=n?delete i.thinkingLevel:i.thinkingLevel={value:t,settingsRevision:n},i.model===void 0&&i.thinkingLevel===void 0&&i.availableThinkingLevels===void 0?te.delete(e):te.set(e,i),!((r?.settingsRevision??0)>=n)&&Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,thinkingLevel:t}}:n)}))}function He(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}}}async function Ue(e,t){let n=(ne.get(e)??0)+1;ne.set(e,n);let r=De(e),i=await $.stats(e,t);return ne.get(e)!==n||!o().runtimes.some(t=>t.key===e)||Y(t=>({...t,runtimes:t.runtimes.map(t=>t.key===e?He(t,i,De(e)!==r):t)})),i}function We(e){let t=new AbortController,n,r=new Promise((r,i)=>{n=setTimeout(()=>{let n=Error(`Stats request for runtime ${e} timed out after ${Em} ms`);i(n),t.abort(n)},Em)});return Promise.race([$.stats(e,t.signal),r]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Ge(){if(ae)return ae;let e=o().runtimes.map(e=>e.key),t=new Map(e.map(e=>[e,De(e)])),n=e.map(e=>We(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&&Y(e=>({...e,runtimes:e.runtimes.map(e=>{let n=r.get(e.key),i=t.get(e.key),a=i===void 0||De(e.key)!==i;return n?He(e,n,a):e})})),d(i.length>0?i.join(`; `):void 0)}).finally(()=>{ae===r&&(ae=void 0)});return ae=r,r}function Ke(e){return Mm.encode(JSON.stringify(e)).byteLength}function qe(e){e.queued=[],e.queuedBytes=0}function Je(){j!==void 0&&clearTimeout(j),j=void 0}function Ye(){return Math.min(Om,Dm*2**Math.max(0,P-1))}function Xe(){if(H||j!==void 0)return;P+=1;let e=Ye();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,tt()},e)}function Ze(){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 Qe(e){let t=e.event?.type;t===`fleet_snapshot`?Ae(e.event.runtimes,e.seq):t===`disk_sessions_changed`?Le().catch(()=>{}):t===`runtime_removed`?e.key&&Me(e.key).catch(()=>{}):e.key&&(xe(e.key,t=>vn(t,e.event)),t===`tasks_update`&&me(e.key))}function $e(e){let t=e.subagent;xe(e.key,n=>{let r=e.messages;if(n.closed=void 0,n.entries=$t(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=>Wt(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,Nm(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])),sn(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:$t(t.messages),streaming:r.status===`running`}}cn(n)}),me(e.key)}function et(e,t){if(A!==e||e.state!==`active`||e.barrierSeq===void 0)return;Je(),P=0,Ze();let n=e.barrierSeq;I=n;let r=Ce(),i=r?o().runtimes.find(e=>e.key===r):void 0;ke(t.fleet),l(void 0),t.active?$e(t.active):r&&Me(r,i,!1).catch(()=>{});let a=[...e.queued].sort((e,t)=>e.seq-t.seq),s=t.active?.subagent;if(s&&t.active)for(let e of a)e.seq>s.barrierSeq&&e.seq<=n&&e.key===t.active.key&&e.event.type===`background_agent_event`&&String(e.event.agentId)===s.agentId&&Qe(e);for(let e of a)e.seq>n&&Qe(e);qe(e),A=void 0,h(!1),p(void 0)}function tt(e=!1){if(H)return Promise.resolve();if(O)return(e||A?.state===`failed`)&&(F=!0),O;Je();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)U(e,t);h(!0),p(void 0);let o=setTimeout(()=>a.controller.abort(`Dashboard recovery timed out`),Tm),s=$.resync(n,r,a.controller.signal).then(e=>{a.barrierSeq=e.barrierSeq,et(a,e)}).catch(e=>{if(A!==a)return;a.state=`failed`,qe(a);let t=a.controller.signal.reason;p(typeof t==`string`?t:e instanceof Error?e.message:String(e)),Xe(),j===void 0&&h(!1)}).finally(()=>{clearTimeout(o),O===s&&(O=void 0),!H&&F&&(F=!1,tt())});return O=s,s}function nt(){return tt(!0)}function rt(e){if(e.event?.type===`dashboard_resync`){tt(!0);return}if(A){if(A.state===`failed`)throw Xe(),Error(`Dashboard recovery is failed; refusing to acknowledge live envelope before resync succeeds`);let t=Ke(e);if(A.queued.length>=xm||A.queuedBytes+t>Sm){qe(A),A.state=`failed`;let e=`Dashboard recovery queue overflowed; waiting for a newer authoritative snapshot`;throw p(e),A.controller.abort(e),Xe(),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=Ke(e);if(t.queued.length>=Cm||t.queuedBytes+n>wm)throw U(e.key,t),Error(`Dashboard hydration queue overflowed for ${e.key}; refusing an incomplete snapshot replay`);t.queued.push(e),t.queuedBytes+=n}Qe(e)}let it;async function at(){H=!1;try{J(await $.auth())}catch(e){_({mode:`remote`,needsPairing:e?.body?.needsPairing??!1,identity:e?.body?.identity,error:e?.message}),ue({screen:`pairing`});return}await Ie().catch(()=>{}),it=St({onEnvelope:rt,onAuthStatus:J,onStatusChange:e=>{N=!1,M=e.state===`connected`?e:void 0,y(e)},onRecovery:()=>{tt()}})}function ot(){H=!0,it?.(),we(),Je(),M=void 0,N=!1,F=!1;let e=A;A=void 0,e&&qe(e),e?.controller.abort(`Dashboard stopped`);for(let[e,t]of T)U(e,t)}function st(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)){xe(n,e=>yn(e,t));return}}async function ct(e,t){U(e);let n=De(e),r={guard:ge(e),queued:[],queuedBytes:0};T.set(e,r);let i=()=>U(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||!_e(e,r.guard))return;xe(e,e=>{let t=i.messages;e.closed=void 0,e.entries=$t(t),e.backgroundAgents=Object.fromEntries(i.backgroundAgents.map(e=>[e.agentId,e])),sn(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=>Wt(e)).filter(e=>e!==void 0),Nm(e,t,i.state),cn(e)}),me(e),ze(e,i.state,n,i.barrierSeq);for(let e of[...r.queued].sort((e,t)=>e.seq-t.seq))e.seq>i.barrierSeq&&Qe(e)}finally{t?.removeEventListener(`abort`,i),U(e,r)}}async function lt(e,t,n){let r=ge(e),{agent:i,messages:a}=await $.subagentMessages(e,t,n);n?.aborted||!ve(e,r)||xe(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=$t(a)),n.streaming=i.status===`running`})}return{sessions:e,revisions:n,route:i,navigate:ue,fleet:o,fleetError:c,fleetStatsError:u,refreshFleet:Ie,refreshDiskSessions:Le,refreshFleetStats:Ge,refreshRuntimeStats:Ue,removeRuntime:Me,stopRuntime:Ne,resumeClosedSession:Fe,dismissClosedBanner:Z,dismissStatusBanner:Pe,upsertRuntime:Re,setRuntimeModel:Be,setRuntimeThinkingLevel:Ve,resyncing:m,resyncError:f,retryResync:nt,auth:g,connected:b,connection:v,notices:x,start:at,stop:ot,dismissToast:st,resolveUiRequest(e,t){xe(e,e=>bn(e,t))},hydrateSession:ct,hydrateSubagent:lt}}var Fm=5e3;function Im(e){let t;return Promise.race([e,new Promise((e,n)=>{t=setTimeout(()=>n(Error(`service worker not ready`)),Fm)})]).finally(()=>{t&&clearTimeout(t)})}function Lm(){let e=Pm();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:ln(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),Im(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=()=>{let t=e.route(),n=t.screen===`session`||t.screen===`subagent`?t.key:void 0;return[...Object.values(e.sessions).flatMap(e=>e.key===n?[]:e.toasts.map(t=>({...t,sessionKey:e.key}))),...e.notices()].slice(-5)};return[W(Te,{get fallback(){return W(ir,{store:e})},get children(){return[W(q,{get when(){return e.route().screen===`session`},get children(){return W(Fd,{store:e,get sessionKey(){return e.route().key}})}}),W(q,{get when(){return e.route().screen===`subagent`},get children(){return W(Yp,{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(Ht,{store:e,get initialPath(){return e.route().path}})}}),W(q,{get when(){return e.route().screen===`memories`},get children(){return W(il,{store:e})}}),W(q,{get when(){return e.route().screen===`settings`},get children(){return W(Lp,{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(ul,{store:e})}})]}}),W(ct,{get toasts(){return i()},onDismiss:t=>e.dismissToast(t)})]}Mf();var Rm=document.getElementById(`root`);if(!Rm)throw Error(`dashboard: #root element missing from index.html`);Oe(()=>W(Lm,{}),Rm);
|
|
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>`),If=[`running`,`attention`,`idle`,`error`];function Lf(){let e=()=>{let e=bf();return e===`system`?void 0:e};return(()=>{var t=Nf(),n=t.firstChild,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling;return r.addEventListener(`change`,e=>Tf(e.currentTarget.value)),Z(r,W(G,{each:af,children:e=>(()=>{var t=Pf();return t.value=e,Z(t,e),t})()})),Z(i,W(G,{each:nf,children:t=>{let n=()=>yf()===t.id;return(()=>{var r=Ff(),i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling.firstChild,l=c.nextSibling;return r.$$click=()=>wf(t.id),Z(o,()=>t.label),Z(s,W(G,{each:If,children:e=>W(nt,{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=bf()),t})()}ke([`click`]);var Rf=Y(`<select><option value=on>on</option><option value=off>off`),zf=Y(`<div class=field style=margin-bottom:8px><input type=text placeholder="search models…">`),Bf=Y(`<button type=button class="model-row model-clear-row"><span class=model-current></span><span class=model-id>`),Vf=Y(`<div class=model-list style=max-height:320px>`),Hf=Y(`<p class="muted small">No matching models.`),Uf=Y(`<section class=model-provider-group><div class=model-provider-heading>`),Wf=Y(`<span class=model-name>`),Gf=Y(`<span class=model-reasoning>think`),Kf=Y(`<button type=button class=model-row><span class=model-current></span><span class=model-id></span><span class=model-provider-badge>`),qf=Y(`<div class=settings-error>`),Jf=Y(`<div class=settings-warning>`),Yf=Y(`<p class="muted small"style=margin-bottom:16px>✓ saved`),Xf=Y(`<div class=settings-success>new pairing lifetime saved`),Zf=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>`),Qf=Y(`<p class="muted small"style=padding-top:8px>No remote devices paired. Launch with <code>--remote --allow <identity></code> to enable Tailscale access.`),$f=Y(`<p>This exits the dashboard server process and terminates <strong>all running sessions</strong>.`),ep=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`),tp=Y(`<div>`),np=Y(`<p class=muted>`),rp=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>`),ip=Y(`<section class="settings-section tab-title-settings"><h2>tab title</h2><p class="muted small"style=margin-bottom:8px>Automatically names new, unnamed sessions after a few tool calls. Changes apply to new sessions.</p><div class=setting-row><span class=setting-label><span class=name>enabled</span><span class=hint>enabled by default; disabled sessions make no title model call</span></span><span class=setting-control></span></div><div class=setting-row><span class=setting-label><span class=name>title model</span><span class=hint>exact authenticated provider/model; parent session model remains the retry</span></span><span class=setting-control><button type=button class="btn btn-small model-picker-button">`),ap=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> `),op=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`),sp=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.`),cp=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>`),lp=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>`),up=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>`),dp=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>`),fp=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.`),pp=Y(`<option>`),mp=Y(`<p class="muted small">No agent definitions found.`),hp=Y(`<div class=agent-model-editor><button type=button class="btn btn-small">add model…`),gp=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">`),_p=Y(`<span class="muted small">default`),vp=Y(`<span class=agent-model-chip>. `),yp=Y(`<p class="muted small">Using the default model.`),bp=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">×`),xp=Y(`<p class="muted small trusted-context-empty">No trusted folders. Use the Files view to trust a project folder and its descendants.`),Sp=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">`),Cp=Y(`<label class=checkbox-control><input type=checkbox><span>`),wp=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`),Tp=Y(`<button type=button class="btn btn-small">cancel`),Ep=Y(`<button type=button class="btn btn-small btn-danger">restart`),Dp=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],Op=[`all`,`one-at-a-time`],kp=[`sse`,`websocket`,`auto`];function Ap(e){return`${e.provider}/${e.id}`}function jp(e){let t=Ap(e);return e.name?`${t} — ${e.name}`:t}function Mp(e){return e.defaultProvider&&e.defaultModel?`${e.defaultProvider}/${e.defaultModel}`:`choose model…`}function Np(e,t){return`${e.provider}/${e.id} ${e.name??``}`.toLowerCase().includes(t)}function Pp(){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 Fp(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 Ip(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 Lp(e){return(()=>{var t=Rf();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 Rp(e){let[t,n]=k(``),r=()=>new Set(e.selected??[]),i=N(()=>{let n=t().toLowerCase();return Fp(e.models.filter(e=>!n||Np(e,n)).slice(0,100))}),a=e=>r().has(Ap(e));return W(ot,{get title(){return e.title},get onDismiss(){return e.onClose},class:`model-picker-modal`,get children(){return[(()=>{var e=zf(),r=e.firstChild;return r.$$input=e=>n(e.currentTarget.value),j(()=>r.value=t()),e})(),(()=>{var t=Vf();return Z(t,W(K,{get when(){return J(()=>!!e.onClear)()&&e.clearLabel},get children(){var t=Bf(),n=t.firstChild,i=n.nextSibling;return t.$$click=()=>e.onClear?.(),Z(n,()=>r().size===0?`✓`:``),Z(i,()=>e.clearLabel),j(()=>t.classList.toggle(`current`,r().size===0)),t}}),null),Z(t,W(K,{get when(){return i().length>0},get fallback(){return Hf()},get children(){return W(G,{get each(){return i()},children:t=>(()=>{var n=Uf(),r=n.firstChild;return Z(r,()=>t.provider),Z(n,W(G,{get each(){return t.models},children:t=>(()=>{var n=Kf(),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=Wf();return Z(e,()=>t.name),e}}),o),Z(o,()=>t.provider),Z(n,W(K,{get when(){return t.reasoning},get children(){return Gf()}}),null),j(e=>{var r=!!a(t),i=jp(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})()})}}),null),t})()]}})}function zp(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(Pp()),[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[ue]=F(async()=>{try{let{version:e}=await $.version();return e}catch{return}}),[de]=F(async()=>{try{return await $.serverInfo()}catch{return}}),[fe,pe]=k(!1),[me,he]=k(!1),[ge,_e]=k();async function ve(){_e(void 0),he(!0);try{await $.restartServer()}catch(e){_e(e instanceof Error?e.message:String(e)),he(!1)}}async function U(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})}})}let Ce=Promise.resolve(),we;function Te(){return we??x()?.tabTitle??{}}function q(e){let t={...Te(),...e},r={...t,model:t.model??void 0};we=r;let a=x();a&&S({...a,tabTitle:r}),Ce=Ce.then(async()=>{n(void 0),i([]),o(!1);try{let t=await $.saveSettings({tabTitle:e});i(t.warnings??[]),o(!0),setTimeout(()=>o(!1),2e3),we===r?(we=t.tabTitle??void 0,S(t)):S({...t,tabTitle:we})}catch(e){let t=e instanceof Error?e.message:String(e),i=await C();n(t),we===r?we=i?.tabTitle??void 0:i&&S({...i,tabTitle:we})}})}async function Ee(e,t){await U({agentModels:{[e]:t}})}async function De(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 Oe(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 Y(e){return x()?.agentModels?.[e]??[]}function ke(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&&!Dp.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 je(){typeof Notification>`u`||b(await Notification.requestPermission())}R(()=>void le()),z(H);let Me=()=>e.store.auth();return(()=>{var i=ep(),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,he=le.firstChild.firstChild.nextSibling,_e=le.nextSibling.firstChild.nextSibling.firstChild,ye=_e.nextSibling.nextSibling,be=ce.nextSibling,Ce=be.firstChild.nextSibling;return Ce.nextSibling,Z(i,W(it,{get store(){return e.store},active:`settings`}),o),Z(o,W(K,{get when(){return t()},get children(){var e=qf();return Z(e,t),e}}),v),Z(o,W(K,{get when(){return r().length>0},get children(){var e=Jf();return Z(e,W(G,{get each(){return r()},children:e=>(()=>{var t=tp();return Z(t,e),t})()})),e}}),v),Z(o,W(K,{get when(){return a()},get children(){return Yf()}}),v),Z(o,W(K,{get when(){return x()},get fallback(){return(()=>{var e=np();return Z(e,()=>t()?`Settings could not be loaded — see the error above.`:`Loading settings…`),e})()},children:t=>[(()=>{var e=rp(),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,()=>Mp(t())),Z(o,()=>Dp.join(` · `)),s.addEventListener(`change`,e=>U({defaultThinkingLevel:e.currentTarget.value})),Z(s,W(G,{each:Dp,children:e=>(()=>{var t=pp();return t.value=e,Z(t,e),t})()})),l.addEventListener(`change`,e=>U({transport:e.currentTarget.value})),Z(l,W(G,{get each(){return[...kp]},children:e=>(()=>{var t=pp();return t.value=e,Z(t,e),t})()})),j(()=>s.value=t().defaultThinkingLevel??`off`),j(()=>l.value=t().transport??`sse`),e})(),(()=>{var e=ip(),n=e.firstChild.nextSibling.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling.firstChild;return Z(r,W(Lp,{get value(){return t().tabTitle?.enabled!==!1},onChange:e=>q({enabled:e})})),i.$$click=()=>c({kind:`tabTitle`}),Z(i,(()=>{var e=J(()=>typeof t().tabTitle?.model==`string`);return()=>e()?t().tabTitle?.model:`automatic (Explore route)`})()),e})(),W(tf,{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=ap(),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(Lp,{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:Dp,children:e=>(()=>{var t=pp();return t.value=e,Z(t,e),t})()})),d.addEventListener(`change`,e=>{Se({guidePath:e.currentTarget.value.trim()||void 0})}),Z(f,()=>ke(t()).message,null),j(()=>Ae(f,ke(t()).ready?`settings-warning`:`muted small`)),j(()=>l.value=typeof t().subagentArbiter?.thinking==`string`&&Dp.some(e=>e===t().subagentArbiter?.thinking)?t().subagentArbiter?.thinking:`off`),j(()=>d.value=typeof t().subagentArbiter?.guidePath==`string`?t().subagentArbiter?.guidePath:``),e})(),(()=>{var e=sp();return e.firstChild.nextSibling,Z(e,W(K,{get when(){return T().length>0},get children(){var e=op(),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=pp();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 mp()},get children(){return W(G,{get each(){return E()??[]},children:e=>{let n=()=>t().agentModels?.[e.name]??[];return(()=>{var t=gp(),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 _p()},get children(){return W(G,{get each(){return n()},children:(e,t)=>(()=>{var n=vp(),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=hp(),r=t.firstChild;return Z(t,W(K,{get when(){return n().length>0},get fallback(){return yp()},get children(){return W(G,{get each(){return n()},children:(t,r)=>(()=>{var i=bp(),a=i.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,c=s.nextSibling;return Z(a,t),o.$$click=()=>void Ee(e.name,Ip(n(),r(),-1)),s.$$click=()=>void Ee(e.name,Ip(n(),r(),1)),c.$$click=()=>void Ee(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=cp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Lp,{get value(){return t().imageAutoResize!==!1},onChange:e=>U({imageAutoResize:e})})),Z(i,W(Lp,{get value(){return t().blockImages===!0},onChange:e=>U({blockImages:e})})),e})(),(()=>{var e=lp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling.firstChild,i=n.nextSibling.firstChild.nextSibling.firstChild;return r.addEventListener(`change`,e=>U({steeringMode:e.currentTarget.value})),Z(r,W(G,{get each(){return[...Op]},children:e=>(()=>{var t=pp();return t.value=e,Z(t,e),t})()})),i.addEventListener(`change`,e=>U({followUpMode:e.currentTarget.value})),Z(i,W(G,{get each(){return[...Op]},children:e=>(()=>{var t=pp();return t.value=e,Z(t,e),t})()})),j(()=>r.value=t().steeringMode??`all`),j(()=>i.value=t().followUpMode??`all`),e})(),(()=>{var e=up(),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(Lp,{get value(){return t().enableSkillCommands!==!1},onChange:e=>U({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}U({maxConcurrentSubagents:i})}),Z(s,W(K,{get when(){return(t().trustedContextFolders??[]).length>0},get fallback(){return xp()},get children(){return W(G,{get each(){return t().trustedContextFolders??[]},children:e=>(()=>{var t=Sp(),n=t.firstChild,r=n.nextSibling.nextSibling;return Z(n,e),r.$$click=()=>void Oe(e),Z(r,()=>_()?`revoking…`:`revoke trust`),j(()=>r.disabled=_()),t})()})}}),c),c.addEventListener(`submit`,e=>{e.preventDefault();let t=h().trim();t&&De(t)}),l.$$input=e=>g(e.currentTarget.value),Z(u,()=>_()?`trusting…`:`trust folder`),Z(f,W(Lp,{get value(){return t().autoLoadNestedContext===!0},onChange:e=>U({autoLoadNestedContext:e})})),Z(p,W(Lp,{get value(){return t().hideThinkingBlock===!0},onChange:e=>U({hideThinkingBlock:e})})),j(()=>u.disabled=_()||!h().trim()),j(()=>o.value=t().maxConcurrentSubagents??4),j(()=>l.value=h()),e})(),(()=>{var e=dp(),n=e.firstChild.nextSibling,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return Z(r,W(Lp,{get value(){return t().compactionEnabled!==!1},onChange:e=>U({compactionEnabled:e})})),Z(i,W(Lp,{get value(){return t().retryEnabled!==!1},onChange:e=>U({retryEnabled:e})})),e})(),fp()]}),v),Z(b,W(Lf,{}),null),C.addEventListener(`change`,e=>us(e.currentTarget.value)),M.addEventListener(`change`,e=>ls(e.currentTarget.checked)),Z(P,W(G,{each:Go,children:e=>(()=>{var t=Cp(),n=t.firstChild,r=n.nextSibling;return n.addEventListener(`change`,t=>ds(e,t.currentTarget.checked)),X(n,`id`,`pref-tool-expand-${e}`),Z(r,e),j(()=>n.checked=fs(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&&je()}),Z(ae,()=>y()===`granted`?`enabled`:`enable notifications`),Z(se,()=>de()?.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=()=>pe(!0),Z(H,()=>me()?`restarting…`:`restart`),Z(v,W(K,{get when(){return ge()},get children(){var e=qf();return Z(e,ge),e}}),null),Z(he,()=>Me()?.mode===`local`?`local`:`host`),_e.$$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 Xf()}}),null),Z(ce,W(K,{get when(){return A()},get children(){var e=qf();return Z(e,A),e}}),null),Z(ce,W(K,{get when(){return J(()=>!!oe()?.enabled)()&&oe()?.code},get children(){var e=Zf(),t=e.firstChild.nextSibling.firstChild;return Z(t,()=>oe().code),e}}),null),Z(ce,W(G,{get each(){return D()??[]},children:e=>(()=>{var t=wp(),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,()=>lt(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 Qf()}}),null),Z(be,(()=>{var e=J(()=>!!de()?.version);return()=>e()?` v${de().version}`:J(()=>!!ue())()?` v${ue()}`:``})(),Ce),Z(be,W(K,{get when(){return de()?.startedAt},get children(){return[` · server build, up `,J(()=>lt(de().startedAt))]}}),null),Z(i,W(K,{get when(){return fe()},get children(){return W(ot,{title:`restart dashboard service?`,onDismiss:()=>pe(!1),get actions(){return[(()=>{var e=Tp();return e.$$click=()=>pe(!1),e})(),(()=>{var e=Ep();return e.$$click=()=>{pe(!1),ve()},e})()]},get children(){var e=$f();return e.firstChild.nextSibling.nextSibling,Z(e,()=>de()?.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`:t.kind===`tabTitle`?`select tab title 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]:[]:t.kind===`tabTitle`?x()?.tabTitle?.model?[x().tabTitle.model]:[]:Y(t.agentName)};return W(Rp,{get title(){return t()},get models(){return w()??[]},get selected(){return n()},get clearLabel(){return e().kind===`tabTitle`?`automatic (Explore route)`:void 0},get onClear(){return e().kind===`tabTitle`?()=>{c(void 0),q({model:null})}:void 0},onClose:()=>c(void 0),onPick:t=>{let n=e();if(c(void 0),n.kind==="default"){U({defaultProvider:t.provider,defaultModel:t.id});return}if(n.kind===`arbiter`){Se({model:Ap(t)});return}if(n.kind===`tabTitle`){q({model:Ap(t)});return}let r=Ap(t),i=Y(n.agentName);i.includes(r)||Ee(n.agentName,[...i,r])}})}}),null),j(e=>{var t=y()===`denied`||y()===`unsupported`||y()===`ios-install`||y()===`insecure`,n=me(),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=cs()),j(()=>M.checked=ss()),j(()=>te.checked=y()===`granted`),j(()=>_e.value=ne()),i})()}ke([`input`,`click`]);var Bp=Y(`<div class="status-line arbitration-history">`),Vp=Y(`<p class=pair-error>`),Hp=Y(`<div class=status-line><span class=working>● working`),Up=Y(`<output class=pending-chips aria-label="pending subagent steering messages">`),Wp=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">`),Gp=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>`),Kp=Y(`<span>arbiter: `),qp=Y(`<p class=muted>`),Jp=Y(`<div class=readonly-note>`),Yp=Y(`<span class=pending-chip>steer: `);function Xp(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 Zp(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=()=>t()?.closed,y=()=>!v()&&n()?.status===`running`,b=()=>typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 700px)`).matches,x,S,C,w=zo({scroller:()=>x});R(()=>{let t=new AbortController;v()||e.store.hydrateSubagent(e.sessionKey,e.agentId,t.signal).catch(e=>{t.signal.aborted&&hl(e)||v()||s(e instanceof Error?e.message:String(e))}),z(()=>t.abort())}),M(()=>{e.store.revisions[e.sessionKey],w.notifyContentChanged()}),R(()=>{w.observeContent(C),w.observeViewport(x),x&&z(Vo(w,x,{keyboard:`window`}))}),z(()=>w.dispose());async function T(){if(y())try{let t=await $.subagentPending(e.sessionKey,e.agentId);h(t.steeringMode),_(t.pending),p(void 0)}catch(e){v()||p(e instanceof Error?e.message:String(e))}}R(()=>{T();let e=window.setInterval(()=>{y()&&T()},1e3);z(()=>window.clearInterval(e))}),M(()=>{c(),S&&queueMicrotask(()=>S&&Td(S))});async function E(){let t=c();if(!(!t.trim()||u()||!y())){d(!0),p(void 0);try{await $.steerSubagent(e.sessionKey,e.agentId,t),l(``),await T()}catch(e){v()||p(e instanceof Error?e.message:String(e))}finally{d(!1)}}}let D=N(()=>{let n=[],r=v();if(r&&!r.bannerDismissed){let t=[];r.cwd&&r.sessionFile&&t.push({label:r.resuming?`resuming…`:`Resume session`,run:()=>e.store.resumeClosedSession(e.sessionKey),disabled:r.resuming}),t.push({label:`Return to fleet`,run:()=>e.store.navigate({screen:`fleet`}),disabled:r.resuming}),n.push({key:`closed`,text:`session ${e.sessionKey} was closed${r.resumeError?`\nResume failed: ${r.resumeError}`:``}`,tone:r.resumeError?`error`:`warning`,onDismiss:()=>e.store.dismissClosedBanner(e.sessionKey),actions:t})}for(let r of t()?.statusEntries??[])r.dismissed||n.push({key:`status:${r.id}`,text:r.text,tone:r.tone,onDismiss:()=>e.store.dismissStatusBanner(e.sessionKey,r.id)});for(let r of t()?.toasts??[])n.push({key:`toast:${r.id}`,text:r.text,tone:r.tone,onDismiss:()=>e.store.dismissToast(r.id)});return n});return(()=>{var t=Gp(),i=t.firstChild,s=i.firstChild.firstChild;s.firstChild;var d=s.nextSibling;d.firstChild;var p=d.nextSibling,h=p.nextSibling,_=i.nextSibling,w=_.firstChild,T=_.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 y()},get fallback(){return W(nt,{get status(){return!v()&&n()?.status===`failed`?`error`:`idle`},get label(){return J(()=>!!v())()?`closed`:n()?.status}})},get children(){return W(nt,{status:`running`})}})),Z(t,W(st,{get banners(){return D()}}),_);var O=x;typeof O==`function`?Pe(O,_):x=_;var k=C;return typeof k==`function`?Pe(k,w):C=w,Z(w,W(K,{get when(){return(n()?.arbitrations?.length??0)>0},get children(){var e=Bp();return Z(e,W(G,{get each(){return n()?.arbitrations??[]},children:e=>(()=>{var t=Kp();return t.firstChild,Z(t,()=>Xp(e),null),j(()=>Ae(t,e.status===`failure`?`error-reason`:`muted`)),t})()})),e}}),null),Z(w,W(K,{get when(){return o()},get children(){var e=Vp();return Z(e,o),e}}),null),Z(w,W(K,{get when(){return J(()=>!!r())()&&r().entries.length>0},get fallback(){return(()=>{var e=qp();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(Oc,{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(T,W(K,{get when(){return r()?.streaming},get children(){return Hp()}}),null),Z(T,W(K,{get when(){return y()},get fallback(){return(()=>{var e=Jp();return Z(e,()=>v()?`This session is closed; the subagent transcript is read-only.`:`This subagent is no longer running; its transcript is read-only.`),e})()},get children(){return[W(K,{get when(){return f()},get children(){var e=Vp();return Z(e,f),e}}),W(K,{get when(){return g().steering.length>0},get children(){var e=Up();return Z(e,W(G,{get each(){return g().steering},children:e=>(()=>{var t=Yp();return t.firstChild,Z(t,e,null),t})()})),e}}),(()=>{var e=Wp(),t=e.firstChild,n=t.nextSibling.firstChild;n.firstChild;var r=n.nextSibling;t.$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!b()&&(e.preventDefault(),E())},t.$$input=e=>{l(e.currentTarget.value),Td(e.currentTarget)};var i=S;return typeof i==`function`?Pe(i,t):S=t,Z(n,()=>m()??`loading…`,null),r.$$click=()=>void E(),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 Qp=Symbol(`store-raw`),$p=Symbol(`store-node`),em=Symbol(`store-has`),tm=Symbol(`store-self`);function nm(e){let t=e[p];if(!t&&(Object.defineProperty(e,p,{value:t=new Proxy(e,um)}),!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 rm(e){let t;return typeof e==`object`&&!!e&&(e[p]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function im(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Qp])return n;if(!rm(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=im(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=im(i,t))!==i&&(e[a]=r))}return e}function am(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function om(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 sm(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===p||t===$p?n:(delete n.value,delete n.writable,n.get=()=>e[p][t],n)}function cm(e){ee()&&om(am(e,$p),tm)()}function lm(e){return cm(e),Reflect.ownKeys(e)}var um={get(e,t,n){if(t===Qp)return e;if(t===p)return n;if(t===m)return cm(e),n;let r=am(e,$p),i=r[t],a=i?i():e[t];if(t===$p||t===em||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=om(r,t,a)())}return rm(a)?nm(a):a},has(e,t){return t===Qp||t===p||t===m||t===$p||t===em||t===`__proto__`?!0:(ee()&&om(am(e,em),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:lm,getOwnPropertyDescriptor:sm};function dm(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[em]&&e[em][t]&&i!==void 0&&e[em][t].$()):(e[t]=n,e[em]&&e[em][t]&&i===void 0&&e[em][t].$());let o=am(e,$p),s;if((s=om(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=om(o,`length`,a))&&s.$(e.length)}(s=o[tm])&&s.$()}function fm(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];pm(i)||dm(e,i,t[i])}}function pm(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function mm(e,t){if(typeof t==`function`&&(t=t(e)),t=im(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&&dm(e,n,r)}dm(e,`length`,r)}else fm(e,t)}function hm(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&&pm(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)hm(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&hm(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)hm(e,[r].concat(t),n);return}else if(t.length>1){hm(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=im(a),r===void 0||rm(i)&&rm(a)&&!Array.isArray(a)?fm(i,a):dm(e,r,a))}function gm(...[e,t]){let n=im(e||{}),r=Array.isArray(n),i=nm(n);function a(...e){I(()=>{r&&e.length===1?mm(n,e[0]):hm(n,e)})}return[i,a]}var _m=new WeakMap,vm={get(e,t){if(t===Qp)return e;let n=e[t];if(t===p||t===m||t===$p||t===em||t===`__proto__`)return n;let r;return rm(n)?_m.get(n)||(_m.set(n,r=new Proxy(n,vm)),r):n},set(e,t,n){return dm(e,t,im(n)),!0},deleteProperty(e,t){return dm(e,t,void 0,!0),!0}};function ym(e){return t=>{if(rm(t)){let n;(n=_m.get(t))||_m.set(t,n=new Proxy(t,vm)),e(n)}return t}}function bm(){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 xm(e){return e.screen===`session`||e.screen===`subagent`?e.key:void 0}function Sm(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 Cm=2e3,wm=3*1024*1024,Tm=Cm,Em=wm,Dm=3e4,Om=1e4,km=1e3,Am=3e4,jm=5e3,Mm=5*6e4,Nm=2147e6,Pm=new TextEncoder;function Fm(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(nn({key:`retry`,text:`retrying (attempt ${r})${n}`,tone:`warning`}))}pn(e,t,n.isStreaming||n.isRetrying||n.isCompacting)}function Im(){let[e,t]=gm({}),[n,r]=gm({}),[i,a]=k(bm()),[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=new Map,ne=new Map,re=0,ie=0,ae,B,oe,V=0,se=new Set,H=!1;function ce(t,n){let r=xm(t);!r||r===xm(n)||!e[r]?.closed||Se(r)}function le(){let e=bm();ce(i(),e),a(e)}window.addEventListener(`hashchange`,le);function ue(e){ce(i(),e),window.location.hash=Sm(e)}function de(e){return n[e]??0}function fe(e){return C.get(e)??0}function pe(e){return w.get(e)??0}function me(e){w.set(e,pe(e)+1)}function he(e){C.set(e,fe(e)+1)}function ge(e){return{revision:de(e),generation:fe(e),epoch:E}}function _e(e,t){return fe(e)===t.generation&&E===t.epoch}function ve(e,t){return de(e)===t.revision&&_e(e,t)}function U(e,t){t&&T.get(e)!==t||(T.delete(e),t&&(t.queued=[],t.queuedBytes=0))}function ye(e){r(e,de(e)+1)}function be(n){e[n]||t(n,Gt(n))}function xe(e,n){be(e),t(e,ym(n)),ye(e)}function Se(e){U(e),he(e),w.delete(e),t(e,void 0),r(e,void 0),Sl(e)}function Ce(){return xm(bm())}function W(e,t=`info`){--D,S(n=>[...n,{id:D,text:e,tone:t}].slice(-20))}function we(){B!==void 0&&clearTimeout(B),B=void 0,oe=void 0,V=0}function G(e){if(H||oe!==e)return;let t=e-Date.now();if(t<=0){B=void 0,Ee(e);return}B=setTimeout(()=>G(e),Math.min(t,Nm))}function K(e){if(we(),!e)return;let t=Date.parse(e);if(!Number.isFinite(t)){W(`Dashboard returned an invalid pairing-expiry check time`,`error`);return}oe=t,G(t)}function Te(e){if(H||oe!==e)return;V+=1;let t=Math.min(10,V-1),n=Math.min(Mm,jm*2**t);B=setTimeout(()=>{B=void 0,!H&&oe===e&&Ee(e)},n)}function q(e){e.pairingExpiryWarning&&W(`This device pairing expires on ${e.pairingExpiryWarning.expiresAt.slice(0,10)}. Re-pair before then to avoid losing remote access.`,`warning`)}function J(e){_(e),q(e),K(e.pairingExpiryCheckAt)}async function Ee(e){try{let t=await $.auth();if(H)return;if(oe!==e){q(t);return}if((t.pairingExpiryCheckAt?Date.parse(t.pairingExpiryCheckAt):void 0)===e&&e<=Date.now()){_(t),q(t),Te(e);return}J(t)}catch(t){if(H||oe!==e)return;if(t?.status===401||t?.status===403){we(),_({mode:`remote`,needsPairing:t?.body?.needsPairing??!1,identity:t?.body?.identity,error:t?.message}),ue({screen:`pairing`});return}V===0&&W(`Could not check pairing expiry: ${t instanceof Error?t.message:String(t)}`,`error`),Te(e)}}function De(e){return R.get(e)??0}function Oe(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=De(e)+1;R.set(e,t),n===void 0?z.set(e,t):ee.set(e,Math.max(ee.get(e)??-1,n))}}function Y(e,t){s(n=>{let r=e(n);return L+=1,Oe(n.runtimes,r.runtimes,t),r})}function ke(e){se.clear(),te.clear(),ne.clear(),Y(()=>e)}function X(e,t){let n=te.get(e.key);if(!n)return e.state;let r={...e.state},i=e.settingsRevision??0;return n.model&&(i>=n.model.settingsRevision?delete n.model:r.model=t?.state.model??n.model.value),n.thinkingLevel&&(i>=n.thinkingLevel.settingsRevision?delete n.thinkingLevel:r.thinkingLevel=t?.state.thinkingLevel??n.thinkingLevel.value),n.availableThinkingLevels&&(i>=n.availableThinkingLevels.settingsRevision?delete n.availableThinkingLevels:r.availableThinkingLevels=t?.state.availableThinkingLevels??n.availableThinkingLevels.value),n.model===void 0&&n.thinkingLevel===void 0&&n.availableThinkingLevels===void 0&&te.delete(e.key),r}function Ae(e,t){let n=new Set(e.filter(e=>!se.has(e.key)).map(e=>e.key)),r=n.size!==o().runtimes.length||o().runtimes.some(e=>!n.has(e.key));Y(t=>{let n=new Map(t.runtimes.map(e=>[e.key,e]));return{...t,runtimes:e.filter(e=>!se.has(e.key)).map(e=>{let t=n.get(e.key);return{...e,state:{...X(e,t),contextUsage:t?.state.contextUsage??e.state.contextUsage},...t?.stats===void 0?{}:{stats:t.stats},...t?.lastAssistantText===void 0?{}:{lastAssistantText:t.lastAssistantText}}})}},t),r&&Le().catch(()=>{})}function je(e,t){U(e),he(e),xe(e,e=>{let n=e.closed;e.closed={...t?.cwd||n?.cwd?{cwd:n?.cwd??t?.cwd}:{},...t?.state.sessionFile||n?.sessionFile?{sessionFile:n?.sessionFile??t?.state.sessionFile}:{},...n?.bannerDismissed?{bannerDismissed:!0}:{},...n?.resuming?{resuming:!0}:{},...n?.resumeError?{resumeError:n.resumeError}:{}},e.streaming=!1,e.compacting=!1,e.workingSince=void 0,e.workingText=void 0,e.statusEntries=e.statusEntries.filter(e=>e.key!==`retry`&&e.key!==`paused`&&e.key!==`compaction`),e.suggestedCommand=void 0,e.uiRequests=[];for(let t of Object.values(e.subagents))t.streaming=!1;cn(e)})}function Me(e,t,n=!0){let r=t??o().runtimes.find(t=>t.key===e),i=se.has(e);return se.add(e),te.delete(e),ne.delete(e),i||Y(t=>({...t,runtimes:t.runtimes.filter(t=>t.key!==e)})),Ce()===e?je(e,r):Se(e),i||!n?Promise.resolve():Le()}async function Ne(e){let t=o().runtimes.find(t=>t.key===e);try{await $.stopRuntime(e)}catch(t){if(se.has(e))return;throw t}await Me(e,t)}function Pe(t,n){e[t]?.statusEntries.some(e=>e.id===n)&&xe(t,e=>{let t=e.statusEntries.find(e=>e.id===n);t&&(t.dismissed=!0)})}function Z(t){e[t]?.closed&&xe(t,e=>{e.closed&&(e.closed.bannerDismissed=!0)})}async function Fe(t){let n=e[t]?.closed;if(!n||n.resuming)return;if(!n.cwd||!n.sessionFile){xe(t,e=>{e.closed&&(e.closed.resumeError=`This closed session has no captured resume path.`)});return}let r=n.cwd,i=n.sessionFile;xe(t,e=>{e.closed&&(e.closed.resuming=!0,e.closed.resumeError=void 0)});let a;try{a=await $.createRuntime(r,{sessionPath:i})}catch(n){let r=n instanceof Error?n.message:String(n);if(!e[t]?.closed)return;xe(t,e=>{e.closed&&(e.closed.resuming=!1,e.closed.resumeError=r,e.closed.bannerDismissed=!1)});return}Re(a),Le().catch(()=>{}),ue({screen:`session`,key:a.key})}function Ie(){let e=++re,t=L;return $.fleet().then(n=>{e!==re||t!==L||(ke(n),l(void 0))},n=>{throw e===re&&t===L&&l(n instanceof Error?n.message:String(n)),n})}function Le(){let e=++ie;return $.sessions().then(t=>{e===ie&&(Y(e=>({...e,diskSessions:t.sessions})),l(void 0))},t=>{throw e===ie&&l(t instanceof Error?t.message:String(t)),t})}function Re(e){se.delete(e.key),Y(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 ze(e,t,n,r){if(o().runtimes.some(t=>t.key===e)){if(n!==void 0&&De(e)!==n){let t=z.get(e)??0,i=ee.get(e);if(t>n||i===void 0||i>r)return}Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:t}:n)}))}}function Be(e,t){let n=o().runtimes.find(t=>t.key===e),r=te.get(e)??{};(n?.settingsRevision??0)>=t.settingsRevision?(delete r.model,delete r.thinkingLevel,delete r.availableThinkingLevels):(r.model={value:t.model,settingsRevision:t.settingsRevision},r.thinkingLevel={value:t.thinkingLevel,settingsRevision:t.settingsRevision},r.availableThinkingLevels={value:[...t.availableThinkingLevels],settingsRevision:t.settingsRevision}),r.model===void 0&&r.thinkingLevel===void 0&&r.availableThinkingLevels===void 0?te.delete(e):te.set(e,r),!((n?.settingsRevision??0)>=t.settingsRevision)&&Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,model:t.model,thinkingLevel:t.thinkingLevel,availableThinkingLevels:[...t.availableThinkingLevels]}}:n)}))}function Ve(e,t,n){let r=o().runtimes.find(t=>t.key===e),i=te.get(e)??{};(r?.settingsRevision??0)>=n?delete i.thinkingLevel:i.thinkingLevel={value:t,settingsRevision:n},i.model===void 0&&i.thinkingLevel===void 0&&i.availableThinkingLevels===void 0?te.delete(e):te.set(e,i),!((r?.settingsRevision??0)>=n)&&Y(n=>({...n,runtimes:n.runtimes.map(n=>n.key===e?{...n,state:{...n.state,thinkingLevel:t}}:n)}))}function He(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}}}async function Ue(e,t){let n=(ne.get(e)??0)+1;ne.set(e,n);let r=De(e),i=await $.stats(e,t);return ne.get(e)!==n||!o().runtimes.some(t=>t.key===e)||Y(t=>({...t,runtimes:t.runtimes.map(t=>t.key===e?He(t,i,De(e)!==r):t)})),i}function We(e){let t=new AbortController,n,r=new Promise((r,i)=>{n=setTimeout(()=>{let n=Error(`Stats request for runtime ${e} timed out after ${Om} ms`);i(n),t.abort(n)},Om)});return Promise.race([$.stats(e,t.signal),r]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Ge(){if(ae)return ae;let e=o().runtimes.map(e=>e.key),t=new Map(e.map(e=>[e,De(e)])),n=e.map(e=>We(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&&Y(e=>({...e,runtimes:e.runtimes.map(e=>{let n=r.get(e.key),i=t.get(e.key),a=i===void 0||De(e.key)!==i;return n?He(e,n,a):e})})),d(i.length>0?i.join(`; `):void 0)}).finally(()=>{ae===r&&(ae=void 0)});return ae=r,r}function Ke(e){return Pm.encode(JSON.stringify(e)).byteLength}function qe(e){e.queued=[],e.queuedBytes=0}function Je(){j!==void 0&&clearTimeout(j),j=void 0}function Ye(){return Math.min(Am,km*2**Math.max(0,P-1))}function Xe(){if(H||j!==void 0)return;P+=1;let e=Ye();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,tt()},e)}function Ze(){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 Qe(e){let t=e.event?.type;t===`fleet_snapshot`?Ae(e.event.runtimes,e.seq):t===`disk_sessions_changed`?Le().catch(()=>{}):t===`runtime_removed`?e.key&&Me(e.key).catch(()=>{}):e.key&&(xe(e.key,t=>vn(t,e.event)),t===`tasks_update`&&me(e.key))}function $e(e){let t=e.subagent;xe(e.key,n=>{let r=e.messages;if(n.closed=void 0,n.entries=$t(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=>Wt(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,Fm(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])),sn(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:$t(t.messages),streaming:r.status===`running`}}cn(n)}),me(e.key)}function et(e,t){if(A!==e||e.state!==`active`||e.barrierSeq===void 0)return;Je(),P=0,Ze();let n=e.barrierSeq;I=n;let r=Ce(),i=r?o().runtimes.find(e=>e.key===r):void 0;ke(t.fleet),l(void 0),t.active?$e(t.active):r&&Me(r,i,!1).catch(()=>{});let a=[...e.queued].sort((e,t)=>e.seq-t.seq),s=t.active?.subagent;if(s&&t.active)for(let e of a)e.seq>s.barrierSeq&&e.seq<=n&&e.key===t.active.key&&e.event.type===`background_agent_event`&&String(e.event.agentId)===s.agentId&&Qe(e);for(let e of a)e.seq>n&&Qe(e);qe(e),A=void 0,h(!1),p(void 0)}function tt(e=!1){if(H)return Promise.resolve();if(O)return(e||A?.state===`failed`)&&(F=!0),O;Je();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)U(e,t);h(!0),p(void 0);let o=setTimeout(()=>a.controller.abort(`Dashboard recovery timed out`),Dm),s=$.resync(n,r,a.controller.signal).then(e=>{a.barrierSeq=e.barrierSeq,et(a,e)}).catch(e=>{if(A!==a)return;a.state=`failed`,qe(a);let t=a.controller.signal.reason;p(typeof t==`string`?t:e instanceof Error?e.message:String(e)),Xe(),j===void 0&&h(!1)}).finally(()=>{clearTimeout(o),O===s&&(O=void 0),!H&&F&&(F=!1,tt())});return O=s,s}function nt(){return tt(!0)}function rt(e){if(e.event?.type===`dashboard_resync`){tt(!0);return}if(A){if(A.state===`failed`)throw Xe(),Error(`Dashboard recovery is failed; refusing to acknowledge live envelope before resync succeeds`);let t=Ke(e);if(A.queued.length>=Cm||A.queuedBytes+t>wm){qe(A),A.state=`failed`;let e=`Dashboard recovery queue overflowed; waiting for a newer authoritative snapshot`;throw p(e),A.controller.abort(e),Xe(),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=Ke(e);if(t.queued.length>=Tm||t.queuedBytes+n>Em)throw U(e.key,t),Error(`Dashboard hydration queue overflowed for ${e.key}; refusing an incomplete snapshot replay`);t.queued.push(e),t.queuedBytes+=n}Qe(e)}let it;async function at(){H=!1;try{J(await $.auth())}catch(e){_({mode:`remote`,needsPairing:e?.body?.needsPairing??!1,identity:e?.body?.identity,error:e?.message}),ue({screen:`pairing`});return}await Ie().catch(()=>{}),it=St({onEnvelope:rt,onAuthStatus:J,onStatusChange:e=>{N=!1,M=e.state===`connected`?e:void 0,y(e)},onRecovery:()=>{tt()}})}function ot(){H=!0,it?.(),we(),Je(),M=void 0,N=!1,F=!1;let e=A;A=void 0,e&&qe(e),e?.controller.abort(`Dashboard stopped`);for(let[e,t]of T)U(e,t)}function st(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)){xe(n,e=>yn(e,t));return}}async function ct(e,t){U(e);let n=De(e),r={guard:ge(e),queued:[],queuedBytes:0};T.set(e,r);let i=()=>U(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||!_e(e,r.guard))return;xe(e,e=>{let t=i.messages;e.closed=void 0,e.entries=$t(t),e.backgroundAgents=Object.fromEntries(i.backgroundAgents.map(e=>[e.agentId,e])),sn(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=>Wt(e)).filter(e=>e!==void 0),Fm(e,t,i.state),cn(e)}),me(e),ze(e,i.state,n,i.barrierSeq);for(let e of[...r.queued].sort((e,t)=>e.seq-t.seq))e.seq>i.barrierSeq&&Qe(e)}finally{t?.removeEventListener(`abort`,i),U(e,r)}}async function lt(e,t,n){let r=ge(e),{agent:i,messages:a}=await $.subagentMessages(e,t,n);n?.aborted||!ve(e,r)||xe(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=$t(a)),n.streaming=i.status===`running`})}return{sessions:e,revisions:n,route:i,navigate:ue,fleet:o,fleetError:c,fleetStatsError:u,refreshFleet:Ie,refreshDiskSessions:Le,refreshFleetStats:Ge,refreshRuntimeStats:Ue,removeRuntime:Me,stopRuntime:Ne,resumeClosedSession:Fe,dismissClosedBanner:Z,dismissStatusBanner:Pe,upsertRuntime:Re,setRuntimeModel:Be,setRuntimeThinkingLevel:Ve,resyncing:m,resyncError:f,retryResync:nt,auth:g,connected:b,connection:v,notices:x,start:at,stop:ot,dismissToast:st,resolveUiRequest(e,t){xe(e,e=>bn(e,t))},hydrateSession:ct,hydrateSubagent:lt}}var Lm=5e3;function Rm(e){let t;return Promise.race([e,new Promise((e,n)=>{t=setTimeout(()=>n(Error(`service worker not ready`)),Lm)})]).finally(()=>{t&&clearTimeout(t)})}function zm(){let e=Im();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:ln(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),Rm(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=()=>{let t=e.route(),n=t.screen===`session`||t.screen===`subagent`?t.key:void 0;return[...Object.values(e.sessions).flatMap(e=>e.key===n?[]:e.toasts.map(t=>({...t,sessionKey:e.key}))),...e.notices()].slice(-5)};return[W(Te,{get fallback(){return W(ir,{store:e})},get children(){return[W(q,{get when(){return e.route().screen===`session`},get children(){return W(Fd,{store:e,get sessionKey(){return e.route().key}})}}),W(q,{get when(){return e.route().screen===`subagent`},get children(){return W(Zp,{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(Ht,{store:e,get initialPath(){return e.route().path}})}}),W(q,{get when(){return e.route().screen===`memories`},get children(){return W(il,{store:e})}}),W(q,{get when(){return e.route().screen===`settings`},get children(){return W(zp,{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(ul,{store:e})}})]}}),W(ct,{get toasts(){return i()},onDismiss:t=>e.dismissToast(t)})]}Mf();var Bm=document.getElementById(`root`);if(!Bm)throw Error(`dashboard: #root element missing from index.html`);Oe(()=>W(zm,{}),Bm);
|
package/dist/static/index.html
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
} catch (e) {}
|
|
56
56
|
})();
|
|
57
57
|
</script>
|
|
58
|
-
<script type="module" crossorigin src="./assets/index-
|
|
58
|
+
<script type="module" crossorigin src="./assets/index-UXklvNmU.js"></script>
|
|
59
59
|
<link rel="stylesheet" crossorigin href="./assets/index-CNDJxinP.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.
|
|
17
|
+
const SW_CACHE_VERSION = "2.62.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
|