eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
101 lines • 4.17 kB
TypeScript
import { type BulkCancelWorkflowRunsResult, type World } from '#compiled/@workflow/world/index.js';
export interface RecreateRunOptions {
deploymentId?: string;
specVersion?: number;
/**
* Queue namespace of the target deployment (e.g. `'eve'` for topics like
* `__eve_wkf_workflow_*`). Falls back to `WORKFLOW_QUEUE_NAMESPACE` in
* the calling process. Cross-context callers (e.g. the observability
* dashboard) must pass the target deployment's namespace explicitly,
* since a run enqueued to a topic the target deployment has no consumer
* for is never picked up.
*/
namespace?: string;
}
export interface StopSleepResult {
/** Number of pending sleeps that were stopped */
stoppedCount: number;
}
export interface ReadStreamOptions {
/**
* The index to start reading from. Defaults to 0.
* Negative values start from the end (e.g. -3 reads the last 3 chunks).
*/
startIndex?: number;
}
export interface StopSleepOptions {
/**
* Optional list of specific correlation IDs to target.
* If provided, only these sleep calls will be interrupted.
* If not provided, all pending sleep calls will be interrupted.
*/
correlationIds?: string[];
/**
* Queue namespace of the run's deployment (e.g. `'eve'`), used when
* re-enqueueing the run after completing its waits. Falls back to
* `WORKFLOW_QUEUE_NAMESPACE` in the calling process. Cross-context
* callers (e.g. the observability dashboard) must pass it explicitly.
*/
namespace?: string;
}
export interface ReenqueueRunOptions {
/**
* Queue namespace of the run's deployment (e.g. `'eve'`). Falls back to
* `WORKFLOW_QUEUE_NAMESPACE` in the calling process. Cross-context
* callers (e.g. the observability dashboard) must pass it explicitly.
*/
namespace?: string;
}
export interface CancelRunOptions {
/**
* Optional free-text reason for the cancellation (max 512 chars), recorded
* on the run_cancelled event and surfaced in the run detail view.
*/
cancelReason?: string;
}
/**
* Start a new workflow run based on an existing run.
*/
export declare function recreateRunFromExisting(world: World, runId: string, options?: RecreateRunOptions): Promise<string>;
/**
* Cancel a workflow run.
*
* @param options - Optional cancellation settings. `cancelReason` records a
* free-text reason (max 512 chars) on the run_cancelled event.
*/
export declare function cancelRun(world: World, runId: string, options?: CancelRunOptions): Promise<void>;
/**
* Cancel many runs in one call.
*
* Fast path: if the world implements `runs.cancelMany`, the whole batch is
* delegated to it in a single operation (one backend round-trip on
* `@workflow/world-vercel`).
*
* Fallback: for worlds without `cancelMany`, this issues single-run
* `cancelRun()` calls with at most {@link CANCEL_RUNS_FALLBACK_CONCURRENCY}
* in flight at a time. Fallback successes are reported as `cancelled`;
* failures are reported as `failed` with `code: 'internal_error'` and
* `retryable: true`, deliberately without per-world error classification.
*
* @throws if `runIds` is empty, contains duplicates, or exceeds
* {@link BULK_CANCEL_MAX_RUN_IDS}.
*/
export declare function cancelRuns(world: World, runIds: string[], options?: CancelRunOptions): Promise<BulkCancelWorkflowRunsResult>;
/**
* Re-enqueue a workflow run.
*/
export declare function reenqueueRun(world: World, runId: string, options?: ReenqueueRunOptions): Promise<void>;
/**
* Wake up a workflow run by interrupting pending sleep() calls.
*/
export declare function wakeUpRun(world: World, runId: string, options?: StopSleepOptions): Promise<StopSleepResult>;
/**
* Read from a stream by stream ID.
* Returns a ReadableStream of Uint8Array chunks.
*/
export declare function readStream(world: World, runId: string, streamId: string, options?: ReadStreamOptions): Promise<ReadableStream<Uint8Array>>;
/**
* List all stream IDs for a workflow run.
*/
export declare function listStreams(world: World, runId: string): Promise<string[]>;
//# sourceMappingURL=runs.d.ts.map