/** Base class for server errors. Each carries the HTTP status the server answers with. */ export declare class ServerError extends Error { /** Stable code, such as `THREAD_BUSY`, sent in the error body. */ readonly code: string; /** HTTP status the server answers with. */ readonly status: number; /** Seconds a client should wait before trying again, sent as `Retry-After` when set. */ retryAfterSeconds?: number; constructor(message: string, /** Stable code, such as `THREAD_BUSY`, sent in the error body. */ code: string, /** HTTP status the server answers with. */ status: number); } /** Raised when a request names something that does not exist, or belongs to another tenant. */ export declare class NotFoundError extends ServerError { constructor(what: string, id: string); } /** Raised when a request is malformed: bad JSON, a missing field, or an unknown assistant. */ export declare class BadRequestError extends ServerError { constructor(message: string, code?: string); } /** Raised when a request carries no usable credentials. */ export declare class UnauthorizedError extends ServerError { constructor(message?: string); } /** Raised when a principal is known but not allowed to do this. */ export declare class ForbiddenError extends ServerError { /** The scope the route required. */ readonly scope: string; constructor( /** The scope the route required. */ scope: string); } /** * Thrown by an assistant to hand its run to another worker while this replica drains: the server puts * the run back on the queue as its next attempt instead of failing it. A function assistant checks * `context.control?.draining` between its own steps, saves where it got with `context.saveProgress()`, * and throws this; the next worker reads `context.progress`. Thrown when the replica is not draining, * it fails the run like any error. */ export declare class RunHandOffError extends Error { /** Always `RUN_HANDED_OFF`. */ readonly code = "RUN_HANDED_OFF"; constructor(message?: string); } /** Raised when a thread is already running something and the busy policy is `reject`. */ export declare class ThreadBusyError extends ServerError { /** The thread. */ readonly threadId: string; /** The run already in flight. */ readonly runId: string; constructor( /** The thread. */ threadId: string, /** The run already in flight. */ runId: string); } /** Which per-tenant limit refused a run. */ export type TenantLimit = 'concurrency' | 'rate' | 'budget'; /** * Raised when a run would take a tenant past one of its limits. The server answers `429`, with a * code per limit — `TENANT_CONCURRENCY`, `TENANT_RATE_LIMITED`, or `TENANT_BUDGET` — and a * `Retry-After` header when the wait is known. */ export declare class TenantLimitError extends ServerError { /** The limit that refused the run. */ readonly limit: TenantLimit; /** The tenant, when the principal has one. */ readonly tenantId: string | undefined; constructor( /** The limit that refused the run. */ limit: TenantLimit, /** The tenant, when the principal has one. */ tenantId: string | undefined, message: string, retryAfterSeconds?: number); } /** Raised when an assistant cannot do what a request needs, such as resuming or rolling back. */ export declare class AssistantCapabilityError extends ServerError { /** The assistant. */ readonly assistant: string; /** What it cannot do. */ readonly capability: string; constructor( /** The assistant. */ assistant: string, /** What it cannot do. */ capability: string); }