@dreb/dashboard 2.35.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 +146 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +251 -0
- package/dist/index.js.map +1 -0
- package/dist/server/auth.d.ts +164 -0
- package/dist/server/auth.d.ts.map +1 -0
- package/dist/server/auth.js +396 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/event-hub.d.ts +31 -0
- package/dist/server/event-hub.d.ts.map +1 -0
- package/dist/server/event-hub.js +73 -0
- package/dist/server/event-hub.js.map +1 -0
- package/dist/server/files.d.ts +48 -0
- package/dist/server/files.d.ts.map +1 -0
- package/dist/server/files.js +194 -0
- package/dist/server/files.js.map +1 -0
- package/dist/server/pairing-storage.d.ts +18 -0
- package/dist/server/pairing-storage.d.ts.map +1 -0
- package/dist/server/pairing-storage.js +83 -0
- package/dist/server/pairing-storage.js.map +1 -0
- package/dist/server/runtime-pool.d.ts +89 -0
- package/dist/server/runtime-pool.d.ts.map +1 -0
- package/dist/server/runtime-pool.js +377 -0
- package/dist/server/runtime-pool.js.map +1 -0
- package/dist/server/server.d.ts +30 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +557 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/subagent-log.d.ts +42 -0
- package/dist/server/subagent-log.d.ts.map +1 -0
- package/dist/server/subagent-log.js +155 -0
- package/dist/server/subagent-log.js.map +1 -0
- package/dist/shared/protocol.d.ts +261 -0
- package/dist/shared/protocol.d.ts.map +1 -0
- package/dist/shared/protocol.js +26 -0
- package/dist/shared/protocol.js.map +1 -0
- package/dist/static/assets/index-Cgwg2zRA.js +77 -0
- package/dist/static/assets/index-DnFrQoI9.css +1 -0
- package/dist/static/icons/apple-touch-icon.png +0 -0
- package/dist/static/icons/favicon-32.png +0 -0
- package/dist/static/icons/punk-1024.png +0 -0
- package/dist/static/icons/punk-192.png +0 -0
- package/dist/static/icons/punk-512.png +0 -0
- package/dist/static/index.html +32 -0
- package/dist/static/manifest.webmanifest +30 -0
- package/dist/static/sw.js +110 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iDAAiD;AACjD,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,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,QAAmB,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAA2D,CAAC;AAE9F,iFAA+E;AAC/E,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAA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IAChC,SAAS,CAAC,EAAE,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC;AAED,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/** Session metadata (mirrors RpcSessionInfo). */\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/** 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}\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/**\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 PerformanceStatsDto {\n\tmodels: Array<{ provider: string; modelId: string; median: number; mean: number; count: number }>;\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\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\";\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\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\tthinkingLevel: string;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\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 DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\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}\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 SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n}\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"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types shared between the dashboard server and the browser client.
|
|
3
|
+
*
|
|
4
|
+
* These are standalone definitions (not imports from @dreb/coding-agent) so the
|
|
5
|
+
* client bundle stays free of node-flavored type resolution. Server code maps
|
|
6
|
+
* RPC DTOs onto these shapes; TypeScript structural typing enforces
|
|
7
|
+
* compatibility at the mapping sites.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Shared eviction cap for completed/failed background agents. The server
|
|
11
|
+
* prunes its registry to this bound and the client applies the same cap as
|
|
12
|
+
* defense-in-depth — the two sides must agree on how many completed agents
|
|
13
|
+
* survive, so the constant lives here.
|
|
14
|
+
*/
|
|
15
|
+
export const MAX_COMPLETED_BACKGROUND_AGENTS = 20;
|
|
16
|
+
/** Maximum JSON prompt request body accepted by the dashboard server. */
|
|
17
|
+
export const MAX_PROMPT_BODY_BYTES = 25 * 1024 * 1024;
|
|
18
|
+
/**
|
|
19
|
+
* Inline images are base64-encoded inside the JSON prompt body. Base64 expands
|
|
20
|
+
* raw bytes by 4/3, so a 25 MiB body can carry at most floor(25 MiB * 3/4) =
|
|
21
|
+
* 18.75 MiB of raw image data before JSON syntax and prompt text. Reserve the
|
|
22
|
+
* remaining 0.75 MiB for that overhead and advertise an 18 MiB aggregate raw
|
|
23
|
+
* image budget to the browser.
|
|
24
|
+
*/
|
|
25
|
+
export const MAX_TOTAL_IMAGE_BYTES = Math.floor((MAX_PROMPT_BODY_BYTES * 3) / 4) - 768 * 1024;
|
|
26
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;;;;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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,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/** Session metadata (mirrors RpcSessionInfo). */\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/** 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}\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/**\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 PerformanceStatsDto {\n\tmodels: Array<{ provider: string; modelId: string; median: number; mean: number; count: number }>;\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\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\";\n}\n\nexport interface RuntimeStatsSummaryDto {\n\ttokensTotal: number;\n\tcost: number;\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\tthinkingLevel: string;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tcontextUsage?: ContextUsageDto;\n\tmodelFallbackMessage?: string;\n}\n\n/** A live runtime managed by the dashboard server's pool. */\nexport interface RuntimeInfoDto {\n\t/** Pool key — stable identity for API calls and SSE envelopes. */\n\tkey: string;\n\tcwd: string;\n\tstate: SessionStateDto;\n\t/** Lean session stats for fleet cards; omitted when the runtime stats call fails. */\n\tstats?: RuntimeStatsSummaryDto;\n\t/** Background agents known to this runtime. */\n\tbackgroundAgents: BackgroundAgentDto[];\n\t/** Server-derived needs-attention flag (extension UI pending, paused, error). */\n\tneedsAttention: boolean;\n\t/** Runtime-level error that should survive browser reloads. */\n\terror?: string;\n\t/** Last assistant text, truncated for fleet-card previews. */\n\tlastAssistantText?: string;\n\t/** Session start timestamp (ISO) — stable tiebreak for deterministic fleet ordering. */\n\tcreatedAt: string;\n\t/** Last activity timestamp (ISO). */\n\tlastActivity: string;\n}\n\n/** Fleet snapshot: live runtimes + on-disk inventory. */\nexport interface FleetDto {\n\truntimes: RuntimeInfoDto[];\n\tdiskSessions: SessionInfoDto[];\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 DirListingDto {\n\t/** Canonicalized absolute path of the listed directory. */\n\tpath: string;\n\tentries: FileEntryDto[];\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}\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 SettingsDto {\n\tdefaultProvider?: string;\n\tdefaultModel?: string;\n\tdefaultThinkingLevel?: string;\n\tsteeringMode?: \"all\" | \"one-at-a-time\";\n\tfollowUpMode?: \"all\" | \"one-at-a-time\";\n\tcompactionEnabled?: boolean;\n\tretryEnabled?: boolean;\n\timageAutoResize?: boolean;\n\tblockImages?: boolean;\n\tenableSkillCommands?: boolean;\n\tautoLoadNestedContext?: boolean;\n\ttransport?: \"sse\" | \"websocket\" | \"auto\";\n\thideThinkingBlock?: boolean;\n\tagentModels?: Record<string, string[]>;\n}\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"]}
|