agent-console-server 3.5.1 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,7 +44,7 @@ We highly recommend you take a look at the [documentation](https://esposter.com/
44
44
  | `createClaudeAgentSdkDriver` | The Claude Code driver, one streaming-input Agent SDK query per open session |
45
45
  | `Driver` | The interface another agent's driver implements |
46
46
 
47
- Commands: `pnpm build`, `pnpm test`, `pnpm typecheck`, `pnpm lint:fix`.
47
+ Commands: `pnpm build`, `pnpm test`, `pnpm typecheck`, `pnpm lint:fix`. `pnpm dev` builds the host and starts it for the local dev server at `http://localhost:3000`, then rebuilds and restarts it on every change to the source, which ends its open sessions and leaves the page to reconnect. Close any other host first, since both take the same port, and pair through the link it prints — the page's Connect starts the installed host, which only the deployed site may pair with.
48
48
 
49
49
  ## <a name="license">⚖️ License</a>
50
50
 
@@ -734,6 +734,9 @@ const driverCommandSchema = z.discriminatedUnion("type", [
734
734
  stopTaskCommandSchema
735
735
  ]);
736
736
  //#endregion
737
+ //#region src/models/event/EphemeralAgentEventTypes.ts
738
+ const EphemeralAgentEventTypes = ["StreamDelta", "TurnUsage"];
739
+ //#endregion
737
740
  //#region src/models/command/CloseShellCommand.ts
738
741
  const closeShellCommandSchema = z.object({
739
742
  ...createBaseCommandSchema(z.literal("CloseShell")).shape,
@@ -832,7 +835,4 @@ let HostCloseCode = /* @__PURE__ */ function(HostCloseCode) {
832
835
  return HostCloseCode;
833
836
  }({});
834
837
  //#endregion
835
- //#region src/models/event/EphemeralAgentEventTypes.ts
836
- const EphemeralAgentEventTypes = ["StreamDelta", "TurnUsage"];
837
- //#endregion
838
- export { eventsMessageSchema as $, serverMessageTypeSchema as $t, forkCommandSchema as A, permissionRequestEventSchema as At, getSignedText as B, commandOutputEventSchema as Bt, resumeCommandSchema as C, PermissionMode as Ct, permissionVerdictCommandSchema as D, permissionResolutionEventSchema as Dt, attachmentSchema as E, rateLimitEventSchema as Et, createBaseCommandSchema as F, fileRewindEventSchema as Ft, shellIdSchema as G, parentToolUseIdSchema as Gt, shellOutputMessageSchema as H, slashCommandSchema as Ht, CommandType as I, contextUsageEventSchema as It, sessionResetMessageSchema as J, AgentEventType as Jt, sessionsMessageSchema as K, messageUuidSchema as Kt, commandTypeSchema as L, compactionEventSchema as Lt, closeSessionCommandSchema as M, hookEventSchema as Mt, backgroundTasksCommandSchema as N, HookPhase as Nt, listSessionsCommandSchema as O, PermissionBehavior as Ot, sessionIdSchema as P, hookPhaseSchema as Pt, hostStoppingMessageSchema as Q, ServerMessageType as Qt, AttachmentMediaType as R, CompactionTrigger as Rt, rewindFilesCommandSchema as S, sessionInitEventSchema as St, promptCommandSchema as T, mcpServerSchema as Tt, shellOpenedMessageSchema as U, modelSchema as Ut, serverMessageSchema as V, capabilitiesEventSchema as Vt, shellClosedMessageSchema as W, assistantMessageEventSchema as Wt, proofMessageSchema as X, commandErrorMessageSchema as Xt, sessionOpenedMessageSchema as Y, agentEventTypeSchema as Yt, pairedMessageSchema as Z, authenticatedMessageSchema as Zt, driverCommandSchema as _, streamDeltaEventSchema as _t, pairMessageSchema as a, DEFAULT_PORT as an, tokenUsageSchema as at, setPermissionModeCommandSchema as b, sessionStateSchema as bt, authenticateMessageSchema as c, PAIRING_HASH_PARAMETER as cn, toolProgressEventSchema as ct, shellCommandSchema as d, HandshakeMessageType as dn, TodoStatus as dt, createBaseServerMessageSchema as en, agentEventSchema as et, shellResizeCommandSchema as f, handshakeMessageTypeSchema as fn, todoStatusSchema as ft, closeShellCommandSchema as g, subagentStatusSchema as gt, terminalSizeSchema as h, SubagentStatus as ht, revokeMessageSchema as i, DEFAULT_HOSTNAME as in, turnResultEventSchema as it, createSessionCommandSchema as j, hostErrorEventSchema as jt, interruptCommandSchema as k, permissionBehaviorSchema as kt, createBaseHandshakeMessageSchema as l, SCHEME_PAIRING_CODE_DURATION as ln, todoUpdateEventSchema as lt, openShellCommandSchema as m, subagentEventSchema as mt, HostCloseCode as n, signaturePurposeSchema as nn, unknownEventSchema as nt, handOffMessageSchema as o, HOST_SCHEME as on, toolUseEventSchema as ot, shellInputCommandSchema as p, thinkingEventSchema as pt, sessionSummarySchema as q, createBaseAgentEventSchema as qt, handshakeMessageSchema as r, DEFAULT_APP_ORIGIN as rn, turnUsageEventSchema as rt, challengeMessageSchema as s, PAIRING_CODE_PARAMETER as sn, toolResultEventSchema as st, EphemeralAgentEventTypes as t, SignaturePurpose as tn, userMessageEventSchema as tt, commandSchema as u, SHELL_OUTPUT_LENGTH as un, todoSchema as ut, stopTaskCommandSchema as v, sessionStateEventSchema as vt, resumeAtCommandSchema as w, permissionModeSchema as wt, setModelCommandSchema as x, sessionSettingsEventSchema as xt, slashCommandCommandSchema as y, SessionState as yt, attachmentMediaTypeSchema as z, compactionTriggerSchema as zt };
838
+ export { eventsMessageSchema as $, serverMessageTypeSchema as $t, forkCommandSchema as A, permissionRequestEventSchema as At, getSignedText as B, commandOutputEventSchema as Bt, resumeCommandSchema as C, PermissionMode as Ct, permissionVerdictCommandSchema as D, permissionResolutionEventSchema as Dt, attachmentSchema as E, rateLimitEventSchema as Et, createBaseCommandSchema as F, fileRewindEventSchema as Ft, shellIdSchema as G, parentToolUseIdSchema as Gt, shellOutputMessageSchema as H, slashCommandSchema as Ht, CommandType as I, contextUsageEventSchema as It, sessionResetMessageSchema as J, AgentEventType as Jt, sessionsMessageSchema as K, messageUuidSchema as Kt, commandTypeSchema as L, compactionEventSchema as Lt, closeSessionCommandSchema as M, hookEventSchema as Mt, backgroundTasksCommandSchema as N, HookPhase as Nt, listSessionsCommandSchema as O, PermissionBehavior as Ot, sessionIdSchema as P, hookPhaseSchema as Pt, hostStoppingMessageSchema as Q, ServerMessageType as Qt, AttachmentMediaType as R, CompactionTrigger as Rt, rewindFilesCommandSchema as S, sessionInitEventSchema as St, promptCommandSchema as T, mcpServerSchema as Tt, shellOpenedMessageSchema as U, modelSchema as Ut, serverMessageSchema as V, capabilitiesEventSchema as Vt, shellClosedMessageSchema as W, assistantMessageEventSchema as Wt, proofMessageSchema as X, commandErrorMessageSchema as Xt, sessionOpenedMessageSchema as Y, agentEventTypeSchema as Yt, pairedMessageSchema as Z, authenticatedMessageSchema as Zt, driverCommandSchema as _, streamDeltaEventSchema as _t, handOffMessageSchema as a, DEFAULT_PORT as an, tokenUsageSchema as at, setPermissionModeCommandSchema as b, sessionStateSchema as bt, createBaseHandshakeMessageSchema as c, PAIRING_HASH_PARAMETER as cn, toolProgressEventSchema as ct, shellResizeCommandSchema as d, HandshakeMessageType as dn, TodoStatus as dt, createBaseServerMessageSchema as en, agentEventSchema as et, shellInputCommandSchema as f, handshakeMessageTypeSchema as fn, todoStatusSchema as ft, EphemeralAgentEventTypes as g, subagentStatusSchema as gt, closeShellCommandSchema as h, SubagentStatus as ht, pairMessageSchema as i, DEFAULT_HOSTNAME as in, turnResultEventSchema as it, createSessionCommandSchema as j, hostErrorEventSchema as jt, interruptCommandSchema as k, permissionBehaviorSchema as kt, commandSchema as l, SCHEME_PAIRING_CODE_DURATION as ln, todoUpdateEventSchema as lt, terminalSizeSchema as m, subagentEventSchema as mt, handshakeMessageSchema as n, signaturePurposeSchema as nn, unknownEventSchema as nt, challengeMessageSchema as o, HOST_SCHEME as on, toolUseEventSchema as ot, openShellCommandSchema as p, thinkingEventSchema as pt, sessionSummarySchema as q, createBaseAgentEventSchema as qt, revokeMessageSchema as r, DEFAULT_APP_ORIGIN as rn, turnUsageEventSchema as rt, authenticateMessageSchema as s, PAIRING_CODE_PARAMETER as sn, toolResultEventSchema as st, HostCloseCode as t, SignaturePurpose as tn, userMessageEventSchema as tt, shellCommandSchema as u, SHELL_OUTPUT_LENGTH as un, todoSchema as ut, stopTaskCommandSchema as v, sessionStateEventSchema as vt, resumeAtCommandSchema as w, permissionModeSchema as wt, setModelCommandSchema as x, sessionSettingsEventSchema as xt, slashCommandCommandSchema as y, SessionState as yt, attachmentMediaTypeSchema as z, compactionTriggerSchema as zt };
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- import { an as DEFAULT_PORT, cn as PAIRING_HASH_PARAMETER, in as DEFAULT_HOSTNAME, ln as SCHEME_PAIRING_CODE_DURATION, rn as DEFAULT_APP_ORIGIN, sn as PAIRING_CODE_PARAMETER } from "./EphemeralAgentEventTypes-DGkHIIcW.js";
2
- import { D as createWindowDriver, E as launchSessionWindow, Gt as readHostKey, It as runDevicesCommand, Lt as sendToRunningHost, S as runSessionChild, W as createClaudeAgentSdkDriver, Xt as PRINTED_PAIRING_CODE_DURATION, _ as uninstallHost, b as checkIsSchemeLaunchTampered, i as runConsoleListAgent, o as createAgentConsoleServer, qt as getStateDirectory, t as spawnPtyShell, v as installHost, x as checkIsHostInstalled, y as getSchemeLaunch } from "./spawnPtyShell-CtAiD2BH.js";
1
+ import { an as DEFAULT_PORT, cn as PAIRING_HASH_PARAMETER, in as DEFAULT_HOSTNAME, ln as SCHEME_PAIRING_CODE_DURATION, rn as DEFAULT_APP_ORIGIN, sn as PAIRING_CODE_PARAMETER } from "./HostCloseCode-eTYq6aIa.js";
2
+ import { E as createWindowDriver, Qt as readHostKey, T as launchSessionWindow, Ut as runDevicesCommand, Wt as sendToRunningHost, Z as createClaudeAgentSdkDriver, _ as installHost, b as checkIsHostInstalled, en as getStateDirectory, g as uninstallHost, i as runConsoleListAgent, o as createAgentConsoleServer, rn as PRINTED_PAIRING_CODE_DURATION, t as spawnPtyShell, v as getSchemeLaunch, x as runSessionChild, y as checkIsSchemeLaunchTampered } from "./spawnPtyShell-CNDdpI2T.js";
3
3
  import { RoutePath, getResult, getResultAsync } from "@esposter/shared";
4
4
  import { hostname } from "node:os";
5
5
  import { basename } from "node:path";
@@ -72,6 +72,7 @@ if (firstPositional === "devices") process.exit(await runDevicesCommand({
72
72
  const server = await getResultAsync(() => createAgentConsoleServer({
73
73
  createDriver: (callbacks) => process.platform === "win32" && values.hostname === "127.0.0.1" ? createWindowDriver(callbacks, {
74
74
  launchSessionWindow,
75
+ stateDirectory,
75
76
  writeLine
76
77
  }) : createClaudeAgentSdkDriver(callbacks),
77
78
  hostKey,
@@ -102,7 +103,7 @@ if (schemeLaunch) {
102
103
  const code = randomBytes(32).toString("base64url");
103
104
  server.addPairingCode(code, PRINTED_PAIRING_CODE_DURATION);
104
105
  const hostAddress = `ws://${reachableHostname}:${server.port}`;
105
- const pairingUrl = `${values.origin}${RoutePath.AgentConsole}#${new URLSearchParams({
106
+ const pairingUrl = `${values.origin}${RoutePath.Genshin}#${new URLSearchParams({
106
107
  [PAIRING_CODE_PARAMETER]: code,
107
108
  [PAIRING_HASH_PARAMETER]: hostAddress
108
109
  })}`;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- import { $ as ChallengeMessage, $n as setPermissionModeCommandSchema, $t as permissionResolutionEventSchema, A as HostStoppingMessage, An as BaseAgentEvent, Ar as BackgroundTasksCommand, At as TodoStatus, B as createBaseServerMessageSchema, Bn as ShellInputCommand, Br as AttachmentMediaType, Bt as SessionStateEvent, C as sessionResetMessageSchema, Cn as modelSchema, Cr as createSessionCommandSchema, Ct as toolResultEventSchema, D as proofMessageSchema, Dn as parentToolUseIdSchema, Dr as shellIdSchema, Dt as todoUpdateEventSchema, E as ProofMessage, En as ParentToolUseId, Er as ShellId, Et as TodoUpdateEvent, F as CommandErrorMessage, Fn as commandSchema, Fr as createBaseCommandSchema, Ft as subagentEventSchema, G as HandshakeMessage, Gn as terminalSizeSchema, Gt as sessionSettingsEventSchema, H as serverMessageTypeSchema, Hn as OpenShellCommand, Ht as SessionState, I as commandErrorMessageSchema, In as ShellCommand, Ir as CommandType, It as SubagentStatus, J as revokeMessageSchema, Jn as StopTaskCommand, Jt as McpServer, K as handshakeMessageSchema, Kn as DriverCommand, Kt as SessionInitEvent, L as AuthenticatedMessage, Ln as shellCommandSchema, Lr as commandTypeSchema, Lt as subagentStatusSchema, M as HostCloseCode, Mn as AgentEventType, Mr as SessionId, Mt as ThinkingEvent, N as EventsMessage, Nn as agentEventTypeSchema, Nr as sessionIdSchema, Nt as thinkingEventSchema, O as PairedMessage, On as MessageUuid, Or as CloseSessionCommand, Ot as Todo, P as eventsMessageSchema, Pn as Command, Pr as BaseCommand, Pt as SubagentEvent, Q as handOffMessageSchema, Qn as SetPermissionModeCommand, Qt as PermissionResolutionEvent, R as authenticatedMessageSchema, Rn as ShellResizeCommand, Rr as Attachment, Rt as StreamDeltaEvent, S as SessionResetMessage, Sn as Model, Sr as CreateSessionCommand, St as ToolResultEvent, T as sessionOpenedMessageSchema, Tn as assistantMessageEventSchema, Tr as closeShellCommandSchema, Tt as toolProgressEventSchema, U as SignaturePurpose, Un as openShellCommandSchema, Ut as sessionStateSchema, V as ServerMessageType, Vn as shellInputCommandSchema, Vr as attachmentMediaTypeSchema, Vt as sessionStateEventSchema, W as signaturePurposeSchema, Wn as TerminalSize, Wt as SessionSettingsEvent, X as pairMessageSchema, Xn as SlashCommandCommand, Xt as RateLimitEvent, Y as PairMessage, Yn as stopTaskCommandSchema, Yt as mcpServerSchema, Z as HandOffMessage, Zn as slashCommandCommandSchema, Zt as rateLimitEventSchema, _ as shellClosedMessageSchema, _n as commandOutputEventSchema, _r as listSessionsCommandSchema, _t as turnResultEventSchema, a as HOST_SCHEME, an as hookEventSchema, ar as rewindFilesCommandSchema, at as HandshakeMessageType, b as SessionSummary, bn as SlashCommand, br as ForkCommand, bt as ToolUseEvent, c as SCHEME_PAIRING_CODE_DURATION, cn as FileRewindEvent, cr as ResumeAtCommand, ct as AgentEvent, d as serverMessageSchema, dn as contextUsageEventSchema, dr as promptCommandSchema, dt as userMessageEventSchema, en as PermissionRequestEvent, er as PermissionMode, et as challengeMessageSchema, f as ShellOutputMessage, fn as CompactionEvent, fr as PermissionVerdictCommand, ft as UnknownEvent, g as ShellClosedMessage, gn as CommandOutputEvent, gr as ListSessionsCommand, gt as TurnResultEvent, h as shellOpenedMessageSchema, hn as compactionTriggerSchema, hr as permissionBehaviorSchema, ht as turnUsageEventSchema, i as DEFAULT_PORT, in as HookEvent, ir as RewindFilesCommand, it as createBaseHandshakeMessageSchema, j as hostStoppingMessageSchema, jn as createBaseAgentEventSchema, jr as backgroundTasksCommandSchema, jt as todoStatusSchema, k as pairedMessageSchema, kn as messageUuidSchema, kr as closeSessionCommandSchema, kt as todoSchema, l as SHELL_OUTPUT_LENGTH, ln as fileRewindEventSchema, lr as resumeAtCommandSchema, lt as agentEventSchema, m as ShellOpenedMessage, mn as CompactionTrigger, mr as PermissionBehavior, mt as TurnUsageEvent, n as DEFAULT_APP_ORIGIN, nn as HostErrorEvent, nr as SetModelCommand, nt as authenticateMessageSchema, o as PAIRING_CODE_PARAMETER, on as HookPhase, or as ResumeCommand, ot as handshakeMessageTypeSchema, p as shellOutputMessageSchema, pn as compactionEventSchema, pr as permissionVerdictCommandSchema, pt as unknownEventSchema, q as RevokeMessage, qn as driverCommandSchema, qt as sessionInitEventSchema, r as DEFAULT_HOSTNAME, rn as hostErrorEventSchema, rr as setModelCommandSchema, rt as BaseHandshakeMessage, s as PAIRING_HASH_PARAMETER, sn as hookPhaseSchema, sr as resumeCommandSchema, st as EphemeralAgentEventTypes, t as getSignedText, tn as permissionRequestEventSchema, tr as permissionModeSchema, tt as AuthenticateMessage, u as ServerMessage, un as ContextUsageEvent, ur as PromptCommand, ut as UserMessageEvent, v as SessionsMessage, vn as CapabilitiesEvent, vr as InterruptCommand, vt as TokenUsage, w as SessionOpenedMessage, wn as AssistantMessageEvent, wr as CloseShellCommand, wt as ToolProgressEvent, x as sessionSummarySchema, xn as slashCommandSchema, xr as forkCommandSchema, xt as toolUseEventSchema, y as sessionsMessageSchema, yn as capabilitiesEventSchema, yr as interruptCommandSchema, yt as tokenUsageSchema, z as BaseServerMessage, zn as shellResizeCommandSchema, zr as attachmentSchema, zt as streamDeltaEventSchema } from "./getSignedText-DQwqr8CH.js";
1
+ import { $ as ChallengeMessage, $n as setPermissionModeCommandSchema, $t as permissionResolutionEventSchema, A as HostStoppingMessage, An as BaseAgentEvent, Ar as BackgroundTasksCommand, At as TodoStatus, B as createBaseServerMessageSchema, Bn as ShellInputCommand, Br as AttachmentMediaType, Bt as SessionStateEvent, C as sessionResetMessageSchema, Cn as modelSchema, Cr as createSessionCommandSchema, Ct as toolResultEventSchema, D as proofMessageSchema, Dn as parentToolUseIdSchema, Dr as shellIdSchema, Dt as todoUpdateEventSchema, E as ProofMessage, En as ParentToolUseId, Er as ShellId, Et as TodoUpdateEvent, F as CommandErrorMessage, Fn as commandSchema, Fr as createBaseCommandSchema, Ft as subagentEventSchema, G as HandshakeMessage, Gn as terminalSizeSchema, Gt as sessionSettingsEventSchema, H as serverMessageTypeSchema, Hn as OpenShellCommand, Ht as SessionState, I as commandErrorMessageSchema, In as ShellCommand, Ir as CommandType, It as SubagentStatus, J as revokeMessageSchema, Jn as StopTaskCommand, Jt as McpServer, K as handshakeMessageSchema, Kn as DriverCommand, Kt as SessionInitEvent, L as AuthenticatedMessage, Ln as shellCommandSchema, Lr as commandTypeSchema, Lt as subagentStatusSchema, M as HostCloseCode, Mn as AgentEventType, Mr as SessionId, Mt as ThinkingEvent, N as EventsMessage, Nn as agentEventTypeSchema, Nr as sessionIdSchema, Nt as thinkingEventSchema, O as PairedMessage, On as MessageUuid, Or as CloseSessionCommand, Ot as Todo, P as eventsMessageSchema, Pn as Command, Pr as BaseCommand, Pt as SubagentEvent, Q as handOffMessageSchema, Qn as SetPermissionModeCommand, Qt as PermissionResolutionEvent, R as authenticatedMessageSchema, Rn as ShellResizeCommand, Rr as Attachment, Rt as StreamDeltaEvent, S as SessionResetMessage, Sn as Model, Sr as CreateSessionCommand, St as ToolResultEvent, T as sessionOpenedMessageSchema, Tn as assistantMessageEventSchema, Tr as closeShellCommandSchema, Tt as toolProgressEventSchema, U as SignaturePurpose, Un as openShellCommandSchema, Ut as sessionStateSchema, V as ServerMessageType, Vn as shellInputCommandSchema, Vr as attachmentMediaTypeSchema, Vt as sessionStateEventSchema, W as signaturePurposeSchema, Wn as TerminalSize, Wt as SessionSettingsEvent, X as pairMessageSchema, Xn as SlashCommandCommand, Xt as RateLimitEvent, Y as PairMessage, Yn as stopTaskCommandSchema, Yt as mcpServerSchema, Z as HandOffMessage, Zn as slashCommandCommandSchema, Zt as rateLimitEventSchema, _ as shellClosedMessageSchema, _n as commandOutputEventSchema, _r as listSessionsCommandSchema, _t as turnResultEventSchema, a as HOST_SCHEME, an as hookEventSchema, ar as rewindFilesCommandSchema, at as HandshakeMessageType, b as SessionSummary, bn as SlashCommand, br as ForkCommand, bt as ToolUseEvent, c as SCHEME_PAIRING_CODE_DURATION, cn as FileRewindEvent, cr as ResumeAtCommand, ct as AgentEvent, d as serverMessageSchema, dn as contextUsageEventSchema, dr as promptCommandSchema, dt as userMessageEventSchema, en as PermissionRequestEvent, er as PermissionMode, et as challengeMessageSchema, f as ShellOutputMessage, fn as CompactionEvent, fr as PermissionVerdictCommand, ft as UnknownEvent, g as ShellClosedMessage, gn as CommandOutputEvent, gr as ListSessionsCommand, gt as TurnResultEvent, h as shellOpenedMessageSchema, hn as compactionTriggerSchema, hr as permissionBehaviorSchema, ht as turnUsageEventSchema, i as DEFAULT_PORT, in as HookEvent, ir as RewindFilesCommand, it as createBaseHandshakeMessageSchema, j as hostStoppingMessageSchema, jn as createBaseAgentEventSchema, jr as backgroundTasksCommandSchema, jt as todoStatusSchema, k as pairedMessageSchema, kn as messageUuidSchema, kr as closeSessionCommandSchema, kt as todoSchema, l as SHELL_OUTPUT_LENGTH, ln as fileRewindEventSchema, lr as resumeAtCommandSchema, lt as agentEventSchema, m as ShellOpenedMessage, mn as CompactionTrigger, mr as PermissionBehavior, mt as TurnUsageEvent, n as DEFAULT_APP_ORIGIN, nn as HostErrorEvent, nr as SetModelCommand, nt as authenticateMessageSchema, o as PAIRING_CODE_PARAMETER, on as HookPhase, or as ResumeCommand, ot as handshakeMessageTypeSchema, p as shellOutputMessageSchema, pn as compactionEventSchema, pr as permissionVerdictCommandSchema, pt as unknownEventSchema, q as RevokeMessage, qn as driverCommandSchema, qt as sessionInitEventSchema, r as DEFAULT_HOSTNAME, rn as hostErrorEventSchema, rr as setModelCommandSchema, rt as BaseHandshakeMessage, s as PAIRING_HASH_PARAMETER, sn as hookPhaseSchema, sr as resumeCommandSchema, st as EphemeralAgentEventTypes, t as getSignedText, tn as permissionRequestEventSchema, tr as permissionModeSchema, tt as AuthenticateMessage, u as ServerMessage, un as ContextUsageEvent, ur as PromptCommand, ut as UserMessageEvent, v as SessionsMessage, vn as CapabilitiesEvent, vr as InterruptCommand, vt as TokenUsage, w as SessionOpenedMessage, wn as AssistantMessageEvent, wr as CloseShellCommand, wt as ToolProgressEvent, x as sessionSummarySchema, xn as slashCommandSchema, xr as forkCommandSchema, xt as toolUseEventSchema, y as sessionsMessageSchema, yn as capabilitiesEventSchema, yr as interruptCommandSchema, yt as tokenUsageSchema, z as BaseServerMessage, zn as shellResizeCommandSchema, zr as attachmentSchema, zt as streamDeltaEventSchema } from "./contracts-DQwqr8CH.js";
2
2
  export { AgentEvent, AgentEventType, AssistantMessageEvent, Attachment, AttachmentMediaType, AuthenticateMessage, AuthenticatedMessage, BackgroundTasksCommand, BaseAgentEvent, BaseCommand, BaseHandshakeMessage, BaseServerMessage, CapabilitiesEvent, ChallengeMessage, CloseSessionCommand, CloseShellCommand, Command, CommandErrorMessage, CommandOutputEvent, CommandType, CompactionEvent, CompactionTrigger, ContextUsageEvent, CreateSessionCommand, DEFAULT_APP_ORIGIN, DEFAULT_HOSTNAME, DEFAULT_PORT, DriverCommand, EphemeralAgentEventTypes, EventsMessage, FileRewindEvent, ForkCommand, HOST_SCHEME, HandOffMessage, HandshakeMessage, HandshakeMessageType, HookEvent, HookPhase, HostCloseCode, HostErrorEvent, HostStoppingMessage, InterruptCommand, ListSessionsCommand, McpServer, MessageUuid, Model, OpenShellCommand, PAIRING_CODE_PARAMETER, PAIRING_HASH_PARAMETER, PairMessage, PairedMessage, ParentToolUseId, PermissionBehavior, PermissionMode, PermissionRequestEvent, PermissionResolutionEvent, PermissionVerdictCommand, PromptCommand, ProofMessage, RateLimitEvent, ResumeAtCommand, ResumeCommand, RevokeMessage, RewindFilesCommand, SCHEME_PAIRING_CODE_DURATION, SHELL_OUTPUT_LENGTH, ServerMessage, ServerMessageType, SessionId, SessionInitEvent, SessionOpenedMessage, SessionResetMessage, SessionSettingsEvent, SessionState, SessionStateEvent, SessionSummary, SessionsMessage, SetModelCommand, SetPermissionModeCommand, ShellClosedMessage, ShellCommand, ShellId, ShellInputCommand, ShellOpenedMessage, ShellOutputMessage, ShellResizeCommand, SignaturePurpose, SlashCommand, SlashCommandCommand, StopTaskCommand, StreamDeltaEvent, SubagentEvent, SubagentStatus, TerminalSize, ThinkingEvent, Todo, TodoStatus, TodoUpdateEvent, TokenUsage, ToolProgressEvent, ToolResultEvent, ToolUseEvent, TurnResultEvent, TurnUsageEvent, UnknownEvent, UserMessageEvent, agentEventSchema, agentEventTypeSchema, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, authenticateMessageSchema, authenticatedMessageSchema, backgroundTasksCommandSchema, capabilitiesEventSchema, challengeMessageSchema, closeSessionCommandSchema, closeShellCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createBaseAgentEventSchema, createBaseCommandSchema, createBaseHandshakeMessageSchema, createBaseServerMessageSchema, createSessionCommandSchema, driverCommandSchema, eventsMessageSchema, fileRewindEventSchema, forkCommandSchema, getSignedText, handOffMessageSchema, handshakeMessageSchema, handshakeMessageTypeSchema, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, hostStoppingMessageSchema, interruptCommandSchema, listSessionsCommandSchema, mcpServerSchema, messageUuidSchema, modelSchema, openShellCommandSchema, pairMessageSchema, pairedMessageSchema, parentToolUseIdSchema, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, proofMessageSchema, rateLimitEventSchema, resumeAtCommandSchema, resumeCommandSchema, revokeMessageSchema, rewindFilesCommandSchema, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, shellClosedMessageSchema, shellCommandSchema, shellIdSchema, shellInputCommandSchema, shellOpenedMessageSchema, shellOutputMessageSchema, shellResizeCommandSchema, signaturePurposeSchema, slashCommandCommandSchema, slashCommandSchema, stopTaskCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, terminalSizeSchema, thinkingEventSchema, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, unknownEventSchema, userMessageEventSchema };
package/dist/contracts.js CHANGED
@@ -1,2 +1,3 @@
1
- import { $ as eventsMessageSchema, $t as serverMessageTypeSchema, A as forkCommandSchema, At as permissionRequestEventSchema, B as getSignedText, Bt as commandOutputEventSchema, C as resumeCommandSchema, Ct as PermissionMode, D as permissionVerdictCommandSchema, Dt as permissionResolutionEventSchema, E as attachmentSchema, Et as rateLimitEventSchema, F as createBaseCommandSchema, Ft as fileRewindEventSchema, G as shellIdSchema, Gt as parentToolUseIdSchema, H as shellOutputMessageSchema, Ht as slashCommandSchema, I as CommandType, It as contextUsageEventSchema, J as sessionResetMessageSchema, Jt as AgentEventType, K as sessionsMessageSchema, Kt as messageUuidSchema, L as commandTypeSchema, Lt as compactionEventSchema, M as closeSessionCommandSchema, Mt as hookEventSchema, N as backgroundTasksCommandSchema, Nt as HookPhase, O as listSessionsCommandSchema, Ot as PermissionBehavior, P as sessionIdSchema, Pt as hookPhaseSchema, Q as hostStoppingMessageSchema, Qt as ServerMessageType, R as AttachmentMediaType, Rt as CompactionTrigger, S as rewindFilesCommandSchema, St as sessionInitEventSchema, T as promptCommandSchema, Tt as mcpServerSchema, U as shellOpenedMessageSchema, Ut as modelSchema, V as serverMessageSchema, Vt as capabilitiesEventSchema, W as shellClosedMessageSchema, Wt as assistantMessageEventSchema, X as proofMessageSchema, Xt as commandErrorMessageSchema, Y as sessionOpenedMessageSchema, Yt as agentEventTypeSchema, Z as pairedMessageSchema, Zt as authenticatedMessageSchema, _ as driverCommandSchema, _t as streamDeltaEventSchema, a as pairMessageSchema, an as DEFAULT_PORT, at as tokenUsageSchema, b as setPermissionModeCommandSchema, bt as sessionStateSchema, c as authenticateMessageSchema, cn as PAIRING_HASH_PARAMETER, ct as toolProgressEventSchema, d as shellCommandSchema, dn as HandshakeMessageType, dt as TodoStatus, en as createBaseServerMessageSchema, et as agentEventSchema, f as shellResizeCommandSchema, fn as handshakeMessageTypeSchema, ft as todoStatusSchema, g as closeShellCommandSchema, gt as subagentStatusSchema, h as terminalSizeSchema, ht as SubagentStatus, i as revokeMessageSchema, in as DEFAULT_HOSTNAME, it as turnResultEventSchema, j as createSessionCommandSchema, jt as hostErrorEventSchema, k as interruptCommandSchema, kt as permissionBehaviorSchema, l as createBaseHandshakeMessageSchema, ln as SCHEME_PAIRING_CODE_DURATION, lt as todoUpdateEventSchema, m as openShellCommandSchema, mt as subagentEventSchema, n as HostCloseCode, nn as signaturePurposeSchema, nt as unknownEventSchema, o as handOffMessageSchema, on as HOST_SCHEME, ot as toolUseEventSchema, p as shellInputCommandSchema, pt as thinkingEventSchema, q as sessionSummarySchema, qt as createBaseAgentEventSchema, r as handshakeMessageSchema, rn as DEFAULT_APP_ORIGIN, rt as turnUsageEventSchema, s as challengeMessageSchema, sn as PAIRING_CODE_PARAMETER, st as toolResultEventSchema, t as EphemeralAgentEventTypes, tn as SignaturePurpose, tt as userMessageEventSchema, u as commandSchema, un as SHELL_OUTPUT_LENGTH, ut as todoSchema, v as stopTaskCommandSchema, vt as sessionStateEventSchema, w as resumeAtCommandSchema, wt as permissionModeSchema, x as setModelCommandSchema, xt as sessionSettingsEventSchema, y as slashCommandCommandSchema, yt as SessionState, z as attachmentMediaTypeSchema, zt as compactionTriggerSchema } from "./EphemeralAgentEventTypes-DGkHIIcW.js";
1
+ import { $ as eventsMessageSchema, $t as serverMessageTypeSchema, A as forkCommandSchema, At as permissionRequestEventSchema, B as getSignedText, Bt as commandOutputEventSchema, C as resumeCommandSchema, Ct as PermissionMode, D as permissionVerdictCommandSchema, Dt as permissionResolutionEventSchema, E as attachmentSchema, Et as rateLimitEventSchema, F as createBaseCommandSchema, Ft as fileRewindEventSchema, G as shellIdSchema, Gt as parentToolUseIdSchema, H as shellOutputMessageSchema, Ht as slashCommandSchema, I as CommandType, It as contextUsageEventSchema, J as sessionResetMessageSchema, Jt as AgentEventType, K as sessionsMessageSchema, Kt as messageUuidSchema, L as commandTypeSchema, Lt as compactionEventSchema, M as closeSessionCommandSchema, Mt as hookEventSchema, N as backgroundTasksCommandSchema, Nt as HookPhase, O as listSessionsCommandSchema, Ot as PermissionBehavior, P as sessionIdSchema, Pt as hookPhaseSchema, Q as hostStoppingMessageSchema, Qt as ServerMessageType, R as AttachmentMediaType, Rt as CompactionTrigger, S as rewindFilesCommandSchema, St as sessionInitEventSchema, T as promptCommandSchema, Tt as mcpServerSchema, U as shellOpenedMessageSchema, Ut as modelSchema, V as serverMessageSchema, Vt as capabilitiesEventSchema, W as shellClosedMessageSchema, Wt as assistantMessageEventSchema, X as proofMessageSchema, Xt as commandErrorMessageSchema, Y as sessionOpenedMessageSchema, Yt as agentEventTypeSchema, Z as pairedMessageSchema, Zt as authenticatedMessageSchema, _ as driverCommandSchema, _t as streamDeltaEventSchema, a as handOffMessageSchema, an as DEFAULT_PORT, at as tokenUsageSchema, b as setPermissionModeCommandSchema, bt as sessionStateSchema, c as createBaseHandshakeMessageSchema, cn as PAIRING_HASH_PARAMETER, ct as toolProgressEventSchema, d as shellResizeCommandSchema, dn as HandshakeMessageType, dt as TodoStatus, en as createBaseServerMessageSchema, et as agentEventSchema, f as shellInputCommandSchema, fn as handshakeMessageTypeSchema, ft as todoStatusSchema, g as EphemeralAgentEventTypes, gt as subagentStatusSchema, h as closeShellCommandSchema, ht as SubagentStatus, i as pairMessageSchema, in as DEFAULT_HOSTNAME, it as turnResultEventSchema, j as createSessionCommandSchema, jt as hostErrorEventSchema, k as interruptCommandSchema, kt as permissionBehaviorSchema, l as commandSchema, ln as SCHEME_PAIRING_CODE_DURATION, lt as todoUpdateEventSchema, m as terminalSizeSchema, mt as subagentEventSchema, n as handshakeMessageSchema, nn as signaturePurposeSchema, nt as unknownEventSchema, o as challengeMessageSchema, on as HOST_SCHEME, ot as toolUseEventSchema, p as openShellCommandSchema, pt as thinkingEventSchema, q as sessionSummarySchema, qt as createBaseAgentEventSchema, r as revokeMessageSchema, rn as DEFAULT_APP_ORIGIN, rt as turnUsageEventSchema, s as authenticateMessageSchema, sn as PAIRING_CODE_PARAMETER, st as toolResultEventSchema, t as HostCloseCode, tn as SignaturePurpose, tt as userMessageEventSchema, u as shellCommandSchema, un as SHELL_OUTPUT_LENGTH, ut as todoSchema, v as stopTaskCommandSchema, vt as sessionStateEventSchema, w as resumeAtCommandSchema, wt as permissionModeSchema, x as setModelCommandSchema, xt as sessionSettingsEventSchema, y as slashCommandCommandSchema, yt as SessionState, z as attachmentMediaTypeSchema, zt as compactionTriggerSchema } from "./HostCloseCode-eTYq6aIa.js";
2
+ import "./contracts-la_KkjCS.js";
2
3
  export { AgentEventType, AttachmentMediaType, CommandType, CompactionTrigger, DEFAULT_APP_ORIGIN, DEFAULT_HOSTNAME, DEFAULT_PORT, EphemeralAgentEventTypes, HOST_SCHEME, HandshakeMessageType, HookPhase, HostCloseCode, PAIRING_CODE_PARAMETER, PAIRING_HASH_PARAMETER, PermissionBehavior, PermissionMode, SCHEME_PAIRING_CODE_DURATION, SHELL_OUTPUT_LENGTH, ServerMessageType, SessionState, SignaturePurpose, SubagentStatus, TodoStatus, agentEventSchema, agentEventTypeSchema, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, authenticateMessageSchema, authenticatedMessageSchema, backgroundTasksCommandSchema, capabilitiesEventSchema, challengeMessageSchema, closeSessionCommandSchema, closeShellCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createBaseAgentEventSchema, createBaseCommandSchema, createBaseHandshakeMessageSchema, createBaseServerMessageSchema, createSessionCommandSchema, driverCommandSchema, eventsMessageSchema, fileRewindEventSchema, forkCommandSchema, getSignedText, handOffMessageSchema, handshakeMessageSchema, handshakeMessageTypeSchema, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, hostStoppingMessageSchema, interruptCommandSchema, listSessionsCommandSchema, mcpServerSchema, messageUuidSchema, modelSchema, openShellCommandSchema, pairMessageSchema, pairedMessageSchema, parentToolUseIdSchema, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, proofMessageSchema, rateLimitEventSchema, resumeAtCommandSchema, resumeCommandSchema, revokeMessageSchema, rewindFilesCommandSchema, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, shellClosedMessageSchema, shellCommandSchema, shellIdSchema, shellInputCommandSchema, shellOpenedMessageSchema, shellOutputMessageSchema, shellResizeCommandSchema, signaturePurposeSchema, slashCommandCommandSchema, slashCommandSchema, stopTaskCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, terminalSizeSchema, thinkingEventSchema, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, unknownEventSchema, userMessageEventSchema };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ChallengeMessage, $n as setPermissionModeCommandSchema, $t as permissionResolutionEventSchema, A as HostStoppingMessage, An as BaseAgentEvent, Ar as BackgroundTasksCommand, At as TodoStatus, B as createBaseServerMessageSchema, Bn as ShellInputCommand, Br as AttachmentMediaType, Bt as SessionStateEvent, C as sessionResetMessageSchema, Cn as modelSchema, Cr as createSessionCommandSchema, Ct as toolResultEventSchema, D as proofMessageSchema, Dn as parentToolUseIdSchema, Dr as shellIdSchema, Dt as todoUpdateEventSchema, E as ProofMessage, En as ParentToolUseId, Er as ShellId, Et as TodoUpdateEvent, F as CommandErrorMessage, Fn as commandSchema, Fr as createBaseCommandSchema, Ft as subagentEventSchema, G as HandshakeMessage, Gn as terminalSizeSchema, Gt as sessionSettingsEventSchema, H as serverMessageTypeSchema, Hn as OpenShellCommand, Ht as SessionState, I as commandErrorMessageSchema, In as ShellCommand, Ir as CommandType, It as SubagentStatus, J as revokeMessageSchema, Jn as StopTaskCommand, Jt as McpServer, K as handshakeMessageSchema, Kn as DriverCommand, Kt as SessionInitEvent, L as AuthenticatedMessage, Ln as shellCommandSchema, Lr as commandTypeSchema, Lt as subagentStatusSchema, M as HostCloseCode, Mn as AgentEventType, Mr as SessionId, Mt as ThinkingEvent, N as EventsMessage, Nn as agentEventTypeSchema, Nr as sessionIdSchema, Nt as thinkingEventSchema, O as PairedMessage, On as MessageUuid, Or as CloseSessionCommand, Ot as Todo, P as eventsMessageSchema, Pn as Command, Pr as BaseCommand, Pt as SubagentEvent, Q as handOffMessageSchema, Qn as SetPermissionModeCommand, Qt as PermissionResolutionEvent, R as authenticatedMessageSchema, Rn as ShellResizeCommand, Rr as Attachment, Rt as StreamDeltaEvent, S as SessionResetMessage, Sn as Model, Sr as CreateSessionCommand, St as ToolResultEvent, T as sessionOpenedMessageSchema, Tn as assistantMessageEventSchema, Tr as closeShellCommandSchema, Tt as toolProgressEventSchema, U as SignaturePurpose, Un as openShellCommandSchema, Ut as sessionStateSchema, V as ServerMessageType, Vn as shellInputCommandSchema, Vr as attachmentMediaTypeSchema, Vt as sessionStateEventSchema, W as signaturePurposeSchema, Wn as TerminalSize, Wt as SessionSettingsEvent, X as pairMessageSchema, Xn as SlashCommandCommand, Xt as RateLimitEvent, Y as PairMessage, Yn as stopTaskCommandSchema, Yt as mcpServerSchema, Z as HandOffMessage, Zn as slashCommandCommandSchema, Zt as rateLimitEventSchema, _ as shellClosedMessageSchema, _n as commandOutputEventSchema, _r as listSessionsCommandSchema, _t as turnResultEventSchema, a as HOST_SCHEME, an as hookEventSchema, ar as rewindFilesCommandSchema, at as HandshakeMessageType, b as SessionSummary, bn as SlashCommand, br as ForkCommand, bt as ToolUseEvent, c as SCHEME_PAIRING_CODE_DURATION, cn as FileRewindEvent, cr as ResumeAtCommand, ct as AgentEvent, d as serverMessageSchema, dn as contextUsageEventSchema, dr as promptCommandSchema, dt as userMessageEventSchema, en as PermissionRequestEvent, er as PermissionMode, et as challengeMessageSchema, f as ShellOutputMessage, fn as CompactionEvent, fr as PermissionVerdictCommand, ft as UnknownEvent, g as ShellClosedMessage, gn as CommandOutputEvent, gr as ListSessionsCommand, gt as TurnResultEvent, h as shellOpenedMessageSchema, hn as compactionTriggerSchema, hr as permissionBehaviorSchema, ht as turnUsageEventSchema, i as DEFAULT_PORT, in as HookEvent, ir as RewindFilesCommand, it as createBaseHandshakeMessageSchema, j as hostStoppingMessageSchema, jn as createBaseAgentEventSchema, jr as backgroundTasksCommandSchema, jt as todoStatusSchema, k as pairedMessageSchema, kn as messageUuidSchema, kr as closeSessionCommandSchema, kt as todoSchema, l as SHELL_OUTPUT_LENGTH, ln as fileRewindEventSchema, lr as resumeAtCommandSchema, lt as agentEventSchema, m as ShellOpenedMessage, mn as CompactionTrigger, mr as PermissionBehavior, mt as TurnUsageEvent, n as DEFAULT_APP_ORIGIN, nn as HostErrorEvent, nr as SetModelCommand, nt as authenticateMessageSchema, o as PAIRING_CODE_PARAMETER, on as HookPhase, or as ResumeCommand, ot as handshakeMessageTypeSchema, p as shellOutputMessageSchema, pn as compactionEventSchema, pr as permissionVerdictCommandSchema, pt as unknownEventSchema, q as RevokeMessage, qn as driverCommandSchema, qt as sessionInitEventSchema, r as DEFAULT_HOSTNAME, rn as hostErrorEventSchema, rr as setModelCommandSchema, rt as BaseHandshakeMessage, s as PAIRING_HASH_PARAMETER, sn as hookPhaseSchema, sr as resumeCommandSchema, st as EphemeralAgentEventTypes, t as getSignedText, tn as permissionRequestEventSchema, tr as permissionModeSchema, tt as AuthenticateMessage, u as ServerMessage, un as ContextUsageEvent, ur as PromptCommand, ut as UserMessageEvent, v as SessionsMessage, vn as CapabilitiesEvent, vr as InterruptCommand, vt as TokenUsage, w as SessionOpenedMessage, wn as AssistantMessageEvent, wr as CloseShellCommand, wt as ToolProgressEvent, x as sessionSummarySchema, xn as slashCommandSchema, xr as forkCommandSchema, xt as toolUseEventSchema, y as sessionsMessageSchema, yn as capabilitiesEventSchema, yr as interruptCommandSchema, yt as tokenUsageSchema, z as BaseServerMessage, zn as shellResizeCommandSchema, zr as attachmentSchema, zt as streamDeltaEventSchema } from "./getSignedText-DQwqr8CH.js";
1
+ import { $ as ChallengeMessage, $n as setPermissionModeCommandSchema, $t as permissionResolutionEventSchema, A as HostStoppingMessage, An as BaseAgentEvent, Ar as BackgroundTasksCommand, At as TodoStatus, B as createBaseServerMessageSchema, Bn as ShellInputCommand, Br as AttachmentMediaType, Bt as SessionStateEvent, C as sessionResetMessageSchema, Cn as modelSchema, Cr as createSessionCommandSchema, Ct as toolResultEventSchema, D as proofMessageSchema, Dn as parentToolUseIdSchema, Dr as shellIdSchema, Dt as todoUpdateEventSchema, E as ProofMessage, En as ParentToolUseId, Er as ShellId, Et as TodoUpdateEvent, F as CommandErrorMessage, Fn as commandSchema, Fr as createBaseCommandSchema, Ft as subagentEventSchema, G as HandshakeMessage, Gn as terminalSizeSchema, Gt as sessionSettingsEventSchema, H as serverMessageTypeSchema, Hn as OpenShellCommand, Ht as SessionState, I as commandErrorMessageSchema, In as ShellCommand, Ir as CommandType, It as SubagentStatus, J as revokeMessageSchema, Jn as StopTaskCommand, Jt as McpServer, K as handshakeMessageSchema, Kn as DriverCommand, Kt as SessionInitEvent, L as AuthenticatedMessage, Ln as shellCommandSchema, Lr as commandTypeSchema, Lt as subagentStatusSchema, M as HostCloseCode, Mn as AgentEventType, Mr as SessionId, Mt as ThinkingEvent, N as EventsMessage, Nn as agentEventTypeSchema, Nr as sessionIdSchema, Nt as thinkingEventSchema, O as PairedMessage, On as MessageUuid, Or as CloseSessionCommand, Ot as Todo, P as eventsMessageSchema, Pn as Command, Pr as BaseCommand, Pt as SubagentEvent, Q as handOffMessageSchema, Qn as SetPermissionModeCommand, Qt as PermissionResolutionEvent, R as authenticatedMessageSchema, Rn as ShellResizeCommand, Rr as Attachment, Rt as StreamDeltaEvent, S as SessionResetMessage, Sn as Model, Sr as CreateSessionCommand, St as ToolResultEvent, T as sessionOpenedMessageSchema, Tn as assistantMessageEventSchema, Tr as closeShellCommandSchema, Tt as toolProgressEventSchema, U as SignaturePurpose, Un as openShellCommandSchema, Ut as sessionStateSchema, V as ServerMessageType, Vn as shellInputCommandSchema, Vr as attachmentMediaTypeSchema, Vt as sessionStateEventSchema, W as signaturePurposeSchema, Wn as TerminalSize, Wt as SessionSettingsEvent, X as pairMessageSchema, Xn as SlashCommandCommand, Xt as RateLimitEvent, Y as PairMessage, Yn as stopTaskCommandSchema, Yt as mcpServerSchema, Z as HandOffMessage, Zn as slashCommandCommandSchema, Zt as rateLimitEventSchema, _ as shellClosedMessageSchema, _n as commandOutputEventSchema, _r as listSessionsCommandSchema, _t as turnResultEventSchema, a as HOST_SCHEME, an as hookEventSchema, ar as rewindFilesCommandSchema, at as HandshakeMessageType, b as SessionSummary, bn as SlashCommand, br as ForkCommand, bt as ToolUseEvent, c as SCHEME_PAIRING_CODE_DURATION, cn as FileRewindEvent, cr as ResumeAtCommand, ct as AgentEvent, d as serverMessageSchema, dn as contextUsageEventSchema, dr as promptCommandSchema, dt as userMessageEventSchema, en as PermissionRequestEvent, er as PermissionMode, et as challengeMessageSchema, f as ShellOutputMessage, fn as CompactionEvent, fr as PermissionVerdictCommand, ft as UnknownEvent, g as ShellClosedMessage, gn as CommandOutputEvent, gr as ListSessionsCommand, gt as TurnResultEvent, h as shellOpenedMessageSchema, hn as compactionTriggerSchema, hr as permissionBehaviorSchema, ht as turnUsageEventSchema, i as DEFAULT_PORT, in as HookEvent, ir as RewindFilesCommand, it as createBaseHandshakeMessageSchema, j as hostStoppingMessageSchema, jn as createBaseAgentEventSchema, jr as backgroundTasksCommandSchema, jt as todoStatusSchema, k as pairedMessageSchema, kn as messageUuidSchema, kr as closeSessionCommandSchema, kt as todoSchema, l as SHELL_OUTPUT_LENGTH, ln as fileRewindEventSchema, lr as resumeAtCommandSchema, lt as agentEventSchema, m as ShellOpenedMessage, mn as CompactionTrigger, mr as PermissionBehavior, mt as TurnUsageEvent, n as DEFAULT_APP_ORIGIN, nn as HostErrorEvent, nr as SetModelCommand, nt as authenticateMessageSchema, o as PAIRING_CODE_PARAMETER, on as HookPhase, or as ResumeCommand, ot as handshakeMessageTypeSchema, p as shellOutputMessageSchema, pn as compactionEventSchema, pr as permissionVerdictCommandSchema, pt as unknownEventSchema, q as RevokeMessage, qn as driverCommandSchema, qt as sessionInitEventSchema, r as DEFAULT_HOSTNAME, rn as hostErrorEventSchema, rr as setModelCommandSchema, rt as BaseHandshakeMessage, s as PAIRING_HASH_PARAMETER, sn as hookPhaseSchema, sr as resumeCommandSchema, st as EphemeralAgentEventTypes, t as getSignedText, tn as permissionRequestEventSchema, tr as permissionModeSchema, tt as AuthenticateMessage, u as ServerMessage, un as ContextUsageEvent, ur as PromptCommand, ut as UserMessageEvent, v as SessionsMessage, vn as CapabilitiesEvent, vr as InterruptCommand, vt as TokenUsage, w as SessionOpenedMessage, wn as AssistantMessageEvent, wr as CloseShellCommand, wt as ToolProgressEvent, x as sessionSummarySchema, xn as slashCommandSchema, xr as forkCommandSchema, xt as toolUseEventSchema, y as sessionsMessageSchema, yn as capabilitiesEventSchema, yr as interruptCommandSchema, yt as tokenUsageSchema, z as BaseServerMessage, zn as shellResizeCommandSchema, zr as attachmentSchema, zt as streamDeltaEventSchema } from "./contracts-DQwqr8CH.js";
2
2
  import { z } from "zod";
3
3
  import { ItemEntityType } from "@esposter/shared";
4
4
  import { KeyObject } from "node:crypto";
@@ -282,6 +282,7 @@ export declare enum ChildMessageType {
282
282
  CommandError = "CommandError",
283
283
  CommandResult = "CommandResult",
284
284
  Events = "Events",
285
+ Rejoin = "Rejoin",
285
286
  SessionOpen = "SessionOpen",
286
287
  SessionsChange = "SessionsChange"
287
288
  }
@@ -326,6 +327,23 @@ export declare const childEventsMessageSchema: z.ZodObject<{
326
327
  type: z.ZodLiteral<ChildMessageType.Events>;
327
328
  }>;
328
329
  //#endregion
330
+ //#region src/models/window/ChildRejoinMessage.d.ts
331
+ export interface ChildRejoinMessage extends BaseChildMessage<ChildMessageType.Rejoin> {
332
+ sessions: RejoiningSession[];
333
+ }
334
+ export interface RejoiningSession {
335
+ events: AgentEvent[];
336
+ sessionId: string;
337
+ }
338
+ declare const rejoiningSessionSchema: z.ZodObject<{
339
+ events: z.ZodArray<typeof agentEventSchema>;
340
+ sessionId: z.ZodString;
341
+ }>;
342
+ export declare const childRejoinMessageSchema: z.ZodObject<{
343
+ sessions: z.ZodArray<typeof rejoiningSessionSchema>;
344
+ type: z.ZodLiteral<ChildMessageType.Rejoin>;
345
+ }>;
346
+ //#endregion
329
347
  //#region src/models/window/ChildSessionOpenMessage.d.ts
330
348
  export interface ChildSessionOpenMessage extends BaseChildMessage<ChildMessageType.SessionOpen> {
331
349
  sessionId: string;
@@ -342,25 +360,42 @@ export declare const childSessionsChangeMessageSchema: z.ZodObject<{
342
360
  }>;
343
361
  //#endregion
344
362
  //#region src/models/window/ChildMessage.d.ts
345
- export type ChildMessage = ChildCommandErrorMessage | ChildCommandResultMessage | ChildEventsMessage | ChildSessionOpenMessage | ChildSessionsChangeMessage;
346
- export declare const childMessageSchema: z.ZodDiscriminatedUnion<[typeof childCommandErrorMessageSchema, typeof childCommandResultMessageSchema, typeof childEventsMessageSchema, typeof childSessionOpenMessageSchema, typeof childSessionsChangeMessageSchema], "type">;
363
+ export type ChildMessage = ChildCommandErrorMessage | ChildCommandResultMessage | ChildEventsMessage | ChildRejoinMessage | ChildSessionOpenMessage | ChildSessionsChangeMessage;
364
+ export declare const childMessageSchema: z.ZodDiscriminatedUnion<[typeof childCommandErrorMessageSchema, typeof childCommandResultMessageSchema, typeof childEventsMessageSchema, typeof childRejoinMessageSchema, typeof childSessionOpenMessageSchema, typeof childSessionsChangeMessageSchema], "type">;
347
365
  //#endregion
348
366
  //#region src/models/window/SessionChild.d.ts
349
367
  export interface SessionChild {
350
368
  cwd: string;
351
369
  pendingReplyMap: Map<string, PromiseWithResolvers<string>>;
370
+ secretHash: string;
352
371
  webSocket: WebSocket;
353
372
  }
354
373
  //#endregion
374
+ //#region src/models/window/SessionWindowCloseCode.d.ts
375
+ export declare enum SessionWindowCloseCode {
376
+ SessionEnded = 4e3
377
+ }
378
+ //#endregion
355
379
  //#region src/models/window/SessionWindowLaunch.d.ts
356
380
  export interface SessionWindowLaunch {
357
381
  port: number;
358
382
  secret: string;
359
383
  }
360
384
  //#endregion
385
+ //#region src/models/window/SessionWindows.d.ts
386
+ export interface SessionWindows {
387
+ port: number;
388
+ secretHashes: string[];
389
+ }
390
+ export declare const sessionWindowsSchema: z.ZodObject<{
391
+ port: z.ZodNumber;
392
+ secretHashes: z.ZodArray<z.ZodString>;
393
+ }>;
394
+ //#endregion
361
395
  //#region src/models/window/WindowDriverOptions.d.ts
362
396
  export interface WindowDriverOptions {
363
397
  launchSessionWindow: (sessionWindowLaunch: SessionWindowLaunch) => void;
398
+ stateDirectory: string;
364
399
  writeLine: (line: string) => void;
365
400
  }
366
401
  //#endregion
@@ -403,98 +438,6 @@ export declare const writeDevices: (stateDirectory: string, devices: Device[]) =
403
438
  //#region src/services/device/writeStateFile.d.ts
404
439
  export declare const writeStateFile: (stateDirectory: string, filename: string, content: string) => void;
405
440
  //#endregion
406
- //#region src/services/handshake/checkIsSignatureValid.d.ts
407
- export declare const checkIsSignatureValid: (key: KeyObject, purpose: SignaturePurpose, port: number, nonce: string, signature: string) => boolean;
408
- //#endregion
409
- //#region src/services/handshake/getPublicKeyText.d.ts
410
- export declare const getPublicKeyText: (privateKey: KeyObject) => string;
411
- //#endregion
412
- //#region src/services/handshake/signNonce.d.ts
413
- export declare const signNonce: (privateKey: KeyObject, purpose: SignaturePurpose, port: number, nonce: string) => string;
414
- //#endregion
415
- //#region src/services/installer/checkIsHostInstalled.d.ts
416
- export declare const checkIsHostInstalled: () => boolean;
417
- //#endregion
418
- //#region src/services/installer/checkIsSchemeLaunchTampered.d.ts
419
- export declare const checkIsSchemeLaunchTampered: (commandLineArguments: string[]) => boolean;
420
- //#endregion
421
- //#region src/services/installer/constants.d.ts
422
- export declare const HOST_EXECUTABLE_FILENAME = "agent-console-host.exe";
423
- export declare const CLAUDE_CODE_EXECUTABLE_FILENAME = "claude.exe";
424
- export declare const HOST_SCHEME_REGISTRY_KEY: string;
425
- export declare const HOST_DIRECTORY_ENVIRONMENT_VARIABLE: string;
426
- export declare const HOST_INSTALL_DIRECTORY_SEGMENTS: readonly [string, string];
427
- export declare const NODE_PTY_DIRECTORY_NAME = "node-pty";
428
- //#endregion
429
- //#region src/services/installer/getClaudeCodeExecutablePath.d.ts
430
- export declare const getClaudeCodeExecutablePath: () => string | undefined;
431
- //#endregion
432
- //#region src/services/installer/getHostInstallDirectory.d.ts
433
- export declare const getHostInstallDirectory: () => string;
434
- //#endregion
435
- //#region src/services/installer/getSchemeLaunch.d.ts
436
- export declare const getSchemeLaunch: (argument: string) => SchemeLaunch | undefined;
437
- //#endregion
438
- //#region src/services/installer/installHost.d.ts
439
- export declare const installHost: () => string;
440
- //#endregion
441
- //#region src/services/installer/uninstallHost.d.ts
442
- export declare const uninstallHost: () => void;
443
- //#endregion
444
- //#region src/services/server/answerHttpRequest.d.ts
445
- export declare const answerHttpRequest: ({ headers, method }: IncomingMessage, response: ServerResponse) => void;
446
- //#endregion
447
- //#region src/services/server/checkIsTokenValid.d.ts
448
- export declare const checkIsTokenValid: (candidate: string, token: string) => boolean;
449
- //#endregion
450
- //#region src/services/server/constants.d.ts
451
- export declare const HOST_PROBE_TIMEOUT_MS = 2e3;
452
- //#endregion
453
- //#region src/services/server/createAgentConsoleServer.d.ts
454
- export declare const createAgentConsoleServer: ({ createDriver, hostKey, hostname, origin, port, spawnShell, stateDirectory, writeLine }: AgentConsoleServerOptions) => Promise<AgentConsoleServer>;
455
- //#endregion
456
- //#region src/services/server/createEventLog.d.ts
457
- export declare const createEventLog: () => EventLog;
458
- //#endregion
459
- //#region src/services/server/createPairingCodes.d.ts
460
- export declare const createPairingCodes: () => PairingCodes;
461
- //#endregion
462
- //#region src/services/server/handleCommand.d.ts
463
- export declare const handleCommand: (driver: Driver, command: DriverCommand) => Promise<string>;
464
- //#endregion
465
- //#region src/services/server/handleShellCommand.d.ts
466
- export declare const handleShellCommand: (shellRegistry: ShellRegistry, command: ShellCommand) => Promise<string>;
467
- //#endregion
468
- //#region src/services/server/sendServerMessage.d.ts
469
- export declare const sendServerMessage: (webSocket: WebSocket, message: ServerMessage) => void;
470
- //#endregion
471
- //#region src/services/server/sendToRunningHost.d.ts
472
- export declare const sendToRunningHost: (hostname: string, port: number, hostKey: KeyObject, createMessage?: (signature: string) => HandOffMessage | RevokeMessage) => Promise<boolean>;
473
- //#endregion
474
- //#region src/services/shared/createTaskRegistry.d.ts
475
- export declare const createTaskRegistry: () => TaskRegistry;
476
- //#endregion
477
- //#region src/services/shared/readMessageText.d.ts
478
- export declare const readMessageText: (data: RawData) => string;
479
- //#endregion
480
- //#region src/services/shell/constants.d.ts
481
- export declare const CONSOLE_LIST_AGENT_NAME = "conpty_console_list_agent";
482
- //#endregion
483
- //#region src/services/shell/createShellRegistry.d.ts
484
- export declare const createShellRegistry: ({ onClose, onOutput, spawnShell }: ShellRegistryOptions) => ShellRegistry;
485
- //#endregion
486
- //#region src/services/shell/getShellFile.d.ts
487
- export declare const getShellFile: () => string;
488
- //#endregion
489
- //#region src/services/shell/loadNodePty.d.ts
490
- export declare const loadNodePty: () => Promise<typeof NodePty>;
491
- //#endregion
492
- //#region src/services/shell/runConsoleListAgent.d.ts
493
- export declare const runConsoleListAgent: (shellPid: number) => void;
494
- //#endregion
495
- //#region src/services/shell/spawnPtyShell.d.ts
496
- export declare const spawnPtyShell: ({ cols, cwd, rows }: ShellTerminalOptions) => Promise<ShellTerminal>;
497
- //#endregion
498
441
  //#region src/services/drivers/claudeAgentSdk/closeOpenSession.d.ts
499
442
  export declare const closeOpenSession: (sessionId: string, openSession: OpenSession, message: string, { emit, onSessionsChange, openSessionMap }: Pick<SessionOpenerContext, "emit" | "onSessionsChange" | "openSessionMap">) => void;
500
443
  //#endregion
@@ -607,9 +550,12 @@ export declare const SESSION_SUBCOMMAND = "session";
607
550
  export declare const SESSION_SECRET_ENVIRONMENT_VARIABLE: string;
608
551
  export declare const SESSION_SECRET_BYTE_LENGTH = 32;
609
552
  export declare const SESSION_WINDOW_CONNECT_TIMEOUT: number;
553
+ export declare const SESSION_WINDOWS_FILENAME = "session-windows.json";
554
+ export declare const SESSION_WINDOW_REJOIN_DURATION: number;
555
+ export declare const SESSION_WINDOW_RECONNECT_DELAY: number;
610
556
  //#endregion
611
557
  //#region src/services/drivers/window/createWindowDriver.d.ts
612
- export declare const createWindowDriver: ({ onEvents, onSessionOpen, onSessionsChange }: DriverCallbacks, { launchSessionWindow, writeLine }: WindowDriverOptions) => Driver;
558
+ export declare const createWindowDriver: ({ onEvents, onSessionOpen, onSessionsChange }: DriverCallbacks, { launchSessionWindow, stateDirectory, writeLine }: WindowDriverOptions) => Driver;
613
559
  //#endregion
614
560
  //#region src/services/drivers/window/formatSessionLogLine.d.ts
615
561
  export declare const formatSessionLogLine: (event: AgentEvent) => string;
@@ -617,6 +563,9 @@ export declare const formatSessionLogLine: (event: AgentEvent) => string;
617
563
  //#region src/services/drivers/window/launchSessionWindow.d.ts
618
564
  declare const launchSessionWindow$1: ({ port, secret }: SessionWindowLaunch) => void;
619
565
  //#endregion
566
+ //#region src/services/drivers/window/readSessionWindows.d.ts
567
+ export declare const readSessionWindows: (stateDirectory: string) => SessionWindows;
568
+ //#endregion
620
569
  //#region src/services/drivers/window/runSessionChild.d.ts
621
570
  export declare const runSessionChild: (port: number, writeLine: (line: string) => void) => Promise<void>;
622
571
  //#endregion
@@ -624,9 +573,101 @@ export declare const runSessionChild: (port: number, writeLine: (line: string) =
624
573
  export declare const sendChildCommand: (child: SessionChild, command: DriverCommand) => Promise<string>;
625
574
  //#endregion
626
575
  //#region src/services/drivers/window/serveSessionChild.d.ts
627
- export declare const serveSessionChild: (webSocket: WebSocket, createDriver: (callbacks: DriverCallbacks) => Driver, writeLine: (line: string) => void) => Promise<void>;
576
+ export declare const serveSessionChild: (connect: () => WebSocket, createDriver: (callbacks: DriverCallbacks) => Driver, writeLine: (line: string) => void, signal: AbortSignal) => Promise<void>;
628
577
  //#endregion
629
578
  //#region src/services/drivers/window/takeChildReply.d.ts
630
579
  export declare const takeChildReply: ({ pendingReplyMap }: SessionChild, commandId: string) => PromiseWithResolvers<string> | undefined;
631
580
  //#endregion
581
+ //#region src/services/handshake/checkIsSignatureValid.d.ts
582
+ export declare const checkIsSignatureValid: (key: KeyObject, purpose: SignaturePurpose, port: number, nonce: string, signature: string) => boolean;
583
+ //#endregion
584
+ //#region src/services/handshake/getPublicKeyText.d.ts
585
+ export declare const getPublicKeyText: (privateKey: KeyObject) => string;
586
+ //#endregion
587
+ //#region src/services/handshake/signNonce.d.ts
588
+ export declare const signNonce: (privateKey: KeyObject, purpose: SignaturePurpose, port: number, nonce: string) => string;
589
+ //#endregion
590
+ //#region src/services/installer/checkIsHostInstalled.d.ts
591
+ export declare const checkIsHostInstalled: () => boolean;
592
+ //#endregion
593
+ //#region src/services/installer/checkIsSchemeLaunchTampered.d.ts
594
+ export declare const checkIsSchemeLaunchTampered: (commandLineArguments: string[]) => boolean;
595
+ //#endregion
596
+ //#region src/services/installer/constants.d.ts
597
+ export declare const HOST_EXECUTABLE_FILENAME = "agent-console-host.exe";
598
+ export declare const CLAUDE_CODE_EXECUTABLE_FILENAME = "claude.exe";
599
+ export declare const HOST_SCHEME_REGISTRY_KEY: string;
600
+ export declare const HOST_DIRECTORY_ENVIRONMENT_VARIABLE: string;
601
+ export declare const HOST_INSTALL_DIRECTORY_SEGMENTS: readonly [string, string];
602
+ export declare const NODE_PTY_DIRECTORY_NAME = "node-pty";
603
+ //#endregion
604
+ //#region src/services/installer/getClaudeCodeExecutablePath.d.ts
605
+ export declare const getClaudeCodeExecutablePath: () => string | undefined;
606
+ //#endregion
607
+ //#region src/services/installer/getHostInstallDirectory.d.ts
608
+ export declare const getHostInstallDirectory: () => string;
609
+ //#endregion
610
+ //#region src/services/installer/getSchemeLaunch.d.ts
611
+ export declare const getSchemeLaunch: (argument: string) => SchemeLaunch | undefined;
612
+ //#endregion
613
+ //#region src/services/installer/installHost.d.ts
614
+ export declare const installHost: () => string;
615
+ //#endregion
616
+ //#region src/services/installer/uninstallHost.d.ts
617
+ export declare const uninstallHost: () => void;
618
+ //#endregion
619
+ //#region src/services/server/answerHttpRequest.d.ts
620
+ export declare const answerHttpRequest: ({ headers, method }: IncomingMessage, response: ServerResponse) => void;
621
+ //#endregion
622
+ //#region src/services/server/checkIsTokenValid.d.ts
623
+ export declare const checkIsTokenValid: (candidate: string, token: string) => boolean;
624
+ //#endregion
625
+ //#region src/services/server/constants.d.ts
626
+ export declare const HOST_PROBE_TIMEOUT_MS = 2e3;
627
+ //#endregion
628
+ //#region src/services/server/createAgentConsoleServer.d.ts
629
+ export declare const createAgentConsoleServer: ({ createDriver, hostKey, hostname, origin, port, spawnShell, stateDirectory, writeLine }: AgentConsoleServerOptions) => Promise<AgentConsoleServer>;
630
+ //#endregion
631
+ //#region src/services/server/createEventLog.d.ts
632
+ export declare const createEventLog: () => EventLog;
633
+ //#endregion
634
+ //#region src/services/server/createPairingCodes.d.ts
635
+ export declare const createPairingCodes: () => PairingCodes;
636
+ //#endregion
637
+ //#region src/services/server/handleCommand.d.ts
638
+ export declare const handleCommand: (driver: Driver, command: DriverCommand) => Promise<string>;
639
+ //#endregion
640
+ //#region src/services/server/handleShellCommand.d.ts
641
+ export declare const handleShellCommand: (shellRegistry: ShellRegistry, command: ShellCommand) => Promise<string>;
642
+ //#endregion
643
+ //#region src/services/server/sendServerMessage.d.ts
644
+ export declare const sendServerMessage: (webSocket: WebSocket, message: ServerMessage) => void;
645
+ //#endregion
646
+ //#region src/services/server/sendToRunningHost.d.ts
647
+ export declare const sendToRunningHost: (hostname: string, port: number, hostKey: KeyObject, createMessage?: (signature: string) => HandOffMessage | RevokeMessage) => Promise<boolean>;
648
+ //#endregion
649
+ //#region src/services/shared/createTaskRegistry.d.ts
650
+ export declare const createTaskRegistry: () => TaskRegistry;
651
+ //#endregion
652
+ //#region src/services/shared/readMessageText.d.ts
653
+ export declare const readMessageText: (data: RawData) => string;
654
+ //#endregion
655
+ //#region src/services/shell/constants.d.ts
656
+ export declare const CONSOLE_LIST_AGENT_NAME = "conpty_console_list_agent";
657
+ //#endregion
658
+ //#region src/services/shell/createShellRegistry.d.ts
659
+ export declare const createShellRegistry: ({ onClose, onOutput, spawnShell }: ShellRegistryOptions) => ShellRegistry;
660
+ //#endregion
661
+ //#region src/services/shell/getShellFile.d.ts
662
+ export declare const getShellFile: () => string;
663
+ //#endregion
664
+ //#region src/services/shell/loadNodePty.d.ts
665
+ export declare const loadNodePty: () => Promise<typeof NodePty>;
666
+ //#endregion
667
+ //#region src/services/shell/runConsoleListAgent.d.ts
668
+ export declare const runConsoleListAgent: (shellPid: number) => void;
669
+ //#endregion
670
+ //#region src/services/shell/spawnPtyShell.d.ts
671
+ export declare const spawnPtyShell: ({ cols, cwd, rows }: ShellTerminalOptions) => Promise<ShellTerminal>;
672
+ //#endregion
632
673
  export { AgentEvent, AgentEventType, AssistantMessageEvent, Attachment, AttachmentMediaType, AuthenticateMessage, AuthenticatedMessage, BackgroundTasksCommand, BaseAgentEvent, BaseCommand, BaseHandshakeMessage, BaseServerMessage, CapabilitiesEvent, ChallengeMessage, CloseSessionCommand, CloseShellCommand, Command, CommandErrorMessage, CommandOutputEvent, CommandType, CompactionEvent, CompactionTrigger, ContextUsageEvent, CreateSessionCommand, DEFAULT_APP_ORIGIN, DEFAULT_HOSTNAME, DEFAULT_PORT, DriverCommand, EphemeralAgentEventTypes, EventsMessage, FileRewindEvent, ForkCommand, HOST_SCHEME, HandOffMessage, HandshakeMessage, HandshakeMessageType, HookEvent, HookPhase, HostCloseCode, HostErrorEvent, HostStoppingMessage, InterruptCommand, ListSessionsCommand, McpServer, MessageUuid, Model, OpenShellCommand, PAIRING_CODE_PARAMETER, PAIRING_HASH_PARAMETER, PairMessage, PairedMessage, ParentToolUseId, PermissionBehavior, PermissionMode, PermissionRequestEvent, PermissionResolutionEvent, PermissionVerdictCommand, PromptCommand, ProofMessage, RateLimitEvent, ResumeAtCommand, ResumeCommand, RevokeMessage, RewindFilesCommand, SCHEME_PAIRING_CODE_DURATION, SHELL_OUTPUT_LENGTH, ServerMessage, ServerMessageType, SessionId, SessionInitEvent, SessionOpenedMessage, SessionResetMessage, SessionSettingsEvent, SessionState, SessionStateEvent, SessionSummary, SessionsMessage, SetModelCommand, SetPermissionModeCommand, ShellClosedMessage, ShellCommand, ShellId, ShellInputCommand, ShellOpenedMessage, ShellOutputMessage, ShellResizeCommand, SignaturePurpose, SlashCommand, SlashCommandCommand, StopTaskCommand, StreamDeltaEvent, SubagentEvent, SubagentStatus, TerminalSize, ThinkingEvent, Todo, TodoStatus, TodoUpdateEvent, TokenUsage, ToolProgressEvent, ToolResultEvent, ToolUseEvent, TurnResultEvent, TurnUsageEvent, UnknownEvent, UserMessageEvent, agentEventSchema, agentEventTypeSchema, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, authenticateMessageSchema, authenticatedMessageSchema, backgroundTasksCommandSchema, capabilitiesEventSchema, challengeMessageSchema, closeSessionCommandSchema, closeShellCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createBaseAgentEventSchema, createBaseCommandSchema, createBaseHandshakeMessageSchema, createBaseServerMessageSchema, createSessionCommandSchema, driverCommandSchema, eventsMessageSchema, fileRewindEventSchema, forkCommandSchema, getSignedText, handOffMessageSchema, handshakeMessageSchema, handshakeMessageTypeSchema, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, hostStoppingMessageSchema, interruptCommandSchema, launchSessionWindow$1 as launchSessionWindow, listSessionsCommandSchema, mcpServerSchema, messageUuidSchema, modelSchema, openShellCommandSchema, pairMessageSchema, pairedMessageSchema, parentToolUseIdSchema, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, proofMessageSchema, rateLimitEventSchema, resumeAtCommandSchema, resumeCommandSchema, revokeMessageSchema, rewindFilesCommandSchema, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, shellClosedMessageSchema, shellCommandSchema, shellIdSchema, shellInputCommandSchema, shellOpenedMessageSchema, shellOutputMessageSchema, shellResizeCommandSchema, signaturePurposeSchema, slashCommandCommandSchema, slashCommandSchema, stopTaskCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, terminalSizeSchema, thinkingEventSchema, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, unknownEventSchema, userMessageEventSchema };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as eventsMessageSchema, $t as serverMessageTypeSchema, A as forkCommandSchema, At as permissionRequestEventSchema, B as getSignedText, Bt as commandOutputEventSchema, C as resumeCommandSchema, Ct as PermissionMode, D as permissionVerdictCommandSchema, Dt as permissionResolutionEventSchema, E as attachmentSchema, Et as rateLimitEventSchema, F as createBaseCommandSchema, Ft as fileRewindEventSchema, G as shellIdSchema, Gt as parentToolUseIdSchema, H as shellOutputMessageSchema, Ht as slashCommandSchema, I as CommandType, It as contextUsageEventSchema, J as sessionResetMessageSchema, Jt as AgentEventType, K as sessionsMessageSchema, Kt as messageUuidSchema, L as commandTypeSchema, Lt as compactionEventSchema, M as closeSessionCommandSchema, Mt as hookEventSchema, N as backgroundTasksCommandSchema, Nt as HookPhase, O as listSessionsCommandSchema, Ot as PermissionBehavior, P as sessionIdSchema, Pt as hookPhaseSchema, Q as hostStoppingMessageSchema, Qt as ServerMessageType, R as AttachmentMediaType, Rt as CompactionTrigger, S as rewindFilesCommandSchema, St as sessionInitEventSchema, T as promptCommandSchema, Tt as mcpServerSchema, U as shellOpenedMessageSchema, Ut as modelSchema, V as serverMessageSchema, Vt as capabilitiesEventSchema, W as shellClosedMessageSchema, Wt as assistantMessageEventSchema, X as proofMessageSchema, Xt as commandErrorMessageSchema, Y as sessionOpenedMessageSchema, Yt as agentEventTypeSchema, Z as pairedMessageSchema, Zt as authenticatedMessageSchema, _ as driverCommandSchema, _t as streamDeltaEventSchema, a as pairMessageSchema, an as DEFAULT_PORT, at as tokenUsageSchema, b as setPermissionModeCommandSchema, bt as sessionStateSchema, c as authenticateMessageSchema, cn as PAIRING_HASH_PARAMETER, ct as toolProgressEventSchema, d as shellCommandSchema, dn as HandshakeMessageType, dt as TodoStatus, en as createBaseServerMessageSchema, et as agentEventSchema, f as shellResizeCommandSchema, fn as handshakeMessageTypeSchema, ft as todoStatusSchema, g as closeShellCommandSchema, gt as subagentStatusSchema, h as terminalSizeSchema, ht as SubagentStatus, i as revokeMessageSchema, in as DEFAULT_HOSTNAME, it as turnResultEventSchema, j as createSessionCommandSchema, jt as hostErrorEventSchema, k as interruptCommandSchema, kt as permissionBehaviorSchema, l as createBaseHandshakeMessageSchema, ln as SCHEME_PAIRING_CODE_DURATION, lt as todoUpdateEventSchema, m as openShellCommandSchema, mt as subagentEventSchema, n as HostCloseCode, nn as signaturePurposeSchema, nt as unknownEventSchema, o as handOffMessageSchema, on as HOST_SCHEME, ot as toolUseEventSchema, p as shellInputCommandSchema, pt as thinkingEventSchema, q as sessionSummarySchema, qt as createBaseAgentEventSchema, r as handshakeMessageSchema, rn as DEFAULT_APP_ORIGIN, rt as turnUsageEventSchema, s as challengeMessageSchema, sn as PAIRING_CODE_PARAMETER, st as toolResultEventSchema, t as EphemeralAgentEventTypes, tn as SignaturePurpose, tt as userMessageEventSchema, u as commandSchema, un as SHELL_OUTPUT_LENGTH, ut as todoSchema, v as stopTaskCommandSchema, vt as sessionStateEventSchema, w as resumeAtCommandSchema, wt as permissionModeSchema, x as setModelCommandSchema, xt as sessionSettingsEventSchema, y as slashCommandCommandSchema, yt as SessionState, z as attachmentMediaTypeSchema, zt as compactionTriggerSchema } from "./EphemeralAgentEventTypes-DGkHIIcW.js";
2
- import { $ as HOST_DIRECTORY_ENVIRONMENT_VARIABLE, A as sendChildCommand, At as IGNORED_SDK_MESSAGE_TYPES, B as SESSION_SECRET_BYTE_LENGTH, Bt as signNonce, C as serveSessionChild, Ct as createStreamTracker, D as createWindowDriver, Dt as toPermissionRequestEvent, E as launchSessionWindow, Et as toPermissionResult, F as childCommandResultMessageSchema, Ft as getEventId, G as createTaskRegistry, Gt as readHostKey, H as SESSION_SUBCOMMAND, Ht as writeDevices, I as childCommandErrorMessageSchema, It as runDevicesCommand, J as listSessionSummaries, Jt as DEVICES_FILENAME, K as toContentBlockParam, Kt as writeStateFile, L as ChildMessageType, Lt as sendToRunningHost, M as childSessionsChangeMessageSchema, Mt as SETTING_SOURCES, N as childSessionOpenMessageSchema, Nt as closeOpenSession, O as checkIsTokenValid, Ot as createInputQueue, P as childEventsMessageSchema, Pt as toSessionClosedEvents, Q as CLAUDE_CODE_EXECUTABLE_FILENAME, Qt as STATE_DIRECTORY_NAME, R as childMessageTypeSchema, Rt as readMessageText, S as runSessionChild, St as TodoToolName, T as formatSessionLogLine, Tt as createPermissionBridge, U as SESSION_WINDOW_CONNECT_TIMEOUT, Ut as readDevices, V as SESSION_SECRET_ENVIRONMENT_VARIABLE, Vt as checkIsSignatureValid, W as createClaudeAgentSdkDriver, Wt as deviceSchema, X as getClaudeCodeExecutablePath, Xt as PRINTED_PAIRING_CODE_DURATION, Y as createSessionOpener, Yt as HOST_KEY_FILENAME, Z as getHostInstallDirectory, Zt as SECRET_BYTE_LENGTH, _ as uninstallHost, _t as mapTaskMessage, a as CONSOLE_LIST_AGENT_NAME, at as toContextUsageEvent, b as checkIsSchemeLaunchTampered, bt as toUnknownEvent, c as sendServerMessage, ct as readToolUseResultMap, d as createEventLog, dt as toTurnResultEvents, et as HOST_EXECUTABLE_FILENAME, f as answerHttpRequest, ft as toSessionInitEvent, g as hashCredential, gt as mapSystemMessage, h as findDevice, ht as toToolResultText, i as runConsoleListAgent, it as watchSession, j as childMessageSchema, jt as SESSION_LIST_LIMIT, k as takeChildReply, kt as DEFAULT_DENY_MESSAGE, l as handleShellCommand, lt as readSessionHistory, m as getDeviceName, mt as mapUserContent, n as loadNodePty, nt as HOST_SCHEME_REGISTRY_KEY, o as createAgentConsoleServer, ot as toCapabilitiesEvent, p as getPublicKeyText, pt as parseMessageBody, q as readSessionCwd, qt as getStateDirectory, r as getShellFile, rt as NODE_PTY_DIRECTORY_NAME, s as createShellRegistry, st as getSessionTitle, t as spawnPtyShell, tt as HOST_INSTALL_DIRECTORY_SEGMENTS, u as createPairingCodes, ut as createSdkMessageMapper, v as installHost, vt as mapHookMessage, w as handleCommand, wt as createFileOriginTracker, x as checkIsHostInstalled, xt as createTodoTracker, y as getSchemeLaunch, yt as mapAssistantContent, z as createBaseChildMessageSchema, zt as HOST_PROBE_TIMEOUT_MS } from "./spawnPtyShell-CtAiD2BH.js";
3
- export { AgentEventType, AttachmentMediaType, CLAUDE_CODE_EXECUTABLE_FILENAME, CONSOLE_LIST_AGENT_NAME, ChildMessageType, CommandType, CompactionTrigger, DEFAULT_APP_ORIGIN, DEFAULT_DENY_MESSAGE, DEFAULT_HOSTNAME, DEFAULT_PORT, DEVICES_FILENAME, EphemeralAgentEventTypes, HOST_DIRECTORY_ENVIRONMENT_VARIABLE, HOST_EXECUTABLE_FILENAME, HOST_INSTALL_DIRECTORY_SEGMENTS, HOST_KEY_FILENAME, HOST_PROBE_TIMEOUT_MS, HOST_SCHEME, HOST_SCHEME_REGISTRY_KEY, HandshakeMessageType, HookPhase, HostCloseCode, IGNORED_SDK_MESSAGE_TYPES, NODE_PTY_DIRECTORY_NAME, PAIRING_CODE_PARAMETER, PAIRING_HASH_PARAMETER, PRINTED_PAIRING_CODE_DURATION, PermissionBehavior, PermissionMode, SCHEME_PAIRING_CODE_DURATION, SECRET_BYTE_LENGTH, SESSION_LIST_LIMIT, SESSION_SECRET_BYTE_LENGTH, SESSION_SECRET_ENVIRONMENT_VARIABLE, SESSION_SUBCOMMAND, SESSION_WINDOW_CONNECT_TIMEOUT, SETTING_SOURCES, SHELL_OUTPUT_LENGTH, STATE_DIRECTORY_NAME, ServerMessageType, SessionState, SignaturePurpose, SubagentStatus, TodoStatus, TodoToolName, agentEventSchema, agentEventTypeSchema, answerHttpRequest, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, authenticateMessageSchema, authenticatedMessageSchema, backgroundTasksCommandSchema, capabilitiesEventSchema, challengeMessageSchema, checkIsHostInstalled, checkIsSchemeLaunchTampered, checkIsSignatureValid, checkIsTokenValid, childCommandErrorMessageSchema, childCommandResultMessageSchema, childEventsMessageSchema, childMessageSchema, childMessageTypeSchema, childSessionOpenMessageSchema, childSessionsChangeMessageSchema, closeOpenSession, closeSessionCommandSchema, closeShellCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createAgentConsoleServer, createBaseAgentEventSchema, createBaseChildMessageSchema, createBaseCommandSchema, createBaseHandshakeMessageSchema, createBaseServerMessageSchema, createClaudeAgentSdkDriver, createEventLog, createFileOriginTracker, createInputQueue, createPairingCodes, createPermissionBridge, createSdkMessageMapper, createSessionCommandSchema, createSessionOpener, createShellRegistry, createStreamTracker, createTaskRegistry, createTodoTracker, createWindowDriver, deviceSchema, driverCommandSchema, eventsMessageSchema, fileRewindEventSchema, findDevice, forkCommandSchema, formatSessionLogLine, getClaudeCodeExecutablePath, getDeviceName, getEventId, getHostInstallDirectory, getPublicKeyText, getSchemeLaunch, getSessionTitle, getShellFile, getSignedText, getStateDirectory, handOffMessageSchema, handleCommand, handleShellCommand, handshakeMessageSchema, handshakeMessageTypeSchema, hashCredential, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, hostStoppingMessageSchema, installHost, interruptCommandSchema, launchSessionWindow, listSessionSummaries, listSessionsCommandSchema, loadNodePty, mapAssistantContent, mapHookMessage, mapSystemMessage, mapTaskMessage, mapUserContent, mcpServerSchema, messageUuidSchema, modelSchema, openShellCommandSchema, pairMessageSchema, pairedMessageSchema, parentToolUseIdSchema, parseMessageBody, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, proofMessageSchema, rateLimitEventSchema, readDevices, readHostKey, readMessageText, readSessionCwd, readSessionHistory, readToolUseResultMap, resumeAtCommandSchema, resumeCommandSchema, revokeMessageSchema, rewindFilesCommandSchema, runConsoleListAgent, runDevicesCommand, runSessionChild, sendChildCommand, sendServerMessage, sendToRunningHost, serveSessionChild, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, shellClosedMessageSchema, shellCommandSchema, shellIdSchema, shellInputCommandSchema, shellOpenedMessageSchema, shellOutputMessageSchema, shellResizeCommandSchema, signNonce, signaturePurposeSchema, slashCommandCommandSchema, slashCommandSchema, spawnPtyShell, stopTaskCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, takeChildReply, terminalSizeSchema, thinkingEventSchema, toCapabilitiesEvent, toContentBlockParam, toContextUsageEvent, toPermissionRequestEvent, toPermissionResult, toSessionClosedEvents, toSessionInitEvent, toToolResultText, toTurnResultEvents, toUnknownEvent, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, uninstallHost, unknownEventSchema, userMessageEventSchema, watchSession, writeDevices, writeStateFile };
1
+ import { $ as eventsMessageSchema, $t as serverMessageTypeSchema, A as forkCommandSchema, At as permissionRequestEventSchema, B as getSignedText, Bt as commandOutputEventSchema, C as resumeCommandSchema, Ct as PermissionMode, D as permissionVerdictCommandSchema, Dt as permissionResolutionEventSchema, E as attachmentSchema, Et as rateLimitEventSchema, F as createBaseCommandSchema, Ft as fileRewindEventSchema, G as shellIdSchema, Gt as parentToolUseIdSchema, H as shellOutputMessageSchema, Ht as slashCommandSchema, I as CommandType, It as contextUsageEventSchema, J as sessionResetMessageSchema, Jt as AgentEventType, K as sessionsMessageSchema, Kt as messageUuidSchema, L as commandTypeSchema, Lt as compactionEventSchema, M as closeSessionCommandSchema, Mt as hookEventSchema, N as backgroundTasksCommandSchema, Nt as HookPhase, O as listSessionsCommandSchema, Ot as PermissionBehavior, P as sessionIdSchema, Pt as hookPhaseSchema, Q as hostStoppingMessageSchema, Qt as ServerMessageType, R as AttachmentMediaType, Rt as CompactionTrigger, S as rewindFilesCommandSchema, St as sessionInitEventSchema, T as promptCommandSchema, Tt as mcpServerSchema, U as shellOpenedMessageSchema, Ut as modelSchema, V as serverMessageSchema, Vt as capabilitiesEventSchema, W as shellClosedMessageSchema, Wt as assistantMessageEventSchema, X as proofMessageSchema, Xt as commandErrorMessageSchema, Y as sessionOpenedMessageSchema, Yt as agentEventTypeSchema, Z as pairedMessageSchema, Zt as authenticatedMessageSchema, _ as driverCommandSchema, _t as streamDeltaEventSchema, a as handOffMessageSchema, an as DEFAULT_PORT, at as tokenUsageSchema, b as setPermissionModeCommandSchema, bt as sessionStateSchema, c as createBaseHandshakeMessageSchema, cn as PAIRING_HASH_PARAMETER, ct as toolProgressEventSchema, d as shellResizeCommandSchema, dn as HandshakeMessageType, dt as TodoStatus, en as createBaseServerMessageSchema, et as agentEventSchema, f as shellInputCommandSchema, fn as handshakeMessageTypeSchema, ft as todoStatusSchema, g as EphemeralAgentEventTypes, gt as subagentStatusSchema, h as closeShellCommandSchema, ht as SubagentStatus, i as pairMessageSchema, in as DEFAULT_HOSTNAME, it as turnResultEventSchema, j as createSessionCommandSchema, jt as hostErrorEventSchema, k as interruptCommandSchema, kt as permissionBehaviorSchema, l as commandSchema, ln as SCHEME_PAIRING_CODE_DURATION, lt as todoUpdateEventSchema, m as terminalSizeSchema, mt as subagentEventSchema, n as handshakeMessageSchema, nn as signaturePurposeSchema, nt as unknownEventSchema, o as challengeMessageSchema, on as HOST_SCHEME, ot as toolUseEventSchema, p as openShellCommandSchema, pt as thinkingEventSchema, q as sessionSummarySchema, qt as createBaseAgentEventSchema, r as revokeMessageSchema, rn as DEFAULT_APP_ORIGIN, rt as turnUsageEventSchema, s as authenticateMessageSchema, sn as PAIRING_CODE_PARAMETER, st as toolResultEventSchema, t as HostCloseCode, tn as SignaturePurpose, tt as userMessageEventSchema, u as shellCommandSchema, un as SHELL_OUTPUT_LENGTH, ut as todoSchema, v as stopTaskCommandSchema, vt as sessionStateEventSchema, w as resumeAtCommandSchema, wt as permissionModeSchema, x as setModelCommandSchema, xt as sessionSettingsEventSchema, y as slashCommandCommandSchema, yt as SessionState, z as attachmentMediaTypeSchema, zt as compactionTriggerSchema } from "./HostCloseCode-eTYq6aIa.js";
2
+ import { $ as toContentBlockParam, $t as writeStateFile, A as readSessionWindows, At as createStreamTracker, B as childCommandErrorMessageSchema, Bt as closeOpenSession, C as handleCommand, Ct as mapSystemMessage, D as checkIsTokenValid, Dt as toUnknownEvent, E as createWindowDriver, Et as mapAssistantContent, F as childSessionsChangeMessageSchema, Ft as createInputQueue, G as SESSION_SECRET_ENVIRONMENT_VARIABLE, Gt as readMessageText, H as childMessageTypeSchema, Ht as getEventId, I as childSessionOpenMessageSchema, It as DEFAULT_DENY_MESSAGE, J as SESSION_WINDOW_CONNECT_TIMEOUT, Jt as checkIsSignatureValid, K as SESSION_SUBCOMMAND, Kt as HOST_PROBE_TIMEOUT_MS, L as childRejoinMessageSchema, Lt as IGNORED_SDK_MESSAGE_TYPES, M as hashCredential, Mt as createPermissionBridge, N as SessionWindowCloseCode, Nt as toPermissionResult, O as takeChildReply, Ot as createTodoTracker, P as childMessageSchema, Pt as toPermissionRequestEvent, Q as createTaskRegistry, Qt as readHostKey, R as childEventsMessageSchema, Rt as SESSION_LIST_LIMIT, S as serveSessionChild, St as toToolResultText, T as launchSessionWindow, Tt as mapHookMessage, U as createBaseChildMessageSchema, Ut as runDevicesCommand, V as ChildMessageType, Vt as toSessionClosedEvents, W as SESSION_SECRET_BYTE_LENGTH, Wt as sendToRunningHost, X as SESSION_WINDOW_REJOIN_DURATION, Xt as readDevices, Y as SESSION_WINDOW_RECONNECT_DELAY, Yt as writeDevices, Z as createClaudeAgentSdkDriver, Zt as deviceSchema, _ as installHost, _t as createSdkMessageMapper, a as CONSOLE_LIST_AGENT_NAME, an as STATE_DIRECTORY_NAME, at as CLAUDE_CODE_EXECUTABLE_FILENAME, b as checkIsHostInstalled, bt as parseMessageBody, c as sendServerMessage, ct as HOST_INSTALL_DIRECTORY_SEGMENTS, d as createEventLog, dt as watchSession, en as getStateDirectory, et as readSessionCwd, f as answerHttpRequest, ft as toContextUsageEvent, g as uninstallHost, gt as readSessionHistory, h as findDevice, ht as readToolUseResultMap, i as runConsoleListAgent, in as SECRET_BYTE_LENGTH, it as getHostInstallDirectory, j as sessionWindowsSchema, jt as createFileOriginTracker, k as sendChildCommand, kt as TodoToolName, l as handleShellCommand, lt as HOST_SCHEME_REGISTRY_KEY, m as getDeviceName, mt as getSessionTitle, n as loadNodePty, nn as HOST_KEY_FILENAME, nt as createSessionOpener, o as createAgentConsoleServer, ot as HOST_DIRECTORY_ENVIRONMENT_VARIABLE, p as getPublicKeyText, pt as toCapabilitiesEvent, q as SESSION_WINDOWS_FILENAME, qt as signNonce, r as getShellFile, rn as PRINTED_PAIRING_CODE_DURATION, rt as getClaudeCodeExecutablePath, s as createShellRegistry, st as HOST_EXECUTABLE_FILENAME, t as spawnPtyShell, tn as DEVICES_FILENAME, tt as listSessionSummaries, u as createPairingCodes, ut as NODE_PTY_DIRECTORY_NAME, v as getSchemeLaunch, vt as toTurnResultEvents, w as formatSessionLogLine, wt as mapTaskMessage, x as runSessionChild, xt as mapUserContent, y as checkIsSchemeLaunchTampered, yt as toSessionInitEvent, z as childCommandResultMessageSchema, zt as SETTING_SOURCES } from "./spawnPtyShell-CNDdpI2T.js";
3
+ export { AgentEventType, AttachmentMediaType, CLAUDE_CODE_EXECUTABLE_FILENAME, CONSOLE_LIST_AGENT_NAME, ChildMessageType, CommandType, CompactionTrigger, DEFAULT_APP_ORIGIN, DEFAULT_DENY_MESSAGE, DEFAULT_HOSTNAME, DEFAULT_PORT, DEVICES_FILENAME, EphemeralAgentEventTypes, HOST_DIRECTORY_ENVIRONMENT_VARIABLE, HOST_EXECUTABLE_FILENAME, HOST_INSTALL_DIRECTORY_SEGMENTS, HOST_KEY_FILENAME, HOST_PROBE_TIMEOUT_MS, HOST_SCHEME, HOST_SCHEME_REGISTRY_KEY, HandshakeMessageType, HookPhase, HostCloseCode, IGNORED_SDK_MESSAGE_TYPES, NODE_PTY_DIRECTORY_NAME, PAIRING_CODE_PARAMETER, PAIRING_HASH_PARAMETER, PRINTED_PAIRING_CODE_DURATION, PermissionBehavior, PermissionMode, SCHEME_PAIRING_CODE_DURATION, SECRET_BYTE_LENGTH, SESSION_LIST_LIMIT, SESSION_SECRET_BYTE_LENGTH, SESSION_SECRET_ENVIRONMENT_VARIABLE, SESSION_SUBCOMMAND, SESSION_WINDOWS_FILENAME, SESSION_WINDOW_CONNECT_TIMEOUT, SESSION_WINDOW_RECONNECT_DELAY, SESSION_WINDOW_REJOIN_DURATION, SETTING_SOURCES, SHELL_OUTPUT_LENGTH, STATE_DIRECTORY_NAME, ServerMessageType, SessionState, SessionWindowCloseCode, SignaturePurpose, SubagentStatus, TodoStatus, TodoToolName, agentEventSchema, agentEventTypeSchema, answerHttpRequest, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, authenticateMessageSchema, authenticatedMessageSchema, backgroundTasksCommandSchema, capabilitiesEventSchema, challengeMessageSchema, checkIsHostInstalled, checkIsSchemeLaunchTampered, checkIsSignatureValid, checkIsTokenValid, childCommandErrorMessageSchema, childCommandResultMessageSchema, childEventsMessageSchema, childMessageSchema, childMessageTypeSchema, childRejoinMessageSchema, childSessionOpenMessageSchema, childSessionsChangeMessageSchema, closeOpenSession, closeSessionCommandSchema, closeShellCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createAgentConsoleServer, createBaseAgentEventSchema, createBaseChildMessageSchema, createBaseCommandSchema, createBaseHandshakeMessageSchema, createBaseServerMessageSchema, createClaudeAgentSdkDriver, createEventLog, createFileOriginTracker, createInputQueue, createPairingCodes, createPermissionBridge, createSdkMessageMapper, createSessionCommandSchema, createSessionOpener, createShellRegistry, createStreamTracker, createTaskRegistry, createTodoTracker, createWindowDriver, deviceSchema, driverCommandSchema, eventsMessageSchema, fileRewindEventSchema, findDevice, forkCommandSchema, formatSessionLogLine, getClaudeCodeExecutablePath, getDeviceName, getEventId, getHostInstallDirectory, getPublicKeyText, getSchemeLaunch, getSessionTitle, getShellFile, getSignedText, getStateDirectory, handOffMessageSchema, handleCommand, handleShellCommand, handshakeMessageSchema, handshakeMessageTypeSchema, hashCredential, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, hostStoppingMessageSchema, installHost, interruptCommandSchema, launchSessionWindow, listSessionSummaries, listSessionsCommandSchema, loadNodePty, mapAssistantContent, mapHookMessage, mapSystemMessage, mapTaskMessage, mapUserContent, mcpServerSchema, messageUuidSchema, modelSchema, openShellCommandSchema, pairMessageSchema, pairedMessageSchema, parentToolUseIdSchema, parseMessageBody, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, proofMessageSchema, rateLimitEventSchema, readDevices, readHostKey, readMessageText, readSessionCwd, readSessionHistory, readSessionWindows, readToolUseResultMap, resumeAtCommandSchema, resumeCommandSchema, revokeMessageSchema, rewindFilesCommandSchema, runConsoleListAgent, runDevicesCommand, runSessionChild, sendChildCommand, sendServerMessage, sendToRunningHost, serveSessionChild, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionWindowsSchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, shellClosedMessageSchema, shellCommandSchema, shellIdSchema, shellInputCommandSchema, shellOpenedMessageSchema, shellOutputMessageSchema, shellResizeCommandSchema, signNonce, signaturePurposeSchema, slashCommandCommandSchema, slashCommandSchema, spawnPtyShell, stopTaskCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, takeChildReply, terminalSizeSchema, thinkingEventSchema, toCapabilitiesEvent, toContentBlockParam, toContextUsageEvent, toPermissionRequestEvent, toPermissionResult, toSessionClosedEvents, toSessionInitEvent, toToolResultText, toTurnResultEvents, toUnknownEvent, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, uninstallHost, unknownEventSchema, userMessageEventSchema, watchSession, writeDevices, writeStateFile };
@@ -1,9 +1,9 @@
1
- import { B as getSignedText, V as serverMessageSchema, _ as driverCommandSchema, et as agentEventSchema, ft as todoStatusSchema, in as DEFAULT_HOSTNAME, ln as SCHEME_PAIRING_CODE_DURATION, on as HOST_SCHEME, r as handshakeMessageSchema, t as EphemeralAgentEventTypes, u as commandSchema, un as SHELL_OUTPUT_LENGTH, wt as permissionModeSchema } from "./EphemeralAgentEventTypes-DGkHIIcW.js";
1
+ import { B as getSignedText, V as serverMessageSchema, _ as driverCommandSchema, et as agentEventSchema, ft as todoStatusSchema, g as EphemeralAgentEventTypes, in as DEFAULT_HOSTNAME, l as commandSchema, ln as SCHEME_PAIRING_CODE_DURATION, n as handshakeMessageSchema, on as HOST_SCHEME, un as SHELL_OUTPUT_LENGTH, wt as permissionModeSchema } from "./HostCloseCode-eTYq6aIa.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { z } from "zod";
4
4
  import { ID_SEPARATOR, InvalidOperationError, Operation, SITE_NAME, createUniqueArraySchema, exhaustiveGuard, getOrCreate, getResult, getResultAsync, noop, withFinalizerAsync } from "@esposter/shared";
5
5
  import { homedir } from "node:os";
6
- import { dirname, join, relative, win32 } from "node:path";
6
+ import { delimiter, dirname, join, relative, win32 } from "node:path";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, sign, timingSafeEqual, verify } from "node:crypto";
9
9
  import { once } from "node:events";
@@ -13,6 +13,7 @@ import { readFile, readdir } from "node:fs/promises";
13
13
  import { getAssetKeys, getRawAsset, isSea } from "node:sea";
14
14
  import { createServer } from "node:http";
15
15
  import { execFileSync, spawn } from "node:child_process";
16
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
16
17
  //#region src/services/device/constants.ts
17
18
  const STATE_DIRECTORY_NAME = ".agent-console-server";
18
19
  const DEVICES_FILENAME = "devices.json";
@@ -760,6 +761,7 @@ const createSdkMessageMapper = () => {
760
761
  model: "",
761
762
  permissionMode: "default"
762
763
  };
764
+ let isCompacting = false;
763
765
  const updateSettings = (id, createdAt, { model, permissionMode }) => {
764
766
  if (model) settings.model = model;
765
767
  const parsedPermissionMode = permissionModeSchema.safeParse(permissionMode);
@@ -853,13 +855,17 @@ const createSdkMessageMapper = () => {
853
855
  });
854
856
  return [toSessionInitEvent(message, settingsEvent.permissionMode, createdAt), settingsEvent];
855
857
  } else if (message.subtype === "status") {
856
- const stateEvent = {
858
+ const wasCompacting = isCompacting;
859
+ isCompacting = message.status === "compacting";
860
+ const events = [];
861
+ if (isCompacting !== wasCompacting) events.push({
857
862
  createdAt,
858
863
  id: message.uuid,
859
- state: message.status === "compacting" ? "Compacting" : "Running",
864
+ state: isCompacting ? "Compacting" : "Running",
860
865
  type: "SessionState"
861
- };
862
- return message.permissionMode ? [stateEvent, updateSettings(getEventId(message.uuid, "SessionSettings"), createdAt, { permissionMode: message.permissionMode })] : [stateEvent];
866
+ });
867
+ if (message.permissionMode) events.push(updateSettings(getEventId(message.uuid, "SessionSettings"), createdAt, { permissionMode: message.permissionMode }));
868
+ return events;
863
869
  } else if (message.subtype === "thinking_tokens") return streamTracker.readThinkingTokens(message, createdAt);
864
870
  else return mapSystemMessage(message, createdAt);
865
871
  default: return [toUnknownEvent(message.uuid, message.type, JSON.stringify(message), createdAt)];
@@ -998,6 +1004,7 @@ const createSessionOpener = ({ emit, onSessionOpen, onSessionsChange, openSessio
998
1004
  const claudeCodeExecutablePath = getClaudeCodeExecutablePath();
999
1005
  const sessionQuery = query({
1000
1006
  options: {
1007
+ allowDangerouslySkipPermissions: true,
1001
1008
  canUseTool: createPermissionBridge(sessionId, pendingPermissionMap, emit),
1002
1009
  cwd,
1003
1010
  enableFileCheckpointing: true,
@@ -1306,6 +1313,9 @@ const SESSION_SUBCOMMAND = "session";
1306
1313
  const SESSION_SECRET_ENVIRONMENT_VARIABLE = `${SITE_NAME.toUpperCase()}_SESSION_SECRET`;
1307
1314
  const SESSION_SECRET_BYTE_LENGTH = 32;
1308
1315
  const SESSION_WINDOW_CONNECT_TIMEOUT = Temporal.Duration.from({ seconds: 30 }).total("milliseconds");
1316
+ const SESSION_WINDOWS_FILENAME = "session-windows.json";
1317
+ const SESSION_WINDOW_REJOIN_DURATION = Temporal.Duration.from({ minutes: 1 }).total("milliseconds");
1318
+ const SESSION_WINDOW_RECONNECT_DELAY = Temporal.Duration.from({ seconds: 1 }).total("milliseconds");
1309
1319
  //#endregion
1310
1320
  //#region src/models/window/BaseChildMessage.ts
1311
1321
  const createBaseChildMessageSchema = (typeSchema) => z.object({ type: typeSchema });
@@ -1315,6 +1325,7 @@ let ChildMessageType = /* @__PURE__ */ function(ChildMessageType) {
1315
1325
  ChildMessageType["CommandError"] = "CommandError";
1316
1326
  ChildMessageType["CommandResult"] = "CommandResult";
1317
1327
  ChildMessageType["Events"] = "Events";
1328
+ ChildMessageType["Rejoin"] = "Rejoin";
1318
1329
  ChildMessageType["SessionOpen"] = "SessionOpen";
1319
1330
  ChildMessageType["SessionsChange"] = "SessionsChange";
1320
1331
  return ChildMessageType;
@@ -1342,6 +1353,16 @@ const childEventsMessageSchema = z.object({
1342
1353
  sessionId: z.string().min(1)
1343
1354
  });
1344
1355
  //#endregion
1356
+ //#region src/models/window/ChildRejoinMessage.ts
1357
+ const rejoiningSessionSchema = z.object({
1358
+ events: createUniqueArraySchema(agentEventSchema, "id"),
1359
+ sessionId: z.string().min(1)
1360
+ });
1361
+ const childRejoinMessageSchema = z.object({
1362
+ ...createBaseChildMessageSchema(z.literal("Rejoin")).shape,
1363
+ sessions: createUniqueArraySchema(rejoiningSessionSchema, "sessionId")
1364
+ });
1365
+ //#endregion
1345
1366
  //#region src/models/window/ChildSessionOpenMessage.ts
1346
1367
  const childSessionOpenMessageSchema = z.object({
1347
1368
  ...createBaseChildMessageSchema(z.literal("SessionOpen")).shape,
@@ -1356,10 +1377,32 @@ const childMessageSchema = z.discriminatedUnion("type", [
1356
1377
  childCommandErrorMessageSchema,
1357
1378
  childCommandResultMessageSchema,
1358
1379
  childEventsMessageSchema,
1380
+ childRejoinMessageSchema,
1359
1381
  childSessionOpenMessageSchema,
1360
1382
  childSessionsChangeMessageSchema
1361
1383
  ]);
1362
1384
  //#endregion
1385
+ //#region src/models/window/SessionWindowCloseCode.ts
1386
+ let SessionWindowCloseCode = /* @__PURE__ */ function(SessionWindowCloseCode) {
1387
+ SessionWindowCloseCode[SessionWindowCloseCode["SessionEnded"] = 4e3] = "SessionEnded";
1388
+ return SessionWindowCloseCode;
1389
+ }({});
1390
+ //#endregion
1391
+ //#region src/services/device/hashCredential.ts
1392
+ const hashCredential = (credential) => createHash("sha256").update(credential).digest("base64url");
1393
+ //#endregion
1394
+ //#region src/models/window/SessionWindows.ts
1395
+ const sessionWindowsSchema = z.object({
1396
+ port: z.int().min(0),
1397
+ secretHashes: z.array(z.string().min(1))
1398
+ });
1399
+ //#endregion
1400
+ //#region src/services/drivers/window/readSessionWindows.ts
1401
+ const readSessionWindows = (stateDirectory) => getResult(() => sessionWindowsSchema.parse(JSON.parse(readFileSync(join(stateDirectory, SESSION_WINDOWS_FILENAME), "utf8")))).unwrapOr({
1402
+ port: 0,
1403
+ secretHashes: []
1404
+ });
1405
+ //#endregion
1363
1406
  //#region src/services/drivers/window/sendChildCommand.ts
1364
1407
  const sendChildCommand = (child, command) => {
1365
1408
  if (child.webSocket.readyState !== WebSocket.OPEN) throw new InvalidOperationError(Operation.Update, child.cwd, "the session's window closed");
@@ -1385,7 +1428,7 @@ const checkIsTokenValid = (candidate, token) => {
1385
1428
  };
1386
1429
  //#endregion
1387
1430
  //#region src/services/drivers/window/createWindowDriver.ts
1388
- const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { launchSessionWindow, writeLine }) => {
1431
+ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { launchSessionWindow, stateDirectory, writeLine }) => {
1389
1432
  const windowSessionMap = /* @__PURE__ */ new Map();
1390
1433
  const childSet = /* @__PURE__ */ new Set();
1391
1434
  const pendingLaunchMap = /* @__PURE__ */ new Map();
@@ -1394,27 +1437,21 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1394
1437
  const httpServer = createServer((_request, response) => {
1395
1438
  response.writeHead(405).end();
1396
1439
  });
1397
- httpServer.on("upgrade", (request, socket, head) => {
1398
- const secret = request.headers.authorization?.replace(/^Bearer /u, "") ?? "";
1399
- const pendingLaunchEntry = [...pendingLaunchMap].find(([launchSecret]) => checkIsTokenValid(secret, launchSecret));
1400
- if (!pendingLaunchEntry) {
1401
- socket.end("HTTP/1.1 401 Unauthorized\r\n\r\n");
1402
- return;
1403
- }
1404
- const [launchSecret, { connection, timeout }] = pendingLaunchEntry;
1405
- pendingLaunchMap.delete(launchSecret);
1406
- clearTimeout(timeout);
1407
- webSocketServer.handleUpgrade(request, socket, head, (webSocket) => {
1408
- connection.resolve(webSocket);
1409
- });
1410
- });
1411
- let listening;
1412
- const listen = async () => {
1413
- httpServer.listen(0, DEFAULT_HOSTNAME);
1414
- await once(httpServer, "listening");
1415
- const address = httpServer.address();
1416
- return typeof address === "object" && address ? address.port : 0;
1440
+ const rejoinSecretHashSet = new Set(readSessionWindows(stateDirectory).secretHashes);
1441
+ let port = 0;
1442
+ const saveSessionWindows = () => {
1443
+ const secretHashes = [...Array.from(childSet, ({ secretHash }) => secretHash), ...rejoinSecretHashSet];
1444
+ getResult(() => {
1445
+ writeStateFile(stateDirectory, SESSION_WINDOWS_FILENAME, JSON.stringify({
1446
+ port,
1447
+ secretHashes
1448
+ }));
1449
+ }).match(noop, console.error);
1417
1450
  };
1451
+ const rejoinTimeout = setTimeout(() => {
1452
+ rejoinSecretHashSet.clear();
1453
+ saveSessionWindows();
1454
+ }, SESSION_WINDOW_REJOIN_DURATION);
1418
1455
  const getWindowSession = (sessionId) => {
1419
1456
  const windowSession = windowSessionMap.get(sessionId);
1420
1457
  if (!windowSession) throw new InvalidOperationError(Operation.Read, sessionId, "the session is not open on this host");
@@ -1426,7 +1463,17 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1426
1463
  if (windowSession.state !== "Closed") onEvents(sessionId, toSessionClosedEvents(""));
1427
1464
  writeLine(`A session in ${windowSession.child.cwd} closed, and its window with it.`);
1428
1465
  onSessionsChange();
1429
- windowSession.child.webSocket.close();
1466
+ windowSession.child.webSocket.close(4e3);
1467
+ };
1468
+ const holdSession = (child, sessionId) => {
1469
+ windowSessionMap.set(sessionId, {
1470
+ child,
1471
+ cwd: child.cwd,
1472
+ lastActivityAt: /* @__PURE__ */ new Date(),
1473
+ state: "Idle",
1474
+ title: ""
1475
+ });
1476
+ onSessionOpen(sessionId);
1430
1477
  };
1431
1478
  const handleChildMessage = (child, childMessage) => {
1432
1479
  switch (childMessage.type) {
@@ -1451,16 +1498,22 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1451
1498
  if (isHeld && windowSession.state === "Closed") closeWindowSession(sessionId, windowSession);
1452
1499
  return;
1453
1500
  }
1501
+ case "Rejoin":
1502
+ for (const { events, sessionId } of childMessage.sessions) {
1503
+ child.cwd = events.findLast((event) => event.type === "SessionInit")?.cwd ?? child.cwd;
1504
+ holdSession(child, sessionId);
1505
+ writeLine(`A session in ${child.cwd} came back from its window.`);
1506
+ handleChildMessage(child, {
1507
+ events,
1508
+ sessionId,
1509
+ type: "Events"
1510
+ });
1511
+ }
1512
+ onSessionsChange();
1513
+ return;
1454
1514
  case "SessionOpen":
1455
- windowSessionMap.set(childMessage.sessionId, {
1456
- child,
1457
- cwd: child.cwd,
1458
- lastActivityAt: /* @__PURE__ */ new Date(),
1459
- state: "Idle",
1460
- title: ""
1461
- });
1515
+ holdSession(child, childMessage.sessionId);
1462
1516
  writeLine(`A session in ${child.cwd} opened in a window of its own.`);
1463
- onSessionOpen(childMessage.sessionId);
1464
1517
  return;
1465
1518
  case "SessionsChange":
1466
1519
  onSessionsChange();
@@ -1475,12 +1528,59 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1475
1528
  };
1476
1529
  const removeChild = (child) => {
1477
1530
  childSet.delete(child);
1531
+ saveSessionWindows();
1478
1532
  for (const reply of child.pendingReplyMap.values()) reply.reject(new InvalidOperationError(Operation.Update, child.cwd, "the session's window closed"));
1479
1533
  child.pendingReplyMap.clear();
1480
1534
  for (const [sessionId, windowSession] of windowSessionMap) if (windowSession.child === child) closeWindowSession(sessionId, windowSession);
1481
1535
  };
1536
+ const addChild = (webSocket, cwd, secretHash) => {
1537
+ const child = {
1538
+ cwd,
1539
+ pendingReplyMap: /* @__PURE__ */ new Map(),
1540
+ secretHash,
1541
+ webSocket
1542
+ };
1543
+ childSet.add(child);
1544
+ saveSessionWindows();
1545
+ webSocket.on("message", (data) => {
1546
+ receive(child, data);
1547
+ });
1548
+ webSocket.on("close", () => {
1549
+ removeChild(child);
1550
+ });
1551
+ return child;
1552
+ };
1553
+ httpServer.on("upgrade", (request, socket, head) => {
1554
+ const secret = request.headers.authorization?.replace(/^Bearer /u, "") ?? "";
1555
+ const pendingLaunchEntry = [...pendingLaunchMap].find(([launchSecret]) => checkIsTokenValid(secret, launchSecret));
1556
+ if (pendingLaunchEntry) {
1557
+ const [launchSecret, { connection, timeout }] = pendingLaunchEntry;
1558
+ pendingLaunchMap.delete(launchSecret);
1559
+ clearTimeout(timeout);
1560
+ webSocketServer.handleUpgrade(request, socket, head, (webSocket) => {
1561
+ connection.resolve(webSocket);
1562
+ });
1563
+ return;
1564
+ }
1565
+ const secretHash = hashCredential(secret);
1566
+ if (!secret || !rejoinSecretHashSet.delete(secretHash)) {
1567
+ socket.end("HTTP/1.1 401 Unauthorized\r\n\r\n");
1568
+ return;
1569
+ }
1570
+ webSocketServer.handleUpgrade(request, socket, head, (webSocket) => {
1571
+ addChild(webSocket, "", secretHash);
1572
+ });
1573
+ });
1574
+ const listen = async () => {
1575
+ httpServer.listen(0, DEFAULT_HOSTNAME);
1576
+ await once(httpServer, "listening");
1577
+ const address = httpServer.address();
1578
+ port = typeof address === "object" && address ? address.port : 0;
1579
+ saveSessionWindows();
1580
+ };
1581
+ const listening = listen();
1482
1582
  const openWindow = async (cwd) => {
1483
- const port = await (listening ??= listen());
1583
+ await listening;
1484
1584
  const secret = randomBytes(32).toString("base64url");
1485
1585
  const connection = Promise.withResolvers();
1486
1586
  const timeout = setTimeout(() => {
@@ -1496,24 +1596,12 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1496
1596
  secret
1497
1597
  });
1498
1598
  const webSocket = await connection.promise;
1499
- const child = {
1500
- cwd,
1501
- pendingReplyMap: /* @__PURE__ */ new Map(),
1502
- webSocket
1503
- };
1504
- childSet.add(child);
1505
- webSocket.on("message", (data) => {
1506
- receive(child, data);
1507
- });
1508
- webSocket.on("close", () => {
1509
- removeChild(child);
1510
- });
1511
- return child;
1599
+ return addChild(webSocket, cwd, hashCredential(secret));
1512
1600
  };
1513
1601
  const openInWindow = async (cwd, command) => {
1514
1602
  const child = await openWindow(cwd);
1515
1603
  return getResultAsync(() => sendChildCommand(child, command)).match((sessionId) => sessionId, (error) => {
1516
- child.webSocket.close();
1604
+ child.webSocket.close(4e3);
1517
1605
  throw error;
1518
1606
  });
1519
1607
  };
@@ -1544,12 +1632,14 @@ const createWindowDriver = ({ onEvents, onSessionOpen, onSessionsChange }, { lau
1544
1632
  connection.reject(new InvalidOperationError(Operation.Create, createWindowDriver.name, "the host is stopping"));
1545
1633
  }
1546
1634
  pendingLaunchMap.clear();
1635
+ clearTimeout(rejoinTimeout);
1636
+ rejoinSecretHashSet.clear();
1547
1637
  const children = [...childSet];
1548
- for (const { webSocket } of children) webSocket.terminate();
1638
+ for (const { webSocket } of children) webSocket.close(4e3);
1549
1639
  await Promise.all(children.map(({ webSocket }) => once(webSocket, "close")));
1550
1640
  await taskRegistry.drain();
1551
- if (!listening) return;
1552
1641
  await listening;
1642
+ saveSessionWindows();
1553
1643
  httpServer.close();
1554
1644
  await once(httpServer, "close");
1555
1645
  },
@@ -1727,10 +1817,12 @@ const handleCommand = async (driver, command) => {
1727
1817
  };
1728
1818
  //#endregion
1729
1819
  //#region src/services/drivers/window/serveSessionChild.ts
1730
- const serveSessionChild = async (webSocket, createDriver, writeLine) => {
1820
+ const serveSessionChild = async (connect, createDriver, writeLine, signal) => {
1731
1821
  const taskRegistry = createTaskRegistry();
1822
+ const sessionEventMap = /* @__PURE__ */ new Map();
1823
+ let webSocket;
1732
1824
  const send = (childMessage) => {
1733
- if (webSocket.readyState === WebSocket.OPEN) webSocket.send(JSON.stringify(childMessage));
1825
+ if (webSocket?.readyState === WebSocket.OPEN) webSocket.send(JSON.stringify(childMessage));
1734
1826
  };
1735
1827
  const driver = createDriver({
1736
1828
  onEvents: (sessionId, events) => {
@@ -1738,6 +1830,8 @@ const serveSessionChild = async (webSocket, createDriver, writeLine) => {
1738
1830
  const line = formatSessionLogLine(event);
1739
1831
  if (line) writeLine(line);
1740
1832
  }
1833
+ getOrCreate(sessionEventMap, sessionId, () => []).push(...events.filter(({ type }) => !EphemeralAgentEventTypes.includes(type)));
1834
+ if (events.some((event) => event.type === "SessionState" && event.state === "Closed")) sessionEventMap.delete(sessionId);
1741
1835
  send({
1742
1836
  events,
1743
1837
  sessionId,
@@ -1745,6 +1839,7 @@ const serveSessionChild = async (webSocket, createDriver, writeLine) => {
1745
1839
  });
1746
1840
  },
1747
1841
  onSessionOpen: (sessionId) => {
1842
+ sessionEventMap.set(sessionId, []);
1748
1843
  send({
1749
1844
  sessionId,
1750
1845
  type: "SessionOpen"
@@ -1777,10 +1872,39 @@ const serveSessionChild = async (webSocket, createDriver, writeLine) => {
1777
1872
  });
1778
1873
  });
1779
1874
  };
1780
- webSocket.on("message", (data) => {
1781
- taskRegistry.run(() => receive(readMessageText(data)));
1875
+ signal.addEventListener("abort", () => {
1876
+ webSocket?.close();
1782
1877
  });
1783
- await once(webSocket, "close");
1878
+ let isRejoining = false;
1879
+ while (!signal.aborted) {
1880
+ const currentWebSocket = connect();
1881
+ webSocket = currentWebSocket;
1882
+ let isRefused = false;
1883
+ currentWebSocket.on("message", (data) => {
1884
+ taskRegistry.run(() => receive(readMessageText(data)));
1885
+ });
1886
+ currentWebSocket.on("error", noop);
1887
+ currentWebSocket.on("unexpected-response", () => {
1888
+ isRefused = true;
1889
+ currentWebSocket.terminate();
1890
+ });
1891
+ if (isRejoining) currentWebSocket.once("open", () => {
1892
+ writeLine("The host is back, and has this session again.");
1893
+ send({
1894
+ sessions: Array.from(sessionEventMap, ([sessionId, events]) => ({
1895
+ events,
1896
+ sessionId
1897
+ })),
1898
+ type: "Rejoin"
1899
+ });
1900
+ });
1901
+ const [code] = await once(currentWebSocket, "close");
1902
+ if (isRefused && isRejoining) writeLine("The host did not take this session back, so it ends here.");
1903
+ if (signal.aborted || isRefused || code === 4e3 || sessionEventMap.size === 0) break;
1904
+ if (!isRejoining) writeLine("The host went away. This session keeps running, and comes back when the host is started again.");
1905
+ isRejoining = true;
1906
+ await setTimeout$1(SESSION_WINDOW_RECONNECT_DELAY);
1907
+ }
1784
1908
  await driver.close();
1785
1909
  await taskRegistry.drain();
1786
1910
  };
@@ -1790,16 +1914,21 @@ const runSessionChild = async (port, writeLine) => {
1790
1914
  const secret = process.env[SESSION_SECRET_ENVIRONMENT_VARIABLE] ?? "";
1791
1915
  Reflect.deleteProperty(process.env, SESSION_SECRET_ENVIRONMENT_VARIABLE);
1792
1916
  process.title = `${SITE_NAME} session`;
1793
- const webSocket = new WebSocket(`ws://${DEFAULT_HOSTNAME}:${port}`, { headers: { authorization: `Bearer ${secret}` } });
1794
- const serving = serveSessionChild(webSocket, createClaudeAgentSdkDriver, writeLine);
1795
- await once(webSocket, "open");
1796
- writeLine("This window shows one session as it runs. Type to it in the page.\nTo stop it, close this window.\n");
1917
+ const stateDirectory = getStateDirectory();
1918
+ let isFirstConnection = true;
1919
+ const connect = () => {
1920
+ const hostPort = isFirstConnection ? port : readSessionWindows(stateDirectory).port;
1921
+ isFirstConnection = false;
1922
+ return new WebSocket(`ws://${DEFAULT_HOSTNAME}:${hostPort}`, { headers: { authorization: `Bearer ${secret}` } });
1923
+ };
1924
+ const abortController = new AbortController();
1797
1925
  const stop = () => {
1798
- webSocket.close();
1926
+ abortController.abort();
1799
1927
  };
1800
1928
  process.once("SIGINT", stop);
1801
1929
  process.once("SIGHUP", stop);
1802
- await serving;
1930
+ writeLine("This window shows one session as it runs. Type to it in the page.\nTo stop it, close this window.\n");
1931
+ await serveSessionChild(connect, createClaudeAgentSdkDriver, writeLine, abortController.signal);
1803
1932
  };
1804
1933
  //#endregion
1805
1934
  //#region src/services/installer/checkIsHostInstalled.ts
@@ -1878,9 +2007,6 @@ const uninstallHost = () => {
1878
2007
  }).unref();
1879
2008
  };
1880
2009
  //#endregion
1881
- //#region src/services/device/hashCredential.ts
1882
- const hashCredential = (credential) => createHash("sha256").update(credential).digest("base64url");
1883
- //#endregion
1884
2010
  //#region src/services/device/findDevice.ts
1885
2011
  const findDevice = (devices, credential) => {
1886
2012
  const credentialHash = hashCredential(credential);
@@ -2340,7 +2466,12 @@ const runConsoleListAgent = (shellPid) => {
2340
2466
  };
2341
2467
  //#endregion
2342
2468
  //#region src/services/shell/getShellFile.ts
2343
- const getShellFile = () => process.platform === "win32" ? "powershell.exe" : process.env.SHELL ?? "/bin/sh";
2469
+ const POWERSHELL_FILE = "pwsh.exe";
2470
+ const WINDOWS_POWERSHELL_FILE = "powershell.exe";
2471
+ const getShellFile = () => {
2472
+ if (process.platform !== "win32") return process.env.SHELL ?? "/bin/sh";
2473
+ return (process.env.PATH ?? "").split(delimiter).filter(Boolean).some((pathDirectory) => existsSync(join(pathDirectory, POWERSHELL_FILE))) ? POWERSHELL_FILE : WINDOWS_POWERSHELL_FILE;
2474
+ };
2344
2475
  //#endregion
2345
2476
  //#region src/services/shell/loadNodePty.ts
2346
2477
  const loadNodePty = () => {
@@ -2354,13 +2485,14 @@ const spawnPtyShell = async ({ cols, cwd, rows }) => {
2354
2485
  const { spawn } = await getResultAsync(() => loadNodePty()).match((nodePty) => nodePty, () => {
2355
2486
  throw new InvalidOperationError(Operation.Create, cwd, "this host has no terminal support, so no shell can start");
2356
2487
  });
2488
+ const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => key.toLowerCase() !== "psmodulepath"));
2357
2489
  return spawn(getShellFile(), [], {
2358
2490
  cols,
2359
2491
  cwd,
2360
- env: process.env,
2492
+ env,
2361
2493
  name: "xterm-256color",
2362
2494
  rows
2363
2495
  });
2364
2496
  };
2365
2497
  //#endregion
2366
- export { HOST_DIRECTORY_ENVIRONMENT_VARIABLE as $, sendChildCommand as A, IGNORED_SDK_MESSAGE_TYPES as At, SESSION_SECRET_BYTE_LENGTH as B, signNonce as Bt, serveSessionChild as C, createStreamTracker as Ct, createWindowDriver as D, toPermissionRequestEvent as Dt, launchSessionWindow as E, toPermissionResult as Et, childCommandResultMessageSchema as F, getEventId as Ft, createTaskRegistry as G, readHostKey as Gt, SESSION_SUBCOMMAND as H, writeDevices as Ht, childCommandErrorMessageSchema as I, runDevicesCommand as It, listSessionSummaries as J, DEVICES_FILENAME as Jt, toContentBlockParam as K, writeStateFile as Kt, ChildMessageType as L, sendToRunningHost as Lt, childSessionsChangeMessageSchema as M, SETTING_SOURCES as Mt, childSessionOpenMessageSchema as N, closeOpenSession as Nt, checkIsTokenValid as O, createInputQueue as Ot, childEventsMessageSchema as P, toSessionClosedEvents as Pt, CLAUDE_CODE_EXECUTABLE_FILENAME as Q, STATE_DIRECTORY_NAME as Qt, childMessageTypeSchema as R, readMessageText as Rt, runSessionChild as S, TodoToolName as St, formatSessionLogLine as T, createPermissionBridge as Tt, SESSION_WINDOW_CONNECT_TIMEOUT as U, readDevices as Ut, SESSION_SECRET_ENVIRONMENT_VARIABLE as V, checkIsSignatureValid as Vt, createClaudeAgentSdkDriver as W, deviceSchema as Wt, getClaudeCodeExecutablePath as X, PRINTED_PAIRING_CODE_DURATION as Xt, createSessionOpener as Y, HOST_KEY_FILENAME as Yt, getHostInstallDirectory as Z, SECRET_BYTE_LENGTH as Zt, uninstallHost as _, mapTaskMessage as _t, CONSOLE_LIST_AGENT_NAME as a, toContextUsageEvent as at, checkIsSchemeLaunchTampered as b, toUnknownEvent as bt, sendServerMessage as c, readToolUseResultMap as ct, createEventLog as d, toTurnResultEvents as dt, HOST_EXECUTABLE_FILENAME as et, answerHttpRequest as f, toSessionInitEvent as ft, hashCredential as g, mapSystemMessage as gt, findDevice as h, toToolResultText as ht, runConsoleListAgent as i, watchSession as it, childMessageSchema as j, SESSION_LIST_LIMIT as jt, takeChildReply as k, DEFAULT_DENY_MESSAGE as kt, handleShellCommand as l, readSessionHistory as lt, getDeviceName as m, mapUserContent as mt, loadNodePty as n, HOST_SCHEME_REGISTRY_KEY as nt, createAgentConsoleServer as o, toCapabilitiesEvent as ot, getPublicKeyText as p, parseMessageBody as pt, readSessionCwd as q, getStateDirectory as qt, getShellFile as r, NODE_PTY_DIRECTORY_NAME as rt, createShellRegistry as s, getSessionTitle as st, spawnPtyShell as t, HOST_INSTALL_DIRECTORY_SEGMENTS as tt, createPairingCodes as u, createSdkMessageMapper as ut, installHost as v, mapHookMessage as vt, handleCommand as w, createFileOriginTracker as wt, checkIsHostInstalled as x, createTodoTracker as xt, getSchemeLaunch as y, mapAssistantContent as yt, createBaseChildMessageSchema as z, HOST_PROBE_TIMEOUT_MS as zt };
2498
+ export { toContentBlockParam as $, writeStateFile as $t, readSessionWindows as A, createStreamTracker as At, childCommandErrorMessageSchema as B, closeOpenSession as Bt, handleCommand as C, mapSystemMessage as Ct, checkIsTokenValid as D, toUnknownEvent as Dt, createWindowDriver as E, mapAssistantContent as Et, childSessionsChangeMessageSchema as F, createInputQueue as Ft, SESSION_SECRET_ENVIRONMENT_VARIABLE as G, readMessageText as Gt, childMessageTypeSchema as H, getEventId as Ht, childSessionOpenMessageSchema as I, DEFAULT_DENY_MESSAGE as It, SESSION_WINDOW_CONNECT_TIMEOUT as J, checkIsSignatureValid as Jt, SESSION_SUBCOMMAND as K, HOST_PROBE_TIMEOUT_MS as Kt, childRejoinMessageSchema as L, IGNORED_SDK_MESSAGE_TYPES as Lt, hashCredential as M, createPermissionBridge as Mt, SessionWindowCloseCode as N, toPermissionResult as Nt, takeChildReply as O, createTodoTracker as Ot, childMessageSchema as P, toPermissionRequestEvent as Pt, createTaskRegistry as Q, readHostKey as Qt, childEventsMessageSchema as R, SESSION_LIST_LIMIT as Rt, serveSessionChild as S, toToolResultText as St, launchSessionWindow as T, mapHookMessage as Tt, createBaseChildMessageSchema as U, runDevicesCommand as Ut, ChildMessageType as V, toSessionClosedEvents as Vt, SESSION_SECRET_BYTE_LENGTH as W, sendToRunningHost as Wt, SESSION_WINDOW_REJOIN_DURATION as X, readDevices as Xt, SESSION_WINDOW_RECONNECT_DELAY as Y, writeDevices as Yt, createClaudeAgentSdkDriver as Z, deviceSchema as Zt, installHost as _, createSdkMessageMapper as _t, CONSOLE_LIST_AGENT_NAME as a, STATE_DIRECTORY_NAME as an, CLAUDE_CODE_EXECUTABLE_FILENAME as at, checkIsHostInstalled as b, parseMessageBody as bt, sendServerMessage as c, HOST_INSTALL_DIRECTORY_SEGMENTS as ct, createEventLog as d, watchSession as dt, getStateDirectory as en, readSessionCwd as et, answerHttpRequest as f, toContextUsageEvent as ft, uninstallHost as g, readSessionHistory as gt, findDevice as h, readToolUseResultMap as ht, runConsoleListAgent as i, SECRET_BYTE_LENGTH as in, getHostInstallDirectory as it, sessionWindowsSchema as j, createFileOriginTracker as jt, sendChildCommand as k, TodoToolName as kt, handleShellCommand as l, HOST_SCHEME_REGISTRY_KEY as lt, getDeviceName as m, getSessionTitle as mt, loadNodePty as n, HOST_KEY_FILENAME as nn, createSessionOpener as nt, createAgentConsoleServer as o, HOST_DIRECTORY_ENVIRONMENT_VARIABLE as ot, getPublicKeyText as p, toCapabilitiesEvent as pt, SESSION_WINDOWS_FILENAME as q, signNonce as qt, getShellFile as r, PRINTED_PAIRING_CODE_DURATION as rn, getClaudeCodeExecutablePath as rt, createShellRegistry as s, HOST_EXECUTABLE_FILENAME as st, spawnPtyShell as t, DEVICES_FILENAME as tn, listSessionSummaries as tt, createPairingCodes as u, NODE_PTY_DIRECTORY_NAME as ut, getSchemeLaunch as v, toTurnResultEvents as vt, formatSessionLogLine as w, mapTaskMessage as wt, runSessionChild as x, mapUserContent as xt, checkIsSchemeLaunchTampered as y, toSessionInitEvent as yt, childCommandResultMessageSchema as z, SETTING_SOURCES as zt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-console-server",
3
- "version": "3.5.1",
3
+ "version": "3.7.0",
4
4
  "description": "The host behind the Esposter agent console — a loopback WebSocket that runs Claude Code sessions through the Claude Agent SDK and speaks a typed wire to the page.",
5
5
  "keywords": [
6
6
  "agent",
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",
48
+ "dev": "tsdown --watch --ignore-watch src/index.ts --on-success \"node bin/cli.js --origin http://localhost:3000\"",
48
49
  "build:sea": "tsdown -c tsdown.sea.config.ts && node scripts/copyClaudeCodeExecutable.ts && node scripts/copyNodePty.ts && node scripts/writeSeaConfig.ts && node --build-sea dist-sea/sea-config.json",
49
- "export:gen": "generate-exports",
50
50
  "format": "oxfmt",
51
51
  "format:check": "oxfmt --check",
52
52
  "lint": "eslint .",
@@ -56,13 +56,13 @@
56
56
  "typecheck": "tsc"
57
57
  },
58
58
  "dependencies": {
59
- "@anthropic-ai/claude-agent-sdk": "^0.3.283",
60
- "@esposter/shared": "3.5.1",
59
+ "@anthropic-ai/claude-agent-sdk": "^0.3.284",
60
+ "@esposter/shared": "3.7.0",
61
61
  "ws": "^8.22.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@arethetypeswrong/core": "^0.18.5",
65
- "@esposter/configuration": "3.5.1",
65
+ "@esposter/configuration": "3.7.0",
66
66
  "@types/node": "^26.6.3",
67
67
  "@types/ws": "^8.18.1",
68
68
  "publint": "^0.3.24",
@@ -75,5 +75,5 @@
75
75
  "optionalDependencies": {
76
76
  "node-pty": "^1.1.0"
77
77
  },
78
- "gitHead": "69b1fb432ea9261d04104f25308cc9f66c8c8594"
78
+ "gitHead": "7fd06688d06adf6dafff4bd869cd7a33d8028688"
79
79
  }