export declare enum ErrorCode { VALIDATION_FAILED = "VALIDATION_FAILED", IDEMPOTENCY_KEY_REUSED = "IDEMPOTENCY_KEY_REUSED", MISSING_IDEMPOTENCY_KEY = "MISSING_IDEMPOTENCY_KEY", UNAUTHORIZED = "UNAUTHORIZED", FORBIDDEN = "FORBIDDEN", TWO_FACTOR_REQUIRED = "TWO_FACTOR_REQUIRED", BUDGET_EXCEEDED = "BUDGET_EXCEEDED", INSUFFICIENT_CREDITS = "INSUFFICIENT_CREDITS", BILLING_GATED = "BILLING_GATED", UPGRADE_REQUIRED = "UPGRADE_REQUIRED", NOT_FOUND = "NOT_FOUND", CONFLICT = "CONFLICT", CONCURRENCY_LIMIT = "CONCURRENCY_LIMIT", WORKFLOW_DISABLED = "WORKFLOW_DISABLED", UNSUPPORTED_TRIGGER = "UNSUPPORTED_TRIGGER", RATE_LIMIT = "RATE_LIMIT", TOOL_ERROR = "TOOL_ERROR", INTERNAL_ERROR = "INTERNAL_ERROR" } export declare class AppError extends Error { readonly code: ErrorCode; readonly httpStatus: number; readonly detail?: unknown; /** One-line "what to do" for the author (message says what's wrong, hint what to do — never * both in one). Duck-typed by `protocolErrorOf` onto the wire as `data.hint`, so it survives * to the run's finalized `error.hint`. */ readonly hint?: string; constructor(code: ErrorCode, message: string, detail?: unknown, hint?: string); } export declare function isAppError(err: unknown): err is AppError; /** * The SEMANTIC code of a thrown value, or undefined when it carries none. Duck-typed rather than * `instanceof` — errors cross package boundaries (SDK/engine dual copies), where class checks fail. * The SCREAMING_SNAKE shape gate keeps prose out of a field consumers render as a code. */ export declare function errorCodeOf(err: unknown): string | undefined; /** Run-lease heartbeat period (ported from the platform's checkpoint module — the broker's * renew endpoint mirrors it). */ export declare const DEFAULT_LEASE_MS: number; /** Opaque unique id (metering sessions, worker ids). Not a ULID — nothing here sorts by it. */ export declare function newId(): string; type LogFields = Record; export interface Logger { debug(message: string, fields?: LogFields): void; info(message: string, fields?: LogFields): void; warn(message: string, fields?: LogFields): void; error(message: string, fields?: LogFields): void; } /** * Freeze the runner's log level from a TRUSTED env — the platform boot env, snapshotted before the * identity relay overlays a run's author env onto process.env (see `main`). Call once at bootstrap. * * Until it's called — in tests, and in the CLI/daemon before boot — {@link activeLevel} falls back to * reading process.env live, so an operator's `--verbose`/`--debug` (which sets the env BEFORE boot, * bin.ts) still applies. After it's called, a workflow author's `meta.env` (overlaid onto process.env * at run time) can no longer raise the runner's own log verbosity. An author-facing verbosity control * belongs in the manifest `meta` (e.g. a `logVerbosity` field), delivered over the trusted control * plane — never an env knob. */ export declare function configureLogging(env: NodeJS.ProcessEnv): void; export declare function createLogger(module: string): Logger; export type OrgRole = "owner" | "admin" | "member" | "viewer"; export type AuthSource = "session_jwt" | "oauth_jwt" | "api_key" | "workflow"; export interface AuthContext { userId: string; source: AuthSource; orgId: string; role: OrgRole; apiKeyId?: string; scopes?: readonly string[]; boundOrgId?: string; boundRole?: OrgRole; } export {};