{
  "package": "@arki/resilience",
  "version": "0.2.0",
  "entries": [
    {
      "subpath": ".",
      "name": "attachPolicyLogger",
      "kind": "function",
      "signature": "export declare function attachPolicyLogger(policy: Policy<unknown, unknown>, logger: PolicyLogger, policyName?: string): () => void;",
      "jsdocSummary": "Attach structured logging to a resilience policy. Subscribes to retry, circuit breaker, timeout, success, and failure events when available."
    },
    {
      "subpath": ".",
      "name": "backgroundJobPolicy",
      "kind": "variable",
      "signature": "export declare const backgroundJobPolicy: ResiliencePolicy;",
      "jsdocSummary": "Resilience policy tuned for background job processing where higher latency and more retries are acceptable."
    },
    {
      "subpath": ".",
      "name": "backoff",
      "kind": "variable",
      "signature": "export declare const backoff: { /** * Waits `base`, then twice as long before each later retry: `base * 2^(attempt - 1)`, * capped at `max`, varied by `jitter`. * * @example backoff.exponential({ base: 200, max: 5000, jitter: 0.25 }).upTo(3) */ exponential(options: ExponentialBackoffOptions): Backoff; /** * Waits the same `ms` before every retry. * * @example backoff.constant(60_000).upTo(1) */ constant(ms: number): Backoff; };",
      "jsdocSummary": "Builders of a {@link Backoff}. Every builder retries forever until `upTo` limits it."
    },
    {
      "subpath": ".",
      "name": "Backoff",
      "kind": "type",
      "signature": "export type Backoff = { /** * The wait in milliseconds before retry number `attempt` (1 for the first retry) after * `reason` failed the previous try: the error it threw, or the failure it returned. * `undefined` means stop: do not retry. Throws `InvalidBackoffError` when `attempt` is * not a whole number from 1. */ delay(attempt: number, reason: unknown): number | undefined; /** The most retries this backoff allows: what `upTo` set, or `Infinity`. */ readonly maxRetries: number; /** The same backoff, stopping after at most `retries` retries. `upTo(0)` never retries. */ upTo(retries: number): Backoff; /** * The same backoff, also retrying returned failures of these `@arki/failure` * definitions. Thrown errors keep retrying as without `while`; other returned * failures are not retried. Short for * `while(reason => !isFailure(reason) || definitions.some(d => d.is(reason)))`. * * @example backoff.exponential({ base: 100 }).while(DbTimeout, ExportUnavailable) */ while(...definitions: RetryableFailures): Backoff; /** * The same backoff, retrying only the reasons for which `predicate` returns true. A * reason is a thrown error or a returned failure, so the predicate sees both: a * returned failure is retried only when a predicate says yes to it. A negative * predicate such as `reason => !(reason instanceof BadInput)` says yes to failures too. * * @example backoff.exponential({ base: 100 }).while(reason => reason instanceof NetworkError) */ while(predicate: RetryPredicate): Backoff; };",
      "jsdocSummary": "How long to wait before each retry, and when to stop. Immutable: `upTo` and `while` return a new backoff. Each call narrows the backoff, except that the first `while` decides alone whether a returned failure is retried."
    },
    {
      "subpath": ".",
      "name": "BreakEvent",
      "kind": "type",
      "signature": "export type BreakEvent = FailureReason | { isolated: true; };",
      "jsdocSummary": "Fired when a circuit breaker opens. `isolated` means it was opened by hand."
    },
    {
      "subpath": ".",
      "name": "BulkheadPolicy",
      "kind": "type",
      "signature": "export type BulkheadPolicy = Policy & { /** Fires when a call is turned away because both the slots and the queue are full. */ readonly onReject: PolicyEvent<void>; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "BulkheadPolicyOptions",
      "kind": "type",
      "signature": "export type BulkheadPolicyOptions = { /** Maximum concurrent executions (default: 10) */ maxConcurrent?: number; /** Maximum queue size for pending executions (default: 100) */ maxQueue?: number; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "BulkheadRejectedError",
      "kind": "class",
      "signature": "export declare class BulkheadRejectedError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E004\"; readonly remediation = \"Retry later, raise the bulkhead limits, or shed load before the call.\"; constructor(message?: string, options?: ErrorOptions); }",
      "jsdocSummary": "A bulkhead turned the call away: every execution slot and queue slot was taken."
    },
    {
      "subpath": ".",
      "name": "CancelledError",
      "kind": "class",
      "signature": "export declare class CancelledError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E003\"; readonly remediation = \"Check signal.aborted before you start, or catch CancelledError where you abort.\"; constructor(message?: string, options?: ErrorOptions); }",
      "jsdocSummary": "The caller's own signal aborted while the call was in flight. `cause` is the signal's reason."
    },
    {
      "subpath": ".",
      "name": "CircuitBreakerPolicy",
      "kind": "type",
      "signature": "export type CircuitBreakerPolicy = Policy & { readonly onBreak: PolicyEvent<BreakEvent>; /** Fires when the breaker lets a trial call through after `halfOpenAfter`. */ readonly onHalfOpen: PolicyEvent<void>; /** Fires when a trial call succeeds and the breaker closes again. */ readonly onReset: PolicyEvent<void>; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "CircuitBreakerPolicyOptions",
      "kind": "type",
      "signature": "export type CircuitBreakerPolicyOptions = { /** Duration in milliseconds before the breaker transitions from open to half-open (default: 30_000) */ halfOpenAfter?: number; /** Number of consecutive failures before the breaker opens (default: 5) */ consecutiveFailures?: number; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "CircuitOpenError",
      "kind": "class",
      "signature": "export declare class CircuitOpenError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E001\"; readonly remediation = \"Wait for the breaker to half-open and try again, or serve a fallback while it is open.\"; constructor(message?: string, options?: ErrorOptions); }",
      "jsdocSummary": "The circuit breaker is open: the call was rejected without running the function."
    },
    {
      "subpath": ".",
      "name": "createBulkheadPolicy",
      "kind": "function",
      "signature": "export declare function createBulkheadPolicy(options?: BulkheadPolicyOptions): BulkheadPolicy;",
      "jsdocSummary": "Create a bulkhead (concurrency-limiter) policy."
    },
    {
      "subpath": ".",
      "name": "createCircuitBreakerPolicy",
      "kind": "function",
      "signature": "export declare function createCircuitBreakerPolicy(options?: CircuitBreakerPolicyOptions): CircuitBreakerPolicy;",
      "jsdocSummary": "Create a circuit breaker policy using consecutive-failure detection."
    },
    {
      "subpath": ".",
      "name": "createResiliencePolicy",
      "kind": "function",
      "signature": "export declare function createResiliencePolicy<Mapped = never>(options?: ResiliencePolicyOptions<Mapped>): ResiliencePolicy<Mapped>;",
      "jsdocSummary": "Create a composed resilience policy: [bulkhead ->] retry -> circuit breaker -> timeout."
    },
    {
      "subpath": ".",
      "name": "createRetryPolicy",
      "kind": "function",
      "signature": "export declare function createRetryPolicy<Mapped = never>(options?: RetryPolicyOptions<Mapped>): RetryPolicy<Mapped>;",
      "jsdocSummary": "Create a retry policy. It calls the function, and after each failure asks `backoff` how long to wait before the next try, or whether to stop and rethrow the error."
    },
    {
      "subpath": ".",
      "name": "createTimeoutPolicy",
      "kind": "function",
      "signature": "export declare function createTimeoutPolicy(options?: TimeoutPolicyOptions): TimeoutPolicy;",
      "jsdocSummary": "Create a timeout policy that aggressively cancels the operation when the deadline is exceeded."
    },
    {
      "subpath": ".",
      "name": "databasePolicy",
      "kind": "variable",
      "signature": "export declare const databasePolicy: import(\"./policy.js\").Policy<never, import(\"@arki/clock\").SleepFailure>;",
      "jsdocSummary": "Resilience policy tuned for database operations."
    },
    {
      "subpath": ".",
      "name": "definePresets",
      "kind": "function",
      "signature": "export declare function definePresets<N extends string>(options: Record<N, ResiliencePolicyOptions>): Presets<N>;",
      "jsdocSummary": "Build one composed policy per name. Each name has its own breaker, so one failing downstream does not open the circuit of another. A `Presets` object shared by two apps shares its breakers too: same downstream, same health."
    },
    {
      "subpath": ".",
      "name": "ExponentialBackoffOptions",
      "kind": "type",
      "signature": "export type ExponentialBackoffOptions = { /** The wait before the first retry, in milliseconds. Each later wait doubles. */ readonly base: number; /** The longest wait, in milliseconds. Default and upper bound: `MAX_TIMER_MS` (about 24.8 days). */ readonly max?: number; /** * How much each wait may vary, from 0 (the default: exact) to 1. With `0.25` a wait is * picked at random from 75% to 125% of its exact value, then capped at `max`. Spreads * the retries of many clients so they do not hit a recovering service at once. */ readonly jitter?: number; /** * Where jitter gets its randomness: a function returning a number in [0, 1), like the * default `Math.random`. Pass a fixed one to make jittered waits deterministic in tests. */ readonly random?: () => number; };",
      "jsdocSummary": "Options of {@link backoff.exponential}."
    },
    {
      "subpath": ".",
      "name": "externalApiPolicy",
      "kind": "variable",
      "signature": "export declare const externalApiPolicy: ResiliencePolicy;",
      "jsdocSummary": "Resilience policy tuned for external API calls (geocoding, AI providers, etc.)."
    },
    {
      "subpath": ".",
      "name": "FailureEvent",
      "kind": "type",
      "signature": "export type FailureEvent = { /** Wall-clock time of the call in milliseconds. */ duration: number; /** Whether the policy handled this failure (retried it, counted it, …). */ handled: boolean; reason: FailureReason; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "FailureReason",
      "kind": "type",
      "signature": "export type FailureReason = { error: unknown; } | { value: unknown; };",
      "jsdocSummary": "Why a call counted as a failure: the error it threw, or the value it returned (a failure from `@arki/failure`)."
    },
    {
      "subpath": ".",
      "name": "InvalidBackoffError",
      "kind": "class",
      "signature": "export declare class InvalidBackoffError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E006\"; readonly remediation = \"Pass finite, non-negative numbers: jitter from 0 to 1, a whole number to upTo, attempts from 1.\"; constructor(message: string); }",
      "jsdocSummary": "A `backoff` builder got an option or an attempt number it cannot use. Raised where the backoff is built."
    },
    {
      "subpath": ".",
      "name": "isBrokenCircuitError",
      "kind": "function",
      "signature": "export declare function isBrokenCircuitError(error: unknown): error is CircuitOpenError;",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "isBulkheadRejectedError",
      "kind": "function",
      "signature": "export declare function isBulkheadRejectedError(error: unknown): error is BulkheadRejectedError;",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "isResilienceError",
      "kind": "function",
      "signature": "export declare function isResilienceError(error: unknown): error is ResilienceError;",
      "jsdocSummary": "True for every error raised by the resilience layer itself."
    },
    {
      "subpath": ".",
      "name": "noop",
      "kind": "variable",
      "signature": "export declare const noop: Policy;",
      "jsdocSummary": "A policy that only runs the function. Useful as a default or in tests."
    },
    {
      "subpath": ".",
      "name": "OnThrow",
      "kind": "type",
      "signature": "export type OnThrow<Mapped> = (error: unknown) => Mapped | PromiseLike<Mapped>;",
      "jsdocSummary": "Turns a thrown error that reaches the caller into a value, usually a failure from `@arki/failure`. Rethrow the errors it does not recognise, so they stay bugs."
    },
    {
      "subpath": ".",
      "name": "Policy",
      "kind": "type",
      "signature": "export type Policy<F = never, E = never> = PolicyExecution<F, E> & { /** Fires once per call that ends well, even when that took retries. */ readonly onSuccess: PolicyEvent<SuccessEvent>; /** Fires on every failed attempt the policy sees. */ readonly onFailure: PolicyEvent<FailureEvent>; };",
      "jsdocSummary": "Execution plus observable policy events."
    },
    {
      "subpath": ".",
      "name": "PolicyCallback",
      "kind": "type",
      "signature": "export type PolicyCallback<T> = (context: PolicyContext) => PromiseLike<T> | T;",
      "jsdocSummary": "The function a policy runs."
    },
    {
      "subpath": ".",
      "name": "PolicyContext",
      "kind": "type",
      "signature": "export type PolicyContext = { /** * Aborted when the caller's signal aborts or when a timeout policy reaches its * deadline. A timeout policy also aborts it once the function has returned. */ readonly signal: AbortSignal; /** 0 for the first call and 1 for the first retry. Always 0 when the policy has no retry. */ readonly attempt: number; };",
      "jsdocSummary": "What a wrapped function receives on every call."
    },
    {
      "subpath": ".",
      "name": "PolicyEvent",
      "kind": "type",
      "signature": "export type PolicyEvent<E> = (listener: (event: E) => void) => Subscription;",
      "jsdocSummary": "An event method: pass a listener, get a subscription back."
    },
    {
      "subpath": ".",
      "name": "PolicyExecution",
      "kind": "type",
      "signature": "export type PolicyExecution<F = never, E = never> = { /** Phantom: makes a policy with a fallback unassignable to a plain `Policy`, so `wrap` rejects it. */ readonly [fallbackType]?: () => F; readonly [outcomeType]?: () => E; execute<T>(this: void, fn: PolicyCallback<T>, signal?: AbortSignal): Promise<T | F | E>; };",
      "jsdocSummary": "Any policy: runs a function and reports how each call ended. `F` is what a fallback may resolve instead of the function's own `T`; it is `never` for a plain policy."
    },
    {
      "subpath": ".",
      "name": "PolicyLogger",
      "kind": "type",
      "signature": "export type PolicyLogger = { info(message: string, context?: Record<string, unknown>): void; warn(message: string, context?: Record<string, unknown>): void; error(message: string, context?: Record<string, unknown>): void; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "Presets",
      "kind": "type",
      "signature": "export type Presets<N extends string = string> = Readonly<Record<N, ResiliencePolicy>>;",
      "jsdocSummary": "A registry of named composed policies. `N` is the union of the names."
    },
    {
      "subpath": ".",
      "name": "RESILIENCE_ERROR_CODES",
      "kind": "variable",
      "signature": "export declare const RESILIENCE_ERROR_CODES: { /** * The circuit breaker is open and rejected the call. * * @fix Wait for the breaker to half-open and call again, or serve a fallback with `withFallback` while it is open. * @verify cd packages/resilience && bun run test */ readonly circuitOpen: 'ARKI_RESILIENCE_E001'; /** * A timeout policy reached its deadline. * * @fix Raise `timeoutMs`, or make the operation faster. Pass the policy's `signal` to the work so it stops. * @verify cd packages/resilience && bun run test */ readonly timeout: 'ARKI_RESILIENCE_E002'; /** * The caller's own signal aborted the call. * * @fix Check `signal.aborted` before you start, or catch `CancelledError` where you abort. It is not an outage. * @verify cd packages/resilience && bun run test */ readonly cancelled: 'ARKI_RESILIENCE_E003'; /** * A bulkhead had no free execution or queue slot. * * @fix Retry later, raise `maxConcurrent` or the queue size, or shed load before the call. * @verify cd packages/resilience && bun run test */ readonly bulkheadRejected: 'ARKI_RESILIENCE_E004'; /** * Every retry attempt failed. * * @fix Read `lastError` for the real cause, or raise the `upTo` limit. * @verify cd packages/resilience && bun run test */ readonly retriesExhausted: 'ARKI_RESILIENCE_E005'; /** * A `backoff` builder got an option or an attempt number it cannot use. * * @fix Pass finite, non-negative numbers: `jitter` from 0 to 1, a whole number to `upTo`, attempts from 1. * @verify cd packages/resilience && bun run test */ readonly invalidBackoff: 'ARKI_RESILIENCE_E006'; };",
      "jsdocSummary": "Stable error codes of `@arki/resilience`. Match on the code, never on the message."
    },
    {
      "subpath": ".",
      "name": "ResilienceComponents",
      "kind": "type",
      "signature": "export type ResilienceComponents = { readonly retry: RetryPolicy; readonly circuitBreaker: CircuitBreakerPolicy; readonly timeout: TimeoutPolicy; /** Set only when the `bulkhead` option was given. */ readonly bulkhead?: BulkheadPolicy; };",
      "jsdocSummary": "The parts a composed resilience policy runs. Their events fire on every composed call."
    },
    {
      "subpath": ".",
      "name": "ResilienceError",
      "kind": "class",
      "signature": "export declare abstract class ResilienceError extends Error { /** Stable machine-readable code, `ARKI_RESILIENCE_E<nnn>`. */ abstract readonly code: ResilienceErrorCode; /** What to do about it, in one sentence. */ abstract readonly remediation: string; constructor(message: string, options?: ErrorOptions); }",
      "jsdocSummary": "Base class of every error the policies raise themselves. Errors thrown by your function pass through untouched."
    },
    {
      "subpath": ".",
      "name": "ResilienceErrorCode",
      "kind": "type",
      "signature": "export type ResilienceErrorCode = (typeof RESILIENCE_ERROR_CODES)[keyof typeof RESILIENCE_ERROR_CODES];",
      "jsdocSummary": "The code of a {@link ResilienceError}."
    },
    {
      "subpath": ".",
      "name": "ResiliencePolicy",
      "kind": "type",
      "signature": "export type ResiliencePolicy<F = never> = Policy<F, SleepFailure> & { readonly components: ResilienceComponents; };",
      "jsdocSummary": "What `createResiliencePolicy` returns: the composed policy plus the parts it runs. `F` is what its `onThrow` may answer instead of the function's own `T`; `never` without one."
    },
    {
      "subpath": ".",
      "name": "ResiliencePolicyOptions",
      "kind": "type",
      "signature": "export type ResiliencePolicyOptions<Mapped = never> = { /** When to retry and how long to wait first. Default: the `createRetryPolicy` default. */ retry?: Backoff; /** Whose timer the retry delay waits on. Default: the system clock. */ clock?: Clock; circuitBreaker?: CircuitBreakerPolicyOptions; timeout?: TimeoutPolicyOptions; /** * Limit concurrent calls. Off unless given, so existing callers keep unlimited * concurrency. It wraps everything else: one logical call, retries included, * holds one slot. */ bulkhead?: BulkheadPolicyOptions; /** * Map a thrown error that reaches the caller to a value, usually a failure from `@arki/failure`. * The call then resolves to `T | Mapped` instead of throwing. It wraps everything, so it also * sees an open circuit (`CircuitOpenError`), a deadline (`TimeoutError`) and a full bulkhead * (`BulkheadRejectedError`). A cancel by the caller's signal is never mapped. Rethrow the * errors it does not recognise, so they stay bugs. */ onThrow?: OnThrow<Mapped>; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "RetriesExhaustedError",
      "kind": "class",
      "signature": "export declare class RetriesExhaustedError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E005\"; readonly remediation = \"Read lastError for the real cause, or raise the attempt limit.\"; readonly attempts: number; readonly lastError: Error | undefined; constructor(attempts: number, lastError?: Error); }",
      "jsdocSummary": "Thrown when all retry attempts have been exhausted without a successful result."
    },
    {
      "subpath": ".",
      "name": "RETRY_WAIT_FAILURES",
      "kind": "variable",
      "signature": "export declare const SLEEP_FAILURES: readonly [import(\"@arki/failure\").FailureDefinition<\"clock.sleep_cancelled\", undefined>, import(\"@arki/failure\").FailureDefinition<\"failure.unexpected_defect\", undefined>];",
      "jsdocSummary": "Exact canonical failure definitions returned by Clock.sleep."
    },
    {
      "subpath": ".",
      "name": "RetryEvent",
      "kind": "type",
      "signature": "export type RetryEvent = FailureReason & { /** The retry about to run: 1 for the first retry. */ attempt: number; /** Backoff delay in milliseconds before that retry. */ delay: number; };",
      "jsdocSummary": "Fired before each retry, after the failed attempt and before the backoff delay."
    },
    {
      "subpath": ".",
      "name": "RetryPolicy",
      "kind": "type",
      "signature": "export type RetryPolicy<F = never> = Policy<F, SleepFailure> & { readonly onRetry: PolicyEvent<RetryEvent>; /** * Fires when the last attempt has failed and its error, or its failure after at least one * retry, is about to reach the caller. A returned failure that was never retried does not fire it. */ readonly onGiveUp: PolicyEvent<FailureReason>; };",
      "jsdocSummary": "A retry policy. `F` is what its `onThrow` may answer instead of the function's own `T`; `never` without one."
    },
    {
      "subpath": ".",
      "name": "RetryPolicyOptions",
      "kind": "type",
      "signature": "export type RetryPolicyOptions<Mapped = never> = { /** * When to retry and how long to wait first. Default: * `backoff.exponential({ base: 100, max: 10_000, jitter: 0.25 }).upTo(3)`. */ backoff?: Backoff; /** Whose timer the retry delay waits on. Default: the system clock. Pass a `MockClock` to make tests instant. */ clock?: Clock; /** * Map an error that outlasts the retries, or one that is not retried, to a value. The call then * resolves to `T | Mapped` instead of throwing. A cancel by the caller's signal is never mapped. */ onThrow?: OnThrow<Mapped>; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "RetryWaitFailure",
      "kind": "type",
      "signature": "export type SleepFailure = ReturnType<(typeof SLEEP_FAILURES)[number]>;",
      "jsdocSummary": "Every operational outcome of Clock.sleep, inferred from its definitions."
    },
    {
      "subpath": ".",
      "name": "Subscription",
      "kind": "type",
      "signature": "export type Subscription = { dispose(): void; };",
      "jsdocSummary": "Returned by every event method. Call `dispose()` to stop listening."
    },
    {
      "subpath": ".",
      "name": "SuccessEvent",
      "kind": "type",
      "signature": "export type SuccessEvent = { /** Wall-clock time of the call in milliseconds. */ duration: number; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "TimeoutError",
      "kind": "class",
      "signature": "export declare class TimeoutError extends ResilienceError { readonly code: \"ARKI_RESILIENCE_E002\"; readonly remediation = \"Raise the timeout, or make the operation faster.\"; constructor(message?: string, options?: ErrorOptions); }",
      "jsdocSummary": "A timeout policy reached its deadline before the function returned."
    },
    {
      "subpath": ".",
      "name": "TimeoutPolicy",
      "kind": "type",
      "signature": "export type TimeoutPolicy = Policy & { readonly onTimeout: PolicyEvent<void>; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "TimeoutPolicyOptions",
      "kind": "type",
      "signature": "export type TimeoutPolicyOptions = { /** Timeout duration in milliseconds (default: 30_000) */ timeoutMs?: number; };",
      "jsdocSummary": ""
    },
    {
      "subpath": ".",
      "name": "withFallback",
      "kind": "function",
      "signature": "export declare function withFallback<F, G = never, E = never>(policy: Policy<G, E>, fallback: (error: unknown) => F | PromiseLike<F>): Policy<G | F, E>;",
      "jsdocSummary": "Give a policy a last answer. When the policy's call fails, `fallback` gets the error and its result becomes the result of the call. Put it outermost: inside `wrap` it would hide the errors the retry needs, so `wrap` does not accept a policy with a fallback."
    },
    {
      "subpath": ".",
      "name": "withResilience",
      "kind": "function",
      "signature": "export declare function withResilience<T, F = never, E = never>(fn: PolicyCallback<T>, policy: Policy<F, E>): Promise<T | F | E>;",
      "jsdocSummary": "Execute a function with an already-constructed resilience policy."
    },
    {
      "subpath": ".",
      "name": "withRetry",
      "kind": "function",
      "signature": "export declare function withRetry<T, Mapped = never>(fn: PolicyCallback<T>, options?: RetryPolicyOptions<Mapped>): Promise<T | Mapped | SleepFailure>;",
      "jsdocSummary": "Execute a function with a retry policy (no circuit breaker or timeout)."
    },
    {
      "subpath": ".",
      "name": "withTimeout",
      "kind": "function",
      "signature": "export declare function withTimeout<T>(fn: PolicyCallback<T>, options?: TimeoutPolicyOptions): Promise<T>;",
      "jsdocSummary": "Execute a function with a timeout policy."
    },
    {
      "subpath": ".",
      "name": "wrap",
      "kind": "function",
      "signature": "export declare function wrap<E = never>(first: Policy<never, E>, ...rest: Policy<never, E>[]): Policy<never, E>;",
      "jsdocSummary": "Compose policies from the outside in: `wrap(retry, breaker, timeout)` retries a call whose every attempt goes through the breaker and then the timeout. Events on the result are those of the outermost policy."
    },
    {
      "subpath": "./dot",
      "name": "resilience",
      "kind": "function",
      "signature": "export declare function resilience<N extends string>(presets: Presets<N>): import(\"@arki/dot/plugin\").AuthoredPlugin<import(\"@arki/dot/plugin\").WireNeeds<import(\"@arki/dot/plugin\").EmptyShape>, import(\"@arki/dot/plugin\").ProvidedValues<{ resilience: ResilienceService<N>; }>, import(\"@arki/dot/plugin\").EmptyShape, \"resilience\", { resilience: ResilienceService<N>; }, import(\"@arki/dot/plugin\").EmptyPhases, import(\"@arki/dot/plugin\").DotLoggingHandle<undefined>, undefined>;",
      "jsdocSummary": "Build a DOT plugin that publishes the presets as `services.resilience` and logs their policy events at `debug` under `arki:resilience`."
    },
    {
      "subpath": "./dot",
      "name": "RESILIENCE_PLUGIN_ERROR_CODES",
      "kind": "variable",
      "signature": "export declare const RESILIENCE_PLUGIN_ERROR_CODES: { /** * `for` or `run` got a name that is not in the presets (only reachable from untyped JS). * * @fix Use a name you passed to `definePresets(...)`. Types catch this in TypeScript. * @verify cd packages/resilience && bun run test */ readonly unknownPreset: 'ARKI_RESILIENCE_PLUGIN_E001'; };",
      "jsdocSummary": "Stable error codes thrown by the resilience plugin. Match on these, never on the message."
    },
    {
      "subpath": "./dot",
      "name": "ResilienceService",
      "kind": "type",
      "signature": "export type ResilienceService<N extends string> = { /** The preset called `name`. The same object as `presets[name]`, so breaker state is shared. */ for(name: N): ResiliencePolicy; /** Run `fn` through the preset called `name`. */ run<T>(name: N, fn: PolicyCallback<T>, signal?: AbortSignal): Promise<T | SleepFailure>; };",
      "jsdocSummary": "Services published by the resilience adapter."
    }
  ],
  "errorCodes": [
    "ARKI_RESILIENCE_E001",
    "ARKI_RESILIENCE_E002",
    "ARKI_RESILIENCE_E003",
    "ARKI_RESILIENCE_E004",
    "ARKI_RESILIENCE_E005",
    "ARKI_RESILIENCE_E006",
    "ARKI_RESILIENCE_PLUGIN_E001"
  ]
}
