/** * Receipt Protocol Schema * * Implements "Permission to Fail with Discipline" governance concept. * Receipts document action chains with explicit uncertainty, reversibility, * and escalation paths. * * @module memory/receipts/schema */ import { z } from "zod"; /** * Confidence level for an action taken under uncertainty */ export declare const ConfidenceLevel: z.ZodEnum<{ high: "high"; medium: "medium"; low: "low"; uncertain: "uncertain"; }>; export type ConfidenceLevel = z.infer; /** * Reversibility level for an action */ export declare const ReversibilityLevel: z.ZodEnum<{ reversible: "reversible"; "partially-reversible": "partially-reversible"; irreversible: "irreversible"; }>; export type ReversibilityLevel = z.infer; /** * Outcome of an action */ export declare const Outcome: z.ZodEnum<{ success: "success"; failure: "failure"; partial: "partial"; deferred: "deferred"; }>; export type Outcome = z.infer; /** * Failure classification for governance tracking * * Each class maps to specific recovery actions: * - timeout: Operation exceeded time budget * - resource_exhaustion: Ran out of tokens, memory, or other resources * - model_error: LLM returned error or invalid response * - context_overflow: Too much context for model to handle * - policy_violation: Action blocked by policy rules */ export declare const FailureClass: z.ZodEnum<{ timeout: "timeout"; resource_exhaustion: "resource_exhaustion"; model_error: "model_error"; context_overflow: "context_overflow"; policy_violation: "policy_violation"; }>; export type FailureClass = z.infer; /** * Explicit marker for uncertainty in decision-making * * Records what was uncertain, what action was taken despite uncertainty, * and what mitigations were applied. */ export declare const UncertaintyMarker: z.ZodObject<{ stated: z.ZodString; actionTaken: z.ZodString; confidence: z.ZodEnum<{ high: "high"; medium: "medium"; low: "low"; uncertain: "uncertain"; }>; mitigations: z.ZodOptional>; }, z.core.$strip>; export type UncertaintyMarker = z.infer; /** * Receipt documenting a disciplined action with uncertainty handling * * Provides a structured way to document: * 1. What action was taken and why * 2. Explicit uncertainty markers * 3. Reversibility and rollback paths * 4. Escalation requirements * * @example * ```typescript * const receipt: Receipt = { * schemaVersion: '1.0.0', * kind: 'Receipt', * action: 'Implemented token refresh with 80% TTL', * outcome: 'success', * rationale: 'Balances security (fresh tokens) with performance (fewer refreshes)', * confidence: 'medium', * uncertaintyNotes: [{ * stated: 'Not sure if 80% TTL is optimal for token refresh', * actionTaken: 'Implemented with 80% TTL, flagged for review', * confidence: 'medium', * mitigations: ['Made configurable via env var', 'Added monitoring'] * }], * reversibility: 'reversible', * rollbackPath: 'Change LEX_TOKEN_REFRESH_TTL env var', * rollbackTested: false, * escalationRequired: false, * timestamp: '2025-12-05T02:00:00Z', * }; * ``` */ export declare const Receipt: z.ZodObject<{ schemaVersion: z.ZodLiteral<"1.0.0">; kind: z.ZodLiteral<"Receipt">; action: z.ZodString; outcome: z.ZodEnum<{ success: "success"; failure: "failure"; partial: "partial"; deferred: "deferred"; }>; rationale: z.ZodString; failureClass: z.ZodOptional>; failureDetails: z.ZodOptional; recoverySuggestion: z.ZodOptional; confidence: z.ZodEnum<{ high: "high"; medium: "medium"; low: "low"; uncertain: "uncertain"; }>; uncertaintyNotes: z.ZodOptional; mitigations: z.ZodOptional>; }, z.core.$strip>>>; reversibility: z.ZodEnum<{ reversible: "reversible"; "partially-reversible": "partially-reversible"; irreversible: "irreversible"; }>; rollbackPath: z.ZodOptional; rollbackTested: z.ZodOptional; escalationRequired: z.ZodDefault; escalationReason: z.ZodOptional; escalatedTo: z.ZodOptional; timestamp: z.ZodString; agentId: z.ZodOptional; sessionId: z.ZodOptional; frameId: z.ZodOptional; }, z.core.$strip>; export type Receipt = z.infer; /** * Receipt schema version constant */ export declare const RECEIPT_SCHEMA_VERSION = "1.0.0";