agents
Version:
A home for your AI agents
90 lines (89 loc) • 3.12 kB
TypeScript
//#region src/tasks/errors.d.ts
/**
* Error classes for the Tasks capability. Each carries a stable `name` so
* hosts and tests can classify failures without depending on message text.
*/
/**
* Thrown by a step callback to fail its run immediately, skipping any
* remaining retry attempts.
*
* Errors named `"NonRetryableError"` from other sources (for example
* `cloudflare:workflows`) are honored the same way.
*
* @experimental The API surface may change before stabilizing.
*/
declare class NonRetryableError extends Error {
constructor(
message: string,
options?: {
cause?: unknown;
}
);
}
/**
* Thrown before executing user code when one replay uses the same step name
* twice. Step names are durable journal keys and must be unique within a run.
*
* @experimental The API surface may change before stabilizing.
*/
declare class DuplicateTaskStepError extends Error {
/** The step name used more than once. */
readonly stepName: string;
constructor(stepName: string);
}
/**
* Thrown when a replay observes a journal that this handler code cannot have
* written — a known step under a different kind, for example. The run fails
* rather than guessing; changing a definition's step layout for in-flight
* runs requires versioning the definition name.
*
* @experimental The API surface may change before stabilizing.
*/
declare class TaskReplayDivergedError extends Error {
/** The step name where replay diverged from the journal. */
readonly stepName: string;
constructor(stepName: string, detail: string);
}
/**
* Recorded against a run whose persisted definition name is no longer
* registered after a deployment. The run fails visibly; it is never silently
* deleted and never replayed against a different handler.
*
* @experimental The API surface may change before stabilizing.
*/
declare class MissingTaskDefinitionError extends Error {
/** The persisted definition name that no longer resolves. */
readonly definition: string;
constructor(definition: string);
}
/**
* Thrown when a Task input, step result, metadata value, or final result is
* not JSON-serializable or exceeds the serialized size limit.
*
* @experimental The API surface may change before stabilizing.
*/
declare class TaskSerializationError extends Error {
constructor(context: string, detail: string);
}
//#endregion
//#region src/tasks/serialization.d.ts
/**
* Value serialization for the Tasks capability.
*
* Task inputs, step results, metadata, and final results persist as JSON
* text in SQLite. `undefined` (and a `void` handler result) is represented
* as SQL `NULL` rather than a JSON envelope, so the JSON column space stays
* plain: `"null"` is JSON `null`, column `NULL` is `undefined`.
*/
/** Default ceiling for one serialized value (1 MiB). */
declare const MAX_SERIALIZED_BYTES = 1048576;
//#endregion
export {
TaskReplayDivergedError as a,
NonRetryableError as i,
DuplicateTaskStepError as n,
TaskSerializationError as o,
MissingTaskDefinitionError as r,
MAX_SERIALIZED_BYTES as t
};
//# sourceMappingURL=index-XDkuQ7zm.d.ts.map