/** * Receipt Schema - Zod validation for Receipt structures * * Receipts provide audit trail and attribution for all task outcomes. * Per governance requirements, a receipt is emitted for EVERY task regardless of outcome. * * @module shared/types */ import { z } from "zod"; /** * Receipt status enum */ export declare const ReceiptStatusSchema: z.ZodEnum<{ success: "success"; failure: "failure"; partial: "partial"; blocked: "blocked"; }>; export type ReceiptStatus = z.infer; /** * Executor type enum */ export declare const ExecutorTypeSchema: z.ZodEnum<{ human: "human"; agent: "agent"; tool: "tool"; }>; export type ExecutorType = z.infer; /** * Capability tier enum (matches Frame schema) */ export declare const CapabilityTierSchema: z.ZodEnum<{ senior: "senior"; mid: "mid"; junior: "junior"; }>; export type CapabilityTier = z.infer; /** * Executor information */ export declare const ExecutorSchema: z.ZodObject<{ type: z.ZodEnum<{ human: "human"; agent: "agent"; tool: "tool"; }>; id: z.ZodString; version: z.ZodOptional; }, z.core.$strip>; export type Executor = z.infer; /** * Task information */ export declare const TaskSchema: z.ZodObject<{ id: z.ZodString; description: z.ZodString; capabilityTier: z.ZodOptional>; }, z.core.$strip>; export type Task = z.infer; /** * Outcome information */ export declare const OutcomeSchema: z.ZodObject<{ result: z.ZodOptional; error: z.ZodOptional; blockers: z.ZodOptional>; artifacts: z.ZodOptional>; }, z.core.$strip>; export type Outcome = z.infer; /** * Metadata information */ export declare const MetadataSchema: z.ZodObject<{ durationMs: z.ZodOptional; retryCount: z.ZodOptional; escalated: z.ZodOptional; }, z.core.$strip>; export type Metadata = z.infer; /** * Receipt schema - audit trail for task execution * * @example * ```json * { * "id": "550e8400-e29b-41d4-a716-446655440000", * "frameId": "f-550e8400-e29b-41d4-a716-446655440001", * "timestamp": "2025-12-16T06:00:00Z", * "executor": { * "type": "agent", * "id": "copilot-senior-dev", * "version": "1.0.0" * }, * "task": { * "id": "PR-554", * "description": "Add capability tier classification", * "capabilityTier": "mid" * }, * "status": "success", * "outcome": { * "artifacts": ["src/shared/types/frame-schema.ts"] * }, * "metadata": { * "durationMs": 45000, * "retryCount": 0 * } * } * ``` */ export declare const ReceiptSchema: z.ZodObject<{ id: z.ZodString; frameId: z.ZodOptional; timestamp: z.ZodString; executor: z.ZodObject<{ type: z.ZodEnum<{ human: "human"; agent: "agent"; tool: "tool"; }>; id: z.ZodString; version: z.ZodOptional; }, z.core.$strip>; task: z.ZodObject<{ id: z.ZodString; description: z.ZodString; capabilityTier: z.ZodOptional>; }, z.core.$strip>; status: z.ZodEnum<{ success: "success"; failure: "failure"; partial: "partial"; blocked: "blocked"; }>; outcome: z.ZodObject<{ result: z.ZodOptional; error: z.ZodOptional; blockers: z.ZodOptional>; artifacts: z.ZodOptional>; }, z.core.$strip>; metadata: z.ZodOptional; retryCount: z.ZodOptional; escalated: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; export type Receipt = z.infer; /** * Validate a Receipt using Zod schema * * @param value - Unknown value to validate * @returns true if valid Receipt, false otherwise */ export declare function isReceipt(value: unknown): value is Receipt; /** * Parse and validate a Receipt, throwing on error * * @param value - Unknown value to parse * @returns Validated Receipt * @throws ZodError if validation fails */ export declare function parseReceipt(value: unknown): Receipt; /** * Parse a Receipt safely, returning result object * * @param value - Unknown value to parse * @returns SafeParseResult with success/data or error */ export declare function safeParseReceipt(value: unknown): z.ZodSafeParseResult<{ id: string; timestamp: string; executor: { type: "human" | "agent" | "tool"; id: string; version?: string | undefined; }; task: { id: string; description: string; capabilityTier?: "senior" | "mid" | "junior" | undefined; }; status: "success" | "failure" | "partial" | "blocked"; outcome: { result?: any; error?: string | undefined; blockers?: string[] | undefined; artifacts?: string[] | undefined; }; frameId?: string | undefined; metadata?: { durationMs?: number | undefined; retryCount?: number | undefined; escalated?: boolean | undefined; } | undefined; }>; /** * Create a minimal valid Receipt * * @param params - Required receipt parameters * @returns Validated Receipt * * @example * ```typescript * const receipt = createReceipt({ * executor: { type: 'agent', id: 'copilot-1' }, * task: { id: 'task-1', description: 'Implement feature' }, * status: 'success' * }); * ``` */ export declare function createReceipt(params: { executor: Executor; task: Task; status: ReceiptStatus; outcome?: Outcome; frameId?: string; metadata?: Metadata; }): Receipt;