UNPKG

@workflow-manager/runner

Version:

CLI runner for in-memory and markdown workflow orchestration using ATEP-like envelopes

63 lines (62 loc) 2.41 kB
import type { ApprovalDecisionPayload, ApprovalRequest, RunEvent, RunController, RunObserver, RunnerEventEnvelope, RunnerLogChunk, RunnerSessionInfo, RunSnapshot, StepDetailSnapshot, WorkflowDefinition } from "./types.js"; interface RunnerSessionStoreOptions { runId: string; workflow: WorkflowDefinition; objective: string; objectives: string[]; host?: string; port?: number; attachToken?: string; startedAt?: string; sessionId?: string; } interface LogListResult { items: RunnerLogChunk[]; nextCursor: string | null; } type Subscriber = (event: RunnerEventEnvelope) => void; export declare class RunnerSessionStore implements RunObserver, RunController { private readonly workflow; private readonly subscribers; private readonly maxLogChunks; private snapshotState; private stepDetailsState; private readonly eventHistory; private readonly logHistory; private readonly sessionState; private pendingApproval; constructor(options: RunnerSessionStoreOptions); setBinding(host: string, port: number): void; sessionInfo(): RunnerSessionInfo; attachToken(): string; runId(): string; snapshot(): RunSnapshot; stepDetail(stepKey: string): StepDetailSnapshot | null; listLogs(stepKey?: string, limit?: number, cursor?: string): LogListResult; events(sinceSequence?: number, includeLogs?: boolean): RunnerEventEnvelope[]; subscribe(listener: Subscriber): () => void; onEvent(event: RunEvent): void; onSnapshot(snapshot: RunSnapshot, stepDetails: StepDetailSnapshot[]): void; onLog(log: RunnerLogChunk): void; publicSession(): Omit<RunnerSessionInfo, "attachToken">; isKnownRun(runId: string): boolean; workflowDefinition(): WorkflowDefinition; waitForDecision(request: ApprovalRequest): Promise<ApprovalDecisionPayload>; approve(stepKey?: string, metadata?: Omit<ApprovalDecisionPayload, "decision">): { ok: boolean; reason?: string; stepKey?: string; }; resume(stepKey?: string, metadata?: Omit<ApprovalDecisionPayload, "decision">): { ok: boolean; reason?: string; stepKey?: string; }; cancel(stepKey?: string, metadata?: Omit<ApprovalDecisionPayload, "decision">): { ok: boolean; reason?: string; stepKey?: string; }; private resolvePendingApproval; } export {};