export type DiagramType = 'flowchart' | 'sequence' | 'class' | 'er' | 'architecture' | 'storymap'; export type DiagramNodeShape = 'rectangle' | 'rounded' | 'circle' | 'diamond' | 'hexagon' | 'stadium'; export type DiagramNode = { id: string; label: string; shape?: DiagramNodeShape; group?: string; style?: string; }; /** * Explicit relationship cardinality for an ER edge, read from source→target. When * set, it overrides the label/style/group heuristics in determineCardinality, so an * object-names-only ERD renders predictable crow's-feet without FK-row matching. */ export type EdgeCardinality = '1:1' | '1:N' | 'N:1' | 'N:M' | '0:1' | '0:N'; /** * UML class-relation kind for a `class` diagram edge, read from source→target. * Drives the standard markers: inheritance/realization → hollow triangle on the * parent; composition → filled diamond on the whole; aggregation → hollow diamond; * dependency → dashed open arrow; association → plain open arrow. */ export type ClassRelation = 'association' | 'inheritance' | 'realization' | 'composition' | 'aggregation' | 'dependency'; export type DiagramEdge = { from: string; to: string; label?: string; style?: 'solid' | 'dashed' | 'dotted' | 'thick'; arrowhead?: 'normal' | 'open' | 'none'; cardinality?: EdgeCardinality; relation?: ClassRelation; }; export type DiagramLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL'; /** * A sequence-diagram participant. Accepts a bare string (id used as label) or an * `{ id, label }` object so actors can carry a readable label distinct from the id * referenced by messages (e.g. id `sp` labelled "Service Provider (SP)"). */ export type DiagramParticipant = string | { id: string; label?: string; }; /** * A story-map board (Jeff Patton / Lucid layout). All zones are OPTIONAL except * `features` and `stories` — a board may carry only those (or only epics). The * renderer draws a zone only when its array is present and non-empty, so a sparse * map (e.g. just features + stories) renders cleanly without empty bands. * * Layout: a vertical "Retos" column on the left; horizontal rows for Roles, * Objetivos, Features (the backbone, left→right); and the user stories arranged in * a grid of feature-columns × priority-rows beneath their feature. */ export type StoryMap = { personas?: Array<{ id: string; label: string; }>; retos?: string[]; roles?: string[]; objetivos?: string[]; features: Array<{ id: string; label: string; }>; /** * Story cards. `feature` ties a card to its column; `priority` to its row band. * `size` is the t-shirt estimate — when present it enables Format 2 (per-feature * pages with sizing badges); absent, the gate falls back to Format 1. */ stories: Array<{ id?: string; label: string; feature: string; persona?: string; priority?: string; size?: 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL'; /** * Dual-layer association (Format 2): a TECHNICAL story sets `parent` to the id * of the functional story it enables, so it renders indented + tinted under it. * `kind` may be given explicitly; when omitted it is inferred (a story with a * `parent` is technical, else functional). */ parent?: string; kind?: 'functional' | 'technical'; }>; /** Optional epic band when the map is expressed as epics rather than features. */ epics?: Array<{ id: string; label: string; }>; }; export type AgentDiagramData = { type: DiagramType; title?: string; direction?: DiagramLayoutDirection; nodes?: DiagramNode[]; edges?: DiagramEdge[]; participants?: DiagramParticipant[]; messages?: Array<{ from: string; to: string; label: string; type?: 'sync' | 'async' | 'reply'; }>; /** Present when `type === 'storymap'`. */ storyMap?: StoryMap; /** * Story-map board format (story-map type only). 1 = zonal overview board * (default). 2 = per-feature multi-page breakdown with t-shirt sizing badges. * When omitted, the renderer auto-detects: Format 2 if every story has a `size`, * else Format 1 — matching the skill's selection gate (GH-430). */ storyMapFormat?: 1 | 2; }; export type DiagramOutputFormat = 'mermaid' | 'maxgraph-json' | 'drawio'; export type MaxGraphNode = { id: string; value: string; x: number; y: number; width: number; height: number; style?: string; parent?: string; }; export type MaxGraphEdge = { id: string; source: string; target: string; value?: string; style?: string; }; export type MaxGraphJson = { nodes: MaxGraphNode[]; edges: MaxGraphEdge[]; };