/** * Frame Schema - Zod validation for Frame structures * * This module provides Zod schemas for Frame validation. * The canonical TypeScript types are in ./frame.ts * * Per AX-CONTRACT.md v0.1, ยง2.5: Frame Emission for Core Workflows * * @module shared/types */ import { z } from "zod"; /** * Capability tier enum - classifies task complexity */ export declare const CapabilityTierSchema: z.ZodEnum<{ senior: "senior"; mid: "mid"; junior: "junior"; }>; export type CapabilityTier = z.infer; /** * Task complexity metadata */ export declare const TaskComplexitySchema: z.ZodObject<{ tier: z.ZodEnum<{ senior: "senior"; mid: "mid"; junior: "junior"; }>; assignedModel: z.ZodOptional; escalated: z.ZodOptional; escalationReason: z.ZodOptional; retryCount: z.ZodOptional; }, z.core.$strip>; export type TaskComplexity = z.infer; /** * SpendMetadata schema - tracks LLM usage */ export declare const SpendMetadataSchema: z.ZodObject<{ prompts: z.ZodOptional; tokens_estimated: z.ZodOptional; }, z.core.$strip>; export type SpendMetadata = z.infer; /** * TurnCostComponent schema - Turn Cost components */ export declare const TurnCostComponentSchema: z.ZodObject<{ latency: z.ZodNumber; contextReset: z.ZodNumber; renegotiation: z.ZodNumber; tokenBloat: z.ZodNumber; attentionSwitch: z.ZodNumber; }, z.core.$strip>; export type TurnCostComponent = z.infer; /** * TurnCostWeights schema - Turn Cost weight configuration */ export declare const TurnCostWeightsSchema: z.ZodObject<{ lambda: z.ZodDefault; gamma: z.ZodDefault; rho: z.ZodDefault; tau: z.ZodDefault; alpha: z.ZodDefault; }, z.core.$strip>; export type TurnCostWeights = z.infer; /** * TurnCost schema - coordination cost tracking */ export declare const TurnCostSchema: z.ZodObject<{ components: z.ZodObject<{ latency: z.ZodNumber; contextReset: z.ZodNumber; renegotiation: z.ZodNumber; tokenBloat: z.ZodNumber; attentionSwitch: z.ZodNumber; }, z.core.$strip>; weights: z.ZodOptional; gamma: z.ZodDefault; rho: z.ZodDefault; tau: z.ZodDefault; alpha: z.ZodDefault; }, z.core.$strip>>; weightedScore: z.ZodOptional; sessionId: z.ZodOptional; timestamp: z.ZodOptional; }, z.core.$strip>; export type TurnCost = z.infer; /** * StatusSnapshot schema - current status and next action */ export declare const StatusSnapshotSchema: z.ZodObject<{ next_action: z.ZodString; blockers: z.ZodOptional>; merge_blockers: z.ZodOptional>; tests_failing: z.ZodOptional>; }, z.core.$strip>; export type StatusSnapshot = z.infer; /** * Frame schema v4 - the canonical shape for memory units * * @example * ```json * { * "id": "f-550e8400-e29b-41d4-a716-446655440000", * "timestamp": "2025-12-01T10:30:00Z", * "branch": "main", * "module_scope": ["memory/store"], * "summary_caption": "Fixed recall FTS5 hyphen handling", * "reference_point": "ax-002-recall-fix", * "status_snapshot": { * "next_action": "Test with compound queries" * }, * "keywords": ["recall", "FTS5", "search"] * } * ``` */ export declare const FrameSchema: z.ZodObject<{ id: z.ZodString; timestamp: z.ZodString; branch: z.ZodString; module_scope: z.ZodArray; summary_caption: z.ZodString; reference_point: z.ZodString; status_snapshot: z.ZodObject<{ next_action: z.ZodString; blockers: z.ZodOptional>; merge_blockers: z.ZodOptional>; tests_failing: z.ZodOptional>; }, z.core.$strip>; jira: z.ZodOptional; keywords: z.ZodOptional>; atlas_frame_id: z.ZodOptional; feature_flags: z.ZodOptional>; permissions: z.ZodOptional>; image_ids: z.ZodOptional>; runId: z.ZodOptional; planHash: z.ZodOptional; spend: z.ZodOptional; tokens_estimated: z.ZodOptional; }, z.core.$strip>>; userId: z.ZodOptional; executorRole: z.ZodOptional; toolCalls: z.ZodOptional>; guardrailProfile: z.ZodOptional; turnCost: z.ZodOptional; weights: z.ZodOptional; gamma: z.ZodDefault; rho: z.ZodDefault; tau: z.ZodDefault; alpha: z.ZodDefault; }, z.core.$strip>>; weightedScore: z.ZodOptional; sessionId: z.ZodOptional; timestamp: z.ZodOptional; }, z.core.$strip>>; capabilityTier: z.ZodOptional>; taskComplexity: z.ZodOptional; assignedModel: z.ZodOptional; escalated: z.ZodOptional; escalationReason: z.ZodOptional; retryCount: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; export type Frame = z.infer; /** * Frame schema version constant * v1: Initial schema (pre-0.4.0) * v2: Added runId, planHash, spend fields for execution provenance (0.4.0) * v3: Added executorRole, toolCalls, guardrailProfile for LexRunner (0.5.0) * v4: Added turnCost for governance Turn Cost measurement (2.0.0-alpha.1) * v5: Added superseded_by, merged_from for frame deduplication (2.1.x) */ export declare const FRAME_SCHEMA_VERSION = 5; /** * Validate a Frame using Zod schema * * @param value - Unknown value to validate * @returns true if valid Frame, false otherwise */ export declare function isFrame(value: unknown): value is Frame; /** * Parse and validate a Frame, throwing on error * * @param value - Unknown value to parse * @returns Validated Frame * @throws ZodError if validation fails */ export declare function parseFrame(value: unknown): Frame; /** * Parse a Frame safely, returning result object * * @param value - Unknown value to parse * @returns SafeParseResult with success/data or error */ export declare function safeParseFrame(value: unknown): z.ZodSafeParseResult<{ id: string; timestamp: string; branch: string; module_scope: string[]; summary_caption: string; reference_point: string; status_snapshot: { next_action: string; blockers?: string[] | undefined; merge_blockers?: string[] | undefined; tests_failing?: string[] | undefined; }; jira?: string | undefined; keywords?: string[] | undefined; atlas_frame_id?: string | undefined; feature_flags?: string[] | undefined; permissions?: string[] | undefined; image_ids?: string[] | undefined; runId?: string | undefined; planHash?: string | undefined; spend?: { prompts?: number | undefined; tokens_estimated?: number | undefined; } | undefined; userId?: string | undefined; executorRole?: string | undefined; toolCalls?: string[] | undefined; guardrailProfile?: string | undefined; turnCost?: { components: { latency: number; contextReset: number; renegotiation: number; tokenBloat: number; attentionSwitch: number; }; weights?: { lambda: number; gamma: number; rho: number; tau: number; alpha: number; } | undefined; weightedScore?: number | undefined; sessionId?: string | undefined; timestamp?: string | undefined; } | undefined; capabilityTier?: "senior" | "mid" | "junior" | undefined; taskComplexity?: { tier: "senior" | "mid" | "junior"; assignedModel?: string | undefined; escalated?: boolean | undefined; escalationReason?: string | undefined; retryCount?: number | undefined; } | undefined; }>; /** * Create a minimal valid Frame for runner emission * * @param params - Required frame parameters * @returns Validated Frame * * @example * ```typescript * const frame = createFrame({ * branch: 'main', * module_scope: ['PR-101', 'PR-102'], * summary_caption: 'Merged 2 PRs via merge-weave', * reference_point: 'merge-weave-2025-12-01', * next_action: 'Run e2e tests' * }); * ``` */ export declare function createFrame(params: { branch: string; module_scope: string[]; summary_caption: string; reference_point: string; next_action: string; keywords?: string[]; runId?: string; executorRole?: string; toolCalls?: string[]; spend?: SpendMetadata; }): Frame;