import type { ClientOptions, ForkWorkflowResult, ForkExecutionOverride, ForkWorkflowOptions, StartWorkflowInput, UpsertScheduleInput, ScheduleInfo, StartDebouncedInput, ListWorkflowsOptions, ListWorkflowsResult, WorkflowDescription, WorkflowHistoryOptions, WorkflowHistoryResult, WorkflowPayloadRevealResult, NamespaceConfig, NamespaceStatusCounts, WorkerInventory, QueueBacklogSnapshot, DebounceSnapshot, SystemMetrics, RpcCallOptions, DurableOutputReadOptions, DurableOutputChunk, ApprovalWorkItem, ListApprovalsOptions, ListApprovalsResult, ApprovalMutationOptions, ApprovalDecisionInput, ApprovalMutationResult, CreateWorkflowEvaluationInput, ListWorkflowEvaluationsOptions, ListWorkflowEvaluationsResult, WorkflowEvaluationMutationResult } from '../types.js'; export declare class RpcCancelledError extends Error { constructor(); } /** * WorkflowClient — used by application code to start, signal, query, * and get results from workflows via gRPC. */ /** * P11.2 (F3): the run hit NonDeterminism against its own checkpoints and is * PARKED — resumable, not failed. Exits: reconnect a worker running the * run's pinned build (it resumes automatically), or fork from the last good * checkpoint (client.fork / the dashboard button) onto code whose prefix * matches up to that step. See docs/DEPLOY-PLAYBOOK.md. */ export declare class WorkflowBlockedError extends Error { constructor(detail: string); } export declare class WorkflowClient { private options; private client; constructor(options: ClientOptions); private unaryCall; private abortableDelay; /** * Start a new workflow execution. */ start(input: StartWorkflowInput, call?: RpcCallOptions): Promise<{ workflowId: string; runId: string; }>; /** * Send a signal to a running workflow. */ signal(workflowId: string, signalName: string, payload?: any, runId?: string, call?: RpcCallOptions): Promise; /** * Query a running workflow (read-only). */ query(workflowId: string, queryName: string, input?: any, runId?: string, call?: RpcCallOptions): Promise; getApproval(approvalId: string, call?: RpcCallOptions): Promise; listApprovals(options?: ListApprovalsOptions, call?: RpcCallOptions): Promise; claimApproval(approvalId: string, options?: ApprovalMutationOptions, call?: RpcCallOptions): Promise; decideApproval(approvalId: string, input: ApprovalDecisionInput, call?: RpcCallOptions): Promise; createWorkflowEvaluation(workflowId: string, input: CreateWorkflowEvaluationInput, call?: RpcCallOptions): Promise; listWorkflowEvaluations(workflowId: string, candidateRunId: string, options?: ListWorkflowEvaluationsOptions, call?: RpcCallOptions): Promise; /** * Get the result of a workflow. Uses server-streaming for instant notification, * falls back to polling if streaming fails. */ getResult(workflowId: string, runId?: string, timeoutMs?: number, call?: RpcCallOptions): Promise; private awaitCompletion; private pollResult; listWorkflows(options?: ListWorkflowsOptions, call?: RpcCallOptions): Promise; listNamespaces(call?: RpcCallOptions): Promise; getNamespaceStatusCounts(namespace?: string, call?: RpcCallOptions): Promise; getNamespaceConfig(namespace?: string, call?: RpcCallOptions): Promise; listWorkers(call?: RpcCallOptions): Promise; listQueues(namespace?: string, call?: RpcCallOptions): Promise; listDebounces(namespace?: string, call?: RpcCallOptions): Promise; getSystemMetrics(call?: RpcCallOptions): Promise; describe(workflowId: string, runId?: string, call?: RpcCallOptions): Promise; getWorkflowHistory(workflowId: string, options?: WorkflowHistoryOptions, call?: RpcCallOptions): Promise; revealWorkflowHistoryEventPayload(workflowId: string, runId: string, sequence: number, reason: string, call?: RpcCallOptions): Promise; /** Cancel a running workflow. */ cancel(workflowId: string, reason?: string, runId?: string, call?: RpcCallOptions): Promise; /** * Subscribe to a run's best-effort streaming step output (P3.5 — * `activityContext().stream(...)` chunks relayed live). Observability * ONLY: chunks emitted before you subscribed, while the relay was * saturated, or on another server are lost — the checkpoints remain the * durable truth. The stream never terminates on its own; call the * returned function to cancel. Errors end the subscription silently * (best-effort by contract). */ streamWorkflowOutput(workflowId: string, onChunk: (chunk: Buffer, stepSeq: number) => void, runId?: string): () => void; /** * Read a retained output stream in offset order. Full pages are fetched * automatically and transport interruptions resume from the last server * cursor, so callers can consume this directly with `for await`. */ readWorkflowOutput(workflowId: string, options: DurableOutputReadOptions): AsyncGenerator; /** * Create or replace a durable cron schedule. Idempotent re-registration * with the SAME cron_expr preserves the schedule's already-computed * next_fire_at (the server only resets the clock on a genuine * reconfiguration) — safe to call on every worker restart. */ upsertSchedule(input: UpsertScheduleInput, call?: RpcCallOptions): Promise<{ scheduleId: string; nextFireAt?: Date; }>; /** Remove a schedule. Idempotent — deleting an unknown scheduleId is not an error. */ deleteSchedule(scheduleId: string, call?: RpcCallOptions): Promise; /** List schedules registered in this client's namespace. */ listSchedules(call?: RpcCallOptions): Promise; /** * Collapse rapid repeated calls sharing `debounceKey` into ONE workflow * start, using the LAST-supplied input (last-write-wins), fired once * `windowMs` elapses since the most recent call. Returns immediately — * the actual StartWorkflow happens asynchronously once the server's * debounce poller observes the window has closed. */ startDebounced(input: StartDebouncedInput, call?: RpcCallOptions): Promise<{ workflowId: string; fireAt?: Date; }>; /** * P6.5 — restart-from-step (operational time travel). Creates a NEW run * (fresh run_id, same workflowId) seeded with checkpoints 0..=stepSeq * copied VERBATIM from `runId`, then dispatches it so it re-executes from * stepSeq+1 onward. * * The source run (`runId`) is NEVER mutated — forking is audit-preserving. * Rejected with a clear error if the source run is still RUNNING (only a * terminal run can be forked) or if `stepSeq` doesn't match any checkpoint * on the source run. See `WorkflowServiceImpl::fork_workflow` in * `crates/server/src/grpc/workflow_service.rs` for the full server-side * contract, including why claim-check blob refs (P3.4) are shared (not * copied) between the source and the fork. * * Server-only: this RPC has no equivalent on the embedded lite engine — * calling it against a lite-backed client is a configuration error, not a * silent no-op (see `ClientLite.fork` for the loud failure). */ fork(workflowId: string, runId: string, stepSeq: number, callOrOverrides?: RpcCallOptions | readonly ForkExecutionOverride[] | ForkWorkflowOptions, overrideCall?: RpcCallOptions): Promise; /** * Close the gRPC connection. */ close(): void; private getWorkflowResult; }