/** * Server-side SVG layout for a `CanvasGraph` (see core/canvas-graph.ts), * emitting markup against the classes `core/canvas-template.ts`'s CSS shell * already defines (node--entry/step/pause/terminal-success/terminal-warn/ * launched-workflow, canvas-edge/--success/--warn/--cross/--launch). No DOM, * no client-side script — the * whole diagram is a static string built once, at render time. * * Layout: longest-path-from-roots layering (a Kahn's-algorithm variant), * robust to reconverging branches (diamonds) and defensively bounded against * a cycle (a malformed/adversarial manifest should degrade, not hang). Ported * from the layout math in an earlier client-side renderer (see git history of * canvas-template.ts, commit "canvas kit — LLM writes data, not HTML") — the * geometry is unchanged, only where it runs (server, not browser). */ import type { CanvasEdge, CanvasEdgeKind, CanvasGraph, CanvasNode, CanvasNodeKind } from "./canvas-graph.js"; import type { CanvasEnrichment, CanvasLayoutHints } from "./canvas-enrichment.js"; export declare const NODE_W = 176; export declare const NODE_H = 64; export interface GraphLayout { pos: Record; width: number; height: number; } /** Assigns each node the longest-path layer reachable from a root (an * in-degree-0 node). Nodes never reached by a root (only possible on a * disconnected/cyclic fragment) fall to the layer just past the deepest * known one, so they still render instead of vanishing. */ export declare function computeLayers(nodes: readonly CanvasNode[], edges: readonly CanvasEdge[]): Map; /** Computes (x, y) for every node and the overall canvas size. Each node is * placed at the BARYCENTRE of its already-placed parents (so a single-child * step sits directly under its parent's lane, and a merge node centres between * the branches that feed it — the two paths converge symmetrically instead of * a straight chain being forced dead-centre while a side branch has to detour * around it). Within a layer, order follows the (laneOrder-applied) sequence * and nodes are spread to a minimum spacing, then re-balanced onto the parent * barycentre. Layers stack top to bottom; layer assignment stays purely * structural (computeLayers). */ export declare function layoutGraph(graph: CanvasGraph, laneOrder?: CanvasLayoutHints["laneOrder"]): GraphLayout; /** Renders one graph's `` diagram, merging in any enrichment content * (node sublabels/descriptions, edge labels, group bands, lane order) — all * of it pre-bounded plain strings (core/canvas-enrichment.ts), escaped here * like every other text. Assumes the shared `` (glow filter + arrow * markers) are already present once at the document level — see * `renderCanvasDocument`'s `SVG_DEFS` — so this never emits its own. */ export declare function renderGraphSvg(graph: CanvasGraph, enrichment?: CanvasEnrichment | null): string; /** Every node/edge kind actually used, for the shared legend footer. */ export declare function usedKinds(graph: CanvasGraph): { nodeKinds: Set; edgeKinds: Set; }; //# sourceMappingURL=canvas-svg.d.ts.map