import { z } from 'zod'; export interface ApiRequestMessage { type: 'api_request'; correlationId: string; method: string; path: string; headers?: Record; body?: unknown; actor?: Actor; } export interface ApiResponseMessage { type: 'api_response'; correlationId: string; status: number; headers?: Record; body?: unknown; } export interface EventMessage { type: 'event'; event: string; data: unknown; timestamp: string; } export interface ConversationInputMessage { type: 'conversation'; conversationId: string; data: { action: 'message'; content: string; }; } export interface ConversationOutputMessage { type: 'conversation'; conversationId: string; data: { event: 'output' | 'tool_use' | 'tool_result' | 'complete' | 'error'; payload: unknown; timestamp: string; }; } export type ConversationMessage = ConversationInputMessage | ConversationOutputMessage; export interface HeartbeatMessage { type: 'heartbeat'; } export interface HandshakeMessage { type: 'handshake'; metadata: ClusterMetadata; activation?: Activation; } export interface ErrorMessage { type: 'error'; code: string; message: string; } export interface TunnelOpenMessage { type: 'tunnel_open'; tunnelId: string; target: string; } export interface TunnelOpenAckMessage { type: 'tunnel_open_ack'; tunnelId: string; status: 'ok' | 'error'; error?: string; } export interface TunnelDataMessage { type: 'tunnel_data'; tunnelId: string; data: string; } export interface TunnelCloseMessage { type: 'tunnel_close'; tunnelId: string; reason?: string; } export type RelayMessage = ApiRequestMessage | ApiResponseMessage | EventMessage | ConversationMessage | HeartbeatMessage | HandshakeMessage | ErrorMessage | TunnelOpenMessage | TunnelOpenAckMessage | TunnelDataMessage | TunnelCloseMessage; export interface GitRemote { name: string; url: string; } export interface ClusterMetadata { workers: number; activeWorkflows: number; channel: 'preview' | 'stable'; orchestratorVersion: string; gitRemotes: GitRemote[]; uptime: number; codeServerReady?: boolean; controlPlaneReady?: boolean; postActivationReady?: boolean; displayName?: string; clusterId?: string; } export declare const ActorSchema: z.ZodObject<{ userId: z.ZodString; sessionId: z.ZodOptional; }, "strip", z.ZodTypeAny, { userId: string; sessionId?: string | undefined; }, { userId: string; sessionId?: string | undefined; }>; export declare const ActivationSchema: z.ZodObject<{ code: z.ZodString; clusterApiKeyId: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; clusterApiKeyId?: string | undefined; }, { code: string; clusterApiKeyId?: string | undefined; }>; export type Actor = z.infer; export type Activation = z.infer; declare const GitRemoteSchema: z.ZodObject<{ name: z.ZodString; url: z.ZodString; }, "strip", z.ZodTypeAny, { name: string; url: string; }, { name: string; url: string; }>; declare const ClusterMetadataSchema: z.ZodObject<{ workers: z.ZodNumber; activeWorkflows: z.ZodNumber; channel: z.ZodEnum<["preview", "stable"]>; orchestratorVersion: z.ZodString; gitRemotes: z.ZodArray, "many">; uptime: z.ZodNumber; displayName: z.ZodOptional; clusterId: z.ZodOptional; }, "strip", z.ZodTypeAny, { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }, { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }>; export declare const EventMessageSchema: z.ZodObject<{ type: z.ZodLiteral<"event">; event: z.ZodString; data: z.ZodUnknown; timestamp: z.ZodString; }, "strip", z.ZodTypeAny, { type: "event"; event: string; timestamp: string; data?: unknown; }, { type: "event"; event: string; timestamp: string; data?: unknown; }>; export declare const RelayMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{ type: z.ZodLiteral<"api_request">; correlationId: z.ZodString; method: z.ZodString; path: z.ZodString; headers: z.ZodOptional>; body: z.ZodOptional; timestamp: z.ZodOptional; actor: z.ZodOptional; }, "strip", z.ZodTypeAny, { userId: string; sessionId?: string | undefined; }, { userId: string; sessionId?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { path: string; type: "api_request"; correlationId: string; method: string; headers?: Record | undefined; body?: unknown; timestamp?: string | undefined; actor?: { userId: string; sessionId?: string | undefined; } | undefined; }, { path: string; type: "api_request"; correlationId: string; method: string; headers?: Record | undefined; body?: unknown; timestamp?: string | undefined; actor?: { userId: string; sessionId?: string | undefined; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"api_response">; correlationId: z.ZodString; status: z.ZodNumber; headers: z.ZodOptional>; body: z.ZodOptional; timestamp: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "api_response"; status: number; correlationId: string; headers?: Record | undefined; body?: unknown; timestamp?: string | undefined; }, { type: "api_response"; status: number; correlationId: string; headers?: Record | undefined; body?: unknown; timestamp?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"event">; event: z.ZodString; data: z.ZodUnknown; timestamp: z.ZodString; }, "strip", z.ZodTypeAny, { type: "event"; event: string; timestamp: string; data?: unknown; }, { type: "event"; event: string; timestamp: string; data?: unknown; }>, z.ZodObject<{ type: z.ZodLiteral<"conversation">; conversationId: z.ZodString; data: z.ZodUnion<[z.ZodObject<{ action: z.ZodLiteral<"message">; content: z.ZodString; }, "strip", z.ZodTypeAny, { action: "message"; content: string; }, { action: "message"; content: string; }>, z.ZodObject<{ event: z.ZodEnum<["output", "tool_use", "tool_result", "complete", "error"]>; payload: z.ZodUnknown; timestamp: z.ZodString; }, "strip", z.ZodTypeAny, { event: "output" | "tool_use" | "tool_result" | "complete" | "error"; timestamp: string; payload?: unknown; }, { event: "output" | "tool_use" | "tool_result" | "complete" | "error"; timestamp: string; payload?: unknown; }>]>; }, "strip", z.ZodTypeAny, { type: "conversation"; data: { action: "message"; content: string; } | { event: "output" | "tool_use" | "tool_result" | "complete" | "error"; timestamp: string; payload?: unknown; }; conversationId: string; }, { type: "conversation"; data: { action: "message"; content: string; } | { event: "output" | "tool_use" | "tool_result" | "complete" | "error"; timestamp: string; payload?: unknown; }; conversationId: string; }>, z.ZodObject<{ type: z.ZodLiteral<"heartbeat">; }, "strip", z.ZodTypeAny, { type: "heartbeat"; }, { type: "heartbeat"; }>, z.ZodObject<{ type: z.ZodLiteral<"handshake">; metadata: z.ZodObject<{ workers: z.ZodNumber; activeWorkflows: z.ZodNumber; channel: z.ZodEnum<["preview", "stable"]>; orchestratorVersion: z.ZodString; gitRemotes: z.ZodArray, "many">; uptime: z.ZodNumber; displayName: z.ZodOptional; clusterId: z.ZodOptional; }, "strip", z.ZodTypeAny, { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }, { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }>; activation: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; clusterApiKeyId?: string | undefined; }, { code: string; clusterApiKeyId?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { type: "handshake"; metadata: { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }; activation?: { code: string; clusterApiKeyId?: string | undefined; } | undefined; }, { type: "handshake"; metadata: { workers: number; activeWorkflows: number; channel: "preview" | "stable"; orchestratorVersion: string; gitRemotes: { name: string; url: string; }[]; uptime: number; displayName?: string | undefined; clusterId?: string | undefined; }; activation?: { code: string; clusterApiKeyId?: string | undefined; } | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"error">; code: z.ZodString; message: z.ZodString; }, "strip", z.ZodTypeAny, { code: string; message: string; type: "error"; }, { code: string; message: string; type: "error"; }>, z.ZodObject<{ type: z.ZodLiteral<"tunnel_open">; tunnelId: z.ZodString; target: z.ZodString; }, "strip", z.ZodTypeAny, { target: string; type: "tunnel_open"; tunnelId: string; }, { target: string; type: "tunnel_open"; tunnelId: string; }>, z.ZodObject<{ type: z.ZodLiteral<"tunnel_open_ack">; tunnelId: z.ZodString; status: z.ZodEnum<["ok", "error"]>; error: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "tunnel_open_ack"; status: "error" | "ok"; tunnelId: string; error?: string | undefined; }, { type: "tunnel_open_ack"; status: "error" | "ok"; tunnelId: string; error?: string | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"tunnel_data">; tunnelId: z.ZodString; data: z.ZodString; }, "strip", z.ZodTypeAny, { type: "tunnel_data"; data: string; tunnelId: string; }, { type: "tunnel_data"; data: string; tunnelId: string; }>, z.ZodObject<{ type: z.ZodLiteral<"tunnel_close">; tunnelId: z.ZodString; reason: z.ZodOptional; }, "strip", z.ZodTypeAny, { type: "tunnel_close"; tunnelId: string; reason?: string | undefined; }, { type: "tunnel_close"; tunnelId: string; reason?: string | undefined; }>]>; export { ClusterMetadataSchema, GitRemoteSchema }; /** * Parse and validate an incoming relay message. * Returns the validated message or null if invalid. */ export declare function parseRelayMessage(data: unknown): RelayMessage | null; //# sourceMappingURL=messages.d.ts.map