/** * Host-neutral error adaptation for agent tool failures. * * The Rust response owns the logical code, message, and structured fields. Host * adapters may attach those values to their native error surface, but must not * rewrite the contract-owned message while doing so. */ export interface AftToolErrorCause { code: string; message: string; response: Record; } export declare class AftToolError extends Error { readonly code: string; readonly response: Record; readonly cause: AftToolErrorCause; constructor(message: string, code: string, response: Record); } /** * Lift a failed bridge response into a host error without losing its logical * code or structured response fields. */ export declare function toolErrorFromResponse(command: string, response: Record): AftToolError; /** Agent-facing guidance for a bash request whose transport outcome is unknown. */ export declare const BASH_TRANSPORT_DISPOSITION = "The transport to the AFT daemon was interrupted; no background task was created for this command and no task ID exists. Re-run the command. Do not poll bash_status for it."; /** * Agent-facing guidance for a call the daemon GOODBYE'd mid-flight. * * Deliberately does NOT say the call failed. The daemon emits route GOODBYEs * after its drain wait regardless of whether that drain completed, so a call * in flight at GOODBYE was admitted BEFORE the gate closed and may already * have run to completion with only its reply lost. "Failed" reads as an * invitation to re-run, which double-applies a mutation that already landed. */ export declare const SUBC_MODULE_RESTART_DISPOSITION = "The AFT daemon module restarted while this call was in flight, so its outcome is UNKNOWN: it may or may not have executed. Verify actual state before re-running, and never blind-retry a mutation."; /** Agent-facing guidance for a standalone request whose write outcome is unknown. */ export declare const BRIDGE_TRANSPORT_UNKNOWN_OUTCOME_DISPOSITION = "The standalone AFT transport failed after this call may have been sent, so its outcome is UNKNOWN: it may or may not have executed. Verify actual state before re-running, and never blind-retry a mutation."; /** * True for the daemon's temporary route.open refusals while an AFT module is * restarting. `module_reloading` is the fast refusal; `module_warming` is the * newer supervision-state response; `target_unavailable` covers the legacy * `live=false` response and a bind relay that closes before its acknowledgement. * * This classifier is only used for route.open rejections: route.open rejections * are provably pre-send AS A CLASS (the daemon refuses-or-assigns atomically; * forwarding requires the channel the rejection withholds). The stable code is * therefore sufficient here and no message prose participates in the match. */ export declare function isRouteOpenReloadWindowError(error: unknown): boolean; export type BashHostFallbackCause = "module down" | "bind timed out" | "route closed before dispatch" | "transport down"; /** * Classify failures that prove bash never reached AFT, including daemon replies * that reject route binding before a module channel exists. A structured engine * response always wins because it proves AFT executed enough of the request to * return a logical result. * * A raw `SubcError("route closed by closeRoute", "route_closed")` is intentionally * absent. The raw request path creates it after a request is pending but exposes * no queued/write marker, so its outcome may be unknown. A future transport can * safely admit that case by using subc-client's managed request path and passing * through `SubcCallError.kind === "not_sent"`. */ export declare function classifyBashHostFallbackError(error: unknown): BashHostFallbackCause | undefined; /** True only when bash could not reach a live AFT engine. */ export declare function isBashTransportDeadError(error: unknown): error is Error; /** * Append agent-facing recovery guidance without changing the original error * object, class, code, or retry behavior. Unknown-outcome errors append safety * guidance on every command; proven bash transport failures append re-run * guidance. Commands matching neither retain their errors untouched. */ export declare function adaptToolError(command: string, error: unknown): unknown; //# sourceMappingURL=error-contract.d.ts.map