import * as Schema from "effect/Schema"; import type { SuggestedAction } from "@agentxm/registry-protocol/unstable/suggested-action"; import { type FailureAction, type FailureInput, type FailureMetadata, type FailureProblem, type FailureSuggestedAction } from "@agentxm/workspace-kernel/operations"; /** * Named exit codes for the CLI. `Success` is the only exit code without an * `AppErrorCode` counterpart; the rest map 1:1 with `AppErrorCode` via * `exitCodeFor`. * * Reserved ranges: * - `0` — success * - `1`–`16` — AXM application errors (this enum) * - `17`–`127` — reserved for future AXM application errors; do not reuse * - `128`+ — POSIX signal convention (130 SIGINT, 143 SIGTERM); set by the * runtime's signal handlers and the operation exit mapping, not by * `AppError` * * The numeric values diverge from `sysexits.h` deliberately: AXM uses a * flat 1–N scheme so the `code` field in JSON output stays the agent-facing * discriminator rather than the number. * * `ExitCodeDefinitions` below holds the one public meaning of every code, * including the signal codes; the help topic at * `apps/cli/help/topics/exit-codes.md` is pinned to it by * `cli/exit-codes-match-published-reference`. Each member here names only the * `AppErrorCode` it pairs with. */ export declare const ExitCode: { /** Pairs with no `AppErrorCode`. */ readonly Success: 0; /** Pairs with `AppErrorCode` `issues`. */ readonly Issues: 1; /** Pairs with `AppErrorCode` `usage`. */ readonly Usage: 2; /** Pairs with `AppErrorCode` `not_found`. */ readonly NotFound: 3; /** Pairs with `AppErrorCode` `auth`. */ readonly Auth: 4; /** Pairs with `AppErrorCode` `forbidden`. */ readonly Forbidden: 5; /** Pairs with `AppErrorCode` `conflict`. */ readonly Conflict: 6; /** Pairs with `AppErrorCode` `rate_limit`. */ readonly RateLimit: 7; /** Pairs with `AppErrorCode` `network`. */ readonly Network: 8; /** Pairs with `AppErrorCode` `validation`. */ readonly Validation: 9; /** Pairs with `AppErrorCode` `internal`. */ readonly Internal: 10; /** Pairs with `AppErrorCode` `unavailable`. */ readonly Unavailable: 11; /** Pairs with `AppErrorCode` `quota`. */ readonly Quota: 12; /** Pairs with `AppErrorCode` `auth_required`. */ readonly AuthRequired: 13; /** Pairs with `AppErrorCode` `auth_expired`. */ readonly AuthExpired: 14; /** Pairs with `AppErrorCode` `auth_denied`. */ readonly AuthDenied: 15; /** Pairs with `AppErrorCode` `timeout`. */ readonly Timeout: 16; }; export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode]; /** Canonical public meaning of every AXM process exit code. */ export declare const ExitCodeDefinitions: readonly [{ readonly code: 0; readonly meaning: "Success. Also used for help output and cancelled prompts."; }, { readonly code: 1; readonly meaning: "Command ran successfully but reported problems requiring attention (e.g., `axm lint` findings, doctor-style checks). Not lint-only — any \"ran but found problems\" outcome belongs here."; }, { readonly code: 2; readonly meaning: "Invalid invocation, confirmable approval required when no prompt can open, or a named policy override is required. Fix the invocation or use the reported recovery action."; }, { readonly code: 3; readonly meaning: "Resource doesn't exist or isn't visible."; }, { readonly code: 4; readonly meaning: "Credentials were rejected, are invalid, or expired. Sign in again."; }, { readonly code: 5; readonly meaning: "Signed in, but not authorized for this action."; }, { readonly code: 6; readonly meaning: "Conflicts with current state, including a stale execution candidate (already exists, version mismatch, concurrent update). Reconcile and retry."; }, { readonly code: 7; readonly meaning: "Rate limited. Retry after a backoff."; }, { readonly code: 8; readonly meaning: "Couldn't reach the remote service (DNS, TCP, TLS, timeout). Usually retryable."; }, { readonly code: 9; readonly meaning: "Input parsed but failed validation. Correct it and retry."; }, { readonly code: 10; readonly meaning: "Unexpected internal error. Likely a bug — please report it."; }, { readonly code: 11; readonly meaning: "Service is responsive but temporarily unable to serve."; }, { readonly code: 12; readonly meaning: "Quota, storage, or plan limit exhausted."; }, { readonly code: 13; readonly meaning: "Authentication or authorization is waiting on a person to complete a required action."; }, { readonly code: 14; readonly meaning: "A pending authentication flow expired."; }, { readonly code: 15; readonly meaning: "A person denied or cancelled a pending authentication flow."; }, { readonly code: 16; readonly meaning: "A bounded operation did not complete before its caller-selected deadline."; }, { readonly code: 130; readonly meaning: "Interrupted by SIGINT. Local candidate-wide transactions roll back before AXM exits."; }, { readonly code: 143; readonly meaning: "Terminated by SIGTERM. Local candidate-wide transactions roll back before AXM exits."; }]; /** `ExitCode` names that carry an `AppErrorCode`. Every exit code except `Success`. */ type ErrorExitName = Exclude; /** * Single source for the snake-case `AppErrorCode` strings (the values emitted * in `--json` output). Keys are `ExitCode` names. * * `satisfies Record` enforces 1:1 with `ExitCode` minus * `Success` — adding an `ExitCode` without an entry here (or removing one) * won't compile. */ declare const AppErrorCodeByExitName: { readonly Issues: "issues"; readonly Usage: "usage"; readonly NotFound: "not_found"; readonly Auth: "auth"; readonly Forbidden: "forbidden"; readonly Conflict: "conflict"; readonly RateLimit: "rate_limit"; readonly Network: "network"; readonly Validation: "validation"; readonly Internal: "internal"; readonly Unavailable: "unavailable"; readonly Quota: "quota"; readonly AuthRequired: "auth_required"; readonly AuthExpired: "auth_expired"; readonly AuthDenied: "auth_denied"; readonly Timeout: "timeout"; }; export type AppErrorCode = (typeof AppErrorCodeByExitName)[ErrorExitName]; export type AppErrorClass = "internal" | "user" | "external"; /** * Tuple of every `AppErrorCode`. Listed via member reads so the tuple type is * preserved for `Schema.Literals` without a cast. */ export declare const AppErrorCodes: readonly ["issues", "usage", "not_found", "auth", "forbidden", "conflict", "rate_limit", "network", "validation", "internal", "unavailable", "quota", "auth_required", "auth_expired", "auth_denied", "timeout"]; export declare const AppErrorCodeSchema: Schema.Literals; export declare const exitCodeFor: (code: AppErrorCode) => ExitCode; /** * The `AppErrorCode` a non-zero application exit code pairs with, read from * the same 1:1 table; `undefined` for success and the signal codes. */ export declare const appErrorCodeForExit: (exitCode: number) => AppErrorCode | undefined; /** The pending action a failure hands to a person, as the kernel renders it. */ export type AppErrorAction = FailureAction; export declare const defaultTitleFor: (code: AppErrorCode) => string; export declare const errorClassForAppErrorCode: (code: AppErrorCode) => AppErrorClass; /** * Resolve the suggestions to surface for an error: the caller's own * suggestions when present, otherwise the baseline set for the error code. * Used by both human (`renderAppError`) and JSON (`makeJsonErrorEnvelope`) * output so the two surfaces stay consistent. */ export declare const effectiveSuggestionsFor: (error: AppError) => ReadonlyArray; declare const AppError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "AppError"; } & Readonly; export declare class AppError extends AppError_base<{ readonly code: AppErrorCode; readonly title: string; readonly detail: string; readonly metadata?: FailureMetadata; readonly status?: "pending-human"; readonly retryable?: boolean; readonly blockedOn?: "human"; readonly action?: AppErrorAction; readonly problem?: FailureProblem; readonly inputs?: ReadonlyArray; readonly suggestions?: ReadonlyArray; readonly cause: unknown; }> { } export declare const makeAppError: (args: { readonly code: AppErrorCode; readonly title?: string; readonly detail?: string; readonly metadata?: FailureMetadata; readonly status?: "pending-human"; readonly retryable?: boolean; readonly blockedOn?: "human"; readonly action?: AppErrorAction; readonly problem?: FailureProblem; readonly inputs?: ReadonlyArray; readonly recover?: string; readonly cmd?: string; readonly suggestions?: ReadonlyArray; readonly cause?: unknown; }) => AppError; export {}; //# sourceMappingURL=app-error.d.ts.map