import { type HistoryEvent, type Span } from '#services/workflow_history/correlator.js'; export interface WorkflowMeta { workflowId?: string; runId?: string; status?: string; startTime?: string; closeTime?: string | null; historyLength?: number; taskQueue?: string; } export interface FetchWorkflowHistoryOptions { workflowId: string; runId?: string; includePayloads?: boolean; longPollTimeoutMs?: number; } export interface WorkflowHistoryResult { workflow: WorkflowMeta | null; rawWorkflow: WorkflowMeta | null; runId: string | null; events: HistoryEvent[]; spans: Span[]; totalDurationMs: number; continuedAsNewRunId: string | null; cursor: WorkflowHistoryCursor; } /** * Resume state for `fetchWorkflowHistoryUpdates`: the accumulated events (so spans/duration * are always computed over the full history, not just the latest delta), `lastEventId` for * de-duping a replayed page, and `pageToken` — the position that fetched the *current* end of * history, which is itself always a valid resume point (see `fetchPages`) even though the * server's own `nextPageToken` for that position is empty. */ export interface WorkflowHistoryCursor { pageToken: string | undefined; lastEventId: number; meta: WorkflowMeta | null; runId: string | undefined; events: HistoryEvent[]; } export declare function fetchWorkflowHistory(options: FetchWorkflowHistoryOptions): Promise; /** * Incremental counterpart to `fetchWorkflowHistory`, for a poller (`workflow monitor`) that * calls repeatedly while a workflow is still running. Pass the previous call's `cursor` * (from either function's result) to resume from where it left off instead of re-paging the * whole history; omit it only to start a completely fresh walk. */ export declare function fetchWorkflowHistoryUpdates(options: FetchWorkflowHistoryOptions, cursor?: WorkflowHistoryCursor): Promise<{ result: WorkflowHistoryResult; cursor: WorkflowHistoryCursor; }>;