import { Cause, Context, Duration, Effect, Layer, Schedule, Schema } from "effect"; import { LanguageModel } from "effect/unstable/ai"; import { type FailureResolver, defaultResolveFailure } from "./model-response-failure.js"; /** @experimental */ export { defaultResolveFailure }; /** @experimental */ export type { FailureInput, FailureResolver } from "./model-response-failure.js"; /** @experimental Classification of a model-call failure. */ export type Classification = "transient" | "terminal"; /** @experimental Retry and correction policy for one logical model call. */ export interface Interface { readonly classify: (error: unknown) => Classification; readonly resolve: FailureResolver; readonly retrySchedule: Schedule.Schedule; readonly invalidToolCallCorrectionLimit: number; readonly streamIdleTimeout?: Duration.Input; } declare const ModelResilience_base: Context.ServiceClass; /** @experimental */ export declare class ModelResilience extends ModelResilience_base { } declare const ModelResilienceMisconfigured_base: Schema.Class; readonly message: Schema.String; }>, Cause.YieldableError>; /** @experimental A model resilience policy contains an unsafe correction bound. */ export declare class ModelResilienceMisconfigured extends ModelResilienceMisconfigured_base { } /** * @experimental A stream that ended without its terminal event is retryable * only while nothing a consumer would replay escaped downstream; retrying after * that would duplicate the consumer's transcript. */ export declare const defaultClassify: (error: unknown) => Classification; /** @experimental */ export declare const defaultPolicy: Interface; /** @experimental */ export declare const none: Interface; /** @experimental Validate a structurally supplied model resilience policy. */ export declare const validate: (implementation: Interface) => Effect.Effect; /** @experimental */ export declare const make: (input?: Partial) => Effect.Effect; /** @experimental */ export declare const layer: (input?: Partial) => Layer.Layer; /** @experimental */ export declare const layerTest: (implementation: Interface) => Layer.Layer; /** @experimental */ export declare const apply: { (resilience: Interface): (model: LanguageModel.Service) => LanguageModel.Service; (model: LanguageModel.Service, resilience: Interface): LanguageModel.Service; };