agent-console-server 3.4.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,36 +1,114 @@
1
- import { G as TOKEN_QUERY_PARAMETER, H as DEFAULT_HOSTNAME, U as DEFAULT_PORT, V as DEFAULT_APP_ORIGIN, W as PAIRING_HASH_PARAMETER } from "./EphemeralAgentEventTypes-Cm5oNQXu.js";
2
- import { a as createAgentConsoleServer, d as createClaudeAgentSdkDriver, t as readToken } from "./readToken-BSQZ8ZVf.js";
3
- import { RoutePath } from "@esposter/shared";
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";
3
+ import { RoutePath, getResult, getResultAsync } from "@esposter/shared";
4
4
  import { hostname } from "node:os";
5
+ import { basename } from "node:path";
6
+ import { randomBytes } from "node:crypto";
5
7
  import { once } from "node:events";
8
+ import { isSea } from "node:sea";
6
9
  import { parseArgs } from "node:util";
7
10
  //#region src/cli.ts
8
- const { values } = parseArgs({ options: {
9
- hostname: {
10
- default: DEFAULT_HOSTNAME,
11
- type: "string"
12
- },
13
- origin: {
14
- default: DEFAULT_APP_ORIGIN,
15
- type: "string"
16
- },
17
- port: {
18
- default: String(DEFAULT_PORT),
19
- type: "string"
11
+ if (checkIsSchemeLaunchTampered(process.argv.slice(2))) {
12
+ process.stderr.write("This link tried to start the host with settings of its own, so it was not started.\n");
13
+ process.exit(1);
14
+ }
15
+ const { positionals, values } = parseArgs({
16
+ allowPositionals: true,
17
+ options: {
18
+ hostname: {
19
+ default: DEFAULT_HOSTNAME,
20
+ type: "string"
21
+ },
22
+ origin: {
23
+ default: DEFAULT_APP_ORIGIN,
24
+ type: "string"
25
+ },
26
+ port: {
27
+ default: String(DEFAULT_PORT),
28
+ type: "string"
29
+ },
30
+ revoke: {
31
+ default: "",
32
+ type: "string"
33
+ }
20
34
  }
21
- } });
22
- const token = readToken();
23
- const server = await createAgentConsoleServer({
24
- createDriver: (callbacks) => createClaudeAgentSdkDriver(callbacks),
25
- hostname: values.hostname,
26
- port: Number(values.port),
27
- token
28
35
  });
36
+ const [firstPositional = ""] = positionals;
37
+ const writeLine = (line) => {
38
+ process.stdout.write(`${line}
39
+ `);
40
+ };
41
+ if (basename(firstPositional) === "conpty_console_list_agent") {
42
+ runConsoleListAgent(Number(positionals[1]));
43
+ process.exit(0);
44
+ }
45
+ if (firstPositional === "session") {
46
+ await runSessionChild(Number(values.port), writeLine);
47
+ process.exit(0);
48
+ }
49
+ if (firstPositional === "uninstall") {
50
+ uninstallHost();
51
+ process.stdout.write("The host is uninstalled, and its folder is removed once this window closes.\n");
52
+ process.exit(0);
53
+ }
54
+ if (isSea() && !checkIsHostInstalled()) getResult(() => installHost()).match((installDirectory) => {
55
+ process.stdout.write(`Installed the host in ${installDirectory}. The page's Connect starts it from now on.\n\n`);
56
+ }, (error) => {
57
+ process.stderr.write(`Could not install the host: ${error.message}\nClose any other host window, then open this file again.\n`);
58
+ process.exit(1);
59
+ });
60
+ const schemeLaunch = getSchemeLaunch(firstPositional);
61
+ const stateDirectory = getStateDirectory();
62
+ const hostKey = readHostKey(stateDirectory);
63
+ const port = Number(values.port);
29
64
  const reachableHostname = values.hostname === "0.0.0.0" ? hostname() : values.hostname;
30
- const hostUrl = `ws://${reachableHostname}:${server.port}/?${TOKEN_QUERY_PARAMETER}=${token}`;
31
- const pairingUrl = `${values.origin}${RoutePath.AgentConsole}#${PAIRING_HASH_PARAMETER}=${encodeURIComponent(hostUrl)}`;
32
- process.stdout.write(`Agent console host listening on ${reachableHostname}:${server.port}\n\nOpen to pair:\n ${pairingUrl}\n\nOr paste this host URL into the page:\n ${hostUrl}\n`);
33
- await once(process, "SIGINT");
65
+ if (firstPositional === "devices") process.exit(await runDevicesCommand({
66
+ hostKey,
67
+ hostname: reachableHostname,
68
+ port,
69
+ revokeDeviceId: values.revoke,
70
+ stateDirectory
71
+ }, writeLine) ? 0 : 1);
72
+ const server = await getResultAsync(() => createAgentConsoleServer({
73
+ createDriver: (callbacks) => process.platform === "win32" && values.hostname === "127.0.0.1" ? createWindowDriver(callbacks, {
74
+ launchSessionWindow,
75
+ writeLine
76
+ }) : createClaudeAgentSdkDriver(callbacks),
77
+ hostKey,
78
+ hostname: values.hostname,
79
+ origin: values.origin,
80
+ port,
81
+ spawnShell: spawnPtyShell,
82
+ stateDirectory,
83
+ writeLine
84
+ })).match((agentConsoleServer) => agentConsoleServer, async (error) => {
85
+ if (!schemeLaunch || !("code" in error) || error.code !== "EADDRINUSE") throw error;
86
+ const { code } = schemeLaunch;
87
+ if (await sendToRunningHost(reachableHostname, port, hostKey, code ? (signature) => ({
88
+ code,
89
+ signature,
90
+ type: "HandOff"
91
+ }) : void 0)) {
92
+ process.stdout.write("The host is already running in another window.\n");
93
+ process.exit(0);
94
+ }
95
+ process.stderr.write(`Another program is using port ${port}, so the host cannot start. Close it and connect again.\n`);
96
+ process.exit(1);
97
+ });
98
+ if (schemeLaunch) {
99
+ if (schemeLaunch.code) server.addPairingCode(schemeLaunch.code, SCHEME_PAIRING_CODE_DURATION);
100
+ process.stdout.write("The host is running. Keep this window open.\n\nTo stop, close this window.\n");
101
+ } else {
102
+ const code = randomBytes(32).toString("base64url");
103
+ server.addPairingCode(code, PRINTED_PAIRING_CODE_DURATION);
104
+ const hostAddress = `ws://${reachableHostname}:${server.port}`;
105
+ const pairingUrl = `${values.origin}${RoutePath.AgentConsole}#${new URLSearchParams({
106
+ [PAIRING_CODE_PARAMETER]: code,
107
+ [PAIRING_HASH_PARAMETER]: hostAddress
108
+ })}`;
109
+ process.stdout.write(`The host is running. Keep this window open.\n\nTo connect, press Connect on the page, or hold Ctrl and click this link in the next ten minutes:\n ${pairingUrl}\n\nTo add this machine from another computer, enter its address and this code in the page's sessions tab:\n ${code}\n\nTo stop, close this window.\n`);
110
+ }
111
+ await Promise.race([once(process, "SIGINT"), once(process, "SIGHUP")]);
34
112
  await server.close();
35
113
  //#endregion
36
114
  export {};
@@ -1,2 +1,2 @@
1
- import { $ as SubagentStatus, $t as SlashCommandCommand, A as unknownEventSchema, An as sessionIdSchema, At as compactionEventSchema, B as toolResultEventSchema, Bt as modelSchema, C as serverMessageTypeSchema, Cn as ForkCommand, Ct as HookPhase, D as UserMessageEvent, Dn as CloseSessionCommand, Dt as ContextUsageEvent, E as agentEventSchema, En as createSessionCommandSchema, Et as fileRewindEventSchema, F as TokenUsage, Fn as Attachment, Ft as CapabilitiesEvent, G as Todo, Gt as MessageUuid, H as toolProgressEventSchema, Ht as assistantMessageEventSchema, I as tokenUsageSchema, In as attachmentSchema, It as capabilitiesEventSchema, J as todoStatusSchema, Jt as createBaseAgentEventSchema, K as todoSchema, Kt as messageUuidSchema, L as ToolUseEvent, Ln as AttachmentMediaType, Lt as SlashCommand, M as turnUsageEventSchema, Mn as createBaseCommandSchema, Mt as compactionTriggerSchema, N as TurnResultEvent, Nn as CommandType, Nt as CommandOutputEvent, O as userMessageEventSchema, On as closeSessionCommandSchema, Ot as contextUsageEventSchema, P as turnResultEventSchema, Pn as commandTypeSchema, Pt as commandOutputEventSchema, Q as subagentEventSchema, Qt as commandSchema, R as toolUseEventSchema, Rn as attachmentMediaTypeSchema, Rt as slashCommandSchema, S as ServerMessageType, Sn as interruptCommandSchema, St as hookEventSchema, T as AgentEvent, Tn as CreateSessionCommand, Tt as FileRewindEvent, U as TodoUpdateEvent, Ut as ParentToolUseId, V as ToolProgressEvent, Vt as AssistantMessageEvent, W as todoUpdateEventSchema, Wt as parentToolUseIdSchema, X as thinkingEventSchema, Xt as agentEventTypeSchema, Y as ThinkingEvent, Yt as AgentEventType, Z as SubagentEvent, Zt as Command, _ as eventsMessageSchema, _n as PermissionBehavior, _t as PermissionRequestEvent, a as TOKEN_QUERY_PARAMETER, an as SetModelCommand, at as SessionState, b as BaseServerMessage, bn as listSessionsCommandSchema, bt as hostErrorEventSchema, c as SessionsMessage, cn as rewindFilesCommandSchema, ct as sessionSettingsEventSchema, d as sessionSummarySchema, dn as ResumeAtCommand, dt as McpServer, en as slashCommandCommandSchema, et as subagentStatusSchema, f as SessionResetMessage, fn as resumeAtCommandSchema, ft as mcpServerSchema, g as EventsMessage, gn as permissionVerdictCommandSchema, gt as permissionResolutionEventSchema, h as sessionOpenedMessageSchema, hn as PermissionVerdictCommand, ht as PermissionResolutionEvent, i as PAIRING_HASH_PARAMETER, in as permissionModeSchema, it as sessionStateEventSchema, j as TurnUsageEvent, jn as BaseCommand, jt as CompactionTrigger, k as UnknownEvent, kn as SessionId, kt as CompactionEvent, l as sessionsMessageSchema, ln as ResumeCommand, lt as SessionInitEvent, m as SessionOpenedMessage, mn as promptCommandSchema, mt as rateLimitEventSchema, n as DEFAULT_HOSTNAME, nn as setPermissionModeCommandSchema, nt as streamDeltaEventSchema, o as ServerMessage, on as setModelCommandSchema, ot as sessionStateSchema, p as sessionResetMessageSchema, pn as PromptCommand, pt as RateLimitEvent, q as TodoStatus, qt as BaseAgentEvent, r as DEFAULT_PORT, rn as PermissionMode, rt as SessionStateEvent, s as serverMessageSchema, sn as RewindFilesCommand, st as SessionSettingsEvent, t as DEFAULT_APP_ORIGIN, tn as SetPermissionModeCommand, tt as StreamDeltaEvent, u as SessionSummary, un as resumeCommandSchema, ut as sessionInitEventSchema, v as CommandErrorMessage, vn as permissionBehaviorSchema, vt as permissionRequestEventSchema, w as EphemeralAgentEventTypes, wn as forkCommandSchema, wt as hookPhaseSchema, x as createBaseServerMessageSchema, xn as InterruptCommand, xt as HookEvent, y as commandErrorMessageSchema, yn as ListSessionsCommand, yt as HostErrorEvent, z as ToolResultEvent, zt as Model } from "./constants-eNCfNezp.js";
2
- export { AgentEvent, AgentEventType, AssistantMessageEvent, Attachment, AttachmentMediaType, BaseAgentEvent, BaseCommand, BaseServerMessage, CapabilitiesEvent, CloseSessionCommand, Command, CommandErrorMessage, CommandOutputEvent, CommandType, CompactionEvent, CompactionTrigger, ContextUsageEvent, CreateSessionCommand, DEFAULT_APP_ORIGIN, DEFAULT_HOSTNAME, DEFAULT_PORT, EphemeralAgentEventTypes, EventsMessage, FileRewindEvent, ForkCommand, HookEvent, HookPhase, HostErrorEvent, InterruptCommand, ListSessionsCommand, McpServer, MessageUuid, Model, PAIRING_HASH_PARAMETER, ParentToolUseId, PermissionBehavior, PermissionMode, PermissionRequestEvent, PermissionResolutionEvent, PermissionVerdictCommand, PromptCommand, RateLimitEvent, ResumeAtCommand, ResumeCommand, RewindFilesCommand, ServerMessage, ServerMessageType, SessionId, SessionInitEvent, SessionOpenedMessage, SessionResetMessage, SessionSettingsEvent, SessionState, SessionStateEvent, SessionSummary, SessionsMessage, SetModelCommand, SetPermissionModeCommand, SlashCommand, SlashCommandCommand, StreamDeltaEvent, SubagentEvent, SubagentStatus, TOKEN_QUERY_PARAMETER, ThinkingEvent, Todo, TodoStatus, TodoUpdateEvent, TokenUsage, ToolProgressEvent, ToolResultEvent, ToolUseEvent, TurnResultEvent, TurnUsageEvent, UnknownEvent, UserMessageEvent, agentEventSchema, agentEventTypeSchema, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, capabilitiesEventSchema, closeSessionCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createBaseAgentEventSchema, createBaseCommandSchema, createBaseServerMessageSchema, createSessionCommandSchema, eventsMessageSchema, fileRewindEventSchema, forkCommandSchema, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, interruptCommandSchema, listSessionsCommandSchema, mcpServerSchema, messageUuidSchema, modelSchema, parentToolUseIdSchema, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, rateLimitEventSchema, resumeAtCommandSchema, resumeCommandSchema, rewindFilesCommandSchema, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, slashCommandCommandSchema, slashCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, thinkingEventSchema, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, unknownEventSchema, userMessageEventSchema };
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";
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,3 +1,2 @@
1
- import { A as compactionTriggerSchema, B as agentEventTypeSchema, C as AttachmentMediaType, D as HookPhase, E as subagentStatusSchema, F as PermissionBehavior, G as TOKEN_QUERY_PARAMETER, H as DEFAULT_HOSTNAME, I as permissionBehaviorSchema, L as SessionState, M as todoStatusSchema, N as PermissionMode, O as hookPhaseSchema, P as permissionModeSchema, R as sessionStateSchema, S as createBaseCommandSchema, T as SubagentStatus, U as DEFAULT_PORT, V as DEFAULT_APP_ORIGIN, W as PAIRING_HASH_PARAMETER, _ as createSessionCommandSchema, a as slashCommandCommandSchema, b as CommandType, c as rewindFilesCommandSchema, d as promptCommandSchema, f as attachmentSchema, g as forkCommandSchema, h as interruptCommandSchema, i as commandSchema, j as TodoStatus, k as CompactionTrigger, l as resumeCommandSchema, m as listSessionsCommandSchema, n as ServerMessageType, o as setPermissionModeCommandSchema, p as permissionVerdictCommandSchema, r as serverMessageTypeSchema, s as setModelCommandSchema, t as EphemeralAgentEventTypes, u as resumeAtCommandSchema, v as closeSessionCommandSchema, w as attachmentMediaTypeSchema, x as commandTypeSchema, y as sessionIdSchema, z as AgentEventType } from "./EphemeralAgentEventTypes-Cm5oNQXu.js";
2
- import { A as hostErrorEventSchema, B as parentToolUseIdSchema, C as sessionStateEventSchema, D as rateLimitEventSchema, E as mcpServerSchema, F as commandOutputEventSchema, H as createBaseAgentEventSchema, I as capabilitiesEventSchema, L as slashCommandSchema, M as fileRewindEventSchema, N as contextUsageEventSchema, O as permissionResolutionEventSchema, P as compactionEventSchema, R as modelSchema, S as streamDeltaEventSchema, T as sessionInitEventSchema, V as messageUuidSchema, _ as toolProgressEventSchema, a as sessionOpenedMessageSchema, b as thinkingEventSchema, c as createBaseServerMessageSchema, d as unknownEventSchema, f as turnUsageEventSchema, g as toolResultEventSchema, h as toolUseEventSchema, i as sessionResetMessageSchema, j as hookEventSchema, k as permissionRequestEventSchema, l as agentEventSchema, m as tokenUsageSchema, n as sessionsMessageSchema, o as eventsMessageSchema, p as turnResultEventSchema, r as sessionSummarySchema, s as commandErrorMessageSchema, t as serverMessageSchema, u as userMessageEventSchema, v as todoUpdateEventSchema, w as sessionSettingsEventSchema, x as subagentEventSchema, y as todoSchema, z as assistantMessageEventSchema } from "./ServerMessage-Deh-bExC.js";
3
- export { AgentEventType, AttachmentMediaType, CommandType, CompactionTrigger, DEFAULT_APP_ORIGIN, DEFAULT_HOSTNAME, DEFAULT_PORT, EphemeralAgentEventTypes, HookPhase, PAIRING_HASH_PARAMETER, PermissionBehavior, PermissionMode, ServerMessageType, SessionState, SubagentStatus, TOKEN_QUERY_PARAMETER, TodoStatus, agentEventSchema, agentEventTypeSchema, assistantMessageEventSchema, attachmentMediaTypeSchema, attachmentSchema, capabilitiesEventSchema, closeSessionCommandSchema, commandErrorMessageSchema, commandOutputEventSchema, commandSchema, commandTypeSchema, compactionEventSchema, compactionTriggerSchema, contextUsageEventSchema, createBaseAgentEventSchema, createBaseCommandSchema, createBaseServerMessageSchema, createSessionCommandSchema, eventsMessageSchema, fileRewindEventSchema, forkCommandSchema, hookEventSchema, hookPhaseSchema, hostErrorEventSchema, interruptCommandSchema, listSessionsCommandSchema, mcpServerSchema, messageUuidSchema, modelSchema, parentToolUseIdSchema, permissionBehaviorSchema, permissionModeSchema, permissionRequestEventSchema, permissionResolutionEventSchema, permissionVerdictCommandSchema, promptCommandSchema, rateLimitEventSchema, resumeAtCommandSchema, resumeCommandSchema, rewindFilesCommandSchema, serverMessageSchema, serverMessageTypeSchema, sessionIdSchema, sessionInitEventSchema, sessionOpenedMessageSchema, sessionResetMessageSchema, sessionSettingsEventSchema, sessionStateEventSchema, sessionStateSchema, sessionSummarySchema, sessionsMessageSchema, setModelCommandSchema, setPermissionModeCommandSchema, slashCommandCommandSchema, slashCommandSchema, streamDeltaEventSchema, subagentEventSchema, subagentStatusSchema, thinkingEventSchema, todoSchema, todoStatusSchema, todoUpdateEventSchema, tokenUsageSchema, toolProgressEventSchema, toolResultEventSchema, toolUseEventSchema, turnResultEventSchema, turnUsageEventSchema, unknownEventSchema, userMessageEventSchema };
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
+ 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 };
@@ -25,11 +25,14 @@ declare const attachmentSchema: z.ZodObject<{
25
25
  //#endregion
26
26
  //#region src/models/command/CommandType.d.ts
27
27
  declare enum CommandType {
28
+ BackgroundTasks = "BackgroundTasks",
28
29
  CloseSession = "CloseSession",
30
+ CloseShell = "CloseShell",
29
31
  CreateSession = "CreateSession",
30
32
  Fork = "Fork",
31
33
  Interrupt = "Interrupt",
32
34
  ListSessions = "ListSessions",
35
+ OpenShell = "OpenShell",
33
36
  PermissionVerdict = "PermissionVerdict",
34
37
  Prompt = "Prompt",
35
38
  Resume = "Resume",
@@ -37,7 +40,10 @@ declare enum CommandType {
37
40
  RewindFiles = "RewindFiles",
38
41
  SetModel = "SetModel",
39
42
  SetPermissionMode = "SetPermissionMode",
40
- SlashCommand = "SlashCommand"
43
+ ShellInput = "ShellInput",
44
+ ShellResize = "ShellResize",
45
+ SlashCommand = "SlashCommand",
46
+ StopTask = "StopTask"
41
47
  }
42
48
  declare const commandTypeSchema: z.ZodEnum<typeof CommandType>;
43
49
  //#endregion
@@ -58,6 +64,14 @@ declare const sessionIdSchema: z.ZodObject<{
58
64
  sessionId: z.ZodString;
59
65
  }>;
60
66
  //#endregion
67
+ //#region src/models/command/BackgroundTasksCommand.d.ts
68
+ interface BackgroundTasksCommand extends BaseCommand<CommandType.BackgroundTasks>, SessionId {}
69
+ declare const backgroundTasksCommandSchema: z.ZodObject<{
70
+ id: z.ZodString;
71
+ sessionId: z.ZodString;
72
+ type: z.ZodLiteral<CommandType.BackgroundTasks>;
73
+ }>;
74
+ //#endregion
61
75
  //#region src/models/command/CloseSessionCommand.d.ts
62
76
  interface CloseSessionCommand extends BaseCommand<CommandType.CloseSession>, SessionId {}
63
77
  declare const closeSessionCommandSchema: z.ZodObject<{
@@ -66,6 +80,22 @@ declare const closeSessionCommandSchema: z.ZodObject<{
66
80
  type: z.ZodLiteral<CommandType.CloseSession>;
67
81
  }>;
68
82
  //#endregion
83
+ //#region src/models/command/ShellId.d.ts
84
+ interface ShellId {
85
+ shellId: string;
86
+ }
87
+ declare const shellIdSchema: z.ZodObject<{
88
+ shellId: z.ZodString;
89
+ }>;
90
+ //#endregion
91
+ //#region src/models/command/CloseShellCommand.d.ts
92
+ interface CloseShellCommand extends BaseCommand<CommandType.CloseShell>, ShellId {}
93
+ declare const closeShellCommandSchema: z.ZodObject<{
94
+ id: z.ZodString;
95
+ shellId: z.ZodString;
96
+ type: z.ZodLiteral<CommandType.CloseShell>;
97
+ }>;
98
+ //#endregion
69
99
  //#region src/models/command/CreateSessionCommand.d.ts
70
100
  interface CreateSessionCommand extends BaseCommand<CommandType.CreateSession> {
71
101
  cwd: string;
@@ -214,9 +244,72 @@ declare const slashCommandCommandSchema: z.ZodObject<{
214
244
  type: z.ZodLiteral<CommandType.SlashCommand>;
215
245
  }>;
216
246
  //#endregion
247
+ //#region src/models/command/StopTaskCommand.d.ts
248
+ interface StopTaskCommand extends BaseCommand<CommandType.StopTask>, SessionId {
249
+ taskId: string;
250
+ }
251
+ declare const stopTaskCommandSchema: z.ZodObject<{
252
+ id: z.ZodString;
253
+ sessionId: z.ZodString;
254
+ taskId: z.ZodString;
255
+ type: z.ZodLiteral<CommandType.StopTask>;
256
+ }>;
257
+ //#endregion
258
+ //#region src/models/command/DriverCommand.d.ts
259
+ type DriverCommand = BackgroundTasksCommand | CloseSessionCommand | CreateSessionCommand | ForkCommand | InterruptCommand | ListSessionsCommand | PermissionVerdictCommand | PromptCommand | ResumeAtCommand | ResumeCommand | RewindFilesCommand | SetModelCommand | SetPermissionModeCommand | SlashCommandCommand | StopTaskCommand;
260
+ declare const driverCommandSchema: z.ZodDiscriminatedUnion<[typeof backgroundTasksCommandSchema, typeof closeSessionCommandSchema, typeof createSessionCommandSchema, typeof forkCommandSchema, typeof interruptCommandSchema, typeof listSessionsCommandSchema, typeof permissionVerdictCommandSchema, typeof promptCommandSchema, typeof resumeAtCommandSchema, typeof resumeCommandSchema, typeof rewindFilesCommandSchema, typeof setModelCommandSchema, typeof setPermissionModeCommandSchema, typeof slashCommandCommandSchema, typeof stopTaskCommandSchema], "type">;
261
+ //#endregion
262
+ //#region src/models/command/TerminalSize.d.ts
263
+ interface TerminalSize {
264
+ cols: number;
265
+ rows: number;
266
+ }
267
+ declare const terminalSizeSchema: z.ZodObject<{
268
+ cols: z.ZodInt;
269
+ rows: z.ZodInt;
270
+ }>;
271
+ //#endregion
272
+ //#region src/models/command/OpenShellCommand.d.ts
273
+ interface OpenShellCommand extends BaseCommand<CommandType.OpenShell>, SessionId, TerminalSize {
274
+ cwd: string;
275
+ }
276
+ declare const openShellCommandSchema: z.ZodObject<{
277
+ cols: z.ZodInt;
278
+ cwd: z.ZodString;
279
+ id: z.ZodString;
280
+ rows: z.ZodInt;
281
+ sessionId: z.ZodString;
282
+ type: z.ZodLiteral<CommandType.OpenShell>;
283
+ }>;
284
+ //#endregion
285
+ //#region src/models/command/ShellInputCommand.d.ts
286
+ interface ShellInputCommand extends BaseCommand<CommandType.ShellInput>, ShellId {
287
+ data: string;
288
+ }
289
+ declare const shellInputCommandSchema: z.ZodObject<{
290
+ data: z.ZodString;
291
+ id: z.ZodString;
292
+ shellId: z.ZodString;
293
+ type: z.ZodLiteral<CommandType.ShellInput>;
294
+ }>;
295
+ //#endregion
296
+ //#region src/models/command/ShellResizeCommand.d.ts
297
+ interface ShellResizeCommand extends BaseCommand<CommandType.ShellResize>, ShellId, TerminalSize {}
298
+ declare const shellResizeCommandSchema: z.ZodObject<{
299
+ cols: z.ZodInt;
300
+ id: z.ZodString;
301
+ rows: z.ZodInt;
302
+ shellId: z.ZodString;
303
+ type: z.ZodLiteral<CommandType.ShellResize>;
304
+ }>;
305
+ //#endregion
306
+ //#region src/models/command/ShellCommand.d.ts
307
+ type ShellCommand = CloseShellCommand | OpenShellCommand | ShellInputCommand | ShellResizeCommand;
308
+ declare const shellCommandSchema: z.ZodDiscriminatedUnion<[typeof closeShellCommandSchema, typeof openShellCommandSchema, typeof shellInputCommandSchema, typeof shellResizeCommandSchema], "type">;
309
+ //#endregion
217
310
  //#region src/models/command/Command.d.ts
218
- type Command = CloseSessionCommand | CreateSessionCommand | ForkCommand | InterruptCommand | ListSessionsCommand | PermissionVerdictCommand | PromptCommand | ResumeAtCommand | ResumeCommand | RewindFilesCommand | SetModelCommand | SetPermissionModeCommand | SlashCommandCommand;
219
- declare const commandSchema: z.ZodDiscriminatedUnion<[typeof closeSessionCommandSchema, typeof createSessionCommandSchema, typeof forkCommandSchema, typeof interruptCommandSchema, typeof listSessionsCommandSchema, typeof permissionVerdictCommandSchema, typeof promptCommandSchema, typeof resumeAtCommandSchema, typeof resumeCommandSchema, typeof rewindFilesCommandSchema, typeof setModelCommandSchema, typeof setPermissionModeCommandSchema, typeof slashCommandCommandSchema], "type">;
311
+ type Command = DriverCommand | ShellCommand;
312
+ declare const commandSchema: z.ZodDiscriminatedUnion<[...(typeof driverCommandSchema)["options"], ...(typeof shellCommandSchema)["options"]], "type">;
220
313
  //#endregion
221
314
  //#region src/models/event/AgentEventType.d.ts
222
315
  declare enum AgentEventType {
@@ -805,13 +898,96 @@ declare const agentEventSchema: z.ZodDiscriminatedUnion<[typeof assistantMessage
805
898
  //#region src/models/event/EphemeralAgentEventTypes.d.ts
806
899
  declare const EphemeralAgentEventTypes: readonly AgentEventType[];
807
900
  //#endregion
901
+ //#region src/models/handshake/HandshakeMessageType.d.ts
902
+ declare enum HandshakeMessageType {
903
+ Authenticate = "Authenticate",
904
+ Challenge = "Challenge",
905
+ HandOff = "HandOff",
906
+ Pair = "Pair",
907
+ Revoke = "Revoke"
908
+ }
909
+ declare const handshakeMessageTypeSchema: z.ZodEnum<typeof HandshakeMessageType>;
910
+ //#endregion
911
+ //#region src/models/handshake/BaseHandshakeMessage.d.ts
912
+ interface BaseHandshakeMessage<T extends HandshakeMessageType> extends ItemEntityType<T> {}
913
+ declare const createBaseHandshakeMessageSchema: <T extends z.ZodType<HandshakeMessageType>>(typeSchema: T) => z.ZodObject<{
914
+ type: T;
915
+ }>;
916
+ //#endregion
917
+ //#region src/models/handshake/AuthenticateMessage.d.ts
918
+ interface AuthenticateMessage extends BaseHandshakeMessage<HandshakeMessageType.Authenticate> {
919
+ credential: string;
920
+ }
921
+ declare const authenticateMessageSchema: z.ZodObject<{
922
+ credential: z.ZodString;
923
+ type: z.ZodLiteral<HandshakeMessageType.Authenticate>;
924
+ }>;
925
+ //#endregion
926
+ //#region src/models/handshake/ChallengeMessage.d.ts
927
+ interface ChallengeMessage extends BaseHandshakeMessage<HandshakeMessageType.Challenge> {
928
+ nonce: string;
929
+ }
930
+ declare const challengeMessageSchema: z.ZodObject<{
931
+ nonce: z.ZodString;
932
+ type: z.ZodLiteral<HandshakeMessageType.Challenge>;
933
+ }>;
934
+ //#endregion
935
+ //#region src/models/handshake/HandOffMessage.d.ts
936
+ interface HandOffMessage extends BaseHandshakeMessage<HandshakeMessageType.HandOff> {
937
+ code: string;
938
+ signature: string;
939
+ }
940
+ declare const handOffMessageSchema: z.ZodObject<{
941
+ code: z.ZodString;
942
+ signature: z.ZodString;
943
+ type: z.ZodLiteral<HandshakeMessageType.HandOff>;
944
+ }>;
945
+ //#endregion
946
+ //#region src/models/handshake/PairMessage.d.ts
947
+ interface PairMessage extends BaseHandshakeMessage<HandshakeMessageType.Pair> {
948
+ code: string;
949
+ }
950
+ declare const pairMessageSchema: z.ZodObject<{
951
+ code: z.ZodString;
952
+ type: z.ZodLiteral<HandshakeMessageType.Pair>;
953
+ }>;
954
+ //#endregion
955
+ //#region src/models/handshake/RevokeMessage.d.ts
956
+ interface RevokeMessage extends BaseHandshakeMessage<HandshakeMessageType.Revoke> {
957
+ deviceId: string;
958
+ signature: string;
959
+ }
960
+ declare const revokeMessageSchema: z.ZodObject<{
961
+ deviceId: z.ZodString;
962
+ signature: z.ZodString;
963
+ type: z.ZodLiteral<HandshakeMessageType.Revoke>;
964
+ }>;
965
+ //#endregion
966
+ //#region src/models/handshake/HandshakeMessage.d.ts
967
+ type HandshakeMessage = AuthenticateMessage | ChallengeMessage | HandOffMessage | PairMessage | RevokeMessage;
968
+ declare const handshakeMessageSchema: z.ZodDiscriminatedUnion<[typeof authenticateMessageSchema, typeof challengeMessageSchema, typeof handOffMessageSchema, typeof pairMessageSchema, typeof revokeMessageSchema], "type">;
969
+ //#endregion
970
+ //#region src/models/handshake/SignaturePurpose.d.ts
971
+ declare enum SignaturePurpose {
972
+ HostProof = "HostProof",
973
+ OwnerProof = "OwnerProof"
974
+ }
975
+ declare const signaturePurposeSchema: z.ZodEnum<typeof SignaturePurpose>;
976
+ //#endregion
808
977
  //#region src/models/server/ServerMessageType.d.ts
809
978
  declare enum ServerMessageType {
979
+ Authenticated = "Authenticated",
810
980
  CommandError = "CommandError",
811
981
  Events = "Events",
982
+ HostStopping = "HostStopping",
983
+ Paired = "Paired",
984
+ Proof = "Proof",
812
985
  SessionOpened = "SessionOpened",
813
986
  SessionReset = "SessionReset",
814
- Sessions = "Sessions"
987
+ Sessions = "Sessions",
988
+ ShellClosed = "ShellClosed",
989
+ ShellOpened = "ShellOpened",
990
+ ShellOutput = "ShellOutput"
815
991
  }
816
992
  declare const serverMessageTypeSchema: z.ZodEnum<typeof ServerMessageType>;
817
993
  //#endregion
@@ -821,6 +997,12 @@ declare const createBaseServerMessageSchema: <T extends z.ZodType<ServerMessageT
821
997
  type: T;
822
998
  }>;
823
999
  //#endregion
1000
+ //#region src/models/server/AuthenticatedMessage.d.ts
1001
+ interface AuthenticatedMessage extends BaseServerMessage<ServerMessageType.Authenticated> {}
1002
+ declare const authenticatedMessageSchema: z.ZodObject<{
1003
+ type: z.ZodLiteral<ServerMessageType.Authenticated>;
1004
+ }>;
1005
+ //#endregion
824
1006
  //#region src/models/server/CommandErrorMessage.d.ts
825
1007
  interface CommandErrorMessage extends BaseServerMessage<ServerMessageType.CommandError> {
826
1008
  commandId: string;
@@ -843,6 +1025,46 @@ declare const eventsMessageSchema: z.ZodObject<{
843
1025
  type: z.ZodLiteral<ServerMessageType.Events>;
844
1026
  }>;
845
1027
  //#endregion
1028
+ //#region src/models/server/HostCloseCode.d.ts
1029
+ declare enum HostCloseCode {
1030
+ HandshakeRefused = 4400,
1031
+ CredentialRefused = 4401,
1032
+ PairingRefused = 4403,
1033
+ SignatureRefused = 4404
1034
+ }
1035
+ //#endregion
1036
+ //#region src/models/server/HostStoppingMessage.d.ts
1037
+ interface HostStoppingMessage extends BaseServerMessage<ServerMessageType.HostStopping> {}
1038
+ declare const hostStoppingMessageSchema: z.ZodObject<{
1039
+ type: z.ZodLiteral<ServerMessageType.HostStopping>;
1040
+ }>;
1041
+ //#endregion
1042
+ //#region src/models/server/PairedMessage.d.ts
1043
+ interface PairedMessage extends BaseServerMessage<ServerMessageType.Paired> {
1044
+ credential: string;
1045
+ deviceId: string;
1046
+ publicKey: string;
1047
+ }
1048
+ declare const pairedMessageSchema: z.ZodObject<{
1049
+ credential: z.ZodString;
1050
+ deviceId: z.ZodString;
1051
+ publicKey: z.ZodString;
1052
+ type: z.ZodLiteral<ServerMessageType.Paired>;
1053
+ }>;
1054
+ //#endregion
1055
+ //#region src/models/server/ProofMessage.d.ts
1056
+ interface ProofMessage extends BaseServerMessage<ServerMessageType.Proof> {
1057
+ nonce: string;
1058
+ port: number;
1059
+ signature: string;
1060
+ }
1061
+ declare const proofMessageSchema: z.ZodObject<{
1062
+ nonce: z.ZodString;
1063
+ port: z.ZodInt;
1064
+ signature: z.ZodString;
1065
+ type: z.ZodLiteral<ServerMessageType.Proof>;
1066
+ }>;
1067
+ //#endregion
846
1068
  //#region src/models/server/SessionOpenedMessage.d.ts
847
1069
  interface SessionOpenedMessage extends BaseServerMessage<ServerMessageType.SessionOpened> {
848
1070
  commandId: string;
@@ -888,15 +1110,52 @@ declare const sessionsMessageSchema: z.ZodObject<{
888
1110
  type: z.ZodLiteral<ServerMessageType.Sessions>;
889
1111
  }>;
890
1112
  //#endregion
1113
+ //#region src/models/server/ShellClosedMessage.d.ts
1114
+ interface ShellClosedMessage extends BaseServerMessage<ServerMessageType.ShellClosed>, ShellId {}
1115
+ declare const shellClosedMessageSchema: z.ZodObject<{
1116
+ shellId: z.ZodString;
1117
+ type: z.ZodLiteral<ServerMessageType.ShellClosed>;
1118
+ }>;
1119
+ //#endregion
1120
+ //#region src/models/server/ShellOpenedMessage.d.ts
1121
+ interface ShellOpenedMessage extends BaseServerMessage<ServerMessageType.ShellOpened> {
1122
+ commandId: string;
1123
+ sessionId: string;
1124
+ shellId: string;
1125
+ }
1126
+ declare const shellOpenedMessageSchema: z.ZodObject<{
1127
+ commandId: z.ZodString;
1128
+ sessionId: z.ZodString;
1129
+ shellId: z.ZodString;
1130
+ type: z.ZodLiteral<ServerMessageType.ShellOpened>;
1131
+ }>;
1132
+ //#endregion
1133
+ //#region src/models/server/ShellOutputMessage.d.ts
1134
+ interface ShellOutputMessage extends BaseServerMessage<ServerMessageType.ShellOutput> {
1135
+ data: string;
1136
+ shellId: string;
1137
+ }
1138
+ declare const shellOutputMessageSchema: z.ZodObject<{
1139
+ data: z.ZodString;
1140
+ shellId: z.ZodString;
1141
+ type: z.ZodLiteral<ServerMessageType.ShellOutput>;
1142
+ }>;
1143
+ //#endregion
891
1144
  //#region src/models/server/ServerMessage.d.ts
892
- type ServerMessage = CommandErrorMessage | EventsMessage | SessionOpenedMessage | SessionResetMessage | SessionsMessage;
893
- declare const serverMessageSchema: z.ZodDiscriminatedUnion<[typeof commandErrorMessageSchema, typeof eventsMessageSchema, typeof sessionOpenedMessageSchema, typeof sessionResetMessageSchema, typeof sessionsMessageSchema], "type">;
1145
+ type ServerMessage = AuthenticatedMessage | CommandErrorMessage | EventsMessage | HostStoppingMessage | PairedMessage | ProofMessage | SessionOpenedMessage | SessionResetMessage | SessionsMessage | ShellClosedMessage | ShellOpenedMessage | ShellOutputMessage;
1146
+ declare const serverMessageSchema: z.ZodDiscriminatedUnion<[typeof authenticatedMessageSchema, typeof commandErrorMessageSchema, typeof eventsMessageSchema, typeof hostStoppingMessageSchema, typeof pairedMessageSchema, typeof proofMessageSchema, typeof sessionOpenedMessageSchema, typeof sessionResetMessageSchema, typeof sessionsMessageSchema, typeof shellClosedMessageSchema, typeof shellOpenedMessageSchema, typeof shellOutputMessageSchema], "type">;
894
1147
  //#endregion
895
1148
  //#region src/services/constants.d.ts
896
1149
  declare const DEFAULT_APP_ORIGIN = "https://esposter.com";
897
1150
  declare const DEFAULT_HOSTNAME = "127.0.0.1";
898
1151
  declare const DEFAULT_PORT = 7437;
1152
+ declare const HOST_SCHEME: string;
1153
+ declare const PAIRING_CODE_PARAMETER = "code";
899
1154
  declare const PAIRING_HASH_PARAMETER = "host";
900
- declare const TOKEN_QUERY_PARAMETER = "token";
1155
+ declare const SHELL_OUTPUT_LENGTH = 1e5;
1156
+ declare const SCHEME_PAIRING_CODE_DURATION: number;
1157
+ //#endregion
1158
+ //#region src/services/handshake/getSignedText.d.ts
1159
+ declare const getSignedText: (purpose: SignaturePurpose, port: number, nonce: string) => string;
901
1160
  //#endregion
902
- export { SubagentStatus as $, SlashCommandCommand as $t, unknownEventSchema as A, sessionIdSchema as An, compactionEventSchema as At, toolResultEventSchema as B, modelSchema as Bt, serverMessageTypeSchema as C, ForkCommand as Cn, HookPhase as Ct, UserMessageEvent as D, CloseSessionCommand as Dn, ContextUsageEvent as Dt, agentEventSchema as E, createSessionCommandSchema as En, fileRewindEventSchema as Et, TokenUsage as F, Attachment as Fn, CapabilitiesEvent as Ft, Todo as G, MessageUuid as Gt, toolProgressEventSchema as H, assistantMessageEventSchema as Ht, tokenUsageSchema as I, attachmentSchema as In, capabilitiesEventSchema as It, todoStatusSchema as J, createBaseAgentEventSchema as Jt, todoSchema as K, messageUuidSchema as Kt, ToolUseEvent as L, AttachmentMediaType as Ln, SlashCommand as Lt, turnUsageEventSchema as M, createBaseCommandSchema as Mn, compactionTriggerSchema as Mt, TurnResultEvent as N, CommandType as Nn, CommandOutputEvent as Nt, userMessageEventSchema as O, closeSessionCommandSchema as On, contextUsageEventSchema as Ot, turnResultEventSchema as P, commandTypeSchema as Pn, commandOutputEventSchema as Pt, subagentEventSchema as Q, commandSchema as Qt, toolUseEventSchema as R, attachmentMediaTypeSchema as Rn, slashCommandSchema as Rt, ServerMessageType as S, interruptCommandSchema as Sn, hookEventSchema as St, AgentEvent as T, CreateSessionCommand as Tn, FileRewindEvent as Tt, TodoUpdateEvent as U, ParentToolUseId as Ut, ToolProgressEvent as V, AssistantMessageEvent as Vt, todoUpdateEventSchema as W, parentToolUseIdSchema as Wt, thinkingEventSchema as X, agentEventTypeSchema as Xt, ThinkingEvent as Y, AgentEventType as Yt, SubagentEvent as Z, Command as Zt, eventsMessageSchema as _, PermissionBehavior as _n, PermissionRequestEvent as _t, TOKEN_QUERY_PARAMETER as a, SetModelCommand as an, SessionState as at, BaseServerMessage as b, listSessionsCommandSchema as bn, hostErrorEventSchema as bt, SessionsMessage as c, rewindFilesCommandSchema as cn, sessionSettingsEventSchema as ct, sessionSummarySchema as d, ResumeAtCommand as dn, McpServer as dt, slashCommandCommandSchema as en, subagentStatusSchema as et, SessionResetMessage as f, resumeAtCommandSchema as fn, mcpServerSchema as ft, EventsMessage as g, permissionVerdictCommandSchema as gn, permissionResolutionEventSchema as gt, sessionOpenedMessageSchema as h, PermissionVerdictCommand as hn, PermissionResolutionEvent as ht, PAIRING_HASH_PARAMETER as i, permissionModeSchema as in, sessionStateEventSchema as it, TurnUsageEvent as j, BaseCommand as jn, CompactionTrigger as jt, UnknownEvent as k, SessionId as kn, CompactionEvent as kt, sessionsMessageSchema as l, ResumeCommand as ln, SessionInitEvent as lt, SessionOpenedMessage as m, promptCommandSchema as mn, rateLimitEventSchema as mt, DEFAULT_HOSTNAME as n, setPermissionModeCommandSchema as nn, streamDeltaEventSchema as nt, ServerMessage as o, setModelCommandSchema as on, sessionStateSchema as ot, sessionResetMessageSchema as p, PromptCommand as pn, RateLimitEvent as pt, TodoStatus as q, BaseAgentEvent as qt, DEFAULT_PORT as r, PermissionMode as rn, SessionStateEvent as rt, serverMessageSchema as s, RewindFilesCommand as sn, SessionSettingsEvent as st, DEFAULT_APP_ORIGIN as t, SetPermissionModeCommand as tn, StreamDeltaEvent as tt, SessionSummary as u, resumeCommandSchema as un, sessionInitEventSchema as ut, CommandErrorMessage as v, permissionBehaviorSchema as vn, permissionRequestEventSchema as vt, EphemeralAgentEventTypes as w, forkCommandSchema as wn, hookPhaseSchema as wt, createBaseServerMessageSchema as x, InterruptCommand as xn, HookEvent as xt, commandErrorMessageSchema as y, ListSessionsCommand as yn, HostErrorEvent as yt, ToolResultEvent as z, Model as zt };
1161
+ export { ChallengeMessage as $, setPermissionModeCommandSchema as $n, permissionResolutionEventSchema as $t, HostStoppingMessage as A, BaseAgentEvent as An, BackgroundTasksCommand as Ar, TodoStatus as At, createBaseServerMessageSchema as B, ShellInputCommand as Bn, AttachmentMediaType as Br, SessionStateEvent as Bt, sessionResetMessageSchema as C, modelSchema as Cn, createSessionCommandSchema as Cr, toolResultEventSchema as Ct, proofMessageSchema as D, parentToolUseIdSchema as Dn, shellIdSchema as Dr, todoUpdateEventSchema as Dt, ProofMessage as E, ParentToolUseId as En, ShellId as Er, TodoUpdateEvent as Et, CommandErrorMessage as F, commandSchema as Fn, createBaseCommandSchema as Fr, subagentEventSchema as Ft, HandshakeMessage as G, terminalSizeSchema as Gn, sessionSettingsEventSchema as Gt, serverMessageTypeSchema as H, OpenShellCommand as Hn, SessionState as Ht, commandErrorMessageSchema as I, ShellCommand as In, CommandType as Ir, SubagentStatus as It, revokeMessageSchema as J, StopTaskCommand as Jn, McpServer as Jt, handshakeMessageSchema as K, DriverCommand as Kn, SessionInitEvent as Kt, AuthenticatedMessage as L, shellCommandSchema as Ln, commandTypeSchema as Lr, subagentStatusSchema as Lt, HostCloseCode as M, AgentEventType as Mn, SessionId as Mr, ThinkingEvent as Mt, EventsMessage as N, agentEventTypeSchema as Nn, sessionIdSchema as Nr, thinkingEventSchema as Nt, PairedMessage as O, MessageUuid as On, CloseSessionCommand as Or, Todo as Ot, eventsMessageSchema as P, Command as Pn, BaseCommand as Pr, SubagentEvent as Pt, handOffMessageSchema as Q, SetPermissionModeCommand as Qn, PermissionResolutionEvent as Qt, authenticatedMessageSchema as R, ShellResizeCommand as Rn, Attachment as Rr, StreamDeltaEvent as Rt, SessionResetMessage as S, Model as Sn, CreateSessionCommand as Sr, ToolResultEvent as St, sessionOpenedMessageSchema as T, assistantMessageEventSchema as Tn, closeShellCommandSchema as Tr, toolProgressEventSchema as Tt, SignaturePurpose as U, openShellCommandSchema as Un, sessionStateSchema as Ut, ServerMessageType as V, shellInputCommandSchema as Vn, attachmentMediaTypeSchema as Vr, sessionStateEventSchema as Vt, signaturePurposeSchema as W, TerminalSize as Wn, SessionSettingsEvent as Wt, pairMessageSchema as X, SlashCommandCommand as Xn, RateLimitEvent as Xt, PairMessage as Y, stopTaskCommandSchema as Yn, mcpServerSchema as Yt, HandOffMessage as Z, slashCommandCommandSchema as Zn, rateLimitEventSchema as Zt, shellClosedMessageSchema as _, commandOutputEventSchema as _n, listSessionsCommandSchema as _r, turnResultEventSchema as _t, HOST_SCHEME as a, hookEventSchema as an, rewindFilesCommandSchema as ar, HandshakeMessageType as at, SessionSummary as b, SlashCommand as bn, ForkCommand as br, ToolUseEvent as bt, SCHEME_PAIRING_CODE_DURATION as c, FileRewindEvent as cn, ResumeAtCommand as cr, AgentEvent as ct, serverMessageSchema as d, contextUsageEventSchema as dn, promptCommandSchema as dr, userMessageEventSchema as dt, PermissionRequestEvent as en, PermissionMode as er, challengeMessageSchema as et, ShellOutputMessage as f, CompactionEvent as fn, PermissionVerdictCommand as fr, UnknownEvent as ft, ShellClosedMessage as g, CommandOutputEvent as gn, ListSessionsCommand as gr, TurnResultEvent as gt, shellOpenedMessageSchema as h, compactionTriggerSchema as hn, permissionBehaviorSchema as hr, turnUsageEventSchema as ht, DEFAULT_PORT as i, HookEvent as in, RewindFilesCommand as ir, createBaseHandshakeMessageSchema as it, hostStoppingMessageSchema as j, createBaseAgentEventSchema as jn, backgroundTasksCommandSchema as jr, todoStatusSchema as jt, pairedMessageSchema as k, messageUuidSchema as kn, closeSessionCommandSchema as kr, todoSchema as kt, SHELL_OUTPUT_LENGTH as l, fileRewindEventSchema as ln, resumeAtCommandSchema as lr, agentEventSchema as lt, ShellOpenedMessage as m, CompactionTrigger as mn, PermissionBehavior as mr, TurnUsageEvent as mt, DEFAULT_APP_ORIGIN as n, HostErrorEvent as nn, SetModelCommand as nr, authenticateMessageSchema as nt, PAIRING_CODE_PARAMETER as o, HookPhase as on, ResumeCommand as or, handshakeMessageTypeSchema as ot, shellOutputMessageSchema as p, compactionEventSchema as pn, permissionVerdictCommandSchema as pr, unknownEventSchema as pt, RevokeMessage as q, driverCommandSchema as qn, sessionInitEventSchema as qt, DEFAULT_HOSTNAME as r, hostErrorEventSchema as rn, setModelCommandSchema as rr, BaseHandshakeMessage as rt, PAIRING_HASH_PARAMETER as s, hookPhaseSchema as sn, resumeCommandSchema as sr, EphemeralAgentEventTypes as st, getSignedText as t, permissionRequestEventSchema as tn, permissionModeSchema as tr, AuthenticateMessage as tt, ServerMessage as u, ContextUsageEvent as un, PromptCommand as ur, UserMessageEvent as ut, SessionsMessage as v, CapabilitiesEvent as vn, InterruptCommand as vr, TokenUsage as vt, SessionOpenedMessage as w, AssistantMessageEvent as wn, CloseShellCommand as wr, ToolProgressEvent as wt, sessionSummarySchema as x, slashCommandSchema as xn, forkCommandSchema as xr, toolUseEventSchema as xt, sessionsMessageSchema as y, capabilitiesEventSchema as yn, interruptCommandSchema as yr, tokenUsageSchema as yt, BaseServerMessage as z, shellResizeCommandSchema as zn, attachmentSchema as zr, streamDeltaEventSchema as zt };