import { type Fault, type FaultKind, type FaultLink, type FaultRetry } from '../fault-classifier.js'; export type { Fault, FaultKind, FaultLink, FaultRetry, FaultRetryDisposition, FaultRetryOwner } from '../fault-classifier.js'; export declare const FAULT_QUIET_MS: number; export interface FaultRecordInput { link: FaultLink; op: string; kind: FaultKind; retry: FaultRetry; message: string; operation_id?: string; since?: string; anchorEntryId?: string; } export declare function recordFault(nodeId: string, input: FaultRecordInput): void; export declare function recordFaultForCurrentNode(input: FaultRecordInput): boolean; export declare function clearFault(nodeId: string, opts?: { link?: FaultLink; }): boolean; export declare function clearFaultForCurrentNode(opts?: { link?: FaultLink; }): boolean; export declare function readFault(nodeId: string): Fault | null; export declare function readFaultAsync(nodeId: string): Promise; export interface BootFaultAttempt { /** The recorded fault's operation + message (e.g. an unresolvable `--model` * spec, or a model that disappeared mid-launch), scoped to THIS attempt, or * null when none applies. A broker that fatal-crashes before it binds its * view socket leaves the launching caller with only the opaque "socket * never bound" symptom; callers append this so the real cause surfaces * instead. Only a `crtr→pi` fatal launch fault with a non-empty op and * message qualifies — never a stale marker from an earlier attempt (see * `beginBootFaultAttempt`) and never an unrelated fault kind (e.g. a * viewer↔broker connect failure racing the same boot). */ explanation(): string | null; } /** Snapshot fault state immediately before a broker launch begins, returning a * reader that is only trustworthy for a fault recorded by THIS attempt. * * `clearFault` can silently fail to remove a prior marker (its own removal * errors are swallowed, and its result goes unchecked by callers), so rather * than assume that call succeeded, this independently CONFIRMS no fault is * present at the moment of launch. Other processes (a viewer, a relay) can * still write THEIR OWN fault links after this snapshot, but `explanation()` * only ever accepts a fatal `crtr→pi` launch fault — the one shape only a * newly launched broker itself writes (`resolveLaunchModel` in `broker.ts`) — * so no ACCEPTED fault can exist before this snapshot without also surviving * a failed clear, which the snapshot already catches. When a stale fault * survives the clear, `explanation()` fails closed (returns null) rather than * risk surfacing an old, unrelated cause as if it were fresh. * * Call this the instant before the launch call it is guarding, so the window * in which an unrelated write could occur stays as small as possible. */ export declare function beginBootFaultAttempt(nodeId: string): BootFaultAttempt; /** True when a raw engine error says pi could not resolve a credential for the model's * provider at all. pi raises `Provider is not configured: ` whenever auth resolution * yields nothing, and `Credential store read/modify failed for ` when the store itself * errored — for crouter's managed providers both mean "the pool did not hand over a usable * credential just now", which is frequently transient (a refresh in flight, a momentary read * failure) and never something the agent can fix from inside its own turn. Classified as a * plain `other` fault it is FATAL, so the node parks and every wake re-fails on the same * provider; the broker instead substitutes an authenticated provider and re-drives. */ export declare function isProviderUnconfiguredError(message: string): boolean; /** True when a raw engine error is the provider 404 "model missing" signal. */ export declare function isModelNotFoundError(message: string): boolean;