/** * Schemas for the type:"diagram" PI tool route (v0.2 slice 1). * * Four topologies ship in slice 1 — they cover every recipe in * skills/lumen-diagram/templates/ai-patterns.md (RAG, Agentic RAG, Mem0, * Multi-Agent). The remaining 11 fgraph topologies land as patch-series * extensions; new entries plug into FgraphContent's discriminated union. * * Coordinate philosophy: callers describe topology semantically (lane * indices, layer indices, compass positions) and the renderer computes * absolute --x/--y. The free-form topologies (system-architecture, * dual-cluster) that genuinely need pixel coords are deferred. */ /** Border / fill tone for nodes + arrows. */ export type FgraphTone = "amber" | "cyan" | "purple" | "green" | "red"; /** Node shape vocabulary — see lumen-diagram/SKILL.md table 2. */ export type FgraphShape = "rect" | "pill" | "circle" | "hexagon" | "diamond" | "cylinder" | "folded"; /** Edge semantic class — see lumen-diagram/SKILL.md table 3. */ export type FgraphSemantic = "data" | "control" | "write" | "feedback" | "async"; /** Optional edge style modifiers. Compose with semantic. */ export type FgraphEdgeStyle = "dashed" | "thick"; export interface FgraphNode { name: string; sub?: string; subMuted?: string; tone?: FgraphTone; shape?: FgraphShape; } export interface FgraphEdge { from: number; to: number; label?: string; semantic?: FgraphSemantic; style?: FgraphEdgeStyle; tone?: FgraphTone; } /** Compass position around the hub (radial-hub). */ export type RadialPosition = "top" | "top-right" | "right" | "bottom-right" | "bottom" | "bottom-left" | "left" | "top-left"; export interface SequenceParticipant { name: string; tone?: FgraphTone; sub?: string; } export interface SequenceMessage { from: number; to: number; label: string; /** "request" = solid forward call; "return" = dashed return / response. */ kind?: "request" | "return"; tone?: FgraphTone; } export interface SequenceContent { topology: "sequence"; participants: SequenceParticipant[]; messages: SequenceMessage[]; legend?: string; } export interface LayeredLayer { label: string; nodes: FgraphNode[]; } export interface LayeredEdge { fromLayer: number; toLayer: number; semantic?: FgraphSemantic; style?: FgraphEdgeStyle; label?: string; } export interface LayeredContent { topology: "layered"; layers: LayeredLayer[]; edges?: LayeredEdge[]; legend?: string; } export interface LinearFlowContent { topology: "linear-flow"; stages: FgraphNode[]; /** Defaults to implicit chain (0→1, 1→2, …). Provide to override semantics. */ edges?: FgraphEdge[]; legend?: string; } export interface RadialSpoke extends FgraphNode { position: RadialPosition; semantic?: FgraphSemantic; /** Edge direction relative to hub. Default "both". */ direction?: "in" | "out" | "both"; style?: FgraphEdgeStyle; } export interface RadialHubContent { topology: "radial-hub"; hub: FgraphNode; spokes: RadialSpoke[]; legend?: string; } export interface RadialRingContent { topology: "radial-ring"; nodes: FgraphNode[]; edges?: FgraphEdge[]; legend?: string; } export interface LaneSwimContent { topology: "lane-swim"; lanes: { label: string; nodes: FgraphNode[]; }[]; edges?: FgraphEdge[]; legend?: string; } export interface DeploymentTiersContent { topology: "deployment-tiers"; tiers: { label: string; nodes: FgraphNode[]; replicas?: number; }[]; edges?: LayeredEdge[]; legend?: string; } export interface MachineClustersContent { topology: "machine-clusters"; hosts: { name: string; nodes: FgraphNode[]; }[]; edges?: FgraphEdge[]; legend?: string; } export interface StateContent { topology: "state"; states: { name: string; tone?: FgraphTone; shape?: FgraphShape; initial?: boolean; final?: boolean; sub?: string; }[]; transitions: { from: number; to: number; label?: string; tone?: FgraphTone; }[]; legend?: string; } export interface GanttContent { topology: "gantt"; tasks: { name: string; start: number; duration: number; tone?: FgraphTone; row?: number; }[]; timeUnit?: string; legend?: string; } export interface PieContent { topology: "pie"; slices: { name: string; value: number; tone?: FgraphTone; }[]; legend?: string; } export interface ErContent { topology: "er"; entities: { name: string; attributes: { name: string; type?: string; key?: boolean; }[]; }[]; relationships: { from: number; to: number; type?: string; label?: string; }[]; legend?: string; } export interface DepGraphContent { topology: "dep-graph"; nodes: FgraphNode[]; edges: { from: number; to: number; label?: string; tone?: FgraphTone; }[]; legend?: string; } export interface DualClusterContent { topology: "dual-cluster"; clusterA: { label: string; nodes: FgraphNode[]; }; clusterB: { label: string; nodes: FgraphNode[]; }; edges?: { fromCluster: "A" | "B"; fromIdx: number; toCluster: "A" | "B"; toIdx: number; label?: string; tone?: FgraphTone; }[]; legend?: string; } export interface SystemArchitectureContent { topology: "system-architecture"; zones: { label: string; nodes: FgraphNode[]; }[]; edges?: FgraphEdge[]; legend?: string; } export type FgraphContent = SequenceContent | LayeredContent | LinearFlowContent | RadialHubContent | RadialRingContent | LaneSwimContent | DeploymentTiersContent | MachineClustersContent | StateContent | GanttContent | PieContent | ErContent | DepGraphContent | DualClusterContent | SystemArchitectureContent; export declare const SUPPORTED_TOPOLOGIES: readonly ["sequence", "layered", "linear-flow", "radial-hub", "radial-ring", "lane-swim", "deployment-tiers", "machine-clusters", "state", "gantt", "pie", "er", "dep-graph", "dual-cluster", "system-architecture"]; export type SupportedTopology = (typeof SUPPORTED_TOPOLOGIES)[number]; /** * Validate + normalize an untrusted `content` object from the PI tool param. * Throws Error with a precise path on any structural problem. */ export declare function parseFgraphContent(raw: unknown): FgraphContent; //# sourceMappingURL=schemas.d.ts.map