/** * A sparse character grid for drawing the workflow graph. Box-drawing * characters merge by connectivity (│ crossing ─ becomes ┼) so overlapping * edge polylines join instead of overwriting each other. */ export type CanvasStyle = "plain" | "dim" | "taken" | "active" | "back" | "ok" | "fail" | "warn" | "branch" | "agent" | "compute" | "action" | "checkpoint"; export declare const UP = 1; export declare const DOWN = 2; export declare const LEFT = 4; export declare const RIGHT = 8; /** Which sides each box-drawing character connects to (exported for tests). */ export declare const CHAR_TO_MASK: Record; export declare class CharCanvas { private readonly cells; private maxX; private maxY; private row; /** Place a single character, merging box-drawing connectivity. */ put(x: number, y: number, char: string, style?: CanvasStyle): void; /** Write a text run left to right (labels, node lines). */ text(x: number, y: number, value: string, style?: CanvasStyle): void; /** * Write text only when every target cell is empty. Returns whether the * text was written. Used for optional decorations (edge labels) that must * never corrupt lines or nodes already on the canvas. */ textIfEmpty(x: number, y: number, value: string, style?: CanvasStyle): boolean; /** * Write text over a plain horizontal run, replacing `─` cells only. * Refuses (returns false) unless every target cell and both flanking * cells are exactly `─`, so a label can never overwrite or sit against * corners, crossings, or other labels. Spaces in `value` become real * blanks, visually breaking the run around the label on purpose. */ textOverRun(x: number, y: number, value: string, style?: CanvasStyle): boolean; hline(y: number, x1: number, x2: number, style?: CanvasStyle): void; vline(x: number, y1: number, y2: number, style?: CanvasStyle): void; /** Render to lines; `paint` applies terminal styling per character run. */ render(paint: (text: string, style: CanvasStyle) => string): string[]; }