import * as bare from "@rivetkit/bare-ts"; export type i32 = number; export type u32 = number; export type u64 = bigint; export type JsonUtf8 = string; export declare function readJsonUtf8(bc: bare.ByteCursor): JsonUtf8; export declare function writeJsonUtf8(bc: bare.ByteCursor, x: JsonUtf8): void; export declare enum AcpRuntimeKind { JavaScript = "JavaScript", Python = "Python", WebAssembly = "WebAssembly" } export declare function readAcpRuntimeKind(bc: bare.ByteCursor): AcpRuntimeKind; export declare function writeAcpRuntimeKind(bc: bare.ByteCursor, x: AcpRuntimeKind): void; /** * Legacy connection-owned ACP messages below remain encoded only for the * dormant browser reference runtime. They are not part of the public AgentOS * session API, and the native sidecar rejects them. Native durable orchestration * uses the same structs internally as a private adapter-process driver until the * browser protocol can be split into its own schema. */ export type AcpCreateSessionRequest = { readonly agentType: string; readonly runtime: AcpRuntimeKind; readonly cwd: string; readonly additionalDirectories: readonly string[]; readonly args: readonly string[]; readonly env: ReadonlyMap; readonly protocolVersion: i32; readonly clientCapabilities: JsonUtf8; readonly mcpServers: JsonUtf8; readonly skipOsInstructions: boolean; readonly additionalInstructions: string | null; }; export declare function readAcpCreateSessionRequest(bc: bare.ByteCursor): AcpCreateSessionRequest; export declare function writeAcpCreateSessionRequest(bc: bare.ByteCursor, x: AcpCreateSessionRequest): void; export type AcpSessionRequest = { readonly sessionId: string; readonly method: string; readonly params: JsonUtf8 | null; }; export declare function readAcpSessionRequest(bc: bare.ByteCursor): AcpSessionRequest; export declare function writeAcpSessionRequest(bc: bare.ByteCursor, x: AcpSessionRequest): void; /** * Enumerate the agents available in this VM. The sidecar answers from the already * projected `/opt/agentos` packages (client parses no manifests). */ export type AcpListAgentsRequest = { readonly reserved: boolean; }; export declare function readAcpListAgentsRequest(bc: bare.ByteCursor): AcpListAgentsRequest; export declare function writeAcpListAgentsRequest(bc: bare.ByteCursor, x: AcpListAgentsRequest): void; export type AcpAgentEntry = { readonly id: string; readonly installed: boolean; readonly adapterEntrypoint: string; }; export declare function readAcpAgentEntry(bc: bare.ByteCursor): AcpAgentEntry; export declare function writeAcpAgentEntry(bc: bare.ByteCursor, x: AcpAgentEntry): void; export type AcpListAgentsResponse = { readonly agents: readonly AcpAgentEntry[]; }; export declare function readAcpListAgentsResponse(bc: bare.ByteCursor): AcpListAgentsResponse; export declare function writeAcpListAgentsResponse(bc: bare.ByteCursor, x: AcpListAgentsResponse): void; /** * `openSession` is idempotent. Opening an existing durable ID restores its * adapter when unloaded; getSession/listSessions remain the storage-only ways to * inspect it without starting an adapter. The sidecar owns ACP session/new versus * native resume/load selection and returns only after negotiation has populated * the cached configuration/capability/agent-info fields. Omitted cwd resolves to * `/home/agentos` in the sidecar. Restoration reapplies the original cwd, * additionalDirectories, env, exact native ACP McpServer values, instruction * settings, and current configuration values. The response is intentionally * empty: the caller owns the requested public ID (or the documented `main` * default), and getSession is the only API that returns durable metadata. * permissionPolicy is an immutable AgentOS-side strategy for resolving native * ACP session/request_permission calls: allow_all (the default) selects an * adapter-provided allow option, reject_all selects a reject option or returns a * typed permission_policy_unsatisfied error when none is offered, * and ask durably exposes the adapter's exact options for a caller response. It * does not change VM permissions and is not sent to the ACP adapter as config. */ export type AcpOpenSessionRequest = { readonly sessionId: string | null; readonly agent: string; readonly cwd: string | null; readonly additionalDirectories: JsonUtf8 | null; readonly env: JsonUtf8 | null; readonly mcpServers: JsonUtf8 | null; readonly permissionPolicy: string | null; readonly skipOsInstructions: boolean | null; readonly additionalInstructions: string | null; }; export declare function readAcpOpenSessionRequest(bc: bare.ByteCursor): AcpOpenSessionRequest; export declare function writeAcpOpenSessionRequest(bc: bare.ByteCursor, x: AcpOpenSessionRequest): void; /** * This lookup never starts, restores, or queries an ACP adapter. */ export type AcpGetDurableSessionRequest = { readonly sessionId: string | null; }; export declare function readAcpGetDurableSessionRequest(bc: bare.ByteCursor): AcpGetDurableSessionRequest; export declare function writeAcpGetDurableSessionRequest(bc: bare.ByteCursor, x: AcpGetDurableSessionRequest): void; /** * Listing is an ordinary updatedAt/sessionId keyset traversal. It never starts, * restores, or queries an ACP adapter. It deliberately does not freeze a database * snapshot across pages: a session updated between page requests can move in the * ordering, which keeps cursors simple and avoids a snapshot registry. */ export type AcpListDurableSessionsRequest = { readonly cursor: string | null; readonly limit: u32 | null; }; export declare function readAcpListDurableSessionsRequest(bc: bare.ByteCursor): AcpListDurableSessionsRequest; export declare function writeAcpListDurableSessionsRequest(bc: bare.ByteCursor, x: AcpListDurableSessionsRequest): void; /** * Deletion is naturally idempotent by its target ID. It permanently * removes durable metadata and history after orderly runtime teardown. */ export type AcpDeleteSessionRequest = { readonly sessionId: string | null; }; export declare function readAcpDeleteSessionRequest(bc: bare.ByteCursor): AcpDeleteSessionRequest; export declare function writeAcpDeleteSessionRequest(bc: bare.ByteCursor, x: AcpDeleteSessionRequest): void; /** * Unload cancels active work and releases the adapter but preserves the durable * session and all history. A later prompt transparently restores it. */ export type AcpUnloadSessionRequest = { readonly sessionId: string | null; }; export declare function readAcpUnloadSessionRequest(bc: bare.ByteCursor): AcpUnloadSessionRequest; export declare function writeAcpUnloadSessionRequest(bc: bare.ByteCursor, x: AcpUnloadSessionRequest): void; /** * Prompt never creates a missing session. It transparently restores an unloaded * adapter, durably accepts input before dispatch, blocks through the turn, and * never automatically replays a prompt whose delivery became uncertain. The * sidecar imposes no absolute session/prompt deadline: long turns and ask-policy * permission waits remain active while the actor keep-awake scope is held. */ export type AcpPromptRequest = { readonly sessionId: string | null; readonly idempotencyKey: string | null; readonly content: JsonUtf8; }; export declare function readAcpPromptRequest(bc: bare.ByteCursor): AcpPromptRequest; export declare function writeAcpPromptRequest(bc: bare.ByteCursor, x: AcpPromptRequest): void; /** * Cancellation is first-writer-wins against prompt completion and returns its * typed race outcome. */ export type AcpCancelPromptRequest = { readonly sessionId: string | null; }; export declare function readAcpCancelPromptRequest(bc: bare.ByteCursor): AcpCancelPromptRequest; export declare function writeAcpCancelPromptRequest(bc: bare.ByteCursor, x: AcpCancelPromptRequest): void; /** * Respond to a pending native ACP session/request_permission. sessionId is * always the explicit caller-owned AgentOS identity; it never defaults to main. * requestId is globally unique AgentOS-owned correlation and never contains the * adapter JSON-RPC ID. optionId is one of the exact adapter-supplied ACP option * identifiers. Resolution is first-writer-wins. accepted means the decision won * that race and was delivered to the active ACP waiter, not that the tool ran. * Invalid options are typed invalid_permission_option errors and do not consume * the request. A terminal late response is non-throwing and names its reason. */ export type AcpRespondPermissionRequest = { readonly sessionId: string; readonly requestId: string; readonly optionId: string; }; export declare function readAcpRespondPermissionRequest(bc: bare.ByteCursor): AcpRespondPermissionRequest; export declare function writeAcpRespondPermissionRequest(bc: bare.ByteCursor, x: AcpRespondPermissionRequest): void; /** * History is SQLite-only and never starts, restores, or queries an adapter. It * stores the generic durable event union below; nested wire payloads retain * unknown extension metadata and clients mechanically expose them as one flat * top-level type union. Agent message/thought deltas are emitted live as ephemeral entries; * they enter durable history only when the message completes. Non-delta ACP * updates interleaved during a message remain in native arrival order. * before/after are exclusive and mutually exclusive. Cursor expiry is a typed * error, never a silent skip. History retention and response pages are bounded * by the VM's generous `limits.acp.*` settings; retention prunes oldest events. * Durable sequence values can repeat on live delivery because observers * deduplicate by (sessionId, sequence). */ export type AcpReadHistoryRequest = { readonly sessionId: string | null; readonly before: u64 | null; readonly after: u64 | null; readonly limit: u32 | null; }; export declare function readAcpReadHistoryRequest(bc: bare.ByteCursor): AcpReadHistoryRequest; export declare function writeAcpReadHistoryRequest(bc: bare.ByteCursor, x: AcpReadHistoryRequest): void; /** * Cached getters never start, restore, or query an adapter. */ export type AcpGetSessionConfigRequest = { readonly sessionId: string | null; }; export declare function readAcpGetSessionConfigRequest(bc: bare.ByteCursor): AcpGetSessionConfigRequest; export declare function writeAcpGetSessionConfigRequest(bc: bare.ByteCursor, x: AcpGetSessionConfigRequest): void; export type AcpGetSessionCapabilitiesRequest = { readonly sessionId: string | null; }; export declare function readAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor): AcpGetSessionCapabilitiesRequest; export declare function writeAcpGetSessionCapabilitiesRequest(bc: bare.ByteCursor, x: AcpGetSessionCapabilitiesRequest): void; export type AcpGetSessionAgentInfoRequest = { readonly sessionId: string | null; }; export declare function readAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor): AcpGetSessionAgentInfoRequest; export declare function writeAcpGetSessionAgentInfoRequest(bc: bare.ByteCursor, x: AcpGetSessionAgentInfoRequest): void; /** * Setting configuration may transparently restore the adapter; ACP owns * validation and the response replaces the complete cached option collection. * `value` encodes exactly one native ACP string or boolean config value. */ export type AcpSetSessionConfigOptionRequest = { readonly sessionId: string | null; readonly configId: string; readonly value: JsonUtf8; }; export declare function readAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor): AcpSetSessionConfigOptionRequest; export declare function writeAcpSetSessionConfigOptionRequest(bc: bare.ByteCursor, x: AcpSetSessionConfigOptionRequest): void; export type AcpGetSessionStateRequest = { readonly sessionId: string; }; export declare function readAcpGetSessionStateRequest(bc: bare.ByteCursor): AcpGetSessionStateRequest; export declare function writeAcpGetSessionStateRequest(bc: bare.ByteCursor, x: AcpGetSessionStateRequest): void; export type AcpCloseSessionRequest = { readonly sessionId: string; }; export declare function readAcpCloseSessionRequest(bc: bare.ByteCursor): AcpCloseSessionRequest; export declare function writeAcpCloseSessionRequest(bc: bare.ByteCursor, x: AcpCloseSessionRequest): void; /** * Resume a session that exists in durable storage but is not live in the current * VM (e.g. after a Rivet actor slept and woke with a fresh VM). The sidecar runs * the stateless resume state machine (native session/load when the agent supports * it, else a fresh session/new + transcript continuation preamble). `runtime`, * `cwd`, and `env` describe the fresh adapter launch used by the fallback tier. * `transcriptPath`, when present, is a guest-readable path the fallback preamble * points the agent at. */ export type AcpResumeSessionRequest = { readonly sessionId: string; readonly agentType: string; readonly runtime: AcpRuntimeKind; readonly transcriptPath: string | null; readonly cwd: string; readonly additionalDirectories: readonly string[]; readonly mcpServers: JsonUtf8; readonly env: ReadonlyMap; }; export declare function readAcpResumeSessionRequest(bc: bare.ByteCursor): AcpResumeSessionRequest; export declare function writeAcpResumeSessionRequest(bc: bare.ByteCursor, x: AcpResumeSessionRequest): void; /** * Browser RESUMABLE path only (AGENTOS-WEB-ASYNC-AGENTS.md §3.2.1): the kernel * worker feeds a chunk of the agent's stdout into the in-flight create_session / * session/prompt handshake. The synchronous sidecar would block inside one * pushFrame; the resumable browser path returns between steps so the worker can * service the agent's own syscalls (incl. pi's net call for inference) on fresh, * non-nested pushFrames. `processId` is the handshake handle returned in the * AcpPendingResponse for the originating create/prompt request. */ export type AcpDeliverAgentOutputRequest = { readonly processId: string; readonly chunk: ArrayBuffer; }; export declare function readAcpDeliverAgentOutputRequest(bc: bare.ByteCursor): AcpDeliverAgentOutputRequest; export declare function writeAcpDeliverAgentOutputRequest(bc: bare.ByteCursor, x: AcpDeliverAgentOutputRequest): void; export type AcpRequest = { readonly tag: "AcpOpenSessionRequest"; readonly val: AcpOpenSessionRequest; } | { readonly tag: "AcpGetDurableSessionRequest"; readonly val: AcpGetDurableSessionRequest; } | { readonly tag: "AcpListDurableSessionsRequest"; readonly val: AcpListDurableSessionsRequest; } | { readonly tag: "AcpDeleteSessionRequest"; readonly val: AcpDeleteSessionRequest; } | { readonly tag: "AcpUnloadSessionRequest"; readonly val: AcpUnloadSessionRequest; } | { readonly tag: "AcpPromptRequest"; readonly val: AcpPromptRequest; } | { readonly tag: "AcpCancelPromptRequest"; readonly val: AcpCancelPromptRequest; } | { readonly tag: "AcpRespondPermissionRequest"; readonly val: AcpRespondPermissionRequest; } | { readonly tag: "AcpReadHistoryRequest"; readonly val: AcpReadHistoryRequest; } | { readonly tag: "AcpGetSessionConfigRequest"; readonly val: AcpGetSessionConfigRequest; } | { readonly tag: "AcpSetSessionConfigOptionRequest"; readonly val: AcpSetSessionConfigOptionRequest; } | { readonly tag: "AcpGetSessionCapabilitiesRequest"; readonly val: AcpGetSessionCapabilitiesRequest; } | { readonly tag: "AcpGetSessionAgentInfoRequest"; readonly val: AcpGetSessionAgentInfoRequest; } | { readonly tag: "AcpCreateSessionRequest"; readonly val: AcpCreateSessionRequest; } | { readonly tag: "AcpSessionRequest"; readonly val: AcpSessionRequest; } | { readonly tag: "AcpGetSessionStateRequest"; readonly val: AcpGetSessionStateRequest; } | { readonly tag: "AcpCloseSessionRequest"; readonly val: AcpCloseSessionRequest; } | { readonly tag: "AcpResumeSessionRequest"; readonly val: AcpResumeSessionRequest; } | { readonly tag: "AcpDeliverAgentOutputRequest"; readonly val: AcpDeliverAgentOutputRequest; } | { readonly tag: "AcpListAgentsRequest"; readonly val: AcpListAgentsRequest; }; export declare function readAcpRequest(bc: bare.ByteCursor): AcpRequest; export declare function writeAcpRequest(bc: bare.ByteCursor, x: AcpRequest): void; export declare function encodeAcpRequest(x: AcpRequest, config?: Partial): Uint8Array; export declare function decodeAcpRequest(bytes: Uint8Array): AcpRequest; export type AcpDurableSessionInfo = { readonly sessionId: string; readonly agent: string; readonly cwd: string; readonly additionalDirectories: JsonUtf8; readonly state: JsonUtf8; readonly latestSequence: u64; readonly title: string | null; readonly metadata: JsonUtf8 | null; readonly createdAt: string; readonly updatedAt: string; }; export declare function readAcpDurableSessionInfo(bc: bare.ByteCursor): AcpDurableSessionInfo; export declare function writeAcpDurableSessionInfo(bc: bare.ByteCursor, x: AcpDurableSessionInfo): void; export type AcpOpenSessionResponse = { readonly reserved: boolean; }; export declare function readAcpOpenSessionResponse(bc: bare.ByteCursor): AcpOpenSessionResponse; export declare function writeAcpOpenSessionResponse(bc: bare.ByteCursor, x: AcpOpenSessionResponse): void; export type AcpGetDurableSessionResponse = { readonly session: AcpDurableSessionInfo; }; export declare function readAcpGetDurableSessionResponse(bc: bare.ByteCursor): AcpGetDurableSessionResponse; export declare function writeAcpGetDurableSessionResponse(bc: bare.ByteCursor, x: AcpGetDurableSessionResponse): void; export type AcpListDurableSessionsResponse = { readonly sessions: readonly AcpDurableSessionInfo[]; readonly nextCursor: string | null; }; export declare function readAcpListDurableSessionsResponse(bc: bare.ByteCursor): AcpListDurableSessionsResponse; export declare function writeAcpListDurableSessionsResponse(bc: bare.ByteCursor, x: AcpListDurableSessionsResponse): void; export type AcpDeleteSessionResponse = { readonly reserved: boolean; }; export declare function readAcpDeleteSessionResponse(bc: bare.ByteCursor): AcpDeleteSessionResponse; export declare function writeAcpDeleteSessionResponse(bc: bare.ByteCursor, x: AcpDeleteSessionResponse): void; export type AcpUnloadSessionResponse = { readonly reserved: boolean; }; export declare function readAcpUnloadSessionResponse(bc: bare.ByteCursor): AcpUnloadSessionResponse; export declare function writeAcpUnloadSessionResponse(bc: bare.ByteCursor, x: AcpUnloadSessionResponse): void; export type AcpPromptResponse = { readonly sessionId: string; readonly message: JsonUtf8 | null; readonly stopReason: string; }; export declare function readAcpPromptResponse(bc: bare.ByteCursor): AcpPromptResponse; export declare function writeAcpPromptResponse(bc: bare.ByteCursor, x: AcpPromptResponse): void; export type AcpCancelPromptResponse = { readonly status: string; }; export declare function readAcpCancelPromptResponse(bc: bare.ByteCursor): AcpCancelPromptResponse; export declare function writeAcpCancelPromptResponse(bc: bare.ByteCursor, x: AcpCancelPromptResponse): void; export type AcpRespondPermissionResponse = { readonly status: string; readonly reason: string | null; }; export declare function readAcpRespondPermissionResponse(bc: bare.ByteCursor): AcpRespondPermissionResponse; export declare function writeAcpRespondPermissionResponse(bc: bare.ByteCursor, x: AcpRespondPermissionResponse): void; /** * The generic internal wire/storage union. Native payloads retain their * negotiated ACP field names, optional values, and opaque _meta. Public clients * flatten SessionUpdate.sessionUpdate into top-level type and flatten permission * request/response fields beside the durability envelope; they do not expose * these internal update/request/response wrappers. Native adapter request IDs * and private ACP session IDs never enter the public union. Automatically * resolved permission requests are never persisted or emitted. An ask request * has no permission timeout: the active prompt remains awake until a response * or explicit adapter/session/VM lifecycle transition wins. */ export type AcpDurableSessionUpdate = { readonly update: JsonUtf8; }; export declare function readAcpDurableSessionUpdate(bc: bare.ByteCursor): AcpDurableSessionUpdate; export declare function writeAcpDurableSessionUpdate(bc: bare.ByteCursor, x: AcpDurableSessionUpdate): void; export type AcpDurablePermissionRequest = { readonly requestId: string; readonly request: JsonUtf8; }; export declare function readAcpDurablePermissionRequest(bc: bare.ByteCursor): AcpDurablePermissionRequest; export declare function writeAcpDurablePermissionRequest(bc: bare.ByteCursor, x: AcpDurablePermissionRequest): void; export type AcpDurablePermissionResponse = { readonly requestId: string; readonly response: JsonUtf8; readonly status: string; readonly reason: string | null; }; export declare function readAcpDurablePermissionResponse(bc: bare.ByteCursor): AcpDurablePermissionResponse; export declare function writeAcpDurablePermissionResponse(bc: bare.ByteCursor, x: AcpDurablePermissionResponse): void; export type AcpDurableEvent = { readonly tag: "AcpDurableSessionUpdate"; readonly val: AcpDurableSessionUpdate; } | { readonly tag: "AcpDurablePermissionRequest"; readonly val: AcpDurablePermissionRequest; } | { readonly tag: "AcpDurablePermissionResponse"; readonly val: AcpDurablePermissionResponse; }; export declare function readAcpDurableEvent(bc: bare.ByteCursor): AcpDurableEvent; export declare function writeAcpDurableEvent(bc: bare.ByteCursor, x: AcpDurableEvent): void; /** * AgentOS adds only this public identity, sequence, and timestamp envelope. */ export type AcpDurableHistoryEntry = { readonly sessionId: string; readonly sequence: u64; readonly timestamp: string; readonly event: AcpDurableEvent; }; export declare function readAcpDurableHistoryEntry(bc: bare.ByteCursor): AcpDurableHistoryEntry; export declare function writeAcpDurableHistoryEntry(bc: bare.ByteCursor, x: AcpDurableHistoryEntry): void; export type AcpHistoryPageResponse = { readonly events: readonly AcpDurableHistoryEntry[]; readonly hasMoreBefore: boolean; readonly hasMoreAfter: boolean; }; export declare function readAcpHistoryPageResponse(bc: bare.ByteCursor): AcpHistoryPageResponse; export declare function writeAcpHistoryPageResponse(bc: bare.ByteCursor, x: AcpHistoryPageResponse): void; export type AcpSessionConfigResponse = { readonly revision: u64; readonly options: JsonUtf8; }; export declare function readAcpSessionConfigResponse(bc: bare.ByteCursor): AcpSessionConfigResponse; export declare function writeAcpSessionConfigResponse(bc: bare.ByteCursor, x: AcpSessionConfigResponse): void; export type AcpSessionCapabilitiesResponse = { readonly capabilities: JsonUtf8 | null; }; export declare function readAcpSessionCapabilitiesResponse(bc: bare.ByteCursor): AcpSessionCapabilitiesResponse; export declare function writeAcpSessionCapabilitiesResponse(bc: bare.ByteCursor, x: AcpSessionCapabilitiesResponse): void; export type AcpSessionAgentInfoResponse = { readonly agentInfo: JsonUtf8 | null; }; export declare function readAcpSessionAgentInfoResponse(bc: bare.ByteCursor): AcpSessionAgentInfoResponse; export declare function writeAcpSessionAgentInfoResponse(bc: bare.ByteCursor, x: AcpSessionAgentInfoResponse): void; export type AcpSessionCreatedResponse = { readonly sessionId: string; readonly pid: u32 | null; readonly modes: JsonUtf8 | null; readonly configOptions: readonly JsonUtf8[]; readonly agentCapabilities: JsonUtf8 | null; readonly agentInfo: JsonUtf8 | null; }; export declare function readAcpSessionCreatedResponse(bc: bare.ByteCursor): AcpSessionCreatedResponse; export declare function writeAcpSessionCreatedResponse(bc: bare.ByteCursor, x: AcpSessionCreatedResponse): void; export type AcpSessionRpcResponse = { readonly sessionId: string; readonly response: JsonUtf8; /** * Number of request-scoped AcpSessionEvent frames emitted before this * terminal response. Clients use this as an event-delivery barrier because * response and event frames travel on separate priority lanes. */ readonly eventCount: u32; }; export declare function readAcpSessionRpcResponse(bc: bare.ByteCursor): AcpSessionRpcResponse; export declare function writeAcpSessionRpcResponse(bc: bare.ByteCursor, x: AcpSessionRpcResponse): void; export type AcpSessionStateResponse = { readonly sessionId: string; readonly agentType: string; readonly processId: string; readonly pid: u32 | null; readonly closed: boolean; readonly exitCode: i32 | null; readonly modes: JsonUtf8 | null; readonly configOptions: readonly JsonUtf8[]; readonly agentCapabilities: JsonUtf8 | null; readonly agentInfo: JsonUtf8 | null; }; export declare function readAcpSessionStateResponse(bc: bare.ByteCursor): AcpSessionStateResponse; export declare function writeAcpSessionStateResponse(bc: bare.ByteCursor, x: AcpSessionStateResponse): void; export type AcpSessionClosedResponse = { readonly sessionId: string; }; export declare function readAcpSessionClosedResponse(bc: bare.ByteCursor): AcpSessionClosedResponse; export declare function writeAcpSessionClosedResponse(bc: bare.ByteCursor, x: AcpSessionClosedResponse): void; /** * Result of AcpResumeSessionRequest. `sessionId` is the live ACP session id after * resume: equal to the requested id for native loads, or the freshly assigned id * for the fallback tier (the caller remaps external -> live). `mode` is "native" * (session/load|resume succeeded) or "fallback" (a new session was created and the * transcript-continuation preamble was armed for the next prompt). */ export type AcpSessionResumedResponse = { readonly sessionId: string; readonly mode: string; }; export declare function readAcpSessionResumedResponse(bc: bare.ByteCursor): AcpSessionResumedResponse; export declare function writeAcpSessionResumedResponse(bc: bare.ByteCursor, x: AcpSessionResumedResponse): void; export type AcpErrorResponse = { readonly code: string; readonly message: string; }; export declare function readAcpErrorResponse(bc: bare.ByteCursor): AcpErrorResponse; export declare function writeAcpErrorResponse(bc: bare.ByteCursor, x: AcpErrorResponse): void; /** * Browser RESUMABLE path: the create_session / session/prompt request (and each * AcpDeliverAgentOutputRequest that has not yet completed the handshake) returns * this, carrying the `processId` handle the kernel worker drives the interaction * with. The real result (AcpSessionCreatedResponse / AcpSessionRpcResponse) is * delivered as the response to the AcpDeliverAgentOutputRequest that completes it. */ export type AcpPendingResponse = { readonly processId: string; }; export declare function readAcpPendingResponse(bc: bare.ByteCursor): AcpPendingResponse; export declare function writeAcpPendingResponse(bc: bare.ByteCursor, x: AcpPendingResponse): void; export type AcpResponse = { readonly tag: "AcpOpenSessionResponse"; readonly val: AcpOpenSessionResponse; } | { readonly tag: "AcpGetDurableSessionResponse"; readonly val: AcpGetDurableSessionResponse; } | { readonly tag: "AcpListDurableSessionsResponse"; readonly val: AcpListDurableSessionsResponse; } | { readonly tag: "AcpDeleteSessionResponse"; readonly val: AcpDeleteSessionResponse; } | { readonly tag: "AcpUnloadSessionResponse"; readonly val: AcpUnloadSessionResponse; } | { readonly tag: "AcpPromptResponse"; readonly val: AcpPromptResponse; } | { readonly tag: "AcpCancelPromptResponse"; readonly val: AcpCancelPromptResponse; } | { readonly tag: "AcpRespondPermissionResponse"; readonly val: AcpRespondPermissionResponse; } | { readonly tag: "AcpHistoryPageResponse"; readonly val: AcpHistoryPageResponse; } | { readonly tag: "AcpSessionConfigResponse"; readonly val: AcpSessionConfigResponse; } | { readonly tag: "AcpSessionCapabilitiesResponse"; readonly val: AcpSessionCapabilitiesResponse; } | { readonly tag: "AcpSessionAgentInfoResponse"; readonly val: AcpSessionAgentInfoResponse; } | { readonly tag: "AcpSessionCreatedResponse"; readonly val: AcpSessionCreatedResponse; } | { readonly tag: "AcpSessionRpcResponse"; readonly val: AcpSessionRpcResponse; } | { readonly tag: "AcpSessionStateResponse"; readonly val: AcpSessionStateResponse; } | { readonly tag: "AcpSessionClosedResponse"; readonly val: AcpSessionClosedResponse; } | { readonly tag: "AcpSessionResumedResponse"; readonly val: AcpSessionResumedResponse; } | { readonly tag: "AcpErrorResponse"; readonly val: AcpErrorResponse; } | { readonly tag: "AcpPendingResponse"; readonly val: AcpPendingResponse; } | { readonly tag: "AcpListAgentsResponse"; readonly val: AcpListAgentsResponse; }; export declare function readAcpResponse(bc: bare.ByteCursor): AcpResponse; export declare function writeAcpResponse(bc: bare.ByteCursor, x: AcpResponse): void; export declare function encodeAcpResponse(x: AcpResponse, config?: Partial): Uint8Array; export declare function decodeAcpResponse(bytes: Uint8Array): AcpResponse; /** * Live delivery uses the identical durable union/history envelope. Consumers * reconnect by subscribing, fetching after their last sequence, then * deduplicating by (sessionId, sequence); there is no second replay protocol. */ export type AcpDurableSessionEvent = { readonly sessionId: string; readonly sequence: u64; readonly timestamp: string; readonly event: AcpDurableEvent; }; export declare function readAcpDurableSessionEvent(bc: bare.ByteCursor): AcpDurableSessionEvent; export declare function writeAcpDurableSessionEvent(bc: bare.ByteCursor, x: AcpDurableSessionEvent): void; /** * Ephemeral entries are live-only ACP agent_message_chunk or * agent_thought_chunk updates. They are never persisted or sequenced; the * durable completed message is authoritative after reconnect. */ export type AcpEphemeralSessionUpdateEvent = { readonly sessionId: string; readonly afterSequence: u64; readonly update: JsonUtf8; }; export declare function readAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor): AcpEphemeralSessionUpdateEvent; export declare function writeAcpEphemeralSessionUpdateEvent(bc: bare.ByteCursor, x: AcpEphemeralSessionUpdateEvent): void; /** * Legacy browser-reference live event. Native durable clients ignore it and * consume AcpDurableSessionEvent/AcpEphemeralSessionUpdateEvent instead. */ export type AcpSessionEvent = { readonly sessionId: string; readonly notification: JsonUtf8; }; export declare function readAcpSessionEvent(bc: bare.ByteCursor): AcpSessionEvent; export declare function writeAcpSessionEvent(bc: bare.ByteCursor, x: AcpSessionEvent): void; export type AcpAgentStderrEvent = { readonly sessionId: string; readonly agentType: string; readonly processId: string; readonly chunk: ArrayBuffer; }; export declare function readAcpAgentStderrEvent(bc: bare.ByteCursor): AcpAgentStderrEvent; export declare function writeAcpAgentStderrEvent(bc: bare.ByteCursor, x: AcpAgentStderrEvent): void; /** * Emitted when the ACP adapter process exits unexpectedly — a crash from the * host's perspective (any spontaneous exit, including code 0). * `restart` is "not_attempted": the sidecar never respawns an adapter or * replays an interrupted request implicitly. `restartCount` and `maxRestarts` * are therefore both zero. Explicit session restoration is a separate caller * operation. * `exitCode` is absent when the exit was observed indirectly (e.g. a write to * the adapter's stdin failed because the process was already gone). * `pid` is the host pid reported when the adapter process was launched. */ export type AcpAgentExitedEvent = { readonly sessionId: string; readonly agentType: string; readonly processId: string; readonly pid: u32 | null; readonly exitCode: i32 | null; readonly restart: string; readonly restartCount: u32; readonly maxRestarts: u32; }; export declare function readAcpAgentExitedEvent(bc: bare.ByteCursor): AcpAgentExitedEvent; export declare function writeAcpAgentExitedEvent(bc: bare.ByteCursor, x: AcpAgentExitedEvent): void; export type AcpEvent = { readonly tag: "AcpDurableSessionEvent"; readonly val: AcpDurableSessionEvent; } | { readonly tag: "AcpEphemeralSessionUpdateEvent"; readonly val: AcpEphemeralSessionUpdateEvent; } | { readonly tag: "AcpSessionEvent"; readonly val: AcpSessionEvent; } | { readonly tag: "AcpAgentStderrEvent"; readonly val: AcpAgentStderrEvent; } | { readonly tag: "AcpAgentExitedEvent"; readonly val: AcpAgentExitedEvent; }; export declare function readAcpEvent(bc: bare.ByteCursor): AcpEvent; export declare function writeAcpEvent(bc: bare.ByteCursor, x: AcpEvent): void; export declare function encodeAcpEvent(x: AcpEvent, config?: Partial): Uint8Array; export declare function decodeAcpEvent(bytes: Uint8Array): AcpEvent; export type AcpHostRequestCallback = { readonly sessionId: string; readonly request: JsonUtf8; }; export declare function readAcpHostRequestCallback(bc: bare.ByteCursor): AcpHostRequestCallback; export declare function writeAcpHostRequestCallback(bc: bare.ByteCursor, x: AcpHostRequestCallback): void; export type AcpCallback = { readonly tag: "AcpHostRequestCallback"; readonly val: AcpHostRequestCallback; }; export declare function readAcpCallback(bc: bare.ByteCursor): AcpCallback; export declare function writeAcpCallback(bc: bare.ByteCursor, x: AcpCallback): void; export declare function encodeAcpCallback(x: AcpCallback, config?: Partial): Uint8Array; export declare function decodeAcpCallback(bytes: Uint8Array): AcpCallback; export type AcpHostRequestCallbackResponse = { readonly response: JsonUtf8 | null; }; export declare function readAcpHostRequestCallbackResponse(bc: bare.ByteCursor): AcpHostRequestCallbackResponse; export declare function writeAcpHostRequestCallbackResponse(bc: bare.ByteCursor, x: AcpHostRequestCallbackResponse): void; export type AcpCallbackResponse = { readonly tag: "AcpHostRequestCallbackResponse"; readonly val: AcpHostRequestCallbackResponse; }; export declare function readAcpCallbackResponse(bc: bare.ByteCursor): AcpCallbackResponse; export declare function writeAcpCallbackResponse(bc: bare.ByteCursor, x: AcpCallbackResponse): void; export declare function encodeAcpCallbackResponse(x: AcpCallbackResponse, config?: Partial): Uint8Array; export declare function decodeAcpCallbackResponse(bytes: Uint8Array): AcpCallbackResponse;