UNPKG

@workflow-manager/runner

Version:

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

84 lines (83 loc) 2.33 kB
import type { RunEvent, RunObserver, RunSnapshot, RunnerLogChunk, StepDetailSnapshot, WorkflowDefinition } from "../types.js"; import { type KeyEvent } from "./screen.js"; export interface TuiSessionControls { approve(stepKey?: string, metadata?: { actor?: string; note?: string; source?: string; }): { ok: boolean; reason?: string; }; resume(stepKey?: string, metadata?: { actor?: string; note?: string; source?: string; }): { ok: boolean; reason?: string; }; cancel(stepKey?: string, metadata?: { actor?: string; note?: string; source?: string; }): { ok: boolean; reason?: string; }; } export interface TuiRunRendererOptions { workflow: WorkflowDefinition; session: TuiSessionControls; attachUrl: string; attachToken: string; stdout?: NodeJS.WriteStream; stdin?: NodeJS.ReadStream; redrawMs?: number; tickMs?: number; now?: () => number; colorEnabled?: boolean; } export declare class TuiRunRenderer implements RunObserver { private readonly workflow; private readonly session; private readonly attachUrl; private readonly attachToken; private readonly stdout; private readonly stdin; private readonly redrawMs; private readonly tickMs; private readonly nowFn; private readonly theme; private readonly screen; private snapshot; private stepDetails; private readonly logs; private selectedStepKey; private follow; private statusMessage; private statusMessageExpiresAt; private dirty; private redrawTimer; private tickTimer; private started; private stopped; constructor(options: TuiRunRendererOptions); start(): void; stop(): void; onSnapshot(snapshot: RunSnapshot, stepDetails: StepDetailSnapshot[]): void; onEvent(event: RunEvent): void; onLog(log: RunnerLogChunk): void; handleKey: (key: KeyEvent) => void; renderNow(): string[]; private handleResize; private handleApprove; private handleResume; private handleCancel; private handleQuit; private moveSelection; private setStatusMessage; private currentStatusMessage; private markDirty; private composeFrame; }