/** * Diagram-native AST and RenderPlan types for MarkdyScript 0.8+. * Zero runtime dependencies. */ type LayoutDirection = "LR" | "RL" | "TB" | "BT"; type EdgeKind = "request" | "response" | "event" | "dependency"; type DiagramType = "architecture" | "flowchart" | "tree" | "state" | "sequence" | "constellation" | "loop" | "flywheel" | "medallion" | "quadrant" | "swimlane" | "pyramid" | "radar" | "timeline" | "gantt" | "venn" | "layers" | "nested"; type NodeShape = "card" | "rounded" | "diamond" | "circle" | "pill" | "terminal" | "container"; type PlayerProgress = "none" | "bar" | "boundary"; /** When and how fast the timeline runs. */ type PlayerPlaybackConfig = { autoplay?: boolean; loop?: boolean; rate?: number; }; /** Which toolbar affordances are mounted. Declaring the group opts in. */ type PlayerControlsConfig = { seek?: boolean; speed?: boolean; fit?: boolean; interact?: boolean; resetView?: boolean; fullscreen?: boolean; svg?: boolean; gif?: boolean; share?: boolean; /** Show the MarkdyScript source code when clicked. */ code?: boolean; /** Theme switcher toggle (dark / light palettes). */ theme?: boolean; /** Speed multipliers offered by the speed buttons. */ speeds?: number[]; }; type PlayerControlsInput = PlayerControlsConfig & { /** Alias for resetView */ focus?: boolean; [key: string]: unknown; }; /** What pointer and key input do. Declaring the group opts in. */ type PlayerInteractionConfig = { zoom?: boolean; pan?: boolean; clickToPlay?: boolean; doubleClickToReset?: boolean; /** Window-level shortcuts; opt-in because they capture space and arrows. */ keyboard?: boolean; }; /** Non-interactive decoration drawn around the scene. */ type PlayerChromeConfig = { badge?: boolean; progress?: PlayerProgress; progressColor?: string; }; type PlayerConfig = { playback?: PlayerPlaybackConfig; controls?: PlayerControlsInput; interaction?: PlayerInteractionConfig; chrome?: PlayerChromeConfig; }; /** Fully defaulted player behavior produced by `resolvePlayer`. `enabled` is * derived: a group is on when at least one of its affordances is on. */ type ResolvedPlayer = { playback: Required; controls: Required & { enabled: boolean; }; interaction: Required & { enabled: boolean; }; chrome: { badge: boolean; progress: PlayerProgress; progressColor?: string; }; }; type DefaultThemesConfig = { light?: string; dark?: string; }; type SceneMeta = { title?: string; width: number; height: number; fps: number; theme: string; direction: LayoutDirection; duration?: number; /** Whether width was explicitly specified by the author in the script. */ explicitWidth?: boolean; /** Whether height was explicitly specified by the author in the script. */ explicitHeight?: boolean; /** Whether theme was explicitly specified by the author in the script. */ explicitTheme?: boolean; /** Default theme names for light and dark modes when following host environment. */ defaultThemes?: DefaultThemesConfig; /** Whether layout direction was explicitly specified by the author in the script. */ explicitDirection?: boolean; /** Layout mode: explicit fixed direction or adaptive auto. */ layoutMode?: "auto" | "explicit"; /** Opt-in diagram mode; defaults to architecture. */ type?: DiagramType; /** Playback, controls, interaction, and chrome behavior. Source of truth. */ player?: PlayerConfig; /** @deprecated Mirror of `player.chrome.progressColor`. */ progressColor?: string; /** @deprecated Mirror of `player.controls.enabled`. */ controls?: boolean; /** @deprecated Mirror of `player.interaction.enabled`. */ interactiveViewport?: boolean; /** @deprecated Mirror of `player.playback.autoplay`. */ autoplay?: boolean; /** @deprecated Mirror of `player.playback.loop`. */ loop?: boolean; /** @deprecated Mirror of `player.chrome.badge`. */ copyright?: boolean; /** @deprecated Mirror of `player.playback.rate`. */ playbackRate?: number; }; type NodeDecl = { kind: string; id: string; label: string; style?: string; props: Record; line: number; }; type EdgeDecl = { id: string; kind: EdgeKind; from: string; to: string; label?: string; props: Record; line: number; }; type GroupDecl = { id: string; label?: string; members: string[]; props: Record; line: number; }; type AnnotationDecl = { id: string; text: string; target?: string; position?: string; /** Callout color intent: neutral (default), accent, or muted. */ intent?: string; props: Record; line: number; }; type StyleDecl = { name: string; props: Record; line: number; }; type FlowSegment = { from: string; op: EdgeKind; to: string; label?: string; }; type Cue = { kind: "flow"; segments: FlowSegment[]; dur?: number; line: number; } | { kind: "show"; targets: string[]; stagger?: number; dur?: number; line: number; } | { kind: "hide"; targets: string[]; dur?: number; line: number; } | { kind: "glow"; targets: string[]; color?: string; strength?: number; dur?: number; line: number; } | { kind: "focus"; targets: string[]; zoom?: number; dur?: number; line: number; } | { kind: "frame"; targets: string[]; zoom?: number; dur?: number; line: number; } | { kind: "use"; pattern: string; args: Record; line: number; } | { kind: "parallel"; cues: Cue[]; line: number; }; type BeatDecl = { name: string; label?: string; cues: Cue[]; dur?: number; line: number; }; type PatternDecl = { name: string; params: string[]; body: Cue[]; line: number; }; type Diagnostic = { severity: "error" | "warning"; message: string; line: number; column?: number; }; type DiagramAST = { meta: SceneMeta; styles: Record; nodes: Record; edges: EdgeDecl[]; groups: Record; annotations: AnnotationDecl[]; patterns: Record; beats: BeatDecl[]; diagnostics: Diagnostic[]; }; type ThemeTokens = { name: string; canvas: string; surface: string; surfaceRaised: string; border: string; text: string; textMuted: string; gridMinor: string; gridMajor: string; vignette: string; accent: string; /** HTTP / external link accent (editorial skin). */ link?: string; /** Semantic editorial aliases for canvas/text/muted/border roles. */ paper?: string; ink?: string; muted?: string; rule?: string; /** Tertiary caption color. */ soft?: string; /** Focal node fill tint. */ accentTint?: string; /** Node card fill (falls back to surface derivations when omitted). */ nodeSurface?: string; nodeSurfaceRaised?: string; /** Node hairline / inset ring color. */ hairline?: string; /** Ambient drop-shadow color (rgba). */ shadow?: string; /** Edge label pill fill. */ labelPlate?: string; /** Editorial: flat cards without drop shadows. */ flatCards?: boolean; roles: Record; edges: Record; /** Multi-series palette for chart types (radar, line, bar). */ series?: string[]; fonts?: { title?: string; nodeName?: string; mono?: string; }; radiusMd?: number; spacing?: { xs: number; sm: number; md: number; lg: number; xl: number; }; }; type PositionedNode = { id: string; kind: string; role: string; label: string; x: number; y: number; width: number; height: number; style?: Record; props?: Record; opacity: number; shape?: NodeShape; focal?: boolean; /** Sequence mode column index. */ column?: number; }; type RoutedEdge = { id: string; kind: EdgeKind; from: string; to: string; label?: string; /** Declared via top-level `edge` (not only flow cues). */ structural?: boolean; selfLoop?: boolean; }; type GroupBoundary = { id: string; label?: string; x: number; y: number; width: number; height: number; memberIds: string[]; props?: Record; }; type SequenceMessage = { id: string; from: string; to: string; kind: EdgeKind; label?: string; y: number; start: number; duration: number; beat: string; }; type SequenceActivation = { id: string; participant: string; y: number; height: number; start: number; duration: number; }; type TreeBus = { id: string; parentId: string; childIds: string[]; parentX: number; parentY: number; branchY: number; childXs: number[]; childY: number; childYs?: number[]; vertical?: boolean; }; type TimedCue = { start: number; duration: number; kind: "show" | "hide" | "flow" | "glow" | "focus" | "frame"; targets: string[]; edgeId?: string; segments?: FlowSegment[]; params: Record; beat: string; }; type BeatRange = { name: string; label?: string; start: number; end: number; }; type RenderPlan = { meta: SceneMeta; theme: ThemeTokens; title: string; diagramType: DiagramType; nodes: PositionedNode[]; edges: RoutedEdge[]; groupBoundaries: GroupBoundary[]; annotations: AnnotationDecl[]; cues: TimedCue[]; beats: BeatRange[]; groups: Record; treeBuses: TreeBus[]; sequenceMessages: SequenceMessage[]; sequenceActivations: SequenceActivation[]; duration: number; }; declare function computeNodeDimensions(decl: NodeDecl, baseW?: number, baseH?: number): { width: number; height: number; }; /** * Computes optimal, content-adaptive canvas width and height for a diagram AST * when dimensions are omitted or partially specified in the script. */ declare function computeAdaptiveDimensions(ast: DiagramAST, edges?: RoutedEdge[]): { width: number; height: number; }; declare function compilePlan(ast: DiagramAST, theme: ThemeTokens): RenderPlan; /** * Diagram-native MarkdyScript parser and compiler. */ declare class ParseError extends Error { readonly line: number; readonly column?: number; constructor(message: string, line: number, column?: number); } type ParseResult = { ast: DiagramAST; plan: RenderPlan; }; type ParseOptions = { /** When true, only parse without compiling layout/schedule. */ parseOnly?: boolean; }; declare function parse(source: string, opts?: ParseOptions): DiagramAST; declare function compile(ast: DiagramAST): RenderPlan; declare function parseAndCompile(source: string): ParseResult; /** * Single source of truth for player configuration: schema, aliases, parsing, * and default resolution. Hosts (DOM renderer, Astro, MDX, CLI) resolve * behavior through `resolvePlayer` instead of re-deriving defaults. */ /** Groups own their own alias table, so `speed` can mean rate at the player * root and the speed buttons inside `controls:`. */ type PlayerScope = "player" | "playback" | "controls" | "interaction" | "chrome"; declare const PLAYER_GROUPS: readonly ["playback", "controls", "interaction", "chrome"]; /** Keys usable as `scene` props and top-level directives. */ declare const PLAYER_FLAT_KEYS: string[]; /** * Applies one `key value` pair into `config`. Returns an error message when the * key is unknown or the value does not fit the setting type. */ declare function applyPlayerSetting(config: PlayerConfig, scope: PlayerScope, key: string, rawValue: string): string | undefined; /** Host behavior overrides. `false` gates a feature off; `true` supplies legacy defaults when script values are absent. */ type PlayerOverrides = { autoplay?: boolean; loop?: boolean; playbackRate?: number; copyright?: boolean; controls?: boolean | (PlayerControlsInput & { playback?: boolean; }); interactiveViewport?: boolean; clickToPlay?: boolean; progress?: PlayerProgress; progressColor?: string; }; declare function resolvePlayer(config?: PlayerConfig, overrides?: PlayerOverrides): ResolvedPlayer; declare const THEMES: Record; declare function resolveTheme(name: string): ThemeTokens; /** * packages/core/src/theme-generator.ts * Algorithmic Theme Token Generator for Markdy. * Computes WCAG-compliant high-contrast theme palettes from any base brand color. * Zero external dependencies. */ interface ThemeGeneratorOptions { name: string; accentHex: string; mode?: "light" | "dark"; canvasHex?: string; inkHex?: string; } /** * Dynamically computes a cohesive ThemeTokens set from an accent color. */ declare function generateThemeFromBrand(opts: ThemeGeneratorOptions): ThemeTokens; declare const NODE_KINDS: Set; declare const DIAGRAM_TYPES: Set; declare const EDGE_OPERATORS: Record; /** Natural-language cue synonyms that AIs reach for, mapped to real cues. */ declare const CUE_ALIASES: Record; declare const BEAT_CUE_KEYWORDS: Set; declare const SCENE_KEYS: Set; declare function nodeRole(kind: string): string; declare function humanizeId(id: string): string; /** Node kind aliases for concise authoring. */ declare const NODE_ALIASES: Record; declare function canonicalNodeKind(kind: string): string; declare const TECHNICAL_NODE_TYPES: readonly ["service", "api", "microservice", "backend", "server", "worker", "job", "scheduler", "cron", "batch", "function", "lambda", "edge", "controller", "handler", "repository", "module", "package", "library", "sdk", "cli", "runtime", "process", "client", "user", "browser", "web", "mobile", "desktop", "frontend", "app", "page", "view", "component", "store", "db", "database", "sql", "nosql", "table", "index", "warehouse", "lake", "object_store", "storage", "bucket", "blob", "volume", "disk", "search", "cache", "queue", "topic", "stream", "event", "event_bus", "bus", "broker", "pubsub", "kafka", "producer", "consumer", "dead_letter", "dlq", "webhook", "cloud", "region", "vpc", "subnet", "network", "internet", "dns", "cdn", "proxy", "gateway", "api_gateway", "load_balancer", "reverse_proxy", "router", "switch", "nat", "firewall", "waf", "vpn", "bastion", "container", "cluster", "pod", "node", "deployment", "replicaset", "statefulset", "daemonset", "namespace", "ingress", "service_mesh", "sidecar", "image", "registry", "docker", "compose", "helm", "chart", "configmap", "pvc", "auth", "identity", "oauth", "oidc", "jwt", "session", "policy", "role", "permission", "vault", "secret", "key", "certificate", "security", "repo", "branch", "commit", "pipeline", "workflow", "runner", "build", "test", "artifact", "deploy", "release", "environment", "preview", "monitor", "metrics", "logs", "trace", "alert", "dashboard", "probe", "slo", "start", "end", "state", "decision", "condition", "step", "loop", "sequence", "participant", "hub", "station", "bronze", "silver", "gold", "lane", "replica", "shard", "leader", "follower", "quorum", "consensus", "lock", "class", "interface", "method", "object", "enum", "type"]; declare const VISUAL_PRIMITIVE_TYPES: readonly ["panel", "surface", "terminal", "metric", "stat", "grid", "matrix", "lane", "track", "marker", "dot", "token_strip", "chips", "glyph_card", "glyph", "external", "optional"]; declare const TECHNICAL_NODE_KINDS: Record<(typeof TECHNICAL_NODE_TYPES)[number], string>; /** * packages/core/src/arch-lint.ts * Architecture topology and governance validation for MarkdyScript ASTs. * Zero runtime dependencies. */ type RuleSeverity = "error" | "warning" | "info"; type ArchRuleType = "cannot-connect" | "must-connect" | "forbidden-cycle" | "must-have-role" | "role-count-limit"; interface NodeSelector { id?: string; kindEquals?: string; roleEquals?: string; labelContains?: string; } interface EdgeSelector { kind?: EdgeKind; labelContains?: string; } interface ArchitectureRule { id: string; name: string; description: string; severity: RuleSeverity; type: ArchRuleType; from?: NodeSelector; to?: NodeSelector; edge?: EdgeSelector; min?: number; max?: number; } interface ArchitectureViolation { ruleId: string; ruleName: string; message: string; severity: RuleSeverity; nodeIds: string[]; edgeKeys: string[]; line?: number; } interface ArchitecturePreset { id: string; name: string; description: string; rules: ArchitectureRule[]; } declare const ARCH_RULE_PRESETS: Record; declare function validateArchitecture(ast: DiagramAST, rules?: ArchitectureRule[]): ArchitectureViolation[]; interface MarkdyConfig { extends?: string[]; rules?: (ArchitectureRule | string)[]; severityOverrides?: Record; } declare function resolveArchitectureConfig(config?: MarkdyConfig | null): ArchitectureRule[]; /** * packages/core/src/classifier.ts * Deep Technology and Semantic Classifier for Markdy. * Zero external dependencies. */ interface SemanticProfile { kind: string; role: string; suggestedTheme: string; badge?: string; } declare function classifyTechnology(id: string, label?: string): SemanticProfile; /** * packages/core/src/diff.ts * Architectural Evolution and Git-Diff Engine for Markdy. * Calculates structural deltas between two architectural states and generates animated migration storyboards. * Zero external dependencies. */ type DiffChangeType = "added" | "removed" | "modified" | "unchanged"; interface NodeDiff { id: string; status: DiffChangeType; before?: NodeDecl; after?: NodeDecl; changes: string[]; } interface EdgeDiff { key: string; status: DiffChangeType; before?: EdgeDecl; after?: EdgeDecl; changes: string[]; } interface GroupDiff { id: string; status: DiffChangeType; before?: GroupDecl; after?: GroupDecl; changes: string[]; } interface DiagramDiffResult { nodes: NodeDiff[]; edges: EdgeDiff[]; groups: GroupDiff[]; addedNodesCount: number; removedNodesCount: number; modifiedNodesCount: number; addedEdgesCount: number; removedEdgesCount: number; summaryMarkdown: string; evolutionMarkdyScript: string; } /** * Compares two Diagram ASTs to produce a comprehensive architectural evolution report. */ declare function diffDiagramASTs(beforeAST: DiagramAST, afterAST: DiagramAST): DiagramDiffResult; /** * packages/core/src/url-codec.ts * Web Standard CompressionStream / DecompressionStream state codec for Markdy. * Zero external dependencies. Works across modern browsers, Node, Bun, Deno. */ declare function compressMarkdyToUrlHash(code: string): Promise; declare function decompressMarkdyFromUrlHash(hash: string): Promise; /** * packages/core/src/router.ts * Collision-aware Orthogonal Manhattan Router with Dynamic Port Multiplexing. * Clean-room re-engineered for Markdy. * Zero external dependencies. */ interface Point { x: number; y: number; } interface Box { x: number; y: number; width: number; height: number; } type CardinalPort = "left" | "right" | "top" | "bottom"; interface PortLane { index: number; total: number; } interface RouteOptions { sourceLane?: PortLane; targetLane?: PortLane; sourcePort?: CardinalPort; targetPort?: CardinalPort; cornerRadius?: number; margin?: number; obstacles?: Box[]; } interface RoutedPath { sourcePort: CardinalPort; targetPort: CardinalPort; startPoint: Point; endPoint: Point; waypoints: Point[]; svgPathData: string; } /** * Calculates the exact point of connection on a bounding box for a given cardinal port and dynamic lane. */ declare function getBoxPortPosition(box: Box, port: CardinalPort, lane?: PortLane): Point; /** * Automatically chooses the optimal cardinal ports connecting two bounding boxes. */ declare function selectOptimalPorts(sourceBox: Box, targetBox: Box): { sourcePort: CardinalPort; targetPort: CardinalPort; }; /** * Builds an SVG path string with optional smooth fillet rounded corners. */ declare function buildSmoothSvgPath(start: Point, waypoints: Point[], end: Point, cornerRadius?: number): string; /** * Routes an orthogonal edge between two boxes with collision awareness and dynamic port multiplexing. */ declare function routeOrthogonalEdge(sourceBox: Box, targetBox: Box, options?: RouteOptions): RoutedPath; /** * Dynamic Port Multiplexer: * Allocates balanced, collision-free port lanes for multiple edges attaching to the same node boundary. * Seamlessly handles multi-edge fan-in/fan-out and bidirectional request/response pairs without overlapping. */ declare function allocatePortLanes(edges: T[], boxes: Record): Map; /** * packages/core/src/symbols.ts * Native Zero-Dependency Vector Symbol Registry for Markdy. * High-performance inline SVG paths for modern system architecture stacks. */ interface VectorSymbol { name: string; category: "cloud" | "database" | "compute" | "messaging" | "runtime" | "gateway" | "client" | "security" | "observability" | "data"; viewBox: string; svgPaths: string; brandColor?: string; } declare const VECTOR_SYMBOLS: Record; /** * Resolves a vector symbol definition by key or normalized alias. */ declare function resolveVectorSymbol(nameOrAlias: string): VectorSymbol | null; /** * Returns a standalone SVG snippet string for a vector symbol. */ declare function renderSymbolSvg(symbol: VectorSymbol | string, options?: { size?: number; className?: string; color?: string; }): string | null; /** * Lists all available vector symbol names registered in Markdy. */ declare function listAvailableSymbols(): string[]; /** * packages/core/src/provenance.ts * Code Provenance and Git Verification Engine for Markdy. * Anchors architecture diagram components to physical source code references with deterministic proof. * Zero runtime dependencies (Node fs/path utilized conditionally in verification CLI). */ interface CodeProvenanceAnchor { raw: string; filePath: string; startLine?: number; endLine?: number; revision?: string; resolvedHref?: string; } interface CodeProvenanceDiagnostic { nodeId: string; severity: "error" | "warning"; code: "provenance/path-invalid" | "provenance/path-escape" | "provenance/file-not-found" | "provenance/line-out-of-bounds" | "provenance/git-mismatch"; message: string; filePath: string; line?: number; fixSuggestion?: string; } interface CodeProvenanceVerificationReport { isValid: boolean; totalAnchors: number; verifiedCount: number; anchors: Map; diagnostics: CodeProvenanceDiagnostic[]; summaryMarkdown: string; } /** * Parses a code anchor string (e.g. "src/auth/jwt.ts#L20-L85" or "prisma/schema.prisma#L110"). */ declare function parseCodeAnchor(raw: unknown, repositoryUrl?: string, revision?: string): CodeProvenanceAnchor | null; /** * Extracts all code provenance anchors declared on nodes across a DiagramAST. */ declare function extractDiagramCodeAnchors(ast: DiagramAST, repositoryUrl?: string, revision?: string): Map; /** * Verifies code provenance anchors against a filesystem reader interface. */ declare function verifyCodeAnchorsWithReader(anchors: Map, fileReader: { fileExists: (relPath: string) => boolean; getLineCount: (relPath: string) => number; }): CodeProvenanceVerificationReport; /** * packages/core/src/syntax-diagnostics.ts * Deep Syntax Diagnostics, Fuzzy Typo Matching, Grammar Inspection & Auto-Healing for Markdy. * Zero external dependencies. */ interface DiagnosticIssue { line: number; column?: number; severity: "error" | "warning" | "info"; code: "TYPO_KEYWORD" | "TYPO_NODE_KIND" | "UNDEFINED_NODE_REFERENCE" | "UNQUOTED_STRING_LABEL" | "UNTERMINATED_STRING" | "MISSING_COLON" | "CUE_OUTSIDE_BEAT" | "INVALID_FLOW_OPERATOR" | "FLOW_CYCLE_RETURN_EDGE" | "UNKNOWN_THEME_OR_PROPERTY" | "FOREIGN_DIAGRAM_SYNTAX" | "SYNTAX_ERROR" | "ARCH_RULE_VIOLATION"; message: string; snippet?: string; suggestion?: string; didYouMean?: string; ruleExplanation?: string; fix?: { original: string; replacement: string; }; } interface SyntaxDiagnosticReport { isValid: boolean; errorCount: number; warningCount: number; issues: DiagnosticIssue[]; repairedCode?: string; repairPrompt: string; summary: string; declaredNodes: string[]; referencedNodes: string[]; } interface AutoRepairResult { repairedCode: string; changes: string[]; isFixed: boolean; } interface DiagnosticOptions { checkArchitecture?: boolean; transpileMermaid?: (source: string) => string; } declare function damerauLevenshteinDistance(a: string, b: string): number; declare function findClosestMatch(word: string, candidates: Iterable, maxDistance?: number): { match: string; distance: number; } | null; declare function diagnoseMarkdyCode(code: string, options?: DiagnosticOptions): SyntaxDiagnosticReport; declare function repairMarkdyCode(code: string, options?: { transpileMermaid?: (source: string) => string; precomputedIssues?: DiagnosticIssue[]; }): AutoRepairResult; /** * packages/core/src/ai-healing.ts * Self-healing AI Prompt Generation & Diagnostic Repair Loop for Markdy. * Zero external dependencies. */ interface RepairPromptBundle { isValid: boolean; repairPrompt?: string; syntaxErrors: string[]; archViolations: ArchitectureViolation[]; issues?: DiagnosticIssue[]; repairedCode?: string; report?: SyntaxDiagnosticReport; } declare function analyzeAndBuildRepairPrompt(sourceCode: string): RepairPromptBundle; /** * Output size presets for various export targets. * Maps named presets to viewBox dimensions and safe margins. */ interface OutputPreset { name: string; width: number; height: number; /** Safe margin inset from each edge (px). */ safeArea: number; /** Aspect ratio label for human display. */ aspect: string; /** Intended output context. */ context: string; } declare const OUTPUT_PRESETS: Record; /** Resolve a preset by name, falling back to doc-inline. */ declare function resolveOutputPreset(name: string): OutputPreset; /** List all available preset names. */ declare function listOutputPresets(): string[]; /** * packages/core/src/intellicode.ts * Markdy IntelliCode, Context-Aware Autocompletion, Predictive Flow & Architecture Suggestion Engine. * Zero external dependencies. */ type IntelliCodeItemKind = "keyword" | "directive" | "nodeKind" | "node" | "group" | "tech" | "flowOp" | "cue" | "selector" | "theme" | "layout" | "diagramType" | "attribute" | "snippet" | "value"; interface IntelliCodeItem { label: string; insertText: string; kind: IntelliCodeItemKind; detail?: string; documentation?: string; isSnippet?: boolean; boost?: number; filterText?: string; } interface ExtractedNode { id: string; kind: string; label: string; line: number; } interface ExtractedGroup { id: string; label: string; members: string[]; line: number; } interface ExtractedBeat { id: string; label: string; line: number; } interface DiagramContext { declaredNodes: ExtractedNode[]; declaredGroups: ExtractedGroup[]; declaredBeats: ExtractedBeat[]; theme?: string; layout?: string; diagramType?: string; insideBeat: boolean; currentBeatName?: string; insideGroup: boolean; lineNo: number; lineText: string; linePrefix: string; tokenPrefix: string; } interface GhostTextSuggestion { text: string; insertText: string; description: string; type: "next-flow" | "beat-cue" | "init-beat" | "next-node" | "group"; } interface ArchitectureRecommendation { id: string; title: string; desc: string; snippet: string; category: "performance" | "security" | "reliability" | "choreography" | "structure"; actionLabel: string; } interface TechPreset { name: string; aliases: string[]; kind: string; defaultId: string; label: string; desc: string; category: "database" | "cache" | "queue" | "gateway" | "client" | "compute" | "storage" | "security" | "ai"; } declare const POPULAR_TECHS: TechPreset[]; declare function extractDiagramContext(text: string, cursorLine?: number, cursorCol?: number): DiagramContext; declare function getIntelliCodeCompletions(docText: string, cursorLine: number, cursorCol: number): IntelliCodeItem[]; declare function predictNextLineSuggestion(docText: string, cursorLine: number): GhostTextSuggestion | null; declare function getArchitectureSuggestions(docText: string): ArchitectureRecommendation[]; declare function formatScene(ast: DiagramAST): string; /** * packages/core/src/recipes.ts * Architectural Scenario Recipes & Recommendation Engine for Markdy. * Clean-room re-engineered architectural pattern catalog and AI prompt matching. * Zero external dependencies. */ interface ArchitectureRecipe { id: string; name: string; category: "caching" | "streaming" | "microservices" | "security" | "data" | "ai" | "resilience" | "consensus" | "observability"; description: string; keywords: string[]; recommendedLayout: "LR" | "TD" | "TB" | "RL"; primaryNodes: string[]; code: string; highlights: string[]; } declare const ARCHITECTURE_RECIPES: ArchitectureRecipe[]; interface PatternRecommendationResult { recipe: ArchitectureRecipe; score: number; matchedKeywords: string[]; rationale: string; } /** * Recommends best architecture recipes for a user prompt or requirement query. */ declare function recommendArchitecturePattern(query: string): PatternRecommendationResult[]; interface SynthesizedRecipeResult { markdyScript: string; detectedComponents: Array<{ id: string; label: string; kind: string; icon?: string; }>; inferredPattern: string; rationale: string; } /** * Zero-token deterministic dynamic architecture synthesis engine. * Parses user requirements and synthesizes custom tailor-made MarkdyScript diagrams. */ declare function synthesizeCustomRecipe(query: string): SynthesizedRecipeResult; /** * Retrieves an architecture recipe by its exact ID or alias. */ declare function getArchitectureRecipe(id: string): ArchitectureRecipe | undefined; /** * Lists all available architecture recipes. */ declare function listArchitectureRecipes(): ArchitectureRecipe[]; /** * packages/core/src/verifier.ts * 9-Point Quality Gate & Responsive Viewport Verifier for Markdy. * Clean-room re-engineered deterministic artifact validation and integrity reporting. * Zero external dependencies. */ type QualityProfile = "standard" | "showcase"; interface QualityCheckItem { id: string; name: string; category: "syntax" | "geometry" | "governance" | "provenance" | "visual"; status: "pass" | "warn" | "fail"; message: string; details?: Record; } interface DiagramQualityMetrics { nodeCount: number; edgeCount: number; beatCount: number; hasCodeProvenance: boolean; provenanceAnchorCount: number; symbolCount: number; estimatedWidth: number; estimatedHeight: number; aspectRatio: number; } interface QualityGateReport { passed: boolean; qualityProfile: QualityProfile; errorCount: number; warningCount: number; sha256Receipt: string; checks: QualityCheckItem[]; metrics: DiagramQualityMetrics; viewportCompliance: { "1440x900": boolean; "1600x1000": boolean; "1920x1080": boolean; "2048x1320": boolean; }; } interface QualityGateOptions { profile?: QualityProfile; strictCycles?: boolean; } /** * Runs the complete 12-Point Quality Gate & Viewport Verification on a DiagramAST. */ declare function verifyDiagramQuality(astOrCode: DiagramAST | string, options?: QualityGateOptions): QualityGateReport; /** * packages/core/src/c4.ts * C4 Hierarchical Architecture Engine for Markdy. * Supports L1 System Context, L2 Containers, L3 Components, and L4 Code Provenance views. * Zero external dependencies. */ type C4Level = "context" | "container" | "component" | "code"; interface C4NodeMeta { id: string; level: C4Level; levelNumber: 1 | 2 | 3 | 4; isExternal: boolean; containerParent?: string; hasCodeProvenance: boolean; } interface C4ModelReport { ast: DiagramAST; levelsPresent: Record; nodesByLevel: Record; summaryMarkdown: string; } /** * Infers the C4 abstraction level of a node based on explicit @c4 prop or node characteristics. */ declare function inferNodeC4Level(node: NodeDecl): { level: C4Level; levelNumber: 1 | 2 | 3 | 4; }; /** * Analyzes the C4 model distribution of a Diagram AST. */ declare function analyzeC4Model(ast: DiagramAST): C4ModelReport; /** * Filters a Diagram AST to a specific C4 abstraction ceiling (e.g. show all nodes up to L2 Container level). */ declare function filterC4Hierarchy(ast: DiagramAST, maxLevel?: C4Level | 1 | 2 | 3 | 4): { filteredAst: DiagramAST; visibleNodeIds: string[]; }; /** * Automatically synthesizes a 4-beat interactive narrative storyboard zooming through C4 levels. */ declare function generateC4Storyboard(ast: DiagramAST): string; interface C4LevelViewExport { level: C4Level; levelNumber: 1 | 2 | 3 | 4; title: string; markdyScript: string; nodeCount: number; edgeCount: number; } /** * Exports isolated, production-ready MarkdyScript blueprints for each of the 4 C4 levels. */ declare function exportC4LevelViews(ast: DiagramAST): Record; /** * Validates cross-level containment and flags orphaned lower-level components. */ declare function validateC4Containment(ast: DiagramAST): { isValid: boolean; issues: string[]; }; /** * packages/core/src/drift.ts * Architecture Drift Detection and In-Tree Code Synchronization Engine for Markdy. * Identifies drift between architecture models and real physical repository codebases. * Zero external dependencies. */ interface BrokenAnchorDrift { nodeId: string; nodeLabel: string; declaredPath: string; reason: "file_not_found" | "path_escaped"; } interface OrphanCodeServiceDrift { suggestedId: string; suggestedKind: string; discoveredPath: string; } interface ArchitectureDriftReport { isSynchronized: boolean; totalAnchorsChecked: number; validAnchorCount: number; brokenAnchors: BrokenAnchorDrift[]; orphanCodeServices: OrphanCodeServiceDrift[]; summaryMarkdown: string; healingMarkdySnippet?: string; } /** * Detects architectural drift between a Diagram AST and a list of physical repository files. */ declare function detectArchitectureDrift(ast: DiagramAST, existingFiles?: string[]): ArchitectureDriftReport; interface AutoHealResult { healedAst: DiagramAST; healedMarkdyScript: string; healedAnchorCount: number; addedServiceCount: number; healedMappings: Array<{ nodeId: string; oldPath: string; newPath: string; }>; } /** * Automatically heals broken architecture anchors and incorporates orphan code services. */ declare function autoHealArchitectureDrift(ast: DiagramAST, report: ArchitectureDriftReport, existingFiles?: string[]): AutoHealResult; export { ARCHITECTURE_RECIPES, ARCH_RULE_PRESETS, type AnnotationDecl, type ArchRuleType, type ArchitectureDriftReport, type ArchitecturePreset, type ArchitectureRecipe, type ArchitectureRecommendation, type ArchitectureRule, type ArchitectureViolation, type AutoHealResult, type AutoRepairResult, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, type Box, type BrokenAnchorDrift, type C4Level, type C4LevelViewExport, type C4ModelReport, type C4NodeMeta, CUE_ALIASES, type CardinalPort, type CodeProvenanceAnchor, type CodeProvenanceDiagnostic, type CodeProvenanceVerificationReport, type Cue, DIAGRAM_TYPES, type DefaultThemesConfig, type Diagnostic, type DiagnosticIssue, type DiagramAST, type DiagramContext, type DiagramDiffResult, type DiagramQualityMetrics, type DiagramType, type DiffChangeType, EDGE_OPERATORS, type EdgeDecl, type EdgeDiff, type EdgeKind, type EdgeSelector, type ExtractedBeat, type ExtractedGroup, type ExtractedNode, type FlowSegment, type GhostTextSuggestion, type GroupBoundary, type GroupDecl, type GroupDiff, type IntelliCodeItem, type IntelliCodeItemKind, type LayoutDirection, type MarkdyConfig, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeDiff, type NodeSelector, type NodeShape, OUTPUT_PRESETS, type OrphanCodeServiceDrift, type OutputPreset, PLAYER_FLAT_KEYS, PLAYER_GROUPS, POPULAR_TECHS, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type PatternRecommendationResult, type PlayerChromeConfig, type PlayerConfig, type PlayerControlsConfig, type PlayerInteractionConfig, type PlayerOverrides, type PlayerPlaybackConfig, type PlayerProgress, type PlayerScope, type Point, type PortLane, type PositionedNode, type QualityCheckItem, type QualityGateOptions, type QualityGateReport, type QualityProfile, type RenderPlan, type RepairPromptBundle, type ResolvedPlayer, type RouteOptions, type RoutedEdge, type RoutedPath, type RuleSeverity, SCENE_KEYS, type SceneMeta, type SemanticProfile, type SequenceActivation, type SequenceMessage, type StyleDecl, type SyntaxDiagnosticReport, type SynthesizedRecipeResult, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type TechPreset, type ThemeGeneratorOptions, type ThemeTokens, type TimedCue, type TreeBus, VECTOR_SYMBOLS, VISUAL_PRIMITIVE_TYPES, type VectorSymbol, allocatePortLanes, analyzeAndBuildRepairPrompt, analyzeC4Model, applyPlayerSetting, autoHealArchitectureDrift, buildSmoothSvgPath, canonicalNodeKind, classifyTechnology, compile, compilePlan, compressMarkdyToUrlHash, computeAdaptiveDimensions, computeNodeDimensions, damerauLevenshteinDistance, decompressMarkdyFromUrlHash, detectArchitectureDrift, diagnoseMarkdyCode, diffDiagramASTs, exportC4LevelViews, extractDiagramCodeAnchors, extractDiagramContext, filterC4Hierarchy, findClosestMatch, formatScene, generateC4Storyboard, generateThemeFromBrand, getArchitectureRecipe, getArchitectureSuggestions, getBoxPortPosition, getIntelliCodeCompletions, humanizeId, inferNodeC4Level, listArchitectureRecipes, listAvailableSymbols, listOutputPresets, nodeRole, parse, parseAndCompile, parseCodeAnchor, predictNextLineSuggestion, recommendArchitecturePattern, renderSymbolSvg, repairMarkdyCode, resolveArchitectureConfig, resolveOutputPreset, resolvePlayer, resolveTheme, resolveVectorSymbol, routeOrthogonalEdge, selectOptimalPorts, synthesizeCustomRecipe, validateArchitecture, validateC4Containment, verifyCodeAnchorsWithReader, verifyDiagramQuality };