TYPESCRIPT / JAVASCRIPT
Observation & SSE
Method reference generated from the public package declarations · v0.3.0
Observation uses event-driven REST snapshots and ends for intervention or terminal state. Raw SSE is separate from a durable business ledger; save committed sequence IDs as strings.
export type ExecutionObserveOptions = WatchOptions & {
signal: AbortSignal;
minimumSnapshotIntervalMs?: number;
};export type ExecutionObservation<T> = {
resource: T;
state: ExecutionState;
event?: ServerSentEvent<Record<string, unknown>>;
cursor?: string;
};ExecutionState
typeexport type ExecutionState = "queued" | "running" | "waiting_input" | "waiting_approval" | "paused" | "completed" | "failed" | "cancelled" | "unknown";executionState
functionexport function executionState(status: string | undefined): ExecutionState;observeExecution
functionexport function observeExecution<T extends {
status?: string;
}>(load: () => Promise<T>, events: () => AsyncIterable<ServerSentEvent<Record<string, unknown>>>, options: ExecutionObserveOptions): AsyncGenerator<ExecutionObservation<T>>;waitForExecution
functionexport function waitForExecution<T>(events: AsyncIterable<ExecutionObservation<T>>): Promise<ExecutionObservation<T>>;WatchOptions
typeexport type WatchOptions = {
afterSequence?: string | number;
signal?: AbortSignal;
reconnectDelayMs?: number;
maxReconnects?: number;
maxEventBytes?: number;
onReconnect?: (attempt: number) => void;
};export type ControlPlaneWatchOptions = WatchOptions & {
topics?: readonly string[];
};StreamOptions
typeexport type StreamOptions = {
method?: "GET" | "POST";
body?: unknown;
headers?: HeadersInit;
lastEventId?: string | number;
signal?: AbortSignal;
maxEventBytes?: number;
};ServerSentEvent
typeexport type ServerSentEvent<T = unknown> = {
id?: string;
event: string;
data: T;
retry?: number;
};export type ParseServerSentEventsOptions = {
maxEventBytes?: number;
};parseServerSentEvents
functionexport function parseServerSentEvents<T = unknown>(response: Response, options?: ParseServerSentEventsOptions): AsyncGenerator<ServerSentEvent<T>>;Download method index JSON ↓ · Source digest 5f558e57b94420ef8fc60d9a8274a2ab5b92ac85d23f370a5bac4bc7ad2baae2