/** * TypeBox JSON Schema definitions for all 67 AgentEvent types. * * Mirrors the TypeScript interfaces in events.ts and events-control.ts exactly. * Every field, optional flag, and literal discriminant is preserved. * * @module */ import { type TObject, type TSchema } from '@sinclair/typebox'; /** Machine-readable error codes defined by agent-mux (from types.ts). */ export declare const ErrorCodeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"CAPABILITY_ERROR">, import("@sinclair/typebox").TLiteral<"VALIDATION_ERROR">, import("@sinclair/typebox").TLiteral<"AUTH_ERROR">, import("@sinclair/typebox").TLiteral<"AGENT_NOT_FOUND">, import("@sinclair/typebox").TLiteral<"AGENT_NOT_INSTALLED">, import("@sinclair/typebox").TLiteral<"AGENT_CRASH">, import("@sinclair/typebox").TLiteral<"SPAWN_ERROR">, import("@sinclair/typebox").TLiteral<"TIMEOUT">, import("@sinclair/typebox").TLiteral<"INACTIVITY_TIMEOUT">, import("@sinclair/typebox").TLiteral<"PARSE_ERROR">, import("@sinclair/typebox").TLiteral<"CONFIG_ERROR">, import("@sinclair/typebox").TLiteral<"CONFIG_LOCK_ERROR">, import("@sinclair/typebox").TLiteral<"SESSION_NOT_FOUND">, import("@sinclair/typebox").TLiteral<"PROFILE_NOT_FOUND">, import("@sinclair/typebox").TLiteral<"PLUGIN_ERROR">, import("@sinclair/typebox").TLiteral<"RATE_LIMITED">, import("@sinclair/typebox").TLiteral<"CONTEXT_EXCEEDED">, import("@sinclair/typebox").TLiteral<"ABORTED">, import("@sinclair/typebox").TLiteral<"RUN_NOT_ACTIVE">, import("@sinclair/typebox").TLiteral<"STDIN_NOT_AVAILABLE">, import("@sinclair/typebox").TLiteral<"NO_PENDING_INTERACTION">, import("@sinclair/typebox").TLiteral<"INTERACTION_NOT_FOUND">, import("@sinclair/typebox").TLiteral<"INVALID_STATE_TRANSITION">, import("@sinclair/typebox").TLiteral<"PTY_NOT_AVAILABLE">, import("@sinclair/typebox").TLiteral<"UNKNOWN_AGENT">, import("@sinclair/typebox").TLiteral<"INTERNAL">]>; /** Aggregated cost data for a single run (from types.ts). */ export declare const CostRecordSchema: TObject<{ totalUsd: import("@sinclair/typebox").TNumber; inputTokens: import("@sinclair/typebox").TNumber; outputTokens: import("@sinclair/typebox").TNumber; thinkingTokens: import("@sinclair/typebox").TOptional; cachedTokens: import("@sinclair/typebox").TOptional; cacheCreationTokens: import("@sinclair/typebox").TOptional; cacheReadTokens: import("@sinclair/typebox").TOptional; }>; /** The base shape shared by every event. */ export declare const BaseEventSchema: TObject<{ type: import("@sinclair/typebox").TString; runId: import("@sinclair/typebox").TString; agent: import("@sinclair/typebox").TString; timestamp: import("@sinclair/typebox").TNumber; source: import("@sinclair/typebox").TOptional; raw: import("@sinclair/typebox").TOptional; }>; export declare const SessionStartEventSchema: TObject; export declare const SessionResumeEventSchema: TObject; export declare const SessionForkEventSchema: TObject; export declare const SessionCheckpointEventSchema: TObject; export declare const SessionEndEventSchema: TObject; export declare const TurnStartEventSchema: TObject; export declare const TurnEndEventSchema: TObject; export declare const StepStartEventSchema: TObject; export declare const StepEndEventSchema: TObject; export declare const MessageStartEventSchema: TObject; export declare const TextDeltaEventSchema: TObject; export declare const MessageStopEventSchema: TObject; export declare const ThinkingStartEventSchema: TObject; export declare const ThinkingDeltaEventSchema: TObject; export declare const ThinkingStopEventSchema: TObject; export declare const ToolCallStartEventSchema: TObject; export declare const ToolInputDeltaEventSchema: TObject; export declare const ToolCallReadyEventSchema: TObject; export declare const ToolResultEventSchema: TObject; export declare const ToolErrorEventSchema: TObject; export declare const FileReadEventSchema: TObject; export declare const FileWriteEventSchema: TObject; export declare const FileCreateEventSchema: TObject; export declare const FileDeleteEventSchema: TObject; export declare const FilePatchEventSchema: TObject; export declare const ShellStartEventSchema: TObject; export declare const ShellStdoutDeltaEventSchema: TObject; export declare const ShellStderrDeltaEventSchema: TObject; export declare const ShellExitEventSchema: TObject; export declare const McpToolCallStartEventSchema: TObject; export declare const McpToolResultEventSchema: TObject; export declare const McpToolErrorEventSchema: TObject; export declare const SubagentSpawnEventSchema: TObject; export declare const SubagentResultEventSchema: TObject; export declare const SubagentErrorEventSchema: TObject; export declare const PluginLoadedEventSchema: TObject; export declare const PluginInvokedEventSchema: TObject; export declare const PluginErrorEventSchema: TObject; export declare const SkillLoadedEventSchema: TObject; export declare const SkillInvokedEventSchema: TObject; export declare const AgentdocReadEventSchema: TObject; export declare const ImageOutputEventSchema: TObject; export declare const ImageInputAckEventSchema: TObject; export declare const CostEventSchema: TObject; export declare const TokenUsageEventSchema: TObject; export declare const InputRequiredEventSchema: TObject; export declare const ApprovalRequestEventSchema: TObject; export declare const ApprovalGrantedEventSchema: TObject; export declare const ApprovalDeniedEventSchema: TObject; export declare const RateLimitedEventSchema: TObject; export declare const ContextLimitWarningEventSchema: TObject; export declare const ContextCompactedEventSchema: TObject; export declare const RetryEventSchema: TObject; export declare const InterruptedEventSchema: TObject; export declare const AbortedEventSchema: TObject; export declare const PausedEventSchema: TObject; export declare const ResumedEventSchema: TObject; export declare const TimeoutEventSchema: TObject; export declare const TurnLimitEventSchema: TObject; export declare const StreamFallbackEventSchema: TObject; export declare const AuthErrorEventSchema: TObject; export declare const RateLimitErrorEventSchema: TObject; export declare const ContextExceededEventSchema: TObject; export declare const CrashEventSchema: TObject; export declare const ErrorEventSchema: TObject; export declare const DebugEventSchema: TObject; export declare const LogEventSchema: TObject; /** * Maps every event `type` discriminant string to its TypeBox schema. * Useful for runtime lookup and validation by event type. */ export declare const eventSchemaRegistry: Record; /** Total count of registered event schemas. */ export declare const EVENT_SCHEMA_COUNT: number; /** TypeBox union schema covering all 67 event types. */ export declare const AgentEventSchema: import("@sinclair/typebox").TUnion<[TSchema, ...TSchema[]]>; /** Result of validating an unknown value against the event schemas. */ export interface EventValidationResult { valid: boolean; eventType?: string; errors?: string[]; } /** * Validate an unknown value as an AgentEvent. * * First checks if the value has a `type` field that maps to a known schema, * then validates against that specific schema for precise error messages. * Falls back to validating against the full union if the type is unknown. */ export declare function validateEvent(event: unknown): EventValidationResult;