@letta-ai/letta-code 0.29.0 → 0.29.2
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/app-server-client.js +10 -1
- package/dist/app-server-client.js.map +3 -3
- package/dist/types/app-server-client.d.ts +2 -1
- package/dist/types/app-server-client.d.ts.map +1 -1
- package/dist/types/types/app-server-info.d.ts +23 -0
- package/dist/types/types/app-server-info.d.ts.map +1 -0
- package/dist/types/types/app-server-protocol.d.ts +2 -0
- package/dist/types/types/app-server-protocol.d.ts.map +1 -1
- package/dist/types/types/conversation-fork-protocol.d.ts +9 -0
- package/dist/types/types/conversation-fork-protocol.d.ts.map +1 -0
- package/dist/types/types/protocol_v2.d.ts +4 -8
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/letta.js +74831 -81761
- package/package.json +5 -5
- package/scripts/source-file-size-baseline.json +1 -1
|
@@ -232,6 +232,15 @@ class AppServerClient {
|
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
+
info(options = {}) {
|
|
236
|
+
return this.request({
|
|
237
|
+
type: "app_server_info",
|
|
238
|
+
request_id: this.nextRequestId("app-server-info")
|
|
239
|
+
}, {
|
|
240
|
+
...options,
|
|
241
|
+
predicate: (message) => message.type === "app_server_info_response"
|
|
242
|
+
});
|
|
243
|
+
}
|
|
235
244
|
runtimeStart(command, options = {}) {
|
|
236
245
|
return this.request({
|
|
237
246
|
type: "runtime_start",
|
|
@@ -444,4 +453,4 @@ export {
|
|
|
444
453
|
AppServerClient
|
|
445
454
|
};
|
|
446
455
|
|
|
447
|
-
//# debugId=
|
|
456
|
+
//# debugId=8F8A6817B3ED4D9F64756E2164756E21
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/app-server-client.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type {\n AbortMessageCommand,\n AbortMessageResponseMessage,\n ConversationListCommand,\n ConversationListResponseMessage,\n ExternalToolCallRequestMessage,\n ExternalToolCallResult,\n InputCommand,\n LoopStatusUpdateMessage,\n RuntimeScope,\n RuntimeStartCommand,\n RuntimeStartResponseMessage,\n StreamDeltaMessage,\n SyncCommand,\n SyncResponseMessage,\n WsProtocolCommand,\n WsProtocolMessage,\n} from \"./types/app-server-protocol\";\n\nexport type AppServerChannel = \"control\" | \"stream\";\n\n/**\n * Receives every parsed protocol frame from both app-server websocket channels.\n * Treat this as the primary event stream: app-server may emit replay or turn\n * updates on the same channel that sent the triggering command, not only on the\n * stream channel. The channel argument is diagnostic/routing context.\n */\nexport type AppServerMessageHandler = (\n message: WsProtocolMessage,\n channel: AppServerChannel,\n) => void;\n\n/** Called synchronously before a protocol command is written to the control socket. */\nexport type AppServerSendHandler = (command: WsProtocolCommand) => void;\n\nexport interface AppServerDisconnectEvent {\n channel: AppServerChannel;\n event: unknown;\n}\n\n/** Called once when either websocket closes before client.close(). */\nexport type AppServerDisconnectHandler = (\n disconnect: AppServerDisconnectEvent,\n) => void;\n\nexport type AppServerExternalToolCallHandler = (\n request: ExternalToolCallRequestMessage,\n) => Promise<ExternalToolCallResult> | ExternalToolCallResult;\n\nexport interface AppServerSocketLike {\n readyState: number;\n send(data: string): void;\n close(): void;\n addEventListener?(type: string, listener: (event: unknown) => void): void;\n removeEventListener?(type: string, listener: (event: unknown) => void): void;\n on?(type: string, listener: (event: unknown) => void): void;\n off?(type: string, listener: (event: unknown) => void): void;\n once?(type: string, listener: (event: unknown) => void): void;\n}\n\nexport interface AppServerSocketOptions {\n headers?: Record<string, string>;\n}\n\nexport type AppServerSocketConstructor = new (\n url: string,\n options?: AppServerSocketOptions,\n) => AppServerSocketLike;\n\nexport interface AppServerClientOptions {\n /** Base app-server URL, e.g. ws://127.0.0.1:4500 or http://127.0.0.1:4500. */\n url: string;\n /** Optional capability token sent as Authorization: Bearer <token>; requires a WebSocket implementation with header support. */\n authToken?: string;\n /** Optional WebSocket constructor for Node/tests. Browsers use globalThis.WebSocket. */\n WebSocket?: AppServerSocketConstructor;\n /** Default timeout for request_id-correlated control requests. */\n requestTimeoutMs?: number;\n}\n\nexport interface AppServerRequestOptions<TMessage extends WsProtocolMessage> {\n timeoutMs?: number;\n predicate?: (message: WsProtocolMessage) => message is TMessage;\n}\n\nexport type AppServerRequestCommand = Extract<\n WsProtocolCommand,\n { request_id?: string }\n>;\n\nexport type AppServerRequestCommandWithId = AppServerRequestCommand & {\n request_id: string;\n};\n\nexport type AppServerRequestBody = Record<string, unknown> & {\n request_id?: string;\n};\n\ntype PendingRequest = {\n resolve: (message: WsProtocolMessage) => void;\n reject: (error: Error) => void;\n predicate?: (message: WsProtocolMessage) => boolean;\n timeout: ReturnType<typeof setTimeout>;\n};\n\nexport type AppServerTurnCompletionSource =\n | \"stop_reason\"\n | \"loop_status_waiting_on_approval\"\n | \"loop_status_waiting_fallback\";\n\nexport interface AppServerTurnResult {\n runtime: RuntimeScope;\n stopReason: string | null;\n runIds: string[];\n clientMessageIds: string[];\n completedBy: AppServerTurnCompletionSource;\n terminalMessage: WsProtocolMessage;\n}\n\nexport interface AppServerRunTurnOptions {\n timeoutMs?: number;\n /**\n * Prefer explicit stream terminal events. This fallback is only used after\n * the client has seen stream/run evidence for this runtime, never from idle\n * loop status alone.\n */\n allowLoopStatusFallback?: boolean;\n}\n\nconst DEFAULT_REQUEST_TIMEOUT_MS = 30_000;\nconst WEBSOCKET_OPEN_STATE = 1;\n\nfunction getGlobalWebSocket(): AppServerSocketConstructor | undefined {\n return (globalThis as { WebSocket?: AppServerSocketConstructor }).WebSocket;\n}\n\nfunction normalizeBaseUrl(url: string): URL {\n const parsed = new URL(url);\n if (parsed.protocol === \"http:\") parsed.protocol = \"ws:\";\n if (parsed.protocol === \"https:\") parsed.protocol = \"wss:\";\n if (parsed.protocol !== \"ws:\" && parsed.protocol !== \"wss:\") {\n throw new Error(`Unsupported app-server URL protocol: ${parsed.protocol}`);\n }\n if (!parsed.pathname || parsed.pathname === \"/\") {\n parsed.pathname = \"/ws\";\n }\n return parsed;\n}\n\nexport function resolveAppServerChannelUrl(\n url: string,\n channel: AppServerChannel,\n): string {\n const parsed = normalizeBaseUrl(url);\n parsed.searchParams.set(\"channel\", channel);\n return parsed.toString();\n}\n\nfunction attachSocketListener(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.addEventListener && socket.removeEventListener) {\n socket.addEventListener(type, listener);\n return () => socket.removeEventListener?.(type, listener);\n }\n\n if (socket.on) {\n socket.on(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n throw new Error(\"WebSocket implementation does not support event listeners\");\n}\n\nfunction onceSocketEvent(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.once) {\n socket.once(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n let detach = () => {};\n detach = attachSocketListener(socket, type, (event) => {\n detach();\n listener(event);\n });\n return detach;\n}\n\nfunction waitForSocketOpen(socket: AppServerSocketLike): Promise<void> {\n if (socket.readyState === WEBSOCKET_OPEN_STATE) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n let detachOpen = () => {};\n let detachError = () => {};\n const cleanup = () => {\n detachOpen();\n detachError();\n };\n detachOpen = onceSocketEvent(socket, \"open\", () => {\n cleanup();\n resolve();\n });\n detachError = onceSocketEvent(socket, \"error\", (event) => {\n cleanup();\n reject(\n new Error(`App-server WebSocket failed to open: ${String(event)}`),\n );\n });\n });\n}\n\nfunction rawEventData(event: unknown): unknown {\n if (event && typeof event === \"object\" && \"data\" in event) {\n return (event as { data: unknown }).data;\n }\n return event;\n}\n\nfunction messageDataToString(data: unknown): string {\n const raw = rawEventData(data);\n if (typeof raw === \"string\") return raw;\n if (raw instanceof ArrayBuffer) {\n return new TextDecoder().decode(raw);\n }\n if (raw instanceof Uint8Array) {\n return new TextDecoder().decode(raw);\n }\n if (ArrayBuffer.isView(raw)) {\n return new TextDecoder().decode(\n new Uint8Array(raw.buffer as ArrayBuffer, raw.byteOffset, raw.byteLength),\n );\n }\n return String(raw);\n}\n\nfunction parseProtocolMessage(event: unknown): WsProtocolMessage {\n return JSON.parse(messageDataToString(event)) as WsProtocolMessage;\n}\n\nfunction appServerSocketOptions(\n authToken: string | undefined,\n): AppServerSocketOptions | undefined {\n if (authToken === undefined) {\n return undefined;\n }\n const token = authToken.trim();\n if (!token) {\n throw new Error(\"app-server auth token must not be empty\");\n }\n return { headers: { Authorization: `Bearer ${token}` } };\n}\n\nfunction sameRuntime(a: RuntimeScope | undefined, b: RuntimeScope): boolean {\n return a?.agent_id === b.agent_id && a?.conversation_id === b.conversation_id;\n}\n\nfunction isWaitingLoopStatus(message: LoopStatusUpdateMessage): boolean {\n return message.loop_status.status === \"WAITING_ON_INPUT\";\n}\n\nfunction isWaitingOnApprovalLoopStatus(\n message: LoopStatusUpdateMessage,\n): boolean {\n return message.loop_status.status === \"WAITING_ON_APPROVAL\";\n}\n\nfunction streamDeltaRunId(message: StreamDeltaMessage): string | null {\n const runId = (message.delta as { run_id?: unknown }).run_id;\n return typeof runId === \"string\" ? runId : null;\n}\n\nfunction streamDeltaMessageType(message: StreamDeltaMessage): string | null {\n const messageType = (message.delta as { message_type?: unknown })\n .message_type;\n return typeof messageType === \"string\" ? messageType : null;\n}\n\nfunction streamDeltaStopReason(message: StreamDeltaMessage): string | null {\n const stopReason = (message.delta as { stop_reason?: unknown }).stop_reason;\n return typeof stopReason === \"string\" ? stopReason : null;\n}\n\nfunction streamDeltaErrorMessage(message: StreamDeltaMessage): string {\n const delta = message.delta as {\n message?: unknown;\n api_error?: { message?: unknown; detail?: unknown };\n };\n const apiMessage = delta.api_error?.message ?? delta.api_error?.detail;\n if (typeof apiMessage === \"string\" && apiMessage.length > 0)\n return apiMessage;\n if (typeof delta.message === \"string\" && delta.message.length > 0)\n return delta.message;\n return \"App-server turn failed\";\n}\n\nexport class AppServerClient {\n readonly control: AppServerSocketLike;\n readonly stream: AppServerSocketLike;\n\n private readonly requestTimeoutMs: number;\n private readonly pending = new Map<string, PendingRequest>();\n private readonly messageHandlers = new Set<AppServerMessageHandler>();\n private readonly sendHandlers = new Set<AppServerSendHandler>();\n private readonly disconnectHandlers = new Set<AppServerDisconnectHandler>();\n private readonly activeTurnRuntimes = new Set<string>();\n private explicitlyClosed = false;\n private disconnectNotified = false;\n private nextRequestNumber = 0;\n\n constructor(options: AppServerClientOptions) {\n const WebSocket = options.WebSocket ?? getGlobalWebSocket();\n if (!WebSocket) {\n throw new Error(\"No WebSocket implementation available\");\n }\n\n this.requestTimeoutMs =\n options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const socketOptions = appServerSocketOptions(options.authToken);\n this.control = new WebSocket(\n resolveAppServerChannelUrl(options.url, \"control\"),\n socketOptions,\n );\n this.stream = new WebSocket(\n resolveAppServerChannelUrl(options.url, \"stream\"),\n socketOptions,\n );\n\n attachSocketListener(this.control, \"message\", (event) => {\n this.handleMessage(event, \"control\");\n });\n attachSocketListener(this.stream, \"message\", (event) => {\n this.handleMessage(event, \"stream\");\n });\n attachSocketListener(this.control, \"close\", (event) => {\n this.handleDisconnect(\"control\", event);\n });\n attachSocketListener(this.stream, \"close\", (event) => {\n this.handleDisconnect(\"stream\", event);\n });\n }\n\n async connect(): Promise<this> {\n await Promise.all([\n waitForSocketOpen(this.control),\n waitForSocketOpen(this.stream),\n ]);\n return this;\n }\n\n close(): void {\n if (this.explicitlyClosed) return;\n this.explicitlyClosed = true;\n this.rejectAllPending(\"App-server client closed\");\n this.control.close();\n this.stream.close();\n }\n\n onMessage(handler: AppServerMessageHandler): () => void {\n this.messageHandlers.add(handler);\n return () => this.messageHandlers.delete(handler);\n }\n\n onSend(handler: AppServerSendHandler): () => void {\n this.sendHandlers.add(handler);\n return () => this.sendHandlers.delete(handler);\n }\n\n onDisconnect(handler: AppServerDisconnectHandler): () => void {\n this.disconnectHandlers.add(handler);\n return () => this.disconnectHandlers.delete(handler);\n }\n\n nextRequestId(prefix = \"req\"): string {\n this.nextRequestNumber += 1;\n return `${prefix}-${this.nextRequestNumber}`;\n }\n\n send(command: WsProtocolCommand): void {\n for (const handler of this.sendHandlers) {\n handler(command);\n }\n this.control.send(JSON.stringify(command));\n }\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n command: AppServerRequestCommandWithId,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<\n TType extends AppServerRequestCommand[\"type\"],\n TMessage extends WsProtocolMessage = WsProtocolMessage,\n >(\n type: TType,\n body?: AppServerRequestBody,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n commandOrType:\n | AppServerRequestCommandWithId\n | AppServerRequestCommand[\"type\"],\n bodyOrOptions:\n | AppServerRequestBody\n | AppServerRequestOptions<TMessage> = {},\n maybeOptions: AppServerRequestOptions<TMessage> = {},\n ): Promise<TMessage> {\n const isTypeRequest = typeof commandOrType === \"string\";\n const command = isTypeRequest\n ? ({\n type: commandOrType,\n request_id:\n (bodyOrOptions as { request_id?: string }).request_id ??\n this.nextRequestId(commandOrType),\n ...(bodyOrOptions as object),\n } as AppServerRequestCommandWithId)\n : commandOrType;\n const options = isTypeRequest\n ? maybeOptions\n : (bodyOrOptions as AppServerRequestOptions<TMessage>);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as TMessage),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.send(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n runtimeStart(\n command: Omit<RuntimeStartCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeStartResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeStartResponseMessage> {\n return this.request(\n {\n type: \"runtime_start\",\n request_id: command.request_id ?? this.nextRequestId(\"runtime-start\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is RuntimeStartResponseMessage =>\n message.type === \"runtime_start_response\",\n },\n );\n }\n\n sync(\n command: Omit<SyncCommand, \"type\" | \"request_id\"> & { request_id?: string },\n options: Omit<\n AppServerRequestOptions<SyncResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<SyncResponseMessage> {\n return this.request(\n {\n type: \"sync\",\n request_id: command.request_id ?? this.nextRequestId(\"sync\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is SyncResponseMessage =>\n message.type === \"sync_response\",\n },\n );\n }\n\n abort(\n command: Omit<AbortMessageCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<AbortMessageResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AbortMessageResponseMessage> {\n return this.request(\n {\n type: \"abort_message\",\n request_id: command.request_id ?? this.nextRequestId(\"abort\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is AbortMessageResponseMessage =>\n message.type === \"abort_message_response\",\n },\n );\n }\n\n conversationList(\n command: Omit<ConversationListCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n } = {},\n options: Omit<\n AppServerRequestOptions<ConversationListResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<ConversationListResponseMessage> {\n return this.request(\n {\n type: \"conversation_list\",\n request_id:\n command.request_id ?? this.nextRequestId(\"conversation-list\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is ConversationListResponseMessage =>\n message.type === \"conversation_list_response\",\n },\n );\n }\n\n onExternalToolCall(handler: AppServerExternalToolCallHandler): () => void {\n return this.onMessage((message, channel) => {\n if (\n channel !== \"control\" ||\n message.type !== \"external_tool_call_request\"\n ) {\n return;\n }\n\n void Promise.resolve(handler(message))\n .then((result) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n result,\n });\n })\n .catch((error) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n error: error instanceof Error ? error.message : String(error),\n });\n });\n });\n }\n\n input(command: Omit<InputCommand, \"type\">): void {\n this.send({ type: \"input\", ...command });\n }\n\n runTurn(\n command: Omit<InputCommand, \"type\">,\n options: AppServerRunTurnOptions = {},\n ): Promise<AppServerTurnResult> {\n const runtimeKey = `${command.runtime.agent_id}/${command.runtime.conversation_id}`;\n if (this.activeTurnRuntimes.has(runtimeKey)) {\n return Promise.reject(\n new Error(`A turn is already in flight for ${runtimeKey}`),\n );\n }\n this.activeTurnRuntimes.add(runtimeKey);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n const commandWithIds = this.withClientMessageIds(command);\n const runIds = new Set<string>();\n let observedTurnEvidence = false;\n let observedRequiresApprovalStop = false;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n cleanup();\n reject(\n new Error(\n `Timed out waiting for app-server turn on ${command.runtime.agent_id}/${command.runtime.conversation_id}`,\n ),\n );\n }, timeoutMs);\n\n const cleanup = () => {\n clearTimeout(timeout);\n this.activeTurnRuntimes.delete(runtimeKey);\n offMessage();\n };\n\n const finish = (\n completedBy: AppServerTurnCompletionSource,\n terminalMessage: WsProtocolMessage,\n stopReason: string | null,\n ) => {\n cleanup();\n resolve({\n runtime: command.runtime,\n stopReason,\n runIds: [...runIds],\n clientMessageIds: commandWithIds.clientMessageIds,\n completedBy,\n terminalMessage,\n });\n };\n\n const fail = (error: Error) => {\n cleanup();\n reject(error);\n };\n\n const offMessage = this.onMessage((message) => {\n if (\n !sameRuntime(\n (message as { runtime?: RuntimeScope }).runtime,\n command.runtime,\n )\n ) {\n return;\n }\n\n if (message.type === \"stream_delta\") {\n observedTurnEvidence = true;\n const runId = streamDeltaRunId(message);\n if (runId) runIds.add(runId);\n\n const messageType = streamDeltaMessageType(message);\n if (messageType === \"loop_error\" || messageType === \"error_message\") {\n fail(new Error(streamDeltaErrorMessage(message)));\n return;\n }\n if (messageType === \"stop_reason\") {\n const stopReason = streamDeltaStopReason(message);\n if (stopReason === \"requires_approval\") {\n observedRequiresApprovalStop = true;\n return;\n }\n finish(\"stop_reason\", message, stopReason);\n }\n return;\n }\n\n if (message.type === \"update_loop_status\") {\n const hadTurnEvidenceBeforeLoopStatus =\n observedTurnEvidence || observedRequiresApprovalStop;\n if (\n !hadTurnEvidenceBeforeLoopStatus &&\n (isWaitingOnApprovalLoopStatus(message) ||\n (options.allowLoopStatusFallback === true &&\n isWaitingLoopStatus(message)))\n ) {\n return;\n }\n for (const runId of message.loop_status.active_run_ids) {\n observedTurnEvidence = true;\n runIds.add(runId);\n }\n if (\n hadTurnEvidenceBeforeLoopStatus &&\n isWaitingOnApprovalLoopStatus(message)\n ) {\n finish(\n \"loop_status_waiting_on_approval\",\n message,\n \"requires_approval\",\n );\n return;\n }\n if (\n options.allowLoopStatusFallback === true &&\n hadTurnEvidenceBeforeLoopStatus &&\n isWaitingLoopStatus(message)\n ) {\n finish(\"loop_status_waiting_fallback\", message, null);\n }\n }\n });\n\n try {\n this.input(commandWithIds.command);\n } catch (error) {\n fail(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n private withClientMessageIds(command: Omit<InputCommand, \"type\">): {\n command: Omit<InputCommand, \"type\">;\n clientMessageIds: string[];\n } {\n if (command.payload.kind !== \"create_message\") {\n return { command, clientMessageIds: [] };\n }\n\n const clientMessageIds: string[] = [];\n const messages = command.payload.messages.map((message) => {\n if (message.role !== \"user\") return message;\n const existing = (message as { client_message_id?: unknown })\n .client_message_id;\n const clientMessageId =\n typeof existing === \"string\" && existing.length > 0\n ? existing\n : this.nextRequestId(\"client-message\");\n clientMessageIds.push(clientMessageId);\n return { ...message, client_message_id: clientMessageId };\n });\n\n return {\n command: {\n ...command,\n payload: { ...command.payload, messages },\n },\n clientMessageIds,\n };\n }\n\n private handleMessage(event: unknown, channel: AppServerChannel): void {\n const message = parseProtocolMessage(event);\n\n for (const handler of this.messageHandlers) {\n handler(message, channel);\n }\n\n const requestId =\n message && typeof message === \"object\" && \"request_id\" in message\n ? (message as { request_id?: unknown }).request_id\n : undefined;\n if (channel !== \"control\" || typeof requestId !== \"string\") {\n return;\n }\n\n const pending = this.pending.get(requestId);\n if (!pending || (pending.predicate && !pending.predicate(message))) {\n return;\n }\n\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.resolve(message);\n }\n\n private rejectAllPending(reason: string): void {\n for (const [requestId, pending] of this.pending) {\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.reject(new Error(reason));\n }\n }\n\n private handleDisconnect(channel: AppServerChannel, event: unknown): void {\n this.rejectAllPending(\"App-server socket closed\");\n if (this.explicitlyClosed || this.disconnectNotified) return;\n this.disconnectNotified = true;\n for (const handler of this.disconnectHandlers) {\n handler({ channel, event });\n }\n }\n}\n\nexport function createAppServerClient(\n options: AppServerClientOptions,\n): AppServerClient {\n return new AppServerClient(options);\n}\n"
|
|
5
|
+
"import type {\n AbortMessageCommand,\n AbortMessageResponseMessage,\n AppServerInfoResponseMessage,\n ConversationListCommand,\n ConversationListResponseMessage,\n ExternalToolCallRequestMessage,\n ExternalToolCallResult,\n InputCommand,\n LoopStatusUpdateMessage,\n RuntimeScope,\n RuntimeStartCommand,\n RuntimeStartResponseMessage,\n StreamDeltaMessage,\n SyncCommand,\n SyncResponseMessage,\n WsProtocolCommand,\n WsProtocolMessage,\n} from \"./types/app-server-protocol\";\n\nexport type AppServerChannel = \"control\" | \"stream\";\n\n/**\n * Receives every parsed protocol frame from both app-server websocket channels.\n * Treat this as the primary event stream: app-server may emit replay or turn\n * updates on the same channel that sent the triggering command, not only on the\n * stream channel. The channel argument is diagnostic/routing context.\n */\nexport type AppServerMessageHandler = (\n message: WsProtocolMessage,\n channel: AppServerChannel,\n) => void;\n\n/** Called synchronously before a protocol command is written to the control socket. */\nexport type AppServerSendHandler = (command: WsProtocolCommand) => void;\n\nexport interface AppServerDisconnectEvent {\n channel: AppServerChannel;\n event: unknown;\n}\n\n/** Called once when either websocket closes before client.close(). */\nexport type AppServerDisconnectHandler = (\n disconnect: AppServerDisconnectEvent,\n) => void;\n\nexport type AppServerExternalToolCallHandler = (\n request: ExternalToolCallRequestMessage,\n) => Promise<ExternalToolCallResult> | ExternalToolCallResult;\n\nexport interface AppServerSocketLike {\n readyState: number;\n send(data: string): void;\n close(): void;\n addEventListener?(type: string, listener: (event: unknown) => void): void;\n removeEventListener?(type: string, listener: (event: unknown) => void): void;\n on?(type: string, listener: (event: unknown) => void): void;\n off?(type: string, listener: (event: unknown) => void): void;\n once?(type: string, listener: (event: unknown) => void): void;\n}\n\nexport interface AppServerSocketOptions {\n headers?: Record<string, string>;\n}\n\nexport type AppServerSocketConstructor = new (\n url: string,\n options?: AppServerSocketOptions,\n) => AppServerSocketLike;\n\nexport interface AppServerClientOptions {\n /** Base app-server URL, e.g. ws://127.0.0.1:4500 or http://127.0.0.1:4500. */\n url: string;\n /** Optional capability token sent as Authorization: Bearer <token>; requires a WebSocket implementation with header support. */\n authToken?: string;\n /** Optional WebSocket constructor for Node/tests. Browsers use globalThis.WebSocket. */\n WebSocket?: AppServerSocketConstructor;\n /** Default timeout for request_id-correlated control requests. */\n requestTimeoutMs?: number;\n}\n\nexport interface AppServerRequestOptions<TMessage extends WsProtocolMessage> {\n timeoutMs?: number;\n predicate?: (message: WsProtocolMessage) => message is TMessage;\n}\n\nexport type AppServerRequestCommand = Extract<\n WsProtocolCommand,\n { request_id?: string }\n>;\n\nexport type AppServerRequestCommandWithId = AppServerRequestCommand & {\n request_id: string;\n};\n\nexport type AppServerRequestBody = Record<string, unknown> & {\n request_id?: string;\n};\n\ntype PendingRequest = {\n resolve: (message: WsProtocolMessage) => void;\n reject: (error: Error) => void;\n predicate?: (message: WsProtocolMessage) => boolean;\n timeout: ReturnType<typeof setTimeout>;\n};\n\nexport type AppServerTurnCompletionSource =\n | \"stop_reason\"\n | \"loop_status_waiting_on_approval\"\n | \"loop_status_waiting_fallback\";\n\nexport interface AppServerTurnResult {\n runtime: RuntimeScope;\n stopReason: string | null;\n runIds: string[];\n clientMessageIds: string[];\n completedBy: AppServerTurnCompletionSource;\n terminalMessage: WsProtocolMessage;\n}\n\nexport interface AppServerRunTurnOptions {\n timeoutMs?: number;\n /**\n * Prefer explicit stream terminal events. This fallback is only used after\n * the client has seen stream/run evidence for this runtime, never from idle\n * loop status alone.\n */\n allowLoopStatusFallback?: boolean;\n}\n\nconst DEFAULT_REQUEST_TIMEOUT_MS = 30_000;\nconst WEBSOCKET_OPEN_STATE = 1;\n\nfunction getGlobalWebSocket(): AppServerSocketConstructor | undefined {\n return (globalThis as { WebSocket?: AppServerSocketConstructor }).WebSocket;\n}\n\nfunction normalizeBaseUrl(url: string): URL {\n const parsed = new URL(url);\n if (parsed.protocol === \"http:\") parsed.protocol = \"ws:\";\n if (parsed.protocol === \"https:\") parsed.protocol = \"wss:\";\n if (parsed.protocol !== \"ws:\" && parsed.protocol !== \"wss:\") {\n throw new Error(`Unsupported app-server URL protocol: ${parsed.protocol}`);\n }\n if (!parsed.pathname || parsed.pathname === \"/\") {\n parsed.pathname = \"/ws\";\n }\n return parsed;\n}\n\nexport function resolveAppServerChannelUrl(\n url: string,\n channel: AppServerChannel,\n): string {\n const parsed = normalizeBaseUrl(url);\n parsed.searchParams.set(\"channel\", channel);\n return parsed.toString();\n}\n\nfunction attachSocketListener(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.addEventListener && socket.removeEventListener) {\n socket.addEventListener(type, listener);\n return () => socket.removeEventListener?.(type, listener);\n }\n\n if (socket.on) {\n socket.on(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n throw new Error(\"WebSocket implementation does not support event listeners\");\n}\n\nfunction onceSocketEvent(\n socket: AppServerSocketLike,\n type: string,\n listener: (event: unknown) => void,\n): () => void {\n if (socket.once) {\n socket.once(type, listener);\n return () => socket.off?.(type, listener);\n }\n\n let detach = () => {};\n detach = attachSocketListener(socket, type, (event) => {\n detach();\n listener(event);\n });\n return detach;\n}\n\nfunction waitForSocketOpen(socket: AppServerSocketLike): Promise<void> {\n if (socket.readyState === WEBSOCKET_OPEN_STATE) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n let detachOpen = () => {};\n let detachError = () => {};\n const cleanup = () => {\n detachOpen();\n detachError();\n };\n detachOpen = onceSocketEvent(socket, \"open\", () => {\n cleanup();\n resolve();\n });\n detachError = onceSocketEvent(socket, \"error\", (event) => {\n cleanup();\n reject(\n new Error(`App-server WebSocket failed to open: ${String(event)}`),\n );\n });\n });\n}\n\nfunction rawEventData(event: unknown): unknown {\n if (event && typeof event === \"object\" && \"data\" in event) {\n return (event as { data: unknown }).data;\n }\n return event;\n}\n\nfunction messageDataToString(data: unknown): string {\n const raw = rawEventData(data);\n if (typeof raw === \"string\") return raw;\n if (raw instanceof ArrayBuffer) {\n return new TextDecoder().decode(raw);\n }\n if (raw instanceof Uint8Array) {\n return new TextDecoder().decode(raw);\n }\n if (ArrayBuffer.isView(raw)) {\n return new TextDecoder().decode(\n new Uint8Array(raw.buffer as ArrayBuffer, raw.byteOffset, raw.byteLength),\n );\n }\n return String(raw);\n}\n\nfunction parseProtocolMessage(event: unknown): WsProtocolMessage {\n return JSON.parse(messageDataToString(event)) as WsProtocolMessage;\n}\n\nfunction appServerSocketOptions(\n authToken: string | undefined,\n): AppServerSocketOptions | undefined {\n if (authToken === undefined) {\n return undefined;\n }\n const token = authToken.trim();\n if (!token) {\n throw new Error(\"app-server auth token must not be empty\");\n }\n return { headers: { Authorization: `Bearer ${token}` } };\n}\n\nfunction sameRuntime(a: RuntimeScope | undefined, b: RuntimeScope): boolean {\n return a?.agent_id === b.agent_id && a?.conversation_id === b.conversation_id;\n}\n\nfunction isWaitingLoopStatus(message: LoopStatusUpdateMessage): boolean {\n return message.loop_status.status === \"WAITING_ON_INPUT\";\n}\n\nfunction isWaitingOnApprovalLoopStatus(\n message: LoopStatusUpdateMessage,\n): boolean {\n return message.loop_status.status === \"WAITING_ON_APPROVAL\";\n}\n\nfunction streamDeltaRunId(message: StreamDeltaMessage): string | null {\n const runId = (message.delta as { run_id?: unknown }).run_id;\n return typeof runId === \"string\" ? runId : null;\n}\n\nfunction streamDeltaMessageType(message: StreamDeltaMessage): string | null {\n const messageType = (message.delta as { message_type?: unknown })\n .message_type;\n return typeof messageType === \"string\" ? messageType : null;\n}\n\nfunction streamDeltaStopReason(message: StreamDeltaMessage): string | null {\n const stopReason = (message.delta as { stop_reason?: unknown }).stop_reason;\n return typeof stopReason === \"string\" ? stopReason : null;\n}\n\nfunction streamDeltaErrorMessage(message: StreamDeltaMessage): string {\n const delta = message.delta as {\n message?: unknown;\n api_error?: { message?: unknown; detail?: unknown };\n };\n const apiMessage = delta.api_error?.message ?? delta.api_error?.detail;\n if (typeof apiMessage === \"string\" && apiMessage.length > 0)\n return apiMessage;\n if (typeof delta.message === \"string\" && delta.message.length > 0)\n return delta.message;\n return \"App-server turn failed\";\n}\n\nexport class AppServerClient {\n readonly control: AppServerSocketLike;\n readonly stream: AppServerSocketLike;\n\n private readonly requestTimeoutMs: number;\n private readonly pending = new Map<string, PendingRequest>();\n private readonly messageHandlers = new Set<AppServerMessageHandler>();\n private readonly sendHandlers = new Set<AppServerSendHandler>();\n private readonly disconnectHandlers = new Set<AppServerDisconnectHandler>();\n private readonly activeTurnRuntimes = new Set<string>();\n private explicitlyClosed = false;\n private disconnectNotified = false;\n private nextRequestNumber = 0;\n\n constructor(options: AppServerClientOptions) {\n const WebSocket = options.WebSocket ?? getGlobalWebSocket();\n if (!WebSocket) {\n throw new Error(\"No WebSocket implementation available\");\n }\n\n this.requestTimeoutMs =\n options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const socketOptions = appServerSocketOptions(options.authToken);\n this.control = new WebSocket(\n resolveAppServerChannelUrl(options.url, \"control\"),\n socketOptions,\n );\n this.stream = new WebSocket(\n resolveAppServerChannelUrl(options.url, \"stream\"),\n socketOptions,\n );\n\n attachSocketListener(this.control, \"message\", (event) => {\n this.handleMessage(event, \"control\");\n });\n attachSocketListener(this.stream, \"message\", (event) => {\n this.handleMessage(event, \"stream\");\n });\n attachSocketListener(this.control, \"close\", (event) => {\n this.handleDisconnect(\"control\", event);\n });\n attachSocketListener(this.stream, \"close\", (event) => {\n this.handleDisconnect(\"stream\", event);\n });\n }\n\n async connect(): Promise<this> {\n await Promise.all([\n waitForSocketOpen(this.control),\n waitForSocketOpen(this.stream),\n ]);\n return this;\n }\n\n close(): void {\n if (this.explicitlyClosed) return;\n this.explicitlyClosed = true;\n this.rejectAllPending(\"App-server client closed\");\n this.control.close();\n this.stream.close();\n }\n\n onMessage(handler: AppServerMessageHandler): () => void {\n this.messageHandlers.add(handler);\n return () => this.messageHandlers.delete(handler);\n }\n\n onSend(handler: AppServerSendHandler): () => void {\n this.sendHandlers.add(handler);\n return () => this.sendHandlers.delete(handler);\n }\n\n onDisconnect(handler: AppServerDisconnectHandler): () => void {\n this.disconnectHandlers.add(handler);\n return () => this.disconnectHandlers.delete(handler);\n }\n\n nextRequestId(prefix = \"req\"): string {\n this.nextRequestNumber += 1;\n return `${prefix}-${this.nextRequestNumber}`;\n }\n\n send(command: WsProtocolCommand): void {\n for (const handler of this.sendHandlers) {\n handler(command);\n }\n this.control.send(JSON.stringify(command));\n }\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n command: AppServerRequestCommandWithId,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<\n TType extends AppServerRequestCommand[\"type\"],\n TMessage extends WsProtocolMessage = WsProtocolMessage,\n >(\n type: TType,\n body?: AppServerRequestBody,\n options?: AppServerRequestOptions<TMessage>,\n ): Promise<TMessage>;\n\n request<TMessage extends WsProtocolMessage = WsProtocolMessage>(\n commandOrType:\n | AppServerRequestCommandWithId\n | AppServerRequestCommand[\"type\"],\n bodyOrOptions:\n | AppServerRequestBody\n | AppServerRequestOptions<TMessage> = {},\n maybeOptions: AppServerRequestOptions<TMessage> = {},\n ): Promise<TMessage> {\n const isTypeRequest = typeof commandOrType === \"string\";\n const command = isTypeRequest\n ? ({\n type: commandOrType,\n request_id:\n (bodyOrOptions as { request_id?: string }).request_id ??\n this.nextRequestId(commandOrType),\n ...(bodyOrOptions as object),\n } as AppServerRequestCommandWithId)\n : commandOrType;\n const options = isTypeRequest\n ? maybeOptions\n : (bodyOrOptions as AppServerRequestOptions<TMessage>);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n this.pending.delete(command.request_id);\n reject(new Error(`Timed out waiting for ${command.request_id}`));\n }, timeoutMs);\n\n this.pending.set(command.request_id, {\n resolve: (message) => resolve(message as TMessage),\n reject,\n predicate: options.predicate,\n timeout,\n });\n\n try {\n this.send(command);\n } catch (error) {\n clearTimeout(timeout);\n this.pending.delete(command.request_id);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n info(\n options: Omit<\n AppServerRequestOptions<AppServerInfoResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AppServerInfoResponseMessage> {\n return this.request(\n {\n type: \"app_server_info\",\n request_id: this.nextRequestId(\"app-server-info\"),\n },\n {\n ...options,\n predicate: (message): message is AppServerInfoResponseMessage =>\n message.type === \"app_server_info_response\",\n },\n );\n }\n\n runtimeStart(\n command: Omit<RuntimeStartCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<RuntimeStartResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<RuntimeStartResponseMessage> {\n return this.request(\n {\n type: \"runtime_start\",\n request_id: command.request_id ?? this.nextRequestId(\"runtime-start\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is RuntimeStartResponseMessage =>\n message.type === \"runtime_start_response\",\n },\n );\n }\n\n sync(\n command: Omit<SyncCommand, \"type\" | \"request_id\"> & { request_id?: string },\n options: Omit<\n AppServerRequestOptions<SyncResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<SyncResponseMessage> {\n return this.request(\n {\n type: \"sync\",\n request_id: command.request_id ?? this.nextRequestId(\"sync\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is SyncResponseMessage =>\n message.type === \"sync_response\",\n },\n );\n }\n\n abort(\n command: Omit<AbortMessageCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n },\n options: Omit<\n AppServerRequestOptions<AbortMessageResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<AbortMessageResponseMessage> {\n return this.request(\n {\n type: \"abort_message\",\n request_id: command.request_id ?? this.nextRequestId(\"abort\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is AbortMessageResponseMessage =>\n message.type === \"abort_message_response\",\n },\n );\n }\n\n conversationList(\n command: Omit<ConversationListCommand, \"type\" | \"request_id\"> & {\n request_id?: string;\n } = {},\n options: Omit<\n AppServerRequestOptions<ConversationListResponseMessage>,\n \"predicate\"\n > = {},\n ): Promise<ConversationListResponseMessage> {\n return this.request(\n {\n type: \"conversation_list\",\n request_id:\n command.request_id ?? this.nextRequestId(\"conversation-list\"),\n ...command,\n },\n {\n ...options,\n predicate: (message): message is ConversationListResponseMessage =>\n message.type === \"conversation_list_response\",\n },\n );\n }\n\n onExternalToolCall(handler: AppServerExternalToolCallHandler): () => void {\n return this.onMessage((message, channel) => {\n if (\n channel !== \"control\" ||\n message.type !== \"external_tool_call_request\"\n ) {\n return;\n }\n\n void Promise.resolve(handler(message))\n .then((result) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n result,\n });\n })\n .catch((error) => {\n this.send({\n type: \"external_tool_call_response\",\n request_id: message.request_id,\n error: error instanceof Error ? error.message : String(error),\n });\n });\n });\n }\n\n input(command: Omit<InputCommand, \"type\">): void {\n this.send({ type: \"input\", ...command });\n }\n\n runTurn(\n command: Omit<InputCommand, \"type\">,\n options: AppServerRunTurnOptions = {},\n ): Promise<AppServerTurnResult> {\n const runtimeKey = `${command.runtime.agent_id}/${command.runtime.conversation_id}`;\n if (this.activeTurnRuntimes.has(runtimeKey)) {\n return Promise.reject(\n new Error(`A turn is already in flight for ${runtimeKey}`),\n );\n }\n this.activeTurnRuntimes.add(runtimeKey);\n const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs;\n const commandWithIds = this.withClientMessageIds(command);\n const runIds = new Set<string>();\n let observedTurnEvidence = false;\n let observedRequiresApprovalStop = false;\n\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n cleanup();\n reject(\n new Error(\n `Timed out waiting for app-server turn on ${command.runtime.agent_id}/${command.runtime.conversation_id}`,\n ),\n );\n }, timeoutMs);\n\n const cleanup = () => {\n clearTimeout(timeout);\n this.activeTurnRuntimes.delete(runtimeKey);\n offMessage();\n };\n\n const finish = (\n completedBy: AppServerTurnCompletionSource,\n terminalMessage: WsProtocolMessage,\n stopReason: string | null,\n ) => {\n cleanup();\n resolve({\n runtime: command.runtime,\n stopReason,\n runIds: [...runIds],\n clientMessageIds: commandWithIds.clientMessageIds,\n completedBy,\n terminalMessage,\n });\n };\n\n const fail = (error: Error) => {\n cleanup();\n reject(error);\n };\n\n const offMessage = this.onMessage((message) => {\n if (\n !sameRuntime(\n (message as { runtime?: RuntimeScope }).runtime,\n command.runtime,\n )\n ) {\n return;\n }\n\n if (message.type === \"stream_delta\") {\n observedTurnEvidence = true;\n const runId = streamDeltaRunId(message);\n if (runId) runIds.add(runId);\n\n const messageType = streamDeltaMessageType(message);\n if (messageType === \"loop_error\" || messageType === \"error_message\") {\n fail(new Error(streamDeltaErrorMessage(message)));\n return;\n }\n if (messageType === \"stop_reason\") {\n const stopReason = streamDeltaStopReason(message);\n if (stopReason === \"requires_approval\") {\n observedRequiresApprovalStop = true;\n return;\n }\n finish(\"stop_reason\", message, stopReason);\n }\n return;\n }\n\n if (message.type === \"update_loop_status\") {\n const hadTurnEvidenceBeforeLoopStatus =\n observedTurnEvidence || observedRequiresApprovalStop;\n if (\n !hadTurnEvidenceBeforeLoopStatus &&\n (isWaitingOnApprovalLoopStatus(message) ||\n (options.allowLoopStatusFallback === true &&\n isWaitingLoopStatus(message)))\n ) {\n return;\n }\n for (const runId of message.loop_status.active_run_ids) {\n observedTurnEvidence = true;\n runIds.add(runId);\n }\n if (\n hadTurnEvidenceBeforeLoopStatus &&\n isWaitingOnApprovalLoopStatus(message)\n ) {\n finish(\n \"loop_status_waiting_on_approval\",\n message,\n \"requires_approval\",\n );\n return;\n }\n if (\n options.allowLoopStatusFallback === true &&\n hadTurnEvidenceBeforeLoopStatus &&\n isWaitingLoopStatus(message)\n ) {\n finish(\"loop_status_waiting_fallback\", message, null);\n }\n }\n });\n\n try {\n this.input(commandWithIds.command);\n } catch (error) {\n fail(error instanceof Error ? error : new Error(String(error)));\n }\n });\n }\n\n private withClientMessageIds(command: Omit<InputCommand, \"type\">): {\n command: Omit<InputCommand, \"type\">;\n clientMessageIds: string[];\n } {\n if (command.payload.kind !== \"create_message\") {\n return { command, clientMessageIds: [] };\n }\n\n const clientMessageIds: string[] = [];\n const messages = command.payload.messages.map((message) => {\n if (message.role !== \"user\") return message;\n const existing = (message as { client_message_id?: unknown })\n .client_message_id;\n const clientMessageId =\n typeof existing === \"string\" && existing.length > 0\n ? existing\n : this.nextRequestId(\"client-message\");\n clientMessageIds.push(clientMessageId);\n return { ...message, client_message_id: clientMessageId };\n });\n\n return {\n command: {\n ...command,\n payload: { ...command.payload, messages },\n },\n clientMessageIds,\n };\n }\n\n private handleMessage(event: unknown, channel: AppServerChannel): void {\n const message = parseProtocolMessage(event);\n\n for (const handler of this.messageHandlers) {\n handler(message, channel);\n }\n\n const requestId =\n message && typeof message === \"object\" && \"request_id\" in message\n ? (message as { request_id?: unknown }).request_id\n : undefined;\n if (channel !== \"control\" || typeof requestId !== \"string\") {\n return;\n }\n\n const pending = this.pending.get(requestId);\n if (!pending || (pending.predicate && !pending.predicate(message))) {\n return;\n }\n\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.resolve(message);\n }\n\n private rejectAllPending(reason: string): void {\n for (const [requestId, pending] of this.pending) {\n clearTimeout(pending.timeout);\n this.pending.delete(requestId);\n pending.reject(new Error(reason));\n }\n }\n\n private handleDisconnect(channel: AppServerChannel, event: unknown): void {\n this.rejectAllPending(\"App-server socket closed\");\n if (this.explicitlyClosed || this.disconnectNotified) return;\n this.disconnectNotified = true;\n for (const handler of this.disconnectHandlers) {\n handler({ channel, event });\n }\n }\n}\n\nexport function createAppServerClient(\n options: AppServerClientOptions,\n): AppServerClient {\n return new AppServerClient(options);\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";AAiIA,IAAM,6BAA6B;AACnC,IAAM,uBAAuB;AAE7B,SAAS,kBAAkB,GAA2C;AAAA,EACpE,OAAQ,WAA0D;AAAA;AAGpE,SAAS,gBAAgB,CAAC,KAAkB;AAAA,EAC1C,MAAM,SAAS,IAAI,IAAI,GAAG;AAAA,EAC1B,IAAI,OAAO,aAAa;AAAA,IAAS,OAAO,WAAW;AAAA,EACnD,IAAI,OAAO,aAAa;AAAA,IAAU,OAAO,WAAW;AAAA,EACpD,IAAI,OAAO,aAAa,SAAS,OAAO,aAAa,QAAQ;AAAA,IAC3D,MAAM,IAAI,MAAM,wCAAwC,OAAO,UAAU;AAAA,EAC3E;AAAA,EACA,IAAI,CAAC,OAAO,YAAY,OAAO,aAAa,KAAK;AAAA,IAC/C,OAAO,WAAW;AAAA,EACpB;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,0BAA0B,CACxC,KACA,SACQ;AAAA,EACR,MAAM,SAAS,iBAAiB,GAAG;AAAA,EACnC,OAAO,aAAa,IAAI,WAAW,OAAO;AAAA,EAC1C,OAAO,OAAO,SAAS;AAAA;AAGzB,SAAS,oBAAoB,CAC3B,QACA,MACA,UACY;AAAA,EACZ,IAAI,OAAO,oB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B,WAAW,WAAW,KAAK,oBAAoB;AAAA,MAC7C,QAAQ,EAAE,SAAS,MAAM,CAAC;AAAA,IAC5B;AAAA;AAEJ;AAEO,SAAS,qBAAqB,CACnC,SACiB;AAAA,EACjB,OAAO,IAAI,gBAAgB,OAAO;AAAA;",
|
|
8
|
+
"debugId": "8F8A6817B3ED4D9F64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbortMessageCommand, AbortMessageResponseMessage, ConversationListCommand, ConversationListResponseMessage, ExternalToolCallRequestMessage, ExternalToolCallResult, InputCommand, RuntimeScope, RuntimeStartCommand, RuntimeStartResponseMessage, SyncCommand, SyncResponseMessage, WsProtocolCommand, WsProtocolMessage } from "./types/app-server-protocol";
|
|
1
|
+
import type { AbortMessageCommand, AbortMessageResponseMessage, AppServerInfoResponseMessage, ConversationListCommand, ConversationListResponseMessage, ExternalToolCallRequestMessage, ExternalToolCallResult, InputCommand, RuntimeScope, RuntimeStartCommand, RuntimeStartResponseMessage, SyncCommand, SyncResponseMessage, WsProtocolCommand, WsProtocolMessage } from "./types/app-server-protocol";
|
|
2
2
|
export type AppServerChannel = "control" | "stream";
|
|
3
3
|
/**
|
|
4
4
|
* Receives every parsed protocol frame from both app-server websocket channels.
|
|
@@ -94,6 +94,7 @@ export declare class AppServerClient {
|
|
|
94
94
|
send(command: WsProtocolCommand): void;
|
|
95
95
|
request<TMessage extends WsProtocolMessage = WsProtocolMessage>(command: AppServerRequestCommandWithId, options?: AppServerRequestOptions<TMessage>): Promise<TMessage>;
|
|
96
96
|
request<TType extends AppServerRequestCommand["type"], TMessage extends WsProtocolMessage = WsProtocolMessage>(type: TType, body?: AppServerRequestBody, options?: AppServerRequestOptions<TMessage>): Promise<TMessage>;
|
|
97
|
+
info(options?: Omit<AppServerRequestOptions<AppServerInfoResponseMessage>, "predicate">): Promise<AppServerInfoResponseMessage>;
|
|
97
98
|
runtimeStart(command: Omit<RuntimeStartCommand, "type" | "request_id"> & {
|
|
98
99
|
request_id?: string;
|
|
99
100
|
}, options?: Omit<AppServerRequestOptions<RuntimeStartResponseMessage>, "predicate">): Promise<RuntimeStartResponseMessage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-server-client.d.ts","sourceRoot":"","sources":["../../src/app-server-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC9B,sBAAsB,EACtB,YAAY,EAEZ,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,EAE3B,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,CACpC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,gBAAgB,KACtB,IAAI,CAAC;AAEV,uFAAuF;AACvF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,sEAAsE;AACtE,MAAM,MAAM,0BAA0B,GAAG,CACvC,UAAU,EAAE,wBAAwB,KACjC,IAAI,CAAC;AAEV,MAAM,MAAM,gCAAgC,GAAG,CAC7C,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,gBAAgB,CAAC,CAAC,IAAI,EAAE,M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pD,WAAW,CACP,GACL,OAAO,CAAC,2BAA2B,CAAC;IAevC,gBAAgB,CACd,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG;QAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;KAChB,EACN,OAAO,GAAE,IAAI,CACX,uBAAuB,CAAC,+BAA+B,CAAC,EACxD,WAAW,CACP,GACL,OAAO,CAAC,+BAA+B,CAAC;IAgB3C,kBAAkB,CAAC,OAAO,EAAE,gCAAgC,GAAG,MAAM,IAAI;IA2BzE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,IAAI;IAIhD,OAAO,CACL,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EACnC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,mBAAmB,CAAC;IA8H/B,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,aAAa;IAyBrB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,gBAAgB;CAQzB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,eAAe,CAEjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const APP_SERVER_PROTOCOL_VERSION = 1;
|
|
2
|
+
export interface AppServerInfoCommand {
|
|
3
|
+
type: "app_server_info";
|
|
4
|
+
/** Echoed back in the response for request correlation. */
|
|
5
|
+
request_id: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AppServerInfoResponseMessage {
|
|
8
|
+
type: "app_server_info_response";
|
|
9
|
+
request_id: string;
|
|
10
|
+
/** Synchronous post-auth capability discovery has no domain failure variant. */
|
|
11
|
+
success: true;
|
|
12
|
+
backend: "local" | "api";
|
|
13
|
+
letta_code_version: string;
|
|
14
|
+
protocol_version: typeof APP_SERVER_PROTOCOL_VERSION;
|
|
15
|
+
capabilities: {
|
|
16
|
+
agent_management: boolean;
|
|
17
|
+
conversation_management: boolean;
|
|
18
|
+
memory_management: boolean;
|
|
19
|
+
runtime_start: boolean;
|
|
20
|
+
split_channels: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=app-server-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-server-info.d.ts","sourceRoot":"","sources":["../../../src/types/app-server-info.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAC;IACxB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,0BAA0B,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,KAAK,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,OAAO,2BAA2B,CAAC;IACrD,YAAY,EAAE;QACZ,gBAAgB,EAAE,OAAO,CAAC;QAC1B,uBAAuB,EAAE,OAAO,CAAC;QACjC,iBAAiB,EAAE,OAAO,CAAC;QAC3B,aAAa,EAAE,OAAO,CAAC;QACvB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-server-protocol.d.ts","sourceRoot":"","sources":["../../../src/types/app-server-protocol.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"app-server-protocol.d.ts","sourceRoot":"","sources":["../../../src/types/app-server-protocol.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ConversationForkBody {
|
|
2
|
+
/** Agent ID for agent-direct mode with the default conversation. */
|
|
3
|
+
agent_id?: string | null;
|
|
4
|
+
/** Whether the forked conversation should be hidden. */
|
|
5
|
+
hidden?: boolean;
|
|
6
|
+
/** Optional projected message ID to fork through, inclusive. */
|
|
7
|
+
message_id?: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=conversation-fork-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-fork-protocol.d.ts","sourceRoot":"","sources":["../../../src/types/conversation-fork-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -10,6 +10,8 @@ import type { Message as LettaMessage, LettaStreamingResponse } from "@letta-ai/
|
|
|
10
10
|
import type { Conversation, ConversationCreateParams, ConversationListParams, ConversationRecompileParams, ConversationUpdateParams } from "@letta-ai/letta-client/resources/conversations/conversations";
|
|
11
11
|
import type { CompactionResponse, MessageCompactParams, MessageListParams } from "@letta-ai/letta-client/resources/conversations/messages";
|
|
12
12
|
import type { StopReasonType } from "@letta-ai/letta-client/resources/runs/runs";
|
|
13
|
+
import type { AppServerInfoCommand, AppServerInfoResponseMessage } from "./app-server-info";
|
|
14
|
+
import type { ConversationForkBody } from "./conversation-fork-protocol";
|
|
13
15
|
export type DmPolicy = "pairing" | "allowlist" | "open";
|
|
14
16
|
export type ExperimentId = "artifacts" | "conversation_titles" | "desktop_conversation_bootstrap" | "diffs" | "reflection_arena" | "tui_cron";
|
|
15
17
|
export type ExperimentSource = "override" | "env" | "default";
|
|
@@ -1617,12 +1619,6 @@ export interface ConversationRecompileCommand {
|
|
|
1617
1619
|
/** Body/query forwarded to the Letta conversations recompile API. */
|
|
1618
1620
|
body?: ConversationRecompileParams;
|
|
1619
1621
|
}
|
|
1620
|
-
export interface ConversationForkBody {
|
|
1621
|
-
/** Agent ID for agent-direct mode with the default conversation. */
|
|
1622
|
-
agent_id?: string | null;
|
|
1623
|
-
/** Whether the forked conversation should be hidden. */
|
|
1624
|
-
hidden?: boolean;
|
|
1625
|
-
}
|
|
1626
1622
|
export interface ConversationForkCommand {
|
|
1627
1623
|
type: "conversation_fork";
|
|
1628
1624
|
/** Echoed back in the response for request correlation. */
|
|
@@ -2364,9 +2360,9 @@ export interface RemoveQueueItemResponse {
|
|
|
2364
2360
|
success: boolean;
|
|
2365
2361
|
item_id: string;
|
|
2366
2362
|
}
|
|
2367
|
-
export type WsProtocolCommand = InputCommand | ChangeDeviceStateCommand | AbortMessageCommand | SyncCommand | RuntimeStartCommand | ExternalToolCallResponseCommand | TerminalSpawnCommand | TerminalInputCommand | TerminalResizeCommand | TerminalKillCommand | SearchFilesCommand | GrepInFilesCommand | ListInDirectoryCommand | GetTreeCommand | ReadFileCommand | WriteFileCommand | WatchFileCommand | UnwatchFileCommand | EditFileCommand | FileOpsCommand | ListMemoryCommand | MemoryHistoryCommand | MemoryFileAtRefCommand | MemoryCommitDiffCommand | ReadMemoryFileCommand | WriteMemoryFileCommand | DeleteMemoryFileCommand | EnableMemfsCommand | ListModelsCommand | ListConnectProvidersCommand | ConnectProviderCommand | DisconnectProviderCommand | ChatGPTUsageReadCommand | UpdateModelCommand | UpdateToolsetCommand | CronListCommand | CronAddCommand | CronGetCommand | CronRunsCommand | CronTriggerCommand | CronUpdateCommand | CronDeleteCommand | CronDeleteAllCommand | SkillEnableCommand | SkillDisableCommand | CreateAgentCommand | AgentListCommand | AgentRetrieveCommand | AgentCreateCommand | AgentUpdateCommand | AgentDeleteCommand | ConversationListCommand | ConversationRetrieveCommand | ConversationCreateCommand | ConversationUpdateCommand | ConversationRecompileCommand | ConversationForkCommand | ConversationMessagesListCommand | ConversationCompactCommand | GetCwdMapCommand | GetReflectionSettingsCommand | SetReflectionSettingsCommand | GetExperimentsCommand | SetExperimentCommand | ChannelsListCommand | ChannelAccountsListCommand | ChannelAccountCreateCommand | ChannelAccountUpdateCommand | ChannelAccountBindCommand | ChannelAccountUnbindCommand | ChannelAccountDeleteCommand | ChannelAccountStartCommand | ChannelAccountStopCommand | ChannelGetConfigCommand | ChannelSetConfigCommand | ChannelStartCommand | ChannelStopCommand | ChannelPairingsListCommand | ChannelPairingBindCommand | ChannelRoutesListCommand | ChannelTargetsListCommand | ChannelTargetBindCommand | ChannelRouteRemoveCommand | ChannelRouteUpdateCommand | ExecuteCommandCommand | RemoveQueueItemCommand | SearchBranchesCommand | CheckoutBranchCommand | SecretListCommand | SecretApplyCommand;
|
|
2363
|
+
export type WsProtocolCommand = InputCommand | ChangeDeviceStateCommand | AbortMessageCommand | SyncCommand | RuntimeStartCommand | ExternalToolCallResponseCommand | TerminalSpawnCommand | TerminalInputCommand | TerminalResizeCommand | TerminalKillCommand | SearchFilesCommand | GrepInFilesCommand | ListInDirectoryCommand | GetTreeCommand | ReadFileCommand | WriteFileCommand | WatchFileCommand | UnwatchFileCommand | EditFileCommand | FileOpsCommand | ListMemoryCommand | MemoryHistoryCommand | MemoryFileAtRefCommand | MemoryCommitDiffCommand | ReadMemoryFileCommand | WriteMemoryFileCommand | DeleteMemoryFileCommand | EnableMemfsCommand | ListModelsCommand | ListConnectProvidersCommand | ConnectProviderCommand | DisconnectProviderCommand | ChatGPTUsageReadCommand | UpdateModelCommand | UpdateToolsetCommand | CronListCommand | CronAddCommand | CronGetCommand | CronRunsCommand | CronTriggerCommand | CronUpdateCommand | CronDeleteCommand | CronDeleteAllCommand | SkillEnableCommand | SkillDisableCommand | CreateAgentCommand | AppServerInfoCommand | AgentListCommand | AgentRetrieveCommand | AgentCreateCommand | AgentUpdateCommand | AgentDeleteCommand | ConversationListCommand | ConversationRetrieveCommand | ConversationCreateCommand | ConversationUpdateCommand | ConversationRecompileCommand | ConversationForkCommand | ConversationMessagesListCommand | ConversationCompactCommand | GetCwdMapCommand | GetReflectionSettingsCommand | SetReflectionSettingsCommand | GetExperimentsCommand | SetExperimentCommand | ChannelsListCommand | ChannelAccountsListCommand | ChannelAccountCreateCommand | ChannelAccountUpdateCommand | ChannelAccountBindCommand | ChannelAccountUnbindCommand | ChannelAccountDeleteCommand | ChannelAccountStartCommand | ChannelAccountStopCommand | ChannelGetConfigCommand | ChannelSetConfigCommand | ChannelStartCommand | ChannelStopCommand | ChannelPairingsListCommand | ChannelPairingBindCommand | ChannelRoutesListCommand | ChannelTargetsListCommand | ChannelTargetBindCommand | ChannelRouteRemoveCommand | ChannelRouteUpdateCommand | ExecuteCommandCommand | RemoveQueueItemCommand | SearchBranchesCommand | CheckoutBranchCommand | SecretListCommand | SecretApplyCommand;
|
|
2368
2364
|
export type WsProtocolCommandType = WsProtocolCommand["type"];
|
|
2369
|
-
export type WsProtocolMessage = ControlRequest | DeviceStatusUpdateMessage | LoopStatusUpdateMessage | QueueUpdateMessage | StreamDeltaMessage | SubagentStateUpdateMessage | ExternalToolCallRequestMessage | AbortMessageResponseMessage | SyncResponseMessage | TerminalOutputMessage | TerminalSpawnedMessage | TerminalExitedMessage | SearchFilesResponseMessage | GrepInFilesResponseMessage | ListInDirectoryResponseMessage | GetTreeResponseMessage | ReadFileResponseMessage | WriteFileResponseMessage | FileOpsCommand | EditFileResponseMessage | FileChangedMessage | ListMemoryResponseMessage | MemoryHistoryResponseMessage | MemoryFileAtRefResponseMessage | MemoryCommitDiffResponseMessage | ReadMemoryFileResponseMessage | WriteMemoryFileResponseMessage | DeleteMemoryFileResponseMessage | EnableMemfsResponseMessage | MemoryUpdatedMessage | ListModelsResponseMessage | ListConnectProvidersResponseMessage | ConnectProviderResponseMessage | DisconnectProviderResponseMessage | ChatGPTUsageReadResponseMessage | UpdateModelResponseMessage | UpdateToolsetResponseMessage | CronListResponseMessage | CronAddResponseMessage | CronGetResponseMessage | CronRunsResponseMessage | CronTriggerResponseMessage | CronUpdateResponseMessage | CronDeleteResponseMessage | CronDeleteAllResponseMessage | CronsUpdatedMessage | SkillEnableResponseMessage | SkillDisableResponseMessage | SkillsUpdatedMessage | CreateAgentResponseMessage | AgentListResponseMessage | AgentRetrieveResponseMessage | AgentCreateResponseMessage | AgentUpdateResponseMessage | AgentDeleteResponseMessage | ConversationListResponseMessage | ConversationRetrieveResponseMessage | ConversationCreateResponseMessage | ConversationUpdateResponseMessage | ConversationRecompileResponseMessage | ConversationForkResponseMessage | ConversationMessagesListResponseMessage | ConversationCompactResponseMessage | RuntimeStartResponseMessage | GetExperimentsResponseMessage | SetExperimentResponseMessage | GetReflectionSettingsResponseMessage | SetReflectionSettingsResponseMessage | ChannelsListResponseMessage | ChannelAccountsListResponseMessage | ChannelAccountCreateResponseMessage | ChannelAccountUpdateResponseMessage | ChannelAccountBindResponseMessage | ChannelAccountUnbindResponseMessage | ChannelAccountDeleteResponseMessage | ChannelAccountStartResponseMessage | ChannelAccountStopResponseMessage | ChannelGetConfigResponseMessage | ChannelSetConfigResponseMessage | ChannelStartResponseMessage | ChannelStopResponseMessage | ChannelPairingsListResponseMessage | ChannelPairingBindResponseMessage | ChannelRoutesListResponseMessage | ChannelTargetsListResponseMessage | ChannelTargetBindResponseMessage | ChannelRouteRemoveResponseMessage | ChannelRouteUpdateResponseMessage | ChannelsUpdatedMessage | ChannelAccountsUpdatedMessage | ChannelPairingsUpdatedMessage | ChannelRoutesUpdatedMessage | ChannelTargetsUpdatedMessage | GetCwdMapResponseMessage | SearchBranchesResponse | CheckoutBranchResponse | SecretListResponse | SecretApplyResponse | RemoveQueueItemResponse;
|
|
2365
|
+
export type WsProtocolMessage = ControlRequest | DeviceStatusUpdateMessage | LoopStatusUpdateMessage | QueueUpdateMessage | StreamDeltaMessage | SubagentStateUpdateMessage | ExternalToolCallRequestMessage | AbortMessageResponseMessage | SyncResponseMessage | TerminalOutputMessage | TerminalSpawnedMessage | TerminalExitedMessage | SearchFilesResponseMessage | GrepInFilesResponseMessage | ListInDirectoryResponseMessage | GetTreeResponseMessage | ReadFileResponseMessage | WriteFileResponseMessage | FileOpsCommand | EditFileResponseMessage | FileChangedMessage | ListMemoryResponseMessage | MemoryHistoryResponseMessage | MemoryFileAtRefResponseMessage | MemoryCommitDiffResponseMessage | ReadMemoryFileResponseMessage | WriteMemoryFileResponseMessage | DeleteMemoryFileResponseMessage | EnableMemfsResponseMessage | MemoryUpdatedMessage | ListModelsResponseMessage | ListConnectProvidersResponseMessage | ConnectProviderResponseMessage | DisconnectProviderResponseMessage | ChatGPTUsageReadResponseMessage | UpdateModelResponseMessage | UpdateToolsetResponseMessage | CronListResponseMessage | CronAddResponseMessage | CronGetResponseMessage | CronRunsResponseMessage | CronTriggerResponseMessage | CronUpdateResponseMessage | CronDeleteResponseMessage | CronDeleteAllResponseMessage | CronsUpdatedMessage | SkillEnableResponseMessage | SkillDisableResponseMessage | SkillsUpdatedMessage | CreateAgentResponseMessage | AppServerInfoResponseMessage | AgentListResponseMessage | AgentRetrieveResponseMessage | AgentCreateResponseMessage | AgentUpdateResponseMessage | AgentDeleteResponseMessage | ConversationListResponseMessage | ConversationRetrieveResponseMessage | ConversationCreateResponseMessage | ConversationUpdateResponseMessage | ConversationRecompileResponseMessage | ConversationForkResponseMessage | ConversationMessagesListResponseMessage | ConversationCompactResponseMessage | RuntimeStartResponseMessage | GetExperimentsResponseMessage | SetExperimentResponseMessage | GetReflectionSettingsResponseMessage | SetReflectionSettingsResponseMessage | ChannelsListResponseMessage | ChannelAccountsListResponseMessage | ChannelAccountCreateResponseMessage | ChannelAccountUpdateResponseMessage | ChannelAccountBindResponseMessage | ChannelAccountUnbindResponseMessage | ChannelAccountDeleteResponseMessage | ChannelAccountStartResponseMessage | ChannelAccountStopResponseMessage | ChannelGetConfigResponseMessage | ChannelSetConfigResponseMessage | ChannelStartResponseMessage | ChannelStopResponseMessage | ChannelPairingsListResponseMessage | ChannelPairingBindResponseMessage | ChannelRoutesListResponseMessage | ChannelTargetsListResponseMessage | ChannelTargetBindResponseMessage | ChannelRouteRemoveResponseMessage | ChannelRouteUpdateResponseMessage | ChannelsUpdatedMessage | ChannelAccountsUpdatedMessage | ChannelPairingsUpdatedMessage | ChannelRoutesUpdatedMessage | ChannelTargetsUpdatedMessage | GetCwdMapResponseMessage | SearchBranchesResponse | CheckoutBranchResponse | SecretListResponse | SecretApplyResponse | RemoveQueueItemResponse;
|
|
2370
2366
|
export type WsProtocolMessageType = WsProtocolMessage["type"];
|
|
2371
2367
|
export type { StopReasonType };
|
|
2372
2368
|
//# sourceMappingURL=protocol_v2.d.ts.map
|