/** * @enclave-vm/types - Zod schemas * * Runtime validation schemas for all protocol types. * These schemas are used for validating incoming messages from untrusted sources. */ import { z } from 'zod'; /** * Protocol version schema (accepts v1 and v2). */ export declare const ProtocolVersionSchema: z.ZodUnion, z.ZodLiteral<1>]>; /** * Session ID schema. */ export declare const SessionIdSchema: z.ZodString; /** * Call ID schema. */ export declare const CallIdSchema: z.ZodString; /** * Reference ID schema. */ export declare const RefIdSchema: z.ZodString; /** * Log level schema. */ export declare const LogLevelSchema: z.ZodEnum<{ debug: "debug"; info: "info"; warn: "warn"; error: "error"; }>; /** * Session state schema. */ export declare const SessionStateSchema: z.ZodEnum<{ starting: "starting"; running: "running"; waiting_for_tool: "waiting_for_tool"; completed: "completed"; cancelled: "cancelled"; failed: "failed"; }>; /** * Error info schema. */ export declare const ErrorInfoSchema: z.ZodObject<{ message: z.ZodString; code: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>; /** * Reference token schema. */ export declare const RefTokenSchema: z.ZodObject<{ $ref: z.ZodObject<{ id: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; /** * Session limits schema. */ export declare const SessionLimitsSchema: z.ZodObject<{ sessionTtlMs: z.ZodOptional; maxToolCalls: z.ZodOptional; maxStdoutBytes: z.ZodOptional; maxToolResultBytes: z.ZodOptional; toolTimeoutMs: z.ZodOptional; heartbeatIntervalMs: z.ZodOptional; deadlineMs: z.ZodOptional; perToolDeadlineMs: z.ZodOptional; cancelOnFirstError: z.ZodOptional; }, z.core.$strip>; /** * Tool config schema. */ export declare const ToolConfigSchema: z.ZodObject<{ timeout: z.ZodOptional; retryable: z.ZodOptional; maxRetries: z.ZodOptional; runtimeReadable: z.ZodOptional; }, z.core.$strip>; /** * Base event schema (common fields). */ export declare const BaseEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>; /** * Encryption config schema. */ export declare const EncryptionConfigSchema: z.ZodObject<{ enabled: z.ZodBoolean; keyId: z.ZodOptional; }, z.core.$strip>; /** * Session init payload schema. */ export declare const SessionInitPayloadSchema: z.ZodObject<{ cancelUrl: z.ZodString; expiresAt: z.ZodString; encryption: z.ZodObject<{ enabled: z.ZodBoolean; keyId: z.ZodOptional; }, z.core.$strip>; replayUrl: z.ZodOptional; }, z.core.$strip>; /** * Stdout payload schema. */ export declare const StdoutPayloadSchema: z.ZodObject<{ chunk: z.ZodString; }, z.core.$strip>; /** * Log payload schema. */ export declare const LogPayloadSchema: z.ZodObject<{ level: z.ZodEnum<{ debug: "debug"; info: "info"; warn: "warn"; error: "error"; }>; message: z.ZodString; data: z.ZodOptional>; }, z.core.$strip>; /** * Tool call payload schema. */ export declare const ToolCallPayloadSchema: z.ZodObject<{ callId: z.ZodString; toolName: z.ZodString; args: z.ZodUnknown; }, z.core.$strip>; /** * Tool result applied payload schema. */ export declare const ToolResultAppliedPayloadSchema: z.ZodObject<{ callId: z.ZodString; }, z.core.$strip>; /** * Session stats schema. */ export declare const SessionStatsSchema: z.ZodObject<{ durationMs: z.ZodNumber; toolCallCount: z.ZodNumber; stdoutBytes: z.ZodNumber; }, z.core.$strip>; /** * Error detail schema. */ export declare const ErrorDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"retry_info">; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">; /** * Error payload schema (rich error model). */ export declare const ErrorPayloadSchema: z.ZodObject<{ code: z.ZodString; message: z.ZodString; path: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>; /** * Final payload schema. */ export declare const FinalPayloadSchema: z.ZodObject<{ ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; errors: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>>; stats: z.ZodOptional>; }, z.core.$strip>; /** * Heartbeat payload schema. */ export declare const HeartbeatPayloadSchema: z.ZodObject<{ ts: z.ZodString; }, z.core.$strip>; /** * Error event payload schema. */ export declare const ErrorEventPayloadSchema: z.ZodObject<{ message: z.ZodString; code: z.ZodOptional; recoverable: z.ZodOptional; }, z.core.$strip>; /** * Session init event schema. */ export declare const SessionInitEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"session_init">; payload: z.ZodObject<{ cancelUrl: z.ZodString; expiresAt: z.ZodString; encryption: z.ZodObject<{ enabled: z.ZodBoolean; keyId: z.ZodOptional; }, z.core.$strip>; replayUrl: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; /** * Stdout event schema. */ export declare const StdoutEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"stdout">; payload: z.ZodObject<{ chunk: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; /** * Log event schema. */ export declare const LogEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"log">; payload: z.ZodObject<{ level: z.ZodEnum<{ debug: "debug"; info: "info"; warn: "warn"; error: "error"; }>; message: z.ZodString; data: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>; /** * Tool call event schema. */ export declare const ToolCallEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_call">; payload: z.ZodObject<{ callId: z.ZodString; toolName: z.ZodString; args: z.ZodUnknown; }, z.core.$strip>; }, z.core.$strip>; /** * Tool result applied event schema. */ export declare const ToolResultAppliedEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_result_applied">; payload: z.ZodObject<{ callId: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; /** * Final event schema. */ export declare const FinalEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"final">; payload: z.ZodObject<{ ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; errors: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>>; stats: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>; /** * Heartbeat event schema. */ export declare const HeartbeatEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"heartbeat">; payload: z.ZodObject<{ ts: z.ZodString; }, z.core.$strip>; }, z.core.$strip>; /** * Error event schema. */ export declare const ErrorEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"error">; payload: z.ZodObject<{ message: z.ZodString; code: z.ZodOptional; recoverable: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; /** * Partial result payload schema. */ export declare const PartialResultPayloadSchema: z.ZodObject<{ path: z.ZodArray; data: z.ZodOptional; error: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>; hasNext: z.ZodBoolean; }, z.core.$strip>; /** * Partial result event schema. */ export declare const PartialResultEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"partial_result">; payload: z.ZodObject<{ path: z.ZodArray; data: z.ZodOptional; error: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>; hasNext: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>; /** * Tool progress phase schema. */ export declare const ToolProgressPhaseSchema: z.ZodEnum<{ connecting: "connecting"; sending: "sending"; receiving: "receiving"; processing: "processing"; }>; /** * Tool progress payload schema. */ export declare const ToolProgressPayloadSchema: z.ZodObject<{ callId: z.ZodString; phase: z.ZodEnum<{ connecting: "connecting"; sending: "sending"; receiving: "receiving"; processing: "processing"; }>; bytesReceived: z.ZodOptional; totalBytes: z.ZodOptional; elapsedMs: z.ZodNumber; }, z.core.$strip>; /** * Tool progress event schema. */ export declare const ToolProgressEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_progress">; payload: z.ZodObject<{ callId: z.ZodString; phase: z.ZodEnum<{ connecting: "connecting"; sending: "sending"; receiving: "receiving"; processing: "processing"; }>; bytesReceived: z.ZodOptional; totalBytes: z.ZodOptional; elapsedMs: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; /** * Deadline exceeded payload schema. */ export declare const DeadlineExceededPayloadSchema: z.ZodObject<{ elapsedMs: z.ZodNumber; budgetMs: z.ZodNumber; }, z.core.$strip>; /** * Deadline exceeded event schema. */ export declare const DeadlineExceededEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"deadline_exceeded">; payload: z.ZodObject<{ elapsedMs: z.ZodNumber; budgetMs: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; /** * Catalog changed payload schema. */ export declare const CatalogChangedPayloadSchema: z.ZodObject<{ version: z.ZodString; addedActions: z.ZodArray; removedActions: z.ZodArray; }, z.core.$strip>; /** * Catalog changed event schema. */ export declare const CatalogChangedEventSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"catalog_changed">; payload: z.ZodObject<{ version: z.ZodString; addedActions: z.ZodArray; removedActions: z.ZodArray; }, z.core.$strip>; }, z.core.$strip>; /** * Stream event union schema. */ export declare const StreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"session_init">; payload: z.ZodObject<{ cancelUrl: z.ZodString; expiresAt: z.ZodString; encryption: z.ZodObject<{ enabled: z.ZodBoolean; keyId: z.ZodOptional; }, z.core.$strip>; replayUrl: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"stdout">; payload: z.ZodObject<{ chunk: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"log">; payload: z.ZodObject<{ level: z.ZodEnum<{ debug: "debug"; info: "info"; warn: "warn"; error: "error"; }>; message: z.ZodString; data: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_call">; payload: z.ZodObject<{ callId: z.ZodString; toolName: z.ZodString; args: z.ZodUnknown; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_result_applied">; payload: z.ZodObject<{ callId: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"final">; payload: z.ZodObject<{ ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; errors: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>>; stats: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"heartbeat">; payload: z.ZodObject<{ ts: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"error">; payload: z.ZodObject<{ message: z.ZodString; code: z.ZodOptional; recoverable: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"partial_result">; payload: z.ZodObject<{ path: z.ZodArray; data: z.ZodOptional; error: z.ZodOptional>; details: z.ZodOptional; retryDelayMs: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"upstream_info">; statusCode: z.ZodNumber; url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"validation_info">; field: z.ZodString; reason: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"quota_info">; limit: z.ZodNumber; used: z.ZodNumber; }, z.core.$strip>], "type">>>; }, z.core.$strip>>; hasNext: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"tool_progress">; payload: z.ZodObject<{ callId: z.ZodString; phase: z.ZodEnum<{ connecting: "connecting"; sending: "sending"; receiving: "receiving"; processing: "processing"; }>; bytesReceived: z.ZodOptional; totalBytes: z.ZodOptional; elapsedMs: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"deadline_exceeded">; payload: z.ZodObject<{ elapsedMs: z.ZodNumber; budgetMs: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"catalog_changed">; payload: z.ZodObject<{ version: z.ZodString; addedActions: z.ZodArray; removedActions: z.ZodArray; }, z.core.$strip>; }, z.core.$strip>], "type">; /** * Supported curve schema. */ export declare const SupportedCurveSchema: z.ZodEnum<{ "P-256": "P-256"; }>; /** * Encryption algorithm schema. */ export declare const EncryptionAlgorithmSchema: z.ZodEnum<{ "AES-GCM-256": "AES-GCM-256"; }>; /** * Key derivation schema. */ export declare const KeyDerivationSchema: z.ZodEnum<{ "HKDF-SHA-256": "HKDF-SHA-256"; }>; /** * Encryption mode schema. */ export declare const EncryptionModeSchema: z.ZodEnum<{ disabled: "disabled"; optional: "optional"; required: "required"; }>; /** * Encrypted envelope payload schema. */ export declare const EncryptedEnvelopePayloadSchema: z.ZodObject<{ kid: z.ZodString; nonceB64: z.ZodString; ciphertextB64: z.ZodString; tagB64: z.ZodOptional; }, z.core.$strip>; /** * Encrypted envelope schema. */ export declare const EncryptedEnvelopeSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; seq: z.ZodNumber; type: z.ZodLiteral<"enc">; payload: z.ZodObject<{ kid: z.ZodString; nonceB64: z.ZodString; ciphertextB64: z.ZodString; tagB64: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; /** * Client hello schema. */ export declare const ClientHelloSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; clientEphemeralPubKeyB64: z.ZodString; curve: z.ZodEnum<{ "P-256": "P-256"; }>; supportedAlgorithms: z.ZodArray>; }, z.core.$strip>; /** * Server hello schema. */ export declare const ServerHelloSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; serverEphemeralPubKeyB64: z.ZodString; curve: z.ZodEnum<{ "P-256": "P-256"; }>; selectedAlgorithm: z.ZodEnum<{ "AES-GCM-256": "AES-GCM-256"; }>; kdf: z.ZodEnum<{ "HKDF-SHA-256": "HKDF-SHA-256"; }>; keyId: z.ZodString; signatureB64: z.ZodOptional; }, z.core.$strip>; /** * Encryption request schema. */ export declare const EncryptionRequestSchema: z.ZodObject<{ mode: z.ZodEnum<{ disabled: "disabled"; optional: "optional"; required: "required"; }>; clientHello: z.ZodOptional, z.ZodLiteral<1>]>; clientEphemeralPubKeyB64: z.ZodString; curve: z.ZodEnum<{ "P-256": "P-256"; }>; supportedAlgorithms: z.ZodArray>; }, z.core.$strip>>; }, z.core.$strip>; /** * Tool result submit payload schema. */ export declare const ToolResultSubmitPayloadSchema: z.ZodObject<{ callId: z.ZodString; ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** * Tool result submit message schema. */ export declare const ToolResultSubmitMessageSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; type: z.ZodLiteral<"tool_result_submit">; payload: z.ZodObject<{ callId: z.ZodString; ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>; /** * Cancel payload schema. */ export declare const CancelPayloadSchema: z.ZodObject<{ reason: z.ZodOptional; }, z.core.$strip>; /** * Cancel message schema. */ export declare const CancelMessageSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; type: z.ZodLiteral<"cancel">; payload: z.ZodObject<{ reason: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; /** * Runtime channel message union schema. */ export declare const RuntimeChannelMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; type: z.ZodLiteral<"tool_result_submit">; payload: z.ZodObject<{ callId: z.ZodString; ok: z.ZodBoolean; result: z.ZodOptional; error: z.ZodOptional; stack: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; sessionId: z.ZodString; type: z.ZodLiteral<"cancel">; payload: z.ZodObject<{ reason: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>], "type">; /** * Session creation request schema. */ export declare const CreateSessionRequestSchema: z.ZodObject<{ protocolVersion: z.ZodUnion, z.ZodLiteral<1>]>; code: z.ZodString; limits: z.ZodOptional; maxToolCalls: z.ZodOptional; maxStdoutBytes: z.ZodOptional; maxToolResultBytes: z.ZodOptional; toolTimeoutMs: z.ZodOptional; heartbeatIntervalMs: z.ZodOptional; deadlineMs: z.ZodOptional; perToolDeadlineMs: z.ZodOptional; cancelOnFirstError: z.ZodOptional; }, z.core.$strip>>; encryption: z.ZodOptional; clientHello: z.ZodOptional, z.ZodLiteral<1>]>; clientEphemeralPubKeyB64: z.ZodString; curve: z.ZodEnum<{ "P-256": "P-256"; }>; supportedAlgorithms: z.ZodArray>; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; /** * Parse and validate a stream event. */ export declare function parseStreamEvent(data: unknown): z.ZodSafeParseResult<{ protocolVersion: 2 | 1; sessionId: string; seq: number; type: "session_init"; payload: { cancelUrl: string; expiresAt: string; encryption: { enabled: boolean; keyId?: string | undefined; }; replayUrl?: string | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "stdout"; payload: { chunk: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "log"; payload: { level: "debug" | "info" | "warn" | "error"; message: string; data?: Record | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_call"; payload: { callId: string; toolName: string; args: unknown; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_result_applied"; payload: { callId: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "final"; payload: { ok: boolean; result?: unknown; error?: { message: string; code?: string | undefined; stack?: string | undefined; } | undefined; errors?: { code: string; message: string; path?: string[] | undefined; details?: ({ type: "retry_info"; retryDelayMs: number; } | { type: "upstream_info"; statusCode: number; url: string; } | { type: "validation_info"; field: string; reason: string; } | { type: "quota_info"; limit: number; used: number; })[] | undefined; }[] | undefined; stats?: { durationMs: number; toolCallCount: number; stdoutBytes: number; } | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "heartbeat"; payload: { ts: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "error"; payload: { message: string; code?: string | undefined; recoverable?: boolean | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "partial_result"; payload: { path: string[]; hasNext: boolean; data?: unknown; error?: { code: string; message: string; path?: string[] | undefined; details?: ({ type: "retry_info"; retryDelayMs: number; } | { type: "upstream_info"; statusCode: number; url: string; } | { type: "validation_info"; field: string; reason: string; } | { type: "quota_info"; limit: number; used: number; })[] | undefined; } | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_progress"; payload: { callId: string; phase: "connecting" | "sending" | "receiving" | "processing"; elapsedMs: number; bytesReceived?: number | undefined; totalBytes?: number | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "deadline_exceeded"; payload: { elapsedMs: number; budgetMs: number; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "catalog_changed"; payload: { version: string; addedActions: string[]; removedActions: string[]; }; }>; /** * Parse and validate an encrypted envelope. */ export declare function parseEncryptedEnvelope(data: unknown): z.ZodSafeParseResult<{ protocolVersion: 2 | 1; sessionId: string; seq: number; type: "enc"; payload: { kid: string; nonceB64: string; ciphertextB64: string; tagB64?: string | undefined; }; }>; /** * Parse and validate a runtime channel message. */ export declare function parseRuntimeChannelMessage(data: unknown): z.ZodSafeParseResult<{ protocolVersion: 2 | 1; sessionId: string; type: "tool_result_submit"; payload: { callId: string; ok: boolean; result?: unknown; error?: { message: string; code?: string | undefined; stack?: string | undefined; } | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; type: "cancel"; payload: { reason?: string | undefined; }; }>; /** * Parse and validate a session creation request. */ export declare function parseCreateSessionRequest(data: unknown): z.ZodSafeParseResult<{ protocolVersion: 2 | 1; code: string; limits?: { sessionTtlMs?: number | undefined; maxToolCalls?: number | undefined; maxStdoutBytes?: number | undefined; maxToolResultBytes?: number | undefined; toolTimeoutMs?: number | undefined; heartbeatIntervalMs?: number | undefined; deadlineMs?: number | undefined; perToolDeadlineMs?: number | undefined; cancelOnFirstError?: boolean | undefined; } | undefined; encryption?: { mode: "disabled" | "optional" | "required"; clientHello?: { protocolVersion: 2 | 1; clientEphemeralPubKeyB64: string; curve: "P-256"; supportedAlgorithms: "AES-GCM-256"[]; } | undefined; } | undefined; }>; /** * Parse either a stream event or encrypted envelope. */ export declare function parseStreamEventOrEncrypted(data: unknown): z.ZodSafeParseResult<{ protocolVersion: 2 | 1; sessionId: string; seq: number; type: "session_init"; payload: { cancelUrl: string; expiresAt: string; encryption: { enabled: boolean; keyId?: string | undefined; }; replayUrl?: string | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "stdout"; payload: { chunk: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "log"; payload: { level: "debug" | "info" | "warn" | "error"; message: string; data?: Record | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_call"; payload: { callId: string; toolName: string; args: unknown; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_result_applied"; payload: { callId: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "final"; payload: { ok: boolean; result?: unknown; error?: { message: string; code?: string | undefined; stack?: string | undefined; } | undefined; errors?: { code: string; message: string; path?: string[] | undefined; details?: ({ type: "retry_info"; retryDelayMs: number; } | { type: "upstream_info"; statusCode: number; url: string; } | { type: "validation_info"; field: string; reason: string; } | { type: "quota_info"; limit: number; used: number; })[] | undefined; }[] | undefined; stats?: { durationMs: number; toolCallCount: number; stdoutBytes: number; } | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "heartbeat"; payload: { ts: string; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "error"; payload: { message: string; code?: string | undefined; recoverable?: boolean | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "partial_result"; payload: { path: string[]; hasNext: boolean; data?: unknown; error?: { code: string; message: string; path?: string[] | undefined; details?: ({ type: "retry_info"; retryDelayMs: number; } | { type: "upstream_info"; statusCode: number; url: string; } | { type: "validation_info"; field: string; reason: string; } | { type: "quota_info"; limit: number; used: number; })[] | undefined; } | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "tool_progress"; payload: { callId: string; phase: "connecting" | "sending" | "receiving" | "processing"; elapsedMs: number; bytesReceived?: number | undefined; totalBytes?: number | undefined; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "deadline_exceeded"; payload: { elapsedMs: number; budgetMs: number; }; } | { protocolVersion: 2 | 1; sessionId: string; seq: number; type: "catalog_changed"; payload: { version: string; addedActions: string[]; removedActions: string[]; }; }> | z.ZodSafeParseResult<{ protocolVersion: 2 | 1; sessionId: string; seq: number; type: "enc"; payload: { kid: string; nonceB64: string; ciphertextB64: string; tagB64?: string | undefined; }; }>; export type ParsedStreamEvent = z.infer; export type ParsedEncryptedEnvelope = z.infer; export type ParsedRuntimeChannelMessage = z.infer; export type ParsedCreateSessionRequest = z.infer;