import { z } from 'zod'; import { WeftError } from '../../core/weft-error.ts'; import type { FlattenedZodIssue, OperationFault, TransportKind } from '../operation-fault.ts'; import type { TransportAvailability, UnknownKeyPolicy } from './types.ts'; export declare const SUPPORTED_TRANSPORTS: ReadonlyArray; export declare const UNSAFE_PROTOTYPE_KEYS: ReadonlySet; export declare function transportToPolicyKey(transport: TransportKind): keyof UnknownKeyPolicy; export declare function transportToAvailabilityKey(transport: TransportKind): keyof TransportAvailability; /** * Extract the top-level keys of an object schema. The registry validates at * construction time that every `inputSchema` is a `z.ZodObject`. */ export declare function extractTopLevelObjectKeys(schema: z.ZodType): ReadonlySet; /** * Build a prototype-safe shallow projection of `rawInput` containing only * keys present in `knownKeys`. */ export declare function sanitizeTopLevel(rawInput: Record, knownKeys: ReadonlySet): Record; export declare function flattenZodIssues(issues: ReadonlyArray<{ path: ReadonlyArray; message: string; code: string; }>): ReadonlyArray; /** * Translate a thrown value from `invoke` into a transport-neutral * OperationFault. * * Typed engine errors (`WorkflowAlreadyExistsError`, * `WorkflowNotFoundError`, `WorkflowNotRegisteredError`) are matched first * so the fault classification is robust against future error-message * rewording. Plain `Error` instances fall through to the message-pattern * heuristics, which exist as a last-resort generic catch-all. * * **Producible-faults enforcement.** When `operation` is supplied (the * dispatch pipeline always supplies it), any direct `OperationFault` * throw whose `code` is NOT in the operation's `producibleFaults` ∪ * universal-defaults set is logged as a declaration violation: * * - Test/dev (`NODE_ENV !== 'production'` OR `WEFT_STRICT_FAULTS=1`): * console.error so the developer notices and either declares the * fault or migrates the throw to `raiseFault`. * - Production: silent log. The original fault is preserved on the * wire to keep clients' actionable semantics intact. * * This makes the producibleFaults declarations runtime-load-bearing for * direct throws too — not just calls routed through the `raiseFault` * helper. */ export declare function classifyEngineError(error: unknown, operation?: { name: string; producibleFaults?: ReadonlyArray; }): OperationFault; /** * Sentinel thrown by `enforceProducibleFaults` in strict mode when an * operation raises a fault code that isn't in its `producibleFaults` * declaration. The dispatcher catches this in `executeOperation` and * surfaces it as a generic `EngineFailure` so test failures point at the * declaration mismatch rather than silently passing through. */ declare class UndeclaredFaultError extends WeftError<'UndeclaredFaultError'> { readonly operationName: string; readonly faultCode: string; constructor(operationName: string, faultCode: string); } export declare function isUndeclaredFaultError(value: unknown): value is UndeclaredFaultError; export {};