@ggui-ai/ui-gen 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/design-mode.ts","../../../src/evaluation/axis-checks/helpers.ts","../../../src/evaluation/axis-checks/checks/universal.ts","../../../src/evaluation/axis-checks/checks/state-merge.ts","../../../src/evaluation/axis-checks/checks/state-ui-affordance.ts","../../../src/evaluation/axis-checks/checks/realtime.ts","../../../src/evaluation/axis-checks/checks/writes.ts","../../../src/evaluation/axis-checks/checks/state-payload.ts","../../../src/evaluation/axis-checks/checks/tooling.ts","../../../src/evaluation/axis-checks/checks/grid.ts","../../../src/evaluation/axis-checks/extras.ts","../../../src/evaluation/axis-checks/registry.ts","../../../src/evaluation/types-public.ts","../../../src/evaluation/axis-checks/dispatch.ts"],"names":["CONTAINER_MAX_WIDTH","cap","m","REALTIME_ACTIVE","mkIssue","matches"],"mappings":";;;;;;;AAwDO,IAAM,gBAAA,GAAkE;AAAA,EAC7E,cAAA,EAAgB,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,EAC1C,yBAAA,EAA2B,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,EACrD,EAAA,EAAI,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,IAAA,EAAK;AAAA,EAC/B,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,GAAA,EAAI;AAAA,EAC/B,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,GAAA;AAC7B,CAAA;ACzBA,IAAM,sBAAsB,CAAC,IAAA,EAAM,QAAQ,QAAA,EAAU,KAAA,EAAO,QAAQ,MAAM,CAAA;AAE1E,SAAS,mBAAmB,CAAA,EAAmD;AAC7E,EAAA,OAAO,CAAA,CAAE,KAAA,EAAO,UAAA,IAAc,CAAA,CAAE,QAAQ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A,EAAO,GAAI;AAAC,GAC/D;AACF","file":"index.js","sourcesContent":["// packages/ui-gen/src/design-mode.ts\n//\n// The ONE definition of the `designMode` option and the rendering-canvas\n// vocabulary. Every triad surface (system prompt, boilerplate, tier-0\n// gate, axis checks, evaluator criteria) AND the visual evaluator import\n// these types from here — nothing re-declares the unions.\n//\n// - `constrained` (default) — today's triad: the component composes\n// from the `@ggui-ai/design` primitives, prop enums and spacing\n// scale, and tier-0 enforces the design vocabulary. Byte-identical\n// to the pre-`designMode` behaviour (pinned by\n// `design-mode.pin.test.ts`).\n// - `free` — the design vocabulary is relaxed: raw HTML elements,\n// inline styles and `<style>` blocks are allowed; the design package\n// is importable but optional. Every HARD contract stays: the data\n// contract via the boilerplate-typed wire hooks, the import\n// allowlist + security bans, the host envelope, the budgets, the\n// blueprint-reuse shape, and brand-bearing color via the closed\n// `--ggui-color-*` token manifest (no literals, no fallbacks).\n\nexport const DESIGN_MODES = [\"constrained\", \"free\"] as const;\n\nexport type DesignMode = (typeof DESIGN_MODES)[number];\n\nexport const DEFAULT_DESIGN_MODE: DesignMode = \"constrained\";\n\n// ─── Rendering canvas ───────────────────────────────────────────────────────\n//\n// ONE canvas vocabulary shared by the prompt input (the `free` prompt\n// TELLS the agent its canvas; the `constrained` prompt keeps its\n// shell/screen descriptors byte-for-byte) and the visual evaluator (one\n// screenshot + judge score per class at `CANVAS_VIEWPORTS[class]`).\n//\n// A class is derived from DISPLAY MODE + width, never from width alone:\n// an inline chat card is `xs-chat-card` whatever the host window\n// measures (the bubble, not the window, bounds the component); a\n// fullscreen-class surface follows its width through the three\n// breakpoints. `canvasForViewportWidth` is monotonic in width per\n// display mode (pinned by `design-mode.test.ts`).\n\nexport const CANVAS_CLASSES = [\n \"xs-chat-card\",\n \"mobile-fullscreen-small\",\n \"md\",\n \"lg\",\n \"xl\",\n] as const;\n\nexport type CanvasClass = (typeof CANVAS_CLASSES)[number];\n\nexport interface CanvasViewport {\n readonly width: number;\n readonly height: number;\n}\n\n/** The viewport (CSS px) each class is rendered + judged at. */\nexport const CANVAS_VIEWPORTS: Readonly<Record<CanvasClass, CanvasViewport>> = {\n \"xs-chat-card\": { width: 400, height: 640 },\n \"mobile-fullscreen-small\": { width: 390, height: 844 },\n md: { width: 768, height: 1024 },\n lg: { width: 1024, height: 768 },\n xl: { width: 1440, height: 900 },\n};\n\n/**\n * The two display modes the canvas derivation distinguishes. `inline`\n * is the chat card (MCP Apps `inline` display mode / the `chat` shell);\n * `fullscreen` is every surface the component owns edge to edge or as\n * a panel (`fullscreen`, `pip`, the `spatial` and `partial` shells) —\n * there the width decides the class.\n */\nexport type CanvasDisplayMode = \"inline\" | \"fullscreen\";\n\n/**\n * Map a shell name (`chat` / `fullscreen` / `spatial` / `partial`) or an\n * MCP Apps display mode (`inline` / `fullscreen` / `pip`) onto the\n * canvas display mode. Only `chat` and `inline` are the inline card;\n * everything else is width-governed.\n */\n/**\n * The display mode a JUDGE canvas stands for (ggui#1100): the inline chat\n * card is `xs-chat-card`; every other canvas is a surface the component\n * owns edge to edge, which the served runtime composes with `fit: 'fill'`\n * — so the judge must too, or it scores a picture the user never sees.\n */\nexport function displayModeForCanvas(canvas: CanvasClass): CanvasDisplayMode {\n return canvas === \"xs-chat-card\" ? \"inline\" : \"fullscreen\";\n}\n\nexport function canvasDisplayModeForShell(shell: string | undefined): CanvasDisplayMode {\n return shell === \"chat\" || shell === \"inline\" ? \"inline\" : \"fullscreen\";\n}\n\n/** Fullscreen-class breakpoints (inclusive lower bounds), CSS px. */\nexport const CANVAS_BREAKPOINTS = { md: 600, lg: 1024, xl: 1440 } as const;\n\n/**\n * Derive the canvas class from display mode + container width.\n *\n * inline → `xs-chat-card` at every width\n * fullscreen → width < 600 → `mobile-fullscreen-small`\n * 600 – 1023 → `md`\n * 1024 – 1439 → `lg`\n * ≥ 1440 → `xl`\n */\nexport function canvasForViewportWidth(mode: CanvasDisplayMode, width: number): CanvasClass {\n if (mode === \"inline\") return \"xs-chat-card\";\n if (width < CANVAS_BREAKPOINTS.md) return \"mobile-fullscreen-small\";\n if (width < CANVAS_BREAKPOINTS.lg) return \"md\";\n if (width < CANVAS_BREAKPOINTS.xl) return \"lg\";\n return \"xl\";\n}\n\n/**\n * Map today's shell × screen descriptors onto a canvas class when no\n * width is known. `chat` is always the inline card; `spatial` is a\n * ~600px floating panel (`md`); `fullscreen` follows the screen. Unknown\n * values fall back to `lg` (the widest common fullscreen), matching the\n * skeleton's `fullscreen` / `universal` defaults.\n */\nexport function canvasForRendering(\n shellType: string | undefined,\n screen: string | undefined,\n): CanvasClass {\n const shell = shellType ?? \"fullscreen\";\n if (canvasDisplayModeForShell(shell) === \"inline\") return \"xs-chat-card\";\n if (shell === \"spatial\") return \"md\";\n switch (screen ?? \"universal\") {\n case \"mobile\":\n return \"mobile-fullscreen-small\";\n case \"tablet\":\n return \"md\";\n default:\n return \"lg\";\n }\n}\n\nexport interface CanvasDescriptor {\n /** Short human label. */\n readonly label: string;\n /** Inclusive width range the component must look right across, CSS px. */\n readonly minWidthPx: number;\n readonly maxWidthPx: number;\n /** What the host draws around the component at this canvas. */\n readonly host: string;\n}\n\nexport const CANVAS_DESCRIPTORS: Readonly<Record<CanvasClass, CanvasDescriptor>> = {\n \"xs-chat-card\": {\n label: \"extra-small chat card\",\n minWidthPx: 320,\n maxWidthPx: 480,\n host: \"an inline card inside a chat message bubble — the host draws the card border, shadow and rounded corners; the component fills the bubble width and takes its natural height\",\n },\n \"mobile-fullscreen-small\": {\n label: \"small mobile fullscreen\",\n minWidthPx: 320,\n maxWidthPx: 599,\n host: \"a phone-sized viewport the component owns edge to edge — single column, touch targets at least 44px, the component manages its own scroll\",\n },\n md: {\n label: \"medium panel\",\n minWidthPx: 600,\n maxWidthPx: 1023,\n host: \"a tablet viewport or a floating panel (spatial / picture-in-picture) — one or two columns, medium density\",\n },\n lg: {\n label: \"large fullscreen\",\n minWidthPx: 1024,\n maxWidthPx: 1439,\n host: \"a desktop viewport the component owns edge to edge — multi-column layouts, hover states and pointer interactions are available\",\n },\n xl: {\n label: \"extra-large fullscreen\",\n minWidthPx: 1440,\n maxWidthPx: 1920,\n host: \"a wide desktop viewport the component owns edge to edge — cap content width or use the extra room deliberately; never stretch a single column across the whole width\",\n },\n};\n\n/**\n * The explicit sentence the `free` prompt renders for a canvas — the\n * agent is TOLD the canvas, it never guesses it.\n */\nexport function describeCanvas(canvas: CanvasClass): string {\n const d = CANVAS_DESCRIPTORS[canvas];\n return (\n `This component renders on the \\`${canvas}\\` canvas (${d.label}): ` +\n `${d.minWidthPx}–${d.maxWidthPx}px wide, ${d.host}. ` +\n `Design for the whole range — the host may size the iframe anywhere inside it, and the host owns the height: size to your content, never to the viewport.`\n );\n}\n","// packages/ui-gen/src/evaluation/axis-checks/helpers.ts\n//\n// Shared contract inspection + source-scan helpers used by axis checks.\n// Ported from the retired mode-checks/ modules.\n\nimport type { ActionEntry, DataContract, JsonObject, JsonValue } from \"@ggui-ai/protocol\";\nimport {\n HOOK_NAME_RE,\n listContractGadgets,\n STDLIB_GADGETS_PACKAGE,\n} from \"@ggui-ai/protocol\";\nimport type { EvalIssue } from \"../types-public.js\";\n\n// =============================================================================\n// Contract shape helpers\n// =============================================================================\n\nexport interface PropShape {\n type?: string;\n required?: boolean;\n items?: { type?: string; properties?: Record<string, unknown> };\n schema?: {\n type?: string;\n items?: { type?: string; properties?: Record<string, unknown> };\n };\n}\n\nexport interface EntityCollection {\n name: string;\n idField: string;\n}\n\nexport interface SubmitAction {\n name: string;\n payloadKeys: string[];\n}\n\nconst ID_FIELD_CANDIDATES = [\"id\", \"uuid\", \"symbol\", \"key\", \"slug\", \"code\"];\n\nfunction getItemsProperties(p: PropShape): Record<string, unknown> | undefined {\n return p.items?.properties ?? p.schema?.items?.properties;\n}\n\nfunction inferIdField(itemProps: Record<string, unknown> | undefined): string {\n if (!itemProps) return \"id\";\n for (const cand of ID_FIELD_CANDIDATES) {\n if (cand in itemProps) return cand;\n }\n for (const [k, v] of Object.entries(itemProps)) {\n const vv = v as { type?: string; schema?: { type?: string } } | undefined;\n if (vv?.type === \"string\" || vv?.schema?.type === \"string\") return k;\n }\n return \"id\";\n}\n\nexport function getRequiredPropNames(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, PropShape> }\n | undefined;\n const properties = propsField?.properties ?? {};\n return Object.entries(properties)\n .filter(([, p]) => p && typeof p === \"object\" && p.required === true)\n .map(([name]) => name);\n}\n\nexport function getActionNames(contract?: DataContract): string[] {\n return Object.keys(contract?.actionSpec ?? {});\n}\n\nexport function getStreamEventNames(contract?: DataContract): string[] {\n return Object.keys(contract?.streamSpec ?? {});\n}\n\n/**\n * Returns the local BINDING names the boilerplate emits for every\n * HOOK gadget the contract declares — `useGeolocation` → `geolocation`\n * (strip the `use` prefix, lowercase the first char). The wire\n * `clientCapabilities.gadgets` is package-keyed and carries only the\n * export NAME, not a separate binding name, so the binding is derived\n * here exactly as the boilerplate generator derives it.\n *\n * Component gadgets are excluded — they are rendered as JSX, not bound\n * to a `const`, so the `const <name> = …()` axis checks don't apply.\n *\n * The agentCapabilities.tools catalog has no parallel helper —\n * agent-side tools aren't component-side, so the axis checks don't\n * scan source for agent-tool bindings.\n */\nexport function getGadgetNames(contract?: DataContract): string[] {\n if (!contract) return [];\n return listContractGadgets(contract)\n .filter((use) => HOOK_NAME_RE.test(use.name))\n .map((use) =>\n use.name.length > 3\n ? use.name.charAt(3).toLowerCase() + use.name.slice(4)\n : use.name,\n );\n}\n\n/**\n * Like {@link getGadgetNames} but restricted to the first-party\n * `@ggui-ai/gadgets` stdlib package — the built-in browser capabilities\n * (`useGeolocation`, `useCamera`, …) that carry the `idle → prompting →\n * active` lifecycle and therefore need a `.start()` invocation.\n *\n * Registered third-party gadgets (e.g. `useBoardState` from\n * `@example/gadget-board`) are plain data hooks: the runtime resolves\n * them without a user gesture, so the `.start()` axis check must NOT\n * fire on them.\n */\nexport function getStdlibGadgetNames(contract?: DataContract): string[] {\n if (!contract) return [];\n return listContractGadgets(contract)\n .filter(\n (use) =>\n use.package === STDLIB_GADGETS_PACKAGE && HOOK_NAME_RE.test(use.name),\n )\n .map((use) =>\n use.name.length > 3\n ? use.name.charAt(3).toLowerCase() + use.name.slice(4)\n : use.name,\n );\n}\n\nexport function getEntityCollections(contract?: DataContract): EntityCollection[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const entities: EntityCollection[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n const items = pp.items ?? pp.schema?.items;\n if (type === \"array\" && items?.type === \"object\") {\n entities.push({ name, idField: inferIdField(getItemsProperties(pp)) });\n }\n }\n return entities;\n}\n\nfunction singularize(name: string): string {\n if (name.endsWith(\"ies\")) return name.slice(0, -3) + \"y\";\n if (name.endsWith(\"ses\")) return name.slice(0, -2);\n if (name.endsWith(\"s\") && !name.endsWith(\"ss\")) return name.slice(0, -1);\n return name;\n}\n\n/**\n * Entity collections that are actually mutated (referenced by a stream\n * event or by an action payload's entity-id key). Static reference lists\n * (e.g., kanban's `columns`) are excluded so they don't trigger\n * \"must be in useState\" false positives.\n */\nexport function getMutatedEntityCollections(\n contract: DataContract | undefined,\n allEntities: EntityCollection[],\n): EntityCollection[] {\n if (!contract) return allEntities;\n\n const actionSpec = contract.actionSpec ?? {};\n const streamSpec = contract.streamSpec ?? {};\n\n const hasStreams = Object.keys(streamSpec).length > 0;\n\n const referencedIdKeys = new Set<string>();\n for (const action of Object.values(actionSpec) as ActionEntry[]) {\n const ex = action.example;\n if (!ex || typeof ex !== \"object\" || Array.isArray(ex)) continue;\n for (const key of Object.keys(ex as JsonObject)) {\n if (key === \"id\" || key === \"key\" || key === \"index\") {\n referencedIdKeys.add(\"id\");\n referencedIdKeys.add(\"key\");\n referencedIdKeys.add(\"index\");\n } else if (/Id$/.test(key)) {\n referencedIdKeys.add(key.slice(0, -2).toLowerCase());\n }\n }\n }\n\n const mutated = allEntities.filter((e) =>\n referencedIdKeys.has(singularize(e.name).toLowerCase()),\n );\n\n if (mutated.length === 0 && hasStreams && allEntities.length > 0) {\n return [allEntities[0]];\n }\n return mutated.length > 0 ? mutated : allEntities;\n}\n\nfunction countScalarKeys(example: unknown): string[] {\n if (!example || typeof example !== \"object\" || Array.isArray(example)) return [];\n const keys: string[] = [];\n for (const [k, v] of Object.entries(example as Record<string, unknown>)) {\n const t = typeof v;\n if (t === \"string\" || t === \"number\" || t === \"boolean\") keys.push(k);\n }\n return keys;\n}\n\nexport function getSubmitActions(contract?: DataContract): SubmitAction[] {\n const actionSpec = contract?.actionSpec ?? {};\n const result: SubmitAction[] = [];\n for (const [name, action] of Object.entries(actionSpec) as Array<[string, ActionEntry]>) {\n const ex: JsonValue | undefined = action.example;\n const scalarKeys = countScalarKeys(ex);\n if (scalarKeys.length < 3) continue;\n const allKeys = ex && typeof ex === \"object\" && !Array.isArray(ex)\n ? Object.keys(ex as JsonObject)\n : scalarKeys;\n result.push({ name, payloadKeys: allKeys });\n }\n return result;\n}\n\nexport function getArrStrProps(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const names: string[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n const items = pp.items ?? pp.schema?.items;\n if (type === \"array\" && items?.type === \"string\") names.push(name);\n }\n return names;\n}\n\nexport function getInitialValuePropNames(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const names: string[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n if (type === \"object\" && /^initial/i.test(name)) names.push(name);\n }\n return names;\n}\n\n// =============================================================================\n// Source scanning helpers\n// =============================================================================\n\n/**\n * Collect all key names that appear as state slots — either keys inside a\n * `useState({ ... })` object literal, or standalone state variables.\n */\nexport function collectStateKeys(src: string): Set<string> {\n const keys = new Set<string>();\n const varRe = /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState/g;\n for (const m of src.matchAll(varRe)) keys.add(m[1]);\n const objRe = /useState(?:<[^>]*>)?\\s*\\(\\s*\\{([\\s\\S]*?)\\}\\s*\\)/g;\n for (const m of src.matchAll(objRe)) {\n const keyRe = /(?:^|,)\\s*(\\w+)\\s*:/g;\n for (const km of m[1].matchAll(keyRe)) keys.add(km[1]);\n }\n const defaultObjRe = /useState(?:<[^>]*>)?\\s*\\([^)]*\\|\\|\\s*\\{([^}]*)\\}/g;\n for (const m of src.matchAll(defaultObjRe)) {\n const keyRe = /(?:^|,)\\s*(\\w+)\\s*:/g;\n for (const km of m[1].matchAll(keyRe)) keys.add(km[1]);\n }\n return keys;\n}\n\nexport function isMultiStepPrompt(prompt: string): boolean {\n if (!prompt) return false;\n const p = prompt.toLowerCase();\n return (\n /\\bstep\\s*[1-9]\\b/.test(p) ||\n /\\b[1-9][- ]step\\b/.test(p) ||\n /\\bmulti[- ]step\\b/.test(p) ||\n /\\bwizard\\b/.test(p) ||\n /\\bsteps?:\\s*\\n?/.test(p)\n );\n}\n\n// =============================================================================\n// Issue factory\n// =============================================================================\n\nexport function mkIssue(\n subcategory: string,\n description: string,\n fix: string,\n result: \"fail\" | \"warn\" = \"fail\",\n): EvalIssue {\n // mode-category issues are structural (missing hook wiring, bad merge-by-id,\n // hardcoded entity literals) — always P0. See ALIGNMENT.md R1.\n return { tier: 0, result, category: \"mode\", priority: \"P0\", subcategory, description, fix };\n}\n\nexport function cap(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n/**\n * Trace flag (ggui#1046): `GGUI_AXIS_CHECK_TRACE=1` makes the dispatcher and the checks\n * that opt in print one JSON line per evaluation round with the facts their verdict was\n * built from — what a reader of a served cell cannot recover from the round's result\n * alone (the source the checks saw, the prompt, the design mode, the classification,\n * the contract's prop keys, which gates matched, which issues came out). Off by default;\n * a diagnostic channel, never part of the result.\n */\nexport function axisCheckTraceEnabled(): boolean {\n return process.env[\"GGUI_AXIS_CHECK_TRACE\"] === \"1\";\n}\n","// packages/ui-gen/src/evaluation/axis-checks/checks/universal.ts\n//\n// Checks that run regardless of axis value — they apply to any generated\n// component. Dispatched via a \"universal\" gate that matches every render\n// value.\n\nimport { LUCIDE_ICON_NAMES, maxWidth as CONTAINER_MAX_WIDTH } from \"@ggui-ai/design\";\nimport { CANVAS_VIEWPORTS, type CanvasClass } from \"../../../design-mode.js\";\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport type { DataContract } from \"@ggui-ai/protocol\";\nimport {\n getRequiredPropNames,\n mkIssue,\n} from \"../helpers.js\";\n\nconst ALL_RENDER_VALUES = [\n \"static\", \"list\", \"grid\", \"spatial\", \"timeline\", \"chart\", \"master-detail\",\n] as const;\n\nfunction runPropCoverage(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const requiredProps = getRequiredPropNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of requiredProps) {\n const dotAccess = new RegExp(`\\\\bprops\\\\.${name}\\\\b`);\n const bracketAccess = new RegExp(`\\\\bprops\\\\[['\"\\`]${name}['\"\\`]\\\\]`);\n const destructured = new RegExp(\n `props[^;]{0,200}\\\\{[^}]*\\\\b${name}\\\\b[^}]*\\\\}|\\\\{[^}]*\\\\b${name}\\\\b[^}]*\\\\}[^;]{0,10}=\\\\s*props`,\n );\n if (dotAccess.test(src) || bracketAccess.test(src) || destructured.test(src))\n continue;\n issues.push(\n mkIssue(\n \"universal.prop_coverage\",\n `Required prop \"${name}\" is not referenced anywhere in the component.`,\n `Render props.${name} — the data contract marks it required.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoPropMirror(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re =\n /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState(?:<[^>]*>)?\\s*\\(\\s*props\\??\\.(\\w+)/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter, propName] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n if (new RegExp(`\\\\b${setter}\\\\s*\\\\(`).test(after)) continue;\n issues.push(\n mkIssue(\n \"universal.no_prop_mirror\",\n `useState(props.${propName}) for \"${stateVar}\" has no \"${setter}\" call — this mirrors a prop without mutation.`,\n `Read props.${propName} directly in the render; remove the useState for ${stateVar}.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nfunction runNoPhantomUseState(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re = /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n const stateUsed = new RegExp(`\\\\b${stateVar}\\\\b`).test(after);\n const setterUsed = new RegExp(`\\\\b${setter}\\\\b`).test(after);\n if (stateUsed || setterUsed) continue;\n issues.push(\n mkIssue(\n \"universal.no_phantom_useState\",\n `useState for \"${stateVar}\" is declared but neither \"${stateVar}\" nor \"${setter}\" is referenced.`,\n `Remove the useState for ${stateVar} — it is dead state.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nfunction runPropSeedNoResync(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re =\n /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState(?:<[^>]*>)?\\s*\\(\\s*props\\??\\.(\\w+)/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter, propName] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n // Never-called setter is `no_prop_mirror`'s case — this check is\n // its #480 complement: the setter IS used (real optimistic state)\n // but nothing re-seeds when the agent repaints the prop.\n if (!new RegExp(`\\\\b${setter}\\\\s*\\\\(`).test(after)) continue;\n // A re-seed effect names the prop in a dependency array. Bracket\n // shape is the pragmatic signal (same looseness as the sibling\n // checks): any `[... props.X ...]` array in the source counts.\n const resync = new RegExp(\n `\\\\[[^\\\\[\\\\]]*props\\\\??\\\\.${propName}\\\\b[^\\\\[\\\\]]*\\\\]`,\n );\n if (resync.test(src)) continue;\n issues.push(\n mkIssue(\n \"universal.prop_seed_no_resync\",\n `useState(props.${propName}) seeds \"${stateVar}\" and mutates it, but no effect depends on [props.${propName}] — a ggui_amend repaint pushes new props that never reach this display (#480).`,\n `Add \\`useEffect(() => ${setter}(props.${propName}), [props.${propName}]);\\` so agent repaints re-seed the state, or derive the display directly from props.${propName}.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\n// ── universal.icon_name_known (ggui#1015) ────────────────────────────\n// The Icon primitive renders ONLY its curated Lucide subset; an unknown\n// name renders an empty box. The model reaches for names from the full\n// Lucide set (\"sparkles\", \"arrow-up-right\" on the hello frames), so the\n// check flags every string-literal `<Icon name>` outside the subset —\n// the fix turn has `get_available_icons`. Dynamic names (`name={x}`)\n// and emoji/unicode (rendered as text) are outside the check's scope.\n\n/** Icon.tsx's resolver rule: exact key, else dashes/underscores stripped + lowercased. */\nconst KNOWN_ICON_KEYS: ReadonlySet<string> = new Set(\n LUCIDE_ICON_NAMES.map((n) => n.replace(/[-_]/g, \"\").toLowerCase()),\n);\n\nexport function isKnownIconName(name: string): boolean {\n return KNOWN_ICON_KEYS.has(name.replace(/[-_]/g, \"\").toLowerCase());\n}\n\nconst ICON_NAME_LITERAL_RX =\n /<Icon\\b[^>]*?\\bname\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{\\s*\"([^\"]*)\"\\s*\\}|\\{\\s*'([^']*)'\\s*\\})/g;\n\nexport function findUnknownIconNames(sourceCode: string): string[] {\n const unknown = new Set<string>();\n for (const m of sourceCode.matchAll(ICON_NAME_LITERAL_RX)) {\n const name = m[1] ?? m[2] ?? m[3] ?? m[4] ?? \"\";\n if (name.length === 0) continue;\n if (/[^\\x20-\\x7e]/.test(name)) continue; // emoji / unicode passthrough renders as text\n if (!isKnownIconName(name)) unknown.add(name);\n }\n return [...unknown];\n}\n\nfunction runIconNameKnown(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const unknown = findUnknownIconNames(input.sourceCode);\n if (unknown.length === 0) return [];\n const list = unknown.map((n) => `\"${n}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.icon_name_known\",\n `<Icon name=…> uses ${unknown.length} name(s) outside the design system's Lucide subset: ${list} — an unknown name renders an empty box.`,\n \"Call get_available_icons and pick a listed name (kebab-case), or use an emoji directly.\",\n ),\n ];\n}\n\n// ── universal.accent_text_ink (ggui#1039) ────────────────────────────\n// The brand ladder's mid stops (300–600) are FILL colours. On a\n// low-saturation brand the 600 stop is mid-grey on the surface, and every\n// one of four brand-directed hello frames painted its eyebrow and inline\n// arrows with it — two of them at 3.5:1 and 2.91:1 on the ground. Accent\n// TEXT is the theme's readable ink `--ggui-color-link` (derived per mode to\n// clear 4.5:1, ggui#1035) or `<Text tone=\"emphasized\">`; `link` resolves to\n// the very same 600 wherever 600 already reads, so the fix never regresses a\n// saturated brand. Out of scope by design: tints as text (50–200 — the\n// on-fill idiom, `primary-50` on a `primary-600` bubble) and the deep stops\n// (700–900 — text on a light primary tint), both documented uses. Matches the\n// `color` property in every spelling the model writes — JSX prop, style\n// object (source and compiled), CSS declaration — and never a compound\n// property (`backgroundColor`, `border-color`, `accent-color`).\n\nconst LADDER_STOP_AS_TEXT_RX =\n /(?<![\\w-])color\\s*(?:=\\s*\\{?\\s*|:\\s*)[\"'`]?\\s*var\\(--ggui-color-primary-(\\d{2,3})\\s*[,)]/g;\nconst TEXT_INK_STOP_MIN = 300;\nconst TEXT_INK_STOP_MAX = 600;\n\n/** Distinct `primary-<stop>` tokens (300–600) the source paints as a text `color`, in source order. */\nexport function findLadderStopsAsText(sourceCode: string): string[] {\n const found = new Set<string>();\n for (const m of sourceCode.matchAll(LADDER_STOP_AS_TEXT_RX)) {\n const digits = m[1] ?? \"\";\n const stop = Number(digits);\n if (stop >= TEXT_INK_STOP_MIN && stop <= TEXT_INK_STOP_MAX) found.add(`primary-${digits}`);\n }\n return [...found];\n}\n\nfunction runAccentTextInk(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const stops = findLadderStopsAsText(input.sourceCode);\n if (stops.length === 0) return [];\n const list = stops.map((s) => `\\`${s}\\``).join(\", \");\n return [\n mkIssue(\n \"universal.accent_text_ink\",\n `Text is painted with a brand-ladder fill stop as its color (${list}) — on a low-saturation brand these stops are mid-grey on the surface and the text fails readability.`,\n 'Accent text (eyebrows, taglines, links, labels, inline arrows) takes var(--ggui-color-link) or <Text tone=\"emphasized\">; body text takes var(--ggui-color-onContainer); keep primary-* stops on fills and borders.',\n ),\n ];\n}\n\n// ── universal.scoped_surface_owns_ground (ggui#1047) ─────────────────\n// A SCOPED surface — `surface=\"inverted\"` or `\"hero\"` on Card / Box — owns its\n// ground: the primitive paints it, the scope rule swaps every ink beneath it.\n// The served Mosaic hello repainted an inverted card's ground with the page's\n// (`style={{ background: 'var(--ggui-color-ground)' }}`) and its hero text\n// read 1:1 — the swapped inks over a ground the scope did not own. The design\n// package now strips that background at render; this check makes the fix turn\n// remove it at the source, so the author's intent never silently vanishes.\n// Stands down in `free` design mode (the primitive is optional there).\n\nconst SCOPED_SURFACE_TAG_RX = /<(Card|Box)\\b([^<>]*?)surface\\s*=\\s*[\"'](inverted|hero)[\"']([^<>]*?)>/g;\nconst STYLE_BACKGROUND_RX = /\\bstyle\\s*=\\s*\\{\\{[^}]*\\b(background|backgroundColor|backgroundImage)\\s*:/;\n\n/** `[tag, surface]` for every scoped Card / Box whose own `style` sets a background. */\nexport function findScopedSurfaceBackgrounds(sourceCode: string): Array<readonly [string, string]> {\n const hits: Array<readonly [string, string]> = [];\n for (const m of sourceCode.matchAll(SCOPED_SURFACE_TAG_RX)) {\n const attrs = `${m[2] ?? \"\"} ${m[4] ?? \"\"}`;\n if (STYLE_BACKGROUND_RX.test(attrs)) hits.push([m[1] ?? \"\", m[3] ?? \"\"]);\n }\n return hits;\n}\n\nfunction runScopedSurfaceOwnsGround(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n if (input.designMode === \"free\") return [];\n const hits = findScopedSurfaceBackgrounds(input.sourceCode);\n if (hits.length === 0) return [];\n const [tag, surface] = hits[0]!;\n return [\n mkIssue(\n \"universal.scoped_surface_owns_ground\",\n `<${tag} surface=\"${surface}\"> sets its own background in style — a scoped surface owns its ground; repainting it puts the scope's swapped inks over the wrong ground (ink on ink).`,\n `Remove the background from that ${tag}'s style — surface=\"${surface}\" paints the ground; pick another surface if a different ground is wanted.`,\n ),\n ];\n}\n\n// ── universal.caps_label_invented (ggui#1075 Track A) ─────────────────\n// A caps label (`<Text caps>` — the eyebrow / kicker / overline treatment)\n// whose entire content is a string literal is copy the model INVENTED: the\n// contract carries no such member, so nothing the agent sends can change\n// it, and every served card wears it (\"LET'S BEGIN\", \"WELCOME\" — 59 of 63\n// generated sources in one sample, none bound to a prop). Copy comes from the\n// props; a caps label exists only when a prop supplies its text. A label\n// whose content is an expression (`{props.section}`, `{label ?? …}`) is\n// bound and passes; a `<Text caps>` with no text children is not a label.\nconst CAPS_TEXT_RX = /<Text\\b(?=[^>]*\\bcaps\\b)[^>]*>([\\s\\S]*?)<\\/Text>/g;\n\n/** Every `<Text caps>` whose content is nothing but literal text: `[literal]`. */\nexport function findInventedCapsLabels(sourceCode: string): string[] {\n const out: string[] = [];\n for (const m of sourceCode.matchAll(CAPS_TEXT_RX)) {\n const inner = (m[1] ?? \"\").trim();\n if (inner.length === 0) continue;\n if (inner.includes(\"{\")) continue; // bound to an expression — the props speak\n out.push(inner.replace(/\\s+/g, \" \").slice(0, 60));\n }\n return out;\n}\n\nfunction runCapsLabelInvented(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const invented = findInventedCapsLabels(input.sourceCode);\n if (invented.length === 0) return [];\n const list = invented.map((t) => `\"${t}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.caps_label_invented\",\n `${invented.length} caps label(s) carry invented copy the props do not supply: ${list} — an eyebrow, kicker or overline the agent cannot change is chatter on every render.`,\n \"Remove the label, or bind its text to a prop (`<Text caps>{props.section}</Text>`); copy comes from the contract, never from the component.\",\n ),\n ];\n}\n\n// ── universal.viewport_sized (ggui#1075 Track A/B, receipted on #1096) ─\n// An element sized to the viewport — `100vh` / `100dvh` / `100svh` / `100lvh`\n// (bare or inside `calc()`) as a `height` / `min-height`, or the `h-screen` /\n// `min-h-screen` utility classes. The frame owns the height: a content-sized\n// frame is measured FROM the content, so a viewport-sized root can never\n// shrink and grows the frame on every re-measure; under fullscreen the frame\n// already stretches the root to its height. 20 of 48 minted cells in one\n// sample carried `minHeight: \"100vh\"` on their root — one an inline chat\n// card told \"compact\". A `max-height` cap on a scroll region is not sizing\n// and passes; so do `height: 100%`, `flex: 1` and pixel heights.\n// The unit, with a `calc(…)` wrapper closed when present — so the quoted\n// snippet reads whole (`height: \"calc(100dvh - 64px)\"`).\nconst VIEWPORT_UNIT = String.raw`(?:calc\\(\\s*)?100(?:vh|dvh|svh|lvh)\\b(?:[^)\"'\\x60;\\n]*\\))?`;\nconst VIEWPORT_STYLE_OBJECT_RX = new RegExp(\n String.raw`\\b(?:minHeight|height|minBlockSize|blockSize)\\s*:\\s*[\"'\\x60]\\s*${VIEWPORT_UNIT}[\"'\\x60]?`,\n \"g\",\n);\nconst VIEWPORT_CSS_RX = new RegExp(\n String.raw`(?<![\\w-])(?:min-)?(?:height|block-size)\\s*:\\s*${VIEWPORT_UNIT}`,\n \"g\",\n);\nconst VIEWPORT_CLASS_RX = /(?<![\\w-])(?:min-)?h-(?:screen|dvh|svh|lvh)\\b/g;\n\n/** Every viewport-sized height in the source, as written (trimmed, ≤ 60 chars), in order. */\nexport function findViewportSizing(sourceCode: string): string[] {\n const hits: Array<{ at: number; text: string }> = [];\n for (const rx of [VIEWPORT_STYLE_OBJECT_RX, VIEWPORT_CSS_RX, VIEWPORT_CLASS_RX]) {\n for (const m of sourceCode.matchAll(rx)) {\n hits.push({ at: m.index ?? 0, text: m[0].replace(/\\s+/g, \" \").trim().slice(0, 60) });\n }\n }\n return hits.sort((a, b) => a.at - b.at).map((h) => h.text);\n}\n\nfunction runViewportSized(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const sized = findViewportSizing(input.sourceCode);\n if (sized.length === 0) return [];\n const list = sized.map((t) => \"`\" + t + \"`\").join(\", \");\n return [\n mkIssue(\n \"universal.viewport_sized\",\n `${sized.length} element(s) are sized to the viewport: ${list} — the frame owns the height; a content-sized frame is measured from the content, so a viewport-sized root never shrinks and grows the frame on every re-measure.`,\n \"Remove the viewport height — size to content, never to the viewport. Under fullscreen the frame stretches your root already (centre inside it with `display: flex; flex-direction: column; justify-content: center`); to fill a parent that has a height use `height: 100%` or `flex: 1`.\",\n ),\n ];\n}\n\n// ── universal.terminal_action_unguarded (ggui#1108, mitigation) ────────\n// A control whose action the user means ONCE — submit, confirm, approve,\n// schedule, reserve, book, pay, checkout, place order — that stays armed after\n// it fires is one double-click away from doing it twice. The check is a WARN,\n// deliberately: terminality lives in the request and the contract, not in a\n// name, so a static rule can suspect it and must not refuse over it. It fires\n// only when a terminal-sounding action or control exists AND the source guards\n// nothing at all (no `disabled=`, no `aria-disabled`), which is the shape with\n// no reading under which the control is safe.\n/** The words that make an action read as meant-once. Matched as WORDS, never as substrings. */\nconst TERMINAL_WORDS = new Set([\n \"submit\", \"confirm\", \"approve\", \"schedule\", \"reserve\", \"book\", \"pay\", \"checkout\", \"purchase\", \"order\",\n]);\n/** In prose (a control's label) the same words, with real boundaries. */\nconst TERMINAL_LABEL_RX = /\\b(submit|confirm|approve|schedule|reserve|book|pay|checkout|purchase|place\\s+order)\\b/i;\nconst GUARD_RX = /\\b(disabled|aria-disabled)\\s*=/;\n\n/** `submitBooking` → ['submit','booking']; `place_order` → ['place','order']. A NAME is words, not a string to search. */\nfunction nameWords(name: string): string[] {\n return name\n .split(/(?=[A-Z])|[_\\-\\s]+/)\n .map((w) => w.toLowerCase())\n .filter((w) => w.length > 0);\n}\n\n/** The terminal-sounding action names and control labels a source carries, deduped, in order. */\nexport function findUnguardedTerminalControls(sourceCode: string): string[] {\n if (GUARD_RX.test(sourceCode)) return [];\n const names = new Set<string>();\n for (const m of sourceCode.matchAll(/useAction(?:<[^>]*>)?\\(\\s*['\"`]([^'\"`]+)['\"`]/g)) {\n const name = m[1] ?? \"\";\n if (nameWords(name).some((w) => TERMINAL_WORDS.has(w))) names.add(name);\n }\n // A control's own words, taken as the plain text immediately before its close\n // tag — attributes can carry `=>`, so a label is read from the text, never by\n // trying to skip an attribute list with a regex.\n for (const m of sourceCode.matchAll(/>([^<>{}]{1,60})<\\/Button>/g)) {\n const label = (m[1] ?? \"\").replace(/\\s+/g, \" \").trim();\n if (label.length > 0 && TERMINAL_LABEL_RX.test(label)) names.add(label.slice(0, 40));\n }\n return [...names];\n}\n\nfunction runTerminalActionUnguarded(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const found = findUnguardedTerminalControls(input.sourceCode);\n if (found.length === 0) return [];\n const list = found.map((t) => `\"${t}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.terminal_action_unguarded\",\n `${list} reads as an action the user means once, and nothing in this component disables the control after it fires — a double-click sends it twice.`,\n \"Hold the fired state (`const [submitted, setSubmitted] = useState(false)`), set it in the handler, and pass `disabled={submitted}` to that control with a word that says so (\\\"Submitted\\\"). If the action IS meant to repeat — sending a message, adding an item — leave it armed and ignore this.\",\n \"warn\",\n ),\n ];\n}\n\n// ── universal.root_width_cap (ggui#1117 — the eval leg ggui#1113 left out) ─\n// FRAME_SIZING's width half: the outermost element FILLS the frame; a width\n// cap belongs INSIDE it, on the column that holds text. A cap on the root is\n// the defect on a wide canvas (the card becomes a narrow strip with the\n// frame's ground on either side) and a no-op in a chat bubble (~400 px; a\n// 480 px cap never binds) — so the check reads `input.canvas`: it stands\n// down with no canvas (never a guess) and below `md`, and fires only for a\n// cap SMALLER than the canvas. A bare `<Container>` is a cap too — its\n// default preset is `lg`, 768 px — so it binds on `lg` / `xl` and not on\n// `md`. A cap the check cannot resolve to pixels (a `max-w-*` class, `rem`,\n// `%`) is reported because the prompt forbids it on the root. WARN, not\n// fail: the prompt names the one shape never to write; whether a centred\n// column was the right composition stays the model's call.\nexport interface RootWidthCap {\n /** The outermost element's tag name as written. */\n readonly element: string;\n /** The cap as written (`maxWidth=\"sm\"`, `maxWidth: '480px'`, `max-w-md`, or `lg (Container default)`). */\n readonly cap: string;\n /** The cap in pixels when it resolves (a Container preset, an `Npx` value); `null` otherwise. */\n readonly px: number | null;\n}\n\n/** The opening tag of the OUTERMOST element the default export returns, as written; `null` for none or a fragment. */\nfunction rootOpeningTag(sourceCode: string): { readonly name: string; readonly attrs: string } | null {\n const start = sourceCode.indexOf(\"export default function\");\n const body = start >= 0 ? sourceCode.slice(start) : sourceCode;\n const ret = /\\breturn\\s*\\(?\\s*</.exec(body);\n if (ret === null) return null;\n const at = ret.index + ret[0].length - 1;\n const nameMatch = /^<([A-Za-z][\\w.]*)/.exec(body.slice(at));\n if (nameMatch === null) return null;\n let j = at + nameMatch[0].length;\n let depth = 0;\n let quote: string | null = null;\n for (; j < body.length; j++) {\n const ch = body[j]!;\n if (quote !== null) {\n if (ch === quote) quote = null;\n continue;\n }\n if (ch === '\"' || ch === \"'\" || ch === \"`\") quote = ch;\n else if (ch === \"{\") depth++;\n else if (ch === \"}\") depth--;\n else if (ch === \">\" && depth === 0) break;\n }\n return { name: nameMatch[1]!, attrs: body.slice(at + nameMatch[0].length, j) };\n}\n\nconst CONTAINER_PRESETS: Readonly<Record<string, string>> = CONTAINER_MAX_WIDTH;\nconst NOT_A_CAP = new Set([\"full\", \"none\", \"100%\", \"unset\", \"initial\", \"inherit\"]);\n\n/** `sm` → 480; `480px` → 480; `100%` / `full` → not a cap (`undefined`); anything else → a cap of unknown size (`null`). */\nfunction capPx(value: string): number | null | undefined {\n const v = value.trim();\n if (NOT_A_CAP.has(v)) return undefined;\n const resolved = CONTAINER_PRESETS[v] ?? v;\n if (NOT_A_CAP.has(resolved)) return undefined;\n const px = /^(\\d+(?:\\.\\d+)?)px$/.exec(resolved);\n return px === null ? null : Number(px[1]);\n}\n\n/** The width cap the outermost returned element carries, or `null` when it fills the frame. */\nexport function findRootWidthCap(sourceCode: string): RootWidthCap | null {\n const root = rootOpeningTag(sourceCode);\n if (root === null) return null;\n const { name, attrs } = root;\n const prop = /\\bmaxWidth\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|(\\d+(?:\\.\\d+)?))\\s*\\})/.exec(attrs);\n if (prop !== null) {\n const raw = prop[1] ?? prop[2] ?? prop[3] ?? prop[4] ?? `${prop[5]!}px`;\n const px = capPx(raw);\n return px === undefined ? null : { element: name, cap: `maxWidth=\"${raw}\"`, px };\n }\n const style = /\\bmaxWidth\\s*:\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|(\\d+(?:\\.\\d+)?))/.exec(attrs);\n if (style !== null) {\n const raw = style[1] ?? style[2] ?? style[3] ?? `${style[4]!}px`;\n const px = capPx(raw);\n return px === undefined ? null : { element: name, cap: `maxWidth: '${raw}'`, px };\n }\n const cls = /(?<![\\w-])max-w-([\\w[\\]%.-]+)/.exec(attrs);\n if (cls !== null) {\n if (cls[1] === \"full\" || cls[1] === \"none\") return null;\n return { element: name, cap: `max-w-${cls[1]!}`, px: null };\n }\n if (name === \"Container\") return { element: name, cap: \"lg (Container default)\", px: capPx(\"lg\") ?? null };\n return null;\n}\n\nconst WIDE_CANVASES: ReadonlySet<CanvasClass> = new Set<CanvasClass>([\"md\", \"lg\", \"xl\"]);\n\nfunction runRootWidthCap(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n if (input.canvas === undefined || !WIDE_CANVASES.has(input.canvas)) return [];\n const cap = findRootWidthCap(input.sourceCode);\n if (cap === null) return [];\n const width = CANVAS_VIEWPORTS[input.canvas].width;\n if (cap.px !== null && cap.px >= width) return [];\n const sized = cap.px !== null ? `${cap.px}px on a ${width}px canvas` : `on a ${width}px canvas`;\n return [\n mkIssue(\n \"universal.root_width_cap\",\n `The outermost element <${cap.element}> carries a width cap (${cap.cap}, ${sized}): on this canvas the card becomes a narrow strip with the frame's ground on either side. The frame owns the width; a cap belongs INSIDE the root, on the column that holds text.`,\n 'Let the root fill the frame — drop the cap on the element you return at the top (or `maxWidth=\"full\"`) — and put the reading measure on an inner column: `<Box padding=\"lg\"><Container maxWidth=\"sm\">…</Container></Box>`.',\n \"warn\",\n ),\n ];\n}\n\n// ── universal.action_label_dropped (ggui#1190 — the transcription-drop guard) ─\n// The GUARD half of #1190: the model transcribes an actionSpec label onto a\n// control but DROPS a special character (\"Confirm & Schedule\" → \"Confirm\n// Schedule\"), because the verbatim label is not at the write-site. This check\n// NAMES that class on the bench and guards regression; the fix (carry the\n// verbatim label / render it from data) lands separately, so #1190 stays open.\n// WARN-class, deterministic, and tuned to flag ONLY the high-confidence drop.\n\nconst LABEL_SPECIAL_CHAR = /[^a-z0-9\\s]/i;\nconst normText = (s: string): string => s.toLowerCase().replace(/\\s+/g, \" \").trim();\nconst alnumText = (s: string): string => s.toLowerCase().replace(/[^a-z0-9]/g, \"\");\n\n/**\n * Extract the VISIBLE rendered text of a component — JSX text nodes (with `{…}`\n * expression containers stripped, nesting-aware) plus visible string\n * attributes (aria-label / placeholder / title / alt). Deliberately excludes\n * identifiers and call args: `useAction('confirmSchedule')` and the `const\n * confirmSchedule` binding must NOT count as the label \"Confirm & Schedule\"\n * appearing, or every action would false-match its own camelCase name.\n */\nfunction visibleText(sourceCode: string): string {\n // JSX text nodes: `>text<`. Excluding `>` from the run (`[^<>]`) skips the\n // `=>` arrow-body conflation — an arrow's `>` is followed by code then a\n // `>`, never text then a `<`, so only true tag-close→text→tag runs match,\n // and identifiers (`const confirmSchedule`, `useAction('confirmSchedule')`)\n // are never between `>` and `<`. `{…}` expression children are stripped so an\n // expression's identifiers don't count as visible text.\n const jsx = (sourceCode.match(/>([^<>]*)</g) ?? [])\n .map((m) => m.slice(1, -1).replace(/\\{[^}]*\\}/g, \" \"))\n .join(\" \");\n let attrs = \"\";\n const attrRx = /\\b(?:aria-label|placeholder|title|alt)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/gi;\n let m: RegExpExecArray | null;\n while ((m = attrRx.exec(sourceCode)) !== null) attrs += \" \" + (m[1] ?? m[2] ?? \"\");\n return jsx + \" \" + attrs;\n}\n\n/**\n * Find actionSpec labels whose special-character content was dropped from the\n * generated source. FALSE-POSITIVE-SAFE by construction — flags ONLY when the\n * label's alphanumeric words appear CONTIGUOUSLY in the source but the full\n * label (with its \"&\", \"/\", \"+\" …) does not, i.e. a clean transcription drop.\n * Every ambiguous shape is exempt: labels rendered from data (`.label`\n * anywhere), labels with no special char (nothing to drop), labels present\n * verbatim, entity-encoded `&` (`&amp;` — the words stop being contiguous, so\n * no flag), and very short labels. Presence-ANYWHERE, not wiring-scoped, on\n * purpose: if the label's text appears anywhere we never flag.\n */\nexport function findDroppedActionLabels(\n sourceCode: string,\n contract: DataContract | undefined,\n): Array<{ readonly name: string; readonly label: string }> {\n const actionSpec = contract?.actionSpec;\n if (actionSpec === undefined) return [];\n // Component renders any label from data → it does not transcribe → exempt all.\n if (/\\.label\\b/.test(sourceCode)) return [];\n const vis = visibleText(sourceCode);\n const normVis = normText(vis);\n const alnumVis = alnumText(vis);\n const out: Array<{ name: string; label: string }> = [];\n for (const [name, entry] of Object.entries(actionSpec)) {\n const label = entry.label;\n if (typeof label !== \"string\" || label.length === 0 || label === name) continue;\n if (!LABEL_SPECIAL_CHAR.test(label)) continue; // no special char → nothing to drop\n if (alnumText(label).length < 3) continue; // too short to match confidently\n if (normVis.includes(normText(label))) continue; // present verbatim in visible text → correct\n // The label's words appear contiguously in the VISIBLE text but the full\n // label (with its punctuation) does not → a character was dropped.\n if (alnumVis.includes(alnumText(label))) out.push({ name, label });\n }\n return out;\n}\n\nfunction runActionLabelDropped(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n return findDroppedActionLabels(input.sourceCode, input.contract).map(({ name, label }) =>\n mkIssue(\n \"universal.action_label_dropped\",\n `The action \"${name}\" declares label \"${label}\", but the rendered control appears to drop its \"${label.replace(/[a-z0-9\\s]/gi, \"\").trim()}\": the label's words are in the generated source, the full label is not — a transcription drop (ggui#1190).`,\n `Render the label EXACTLY as the contract states it — button text should be the verbatim \\`actionSpec.${name}.label\\`, or render it from data (\\`{x.label}\\`), never a re-typed copy that drops \"&\", \"/\", \"+\", etc.`,\n \"warn\",\n ),\n );\n}\n\n// ── universal.fixture_default_echo (ggui#1285 — the fixture echo) ────────\n// The probe and the judge render the source with fixture props, the judge's\n// critique quotes what it saw, and an eval-fix turn can write that text back\n// into the source as a default, a fallback or a placeholder. The fixture is\n// judging data, not the request; a visitor then sees it whenever the agent\n// leaves the prop out (guuey#1642: a builder's system-prompt line became a\n// hello's baked copy). Rule 3 of Data Parameterization stays true — defaults\n// come from the REQUEST — so a fixture value the request (or the contract's\n// own text) states is allowed; only a fixture-only value is the echo. WARN,\n// never fail: the copy is wrong, the card is not broken. Prose-like values\n// only (≥ MIN_ECHO_CHARS and a space), so a city name or a number is never a\n// hit.\nexport const MIN_ECHO_CHARS = 12;\nfunction collectStrings(value: unknown, out: string[]): void {\n if (typeof value === \"string\") {\n out.push(value);\n } else if (Array.isArray(value)) {\n for (const v of value) collectStrings(v, out);\n } else if (value !== null && typeof value === \"object\") {\n for (const v of Object.values(value)) collectStrings(v, out);\n }\n}\n/** The fixture's prose-like string values the request never stated, verbatim. */\nexport function fixtureOnlyStrings(input: Pick<AxisCheckInput, \"fixtureProps\" | \"originalPrompt\" | \"contract\">): string[] {\n if (input.fixtureProps === undefined) return [];\n const values: string[] = [];\n collectStrings(input.fixtureProps, values);\n const stated = `${input.originalPrompt}\\n${input.contract === undefined ? \"\" : JSON.stringify(input.contract)}`;\n const seen = new Set<string>();\n const out: string[] = [];\n for (const v of values) {\n const t = v.trim();\n if (t.length < MIN_ECHO_CHARS || !t.includes(\" \") || seen.has(t)) continue;\n seen.add(t);\n if (stated.includes(t)) continue;\n out.push(t);\n }\n return out;\n}\nfunction runFixtureDefaultEcho(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n for (const value of fixtureOnlyStrings(input)) {\n if (!src.includes(value)) continue;\n issues.push(\n mkIssue(\n \"universal.fixture_default_echo\",\n `A literal in the source equals a fixture value the request never stated: \"${value.length > 60 ? `${value.slice(0, 57)}…` : value}\". The fixture is judging data; a visitor sees this copy whenever the agent leaves the prop out.`,\n \"Take that copy from the prop it renders and drop the literal — no default, fallback or placeholder that repeats a fixture value. A default may only carry text the request itself states.\",\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\n// ── universal.form_submit_control (ggui#1443 — a form whose buttons cannot submit it) ──\n// The design `Button` defaults to `type=\"button\"` (the safe default: no accidental\n// submits from secondary controls), so the control that submits a `<form onSubmit>`\n// must say `type=\"submit\"`. A generated composer rendered its Send as a type-less\n// `Button` inside the form: clicking it did nothing, only Enter submitted, and the\n// card passed quality (#1398's dumps: 5 of 9 form cells, both arms). FAIL: a form\n// with buttons and no submitting control is a control that does not work. A form\n// without any button is not this check's claim; a form without `onSubmit` is not\n// read (nothing to submit to).\nconst FORM_OPEN_RX = /<form\\b[^<>]*\\bonSubmit\\s*=[^<>]*>/g;\nconst CONTROL_TAG_RX = /<(?:Button|button|input)\\b[^<>]*>/g;\nconst SUBMIT_TYPE_RX = /\\btype\\s*=\\s*(?:[\"']submit[\"']|\\{\\s*[\"']submit[\"']\\s*\\})/;\n/** Every `<form … onSubmit=…>…</form>` block in the source, verbatim (up to the first `</form>` after each opening tag). */\nexport function submitForms(sourceCode: string): string[] {\n const out: string[] = [];\n for (const m of sourceCode.matchAll(FORM_OPEN_RX)) {\n const start = m.index ?? 0;\n const end = sourceCode.indexOf(\"</form>\", start + m[0].length);\n out.push(end === -1 ? sourceCode.slice(start) : sourceCode.slice(start, end + \"</form>\".length));\n }\n return out;\n}\nfunction runFormSubmitControl(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const issues: EvalIssue[] = [];\n for (const form of submitForms(input.sourceCode)) {\n const controls = [...form.matchAll(CONTROL_TAG_RX)].map((m) => m[0]);\n if (controls.length === 0) continue;\n if (controls.some((tag) => SUBMIT_TYPE_RX.test(tag))) continue;\n const named = controls.find((tag) => /<Button\\b/.test(tag)) ?? controls[0]!;\n issues.push(\n mkIssue(\n \"universal.form_submit_control\",\n `A <form onSubmit> renders ${controls.length} control(s) and none submits it: the design Button defaults to type=\"button\", so clicking ${named.length > 60 ? `${named.slice(0, 57)}…` : named} does nothing — only Enter in a field submits.`,\n 'Give the control that submits this form type=\"submit\" — a Button inside a form defaults to type=\"button\" and never submits on click; keep type=\"button\" on the others.',\n \"fail\",\n ),\n );\n }\n return issues;\n}\n\nexport const UNIVERSAL_CHECKS: readonly AxisCheck[] = [\n {\n id: \"universal.icon_name_known\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runIconNameKnown,\n },\n {\n id: \"universal.caps_label_invented\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runCapsLabelInvented,\n },\n {\n id: \"universal.viewport_sized\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runViewportSized,\n },\n {\n id: \"universal.root_width_cap\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runRootWidthCap,\n },\n {\n id: \"universal.action_label_dropped\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runActionLabelDropped,\n },\n {\n id: \"universal.terminal_action_unguarded\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runTerminalActionUnguarded,\n },\n {\n id: \"universal.form_submit_control\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runFormSubmitControl,\n },\n {\n id: \"universal.fixture_default_echo\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runFixtureDefaultEcho,\n },\n {\n id: \"universal.accent_text_ink\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runAccentTextInk,\n },\n {\n id: \"universal.scoped_surface_owns_ground\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runScopedSurfaceOwnsGround,\n },\n {\n id: \"universal.prop_coverage\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runPropCoverage,\n },\n {\n id: \"universal.no_prop_mirror\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runNoPropMirror,\n },\n {\n id: \"universal.no_phantom_useState\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runNoPhantomUseState,\n },\n {\n id: \"universal.prop_seed_no_resync\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runPropSeedNoResync,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-merge.ts\n//\n// Checks gated on state=merge: the component owns a live entity list\n// reconciled from stream/action updates. Ported from\n// mode-checks/collection.ts (§5a state-seeded, no-hardcoded-entities,\n// derived-view-memoized).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n cap,\n getEntityCollections,\n getMutatedEntityCollections,\n mkIssue,\n} from \"../helpers.js\";\n\nfunction runStateSeededFromProps(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n const issues: EvalIssue[] = [];\n for (const e of entities) {\n const re = new RegExp(\n `useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?props\\\\.${e.name}\\\\b`,\n );\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"state.merge.seeded_from_props\",\n `Entity collection \"${e.name}\" is not seeded from props — no useState initializer reads props.${e.name}.`,\n `Add \\`const [${e.name}, set${cap(e.name)}] = useState(props.${e.name});\\` paired with \\`useEffect(() => set${cap(e.name)}(props.${e.name}), [props.${e.name}]);\\` so stream/action updates merge into live state AND agent repaints (ggui_amend) re-seed it (#480).`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoHardcodedEntities(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (entities.length === 0) return [];\n const uncommented = src\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/[^\\n]*/g, \"\");\n const issues: EvalIssue[] = [];\n const idFields = [...new Set(entities.map((e) => e.idField))];\n for (const idField of idFields) {\n const re = new RegExp(\n `\\\\[\\\\s*\\\\{[^}]*\\\\b${idField}\\\\s*:[^}]*\\\\}\\\\s*,\\\\s*\\\\{[^}]*\\\\b${idField}\\\\s*:`,\n \"g\",\n );\n if (!re.test(uncommented)) continue;\n issues.push(\n mkIssue(\n \"state.merge.no_hardcoded_entities\",\n `Hardcoded entity array literal (multiple objects with \"${idField}\") in the component — entity data should come from state/props.`,\n `Remove the literal array. Seed state from props.{entityProp} and merge updates via stream.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runDerivedViewMemoized(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (entities.length === 0) return [];\n const returnIdx = src.indexOf(\"return (\");\n if (returnIdx < 0) return [];\n const renderBody = src.slice(returnIdx);\n const issues: EvalIssue[] = [];\n for (const e of entities) {\n const re = new RegExp(`\\\\b${e.name}\\\\s*\\\\.(filter|reduce|sort)\\\\s*\\\\(`);\n if (re.test(renderBody)) {\n issues.push(\n mkIssue(\n \"state.merge.derived_view_memoized\",\n `Derived view (${e.name}.filter/reduce/sort) computed inside the render body — should be wrapped in useMemo.`,\n `Extract to \\`const ${e.name}Filtered = useMemo(() => ${e.name}.filter(...), [${e.name}, ...]);\\` before the return.`,\n \"warn\",\n ),\n );\n }\n }\n return issues;\n}\n\n/**\n * `.map()` keyed by index → reorders and merges break React reconciliation.\n * Gated on any render that iterates (list/grid/timeline/master-detail) OR\n * state=merge (mutating list).\n */\nfunction runMapKeyIsId(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const INDEX_NAMES = new Set([\"index\", \"idx\", \"i\", \"j\", \"k\", \"n\", \"ix\"]);\n const re = /key\\s*=\\s*\\{\\s*(\\w+)\\s*\\}/g;\n const issues: EvalIssue[] = [];\n for (const m of src.matchAll(re)) {\n const key = m[1];\n if (!INDEX_NAMES.has(key)) continue;\n issues.push(\n mkIssue(\n \"render.map_key_is_id\",\n `Array key uses index variable \"${key}\" — reorders and stream merges will break React reconciliation.`,\n `Replace key={${key}} with key={item.id} — or, when the items carry no id, with the field that names each one (item.label / item.symbol / item.name).`,\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_MERGE_CHECKS: readonly AxisCheck[] = [\n {\n id: \"state.merge.seeded_from_props\",\n axis: \"state\",\n values: [\"merge\"],\n run: runStateSeededFromProps,\n },\n {\n id: \"state.merge.no_hardcoded_entities\",\n axis: \"state\",\n values: [\"merge\"],\n run: runNoHardcodedEntities,\n },\n {\n id: \"state.merge.derived_view_memoized\",\n axis: \"state\",\n values: [\"merge\"],\n run: runDerivedViewMemoized,\n },\n // Map-key check: gated on any iterating render. state=merge always\n // implies iteration, so the render gate already covers it.\n {\n id: \"render.map_key_is_id\",\n axis: \"render\",\n values: [\"list\", \"grid\", \"timeline\", \"master-detail\"],\n run: runMapKeyIsId,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-ui-affordance.ts\n//\n// `state.ui_affordance.state_aria_present` (ggui#408) — a hand-rolled\n// stateful control must expose its state in ARIA.\n//\n// Why this is a DETERMINISTIC check and not (only) an LLM criterion:\n// the Experiment-53 baseline showed the defect class is structurally\n// invisible to the LLM leg — `state=ui-affordance` with no writes\n// classifies `riskTier=low`, and the low-risk bypass skips tier-1+2\n// entirely, so 10/10 ARIA-less generations were never evaluated at\n// all. Axis checks run BEFORE the bypass decision, and a `fail` among\n// them disables the bypass for that round — which both surfaces the\n// finding and routes it into the coding loop. Prototype validation\n// against the 27-cell baseline corpus: precision 1.00, recall 0.80\n// (both false negatives closed here: lowercase tags — `<div\n// as={Clickable}>` is the WORSE variant since `as` is inert on a\n// native element — and callback-prop indirection in extracted\n// subcomponents).\n//\n// Detection predicate (v2 — \"the element's own onClick mutates the\n// affordance state\"; v1's styling-dataflow precondition scored recall\n// 0.30, do not resurrect it): an element fires when its `onClick`\n// references a `useState` setter, a local handler that calls one, or\n// an `on[A-Z]…` callback prop (extracted-subcomponent shape) — AND it\n// is not a semantics-owning primitive, carries no state ARIA\n// (`aria-checked/pressed/selected/expanded/current` or any `role=`),\n// and contains no state-carrying primitive in its subtree (pushing\n// duplicate ARIA onto a wrapper around `<Checkbox>` is itself a\n// defect the judge fails — never demand it).\n//\n// Gate: `{axis: \"state\", values: [\"ui-affordance\"]}` ONLY. The\n// predicate must not reach `state=payload/draft` (form-field wrappers\n// with onClick would false-flag) or `state=merge` (kanban's per-item\n// onClick is a MOVE, not a boolean affordance).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { mkIssue } from \"../helpers.js\";\n\nconst STATE_ARIA_OR_ROLE = /aria-(checked|pressed|selected|expanded|current)\\s*=|role\\s*=/;\nconst STATE_PRIMITIVE_IN_SUBTREE = /<(Checkbox|Toggle|Tabs|Accordion)[\\s/>]/;\n/** Primitives that own their own interaction semantics — never flagged. */\nconst SEMANTIC_PRIMITIVES = new Set([\"Button\", \"Checkbox\", \"Toggle\", \"Link\", \"MenuItem\"]);\n\n/** Collect `const [x, setX] = useState(...)` setter names. */\nfunction collectSetters(src: string): Set<string> {\n const setters = new Set<string>();\n for (const m of src.matchAll(/const\\s*\\[\\s*\\w+\\s*,\\s*(set\\w+)\\s*\\]\\s*=\\s*useState/g)) {\n setters.add(m[1]);\n }\n return setters;\n}\n\n/** Collect local handler names whose body (nearby) calls a setter. */\nfunction collectHandlers(src: string, setters: Set<string>): Set<string> {\n const handlers = new Set<string>();\n for (const m of src.matchAll(/const\\s+(\\w+)\\s*=\\s*(?:\\([^)]*\\)|\\w+)\\s*=>\\s*\\{?/g)) {\n const body = src.slice(m.index + m[0].length, m.index + m[0].length + 400);\n for (const s of setters) {\n if (body.includes(s)) {\n handlers.add(m[1]);\n break;\n }\n }\n }\n return handlers;\n}\n\n/** The attribute block of an opening tag: from after the tag name to its `>` (brace-aware). */\nfunction attrBlock(src: string, start: number): { block: string; end: number } {\n let depth = 0;\n for (let i = start; i < src.length; i++) {\n const c = src[i];\n if (c === \"{\") depth++;\n else if (c === \"}\") depth--;\n else if (c === \">\" && depth === 0) return { block: src.slice(start, i), end: i };\n }\n return { block: src.slice(start, start + 900), end: start + 900 };\n}\n\n/** The brace-balanced expression of `onClick={…}`, or null when absent. */\nfunction onClickValue(block: string): string | null {\n const m = block.match(/onClick\\s*=\\s*\\{/);\n if (!m || m.index === undefined) return null;\n const open = m.index + m[0].length - 1;\n let depth = 0;\n for (let i = open; i < block.length; i++) {\n if (block[i] === \"{\") depth++;\n else if (block[i] === \"}\") {\n depth--;\n if (depth === 0) return block.slice(open + 1, i);\n }\n }\n return block.slice(open + 1);\n}\n\nfunction subtree(src: string, pos: number, tag: string): string {\n const close = src.indexOf(`</${tag}>`, pos);\n return src.slice(pos, close === -1 ? pos + 700 : close);\n}\n\nfunction runStateAriaPresent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const setters = collectSetters(src);\n const handlers = collectHandlers(src, setters);\n const issues: EvalIssue[] = [];\n const flaggedLines = new Set<number>();\n\n // Locally-defined components: their CALL SITES can never satisfy the\n // check (the ARIA lives inside the definition, which this check\n // already covers via the callback-prop clause) — flagging the call\n // site is a permanently-unresolvable finding that stalls the\n // eval-fix loop in the recurrence guard (Experiment 54: exactly the\n // 2/27 stuck cells). Skip call sites of components defined in this\n // file; the definition's own inner element carries the check.\n const localComponents = new Set<string>();\n for (const m of src.matchAll(/(?:function\\s+([A-Z]\\w*)\\s*\\(|const\\s+([A-Z]\\w*)\\s*=)/g)) {\n localComponents.add(m[1] ?? m[2]);\n }\n\n for (const m of src.matchAll(/<([A-Za-z][A-Za-z0-9]*)\\b/g)) {\n const tag = m[1];\n if (m.index === undefined) continue;\n if (localComponents.has(tag)) continue;\n const { block, end } = attrBlock(src, m.index + m[0].length);\n const clickValue = onClickValue(block);\n if (clickValue === null) continue;\n const mutatesAffordance =\n [...setters].some((s) => clickValue.includes(s)) ||\n [...handlers].some((h) => new RegExp(`\\\\b${h}\\\\b`).test(clickValue)) ||\n // Extracted-subcomponent shape: the toggle handler arrives as an\n // `on[A-Z]…` callback prop and is invoked from onClick — inside a\n // ui-affordance component that IS the affordance mutation.\n /\\bon[A-Z]\\w*\\b/.test(clickValue);\n if (!mutatesAffordance) continue;\n if (SEMANTIC_PRIMITIVES.has(tag)) continue;\n if (STATE_ARIA_OR_ROLE.test(block)) continue;\n if (STATE_PRIMITIVE_IN_SUBTREE.test(subtree(src, end, tag))) continue;\n\n const line = src.slice(0, m.index).split(\"\\n\").length;\n if (flaggedLines.has(line)) continue;\n flaggedLines.add(line);\n issues.push(\n mkIssue(\n \"state.ui_affordance.state_aria_present\",\n `Line ${line}: <${tag}> toggles the UI affordance from its onClick but exposes no state ARIA — its checked/selected/expanded state is invisible to assistive technology (styling is the only carrier).`,\n `Add the matching state attribute to the SAME element that carries the onClick: \\`role=\"checkbox\"\\` + \\`aria-checked={…}\\` for a toggle row, \\`aria-pressed\\` for a toggle button, \\`aria-selected\\` for a selection, \\`aria-expanded\\` for an open/close affordance — or replace the hand-rolled control with the state-carrying primitive (Checkbox / Toggle / Tabs / Accordion). \\`as={Clickable}\\` adds button + keyboard semantics but NOT state.`,\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_UI_AFFORDANCE_CHECKS: readonly AxisCheck[] = [\n {\n id: \"state.ui_affordance.state_aria_present\",\n axis: \"state\",\n values: [\"ui-affordance\"],\n run: runStateAriaPresent,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/realtime.ts\n//\n// Checks gated on realtime != none. Ported from mode-checks/collection.ts\n// (stream-handler-per-event, stream-merges-by-id).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n getEntityCollections,\n getMutatedEntityCollections,\n getStreamEventNames,\n mkIssue,\n} from \"../helpers.js\";\n\nconst REALTIME_ACTIVE = [\"merge\", \"append\", \"status\", \"presence\", \"mixed\"] as const;\n\nfunction runStreamHandlerPerEvent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const eventNames = getStreamEventNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of eventNames) {\n const re = new RegExp(`useStream(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"realtime.stream_handler_per_event\",\n `Stream event \"${name}\" declared in the contract has no useStream('${name}') call.`,\n `Add \\`const ${name} = useStream<...>('${name}');\\` and handle ${name}.latest in a useEffect.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runStreamMergesById(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const eventNames = getStreamEventNames(input.contract);\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (eventNames.length === 0 || entities.length === 0) return [];\n const issues: EvalIssue[] = [];\n const idFields = new Set(entities.map((e) => e.idField));\n for (const idField of idFields) {\n const re = new RegExp(`\\\\.${idField}\\\\b`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"realtime.merge.stream_merges_by_id\",\n `Entity id field \"${idField}\" is never referenced in the source — stream merge likely does not key by id.`,\n `In the stream handler, merge by id: setItems(prev => prev.map(x => x.${idField} === update.${idField} ? {...x, ...update} : x)).`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nexport const REALTIME_CHECKS: readonly AxisCheck[] = [\n {\n id: \"realtime.stream_handler_per_event\",\n axis: \"realtime\",\n values: REALTIME_ACTIVE,\n run: runStreamHandlerPerEvent,\n },\n {\n id: \"realtime.merge.stream_merges_by_id\",\n axis: \"realtime\",\n values: [\"merge\", \"mixed\"],\n run: runStreamMergesById,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/writes.ts\n//\n// Checks gated on writes != none. Ported from display.ts (action-hook,\n// action-handler) + form.ts (submit-hook, submit-handler, submit-disabled)\n// + collection.ts (per-item action variants).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n getActionNames,\n getSubmitActions,\n mkIssue,\n} from \"../helpers.js\";\n\nconst ACTIVE_WRITES = [\n \"commit\", \"multi-commit\", \"per-item\", \"submit\", \"compose\",\n] as const;\n\nfunction runActionHookWired(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const actionNames = getActionNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of actionNames) {\n const re = new RegExp(`useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"writes.action_hook_wired\",\n `Contract action \"${name}\" has no useAction('${name}') call.`,\n `Add \\`const ${name} = useAction<...>('${name}');\\` and wire it to the relevant control.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runActionHandlerAttached(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const actionNames = getActionNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of actionNames) {\n const declRe = new RegExp(\n `const\\\\s+(\\\\w+)\\\\s*=\\\\s*useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`,\n );\n const m = src.match(declRe);\n if (!m) continue;\n const constName = m[1];\n const rest = src.replace(m[0], \"\");\n if (new RegExp(`\\\\b${constName}\\\\s*\\\\(`).test(rest)) continue;\n issues.push(\n mkIssue(\n \"writes.action_handler_attached\",\n `useAction result \"${constName}\" (for action \"${name}\") is declared but never invoked.`,\n `Call ${constName}({...}) from an interactive element (e.g., <Button onClick={() => ${constName}(payload)}>).`,\n ),\n );\n }\n return issues;\n}\n\nfunction runSubmitDisabledPath(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n if (/disabled\\s*=\\s*\\{/.test(src)) return [];\n return [\n mkIssue(\n \"writes.submit.disabled_path\",\n `Form has no \\`disabled={...}\\` expression anywhere — submit is likely unconditional.`,\n `Gate submit on validation: e.g. \\`<Button disabled={!isValid} onClick={handleSubmit}>\\`.`,\n \"warn\",\n ),\n ];\n}\n\nexport const WRITES_CHECKS: readonly AxisCheck[] = [\n {\n id: \"writes.action_hook_wired\",\n axis: \"writes\",\n values: ACTIVE_WRITES,\n run: runActionHookWired,\n },\n {\n id: \"writes.action_handler_attached\",\n axis: \"writes\",\n values: ACTIVE_WRITES,\n run: runActionHandlerAttached,\n },\n {\n id: \"writes.submit.disabled_path\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitDisabledPath,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-payload.ts\n//\n// Checks gated on state=payload or writes=submit. Ported from\n// mode-checks/form.ts (submit-hook, submit-handler, state-covers-payload,\n// initial-values-seeded, option-lists-consumed, no-orphan-payload-key).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n collectStateKeys,\n getArrStrProps,\n getInitialValuePropNames,\n getSubmitActions,\n mkIssue,\n} from \"../helpers.js\";\n\nfunction runSubmitHookPresent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const re = new RegExp(`useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${s.name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"writes.submit.hook_present\",\n `Submit action \"${s.name}\" has no useAction('${s.name}') call.`,\n `Add \\`const ${s.name} = useAction<...>('${s.name}');\\` and invoke it from the submit button.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runSubmitHandlerAttached(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const declRe = new RegExp(\n `const\\\\s+(\\\\w+)\\\\s*=\\\\s*useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${s.name}['\"\\`]`,\n );\n const m = src.match(declRe);\n if (!m) continue;\n const constName = m[1];\n const rest = src.replace(m[0], \"\");\n if (new RegExp(`\\\\b${constName}\\\\s*\\\\(`).test(rest)) continue;\n issues.push(\n mkIssue(\n \"writes.submit.handler_attached\",\n `useAction result \"${constName}\" (for submit \"${s.name}\") is declared but never invoked.`,\n `Call ${constName}(payload) from the submit button's onClick handler, after validation.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runStateCoversPayload(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n const stateKeys = collectStateKeys(src);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const missing = s.payloadKeys.filter((k) => !stateKeys.has(k));\n if (missing.length === 0) continue;\n issues.push(\n mkIssue(\n \"state.payload.covers_submit\",\n `Submit action \"${s.name}\" expects payload keys [${s.payloadKeys.join(\", \")}] but state does not cover: ${missing.join(\", \")}.`,\n `Add a state slot for each missing key so the final payload can be assembled.`,\n ),\n );\n }\n return issues;\n}\n\n/**\n * Whether a `useState` initializer reads `props.<name>`: directly, or through a local bound from\n * it (`const initial = normalize(props.initialProfile)` then `useState(initial.name)`, or a\n * destructure `const { name } = props.initialProfile ?? {}` then `useState(name)`). The property\n * this check guards is \"form state is seeded from the prop\", not a spelling: ggui#1261's Exp 011\n * cell re-seeded correctly through a normalized local, was refused, and spent a turn restoring\n * the literal form.\n */\nfunction seedsFromProp(src: string, name: string): boolean {\n const propRef = `props\\\\??\\\\.${name}\\\\b`;\n const initializerReads = (ref: string): boolean =>\n new RegExp(`useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?${ref}`).test(src);\n if (initializerReads(propRef)) return true;\n const locals = new Set<string>();\n for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\\\s+(\\\\w+)\\\\s*(?::[^=]{1,80})?=\\\\s*[^;]{0,300}?${propRef}`, \"g\"))) {\n const id = m[1];\n if (id !== undefined) locals.add(id);\n }\n for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\\\s*\\\\{([^}]{1,400})\\\\}\\\\s*=\\\\s*[^;]{0,300}?${propRef}`, \"g\"))) {\n for (const part of (m[1] ?? \"\").split(\",\")) {\n const id = part.split(\":\").pop()?.split(\"=\")[0]?.trim();\n if (id !== undefined && /^\\w+$/.test(id)) locals.add(id);\n }\n }\n for (const id of locals) if (initializerReads(`\\\\b${id}\\\\b`)) return true;\n return false;\n}\n\nfunction runInitialValuesSeeded(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const initialProps = getInitialValuePropNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of initialProps) {\n if (seedsFromProp(src, name)) continue;\n issues.push(\n mkIssue(\n \"state.payload.initial_values_seeded\",\n `Prop \"${name}\" (pre-filled initial values) is never read in a useState initializer.`,\n `Seed form state from props.${name} so edit mode pre-fills.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runOptionListsConsumed(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const arrStrNames = getArrStrProps(input.contract);\n const hasAnyMap = /\\.map\\s*\\(/.test(src);\n const issues: EvalIssue[] = [];\n for (const name of arrStrNames) {\n const referenced = new RegExp(`\\\\bprops\\\\.${name}\\\\b`).test(src);\n if (referenced && hasAnyMap) continue;\n const reason = !referenced\n ? `Option list prop \"${name}\" (arr<str>) is never referenced — users cannot see the options.`\n : `Option list prop \"${name}\" (arr<str>) is referenced but the component has no .map() — options are not rendered as choices.`;\n issues.push(\n mkIssue(\n \"state.payload.option_lists_consumed\",\n reason,\n `Render options with \\`props.${name}.map(option => <RadioOption value={option} ... />)\\`.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoOrphanPayloadKey(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n const body = src\n .replace(/interface\\s+Action\\w+[\\s\\S]*?\\n}/g, \"\")\n .replace(/type\\s+Action\\w+[\\s\\S]*?\\n;/g, \"\");\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const orphans: string[] = [];\n for (const key of s.payloadKeys) {\n const re = new RegExp(`\\\\b${key}\\\\b`);\n if (!re.test(body)) orphans.push(key);\n }\n if (orphans.length === 0) continue;\n issues.push(\n mkIssue(\n \"state.payload.no_orphan_key\",\n `Submit payload keys [${orphans.join(\", \")}] never appear in the component body — missing from the submitted payload.`,\n `Add UI and state for these keys, or remove them from the ActionEntry if not needed.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_PAYLOAD_CHECKS: readonly AxisCheck[] = [\n {\n id: \"writes.submit.hook_present\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitHookPresent,\n },\n {\n id: \"writes.submit.handler_attached\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitHandlerAttached,\n },\n {\n id: \"state.payload.covers_submit\",\n axis: \"state\",\n values: [\"payload\"],\n run: runStateCoversPayload,\n },\n {\n id: \"state.payload.initial_values_seeded\",\n axis: \"state\",\n values: [\"payload\", \"draft\"],\n run: runInitialValuesSeeded,\n },\n {\n id: \"state.payload.option_lists_consumed\",\n axis: \"state\",\n values: [\"payload\"],\n run: runOptionListsConsumed,\n },\n {\n id: \"state.payload.no_orphan_key\",\n axis: \"state\",\n values: [\"payload\"],\n run: runNoOrphanPayloadKey,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/tooling.ts\n//\n// Checks gated on the tooling axis. Two surfaces:\n//\n// - `tooling.clientCapability.hook_called` — verifies every declared\n// `clientCapabilities.gadgets[name]` has a matching\n// `const <name> = …()` binding in source.\n// - `tooling.clientCapability.start_called` — verifies a bound\n// gadget hook also has a `.start(...)` invocation; without it\n// the capability stays in `idle` and never fires.\n// - `realtime.stream_source.no_direct_call` — the LLM must NOT\n// directly invoke a tool named on `streamSpec[*].source.tool`;\n// subscribe via `useStream(...)` instead.\n// - `universal.no_retired_identifiers` — fires on every contract.\n// The LLM's training data predates the current wire shape and\n// reaches for retired identifiers (component-side tool hooks,\n// dispatch.kind, intendedTool, broadcast field, retired catalog\n// names, retired package imports, retired wire-input fields).\n// The grep gate emits one issue per detected identifier so the\n// LLM rewrites toward the current shape before evaluation\n// completes.\n\nimport type { DataContract, StreamChannelEntry } from \"@ggui-ai/protocol\";\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { getGadgetNames, getStdlibGadgetNames, mkIssue } from \"../helpers.js\";\n\nconst CLIENT_PRESENT = [\"client\", \"both\"] as const;\nconst ALL_TOOLING_VALUES = [\"none\", \"wired\", \"client\", \"both\"] as const;\nconst REALTIME_ACTIVE = [\n \"merge\",\n \"append\",\n \"status\",\n \"presence\",\n \"mixed\",\n] as const;\n\n// ── clientCapabilities ──────────────────────────────────────────────\n\nfunction runGadgetHookCalled(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const names = getGadgetNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of names) {\n // The boilerplate emits `const <name> = <hook>();` — match the const\n // binding to detect omission. We don't pin the hook identifier here\n // because the contract carries it via `entry.hook` and the LLM may\n // legitimately alias on import.\n const re = new RegExp(`const\\\\s+${name}\\\\s*=`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"tooling.clientCapability.hook_called\",\n `Contract clientCapability \"${name}\" has no \\`const ${name} = …()\\` hook call.`,\n `Import the declared hook (default package: @ggui-ai/gadgets) and bind its return value to \\`const ${name}\\` at the top of the component; surface \\`.value\\` / \\`.status\\` in JSX.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runClientCapabilityStartCalled(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Only the first-party `@ggui-ai/gadgets` browser capabilities have\n // the `idle → prompting → active` lifecycle that `.start()` drives.\n // Registered third-party gadget hooks (e.g. `useBoardState`) are\n // plain data hooks the runtime resolves on its own — exclude them.\n const names = getStdlibGadgetNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of names) {\n // Skip when the binding doesn't exist — the `hook_called` check\n // covers that case; we don't double-issue.\n const bindingRe = new RegExp(`const\\\\s+${name}\\\\s*=`);\n if (!bindingRe.test(src)) continue;\n\n // The capability lifecycle requires `.start()` invocation to\n // transition from `idle` → `prompting`. Without it the hook's\n // `.value` / `.status` stay frozen at the initial state and the\n // UI feature never fires. Match `<name>.start(`, allowing chained\n // member access or method aliasing.\n const startRe = new RegExp(`\\\\b${name}\\\\s*\\\\.\\\\s*start\\\\s*\\\\(`);\n if (startRe.test(src)) continue;\n issues.push(\n mkIssue(\n \"tooling.clientCapability.start_called\",\n `clientCapability \"${name}\" is bound but \\`${name}.start(…)\\` is never invoked — the capability stays in 'idle' and the feature won't fire.`,\n `Wire \\`${name}.start({...})\\` to a UI control (Button onClick, effect, etc.). Read \\`.status\\` to gate the UI between 'idle' / 'prompting' / 'active' / 'completed' / 'denied' / 'error'.`,\n ),\n );\n }\n return issues;\n}\n\n// ── streamSpec sources ──────────────────────────────────────────────\n\nfunction collectStreamSourceTools(\n contract: DataContract | undefined,\n): Map<string, string> {\n // Map<channelName, sourceToolName> for every channel that declares\n // a source. Excludes channels without `source` (agent-written).\n const result = new Map<string, string>();\n const streamSpec = contract?.streamSpec;\n if (!streamSpec || typeof streamSpec !== \"object\") return result;\n for (const [channelName, entryRaw] of Object.entries(streamSpec)) {\n const entry = entryRaw as StreamChannelEntry | undefined;\n if (!entry || typeof entry !== \"object\") continue;\n const tool = entry.source?.tool;\n if (typeof tool !== \"string\" || tool.length === 0) continue;\n result.set(channelName, tool);\n }\n return result;\n}\n\nfunction runStreamSourceNoDirectCall(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const map = collectStreamSourceTools(input.contract);\n if (map.size === 0) return [];\n\n const issues: EvalIssue[] = [];\n for (const [channelName, toolName] of map) {\n // Detect a direct call to the source tool. Matches identifier\n // followed by `(` — covers `foo()`, `foo(args)`, `foo.bar()`\n // (the dotted form indirectly catches `someObject.foo()` which\n // the contract doesn't expect to see, since the source tool is\n // an agent-side MCP tool, not a local function).\n const callRe = new RegExp(`\\\\b${toolName}\\\\s*\\\\(`);\n if (!callRe.test(src)) continue;\n\n // Don't false-fire when `toolName` happens to be the channel name\n // bound to useStream (e.g., `const messages = useStream(...)` then\n // `messages(...)` would be weird but we're matching the TOOL name,\n // not the binding). If toolName === channelName then the\n // `<channel>(` call would be the useStream binding being called\n // as a function — which is itself wrong, so still emit.\n issues.push(\n mkIssue(\n \"realtime.stream_source.no_direct_call\",\n `Source code calls \\`${toolName}(...)\\` directly but the contract declares it as the source tool for streamSpec.${channelName}. Source tools are agent-side / runtime-polled; the component MUST NOT invoke them.`,\n `Subscribe to the channel via \\`const ${channelName} = useStream('${channelName}');\\` and read \\`${channelName}.latest\\` / \\`${channelName}.all\\` — the runtime polls or subscribes to '${toolName}' on the component's behalf.`,\n ),\n );\n }\n return issues;\n}\n\n// ── Anti-pattern grep — retired identifiers a model may emit from\n// stale training data ──\n\ninterface RetiredIdentifier {\n /** Regex matching the retired surface in source. */\n readonly pattern: RegExp;\n /** Stable subcategory used for the EvalIssue. */\n readonly id: string;\n /** Human-readable description for the issue message. */\n readonly label: string;\n /** Replacement guidance for the fix message. */\n readonly replacement: string;\n}\n\nconst RETIRED_IDENTIFIERS: readonly RetiredIdentifier[] = [\n {\n pattern: /\\buseWiredTool\\b/,\n id: \"useWiredTool\",\n label: \"`useWiredTool(...)` hook\",\n replacement:\n \"Use `useAction(name)` for user gestures the agent should react to. `agentCapabilities.tools` entries are agent-side catalog declarations — the component never calls them directly.\",\n },\n {\n pattern: /\\buseAgentTool\\b/,\n id: \"useAgentTool\",\n label: \"`useAgentTool(...)` hook\",\n replacement:\n \"Agent-side tools are NEVER imported as component hooks. The contract declares them under `agentCapabilities.tools` for cross-ref (actionSpec.nextStep / streamSpec.source.tool); the component reacts via `useAction` / `useStream`.\",\n },\n {\n pattern: /\\bcallWiredTool\\b/,\n id: \"callWiredTool\",\n label: \"`callWiredTool(...)` call\",\n replacement:\n \"Component-side direct invocation of agent-side tools is retired. Fire a UI gesture via `useAction(name)`; the agent reacts on its next turn (`nextStep` hint optional).\",\n },\n {\n pattern: /\\buseClientTool\\b/,\n id: \"useClientTool\",\n label: \"`useClientTool(name, handler)` hook\",\n replacement:\n \"Use a gadget hook from `@ggui-ai/gadgets` (e.g., `useGeolocation`, `useClipboardWrite`) and thread the result into a contextSpec slot or actionSpec payload.\",\n },\n {\n pattern: /\\bdispatch\\s*:\\s*\\{\\s*kind\\s*:/,\n id: \"dispatch.kind\",\n label: \"`dispatch: { kind: '...' }` discriminated union\",\n replacement:\n \"ActionEntry.dispatch is retired. Use the flat `nextStep?: '<tool>'` field on the action entry instead.\",\n },\n {\n pattern: /\\bintendedTool\\b/,\n id: \"intendedTool\",\n label: \"`intendedTool` field\",\n replacement:\n \"Use the flat `nextStep` field — the hint surface is one optional advisory string, not a nested discriminator.\",\n },\n {\n pattern: /\\bmode\\s*:\\s*['\"`]host-routed['\"`]/,\n id: \"mode.host-routed\",\n label: \"`mode: 'host-routed'`\",\n replacement:\n \"The `mode` field on action entries is retired. All actions are agent-routed; use `nextStep` for the optional tool hint.\",\n },\n {\n pattern: /\\bbroadcast\\s*:\\s*\\{/,\n id: \"broadcast\",\n label: \"`broadcast: { … }` contract field\",\n replacement:\n \"Move the channel source declaration to `streamSpec[channel].source = { tool, args? }`.\",\n },\n {\n // Match `agentTools` only as a contract-shaped object key or\n // property access — not as a local variable name in unrelated\n // code. `\\bagentTools\\s*[:.]` catches `{ agentTools: {...} }` /\n // `contract.agentTools` while ignoring `const agentTools = ...`.\n pattern: /\\bagentTools\\s*[:.]/,\n id: \"contract.agentTools\",\n label: \"`agentTools` top-level contract field\",\n replacement:\n \"The top-level `agentTools` field is retired. Declare agent-side tools under `agentCapabilities.tools` (catalog nested under a capabilities parent for symmetry with `clientCapabilities`).\",\n },\n {\n pattern: /\\bclientCapabilities\\s*\\.\\s*capabilities\\b/,\n id: \"clientCapabilities.capabilities\",\n label: \"`clientCapabilities.capabilities` inner key\",\n replacement:\n \"The inner `capabilities` key is retired. Use `clientCapabilities.gadgets` — entries are library-hook declarations, not RPC capabilities.\",\n },\n {\n pattern: /['\"`]@ggui-ai\\/client-tools['\"`]/,\n id: \"package.@ggui-ai/client-tools\",\n label: \"`@ggui-ai/client-tools` package import\",\n replacement:\n \"The package was renamed to `@ggui-ai/gadgets`. Update the import string.\",\n },\n {\n pattern: /\\bPushStory\\b/,\n id: \"PushStory\",\n label: \"`PushStory` type / `pushStorySchema` schema\",\n replacement:\n \"`PushStory` was retired when the handshake input was flattened. The current wire is `ggui_handshake({intent, blueprintDraft: {contract, variance?, generator?}})` + `ggui_render({handshakeId, props, override?: {contract?, variance?}})` (omit `override` to accept the proposal as-is).\",\n },\n {\n pattern: /\\bpushStorySchema\\b/,\n id: \"pushStorySchema\",\n label: \"`pushStorySchema` zod schema\",\n replacement:\n \"`pushStorySchema` was retired alongside `PushStory`. Current schemas: `handshakeInputSchema` + `renderInputSchema` (with the optional `override` re-aim) in `@ggui-ai/protocol`.\",\n },\n {\n pattern: /\\bstory\\s*\\.\\s*adapters\\b/,\n id: \"story.adapters\",\n label: \"`story.adapters` field access\",\n replacement:\n \"The story.adapters gate was retired alongside `PushStory`. Per-app permission gates flow through `clientCapabilities.gadgets[*].permission` (Permissions-Policy derivation).\",\n },\n {\n pattern: /\\bdeclaredAdapters\\b/,\n id: \"declaredAdapters\",\n label: \"`declaredAdapters` field / runtime gate\",\n replacement:\n \"App-level `declaredAdapters` was retired. Per-app permission gates derive from `clientCapabilities.gadgets[*].permission` instead.\",\n },\n {\n pattern: /\\bassertAdaptersDeclared\\b/,\n id: \"assertAdaptersDeclared\",\n label: \"`assertAdaptersDeclared(...)` runtime call\",\n replacement:\n \"The runtime adapter-gate function is retired. Permissions-Policy is derived per-contract at render commit time and threaded through the bootstrap projection.\",\n },\n {\n pattern: /\\bHandshakeStoredStory\\b/,\n id: \"HandshakeStoredStory\",\n label: \"`HandshakeStoredStory` storage type\",\n replacement:\n \"The OSS handler's stored type is now `HandshakeStoredInput` with the MVB-5 `{intent, blueprintDraft, forceCreate?}` shape.\",\n },\n {\n pattern: /\\brecord\\s*\\.\\s*story\\b/,\n id: \"record.story\",\n label: \"`record.story.*` access on handshake storage\",\n replacement:\n \"Handshake storage was flattened. Read `record.input.*` (intent / blueprintDraft) — the nested `story` wrapper is gone. MVB-5 also adds `record.suggestion` + `record.effectiveContract`.\",\n },\n];\n\nfunction runNoRetiredIdentifiers(input: AxisCheckInput): EvalIssue[] {\n // Source-only scan; compiled code irrelevant for identifier detection.\n // Run even without compiled code so we surface early in the loop.\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n for (const rule of RETIRED_IDENTIFIERS) {\n if (!rule.pattern.test(src)) continue;\n issues.push(\n mkIssue(\n `universal.no_retired_identifiers.${rule.id}`,\n `Source contains ${rule.label} — retired from the contract surface.`,\n rule.replacement,\n ),\n );\n }\n return issues;\n}\n\nexport const TOOLING_CHECKS: readonly AxisCheck[] = [\n {\n id: \"tooling.clientCapability.hook_called\",\n axis: \"tooling\",\n values: CLIENT_PRESENT,\n run: runGadgetHookCalled,\n },\n {\n id: \"tooling.clientCapability.start_called\",\n axis: \"tooling\",\n values: CLIENT_PRESENT,\n run: runClientCapabilityStartCalled,\n },\n {\n // Stream-source direct-call check. Gated on realtime axis (rather\n // than tooling) since stream sources are a realtime concern — but\n // logically lives in tooling.ts alongside the other tool-reference\n // checks since the issue class is about referenced agentTools.\n id: \"realtime.stream_source.no_direct_call\",\n axis: \"realtime\",\n values: REALTIME_ACTIVE,\n run: runStreamSourceNoDirectCall,\n },\n {\n // Universal — fires on every tooling-axis value. The check itself\n // is contract-agnostic; the axis gate is \"every contract\" via the\n // full ALL_TOOLING_VALUES list (rather than the universal-check\n // module's \"render\" gate convention) so the anti-pattern stays\n // co-located with the other tooling-related rules.\n id: \"universal.no_retired_identifiers\",\n axis: \"tooling\",\n values: ALL_TOOLING_VALUES,\n run: runNoRetiredIdentifiers,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/grid.ts\n//\n// Checks gated on `render=grid`.\n//\n// ── grid.board_columns_side_by_side (ggui#1046) ─────────────────────────\n// A kanban classifies as `render=grid` (the classifier's GRID_RX carries\n// `kanban`), and three of four constrained mints on the candidate-15 image\n// composed the board's columns as a vertical <Stack> of sections — no <Grid>\n// anywhere — then read below the judge's bar; the tier-2 evaluator saw the\n// stacking only as a `warn`, which never costs a fix turn. This check reads\n// the source the way the fix turn must: find the JSX map over the board's\n// columns array and name the layout primitive that ENCLOSES it. <Grid> or\n// <Row> = side by side; <Stack> / <Card> / <Box> / a bare block / nothing =\n// stacked. Stands down in `free` design mode, where the primitive is optional.\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { axisCheckTraceEnabled, mkIssue } from \"../helpers.js\";\n\n/** Prop names a board's column array goes by. */\nconst BOARD_PROP_RX = /^(columns?|lanes?|stages?|lists?|buckets?|swimlanes?)$/i;\nconst BOARD_PROMPT_RX = /\\b(kanban|board)\\b/i;\n/** The names a board's column array goes by, for the prompt and source paths. */\nconst BOARD_NAMES = [\"columns\", \"lanes\", \"stages\", \"lists\", \"buckets\", \"swimlanes\"] as const;\n/** Layout primitives whose nesting decides side-by-side vs stacked. */\nconst LAYOUT_TAG_RX = /<(\\/?)(Grid|Row|Stack|Card|Box|Container|ScrollArea|div|section)\\b([^<>]*?)>/g;\nconst SIDE_BY_SIDE = new Set([\"Grid\", \"Row\"]);\n\ninterface PropShapeLike {\n type?: string;\n schema?: { type?: string };\n}\n\n/** The board prop names the contract declares as arrays. */\nexport function boardPropNames(contract: AxisCheckInput[\"contract\"]): string[] {\n const propsField = contract?.propsSpec as { properties?: Record<string, PropShapeLike> } | undefined;\n const properties = propsField?.properties ?? {};\n return Object.entries(properties)\n .filter(([name, p]) => BOARD_PROP_RX.test(name) && (p?.type === \"array\" || p?.schema?.type === \"array\"))\n .map(([name]) => name);\n}\n\n/**\n * Every JSX map over `name`, by index — an expression-body arrow (`name.map((col) => (<…`)\n * or a block-body one (`name.map((col) => { … return (<…`); the serving deployment's candidate-18 kanban\n * mints composed two of three stacked boards through the block form (ggui#1046), which the\n * first reader never matched.\n */\nfunction jsxMapPositions(sourceCode: string, name: string): number[] {\n const rx = new RegExp(\n `\\\\b${name}(?:\\\\?\\\\.)?\\\\.map\\\\(\\\\s*\\\\(?\\\\s*\\\\w+(?:\\\\s*,\\\\s*\\\\w+)?\\\\s*\\\\)?\\\\s*=>\\\\s*(?:\\\\(?\\\\s*<|\\\\{[^{}]{0,600}?\\\\breturn\\\\s*\\\\(?\\\\s*<)`,\n \"g\",\n );\n return [...sourceCode.matchAll(rx)].map((m) => m.index ?? 0);\n}\n\n/** The layout primitive enclosing `pos`, walked as a tag stack over the source before it. */\nexport function enclosingLayoutTag(sourceCode: string, pos: number): string | undefined {\n const stack: string[] = [];\n for (const m of sourceCode.slice(0, pos).matchAll(LAYOUT_TAG_RX)) {\n const closing = m[1] === \"/\";\n const name = m[2] ?? \"\";\n const attrs = m[3] ?? \"\";\n if (closing) {\n if (stack[stack.length - 1] === name) stack.pop();\n continue;\n }\n if (attrs.trimEnd().endsWith(\"/\")) continue; // self-closing\n stack.push(name);\n }\n return stack[stack.length - 1];\n}\n\n/** What the check read (ggui#1046): the board names it walked and, per name, every JSX map's enclosing layout tag. */\nexport interface BoardRead {\n readonly declared: readonly string[];\n readonly names: readonly string[];\n readonly perName: ReadonlyArray<{ readonly name: string; readonly maps: number; readonly enclosing: readonly string[] }>;\n}\n\n/** The board check's own trace line (ggui#1046). */\nexport interface BoardColumnsTrace extends BoardRead {\n readonly designMode: string;\n readonly standDown: boolean;\n readonly result: \"pass\" | \"fail\" | \"stand-down\";\n}\n\nexport function describeBoardRead(input: AxisCheckInput): BoardRead {\n // Which array the board's columns are: the contract names it; else the prompt says\n // \"board\" / \"kanban\"; else the SOURCE itself does — a JSX map over a board-shaped name\n // (ggui#1046: on candidate 20 the check flagged every stacked source locally and none on\n // the serving deployment, where the contract and prompt reach it in another shape; the\n // source is the one input every path hands over verbatim).\n const declared = boardPropNames(input.contract);\n const names = declared.length > 0\n ? declared\n : BOARD_PROMPT_RX.test(input.originalPrompt)\n ? [...BOARD_NAMES]\n : BOARD_NAMES.filter((n) => jsxMapPositions(input.sourceCode, n).length > 0);\n const perName = names.map((name) => {\n const positions = jsxMapPositions(input.sourceCode, name);\n return { name, maps: positions.length, enclosing: positions.map((pos) => enclosingLayoutTag(input.sourceCode, pos) ?? \"nothing\") };\n });\n return { declared, names, perName };\n}\n\n/** Board maps composed under something other than <Grid> / <Row>: `[propName, enclosing tag or \"nothing\"]`. */\nexport function findStackedBoardColumns(input: AxisCheckInput): Array<readonly [string, string]> {\n const stacked: Array<readonly [string, string]> = [];\n for (const { name, enclosing } of describeBoardRead(input).perName) {\n for (const tag of enclosing) if (!SIDE_BY_SIDE.has(tag)) stacked.push([name, tag]);\n }\n return stacked;\n}\n\nfunction runBoardColumnsSideBySide(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const standDown = input.designMode === \"free\";\n const stacked = standDown ? [] : findStackedBoardColumns(input);\n if (axisCheckTraceEnabled()) {\n // The check's own line beside the dispatcher's (ggui#1046): what it read, PASS and stand-down included.\n const line: BoardColumnsTrace = {\n ...describeBoardRead(input),\n designMode: input.designMode ?? \"constrained\",\n standDown,\n result: standDown ? \"stand-down\" : stacked.length > 0 ? \"fail\" : \"pass\",\n };\n console.log(JSON.stringify({ boardColumnsTrace: line }));\n }\n if (stacked.length === 0) return [];\n const [name, tag] = stacked[0]!;\n return [\n mkIssue(\n \"grid.board_columns_side_by_side\",\n `The board's \\`${name}\\` are composed under <${tag}> — a vertical stack of column sections; at md and wider the columns must sit side by side.`,\n `Wrap the ${name} map in <Grid columns={{ base: 1, md: ${name}.length }} gap=\"md\"> (each column its own <Stack> of cards); never a <Stack> of column sections.`,\n ),\n ];\n}\n\nexport const GRID_CHECKS: readonly AxisCheck[] = [\n {\n id: \"grid.board_columns_side_by_side\",\n axis: \"render\",\n values: [\"grid\"],\n run: runBoardColumnsSideBySide,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/extras.ts\n//\n// Axis-specific checks that had no legacy home. These fire on axis values\n// the old 3-mode dispatch didn't route (drag, swipe, compose, multi-step,\n// mixed streams). Intentionally narrow — each catches a specific failure\n// mode the fragments' prompt text tells the LLM to avoid.\n\nimport type { AxisCheck, AxisCheckInput } from \"./types.js\";\nimport type { EvalIssue } from \"../types-public.js\";\n\nfunction mkIssue(\n subcategory: string,\n description: string,\n fix: string,\n result: \"fail\" | \"warn\" = \"warn\",\n): EvalIssue {\n return { tier: 0, result, category: \"mode\", subcategory, description, fix };\n}\n\n/**\n * writeTrigger=drag → must attach onDragStart + onDrop (or onDragOver)\n * somewhere. Otherwise the drag handler is decorative.\n */\nconst dragTriggerWired: AxisCheck = {\n id: \"writeTrigger.drag.handlers_wired\",\n axis: \"writeTrigger\",\n values: [\"drag\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasStart = /onDragStart\\s*=/.test(src);\n const hasDrop = /onDrop\\s*=/.test(src);\n if (hasStart && hasDrop) return [];\n return [\n mkIssue(\n \"writeTrigger.drag.handlers_wired\",\n `Classified as writeTrigger=drag but component lacks ${!hasStart ? \"onDragStart\" : \"\"}${!hasStart && !hasDrop ? \" + \" : \"\"}${!hasDrop ? \"onDrop\" : \"\"} handlers.`,\n \"Attach onDragStart to draggable items and onDrop (with onDragOver preventDefault) to drop zones.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * writeTrigger=swipe → must wire onTouchStart + onTouchEnd. Also emit\n * a warn if no fallback click handlers exist (desktop users).\n */\nconst swipeTriggerWired: AxisCheck = {\n id: \"writeTrigger.swipe.handlers_wired\",\n axis: \"writeTrigger\",\n values: [\"swipe\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasTouch = /onTouchStart\\s*=/.test(src) && /onTouchEnd\\s*=/.test(src);\n if (!hasTouch) {\n return [\n mkIssue(\n \"writeTrigger.swipe.handlers_wired\",\n \"Classified as writeTrigger=swipe but component lacks onTouchStart + onTouchEnd handlers.\",\n \"Wire onTouchStart to record the start X/Y, onTouchEnd to classify direction and fire the action.\",\n \"fail\",\n ),\n ];\n }\n return [];\n },\n};\n\n/**\n * writes=compose → exactly one action should be called with ids sourced\n * from two different state slots. Heuristic: at least two useState or\n * props.id references should appear in the action invocation's argument\n * region.\n *\n * Light check: warn if only one id-bearing field appears near the useAction\n * invocation (hard to get false-positive free without AST).\n */\nconst composeCrossEntity: AxisCheck = {\n id: \"writes.compose.cross_entity_ids\",\n axis: \"writes\",\n values: [\"compose\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Look for an action invocation passing an object literal with >= 2\n // `*Id` or `id` keys. That's the compose signature.\n const re = /\\{\\s*[^}]*?\\b(\\w*Id|id)\\b[^}]*?,\\s*[^}]*?\\b(\\w*Id|id)\\b[^}]*?\\}/s;\n if (re.test(src)) return [];\n return [\n mkIssue(\n \"writes.compose.cross_entity_ids\",\n \"Classified as writes=compose but no action invocation passes two id-bearing keys together.\",\n \"The compose action must receive both entity ids in one payload, e.g. `schedule({ eventId, calendarId })`.\",\n \"warn\",\n ),\n ];\n },\n};\n\n/**\n * layout=multi-step → integer step state + a step-guard on Next. Re-uses\n * the form check's multi-step signal, but fires even when writes != submit\n * (e.g., multi-step wizards that never submit, like onboarding).\n */\nconst multiStepHasState: AxisCheck = {\n id: \"layout.multi_step.state_present\",\n axis: \"layout\",\n values: [\"multi-step\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasIntStep = /useState(?:<number>)?\\s*\\(\\s*[0-9]+\\s*\\)/.test(src);\n if (hasIntStep) return [];\n return [\n mkIssue(\n \"layout.multi_step.state_present\",\n \"Classified as layout=multi-step but no integer-typed useState tracks the current step.\",\n \"Add `const [step, setStep] = useState(0);` and branch rendering on it.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * layout=multi-step → the design system's Stepper composite must be\n * ADOPTED (rendered). D8 (Exp 47) measured adoption at 17/18 from\n * fragment + JSDoc alone; this check gives the CHECK leg ownership of\n * the mandate so a regression surfaces as a fix turn instead of\n * silently shipping a wizard with no step affordance.\n *\n * Replaces the always-on `stepper-display-only` pitfall (deleted in the\n * same slice): with adoption carried by the WHAT leg, a 6th always-on\n * prompt rule was pure attention-dilution cost (the exp66 count-\n * sensitivity class, ~+9s blended), while this check prices at zero\n * outside multi-step cells. The pitfall's display-only guidance lives\n * on in the fix string below — delivered only when a cell actually\n * needs it.\n */\nconst stepperAdopted: AxisCheck = {\n id: \"layout.multi_step.stepper_adopted\",\n axis: \"layout\",\n values: [\"multi-step\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n // `free` design mode: the Stepper composite is optional (the prompt\n // names it as a default, not a requirement), so the adoption\n // mandate stands down. `layout.multi_step.state_present` — the\n // behavioural rule — still fires in both modes.\n if (input.designMode === \"free\") return [];\n if (/<Stepper[\\s/>]/.test(input.sourceCode)) return [];\n return [\n mkIssue(\n \"layout.multi_step.stepper_adopted\",\n \"Classified as layout=multi-step but the design system's Stepper composite is never rendered.\",\n \"Render <Stepper steps={STEPS} current={step} /> above the step body — STEPS is a top-level const array of step labels and `step` is your own useState index. Stepper is display-only: it never stores or advances the step itself.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * realtime=mixed → the contract declares multiple events of different\n * kinds. Each must have its own useStream call. We approximate by\n * requiring ≥ 2 useStream calls when the vector is mixed.\n */\nconst mixedStreamsHaveHandlers: AxisCheck = {\n id: \"realtime.mixed.handlers_per_event\",\n axis: \"realtime\",\n values: [\"mixed\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Accept both `useStream('x')` and `useStream<T>('x')` (generic type arg).\n // The boilerplate pre-emits typed calls, so the `(` -only regex was a\n // 100%-false-positive on chat-interface + stock-ticker (Experiment 34).\n const matches = src.match(/useStream\\s*(?:<[^>]*>)?\\s*\\(/g);\n const count = matches?.length ?? 0;\n if (count >= 2) return [];\n return [\n mkIssue(\n \"realtime.mixed.handlers_per_event\",\n `Classified as realtime=mixed but only ${count} useStream call(s) found — mixed streams need one handler per event.`,\n \"Add a separate `useStream('eventName')` for each event in the contract.\",\n \"fail\",\n ),\n ];\n },\n};\n\nexport const EXTRA_CHECKS: readonly AxisCheck[] = [\n dragTriggerWired,\n swipeTriggerWired,\n composeCrossEntity,\n multiStepHasState,\n stepperAdopted,\n mixedStreamsHaveHandlers,\n];\n","// packages/ui-gen/src/evaluation/axis-checks/registry.ts\n//\n// Flat list of all axis-gated checks. The dispatcher iterates this and\n// runs every entry whose gate matches the classification's axis vector.\n\nimport type { AxisCheck } from \"./types.js\";\nimport { UNIVERSAL_CHECKS } from \"./checks/universal.js\";\nimport { STATE_MERGE_CHECKS } from \"./checks/state-merge.js\";\nimport { STATE_UI_AFFORDANCE_CHECKS } from \"./checks/state-ui-affordance.js\";\nimport { REALTIME_CHECKS } from \"./checks/realtime.js\";\nimport { WRITES_CHECKS } from \"./checks/writes.js\";\nimport { STATE_PAYLOAD_CHECKS } from \"./checks/state-payload.js\";\nimport { TOOLING_CHECKS } from \"./checks/tooling.js\";\nimport { GRID_CHECKS } from \"./checks/grid.js\";\nimport { EXTRA_CHECKS } from \"./extras.js\";\n\nexport const REGISTRY: readonly AxisCheck[] = [\n ...UNIVERSAL_CHECKS,\n ...STATE_MERGE_CHECKS,\n ...STATE_UI_AFFORDANCE_CHECKS,\n ...REALTIME_CHECKS,\n ...WRITES_CHECKS,\n ...STATE_PAYLOAD_CHECKS,\n ...TOOLING_CHECKS,\n ...GRID_CHECKS,\n ...EXTRA_CHECKS,\n];\n","// Evaluation type vocabulary shared between the harness runtime and its\n// check/evaluator surfaces. This is the narrow contract layer — the\n// type language every harness leg is written against:\n//\n// - `EvalIssue` — the single issue shape everything produces.\n// - `EvalTier` / `EvalOutcome` / `EvalCategory` — the issue's axes.\n// - `Priority` — P0/P1/P2 ranking referenced by the retry formatter.\n// - `EvalResult` — aggregate shape a runner returns.\n// - `QualityMode` / `QualityConfig` / `DEFAULT_QUALITY_CONFIG` —\n// the quality-mode knob the adapter surface consumes.\n// - `priorityForIssue` / `isBlocked` / `getActionableIssues` — the\n// purely-typed helpers over the vocabulary.\n//\n// `EvalIssue` is referenced by `PatchFn`, `TierCheck`, `LLMEvaluator`,\n// and `RuntimeRenderCheck` in the harness types hub.\n\n// ─── Priority ──────────────────────────────────────────────────────────────\n// P0 = must (compile + complete), P1 = should (safety), P2 = nice (quality).\n// Single source of truth for the retry-formatter ranking.\n\nexport type Priority = \"P0\" | \"P1\" | \"P2\";\n\nimport type { VisionFinishReason } from '../harness/llm-router.js';\nimport type { GenerationRuntimeProbeOutcome, GenerationRuntimeProbeStatus } from \"@ggui-ai/mcp-server-core\";\nimport type { CanvasClass, DesignMode } from \"../design-mode.js\";\n\n// ─── Issue shape ───────────────────────────────────────────────────────────\n\nexport type EvalTier = 0 | 1 | 2;\nexport type EvalOutcome = \"fail\" | \"warn\" | \"pass\";\n\nexport type EvalCategory =\n | \"compile\"\n | \"security\"\n | \"contract\"\n | \"types\"\n | \"imports\"\n | \"tokens\" // tier 0\n | \"mode\" // tier 0 — per-mode deterministic\n | \"functionality\"\n | \"crash\" // tier 1\n | \"interactivity\"\n | \"accessibility\"\n | \"layout\"\n | \"loading\"\n | \"visual\"; // tier 2\n\nexport interface EvalIssue {\n tier: EvalTier;\n result: EvalOutcome;\n category: EvalCategory;\n /**\n * Priority tier — threaded through to the retry formatter so the LLM can\n * rank its next patch against the prompt's P0/P1/P2 priority schema.\n * Derived from (category, result) via {@link priorityForIssue} when not\n * explicitly set. Optional on construction; check-runners typically\n * populate it before returning.\n */\n priority?: Priority;\n subcategory?: string;\n severity?: \"critical\" | \"major\";\n description: string;\n fix: string;\n line?: number;\n /**\n * The visual leg's provenance (ggui#1545): `judge` (the model's finding) or `instrument` (a deterministic\n * measurement). Absent on every other leg's issues. `visualEvaluation.actOn` acts on `judge` only.\n */\n origin?: \"judge\" | \"instrument\";\n}\n\n/**\n * Runtime-render probe execution status — four-valued so \"the probe\n * never ran\" is never conflated with \"the probe ran clean\". ONE union: the\n * same values a generation's metadata reports (`GenerationRuntimeProbeStatus`\n * in `@ggui-ai/mcp-server-core`), declared there and named here.\n *\n * - `ran` — probe executed; its findings (possibly none) are\n * in the issue stream under `runtime:*` subcategories.\n * - `infra-skipped` — probe could NOT execute (environment failure:\n * happy-dom load, user-event document capture,\n * ESM/CJS interop). Carries ZERO probe evidence;\n * consumers MUST NOT count it as a pass.\n * - `not-applicable`— nothing to probe (no compiled code, no contract\n * surface, or no runtimeRender check configured).\n * - `timed-out` — probe started but did not finish inside its\n * wall-clock bound (ggui#1299). Carries ZERO\n * evidence about the component: on a contended\n * host an ordinary component crosses the bound.\n * Consumers MUST NOT count it as a pass, and MUST\n * NOT count it as a crash either. `elapsedMs` and\n * `hostLoad` say how long it ran and how busy the\n * host was, so a reader can tell the two cases apart.\n */\nexport type RuntimeProbeStatus = GenerationRuntimeProbeStatus;\n\n/**\n * The host's 1-minute load average at a probe's start and end, beside the\n * number of CPUs the process can use (ggui#1299). A load well above\n * `cores` means the probe competed for CPU; a wall-clock bound crossed\n * there says more about the host than about the component.\n */\nexport interface ProbeHostLoad {\n readonly start: number;\n readonly end: number;\n readonly cores: number;\n}\n\n/**\n * ggui#1398 — whether the controls the probe clicked showed they were\n * working once their action was pending. Report-only: it is read by the\n * benchmark and never counted into the probe's warnings or fed back to\n * the coding loop.\n */\nexport interface ProbePendingAffordance {\n /** Controls the pending phase marked pending: those whose click dispatched their action (click or submit wiring) and that were still in the page. `visible + missing.length === dispatched`. */\n readonly dispatched: number;\n /** Of those, how many visibly changed while pending (disabled, busy, text, or replaced). */\n readonly visible: number;\n /** The actions whose control did not visibly change, including one whose card threw while pending. */\n readonly missing: readonly string[];\n /** Actions whose control was no longer in the page when its turn came (the card replaced it, or blanked after a throw): never marked, not counted as dispatched. */\n readonly gone: readonly string[];\n}\n\n/**\n * The engine's own fields on a probe's meta, beside the outcome a\n * generation's metadata reports: why a probe did not finish, its render\n * time, the host's load around it. Present on every arm of\n * {@link RuntimeProbeMeta}; each is absent when the probe had nothing to\n * say about it.\n */\nexport interface RuntimeProbeMetaDetail {\n /** Populated for `infra-skipped` / `not-applicable` / `timed-out` — why the probe didn't finish. */\n readonly reason?: string;\n /** `ran` only: the check's own render time, inside `elapsedMs`. */\n readonly renderMs?: number;\n /** Host load around the probe, when it ran isolated (absent for an in-process probe). */\n readonly hostLoad?: ProbeHostLoad;\n /** Time the check waited for a probe slot before it started, ms; present only when > 0 (ggui#1380 C2b). */\n readonly queuedMs?: number;\n /**\n * `ran` only: the pending-affordance walk (ggui#1398). Absent when no\n * action walk ran, so \"no data\" and \"0 of 0\" read differently.\n */\n readonly pendingAffordance?: ProbePendingAffordance;\n}\n\n/**\n * Probe execution meta stamped onto an `EvalResult` at the exit-decision\n * points that invoke the probe. Absence of this field means the eval\n * path never reached a probe invocation at all — consumers treat that\n * the same as not-run, never as a pass.\n *\n * ONE union with the generation metadata's probe outcome\n * (`GenerationRuntimeProbeOutcome` in `@ggui-ai/mcp-server-core`, declared\n * there and carried here with {@link RuntimeProbeMetaDetail} on every arm),\n * so the round's stamp and the metadata's record cannot say different\n * things (ggui#1380):\n *\n * - `ran` + `verdict: 'pass'` — the probe executed and no check failed;\n * - `ran` + `verdict: 'fail'` — ANY check failed; `failChecks` lists the\n * distinct check kinds that did (`RenderCheckKind`, the engine's name\n * for the same union), never empty, in the order `RENDER_CHECK_KINDS`\n * declares them, parsed from the probe's own\n * `runtime:<check>[:<subject>]` issues;\n * - `timed-out` / `infra-skipped` / `not-applicable` — no verdict, and the\n * type carries none. `elapsedMs` (on every status that reached the\n * check) and `hostLoad` say how long it ran and how busy the host was.\n *\n * The verdict and the repair trigger are two different questions. The\n * verdict is `fail` on any failing check. The one repair turn a probe-only\n * round buys fires on a `render-no-throw` fail the engine recognises\n * (`isRecoverableRenderCrash`) and on nothing else: on the PROBE-ONLY round a\n * `fail` verdict whose checks are `prop-sensitivity`, `action-wiring` or any\n * other kind is recorded here and never fed back. The same meta is stamped on\n * the EVALUATION lane, where a `prop-sensitivity` fail buys that lane's own\n * contract-feedback round (ggui#1261, `FEEDBACK_PROBE_CHECKS`) — a different\n * turn under a different rule, not the repair turn.\n */\nexport type RuntimeProbeMeta = GenerationRuntimeProbeOutcome & RuntimeProbeMetaDetail;\n\n/**\n * The one repair turn a probe-only round buys (ggui#1380). A serving\n * deployment that wires the runtime probe and configures no evaluator runs\n * the probe once after the coding turns; a render crash the engine\n * recognises buys exactly one repair turn, then one re-probe. This records\n * what came of it:\n * - `compiled: false` — the repair turn's code did not pass self-check, so\n * no re-probe ran (there is no `after`) and the pre-repair card is the\n * one served;\n * - `compiled: true` — the re-probe ran and `after` is its whole meta:\n * its status, its verdict when it ran, and the checks that still fail.\n * Whether the crash class the turn was bought for is still there is\n * `after.verdict === 'fail' && after.failChecks.includes('render-no-throw')`.\n * The two arms are exclusive by type.\n */\nexport type RuntimeProbeRepair =\n | { readonly attempted: true; readonly compiled: false; readonly trigger?: never }\n | { readonly attempted: true; readonly compiled: true; readonly trigger: RuntimeProbeMeta };\n\n/**\n * Per-criterion execution status — three-valued so \"the criterion\n * silently produced no verdict\" is never conflated with \"the criterion\n * ran clean\", and neither is conflated with \"not evaluated by design\".\n * Same doctrine and vocabulary family as `RuntimeProbeStatus` above.\n *\n * - `ran` — the LLM call completed and returned a verdict\n * for this criterion; its findings (possibly\n * none) are in `issues`.\n * - `skipped` — the call errored or returned no tool call. The\n * criterion carries ZERO evidence; the evaluator\n * fail-opens it into `pass` to avoid blocking\n * generation on flaky LLM calls, so consumers\n * MUST consult this field before treating `pass`\n * membership as a verdict. Counts AGAINST\n * coverage.\n * - `not-applicable` — the evaluator was bypassed by design for this\n * cell (e.g. the same-image low-risk bypass:\n * axis checks clean, tier-1/2 never invoked).\n * `reason` names the bypass. Excluded from\n * coverage denominators — it is neither evidence\n * nor a silent absence.\n */\nexport type CriterionRunStatus = \"ran\" | \"skipped\" | \"not-applicable\";\n\n/** Coverage row for one evaluation criterion of one eval run. */\nexport interface CriterionCoverage {\n readonly criterion: string;\n readonly tier: 1 | 2;\n readonly status: CriterionRunStatus;\n /** Populated for `skipped` / `not-applicable` — why no verdict. */\n readonly reason?: string;\n}\n\n/**\n * Coverage of the screenshot JUDGE leg for one eval round (ggui#1221) — a\n * different surface from the `visual` CRITERION in `criteriaCoverage` (the\n * LLM evaluator's read of the source). `ran` = a frame was captured and\n * judged; `skipped` = the leg was configured but produced no verdict\n * (no browser, a launch or in-page failure, an unbundlable component, an\n * unparsable judge answer) with `reason` naming why; `not-applicable` =\n * the round had no visual leg configured. Before this row a skipped leg\n * left NO trace on the result — `{ issues: [] }` read exactly like a\n * clean run, and every bootstrap mint on a browserless runtime \"passed\"\n * its visual round that way.\n */\nexport interface VisualCoverage {\n readonly status: CriterionRunStatus;\n /** Populated for `skipped` / `not-applicable` — why no verdict. */\n readonly reason?: string;\n}\n\n/**\n * The static criteria `runLLMEvaluation` runs, in stamp order — the\n * ONE list both the evaluator's coverage stamp and the harness's\n * bypass stamp derive from, so the two can never disagree on the set.\n * Tier 1 = binary pass/fail gates; tier 2 = fail/warn/pass quality.\n */\nexport const LLM_EVAL_STATIC_CRITERIA: ReadonlyArray<{ readonly criterion: string; readonly tier: 1 | 2 }> = [\n { criterion: \"functionality\", tier: 1 },\n { criterion: \"crash\", tier: 1 },\n { criterion: \"interactivity\", tier: 2 },\n { criterion: \"accessibility\", tier: 2 },\n { criterion: \"layout\", tier: 2 },\n { criterion: \"loading\", tier: 2 },\n { criterion: \"visual\", tier: 2 },\n];\n\n/**\n * Coverage rows for a cell where the evaluator was BYPASSED BY DESIGN\n * (never invoked) — one `not-applicable` row per static criterion, all\n * carrying `reason`. Harness exits that skip tier-1/2 evaluation stamp\n * this so the cell is neither a silent absence (field missing) nor\n * evidence. Same shape contract as `runLLMEvaluation`'s stamp: always\n * every criterion. Lives here (not in llm-evaluator) because the bypass\n * exit runs before the evaluator module is lazily loaded.\n */\nexport function notApplicableCoverage(reason: string): CriterionCoverage[] {\n return LLM_EVAL_STATIC_CRITERIA.map(({ criterion, tier }) => ({\n criterion,\n tier,\n status: \"not-applicable\",\n reason,\n }));\n}\n\n/** One contract-feedback round (ggui#1261): what bought it, and the source it was fed back on. */\nexport interface ContractFeedbackRecord {\n /** The exit-probe issue subcategories that bought the round, e.g. `runtime:prop-sensitivity:currentUser`. */\n readonly firedOn: readonly string[];\n /** The component source as it stood when the model was told — the round's BEFORE. */\n readonly sourceBefore: string;\n}\n\nexport interface EvalResult {\n issues: EvalIssue[];\n pass: string[];\n /**\n * Per-criterion coverage for this eval run — one row per static\n * criterion, ALWAYS all of them when present. Stamped by\n * `runLLMEvaluation` (`ran` / `skipped`) and by the harness on\n * evaluator-bypass exits (`not-applicable` + reason). The harness\n * carries it unchanged through every later re-stamp of this result.\n * Absent = coverage UNKNOWN (paths that predate the instrument, e.g.\n * `parseEvalResponse` replays) — never assume `ran`, never assume\n * bypass.\n */\n criteriaCoverage?: CriterionCoverage[];\n /**\n * Runtime-render probe execution meta. Stamped by the exit-decision\n * probe runner; absent on eval paths that never invoke the probe.\n */\n runtimeProbe?: RuntimeProbeMeta;\n /**\n * The probe-only round's repair record (ggui#1380) — present only when a\n * recoverable render crash bought the one repair turn. See\n * {@link RuntimeProbeRepair}. `runtimeProbe` beside it is the re-probe's\n * verdict when the repair compiled, else the pre-repair probe's.\n */\n runtimeProbeRepair?: RuntimeProbeRepair;\n /**\n * The contract-feedback round, when one fired this generation (ggui#1261):\n * which exit-probe findings bought it and the source as it stood when the\n * model was told. `runtimeProbe` and the `runtime:*` issues on this result\n * are the probe's verdict AFTER that round; `sourceBefore` beside the final\n * source is the round's before/after. Absent when no such round fired.\n */\n contractFeedback?: ContractFeedbackRecord;\n /**\n * Per-canvas visual verdicts. Stamped by the harness ONLY when the\n * visual leg ran with `visualEvaluation.canvases` set (arm-neutral —\n * the same judge in every design mode); absent on the single-shot\n * visual path and whenever the visual leg did not run. PNGs stay on\n * `runVisualEvaluation`'s own result (`VisualEvaluationResult.canvases[*].screenshotPng`),\n * never here — this object is serialized into reports.\n */\n visual?: VisualEvalSummary;\n /**\n * Whether the screenshot judge leg ran, was skipped (with the reason) or\n * was not configured — ALWAYS stamped by the harness's eval round\n * (ggui#1221), so a consumer can tell a clean visual run from a leg\n * that silently could not run. See {@link VisualCoverage}.\n */\n visualCoverage?: VisualCoverage;\n}\n\n/** One canvas's visual verdict, PNG-free — see `EvalResult.visual`. */\n/**\n * How one canvas's `score` was reached (ggui#1072): `k` vision calls on the\n * SAME captured frame, aggregated by `rule`. Always present — `k: 1` ⇒\n * `samples: [score]`, `sigma: 0`, `notes: [critique]` — so one shape serves\n * a single judgement and a median of many. `samples`/`notes` carry only the\n * calls the judge could parse (in call order); `k` stays the requested count,\n * so a short `samples` is visible on the row rather than filled in.\n */\nexport interface CanvasJudgeRecord {\n readonly k: number;\n readonly rule: 'median';\n readonly samples: number[];\n /** Population σ of `samples` (0 when one sample). */\n readonly sigma: number;\n /** The judge's per-canvas critique per sample — the words beside a swing. */\n readonly notes: string[];\n /**\n * ggui#1127 — the cause of each scoring sample whose answer failed to parse and was SALVAGED: its four dimensions\n * were recovered from the closed prefix, its issues kept only as far as they closed, its critique lost. One entry\n * per salvaged sample; absent when every sample parsed. The salvaged sample's score still counts.\n */\n readonly salvaged?: readonly JudgeSalvageCause[];\n /**\n * ggui#1127 — the criteria call's answer was salvaged. A salvage keeps no criteria, so that frame's judge rows read\n * \"not answered\" with this cause rather than a clean `n/a`. Absent when the call parsed or was not asked.\n */\n readonly criteriaSalvaged?: JudgeSalvageCause;\n /**\n * ggui#1687 — the model asked for, and every model the provider said answered this canvas's calls (scoring and\n * criteria), deduplicated. `served` is empty when no provider named one: unknown, never \"the requested model\".\n * When the request names an alias and the provider echoes the alias (measured on a hosted route, 125 of 125\n * canvases), `served` confirms the alias was honoured but cannot tell two snapshots behind it apart. A judge that\n * must is pinned to a dated snapshot id instead. With the alias, a snapshot change shows only as a step on a date in\n * the judge's pooled within-call spread, read by week. That is a read someone runs, not a monitor.\n */\n readonly models?: { readonly requested: string; readonly served: readonly string[] };\n}\n\n/**\n * ggui#1687 — what the criteria call's answer held, before resolution. A row the judge left unanswered reads `n/a`\n * either way; this says whether the call came back empty, cut, or with entries the parser had to drop.\n */\nexport interface CriteriaAnswerCounts {\n /** The answer carried a `criteria` array. `false`: absent or not an array, so no row was read from it. */\n readonly array: boolean;\n /** Entries in the array. */\n readonly received: number;\n /** Entries kept: an object with a string id and a verdict of pass, fail or n/a. */\n readonly kept: number;\n /** Entries dropped, by why. */\n readonly dropped: { readonly notObject: number; readonly badId: number; readonly badVerdict: number };\n}\n\n/**\n * ggui#1127 — why a judge answer that failed to parse had to be salvaged. `output-cap`: the provider reported it\n * stopped at the output cap. `malformed`: the provider reported a normal stop, so the answer ended but did not\n * parse. `stopped`: the provider stopped it for another reason it named (a safety stop, or one it reports as\n * other), so it is cut, not malformed. `unknown`: the provider or route reported no stop reason. Never inferred\n * from the answer's length.\n */\nexport type JudgeSalvageCause = \"output-cap\" | \"malformed\" | \"stopped\" | \"unknown\";\n\n/** ggui#1127 — salvaged judge answers across a canvas run, per leg, as N of M. */\nexport interface JudgeSalvageCounts {\n /** Scoring answers: `answers` = samples that parsed or were salvaged, `salvaged` = those salvaged. */\n readonly scoring: { readonly salvaged: number; readonly answers: number };\n /** Criteria calls: `answered` = calls that parsed or were salvaged, `salvaged` = those salvaged (criteria lost). */\n readonly criteria: { readonly salvaged: number; readonly answered: number };\n}\n\n// ─── Visual criteria (ggui#1436) ──────────────────────────────────────────\n// The judge's typed criteria block per canvas — report-only beside the score\n// until a later word flips a gate to it. Every field below is optional on the\n// stamps so yesterday's `eval.json` and an old judge answer still parse (N−1).\nimport type { FetchShape, LayoutShape, RenderShape, RiskTier, StateShape, WriteShape } from \"../classifier/axes.js\";\n\nexport type CriteriaSeverity = \"must\" | \"should\";\nexport type CriteriaVerdict = \"pass\" | \"fail\" | \"n/a\";\n/** The method that produces a verdict: an instrument's measurement, the vision judge off the frame, or a person's eye. */\nexport type CriteriaMethod = \"instrument\" | \"judge\" | \"human\";\n/** The method's readiness, as the bank's author wrote it — the only source of an `n/a` that is not the judge's own. */\nexport type CriteriaStatus = \"live\" | \"reference\" | \"planned\" | \"manual\";\n/**\n * How a criterion entered the selection: bank-level (`static`, an empty scope) or by the selector's\n * rules for this card (`context`). A model PROPOSING a criterion at judge time is RESERVED and not a\n * member until a consumer exists — it would be `should`-only, recorded verbatim, never a gate.\n */\nexport type CriteriaSource = \"static\" | \"context\";\nexport type CriteriaChroma = \"achromatic\" | \"chromatic\" | \"unknown\";\n/** The classifier's shape axes, as hashed into the set id. */\nexport interface CriteriaAxes {\n render: RenderShape;\n state: StateShape;\n writes: WriteShape;\n fetch: FetchShape;\n layout: LayoutShape;\n}\n/** The selector's inputs, stored with the verdict so a reader recomputes `criteriaSetId` from the record alone. */\nexport interface CriteriaContext {\n canvas: CanvasClass;\n hasActions: boolean;\n riskTier: RiskTier;\n axes: CriteriaAxes;\n chroma: CriteriaChroma;\n profilePresent: boolean;\n /** The harness's shell as named; `unknown` when the round carries none. */\n shell: string;\n /** The caller's item kind (a bootstrap mint's `hello`); hashed when present. */\n kind?: string;\n /** The styling preset in force (the profile's aesthetic id); a recipe is selected only under its preset. */\n preset?: string;\n}\n/** What was asked and why — recorded BEFORE the judge runs. Omission is the selector's decision. */\nexport interface CriteriaSelection {\n id: string;\n source: CriteriaSource;\n reason: string;\n}\n/** One criterion's verdict; `n/a` is the judge's answer (\"cannot read this off the frame\"), an unanswered id, a tie, or a method whose `status` is not live. */\nexport interface CriterionVerdict {\n id: string;\n severity: CriteriaSeverity;\n method: CriteriaMethod;\n status: CriteriaStatus;\n source: CriteriaSource;\n verdict: CriteriaVerdict;\n evidence: string;\n /**\n * ggui#1663 — a measured reading beside a judge row, REPORT-ONLY: the row's `verdict` stays the judge's, so this\n * changes no verdict, score or bar. Present only on rows an instrument answers beside the judge (`space.edge`).\n */\n instrument?: { verdict: CriteriaVerdict; evidence: string };\n}\n/** ggui#1687 — the criteria call as it came back: its answer's counts, ids it answered outside the bank, its stop. */\nexport interface CriteriaCallRecord {\n readonly answer: CriteriaAnswerCounts;\n /** Kept entries whose id names no row of the bank. */\n readonly unknownIds: number;\n /** The provider's normalized stop reason (`length` = the output cap); absent when it reported none. */\n readonly finishReason?: VisionFinishReason;\n}\nexport interface CriteriaBlock {\n /** sha256(bank version | selector version | canonical context), 16 hex — the block's own digest. */\n criteriaSetId: string;\n bankVersion: string;\n selectorVersion: string;\n context: CriteriaContext;\n selection: CriteriaSelection[];\n verdicts: CriterionVerdict[];\n /** ggui#1687 — the call that answered this block, when one did. Absent for a block resolved with no call. */\n call?: CriteriaCallRecord;\n}\n/** The roll-up across canvases; a `must` at `n/a` is listed, never counted as a pass. */\nexport interface CriteriaRollup {\n mustFailed: string[];\n shouldFailed: string[];\n mustNa: string[];\n}\n\n/** ggui#1492 — a host\"s frame round the inline card, as data. Colours are `#rrggbb`; the ring\"s `alpha` is 0..1. */\nexport interface HostInlineFrame {\n /** The frame\"s surface — what shows behind a transparent card, and under the floor\"s residual. */\n readonly surface: string;\n /** The room the frame sits in (the page ground round it). */\n readonly ground: string;\n readonly ring: { readonly widthPx: number; readonly color: string; readonly alpha: number };\n readonly radiusPx: number;\n /** The host\"s minimum frame height: a card shorter than it sits in a frame this tall, and the visitor sees the rest as void. */\n readonly minHeightPx?: number;\n}\n/** ggui#1492 — how a host presents one canvas: the label the judge is told, the page ground, and (the inline card only) its frame. */\nexport interface CanvasHostPresentation {\n readonly label: string;\n /** The page ground under a fill canvas\"s panel; the inline card\"s ground lives on its {@link HostInlineFrame}. */\n readonly ground?: string;\n readonly frame?: HostInlineFrame;\n}\n/** ggui#1492 — why the judge did not draw a canvas's host presentation. The codes are the lane reader's own. */\nexport type HostPresentationIgnoredReason = \"label_missing\" | \"color_not_hex\" | \"frame_off_inline\" | \"frame_malformed\" | \"ground_on_inline\";\n/**\n * ggui#1492 — what the judge DID with a canvas's host presentation, read from the judge itself: `applied` carries\n * the presentation it drew, `ignored` the reason it drew none. Absent when the caller supplied no presentation.\n */\nexport type CanvasPresentationOutcome =\n | { readonly status: \"applied\"; readonly applied: CanvasHostPresentation }\n | { readonly status: \"ignored\"; readonly reason: HostPresentationIgnoredReason };\n\nexport interface CanvasVisualSummary {\n canvas: CanvasClass;\n viewport: { width: number; height: number };\n /** The judge's weighted score at this canvas (0-100). */\n score: number;\n /** `score >= passThreshold`, and on the inline card: no overflow (ggui#1027). */\n passed: boolean;\n /** The document's scroll height at this canvas, CSS px; `null` when unmeasurable (ggui#1027). */\n contentHeight: number | null;\n /** `contentHeight > viewport.height` — measured on every canvas, judged per `canvasFitPolicy`. */\n overflow: boolean;\n /**\n * ggui#1120 — how far down the capture anything was painted: the last inked row over the measured\n * region's height (inside a drawn host panel's chrome on md/lg/xl), read from the screenshot's\n * pixels against their dominant colour. `0` is the blank the judge fails (`canvas-blank`); every\n * other value is reported, never scored. `null` when the capture could not be read.\n */\n inkRatio: number | null;\n /** How `score` was reached — always present (ggui#1072). */\n judge: CanvasJudgeRecord;\n /** ggui#1436 — the typed criteria block, when a bank was configured; report-only. */\n criteria?: CriteriaBlock;\n /** ggui#1492 — what the judge did with this canvas's host presentation, when one was supplied. */\n presentation?: CanvasPresentationOutcome;\n /**\n * How the judge composed the mount (ggui#1100): `'fill'` on every\n * fullscreen canvas — the served runtime's fit, the root stretched to\n * the frame; absent on the inline card, which keeps its natural height.\n */\n fit?: 'fill';\n}\n\n/**\n * ggui#1195 — the fit reading on the canvas whose policy FAILS an overflow\n * (the inline chat card): the box it was judged at (`ceiling` — the order's\n * declared viewport when one was carried, else the class box), whether that\n * box was declared, and how many px of content sit below it (0 = fits).\n * Present only when such a canvas was judged with a measurable height, so\n * the bar and the ledger read one number for \"does the hello fit\".\n */\nexport interface VisualFitStamp {\n readonly canvas: CanvasClass;\n readonly ceiling: { readonly width: number; readonly height: number };\n readonly declared: boolean;\n readonly overflowPx: number;\n}\n\n/** The visual leg's per-canvas summary — see `EvalResult.visual`. */\nexport interface VisualEvalSummary {\n /** Mean of the canvas scores (rounded). */\n score: number;\n /** Every canvas passed. */\n passed: boolean;\n canvases: CanvasVisualSummary[];\n /** ggui#1195 — see {@link VisualFitStamp}; absent when no fail-policy canvas was judged. */\n fit?: VisualFitStamp;\n /** The design tree the judge painted with (ggui#1042): `src` + `srcSha256` — `design@judge`. */\n design?: { readonly src: string; readonly srcSha256: string };\n /** The mode the judge's tokens were composed in, when the caller said (ggui#1076). */\n themeMode?: 'light' | 'dark';\n /** ggui#1436 — the criteria roll-up across canvases, when any canvas carries a block; report-only. */\n criteria?: CriteriaRollup;\n}\n\n// ─── Quality mode ──────────────────────────────────────────────────────────\n\nexport type QualityMode = \"fast\" | \"auto-improve\" | \"high-quality\";\n\nexport interface QualityConfig {\n quality: QualityMode;\n visualEval: boolean;\n maxCostPerGeneration: number;\n model?: { provider?: string; model?: string };\n}\n\nexport const DEFAULT_QUALITY_CONFIG: QualityConfig = {\n quality: \"fast\",\n visualEval: false,\n maxCostPerGeneration: 3,\n};\n\n// ─── Axis-check types ──────────────────────────────────────────────────────\n// The `AxisCheck` type vocabulary lives here. The check bodies\n// themselves (REGISTRY, per-axis implementations) live under\n// `./axis-checks/`.\n\nimport type { DataContract } from \"@ggui-ai/protocol\";\nimport type { JsonObject } from \"@ggui-ai/protocol\";\nimport type { AxisVector, Classification } from \"../classifier/axes.js\";\nimport type { AxisKey } from \"../fragments/index.js\";\n\nexport interface AxisCheckInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n /** Full classification — checks may read sibling axes. */\n classification: Classification;\n /**\n * Which triad produced the source. Checks that assert a design-package\n * component (e.g. `layout.multi_step.stepper_adopted`) read it and\n * stand down in `free` mode, where the primitive is optional. Absent\n * means `constrained`.\n */\n designMode?: DesignMode;\n /**\n * The rendering canvas the source is judged FOR (ggui#1117). A width cap on\n * the outermost element is a defect on a fullscreen canvas and a no-op in a\n * chat bubble, so a check that reads width must know the surface. Populated\n * where the harness is built (`Harness.canvas`); ABSENT for callers with no\n * rendering context — a check handles `undefined`, it never assumes a\n * default (a silent `lg` would be the same guess with a nicer face).\n */\n canvas?: CanvasClass;\n /**\n * The props the probe and the judge RENDERED the source with (ggui#1285) — a bootstrap order's\n * `sampleProps`, the bench commit's fixture. They are judging data, not the request: a literal in\n * the source that equals one of these values, and that the request never stated, is baked copy a\n * visitor sees whenever the agent leaves the prop out. Populated on the served loop and at\n * auto-commit; ABSENT where the caller has none — the check stands down, it never guesses.\n */\n fixtureProps?: JsonObject;\n}\n\n/**\n * A gated check. Runs only when the classification's axis value matches\n * one of the gate's accepted values. Multiple gates (implicit AND) support\n * cross-axis combinations.\n */\nexport interface AxisCheck {\n /** Stable id used in issue subcategories. */\n id: string;\n /** Primary axis this check gates on. */\n axis: AxisKey;\n /** Which values of that axis activate the check. */\n values: readonly string[];\n /** Optional extra gate on a sibling axis (e.g., only when state=merge AND writes=per-item). */\n and?: { axis: AxisKey; values: readonly string[] };\n /** Execute the check and emit zero or more issues. */\n run(input: AxisCheckInput): EvalIssue[];\n}\n\n/**\n * Whether a check's gate(s) match the given axis vector. Pure function,\n * no issue emission.\n */\nexport function matches(vector: AxisVector, check: AxisCheck): boolean {\n const primary = vector[check.axis] as string;\n if (!check.values.includes(primary)) return false;\n if (check.and) {\n const sibling = vector[check.and.axis] as string;\n if (!check.and.values.includes(sibling)) return false;\n }\n return true;\n}\n\n// ─── Purely-typed helpers ──────────────────────────────────────────────────\n\n/**\n * Map a tier-0 issue category to the canonical P0/P1/P2 priority.\n *\n * Sourced from the criteria priority assignments:\n * - P0 (must): compile, security, imports, contract, types, mode\n * - P1 (safety): tokens, crash, functionality\n * - P2 (quality): interactivity, accessibility, layout, loading, visual\n */\nexport function priorityForIssue(category: EvalCategory): Priority {\n if (\n category === \"interactivity\" ||\n category === \"accessibility\" ||\n category === \"layout\" ||\n category === \"loading\" ||\n category === \"visual\"\n ) {\n return \"P2\";\n }\n if (category === \"tokens\" || category === \"crash\" || category === \"functionality\") {\n return \"P1\";\n }\n // compile, security, imports, contract, types, mode → P0.\n return \"P0\";\n}\n\n/** Whether any issue blocks shipping (has result = 'fail'). */\nexport function isBlocked(result: EvalResult): boolean {\n return result.issues.some((i) => i.result === \"fail\");\n}\n\n/**\n * Return the issues the agent should act on, depending on quality mode.\n * - fast: only fails (blocking issues)\n * - auto-improve / high-quality: fails + warns\n */\nexport function getActionableIssues(result: EvalResult, mode: QualityMode): EvalIssue[] {\n if (mode === \"fast\") {\n return result.issues.filter((i) => i.result === \"fail\");\n }\n return result.issues.filter((i) => i.result === \"fail\" || i.result === \"warn\");\n}\n\n// ─── Criteria (single source of truth for coding + eval sides) ─────────────\n//\n// Each criterion is defined ONCE with both sides of the contract:\n// - codingGuidance: what the coding agent should DO\n// - evalInstruction: what the eval agent should CHECK\n// They must be compatible — changing one means reviewing the other.\n//\n// This is *validated* shipping content: it's what the hosted runtime sends\n// to every generation today. External OSS implementers building their own\n// prompts should be able to use the same rubric — hence it's open.\n\nexport interface EvalCriterion {\n /** Unique identifier matching the eval tool name (e.g., 'functionality') */\n id: string;\n /** Human-readable name shown to both agents */\n name: string;\n /** Priority tier — P0 must, P1 should, P2 nice */\n priority: Priority;\n /** What the coding agent should DO to satisfy this criterion */\n codingGuidance: string;\n /** What the eval agent should CHECK — the evaluation prompt */\n evalInstruction: string;\n /** Tier 0 = programmatic, Tier 1 = LLM critical, Tier 2 = LLM quality */\n tier: 0 | 1 | 2;\n /** Eval outcome when this criterion fails */\n failOutcome: \"fail\" | \"warn\";\n}\n\nexport const CRITERIA: readonly EvalCriterion[] = [\n // ── P0: Correctness (must satisfy — failure = broken component) ──\n\n {\n id: \"compile\",\n name: \"Compile & type-check\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance:\n \"Code must compile. The typed Props and wire hook generics are enforced by the compiler.\",\n evalInstruction: \"Checked automatically by esbuild + TypeScript. No LLM evaluation needed.\",\n },\n {\n id: \"render-props\",\n name: \"Render all Props fields\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance: \"Render every Props field in JSX. Access via props.fieldName.\",\n evalInstruction:\n \"Check that every field from interface Props appears as props.fieldName in the function body.\",\n },\n {\n id: \"wire-hooks\",\n name: \"Wire all contract hooks\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Wire every useAction/useStream and every clientCapabilities.gadgets hook (e.g., useGeolocation) to a UI element. `agentCapabilities.tools` is a catalog the AGENT invokes — NOT a component hook surface.\",\n evalInstruction:\n \"Check that every hook variable from the boilerplate appears in the JSX or an effect.\",\n },\n {\n id: \"imports\",\n name: \"Valid imports only\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance: \"Only import from react, @ggui-ai/design/*, and @ggui-ai/wire.\",\n evalInstruction: \"Flag any import from a package not in the allowlist.\",\n },\n {\n id: \"security\",\n name: \"No eval/fetch/window\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance: \"Never use eval(), fetch(), or window. Data comes from props and hooks.\",\n evalInstruction: \"Flag any call to eval(), fetch(), or window access.\",\n },\n\n // ── P1: Safety (should satisfy — failure = crash or bad UX) ──\n\n {\n id: \"functionality\",\n name: \"All features implemented\",\n priority: \"P1\",\n tier: 1,\n failOutcome: \"fail\",\n codingGuidance: \"Implement ALL features from the request AND the data contract.\",\n evalInstruction: `Evaluate FUNCTIONALITY: Does this component implement ALL features from the request AND the data contract?\n\nCheck against BOTH sources:\n1. Original request — each feature must be coded AND rendered in JSX\n2. Data contract (if present) — verify:\n - Props fields are rendered in the UI. EXCEPTION: pure identifier fields (\\`id\\`, \\`*Id\\`, keys) that exist only to be echoed back inside an action payload do NOT need to be visibly rendered.\n - ALL useAction hooks are wired to clickable UI elements\n - ALL useStream hooks are consumed — the streamed data must reach the UI. Merging stream events into rendered state (a list, a counter, the displayed records) COUNTS as consuming the stream; it need not be a literal \\`.latest\\` render.\n - ALL clientCapabilities gadgets are used. \\`clientCapabilities.gadgets\\` is keyed by npm package: built-in browser capabilities (useGeolocation / useCamera / …) import from @ggui-ai/gadgets; registered third-party gadgets (e.g. useChartTheme) import from their OWN package. Any gadget the contract declares IS a contract feature — NEVER flag it as \"not part of the contract\".\n - \\`agentCapabilities.tools\\` is a catalog declaration only; do NOT flag missing component-side calls for it\n\nA contract hook that is declared but never used at all is a MISSING feature.\n\nCRITICAL: The \"issues\" array must ONLY contain features you are CERTAIN are missing or broken — never an implemented feature. (See \"Issue-array discipline\" above: no speculative, self-negating, or \"verify that…\" entries.)`,\n },\n {\n id: \"crash\",\n name: \"No crash scenarios\",\n priority: \"P1\",\n tier: 1,\n failOutcome: \"fail\",\n codingGuidance:\n \"Guard optional props (props.field?.x). stream.latest is T|null — always null-guard. .all is always an array.\",\n evalInstruction: `Evaluate CRASH SAFETY: Are there ACTUAL runtime crash scenarios?\n\nWILL crash (include in issues):\n- .map()/.filter()/.length on an uninitialized variable\n- Accessing property of undefined without guard\n- useStream().latest.field WITHOUT null guard — .latest is T | null\n- Optional Props field accessed as props.field.x without guard\n- Array item optional field: items.map(item => item.priority.toUpperCase()) when priority is optional\n\nSAFE (do NOT include):\n- Optional chaining: props.items?.map() — SAFE\n- Fallback: items || [] — SAFE\n- useState initializer: useState([]) — SAFE\n- Null check: items && items.map() — SAFE\n- stream.latest && stream.latest.field — SAFE, guarded\n- stream.all.map(...) — SAFE, .all is always an array\n- stream.all.length — SAFE, always a number\n\nThe \"issues\" array is ONLY for a specific line that WILL throw at runtime. NEVER put a line you have determined is safe into the issues array — not even to note that it is safe (\"…so this is safely guarded\", \"…so there is no crash\"). If you cannot name a concrete line that will throw, the answer is {\"pass\": true} — return that and an empty issues array.`,\n },\n {\n id: \"tokens\",\n name: \"Design system tokens\",\n priority: \"P1\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Use CSS variables for colors (var(--ggui-color-*)); use the spacing scale for gap/padding/margin (gap=\\\"md\\\", padding=\\\"lg\\\").\",\n evalInstruction:\n \"Flag hardcoded hex colors, rgba/hsl functions, and numeric or raw-CSS-length spacing props. A t-shirt-scale spacing name (gap=\\\"md\\\") IS a token — never flag it.\",\n },\n\n // ── P2: Quality (nice to have — failure = lower score, not broken) ──\n\n {\n id: \"interactivity\",\n name: \"Sufficient interactive elements\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Add appropriate interactive elements for the component purpose.\",\n evalInstruction: `Evaluate INTERACTIVITY: Does this component have sufficient interactive elements?\n\nConsider: forms need submit buttons, lists need selection, editable content needs save/cancel.\nContract actions (if present): every useAction hook should be triggered by a visible UI element.\n\nOnly list MISSING interactive elements. Use 'fail' only for issues blocking core purpose.`,\n },\n {\n id: \"accessibility\",\n name: \"Accessible markup\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance:\n \"Add labels on form inputs, alt text on images, semantic HTML, and state ARIA (aria-checked/pressed/selected/expanded) on hand-rolled interactive controls.\",\n evalInstruction: `Evaluate ACCESSIBILITY: missing labels, alt text, semantic HTML, keyboard support, ARIA state.\n\nggui primitives bake in their own ARIA — see \"Primitive Accessibility\" in the Design System context above. NEVER flag a ggui primitive (Input/Select/TextArea, RadioGroup, Checkbox, Toggle, Progress, Slider, Spinner, Skeleton, Tabs, Accordion, Alert, Toast, Tooltip, Clickable, Icon) for a missing role / aria-* / label / keyboard handler — it is already there and not visible in the source you are reading.\n\nFlag ONLY real gaps: a raw div/span used as an interactive control; a hand-rolled control whose checked/selected/expanded/pressed state is conveyed only by styling (strikethrough, color, a check icon) with no \\`aria-checked\\` / \\`aria-pressed\\` / \\`aria-selected\\` / \\`aria-expanded\\`; an image with no alt text; an Input/Select/TextArea with no \\`label\\` prop; an icon-only Button with no aria-label; live/streaming data not wrapped in an aria-live region; inverted heading hierarchy.\n\nOnly list MISSING accessibility features. Use 'fail' only if it blocks delivery.`,\n },\n {\n id: \"layout\",\n name: \"Clean layout\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Use proper spacing and visual grouping.\",\n evalInstruction: `Evaluate LAYOUT: Check spacing, alignment, visual grouping, and composition.\n\nOnly list ACTUAL layout problems. Use 'fail' only for fundamentally broken layouts.`,\n },\n {\n id: \"loading\",\n name: \"Loading/empty/error states\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Handle async data, empty collections, and error cases.\",\n evalInstruction: `Evaluate LOADING/EMPTY/ERROR STATES: Does the component handle async data and edge cases?\n\nContract-specific: useStream should handle pre-data state. clientCapabilities hooks may return undefined / permission-denied — defensive guards expected before threading values into JSX.\nProps-only components (no async, no streams, no client capabilities) do NOT need loading states — return pass.\n\nOnly list MISSING states.`,\n },\n {\n id: \"visual\",\n name: \"Design system consistency\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Use design system tokens consistently.\",\n evalInstruction: `Evaluate VISUAL CONSISTENCY: Is the component using the design system correctly?\n\nFlag: hardcoded colors instead of CSS variables, numeric or raw-CSS-length spacing instead of the t-shirt scale, style objects bypassing design system.\nA t-shirt-scale spacing name (gap=\"md\", padding=\"lg\") IS correct token usage — never flag it.\nIntentional custom colors (status indicators) are acceptable when no semantic token fits.\n\nOnly list ACTUAL violations. Use 'fail' only for pervasive violations.`,\n },\n] as const;\n\n/**\n * `designMode: 'free'` overrides — ONLY the two criteria whose text\n * encodes the design vocabulary. `tokens` narrows to COLOR (the free arm\n * relaxes spacing / typography / radius / shadow to literals but keeps\n * brand-bearing color on the closed `--ggui-color-*` manifest, no\n * fallbacks); `visual` becomes arm-neutral (composition, hierarchy,\n * consistency, fit to canvas — no reward or penalty for design-system\n * usage). Every other criterion is shared verbatim between the modes.\n * Constraint alignment: what the free prompt says, the free evaluator\n * checks — and nothing more.\n */\nconst FREE_DESIGN_CRITERIA_OVERRIDES: readonly EvalCriterion[] = [\n {\n id: \"tokens\",\n name: \"Color tokens\",\n priority: \"P1\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Every color is a bare var(--ggui-color-*) from the token manifest — no hex, rgb()/hsl(), CSS named colors or literal fallbacks, in style props and <style> blocks alike. Spacing, typography, radius and shadow geometry may be literals.\",\n evalInstruction:\n \"Flag hardcoded hex colors, rgba/hsl functions, CSS named colors, and literal fallbacks inside var(--ggui-*) references. Do NOT flag literal spacing, font sizes, radii or pixel values — they are allowed in this mode.\",\n },\n {\n id: \"visual\",\n name: \"Visual composition\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance:\n \"Compose deliberately: one clear focal point, consistent spacing rhythm, a coherent theme-token palette, a fit to the rendering canvas.\",\n evalInstruction: `Evaluate VISUAL COMPOSITION: Is the component composed deliberately for its canvas?\n\nJudge: visual hierarchy (one clear focal point, headings distinct from body text), consistent spacing rhythm and alignment, a coherent palette drawn from the theme tokens, fit to the canvas (fluid width, no fixed widths, nothing cramped or stretched).\nDo NOT reward or penalise the use of design-system primitives — raw HTML with inline CSS is a first-class choice here. Literal spacing / typography / radius values are fine.\n\nOnly list ACTUAL composition problems. Use 'fail' only for a fundamentally incoherent composition.`,\n },\n];\n\n/**\n * The criteria registry for a design mode. `constrained` IS `CRITERIA`\n * (same array, byte-identical summary); `free` swaps in the two\n * overrides above by id, preserving order.\n */\nexport function criteriaFor(designMode: DesignMode = \"constrained\"): readonly EvalCriterion[] {\n if (designMode === \"constrained\") return CRITERIA;\n return CRITERIA.map(\n (c) => FREE_DESIGN_CRITERIA_OVERRIDES.find((o) => o.id === c.id) ?? c,\n );\n}\n\n/** Get all criteria for a specific priority level */\nexport function getCriteriaByPriority(\n priority: Priority,\n designMode: DesignMode = \"constrained\",\n): EvalCriterion[] {\n return criteriaFor(designMode).filter((c) => c.priority === priority);\n}\n\n/** Get a specific criterion by ID */\nexport function getCriterionById(\n id: string,\n designMode: DesignMode = \"constrained\",\n): EvalCriterion | undefined {\n return criteriaFor(designMode).find((c) => c.id === id);\n}\n\n/** Get all LLM-evaluated criteria (tier 1 + 2) */\nexport function getLLMCriteria(designMode: DesignMode = \"constrained\"): EvalCriterion[] {\n return criteriaFor(designMode).filter((c) => c.tier > 0);\n}\n\n/**\n * Build the coding agent's criteria summary from the single source of truth.\n * Grouped by priority for the P0→P1→P2 hierarchy.\n */\nexport function buildCodingCriteriaSummary(designMode: DesignMode = \"constrained\"): string {\n const lines: string[] = [\"## Priority (P0 first, then P1, then P2)\", \"\"];\n\n for (const priority of [\"P0\", \"P1\", \"P2\"] as Priority[]) {\n const label =\n priority === \"P0\"\n ? \"Must (compile + complete)\"\n : priority === \"P1\"\n ? \"Should (safety)\"\n : \"Nice (quality)\";\n const criteria = getCriteriaByPriority(priority, designMode);\n lines.push(`**${priority} — ${label}:**`);\n for (const c of criteria) {\n lines.push(`- ${c.codingGuidance}`);\n }\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n}\n","// Axis-keyed dispatcher. Iterates the flat REGISTRY, runs each check\n// whose gate matches the classification's axis vector, and accumulates\n// issues.\n\nimport type { DataContract, JsonObject } from \"@ggui-ai/protocol\";\nimport type { Classification } from \"../../classifier/index.js\";\nimport type { EvalIssue } from \"../types-public.js\";\nimport { REGISTRY } from \"./registry.js\";\nimport { matches, type AxisCheck, type AxisCheckInput } from \"./types.js\";\nimport { axisCheckTraceEnabled } from \"./helpers.js\";\nimport { createHash } from \"node:crypto\";\nimport type { CanvasClass, DesignMode } from \"../../design-mode.js\";\n\nexport interface RunAxisChecksInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n /** Which triad produced the source — see `AxisCheckInput.designMode`. */\n designMode?: DesignMode;\n /** The canvas the source is judged for — see `AxisCheckInput.canvas` (ggui#1117); absent = no rendering context. */\n canvas?: CanvasClass;\n /** The props the source was rendered with — see `AxisCheckInput.fixtureProps` (ggui#1285); absent = the echo check stands down. */\n fixtureProps?: JsonObject;\n}\n\nexport function runAxisChecks(\n classification: Classification,\n input: RunAxisChecksInput,\n): EvalIssue[] {\n const facts: AxisTraceFacts = {\n sourceCode: input.sourceCode,\n ...(input.contract !== undefined ? { contract: input.contract } : {}),\n originalPrompt: input.originalPrompt,\n classification,\n ...(input.designMode !== undefined ? { designMode: input.designMode } : {}),\n ...(input.canvas !== undefined ? { canvas: input.canvas } : {}),\n ...(input.fixtureProps !== undefined ? { fixtureProps: input.fixtureProps } : {}),\n };\n if (input.compiledCode === null) {\n traceAxisChecksSkipped(facts, \"compiledCode null — no check ran\");\n return [];\n }\n const axisInput: AxisCheckInput = { ...facts, compiledCode: input.compiledCode };\n return runGatedAxisChecks(\n REGISTRY.filter((check) => matches(classification.vector, check)),\n axisInput,\n ).issues;\n}\n\nexport interface AxisRunResult {\n readonly issues: EvalIssue[];\n /** Check ids run, in registry order, each once. */\n readonly firedIds: string[];\n}\n\n/**\n * Run a PRE-GATED list of checks once each — the one runner the served\n * loop (`run-check.ts`, over the harness's pre-filtered `axisChecks`) and\n * `runAxisChecks` (gate + run) share, so the ggui#1046 trace line prints on\n * both paths.\n */\nexport function runGatedAxisChecks(checks: readonly AxisCheck[], input: AxisCheckInput): AxisRunResult {\n const issues: EvalIssue[] = [];\n const firedIds: string[] = [];\n const seen = new Set<string>();\n for (const check of checks) {\n if (seen.has(check.id)) continue;\n seen.add(check.id);\n firedIds.push(check.id);\n issues.push(...check.run(input));\n }\n if (axisCheckTraceEnabled()) {\n const line: AxisCheckTrace = {\n ...traceFacts(input),\n matched: [...firedIds],\n issues: issues.map((i) => ({ id: i.subcategory ?? i.category, result: i.result })),\n };\n console.log(JSON.stringify({ axisCheckTrace: line }));\n }\n return { issues, firedIds };\n}\n\n/** The dispatcher's line for a round where no check could run (a null compile), flag-gated like the rest. */\nexport function traceAxisChecksSkipped(facts: AxisTraceFacts, note: string): void {\n if (!axisCheckTraceEnabled()) return;\n const line: AxisCheckTrace = { ...traceFacts(facts), matched: [], issues: [], note };\n console.log(JSON.stringify({ axisCheckTrace: line }));\n}\n\n/** The input facts a round's verdict is built from — `AxisCheckInput` minus the compile. */\nexport type AxisTraceFacts = Omit<AxisCheckInput, \"compiledCode\">;\n\n/** One trace line per round (ggui#1046): the input facts a verdict was built from, the gates that matched, the issues that came out. */\nexport interface AxisCheckTrace {\n readonly sourceSha256: string;\n readonly originalPrompt: string;\n readonly designMode: string;\n readonly classification: Classification[\"vector\"];\n readonly propsSpecKeys: readonly string[];\n readonly propsSpecPropertyKeys: readonly string[];\n /** The canvas the verdict was built for (ggui#1117) — present only when the input carried one. */\n readonly canvas?: CanvasClass;\n readonly matched: readonly string[];\n readonly issues: ReadonlyArray<{ readonly id: string; readonly result: EvalIssue[\"result\"] }>;\n readonly note?: string;\n}\n\nfunction traceFacts(input: AxisTraceFacts): Omit<AxisCheckTrace, \"matched\" | \"issues\"> {\n const propsSpec = input.contract?.propsSpec;\n return {\n sourceSha256: createHash(\"sha256\").update(input.sourceCode, \"utf8\").digest(\"hex\"),\n originalPrompt: input.originalPrompt,\n designMode: input.designMode ?? \"constrained\",\n classification: input.classification.vector,\n propsSpecKeys: Object.keys(propsSpec ?? {}),\n propsSpecPropertyKeys: Object.keys(propsSpec?.properties ?? {}),\n // No default here, unlike designMode: an absent canvas is a fact about the caller, not a guess to paper over.\n ...(input.canvas !== undefined ? { canvas: input.canvas } : {}),\n };\n}\n"]}
1
+ {"version":3,"sources":["../../../src/design-mode.ts","../../../src/evaluation/axis-checks/helpers.ts","../../../src/evaluation/axis-checks/checks/universal.ts","../../../src/evaluation/axis-checks/checks/state-merge.ts","../../../src/evaluation/axis-checks/checks/state-ui-affordance.ts","../../../src/evaluation/axis-checks/checks/realtime.ts","../../../src/evaluation/axis-checks/checks/writes.ts","../../../src/evaluation/axis-checks/checks/state-payload.ts","../../../src/evaluation/axis-checks/checks/tooling.ts","../../../src/evaluation/axis-checks/checks/grid.ts","../../../src/evaluation/axis-checks/extras.ts","../../../src/evaluation/axis-checks/registry.ts","../../../src/evaluation/types-public.ts","../../../src/evaluation/axis-checks/dispatch.ts"],"names":["CONTAINER_MAX_WIDTH","cap","m","REALTIME_ACTIVE","mkIssue","matches"],"mappings":";;;;;;;AAwDO,IAAM,gBAAA,GAAkE;AAAA,EAC7E,cAAA,EAAgB,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,EAC1C,yBAAA,EAA2B,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,GAAA,EAAI;AAAA,EACrD,EAAA,EAAI,EAAE,KAAA,EAAO,GAAA,EAAK,QAAQ,IAAA,EAAK;AAAA,EAC/B,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,GAAA,EAAI;AAAA,EAC/B,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,QAAQ,GAAA;AAC7B,CAAA;ACzBA,IAAM,sBAAsB,CAAC,IAAA,EAAM,QAAQ,QAAA,EAAU,KAAA,EAAO,QAAQ,MAAM,CAAA;AAE1E,SAAS,mBAAmB,CAAA,EAAmD;AAC7E,EAAA,OAAO,CAAA,CAAE,KAAA,EAAO,UAAA,IAAc,CAAA,CAAE,QAAQ,KAAA,EAAO,UAAA;AACjD;AAEA,SAAS,aAAa,SAAA,EAAwD;AAC5E,EAAA,IAAI,CAAC,WAAW,OAAO,IAAA;AACvB,EAAA,KAAA,MAAW,QAAQ,mBAAA,EAAqB;AACtC,IAAA,IAAI,IAAA,IAAQ,WAAW,OAAO,IAAA;AAAA,EAChC;AACA,EAAA,KAAA,MAAW,CAAC,CAAA,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AAA,CAAM,cAAA;AAAA,IACtB,UAAA,EAAY,MAAM,UAAA,IAAc,aAAA;AAAA,IAChC,cAAA,EAAgB,MAAM,cAAA,CAAe,MAAA;AAAA,IACrC,aAAA,EAAe,MAAA,CAAO,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA;AAAA,IAC1C,uBAAuB,MAAA,CAAO,IAAA,CAAK,SAAA,EAAW,UAAA,IAAc,EAAE,CAAA;AAAA;AAAA,IAE9D,GAAI,MAAM,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,EAAQ,KAAA,CAAM,MAAA,EAAO,GAAI;AAAC,GAC/D;AACF","file":"index.js","sourcesContent":["// packages/ui-gen/src/design-mode.ts\n//\n// The ONE definition of the `designMode` option and the rendering-canvas\n// vocabulary. Every triad surface (system prompt, boilerplate, tier-0\n// gate, axis checks, evaluator criteria) AND the visual evaluator import\n// these types from here — nothing re-declares the unions.\n//\n// - `constrained` (default) — today's triad: the component composes\n// from the `@ggui-ai/design` primitives, prop enums and spacing\n// scale, and tier-0 enforces the design vocabulary. Byte-identical\n// to the pre-`designMode` behaviour (pinned by\n// `design-mode.pin.test.ts`).\n// - `free` — the design vocabulary is relaxed: raw HTML elements,\n// inline styles and `<style>` blocks are allowed; the design package\n// is importable but optional. Every HARD contract stays: the data\n// contract via the boilerplate-typed wire hooks, the import\n// allowlist + security bans, the host envelope, the budgets, the\n// blueprint-reuse shape, and brand-bearing color via the closed\n// `--ggui-color-*` token manifest (no literals, no fallbacks).\n\nexport const DESIGN_MODES = [\"constrained\", \"free\"] as const;\n\nexport type DesignMode = (typeof DESIGN_MODES)[number];\n\nexport const DEFAULT_DESIGN_MODE: DesignMode = \"constrained\";\n\n// ─── Rendering canvas ───────────────────────────────────────────────────────\n//\n// ONE canvas vocabulary shared by the prompt input (the `free` prompt\n// TELLS the agent its canvas; the `constrained` prompt keeps its\n// shell/screen descriptors byte-for-byte) and the visual evaluator (one\n// screenshot + judge score per class at `CANVAS_VIEWPORTS[class]`).\n//\n// A class is derived from DISPLAY MODE + width, never from width alone:\n// an inline chat card is `xs-chat-card` whatever the host window\n// measures (the bubble, not the window, bounds the component); a\n// fullscreen-class surface follows its width through the three\n// breakpoints. `canvasForViewportWidth` is monotonic in width per\n// display mode (pinned by `design-mode.test.ts`).\n\nexport const CANVAS_CLASSES = [\n \"xs-chat-card\",\n \"mobile-fullscreen-small\",\n \"md\",\n \"lg\",\n \"xl\",\n] as const;\n\nexport type CanvasClass = (typeof CANVAS_CLASSES)[number];\n\nexport interface CanvasViewport {\n readonly width: number;\n readonly height: number;\n}\n\n/** The viewport (CSS px) each class is rendered + judged at. */\nexport const CANVAS_VIEWPORTS: Readonly<Record<CanvasClass, CanvasViewport>> = {\n \"xs-chat-card\": { width: 400, height: 640 },\n \"mobile-fullscreen-small\": { width: 390, height: 844 },\n md: { width: 768, height: 1024 },\n lg: { width: 1024, height: 768 },\n xl: { width: 1440, height: 900 },\n};\n\n/**\n * The two display modes the canvas derivation distinguishes. `inline`\n * is the chat card (MCP Apps `inline` display mode / the `chat` shell);\n * `fullscreen` is every surface the component owns edge to edge or as\n * a panel (`fullscreen`, `pip`, the `spatial` and `partial` shells) —\n * there the width decides the class.\n */\nexport type CanvasDisplayMode = \"inline\" | \"fullscreen\";\n\n/**\n * Map a shell name (`chat` / `fullscreen` / `spatial` / `partial`) or an\n * MCP Apps display mode (`inline` / `fullscreen` / `pip`) onto the\n * canvas display mode. Only `chat` and `inline` are the inline card;\n * everything else is width-governed.\n */\n/**\n * The display mode a JUDGE canvas stands for (ggui#1100): the inline chat\n * card is `xs-chat-card`; every other canvas is a surface the component\n * owns edge to edge, which the served runtime composes with `fit: 'fill'`\n * — so the judge must too, or it scores a picture the user never sees.\n */\nexport function displayModeForCanvas(canvas: CanvasClass): CanvasDisplayMode {\n return canvas === \"xs-chat-card\" ? \"inline\" : \"fullscreen\";\n}\n\nexport function canvasDisplayModeForShell(shell: string | undefined): CanvasDisplayMode {\n return shell === \"chat\" || shell === \"inline\" ? \"inline\" : \"fullscreen\";\n}\n\n/** Fullscreen-class breakpoints (inclusive lower bounds), CSS px. */\nexport const CANVAS_BREAKPOINTS = { md: 600, lg: 1024, xl: 1440 } as const;\n\n/**\n * Derive the canvas class from display mode + container width.\n *\n * inline → `xs-chat-card` at every width\n * fullscreen → width < 600 → `mobile-fullscreen-small`\n * 600 – 1023 → `md`\n * 1024 – 1439 → `lg`\n * ≥ 1440 → `xl`\n */\nexport function canvasForViewportWidth(mode: CanvasDisplayMode, width: number): CanvasClass {\n if (mode === \"inline\") return \"xs-chat-card\";\n if (width < CANVAS_BREAKPOINTS.md) return \"mobile-fullscreen-small\";\n if (width < CANVAS_BREAKPOINTS.lg) return \"md\";\n if (width < CANVAS_BREAKPOINTS.xl) return \"lg\";\n return \"xl\";\n}\n\n/**\n * Map today's shell × screen descriptors onto a canvas class when no\n * width is known. `chat` is always the inline card; `spatial` is a\n * ~600px floating panel (`md`); `fullscreen` follows the screen. Unknown\n * values fall back to `lg` (the widest common fullscreen), matching the\n * skeleton's `fullscreen` / `universal` defaults.\n */\nexport function canvasForRendering(\n shellType: string | undefined,\n screen: string | undefined,\n): CanvasClass {\n const shell = shellType ?? \"fullscreen\";\n if (canvasDisplayModeForShell(shell) === \"inline\") return \"xs-chat-card\";\n if (shell === \"spatial\") return \"md\";\n switch (screen ?? \"universal\") {\n case \"mobile\":\n return \"mobile-fullscreen-small\";\n case \"tablet\":\n return \"md\";\n default:\n return \"lg\";\n }\n}\n\nexport interface CanvasDescriptor {\n /** Short human label. */\n readonly label: string;\n /** Inclusive width range the component must look right across, CSS px. */\n readonly minWidthPx: number;\n readonly maxWidthPx: number;\n /** What the host draws around the component at this canvas. */\n readonly host: string;\n}\n\nexport const CANVAS_DESCRIPTORS: Readonly<Record<CanvasClass, CanvasDescriptor>> = {\n \"xs-chat-card\": {\n label: \"extra-small chat card\",\n minWidthPx: 320,\n maxWidthPx: 480,\n host: \"an inline card inside a chat message bubble — the host draws the card border, shadow and rounded corners; the component fills the bubble width and takes its natural height\",\n },\n \"mobile-fullscreen-small\": {\n label: \"small mobile fullscreen\",\n minWidthPx: 320,\n maxWidthPx: 599,\n host: \"a phone-sized viewport the component owns edge to edge — single column, touch targets at least 44px, the component manages its own scroll\",\n },\n md: {\n label: \"medium panel\",\n minWidthPx: 600,\n maxWidthPx: 1023,\n host: \"a tablet viewport or a floating panel (spatial / picture-in-picture) — one or two columns, medium density\",\n },\n lg: {\n label: \"large fullscreen\",\n minWidthPx: 1024,\n maxWidthPx: 1439,\n host: \"a desktop viewport the component owns edge to edge — multi-column layouts, hover states and pointer interactions are available\",\n },\n xl: {\n label: \"extra-large fullscreen\",\n minWidthPx: 1440,\n maxWidthPx: 1920,\n host: \"a wide desktop viewport the component owns edge to edge — cap content width or use the extra room deliberately; never stretch a single column across the whole width\",\n },\n};\n\n/**\n * The explicit sentence the `free` prompt renders for a canvas — the\n * agent is TOLD the canvas, it never guesses it.\n */\nexport function describeCanvas(canvas: CanvasClass): string {\n const d = CANVAS_DESCRIPTORS[canvas];\n return (\n `This component renders on the \\`${canvas}\\` canvas (${d.label}): ` +\n `${d.minWidthPx}–${d.maxWidthPx}px wide, ${d.host}. ` +\n `Design for the whole range — the host may size the iframe anywhere inside it, and the host owns the height: size to your content, never to the viewport.`\n );\n}\n","// packages/ui-gen/src/evaluation/axis-checks/helpers.ts\n//\n// Shared contract inspection + source-scan helpers used by axis checks.\n// Ported from the retired mode-checks/ modules.\n\nimport type { ActionEntry, DataContract, JsonObject, JsonValue } from \"@ggui-ai/protocol\";\nimport {\n HOOK_NAME_RE,\n listContractGadgets,\n STDLIB_GADGETS_PACKAGE,\n} from \"@ggui-ai/protocol\";\nimport type { EvalIssue } from \"../types-public.js\";\n\n// =============================================================================\n// Contract shape helpers\n// =============================================================================\n\nexport interface PropShape {\n type?: string;\n required?: boolean;\n items?: { type?: string; properties?: Record<string, unknown> };\n schema?: {\n type?: string;\n items?: { type?: string; properties?: Record<string, unknown> };\n };\n}\n\nexport interface EntityCollection {\n name: string;\n idField: string;\n}\n\nexport interface SubmitAction {\n name: string;\n payloadKeys: string[];\n}\n\nconst ID_FIELD_CANDIDATES = [\"id\", \"uuid\", \"symbol\", \"key\", \"slug\", \"code\"];\n\nfunction getItemsProperties(p: PropShape): Record<string, unknown> | undefined {\n return p.items?.properties ?? p.schema?.items?.properties;\n}\n\nfunction inferIdField(itemProps: Record<string, unknown> | undefined): string {\n if (!itemProps) return \"id\";\n for (const cand of ID_FIELD_CANDIDATES) {\n if (cand in itemProps) return cand;\n }\n for (const [k, v] of Object.entries(itemProps)) {\n const vv = v as { type?: string; schema?: { type?: string } } | undefined;\n if (vv?.type === \"string\" || vv?.schema?.type === \"string\") return k;\n }\n return \"id\";\n}\n\nexport function getRequiredPropNames(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, PropShape> }\n | undefined;\n const properties = propsField?.properties ?? {};\n return Object.entries(properties)\n .filter(([, p]) => p && typeof p === \"object\" && p.required === true)\n .map(([name]) => name);\n}\n\nexport function getActionNames(contract?: DataContract): string[] {\n return Object.keys(contract?.actionSpec ?? {});\n}\n\nexport function getStreamEventNames(contract?: DataContract): string[] {\n return Object.keys(contract?.streamSpec ?? {});\n}\n\n/**\n * Returns the local BINDING names the boilerplate emits for every\n * HOOK gadget the contract declares — `useGeolocation` → `geolocation`\n * (strip the `use` prefix, lowercase the first char). The wire\n * `clientCapabilities.gadgets` is package-keyed and carries only the\n * export NAME, not a separate binding name, so the binding is derived\n * here exactly as the boilerplate generator derives it.\n *\n * Component gadgets are excluded — they are rendered as JSX, not bound\n * to a `const`, so the `const <name> = …()` axis checks don't apply.\n *\n * The agentCapabilities.tools catalog has no parallel helper —\n * agent-side tools aren't component-side, so the axis checks don't\n * scan source for agent-tool bindings.\n */\nexport function getGadgetNames(contract?: DataContract): string[] {\n if (!contract) return [];\n return listContractGadgets(contract)\n .filter((use) => HOOK_NAME_RE.test(use.name))\n .map((use) =>\n use.name.length > 3\n ? use.name.charAt(3).toLowerCase() + use.name.slice(4)\n : use.name,\n );\n}\n\n/**\n * Like {@link getGadgetNames} but restricted to the first-party\n * `@ggui-ai/gadgets` stdlib package — the built-in browser capabilities\n * (`useGeolocation`, `useCamera`, …) that carry the `idle → prompting →\n * active` lifecycle and therefore need a `.start()` invocation.\n *\n * Registered third-party gadgets (e.g. `useBoardState` from\n * `@example/gadget-board`) are plain data hooks: the runtime resolves\n * them without a user gesture, so the `.start()` axis check must NOT\n * fire on them.\n */\nexport function getStdlibGadgetNames(contract?: DataContract): string[] {\n if (!contract) return [];\n return listContractGadgets(contract)\n .filter(\n (use) =>\n use.package === STDLIB_GADGETS_PACKAGE && HOOK_NAME_RE.test(use.name),\n )\n .map((use) =>\n use.name.length > 3\n ? use.name.charAt(3).toLowerCase() + use.name.slice(4)\n : use.name,\n );\n}\n\nexport function getEntityCollections(contract?: DataContract): EntityCollection[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const entities: EntityCollection[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n const items = pp.items ?? pp.schema?.items;\n if (type === \"array\" && items?.type === \"object\") {\n entities.push({ name, idField: inferIdField(getItemsProperties(pp)) });\n }\n }\n return entities;\n}\n\nfunction singularize(name: string): string {\n if (name.endsWith(\"ies\")) return name.slice(0, -3) + \"y\";\n if (name.endsWith(\"ses\")) return name.slice(0, -2);\n if (name.endsWith(\"s\") && !name.endsWith(\"ss\")) return name.slice(0, -1);\n return name;\n}\n\n/**\n * Entity collections that are actually mutated (referenced by a stream\n * event or by an action payload's entity-id key). Static reference lists\n * (e.g., kanban's `columns`) are excluded so they don't trigger\n * \"must be in useState\" false positives.\n */\nexport function getMutatedEntityCollections(\n contract: DataContract | undefined,\n allEntities: EntityCollection[],\n): EntityCollection[] {\n if (!contract) return allEntities;\n\n const actionSpec = contract.actionSpec ?? {};\n const streamSpec = contract.streamSpec ?? {};\n\n const hasStreams = Object.keys(streamSpec).length > 0;\n\n const referencedIdKeys = new Set<string>();\n for (const action of Object.values(actionSpec) as ActionEntry[]) {\n const ex = action.example;\n if (!ex || typeof ex !== \"object\" || Array.isArray(ex)) continue;\n for (const key of Object.keys(ex as JsonObject)) {\n if (key === \"id\" || key === \"key\" || key === \"index\") {\n referencedIdKeys.add(\"id\");\n referencedIdKeys.add(\"key\");\n referencedIdKeys.add(\"index\");\n } else if (/Id$/.test(key)) {\n referencedIdKeys.add(key.slice(0, -2).toLowerCase());\n }\n }\n }\n\n const mutated = allEntities.filter((e) =>\n referencedIdKeys.has(singularize(e.name).toLowerCase()),\n );\n\n if (mutated.length === 0 && hasStreams && allEntities.length > 0) {\n return [allEntities[0]];\n }\n return mutated.length > 0 ? mutated : allEntities;\n}\n\nfunction countScalarKeys(example: unknown): string[] {\n if (!example || typeof example !== \"object\" || Array.isArray(example)) return [];\n const keys: string[] = [];\n for (const [k, v] of Object.entries(example as Record<string, unknown>)) {\n const t = typeof v;\n if (t === \"string\" || t === \"number\" || t === \"boolean\") keys.push(k);\n }\n return keys;\n}\n\nexport function getSubmitActions(contract?: DataContract): SubmitAction[] {\n const actionSpec = contract?.actionSpec ?? {};\n const result: SubmitAction[] = [];\n for (const [name, action] of Object.entries(actionSpec) as Array<[string, ActionEntry]>) {\n const ex: JsonValue | undefined = action.example;\n const scalarKeys = countScalarKeys(ex);\n if (scalarKeys.length < 3) continue;\n const allKeys = ex && typeof ex === \"object\" && !Array.isArray(ex)\n ? Object.keys(ex as JsonObject)\n : scalarKeys;\n result.push({ name, payloadKeys: allKeys });\n }\n return result;\n}\n\nexport function getArrStrProps(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const names: string[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n const items = pp.items ?? pp.schema?.items;\n if (type === \"array\" && items?.type === \"string\") names.push(name);\n }\n return names;\n}\n\nexport function getInitialValuePropNames(contract?: DataContract): string[] {\n const propsField = contract?.propsSpec as\n | { properties?: Record<string, unknown> }\n | undefined;\n const properties = propsField?.properties ?? {};\n const names: string[] = [];\n for (const [name, p] of Object.entries(properties)) {\n if (!p || typeof p !== \"object\") continue;\n const pp = p as PropShape;\n const type = pp.type ?? pp.schema?.type;\n if (type === \"object\" && /^initial/i.test(name)) names.push(name);\n }\n return names;\n}\n\n// =============================================================================\n// Source scanning helpers\n// =============================================================================\n\n/**\n * The top-level property keys of the object literal whose `{` is at `open`, read by\n * walking brackets and skipping strings, so a nested object or a `}` inside a string\n * neither ends the literal early nor contributes keys. `undefined` when `open` is not a `{`.\n */\nfunction objectLiteralKeysAt(src: string, open: number): string[] | undefined {\n if (src[open] !== \"{\") return undefined;\n const keys: string[] = [];\n let depth = 0;\n let expectKey = true;\n for (let i = open; i < src.length; i++) {\n const c = src[i];\n if (c === '\"' || c === \"'\" || c === \"`\") {\n // Skip the string; a quoted top-level key (\"name\": …) is a key too.\n let j = i + 1;\n while (j < src.length && src[j] !== c) j += src[j] === \"\\\\\" ? 2 : 1;\n if (depth === 1 && expectKey && /^\\s*:/.test(src.slice(j + 1))) keys.push(src.slice(i + 1, j));\n i = j;\n expectKey = false;\n continue;\n }\n if (c === \"{\" || c === \"[\" || c === \"(\") {\n depth++;\n if (depth === 1) expectKey = true;\n continue;\n }\n if (c === \"}\" || c === \"]\" || c === \")\") {\n depth--;\n if (depth === 0) return keys;\n continue;\n }\n if (depth !== 1) continue;\n if (c === \",\") {\n expectKey = true;\n continue;\n }\n if (expectKey && /[A-Za-z_$]/.test(c ?? \"\")) {\n const m = /^([A-Za-z_$][\\w$]*)\\s*(:|,|\\})/.exec(src.slice(i));\n // `key: value`, or the shorthand `key,` / `key }`.\n if (m !== null && m[1] !== undefined) keys.push(m[1]);\n expectKey = false;\n }\n }\n return keys;\n}\n\n/** The argument texts of the call whose `(` is at `open`, split on top-level commas. */\nfunction callArgsAt(src: string, open: number): string[] {\n const args: string[] = [];\n let depth = 0;\n let start = open + 1;\n for (let i = open; i < src.length; i++) {\n const c = src[i];\n if (c === '\"' || c === \"'\" || c === \"`\") {\n let j = i + 1;\n while (j < src.length && src[j] !== c) j += src[j] === \"\\\\\" ? 2 : 1;\n i = j;\n continue;\n }\n if (c === \"(\" || c === \"{\" || c === \"[\") depth++;\n else if (c === \")\" || c === \"}\" || c === \"]\") {\n depth--;\n if (depth === 0) {\n args.push(src.slice(start, i));\n return args;\n }\n } else if (c === \",\" && depth === 1) {\n args.push(src.slice(start, i));\n start = i + 1;\n }\n }\n return args;\n}\n\n/**\n * The keys an initial-state argument provides: an object literal (`{ … }`), a lazy\n * initializer returning one (`() => ({ … })`), or an identifier bound to one in the same\n * file (`const INITIAL: Form = { … }`, also behind a lazy `() => INITIAL`).\n */\nfunction initialStateKeys(src: string, argStart: number, argText: string): string[] {\n const lead = argText.length - argText.trimStart().length;\n let at = argStart + lead;\n let text = argText.trim();\n const lazy = /^\\(\\s*\\)\\s*=>\\s*\\(?\\s*/.exec(text);\n if (lazy !== null) {\n at += lazy[0].length;\n text = text.slice(lazy[0].length);\n }\n if (text.startsWith(\"{\")) return objectLiteralKeysAt(src, at) ?? [];\n const ident = /^([A-Za-z_$][\\w$]*)\\s*\\)?\\s*$/.exec(text);\n if (ident === null || ident[1] === undefined) return [];\n // One binding, or none: a name declared twice (shadowed, or re-declared in another scope) is\n // ambiguous, and ambiguity reads as absence, so the check can never pass on the wrong binding.\n const decls = [...src.matchAll(new RegExp(`(?:const|let|var)\\\\s+${ident[1]}\\\\s*(?::[^=]{1,200})?=\\\\s*`, \"g\"))];\n const decl = decls.length === 1 ? decls[0] : undefined;\n if (decl === undefined) return [];\n return objectLiteralKeysAt(src, (decl.index ?? 0) + decl[0].length) ?? [];\n}\n\n/**\n * Collect all key names that appear as state slots — either keys inside a\n * `useState({ ... })` object literal, or standalone state variables.\n *\n * ggui#1790 — also the initial-state shapes the inline-literal patterns cannot see, each\n * idiomatic React: `useState(INITIAL)` with `const INITIAL = { … }` in the file, a lazy\n * initializer `useState(() => ({ … }))`, and `useReducer(reducer, { … } | INITIAL)`. Missing\n * them made `state.payload.covers_submit` report every payload key missing on a form that held\n * them all, and the model, with nothing real to fix, spent the turn cap rewording a comment.\n */\nexport function collectStateKeys(src: string): Set<string> {\n const keys = new Set<string>();\n const varRe = /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState/g;\n for (const m of src.matchAll(varRe)) keys.add(m[1]);\n // ggui#1791 — a contextSpec slot is state too: the boilerplate binds each slot as\n // `const [x, setX] = useGguiContext<T>('x')` under a DO-NOT-EDIT banner, so a form\n // whose fields are context slots holds every payload key there and cannot move them\n // into useState. Both the binding's name and the slot's name count.\n const contextRe = /const\\s*\\[\\s*(\\w+)\\s*,\\s*\\w+\\s*\\]\\s*=\\s*useGguiContext\\s*(?:<[^>]*>)?\\s*\\(\\s*['\"`](\\w+)['\"`]/g;\n for (const m of src.matchAll(contextRe)) {\n keys.add(m[1]);\n keys.add(m[2]);\n }\n const objRe = /useState(?:<[^>]*>)?\\s*\\(\\s*\\{([\\s\\S]*?)\\}\\s*\\)/g;\n for (const m of src.matchAll(objRe)) {\n const keyRe = /(?:^|,)\\s*(\\w+)\\s*:/g;\n for (const km of m[1].matchAll(keyRe)) keys.add(km[1]);\n }\n const defaultObjRe = /useState(?:<[^>]*>)?\\s*\\([^)]*\\|\\|\\s*\\{([^}]*)\\}/g;\n for (const m of src.matchAll(defaultObjRe)) {\n const keyRe = /(?:^|,)\\s*(\\w+)\\s*:/g;\n for (const km of m[1].matchAll(keyRe)) keys.add(km[1]);\n }\n // ggui#1790 — the initial-state argument, resolved: useState's first, useReducer's second.\n for (const m of src.matchAll(/\\b(useState|useReducer)\\s*(?:<[^>]*>)?\\s*\\(/g)) {\n const open = (m.index ?? 0) + m[0].length - 1;\n const args = callArgsAt(src, open);\n const which = m[1] === \"useReducer\" ? 1 : 0;\n const arg = args[which];\n if (arg === undefined) continue;\n let argStart = open + 1;\n for (let k = 0; k < which; k++) argStart += (args[k]?.length ?? 0) + 1;\n for (const key of initialStateKeys(src, argStart, arg)) keys.add(key);\n }\n return keys;\n}\n\nexport function isMultiStepPrompt(prompt: string): boolean {\n if (!prompt) return false;\n const p = prompt.toLowerCase();\n return (\n /\\bstep\\s*[1-9]\\b/.test(p) ||\n /\\b[1-9][- ]step\\b/.test(p) ||\n /\\bmulti[- ]step\\b/.test(p) ||\n /\\bwizard\\b/.test(p) ||\n /\\bsteps?:\\s*\\n?/.test(p)\n );\n}\n\n// =============================================================================\n// Issue factory\n// =============================================================================\n\nexport function mkIssue(\n subcategory: string,\n description: string,\n fix: string,\n result: \"fail\" | \"warn\" = \"fail\",\n): EvalIssue {\n // mode-category issues are structural (missing hook wiring, bad merge-by-id,\n // hardcoded entity literals) — always P0. See ALIGNMENT.md R1.\n return { tier: 0, result, category: \"mode\", priority: \"P0\", subcategory, description, fix };\n}\n\nexport function cap(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n/**\n * Trace flag (ggui#1046): `GGUI_AXIS_CHECK_TRACE=1` makes the dispatcher and the checks\n * that opt in print one JSON line per evaluation round with the facts their verdict was\n * built from — what a reader of a served cell cannot recover from the round's result\n * alone (the source the checks saw, the prompt, the design mode, the classification,\n * the contract's prop keys, which gates matched, which issues came out). Off by default;\n * a diagnostic channel, never part of the result.\n */\nexport function axisCheckTraceEnabled(): boolean {\n return process.env[\"GGUI_AXIS_CHECK_TRACE\"] === \"1\";\n}\n","// packages/ui-gen/src/evaluation/axis-checks/checks/universal.ts\n//\n// Checks that run regardless of axis value — they apply to any generated\n// component. Dispatched via a \"universal\" gate that matches every render\n// value.\n\nimport { LUCIDE_ICON_NAMES, maxWidth as CONTAINER_MAX_WIDTH } from \"@ggui-ai/design\";\nimport { CANVAS_VIEWPORTS, type CanvasClass } from \"../../../design-mode.js\";\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport type { DataContract } from \"@ggui-ai/protocol\";\nimport {\n getRequiredPropNames,\n mkIssue,\n} from \"../helpers.js\";\n\nconst ALL_RENDER_VALUES = [\n \"static\", \"list\", \"grid\", \"spatial\", \"timeline\", \"chart\", \"master-detail\",\n] as const;\n\nfunction runPropCoverage(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const requiredProps = getRequiredPropNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of requiredProps) {\n const dotAccess = new RegExp(`\\\\bprops\\\\.${name}\\\\b`);\n const bracketAccess = new RegExp(`\\\\bprops\\\\[['\"\\`]${name}['\"\\`]\\\\]`);\n const destructured = new RegExp(\n `props[^;]{0,200}\\\\{[^}]*\\\\b${name}\\\\b[^}]*\\\\}|\\\\{[^}]*\\\\b${name}\\\\b[^}]*\\\\}[^;]{0,10}=\\\\s*props`,\n );\n if (dotAccess.test(src) || bracketAccess.test(src) || destructured.test(src))\n continue;\n issues.push(\n mkIssue(\n \"universal.prop_coverage\",\n `Required prop \"${name}\" is not referenced anywhere in the component.`,\n `Render props.${name} — the data contract marks it required.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoPropMirror(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re =\n /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState(?:<[^>]*>)?\\s*\\(\\s*props\\??\\.(\\w+)/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter, propName] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n if (new RegExp(`\\\\b${setter}\\\\s*\\\\(`).test(after)) continue;\n issues.push(\n mkIssue(\n \"universal.no_prop_mirror\",\n `useState(props.${propName}) for \"${stateVar}\" has no \"${setter}\" call — this mirrors a prop without mutation.`,\n `Read props.${propName} directly in the render; remove the useState for ${stateVar}.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nfunction runNoPhantomUseState(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re = /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n const stateUsed = new RegExp(`\\\\b${stateVar}\\\\b`).test(after);\n const setterUsed = new RegExp(`\\\\b${setter}\\\\b`).test(after);\n if (stateUsed || setterUsed) continue;\n issues.push(\n mkIssue(\n \"universal.no_phantom_useState\",\n `useState for \"${stateVar}\" is declared but neither \"${stateVar}\" nor \"${setter}\" is referenced.`,\n `Remove the useState for ${stateVar} — it is dead state.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nfunction runPropSeedNoResync(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n const re =\n /const\\s*\\[\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\]\\s*=\\s*useState(?:<[^>]*>)?\\s*\\(\\s*props\\??\\.(\\w+)/g;\n for (const m of src.matchAll(re)) {\n const [full, stateVar, setter, propName] = m;\n const idx = m.index ?? 0;\n const after = src.slice(idx + full.length);\n // Never-called setter is `no_prop_mirror`'s case — this check is\n // its #480 complement: the setter IS used (real optimistic state)\n // but nothing re-seeds when the agent repaints the prop.\n if (!new RegExp(`\\\\b${setter}\\\\s*\\\\(`).test(after)) continue;\n // A re-seed effect names the prop in a dependency array. Bracket\n // shape is the pragmatic signal (same looseness as the sibling\n // checks): any `[... props.X ...]` array in the source counts.\n const resync = new RegExp(\n `\\\\[[^\\\\[\\\\]]*props\\\\??\\\\.${propName}\\\\b[^\\\\[\\\\]]*\\\\]`,\n );\n if (resync.test(src)) continue;\n issues.push(\n mkIssue(\n \"universal.prop_seed_no_resync\",\n `useState(props.${propName}) seeds \"${stateVar}\" and mutates it, but no effect depends on [props.${propName}] — a ggui_amend repaint pushes new props that never reach this display (#480).`,\n `Add \\`useEffect(() => ${setter}(props.${propName}), [props.${propName}]);\\` so agent repaints re-seed the state, or derive the display directly from props.${propName}.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\n// ── universal.icon_name_known (ggui#1015) ────────────────────────────\n// The Icon primitive renders ONLY its curated Lucide subset; an unknown\n// name renders an empty box. The model reaches for names from the full\n// Lucide set (\"sparkles\", \"arrow-up-right\" on the hello frames), so the\n// check flags every string-literal `<Icon name>` outside the subset —\n// the fix turn has `get_available_icons`. Dynamic names (`name={x}`)\n// and emoji/unicode (rendered as text) are outside the check's scope.\n\n/** Icon.tsx's resolver rule: exact key, else dashes/underscores stripped + lowercased. */\nconst KNOWN_ICON_KEYS: ReadonlySet<string> = new Set(\n LUCIDE_ICON_NAMES.map((n) => n.replace(/[-_]/g, \"\").toLowerCase()),\n);\n\nexport function isKnownIconName(name: string): boolean {\n return KNOWN_ICON_KEYS.has(name.replace(/[-_]/g, \"\").toLowerCase());\n}\n\nconst ICON_NAME_LITERAL_RX =\n /<Icon\\b[^>]*?\\bname\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{\\s*\"([^\"]*)\"\\s*\\}|\\{\\s*'([^']*)'\\s*\\})/g;\n\nexport function findUnknownIconNames(sourceCode: string): string[] {\n const unknown = new Set<string>();\n for (const m of sourceCode.matchAll(ICON_NAME_LITERAL_RX)) {\n const name = m[1] ?? m[2] ?? m[3] ?? m[4] ?? \"\";\n if (name.length === 0) continue;\n if (/[^\\x20-\\x7e]/.test(name)) continue; // emoji / unicode passthrough renders as text\n if (!isKnownIconName(name)) unknown.add(name);\n }\n return [...unknown];\n}\n\nfunction runIconNameKnown(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const unknown = findUnknownIconNames(input.sourceCode);\n if (unknown.length === 0) return [];\n const list = unknown.map((n) => `\"${n}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.icon_name_known\",\n `<Icon name=…> uses ${unknown.length} name(s) outside the design system's Lucide subset: ${list} — an unknown name renders an empty box.`,\n \"Call get_available_icons and pick a listed name (kebab-case), or use an emoji directly.\",\n ),\n ];\n}\n\n// ── universal.accent_text_ink (ggui#1039) ────────────────────────────\n// The brand ladder's mid stops (300–600) are FILL colours. On a\n// low-saturation brand the 600 stop is mid-grey on the surface, and every\n// one of four brand-directed hello frames painted its eyebrow and inline\n// arrows with it — two of them at 3.5:1 and 2.91:1 on the ground. Accent\n// TEXT is the theme's readable ink `--ggui-color-link` (derived per mode to\n// clear 4.5:1, ggui#1035) or `<Text tone=\"emphasized\">`; `link` resolves to\n// the very same 600 wherever 600 already reads, so the fix never regresses a\n// saturated brand. Out of scope by design: tints as text (50–200 — the\n// on-fill idiom, `primary-50` on a `primary-600` bubble) and the deep stops\n// (700–900 — text on a light primary tint), both documented uses. Matches the\n// `color` property in every spelling the model writes — JSX prop, style\n// object (source and compiled), CSS declaration — and never a compound\n// property (`backgroundColor`, `border-color`, `accent-color`).\n\nconst LADDER_STOP_AS_TEXT_RX =\n /(?<![\\w-])color\\s*(?:=\\s*\\{?\\s*|:\\s*)[\"'`]?\\s*var\\(--ggui-color-primary-(\\d{2,3})\\s*[,)]/g;\nconst TEXT_INK_STOP_MIN = 300;\nconst TEXT_INK_STOP_MAX = 600;\n\n/** Distinct `primary-<stop>` tokens (300–600) the source paints as a text `color`, in source order. */\nexport function findLadderStopsAsText(sourceCode: string): string[] {\n const found = new Set<string>();\n for (const m of sourceCode.matchAll(LADDER_STOP_AS_TEXT_RX)) {\n const digits = m[1] ?? \"\";\n const stop = Number(digits);\n if (stop >= TEXT_INK_STOP_MIN && stop <= TEXT_INK_STOP_MAX) found.add(`primary-${digits}`);\n }\n return [...found];\n}\n\nfunction runAccentTextInk(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const stops = findLadderStopsAsText(input.sourceCode);\n if (stops.length === 0) return [];\n const list = stops.map((s) => `\\`${s}\\``).join(\", \");\n return [\n mkIssue(\n \"universal.accent_text_ink\",\n `Text is painted with a brand-ladder fill stop as its color (${list}) — on a low-saturation brand these stops are mid-grey on the surface and the text fails readability.`,\n 'Accent text (eyebrows, taglines, links, labels, inline arrows) takes var(--ggui-color-link) or <Text tone=\"emphasized\">; body text takes var(--ggui-color-onContainer); keep primary-* stops on fills and borders.',\n ),\n ];\n}\n\n// ── universal.scoped_surface_owns_ground (ggui#1047) ─────────────────\n// A SCOPED surface — `surface=\"inverted\"` or `\"hero\"` on Card / Box — owns its\n// ground: the primitive paints it, the scope rule swaps every ink beneath it.\n// The served Mosaic hello repainted an inverted card's ground with the page's\n// (`style={{ background: 'var(--ggui-color-ground)' }}`) and its hero text\n// read 1:1 — the swapped inks over a ground the scope did not own. The design\n// package now strips that background at render; this check makes the fix turn\n// remove it at the source, so the author's intent never silently vanishes.\n// Stands down in `free` design mode (the primitive is optional there).\n\nconst SCOPED_SURFACE_TAG_RX = /<(Card|Box)\\b([^<>]*?)surface\\s*=\\s*[\"'](inverted|hero)[\"']([^<>]*?)>/g;\nconst STYLE_BACKGROUND_RX = /\\bstyle\\s*=\\s*\\{\\{[^}]*\\b(background|backgroundColor|backgroundImage)\\s*:/;\n\n/** `[tag, surface]` for every scoped Card / Box whose own `style` sets a background. */\nexport function findScopedSurfaceBackgrounds(sourceCode: string): Array<readonly [string, string]> {\n const hits: Array<readonly [string, string]> = [];\n for (const m of sourceCode.matchAll(SCOPED_SURFACE_TAG_RX)) {\n const attrs = `${m[2] ?? \"\"} ${m[4] ?? \"\"}`;\n if (STYLE_BACKGROUND_RX.test(attrs)) hits.push([m[1] ?? \"\", m[3] ?? \"\"]);\n }\n return hits;\n}\n\nfunction runScopedSurfaceOwnsGround(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n if (input.designMode === \"free\") return [];\n const hits = findScopedSurfaceBackgrounds(input.sourceCode);\n if (hits.length === 0) return [];\n const [tag, surface] = hits[0]!;\n return [\n mkIssue(\n \"universal.scoped_surface_owns_ground\",\n `<${tag} surface=\"${surface}\"> sets its own background in style — a scoped surface owns its ground; repainting it puts the scope's swapped inks over the wrong ground (ink on ink).`,\n `Remove the background from that ${tag}'s style — surface=\"${surface}\" paints the ground; pick another surface if a different ground is wanted.`,\n ),\n ];\n}\n\n// ── universal.caps_label_invented (ggui#1075 Track A) ─────────────────\n// A caps label (`<Text caps>` — the eyebrow / kicker / overline treatment)\n// whose entire content is a string literal is copy the model INVENTED: the\n// contract carries no such member, so nothing the agent sends can change\n// it, and every served card wears it (\"LET'S BEGIN\", \"WELCOME\" — 59 of 63\n// generated sources in one sample, none bound to a prop). Copy comes from the\n// props; a caps label exists only when a prop supplies its text. A label\n// whose content is an expression (`{props.section}`, `{label ?? …}`) is\n// bound and passes; a `<Text caps>` with no text children is not a label.\nconst CAPS_TEXT_RX = /<Text\\b(?=[^>]*\\bcaps\\b)[^>]*>([\\s\\S]*?)<\\/Text>/g;\n\n/** Every `<Text caps>` whose content is nothing but literal text: `[literal]`. */\nexport function findInventedCapsLabels(sourceCode: string): string[] {\n const out: string[] = [];\n for (const m of sourceCode.matchAll(CAPS_TEXT_RX)) {\n const inner = (m[1] ?? \"\").trim();\n if (inner.length === 0) continue;\n if (inner.includes(\"{\")) continue; // bound to an expression — the props speak\n out.push(inner.replace(/\\s+/g, \" \").slice(0, 60));\n }\n return out;\n}\n\nfunction runCapsLabelInvented(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const invented = findInventedCapsLabels(input.sourceCode);\n if (invented.length === 0) return [];\n const list = invented.map((t) => `\"${t}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.caps_label_invented\",\n `${invented.length} caps label(s) carry invented copy the props do not supply: ${list} — an eyebrow, kicker or overline the agent cannot change is chatter on every render.`,\n \"Remove the label, or bind its text to a prop (`<Text caps>{props.section}</Text>`); copy comes from the contract, never from the component.\",\n ),\n ];\n}\n\n// ── universal.viewport_sized (ggui#1075 Track A/B, receipted on #1096) ─\n// An element sized to the viewport — `100vh` / `100dvh` / `100svh` / `100lvh`\n// (bare or inside `calc()`) as a `height` / `min-height`, or the `h-screen` /\n// `min-h-screen` utility classes. The frame owns the height: a content-sized\n// frame is measured FROM the content, so a viewport-sized root can never\n// shrink and grows the frame on every re-measure; under fullscreen the frame\n// already stretches the root to its height. 20 of 48 minted cells in one\n// sample carried `minHeight: \"100vh\"` on their root — one an inline chat\n// card told \"compact\". A `max-height` cap on a scroll region is not sizing\n// and passes; so do `height: 100%`, `flex: 1` and pixel heights.\n// The unit, with a `calc(…)` wrapper closed when present — so the quoted\n// snippet reads whole (`height: \"calc(100dvh - 64px)\"`).\nconst VIEWPORT_UNIT = String.raw`(?:calc\\(\\s*)?100(?:vh|dvh|svh|lvh)\\b(?:[^)\"'\\x60;\\n]*\\))?`;\nconst VIEWPORT_STYLE_OBJECT_RX = new RegExp(\n String.raw`\\b(?:minHeight|height|minBlockSize|blockSize)\\s*:\\s*[\"'\\x60]\\s*${VIEWPORT_UNIT}[\"'\\x60]?`,\n \"g\",\n);\nconst VIEWPORT_CSS_RX = new RegExp(\n String.raw`(?<![\\w-])(?:min-)?(?:height|block-size)\\s*:\\s*${VIEWPORT_UNIT}`,\n \"g\",\n);\nconst VIEWPORT_CLASS_RX = /(?<![\\w-])(?:min-)?h-(?:screen|dvh|svh|lvh)\\b/g;\n\n/** Every viewport-sized height in the source, as written (trimmed, ≤ 60 chars), in order. */\nexport function findViewportSizing(sourceCode: string): string[] {\n const hits: Array<{ at: number; text: string }> = [];\n for (const rx of [VIEWPORT_STYLE_OBJECT_RX, VIEWPORT_CSS_RX, VIEWPORT_CLASS_RX]) {\n for (const m of sourceCode.matchAll(rx)) {\n hits.push({ at: m.index ?? 0, text: m[0].replace(/\\s+/g, \" \").trim().slice(0, 60) });\n }\n }\n return hits.sort((a, b) => a.at - b.at).map((h) => h.text);\n}\n\nfunction runViewportSized(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const sized = findViewportSizing(input.sourceCode);\n if (sized.length === 0) return [];\n const list = sized.map((t) => \"`\" + t + \"`\").join(\", \");\n return [\n mkIssue(\n \"universal.viewport_sized\",\n `${sized.length} element(s) are sized to the viewport: ${list} — the frame owns the height; a content-sized frame is measured from the content, so a viewport-sized root never shrinks and grows the frame on every re-measure.`,\n \"Remove the viewport height — size to content, never to the viewport. Under fullscreen the frame stretches your root already (centre inside it with `display: flex; flex-direction: column; justify-content: center`); to fill a parent that has a height use `height: 100%` or `flex: 1`.\",\n ),\n ];\n}\n\n// ── universal.terminal_action_unguarded (ggui#1108, mitigation) ────────\n// A control whose action the user means ONCE — submit, confirm, approve,\n// schedule, reserve, book, pay, checkout, place order — that stays armed after\n// it fires is one double-click away from doing it twice. The check is a WARN,\n// deliberately: terminality lives in the request and the contract, not in a\n// name, so a static rule can suspect it and must not refuse over it. It fires\n// only when a terminal-sounding action or control exists AND the source guards\n// nothing at all (no `disabled=`, no `aria-disabled`), which is the shape with\n// no reading under which the control is safe.\n/** The words that make an action read as meant-once. Matched as WORDS, never as substrings. */\nconst TERMINAL_WORDS = new Set([\n \"submit\", \"confirm\", \"approve\", \"schedule\", \"reserve\", \"book\", \"pay\", \"checkout\", \"purchase\", \"order\",\n]);\n/** In prose (a control's label) the same words, with real boundaries. */\nconst TERMINAL_LABEL_RX = /\\b(submit|confirm|approve|schedule|reserve|book|pay|checkout|purchase|place\\s+order)\\b/i;\nconst GUARD_RX = /\\b(disabled|aria-disabled)\\s*=/;\n\n/** `submitBooking` → ['submit','booking']; `place_order` → ['place','order']. A NAME is words, not a string to search. */\nfunction nameWords(name: string): string[] {\n return name\n .split(/(?=[A-Z])|[_\\-\\s]+/)\n .map((w) => w.toLowerCase())\n .filter((w) => w.length > 0);\n}\n\n/** The terminal-sounding action names and control labels a source carries, deduped, in order. */\nexport function findUnguardedTerminalControls(sourceCode: string): string[] {\n if (GUARD_RX.test(sourceCode)) return [];\n const names = new Set<string>();\n for (const m of sourceCode.matchAll(/useAction(?:<[^>]*>)?\\(\\s*['\"`]([^'\"`]+)['\"`]/g)) {\n const name = m[1] ?? \"\";\n if (nameWords(name).some((w) => TERMINAL_WORDS.has(w))) names.add(name);\n }\n // A control's own words, taken as the plain text immediately before its close\n // tag — attributes can carry `=>`, so a label is read from the text, never by\n // trying to skip an attribute list with a regex.\n for (const m of sourceCode.matchAll(/>([^<>{}]{1,60})<\\/Button>/g)) {\n const label = (m[1] ?? \"\").replace(/\\s+/g, \" \").trim();\n if (label.length > 0 && TERMINAL_LABEL_RX.test(label)) names.add(label.slice(0, 40));\n }\n return [...names];\n}\n\nfunction runTerminalActionUnguarded(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const found = findUnguardedTerminalControls(input.sourceCode);\n if (found.length === 0) return [];\n const list = found.map((t) => `\"${t}\"`).join(\", \");\n return [\n mkIssue(\n \"universal.terminal_action_unguarded\",\n `${list} reads as an action the user means once, and nothing in this component disables the control after it fires — a double-click sends it twice.`,\n \"Hold the fired state (`const [submitted, setSubmitted] = useState(false)`), set it in the handler, and pass `disabled={submitted}` to that control with a word that says so (\\\"Submitted\\\"). If the action IS meant to repeat — sending a message, adding an item — leave it armed and ignore this.\",\n \"warn\",\n ),\n ];\n}\n\n// ── universal.root_width_cap (ggui#1117 — the eval leg ggui#1113 left out) ─\n// FRAME_SIZING's width half: the outermost element FILLS the frame; a width\n// cap belongs INSIDE it, on the column that holds text. A cap on the root is\n// the defect on a wide canvas (the card becomes a narrow strip with the\n// frame's ground on either side) and a no-op in a chat bubble (~400 px; a\n// 480 px cap never binds) — so the check reads `input.canvas`: it stands\n// down with no canvas (never a guess) and below `md`, and fires only for a\n// cap SMALLER than the canvas. A bare `<Container>` is a cap too — its\n// default preset is `lg`, 768 px — so it binds on `lg` / `xl` and not on\n// `md`. A cap the check cannot resolve to pixels (a `max-w-*` class, `rem`,\n// `%`) is reported because the prompt forbids it on the root. WARN, not\n// fail: the prompt names the one shape never to write; whether a centred\n// column was the right composition stays the model's call.\nexport interface RootWidthCap {\n /** The outermost element's tag name as written. */\n readonly element: string;\n /** The cap as written (`maxWidth=\"sm\"`, `maxWidth: '480px'`, `max-w-md`, or `lg (Container default)`). */\n readonly cap: string;\n /** The cap in pixels when it resolves (a Container preset, an `Npx` value); `null` otherwise. */\n readonly px: number | null;\n}\n\n/** The opening tag of the OUTERMOST element the default export returns, as written; `null` for none or a fragment. */\nfunction rootOpeningTag(sourceCode: string): { readonly name: string; readonly attrs: string } | null {\n const start = sourceCode.indexOf(\"export default function\");\n const body = start >= 0 ? sourceCode.slice(start) : sourceCode;\n const ret = /\\breturn\\s*\\(?\\s*</.exec(body);\n if (ret === null) return null;\n const at = ret.index + ret[0].length - 1;\n const nameMatch = /^<([A-Za-z][\\w.]*)/.exec(body.slice(at));\n if (nameMatch === null) return null;\n let j = at + nameMatch[0].length;\n let depth = 0;\n let quote: string | null = null;\n for (; j < body.length; j++) {\n const ch = body[j]!;\n if (quote !== null) {\n if (ch === quote) quote = null;\n continue;\n }\n if (ch === '\"' || ch === \"'\" || ch === \"`\") quote = ch;\n else if (ch === \"{\") depth++;\n else if (ch === \"}\") depth--;\n else if (ch === \">\" && depth === 0) break;\n }\n return { name: nameMatch[1]!, attrs: body.slice(at + nameMatch[0].length, j) };\n}\n\nconst CONTAINER_PRESETS: Readonly<Record<string, string>> = CONTAINER_MAX_WIDTH;\nconst NOT_A_CAP = new Set([\"full\", \"none\", \"100%\", \"unset\", \"initial\", \"inherit\"]);\n\n/** `sm` → 480; `480px` → 480; `100%` / `full` → not a cap (`undefined`); anything else → a cap of unknown size (`null`). */\nfunction capPx(value: string): number | null | undefined {\n const v = value.trim();\n if (NOT_A_CAP.has(v)) return undefined;\n const resolved = CONTAINER_PRESETS[v] ?? v;\n if (NOT_A_CAP.has(resolved)) return undefined;\n const px = /^(\\d+(?:\\.\\d+)?)px$/.exec(resolved);\n return px === null ? null : Number(px[1]);\n}\n\n/** The width cap the outermost returned element carries, or `null` when it fills the frame. */\nexport function findRootWidthCap(sourceCode: string): RootWidthCap | null {\n const root = rootOpeningTag(sourceCode);\n if (root === null) return null;\n const { name, attrs } = root;\n const prop = /\\bmaxWidth\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{\\s*(?:\"([^\"]*)\"|'([^']*)'|(\\d+(?:\\.\\d+)?))\\s*\\})/.exec(attrs);\n if (prop !== null) {\n const raw = prop[1] ?? prop[2] ?? prop[3] ?? prop[4] ?? `${prop[5]!}px`;\n const px = capPx(raw);\n return px === undefined ? null : { element: name, cap: `maxWidth=\"${raw}\"`, px };\n }\n const style = /\\bmaxWidth\\s*:\\s*(?:\"([^\"]*)\"|'([^']*)'|`([^`]*)`|(\\d+(?:\\.\\d+)?))/.exec(attrs);\n if (style !== null) {\n const raw = style[1] ?? style[2] ?? style[3] ?? `${style[4]!}px`;\n const px = capPx(raw);\n return px === undefined ? null : { element: name, cap: `maxWidth: '${raw}'`, px };\n }\n const cls = /(?<![\\w-])max-w-([\\w[\\]%.-]+)/.exec(attrs);\n if (cls !== null) {\n if (cls[1] === \"full\" || cls[1] === \"none\") return null;\n return { element: name, cap: `max-w-${cls[1]!}`, px: null };\n }\n if (name === \"Container\") return { element: name, cap: \"lg (Container default)\", px: capPx(\"lg\") ?? null };\n return null;\n}\n\nconst WIDE_CANVASES: ReadonlySet<CanvasClass> = new Set<CanvasClass>([\"md\", \"lg\", \"xl\"]);\n\nfunction runRootWidthCap(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n if (input.canvas === undefined || !WIDE_CANVASES.has(input.canvas)) return [];\n const cap = findRootWidthCap(input.sourceCode);\n if (cap === null) return [];\n const width = CANVAS_VIEWPORTS[input.canvas].width;\n if (cap.px !== null && cap.px >= width) return [];\n const sized = cap.px !== null ? `${cap.px}px on a ${width}px canvas` : `on a ${width}px canvas`;\n return [\n mkIssue(\n \"universal.root_width_cap\",\n `The outermost element <${cap.element}> carries a width cap (${cap.cap}, ${sized}): on this canvas the card becomes a narrow strip with the frame's ground on either side. The frame owns the width; a cap belongs INSIDE the root, on the column that holds text.`,\n 'Let the root fill the frame — drop the cap on the element you return at the top (or `maxWidth=\"full\"`) — and put the reading measure on an inner column: `<Box padding=\"lg\"><Container maxWidth=\"sm\">…</Container></Box>`.',\n \"warn\",\n ),\n ];\n}\n\n// ── universal.action_label_dropped (ggui#1190 — the transcription-drop guard) ─\n// The GUARD half of #1190: the model transcribes an actionSpec label onto a\n// control but DROPS a special character (\"Confirm & Schedule\" → \"Confirm\n// Schedule\"), because the verbatim label is not at the write-site. This check\n// NAMES that class on the bench and guards regression; the fix (carry the\n// verbatim label / render it from data) lands separately, so #1190 stays open.\n// WARN-class, deterministic, and tuned to flag ONLY the high-confidence drop.\n\nconst LABEL_SPECIAL_CHAR = /[^a-z0-9\\s]/i;\nconst normText = (s: string): string => s.toLowerCase().replace(/\\s+/g, \" \").trim();\nconst alnumText = (s: string): string => s.toLowerCase().replace(/[^a-z0-9]/g, \"\");\n\n/**\n * Extract the VISIBLE rendered text of a component — JSX text nodes (with `{…}`\n * expression containers stripped, nesting-aware) plus visible string\n * attributes (aria-label / placeholder / title / alt). Deliberately excludes\n * identifiers and call args: `useAction('confirmSchedule')` and the `const\n * confirmSchedule` binding must NOT count as the label \"Confirm & Schedule\"\n * appearing, or every action would false-match its own camelCase name.\n */\nfunction visibleText(sourceCode: string): string {\n // JSX text nodes: `>text<`. Excluding `>` from the run (`[^<>]`) skips the\n // `=>` arrow-body conflation — an arrow's `>` is followed by code then a\n // `>`, never text then a `<`, so only true tag-close→text→tag runs match,\n // and identifiers (`const confirmSchedule`, `useAction('confirmSchedule')`)\n // are never between `>` and `<`. `{…}` expression children are stripped so an\n // expression's identifiers don't count as visible text.\n const jsx = (sourceCode.match(/>([^<>]*)</g) ?? [])\n .map((m) => m.slice(1, -1).replace(/\\{[^}]*\\}/g, \" \"))\n .join(\" \");\n let attrs = \"\";\n const attrRx = /\\b(?:aria-label|placeholder|title|alt)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/gi;\n let m: RegExpExecArray | null;\n while ((m = attrRx.exec(sourceCode)) !== null) attrs += \" \" + (m[1] ?? m[2] ?? \"\");\n return jsx + \" \" + attrs;\n}\n\n/**\n * Find actionSpec labels whose special-character content was dropped from the\n * generated source. FALSE-POSITIVE-SAFE by construction — flags ONLY when the\n * label's alphanumeric words appear CONTIGUOUSLY in the source but the full\n * label (with its \"&\", \"/\", \"+\" …) does not, i.e. a clean transcription drop.\n * Every ambiguous shape is exempt: labels rendered from data (`.label`\n * anywhere), labels with no special char (nothing to drop), labels present\n * verbatim, entity-encoded `&` (`&amp;` — the words stop being contiguous, so\n * no flag), and very short labels. Presence-ANYWHERE, not wiring-scoped, on\n * purpose: if the label's text appears anywhere we never flag.\n */\nexport function findDroppedActionLabels(\n sourceCode: string,\n contract: DataContract | undefined,\n): Array<{ readonly name: string; readonly label: string }> {\n const actionSpec = contract?.actionSpec;\n if (actionSpec === undefined) return [];\n // Component renders any label from data → it does not transcribe → exempt all.\n if (/\\.label\\b/.test(sourceCode)) return [];\n const vis = visibleText(sourceCode);\n const normVis = normText(vis);\n const alnumVis = alnumText(vis);\n const out: Array<{ name: string; label: string }> = [];\n for (const [name, entry] of Object.entries(actionSpec)) {\n const label = entry.label;\n if (typeof label !== \"string\" || label.length === 0 || label === name) continue;\n if (!LABEL_SPECIAL_CHAR.test(label)) continue; // no special char → nothing to drop\n if (alnumText(label).length < 3) continue; // too short to match confidently\n if (normVis.includes(normText(label))) continue; // present verbatim in visible text → correct\n // The label's words appear contiguously in the VISIBLE text but the full\n // label (with its punctuation) does not → a character was dropped.\n if (alnumVis.includes(alnumText(label))) out.push({ name, label });\n }\n return out;\n}\n\nfunction runActionLabelDropped(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n return findDroppedActionLabels(input.sourceCode, input.contract).map(({ name, label }) =>\n mkIssue(\n \"universal.action_label_dropped\",\n `The action \"${name}\" declares label \"${label}\", but the rendered control appears to drop its \"${label.replace(/[a-z0-9\\s]/gi, \"\").trim()}\": the label's words are in the generated source, the full label is not — a transcription drop (ggui#1190).`,\n `Render the label EXACTLY as the contract states it — button text should be the verbatim \\`actionSpec.${name}.label\\`, or render it from data (\\`{x.label}\\`), never a re-typed copy that drops \"&\", \"/\", \"+\", etc.`,\n \"warn\",\n ),\n );\n}\n\n// ── universal.fixture_default_echo (ggui#1285 — the fixture echo) ────────\n// The probe and the judge render the source with fixture props, the judge's\n// critique quotes what it saw, and an eval-fix turn can write that text back\n// into the source as a default, a fallback or a placeholder. The fixture is\n// judging data, not the request; a visitor then sees it whenever the agent\n// leaves the prop out (guuey#1642: a builder's system-prompt line became a\n// hello's baked copy). Rule 3 of Data Parameterization stays true — defaults\n// come from the REQUEST — so a fixture value the request (or the contract's\n// own text) states is allowed; only a fixture-only value is the echo. WARN,\n// never fail: the copy is wrong, the card is not broken. Prose-like values\n// only (≥ MIN_ECHO_CHARS and a space), so a city name or a number is never a\n// hit.\nexport const MIN_ECHO_CHARS = 12;\nfunction collectStrings(value: unknown, out: string[]): void {\n if (typeof value === \"string\") {\n out.push(value);\n } else if (Array.isArray(value)) {\n for (const v of value) collectStrings(v, out);\n } else if (value !== null && typeof value === \"object\") {\n for (const v of Object.values(value)) collectStrings(v, out);\n }\n}\n/** The fixture's prose-like string values the request never stated, verbatim. */\nexport function fixtureOnlyStrings(input: Pick<AxisCheckInput, \"fixtureProps\" | \"originalPrompt\" | \"contract\">): string[] {\n if (input.fixtureProps === undefined) return [];\n const values: string[] = [];\n collectStrings(input.fixtureProps, values);\n const stated = `${input.originalPrompt}\\n${input.contract === undefined ? \"\" : JSON.stringify(input.contract)}`;\n const seen = new Set<string>();\n const out: string[] = [];\n for (const v of values) {\n const t = v.trim();\n if (t.length < MIN_ECHO_CHARS || !t.includes(\" \") || seen.has(t)) continue;\n seen.add(t);\n if (stated.includes(t)) continue;\n out.push(t);\n }\n return out;\n}\nfunction runFixtureDefaultEcho(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n for (const value of fixtureOnlyStrings(input)) {\n if (!src.includes(value)) continue;\n issues.push(\n mkIssue(\n \"universal.fixture_default_echo\",\n `A literal in the source equals a fixture value the request never stated: \"${value.length > 60 ? `${value.slice(0, 57)}…` : value}\". The fixture is judging data; a visitor sees this copy whenever the agent leaves the prop out.`,\n \"Take that copy from the prop it renders and drop the literal — no default, fallback or placeholder that repeats a fixture value. A default may only carry text the request itself states.\",\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\n// ── universal.form_submit_control (ggui#1443 — a form whose buttons cannot submit it) ──\n// The design `Button` defaults to `type=\"button\"` (the safe default: no accidental\n// submits from secondary controls), so the control that submits a `<form onSubmit>`\n// must say `type=\"submit\"`. A generated composer rendered its Send as a type-less\n// `Button` inside the form: clicking it did nothing, only Enter submitted, and the\n// card passed quality (#1398's dumps: 5 of 9 form cells, both arms). FAIL: a form\n// with buttons and no submitting control is a control that does not work. A form\n// without any button is not this check's claim; a form without `onSubmit` is not\n// read (nothing to submit to).\nconst FORM_OPEN_RX = /<form\\b[^<>]*\\bonSubmit\\s*=[^<>]*>/g;\nconst CONTROL_TAG_RX = /<(?:Button|button|input)\\b[^<>]*>/g;\nconst SUBMIT_TYPE_RX = /\\btype\\s*=\\s*(?:[\"']submit[\"']|\\{\\s*[\"']submit[\"']\\s*\\})/;\n/** Every `<form … onSubmit=…>…</form>` block in the source, verbatim (up to the first `</form>` after each opening tag). */\nexport function submitForms(sourceCode: string): string[] {\n const out: string[] = [];\n for (const m of sourceCode.matchAll(FORM_OPEN_RX)) {\n const start = m.index ?? 0;\n const end = sourceCode.indexOf(\"</form>\", start + m[0].length);\n out.push(end === -1 ? sourceCode.slice(start) : sourceCode.slice(start, end + \"</form>\".length));\n }\n return out;\n}\nfunction runFormSubmitControl(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const issues: EvalIssue[] = [];\n for (const form of submitForms(input.sourceCode)) {\n const controls = [...form.matchAll(CONTROL_TAG_RX)].map((m) => m[0]);\n if (controls.length === 0) continue;\n if (controls.some((tag) => SUBMIT_TYPE_RX.test(tag))) continue;\n const named = controls.find((tag) => /<Button\\b/.test(tag)) ?? controls[0]!;\n issues.push(\n mkIssue(\n \"universal.form_submit_control\",\n `A <form onSubmit> renders ${controls.length} control(s) and none submits it: the design Button defaults to type=\"button\", so clicking ${named.length > 60 ? `${named.slice(0, 57)}…` : named} does nothing — only Enter in a field submits.`,\n 'Give the control that submits this form type=\"submit\" — a Button inside a form defaults to type=\"button\" and never submits on click; keep type=\"button\" on the others.',\n \"fail\",\n ),\n );\n }\n return issues;\n}\n\nexport const UNIVERSAL_CHECKS: readonly AxisCheck[] = [\n {\n id: \"universal.icon_name_known\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runIconNameKnown,\n },\n {\n id: \"universal.caps_label_invented\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runCapsLabelInvented,\n },\n {\n id: \"universal.viewport_sized\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runViewportSized,\n },\n {\n id: \"universal.root_width_cap\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runRootWidthCap,\n },\n {\n id: \"universal.action_label_dropped\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runActionLabelDropped,\n },\n {\n id: \"universal.terminal_action_unguarded\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runTerminalActionUnguarded,\n },\n {\n id: \"universal.form_submit_control\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runFormSubmitControl,\n },\n {\n id: \"universal.fixture_default_echo\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runFixtureDefaultEcho,\n },\n {\n id: \"universal.accent_text_ink\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runAccentTextInk,\n },\n {\n id: \"universal.scoped_surface_owns_ground\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runScopedSurfaceOwnsGround,\n },\n {\n id: \"universal.prop_coverage\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runPropCoverage,\n },\n {\n id: \"universal.no_prop_mirror\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runNoPropMirror,\n },\n {\n id: \"universal.no_phantom_useState\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runNoPhantomUseState,\n },\n {\n id: \"universal.prop_seed_no_resync\",\n axis: \"render\",\n values: ALL_RENDER_VALUES,\n run: runPropSeedNoResync,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-merge.ts\n//\n// Checks gated on state=merge: the component owns a live entity list\n// reconciled from stream/action updates. Ported from\n// mode-checks/collection.ts (§5a state-seeded, no-hardcoded-entities,\n// derived-view-memoized).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n cap,\n getEntityCollections,\n getMutatedEntityCollections,\n mkIssue,\n} from \"../helpers.js\";\n\nfunction runStateSeededFromProps(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n const issues: EvalIssue[] = [];\n for (const e of entities) {\n const re = new RegExp(\n `useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?props\\\\.${e.name}\\\\b`,\n );\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"state.merge.seeded_from_props\",\n `Entity collection \"${e.name}\" is not seeded from props — no useState initializer reads props.${e.name}.`,\n `Add \\`const [${e.name}, set${cap(e.name)}] = useState(props.${e.name});\\` paired with \\`useEffect(() => set${cap(e.name)}(props.${e.name}), [props.${e.name}]);\\` so stream/action updates merge into live state AND agent repaints (ggui_amend) re-seed it (#480).`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoHardcodedEntities(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (entities.length === 0) return [];\n const uncommented = src\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/[^\\n]*/g, \"\");\n const issues: EvalIssue[] = [];\n const idFields = [...new Set(entities.map((e) => e.idField))];\n for (const idField of idFields) {\n const re = new RegExp(\n `\\\\[\\\\s*\\\\{[^}]*\\\\b${idField}\\\\s*:[^}]*\\\\}\\\\s*,\\\\s*\\\\{[^}]*\\\\b${idField}\\\\s*:`,\n \"g\",\n );\n if (!re.test(uncommented)) continue;\n issues.push(\n mkIssue(\n \"state.merge.no_hardcoded_entities\",\n `Hardcoded entity array literal (multiple objects with \"${idField}\") in the component — entity data should come from state/props.`,\n `Remove the literal array: this data comes from ${all.filter((e) => e.idField === idField).map((e) => `props.${e.name}`).join(\" / \") || \"props\"}. Read it there (\\`?? []\\` for an absent value, never a literal default), seed state from it, and merge updates via stream.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runDerivedViewMemoized(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (entities.length === 0) return [];\n const returnIdx = src.indexOf(\"return (\");\n if (returnIdx < 0) return [];\n const renderBody = src.slice(returnIdx);\n const issues: EvalIssue[] = [];\n for (const e of entities) {\n const re = new RegExp(`\\\\b${e.name}\\\\s*\\\\.(filter|reduce|sort)\\\\s*\\\\(`);\n if (re.test(renderBody)) {\n issues.push(\n mkIssue(\n \"state.merge.derived_view_memoized\",\n `Derived view (${e.name}.filter/reduce/sort) computed inside the render body — should be wrapped in useMemo.`,\n `Extract to \\`const ${e.name}Filtered = useMemo(() => ${e.name}.filter(...), [${e.name}, ...]);\\` before the return.`,\n \"warn\",\n ),\n );\n }\n }\n return issues;\n}\n\n/**\n * `.map()` keyed by index → reorders and merges break React reconciliation.\n * Gated on any render that iterates (list/grid/timeline/master-detail) OR\n * state=merge (mutating list).\n */\nfunction runMapKeyIsId(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const INDEX_NAMES = new Set([\"index\", \"idx\", \"i\", \"j\", \"k\", \"n\", \"ix\"]);\n const re = /key\\s*=\\s*\\{\\s*(\\w+)\\s*\\}/g;\n const issues: EvalIssue[] = [];\n for (const m of src.matchAll(re)) {\n const key = m[1];\n if (!INDEX_NAMES.has(key)) continue;\n issues.push(\n mkIssue(\n \"render.map_key_is_id\",\n `Array key uses index variable \"${key}\" — reorders and stream merges will break React reconciliation.`,\n `Replace key={${key}} with key={item.id} — or, when the items carry no id, with the field that names each one (item.label / item.symbol / item.name).`,\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_MERGE_CHECKS: readonly AxisCheck[] = [\n {\n id: \"state.merge.seeded_from_props\",\n axis: \"state\",\n values: [\"merge\"],\n run: runStateSeededFromProps,\n },\n {\n id: \"state.merge.no_hardcoded_entities\",\n axis: \"state\",\n values: [\"merge\"],\n run: runNoHardcodedEntities,\n },\n {\n id: \"state.merge.derived_view_memoized\",\n axis: \"state\",\n values: [\"merge\"],\n run: runDerivedViewMemoized,\n },\n // Map-key check: gated on any iterating render. state=merge always\n // implies iteration, so the render gate already covers it.\n {\n id: \"render.map_key_is_id\",\n axis: \"render\",\n values: [\"list\", \"grid\", \"timeline\", \"master-detail\"],\n run: runMapKeyIsId,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-ui-affordance.ts\n//\n// `state.ui_affordance.state_aria_present` (ggui#408) — a hand-rolled\n// stateful control must expose its state in ARIA.\n//\n// Why this is a DETERMINISTIC check and not (only) an LLM criterion:\n// the Experiment-53 baseline showed the defect class is structurally\n// invisible to the LLM leg — `state=ui-affordance` with no writes\n// classifies `riskTier=low`, and the low-risk bypass skips tier-1+2\n// entirely, so 10/10 ARIA-less generations were never evaluated at\n// all. Axis checks run BEFORE the bypass decision, and a `fail` among\n// them disables the bypass for that round — which both surfaces the\n// finding and routes it into the coding loop. Prototype validation\n// against the 27-cell baseline corpus: precision 1.00, recall 0.80\n// (both false negatives closed here: lowercase tags — `<div\n// as={Clickable}>` is the WORSE variant since `as` is inert on a\n// native element — and callback-prop indirection in extracted\n// subcomponents).\n//\n// Detection predicate (v2 — \"the element's own onClick mutates the\n// affordance state\"; v1's styling-dataflow precondition scored recall\n// 0.30, do not resurrect it): an element fires when its `onClick`\n// references a `useState` setter, a local handler that calls one, or\n// an `on[A-Z]…` callback prop (extracted-subcomponent shape) — AND it\n// is not a semantics-owning primitive, carries no state ARIA\n// (`aria-checked/pressed/selected/expanded/current` or any `role=`),\n// and contains no state-carrying primitive in its subtree (pushing\n// duplicate ARIA onto a wrapper around `<Checkbox>` is itself a\n// defect the judge fails — never demand it).\n//\n// Gate: `{axis: \"state\", values: [\"ui-affordance\"]}` ONLY. The\n// predicate must not reach `state=payload/draft` (form-field wrappers\n// with onClick would false-flag) or `state=merge` (kanban's per-item\n// onClick is a MOVE, not a boolean affordance).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { mkIssue } from \"../helpers.js\";\n\nconst STATE_ARIA_OR_ROLE = /aria-(checked|pressed|selected|expanded|current)\\s*=|role\\s*=/;\nconst STATE_PRIMITIVE_IN_SUBTREE = /<(Checkbox|Toggle|Tabs|Accordion)[\\s/>]/;\n/** Primitives that own their own interaction semantics — never flagged. */\nconst SEMANTIC_PRIMITIVES = new Set([\"Button\", \"Checkbox\", \"Toggle\", \"Link\", \"MenuItem\"]);\n\n/** Collect `const [x, setX] = useState(...)` setter names. */\nfunction collectSetters(src: string): Set<string> {\n const setters = new Set<string>();\n for (const m of src.matchAll(/const\\s*\\[\\s*\\w+\\s*,\\s*(set\\w+)\\s*\\]\\s*=\\s*useState/g)) {\n setters.add(m[1]);\n }\n return setters;\n}\n\n/** Collect local handler names whose body (nearby) calls a setter. */\nfunction collectHandlers(src: string, setters: Set<string>): Set<string> {\n const handlers = new Set<string>();\n for (const m of src.matchAll(/const\\s+(\\w+)\\s*=\\s*(?:\\([^)]*\\)|\\w+)\\s*=>\\s*\\{?/g)) {\n const body = src.slice(m.index + m[0].length, m.index + m[0].length + 400);\n for (const s of setters) {\n if (body.includes(s)) {\n handlers.add(m[1]);\n break;\n }\n }\n }\n return handlers;\n}\n\n/** The attribute block of an opening tag: from after the tag name to its `>` (brace-aware). */\nfunction attrBlock(src: string, start: number): { block: string; end: number } {\n let depth = 0;\n for (let i = start; i < src.length; i++) {\n const c = src[i];\n if (c === \"{\") depth++;\n else if (c === \"}\") depth--;\n else if (c === \">\" && depth === 0) return { block: src.slice(start, i), end: i };\n }\n return { block: src.slice(start, start + 900), end: start + 900 };\n}\n\n/** The brace-balanced expression of `onClick={…}`, or null when absent. */\nfunction onClickValue(block: string): string | null {\n const m = block.match(/onClick\\s*=\\s*\\{/);\n if (!m || m.index === undefined) return null;\n const open = m.index + m[0].length - 1;\n let depth = 0;\n for (let i = open; i < block.length; i++) {\n if (block[i] === \"{\") depth++;\n else if (block[i] === \"}\") {\n depth--;\n if (depth === 0) return block.slice(open + 1, i);\n }\n }\n return block.slice(open + 1);\n}\n\nfunction subtree(src: string, pos: number, tag: string): string {\n const close = src.indexOf(`</${tag}>`, pos);\n return src.slice(pos, close === -1 ? pos + 700 : close);\n}\n\nfunction runStateAriaPresent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const setters = collectSetters(src);\n const handlers = collectHandlers(src, setters);\n const issues: EvalIssue[] = [];\n const flaggedLines = new Set<number>();\n\n // Locally-defined components: their CALL SITES can never satisfy the\n // check (the ARIA lives inside the definition, which this check\n // already covers via the callback-prop clause) — flagging the call\n // site is a permanently-unresolvable finding that stalls the\n // eval-fix loop in the recurrence guard (Experiment 54: exactly the\n // 2/27 stuck cells). Skip call sites of components defined in this\n // file; the definition's own inner element carries the check.\n const localComponents = new Set<string>();\n for (const m of src.matchAll(/(?:function\\s+([A-Z]\\w*)\\s*\\(|const\\s+([A-Z]\\w*)\\s*=)/g)) {\n localComponents.add(m[1] ?? m[2]);\n }\n\n for (const m of src.matchAll(/<([A-Za-z][A-Za-z0-9]*)\\b/g)) {\n const tag = m[1];\n if (m.index === undefined) continue;\n if (localComponents.has(tag)) continue;\n const { block, end } = attrBlock(src, m.index + m[0].length);\n const clickValue = onClickValue(block);\n if (clickValue === null) continue;\n const mutatesAffordance =\n [...setters].some((s) => clickValue.includes(s)) ||\n [...handlers].some((h) => new RegExp(`\\\\b${h}\\\\b`).test(clickValue)) ||\n // Extracted-subcomponent shape: the toggle handler arrives as an\n // `on[A-Z]…` callback prop and is invoked from onClick — inside a\n // ui-affordance component that IS the affordance mutation.\n /\\bon[A-Z]\\w*\\b/.test(clickValue);\n if (!mutatesAffordance) continue;\n if (SEMANTIC_PRIMITIVES.has(tag)) continue;\n if (STATE_ARIA_OR_ROLE.test(block)) continue;\n if (STATE_PRIMITIVE_IN_SUBTREE.test(subtree(src, end, tag))) continue;\n\n const line = src.slice(0, m.index).split(\"\\n\").length;\n if (flaggedLines.has(line)) continue;\n flaggedLines.add(line);\n issues.push(\n mkIssue(\n \"state.ui_affordance.state_aria_present\",\n `Line ${line}: <${tag}> toggles the UI affordance from its onClick but exposes no state ARIA — its checked/selected/expanded state is invisible to assistive technology (styling is the only carrier).`,\n `Add the matching state attribute to the SAME element that carries the onClick: \\`role=\"checkbox\"\\` + \\`aria-checked={…}\\` for a toggle row, \\`aria-pressed\\` for a toggle button, \\`aria-selected\\` for a selection, \\`aria-expanded\\` for an open/close affordance — or replace the hand-rolled control with the state-carrying primitive (Checkbox / Toggle / Tabs / Accordion). \\`as={Clickable}\\` adds button + keyboard semantics but NOT state.`,\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_UI_AFFORDANCE_CHECKS: readonly AxisCheck[] = [\n {\n id: \"state.ui_affordance.state_aria_present\",\n axis: \"state\",\n values: [\"ui-affordance\"],\n run: runStateAriaPresent,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/realtime.ts\n//\n// Checks gated on realtime != none. Ported from mode-checks/collection.ts\n// (stream-handler-per-event, stream-merges-by-id).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n getEntityCollections,\n getMutatedEntityCollections,\n getStreamEventNames,\n mkIssue,\n} from \"../helpers.js\";\n\nconst REALTIME_ACTIVE = [\"merge\", \"append\", \"status\", \"presence\", \"mixed\"] as const;\n\nfunction runStreamHandlerPerEvent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const eventNames = getStreamEventNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of eventNames) {\n const re = new RegExp(`useStream(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"realtime.stream_handler_per_event\",\n `Stream event \"${name}\" declared in the contract has no useStream('${name}') call.`,\n `Add \\`const ${name} = useStream<...>('${name}');\\` and handle ${name}.latest in a useEffect.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runStreamMergesById(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const eventNames = getStreamEventNames(input.contract);\n const all = getEntityCollections(input.contract);\n const entities = getMutatedEntityCollections(input.contract, all);\n if (eventNames.length === 0 || entities.length === 0) return [];\n const issues: EvalIssue[] = [];\n const idFields = new Set(entities.map((e) => e.idField));\n for (const idField of idFields) {\n const re = new RegExp(`\\\\.${idField}\\\\b`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"realtime.merge.stream_merges_by_id\",\n `Entity id field \"${idField}\" is never referenced in the source — stream merge likely does not key by id.`,\n `In the stream handler, merge by id: setItems(prev => prev.map(x => x.${idField} === update.${idField} ? {...x, ...update} : x)).`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nexport const REALTIME_CHECKS: readonly AxisCheck[] = [\n {\n id: \"realtime.stream_handler_per_event\",\n axis: \"realtime\",\n values: REALTIME_ACTIVE,\n run: runStreamHandlerPerEvent,\n },\n {\n id: \"realtime.merge.stream_merges_by_id\",\n axis: \"realtime\",\n values: [\"merge\", \"mixed\"],\n run: runStreamMergesById,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/writes.ts\n//\n// Checks gated on writes != none. Ported from display.ts (action-hook,\n// action-handler) + form.ts (submit-hook, submit-handler, submit-disabled)\n// + collection.ts (per-item action variants).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n getActionNames,\n getSubmitActions,\n mkIssue,\n} from \"../helpers.js\";\n\nconst ACTIVE_WRITES = [\n \"commit\", \"multi-commit\", \"per-item\", \"submit\", \"compose\",\n] as const;\n\nfunction runActionHookWired(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const actionNames = getActionNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of actionNames) {\n const re = new RegExp(`useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"writes.action_hook_wired\",\n `Contract action \"${name}\" has no useAction('${name}') call.`,\n `Add \\`const ${name} = useAction<...>('${name}');\\` and wire it to the relevant control.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runActionHandlerAttached(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const actionNames = getActionNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of actionNames) {\n const declRe = new RegExp(\n `const\\\\s+(\\\\w+)\\\\s*=\\\\s*useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${name}['\"\\`]`,\n );\n const m = src.match(declRe);\n if (!m) continue;\n const constName = m[1];\n const rest = src.replace(m[0], \"\");\n if (new RegExp(`\\\\b${constName}\\\\s*\\\\(`).test(rest)) continue;\n issues.push(\n mkIssue(\n \"writes.action_handler_attached\",\n `useAction result \"${constName}\" (for action \"${name}\") is declared but never invoked.`,\n `Call ${constName}({...}) from an interactive element (e.g., <Button onClick={() => ${constName}(payload)}>).`,\n ),\n );\n }\n return issues;\n}\n\nfunction runSubmitDisabledPath(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n if (/disabled\\s*=\\s*\\{/.test(src)) return [];\n return [\n mkIssue(\n \"writes.submit.disabled_path\",\n `Form has no \\`disabled={...}\\` expression anywhere — submit is likely unconditional.`,\n `Gate submit on validation: e.g. \\`<Button disabled={!isValid} onClick={handleSubmit}>\\`.`,\n \"warn\",\n ),\n ];\n}\n\nexport const WRITES_CHECKS: readonly AxisCheck[] = [\n {\n id: \"writes.action_hook_wired\",\n axis: \"writes\",\n values: ACTIVE_WRITES,\n run: runActionHookWired,\n },\n {\n id: \"writes.action_handler_attached\",\n axis: \"writes\",\n values: ACTIVE_WRITES,\n run: runActionHandlerAttached,\n },\n {\n id: \"writes.submit.disabled_path\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitDisabledPath,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/state-payload.ts\n//\n// Checks gated on state=payload or writes=submit. Ported from\n// mode-checks/form.ts (submit-hook, submit-handler, state-covers-payload,\n// initial-values-seeded, option-lists-consumed, no-orphan-payload-key).\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport {\n collectStateKeys,\n getArrStrProps,\n getInitialValuePropNames,\n getSubmitActions,\n mkIssue,\n} from \"../helpers.js\";\n\nfunction runSubmitHookPresent(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const re = new RegExp(`useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${s.name}['\"\\`]`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"writes.submit.hook_present\",\n `Submit action \"${s.name}\" has no useAction('${s.name}') call.`,\n `Add \\`const ${s.name} = useAction<...>('${s.name}');\\` and invoke it from the submit button.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runSubmitHandlerAttached(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const declRe = new RegExp(\n `const\\\\s+(\\\\w+)\\\\s*=\\\\s*useAction(?:<[^>]*>)?\\\\s*\\\\(\\\\s*['\"\\`]${s.name}['\"\\`]`,\n );\n const m = src.match(declRe);\n if (!m) continue;\n const constName = m[1];\n const rest = src.replace(m[0], \"\");\n if (new RegExp(`\\\\b${constName}\\\\s*\\\\(`).test(rest)) continue;\n issues.push(\n mkIssue(\n \"writes.submit.handler_attached\",\n `useAction result \"${constName}\" (for submit \"${s.name}\") is declared but never invoked.`,\n `Call ${constName}(payload) from the submit button's onClick handler, after validation.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runStateCoversPayload(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n const stateKeys = collectStateKeys(src);\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const missing = s.payloadKeys.filter((k) => !stateKeys.has(k));\n if (missing.length === 0) continue;\n issues.push(\n mkIssue(\n \"state.payload.covers_submit\",\n `Submit action \"${s.name}\" expects payload keys [${s.payloadKeys.join(\", \")}] but state does not cover: ${missing.join(\", \")}.`,\n `Add a state slot for each missing key so the final payload can be assembled.`,\n ),\n );\n }\n return issues;\n}\n\n/**\n * Whether a `useState` initializer reads `props.<name>`: directly, or through a local bound from\n * it (`const initial = normalize(props.initialProfile)` then `useState(initial.name)`, or a\n * destructure `const { name } = props.initialProfile ?? {}` then `useState(name)`). The property\n * this check guards is \"form state is seeded from the prop\", not a spelling: ggui#1261's Exp 011\n * cell re-seeded correctly through a normalized local, was refused, and spent a turn restoring\n * the literal form.\n */\nfunction seedsFromProp(src: string, name: string): boolean {\n const propRef = `props\\\\??\\\\.${name}\\\\b`;\n const initializerReads = (ref: string): boolean =>\n new RegExp(`useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?${ref}`).test(src);\n if (initializerReads(propRef)) return true;\n const locals = new Set<string>();\n for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\\\s+(\\\\w+)\\\\s*(?::[^=]{1,80})?=\\\\s*[^;]{0,300}?${propRef}`, \"g\"))) {\n const id = m[1];\n if (id !== undefined) locals.add(id);\n }\n for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\\\s*\\\\{([^}]{1,400})\\\\}\\\\s*=\\\\s*[^;]{0,300}?${propRef}`, \"g\"))) {\n for (const part of (m[1] ?? \"\").split(\",\")) {\n const id = part.split(\":\").pop()?.split(\"=\")[0]?.trim();\n if (id !== undefined && /^\\w+$/.test(id)) locals.add(id);\n }\n }\n for (const id of locals) if (initializerReads(`\\\\b${id}\\\\b`)) return true;\n return false;\n}\n\nfunction runInitialValuesSeeded(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const initialProps = getInitialValuePropNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of initialProps) {\n if (seedsFromProp(src, name)) continue;\n issues.push(\n mkIssue(\n \"state.payload.initial_values_seeded\",\n `Prop \"${name}\" (pre-filled initial values) is never read in a useState initializer.`,\n `Seed form state from props.${name} so edit mode pre-fills.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runOptionListsConsumed(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const arrStrNames = getArrStrProps(input.contract);\n const hasAnyMap = /\\.map\\s*\\(/.test(src);\n const issues: EvalIssue[] = [];\n for (const name of arrStrNames) {\n const referenced = new RegExp(`\\\\bprops\\\\.${name}\\\\b`).test(src);\n if (referenced && hasAnyMap) continue;\n const reason = !referenced\n ? `Option list prop \"${name}\" (arr<str>) is never referenced — users cannot see the options.`\n : `Option list prop \"${name}\" (arr<str>) is referenced but the component has no .map() — options are not rendered as choices.`;\n issues.push(\n mkIssue(\n \"state.payload.option_lists_consumed\",\n reason,\n `Render options with \\`props.${name}.map(option => <RadioOption value={option} ... />)\\`.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runNoOrphanPayloadKey(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const submits = getSubmitActions(input.contract);\n if (submits.length === 0) return [];\n const body = src\n .replace(/interface\\s+Action\\w+[\\s\\S]*?\\n}/g, \"\")\n .replace(/type\\s+Action\\w+[\\s\\S]*?\\n;/g, \"\");\n const issues: EvalIssue[] = [];\n for (const s of submits) {\n const orphans: string[] = [];\n for (const key of s.payloadKeys) {\n const re = new RegExp(`\\\\b${key}\\\\b`);\n if (!re.test(body)) orphans.push(key);\n }\n if (orphans.length === 0) continue;\n issues.push(\n mkIssue(\n \"state.payload.no_orphan_key\",\n `Submit payload keys [${orphans.join(\", \")}] never appear in the component body — missing from the submitted payload.`,\n `Add UI and state for these keys, or remove them from the ActionEntry if not needed.`,\n \"warn\",\n ),\n );\n }\n return issues;\n}\n\nexport const STATE_PAYLOAD_CHECKS: readonly AxisCheck[] = [\n {\n id: \"writes.submit.hook_present\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitHookPresent,\n },\n {\n id: \"writes.submit.handler_attached\",\n axis: \"writes\",\n values: [\"submit\"],\n run: runSubmitHandlerAttached,\n },\n {\n id: \"state.payload.covers_submit\",\n axis: \"state\",\n values: [\"payload\"],\n run: runStateCoversPayload,\n },\n {\n id: \"state.payload.initial_values_seeded\",\n axis: \"state\",\n values: [\"payload\", \"draft\"],\n run: runInitialValuesSeeded,\n },\n {\n id: \"state.payload.option_lists_consumed\",\n axis: \"state\",\n values: [\"payload\"],\n run: runOptionListsConsumed,\n },\n {\n id: \"state.payload.no_orphan_key\",\n axis: \"state\",\n values: [\"payload\"],\n run: runNoOrphanPayloadKey,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/tooling.ts\n//\n// Checks gated on the tooling axis. Two surfaces:\n//\n// - `tooling.clientCapability.hook_called` — verifies every declared\n// `clientCapabilities.gadgets[name]` has a matching\n// `const <name> = …()` binding in source.\n// - `tooling.clientCapability.start_called` — verifies a bound\n// gadget hook also has a `.start(...)` invocation; without it\n// the capability stays in `idle` and never fires.\n// - `realtime.stream_source.no_direct_call` — the LLM must NOT\n// directly invoke a tool named on `streamSpec[*].source.tool`;\n// subscribe via `useStream(...)` instead.\n// - `universal.no_retired_identifiers` — fires on every contract.\n// The LLM's training data predates the current wire shape and\n// reaches for retired identifiers (component-side tool hooks,\n// dispatch.kind, intendedTool, broadcast field, retired catalog\n// names, retired package imports, retired wire-input fields).\n// The grep gate emits one issue per detected identifier so the\n// LLM rewrites toward the current shape before evaluation\n// completes.\n\nimport type { DataContract, StreamChannelEntry } from \"@ggui-ai/protocol\";\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { getGadgetNames, getStdlibGadgetNames, mkIssue } from \"../helpers.js\";\n\nconst CLIENT_PRESENT = [\"client\", \"both\"] as const;\nconst ALL_TOOLING_VALUES = [\"none\", \"wired\", \"client\", \"both\"] as const;\nconst REALTIME_ACTIVE = [\n \"merge\",\n \"append\",\n \"status\",\n \"presence\",\n \"mixed\",\n] as const;\n\n// ── clientCapabilities ──────────────────────────────────────────────\n\nfunction runGadgetHookCalled(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const names = getGadgetNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of names) {\n // The boilerplate emits `const <name> = <hook>();` — match the const\n // binding to detect omission. We don't pin the hook identifier here\n // because the contract carries it via `entry.hook` and the LLM may\n // legitimately alias on import.\n const re = new RegExp(`const\\\\s+${name}\\\\s*=`);\n if (re.test(src)) continue;\n issues.push(\n mkIssue(\n \"tooling.clientCapability.hook_called\",\n `Contract clientCapability \"${name}\" has no \\`const ${name} = …()\\` hook call.`,\n `Import the declared hook (default package: @ggui-ai/gadgets) and bind its return value to \\`const ${name}\\` at the top of the component; surface \\`.value\\` / \\`.status\\` in JSX.`,\n ),\n );\n }\n return issues;\n}\n\nfunction runClientCapabilityStartCalled(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Only the first-party `@ggui-ai/gadgets` browser capabilities have\n // the `idle → prompting → active` lifecycle that `.start()` drives.\n // Registered third-party gadget hooks (e.g. `useBoardState`) are\n // plain data hooks the runtime resolves on its own — exclude them.\n const names = getStdlibGadgetNames(input.contract);\n const issues: EvalIssue[] = [];\n for (const name of names) {\n // Skip when the binding doesn't exist — the `hook_called` check\n // covers that case; we don't double-issue.\n const bindingRe = new RegExp(`const\\\\s+${name}\\\\s*=`);\n if (!bindingRe.test(src)) continue;\n\n // The capability lifecycle requires `.start()` invocation to\n // transition from `idle` → `prompting`. Without it the hook's\n // `.value` / `.status` stay frozen at the initial state and the\n // UI feature never fires. Match `<name>.start(`, allowing chained\n // member access or method aliasing.\n const startRe = new RegExp(`\\\\b${name}\\\\s*\\\\.\\\\s*start\\\\s*\\\\(`);\n if (startRe.test(src)) continue;\n issues.push(\n mkIssue(\n \"tooling.clientCapability.start_called\",\n `clientCapability \"${name}\" is bound but \\`${name}.start(…)\\` is never invoked — the capability stays in 'idle' and the feature won't fire.`,\n `Wire \\`${name}.start({...})\\` to a UI control (Button onClick, effect, etc.). Read \\`.status\\` to gate the UI between 'idle' / 'prompting' / 'active' / 'completed' / 'denied' / 'error'.`,\n ),\n );\n }\n return issues;\n}\n\n// ── streamSpec sources ──────────────────────────────────────────────\n\nfunction collectStreamSourceTools(\n contract: DataContract | undefined,\n): Map<string, string> {\n // Map<channelName, sourceToolName> for every channel that declares\n // a source. Excludes channels without `source` (agent-written).\n const result = new Map<string, string>();\n const streamSpec = contract?.streamSpec;\n if (!streamSpec || typeof streamSpec !== \"object\") return result;\n for (const [channelName, entryRaw] of Object.entries(streamSpec)) {\n const entry = entryRaw as StreamChannelEntry | undefined;\n if (!entry || typeof entry !== \"object\") continue;\n const tool = entry.source?.tool;\n if (typeof tool !== \"string\" || tool.length === 0) continue;\n result.set(channelName, tool);\n }\n return result;\n}\n\nfunction runStreamSourceNoDirectCall(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const map = collectStreamSourceTools(input.contract);\n if (map.size === 0) return [];\n\n const issues: EvalIssue[] = [];\n for (const [channelName, toolName] of map) {\n // Detect a direct call to the source tool. Matches identifier\n // followed by `(` — covers `foo()`, `foo(args)`, `foo.bar()`\n // (the dotted form indirectly catches `someObject.foo()` which\n // the contract doesn't expect to see, since the source tool is\n // an agent-side MCP tool, not a local function).\n const callRe = new RegExp(`\\\\b${toolName}\\\\s*\\\\(`);\n if (!callRe.test(src)) continue;\n\n // Don't false-fire when `toolName` happens to be the channel name\n // bound to useStream (e.g., `const messages = useStream(...)` then\n // `messages(...)` would be weird but we're matching the TOOL name,\n // not the binding). If toolName === channelName then the\n // `<channel>(` call would be the useStream binding being called\n // as a function — which is itself wrong, so still emit.\n issues.push(\n mkIssue(\n \"realtime.stream_source.no_direct_call\",\n `Source code calls \\`${toolName}(...)\\` directly but the contract declares it as the source tool for streamSpec.${channelName}. Source tools are agent-side / runtime-polled; the component MUST NOT invoke them.`,\n `Subscribe to the channel via \\`const ${channelName} = useStream('${channelName}');\\` and read \\`${channelName}.latest\\` / \\`${channelName}.all\\` — the runtime polls or subscribes to '${toolName}' on the component's behalf.`,\n ),\n );\n }\n return issues;\n}\n\n// ── Anti-pattern grep — retired identifiers a model may emit from\n// stale training data ──\n\ninterface RetiredIdentifier {\n /** Regex matching the retired surface in source. */\n readonly pattern: RegExp;\n /** Stable subcategory used for the EvalIssue. */\n readonly id: string;\n /** Human-readable description for the issue message. */\n readonly label: string;\n /** Replacement guidance for the fix message. */\n readonly replacement: string;\n}\n\nconst RETIRED_IDENTIFIERS: readonly RetiredIdentifier[] = [\n {\n pattern: /\\buseWiredTool\\b/,\n id: \"useWiredTool\",\n label: \"`useWiredTool(...)` hook\",\n replacement:\n \"Use `useAction(name)` for user gestures the agent should react to. `agentCapabilities.tools` entries are agent-side catalog declarations — the component never calls them directly.\",\n },\n {\n pattern: /\\buseAgentTool\\b/,\n id: \"useAgentTool\",\n label: \"`useAgentTool(...)` hook\",\n replacement:\n \"Agent-side tools are NEVER imported as component hooks. The contract declares them under `agentCapabilities.tools` for cross-ref (actionSpec.nextStep / streamSpec.source.tool); the component reacts via `useAction` / `useStream`.\",\n },\n {\n pattern: /\\bcallWiredTool\\b/,\n id: \"callWiredTool\",\n label: \"`callWiredTool(...)` call\",\n replacement:\n \"Component-side direct invocation of agent-side tools is retired. Fire a UI gesture via `useAction(name)`; the agent reacts on its next turn (`nextStep` hint optional).\",\n },\n {\n pattern: /\\buseClientTool\\b/,\n id: \"useClientTool\",\n label: \"`useClientTool(name, handler)` hook\",\n replacement:\n \"Use a gadget hook from `@ggui-ai/gadgets` (e.g., `useGeolocation`, `useClipboardWrite`) and thread the result into a contextSpec slot or actionSpec payload.\",\n },\n {\n pattern: /\\bdispatch\\s*:\\s*\\{\\s*kind\\s*:/,\n id: \"dispatch.kind\",\n label: \"`dispatch: { kind: '...' }` discriminated union\",\n replacement:\n \"ActionEntry.dispatch is retired. Use the flat `nextStep?: '<tool>'` field on the action entry instead.\",\n },\n {\n pattern: /\\bintendedTool\\b/,\n id: \"intendedTool\",\n label: \"`intendedTool` field\",\n replacement:\n \"Use the flat `nextStep` field — the hint surface is one optional advisory string, not a nested discriminator.\",\n },\n {\n pattern: /\\bmode\\s*:\\s*['\"`]host-routed['\"`]/,\n id: \"mode.host-routed\",\n label: \"`mode: 'host-routed'`\",\n replacement:\n \"The `mode` field on action entries is retired. All actions are agent-routed; use `nextStep` for the optional tool hint.\",\n },\n {\n pattern: /\\bbroadcast\\s*:\\s*\\{/,\n id: \"broadcast\",\n label: \"`broadcast: { … }` contract field\",\n replacement:\n \"Move the channel source declaration to `streamSpec[channel].source = { tool, args? }`.\",\n },\n {\n // Match `agentTools` only as a contract-shaped object key or\n // property access — not as a local variable name in unrelated\n // code. `\\bagentTools\\s*[:.]` catches `{ agentTools: {...} }` /\n // `contract.agentTools` while ignoring `const agentTools = ...`.\n pattern: /\\bagentTools\\s*[:.]/,\n id: \"contract.agentTools\",\n label: \"`agentTools` top-level contract field\",\n replacement:\n \"The top-level `agentTools` field is retired. Declare agent-side tools under `agentCapabilities.tools` (catalog nested under a capabilities parent for symmetry with `clientCapabilities`).\",\n },\n {\n pattern: /\\bclientCapabilities\\s*\\.\\s*capabilities\\b/,\n id: \"clientCapabilities.capabilities\",\n label: \"`clientCapabilities.capabilities` inner key\",\n replacement:\n \"The inner `capabilities` key is retired. Use `clientCapabilities.gadgets` — entries are library-hook declarations, not RPC capabilities.\",\n },\n {\n pattern: /['\"`]@ggui-ai\\/client-tools['\"`]/,\n id: \"package.@ggui-ai/client-tools\",\n label: \"`@ggui-ai/client-tools` package import\",\n replacement:\n \"The package was renamed to `@ggui-ai/gadgets`. Update the import string.\",\n },\n {\n pattern: /\\bPushStory\\b/,\n id: \"PushStory\",\n label: \"`PushStory` type / `pushStorySchema` schema\",\n replacement:\n \"`PushStory` was retired when the handshake input was flattened. The current wire is `ggui_handshake({intent, blueprintDraft: {contract, variance?, generator?}})` + `ggui_render({handshakeId, props, override?: {contract?, variance?}})` (omit `override` to accept the proposal as-is).\",\n },\n {\n pattern: /\\bpushStorySchema\\b/,\n id: \"pushStorySchema\",\n label: \"`pushStorySchema` zod schema\",\n replacement:\n \"`pushStorySchema` was retired alongside `PushStory`. Current schemas: `handshakeInputSchema` + `renderInputSchema` (with the optional `override` re-aim) in `@ggui-ai/protocol`.\",\n },\n {\n pattern: /\\bstory\\s*\\.\\s*adapters\\b/,\n id: \"story.adapters\",\n label: \"`story.adapters` field access\",\n replacement:\n \"The story.adapters gate was retired alongside `PushStory`. Per-app permission gates flow through `clientCapabilities.gadgets[*].permission` (Permissions-Policy derivation).\",\n },\n {\n pattern: /\\bdeclaredAdapters\\b/,\n id: \"declaredAdapters\",\n label: \"`declaredAdapters` field / runtime gate\",\n replacement:\n \"App-level `declaredAdapters` was retired. Per-app permission gates derive from `clientCapabilities.gadgets[*].permission` instead.\",\n },\n {\n pattern: /\\bassertAdaptersDeclared\\b/,\n id: \"assertAdaptersDeclared\",\n label: \"`assertAdaptersDeclared(...)` runtime call\",\n replacement:\n \"The runtime adapter-gate function is retired. Permissions-Policy is derived per-contract at render commit time and threaded through the bootstrap projection.\",\n },\n {\n pattern: /\\bHandshakeStoredStory\\b/,\n id: \"HandshakeStoredStory\",\n label: \"`HandshakeStoredStory` storage type\",\n replacement:\n \"The OSS handler's stored type is now `HandshakeStoredInput` with the MVB-5 `{intent, blueprintDraft, forceCreate?}` shape.\",\n },\n {\n pattern: /\\brecord\\s*\\.\\s*story\\b/,\n id: \"record.story\",\n label: \"`record.story.*` access on handshake storage\",\n replacement:\n \"Handshake storage was flattened. Read `record.input.*` (intent / blueprintDraft) — the nested `story` wrapper is gone. MVB-5 also adds `record.suggestion` + `record.effectiveContract`.\",\n },\n];\n\nfunction runNoRetiredIdentifiers(input: AxisCheckInput): EvalIssue[] {\n // Source-only scan; compiled code irrelevant for identifier detection.\n // Run even without compiled code so we surface early in the loop.\n const src = input.sourceCode;\n const issues: EvalIssue[] = [];\n for (const rule of RETIRED_IDENTIFIERS) {\n if (!rule.pattern.test(src)) continue;\n issues.push(\n mkIssue(\n `universal.no_retired_identifiers.${rule.id}`,\n `Source contains ${rule.label} — retired from the contract surface.`,\n rule.replacement,\n ),\n );\n }\n return issues;\n}\n\nexport const TOOLING_CHECKS: readonly AxisCheck[] = [\n {\n id: \"tooling.clientCapability.hook_called\",\n axis: \"tooling\",\n values: CLIENT_PRESENT,\n run: runGadgetHookCalled,\n },\n {\n id: \"tooling.clientCapability.start_called\",\n axis: \"tooling\",\n values: CLIENT_PRESENT,\n run: runClientCapabilityStartCalled,\n },\n {\n // Stream-source direct-call check. Gated on realtime axis (rather\n // than tooling) since stream sources are a realtime concern — but\n // logically lives in tooling.ts alongside the other tool-reference\n // checks since the issue class is about referenced agentTools.\n id: \"realtime.stream_source.no_direct_call\",\n axis: \"realtime\",\n values: REALTIME_ACTIVE,\n run: runStreamSourceNoDirectCall,\n },\n {\n // Universal — fires on every tooling-axis value. The check itself\n // is contract-agnostic; the axis gate is \"every contract\" via the\n // full ALL_TOOLING_VALUES list (rather than the universal-check\n // module's \"render\" gate convention) so the anti-pattern stays\n // co-located with the other tooling-related rules.\n id: \"universal.no_retired_identifiers\",\n axis: \"tooling\",\n values: ALL_TOOLING_VALUES,\n run: runNoRetiredIdentifiers,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/checks/grid.ts\n//\n// Checks gated on `render=grid`.\n//\n// ── grid.board_columns_side_by_side (ggui#1046) ─────────────────────────\n// A kanban classifies as `render=grid` (the classifier's GRID_RX carries\n// `kanban`), and three of four constrained mints on the candidate-15 image\n// composed the board's columns as a vertical <Stack> of sections — no <Grid>\n// anywhere — then read below the judge's bar; the tier-2 evaluator saw the\n// stacking only as a `warn`, which never costs a fix turn. This check reads\n// the source the way the fix turn must: find the JSX map over the board's\n// columns array and name the layout primitive that ENCLOSES it. <Grid> or\n// <Row> = side by side; <Stack> / <Card> / <Box> / a bare block / nothing =\n// stacked. Stands down in `free` design mode, where the primitive is optional.\n\nimport type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\nimport { axisCheckTraceEnabled, mkIssue } from \"../helpers.js\";\n\n/** Prop names a board's column array goes by. */\nconst BOARD_PROP_RX = /^(columns?|lanes?|stages?|lists?|buckets?|swimlanes?)$/i;\nconst BOARD_PROMPT_RX = /\\b(kanban|board)\\b/i;\n/** The names a board's column array goes by, for the prompt and source paths. */\nconst BOARD_NAMES = [\"columns\", \"lanes\", \"stages\", \"lists\", \"buckets\", \"swimlanes\"] as const;\n/** Layout primitives whose nesting decides side-by-side vs stacked. */\nconst LAYOUT_TAG_RX = /<(\\/?)(Grid|Row|Stack|Card|Box|Container|ScrollArea|div|section)\\b([^<>]*?)>/g;\nconst SIDE_BY_SIDE = new Set([\"Grid\", \"Row\"]);\n\ninterface PropShapeLike {\n type?: string;\n schema?: { type?: string };\n}\n\n/** The board prop names the contract declares as arrays. */\nexport function boardPropNames(contract: AxisCheckInput[\"contract\"]): string[] {\n const propsField = contract?.propsSpec as { properties?: Record<string, PropShapeLike> } | undefined;\n const properties = propsField?.properties ?? {};\n return Object.entries(properties)\n .filter(([name, p]) => BOARD_PROP_RX.test(name) && (p?.type === \"array\" || p?.schema?.type === \"array\"))\n .map(([name]) => name);\n}\n\n/**\n * Every JSX map over `name`, by index — an expression-body arrow (`name.map((col) => (<…`)\n * or a block-body one (`name.map((col) => { … return (<…`); the serving deployment's candidate-18 kanban\n * mints composed two of three stacked boards through the block form (ggui#1046), which the\n * first reader never matched.\n */\nfunction jsxMapPositions(sourceCode: string, name: string): number[] {\n const rx = new RegExp(\n `\\\\b${name}(?:\\\\?\\\\.)?\\\\.map\\\\(\\\\s*\\\\(?\\\\s*\\\\w+(?:\\\\s*,\\\\s*\\\\w+)?\\\\s*\\\\)?\\\\s*=>\\\\s*(?:\\\\(?\\\\s*<|\\\\{[^{}]{0,600}?\\\\breturn\\\\s*\\\\(?\\\\s*<)`,\n \"g\",\n );\n return [...sourceCode.matchAll(rx)].map((m) => m.index ?? 0);\n}\n\n/** The layout primitive enclosing `pos`, walked as a tag stack over the source before it. */\nexport function enclosingLayoutTag(sourceCode: string, pos: number): string | undefined {\n const stack: string[] = [];\n for (const m of sourceCode.slice(0, pos).matchAll(LAYOUT_TAG_RX)) {\n const closing = m[1] === \"/\";\n const name = m[2] ?? \"\";\n const attrs = m[3] ?? \"\";\n if (closing) {\n if (stack[stack.length - 1] === name) stack.pop();\n continue;\n }\n if (attrs.trimEnd().endsWith(\"/\")) continue; // self-closing\n stack.push(name);\n }\n return stack[stack.length - 1];\n}\n\n/** What the check read (ggui#1046): the board names it walked and, per name, every JSX map's enclosing layout tag. */\nexport interface BoardRead {\n readonly declared: readonly string[];\n readonly names: readonly string[];\n readonly perName: ReadonlyArray<{ readonly name: string; readonly maps: number; readonly enclosing: readonly string[] }>;\n}\n\n/** The board check's own trace line (ggui#1046). */\nexport interface BoardColumnsTrace extends BoardRead {\n readonly designMode: string;\n readonly standDown: boolean;\n readonly result: \"pass\" | \"fail\" | \"stand-down\";\n}\n\nexport function describeBoardRead(input: AxisCheckInput): BoardRead {\n // Which array the board's columns are: the contract names it; else the prompt says\n // \"board\" / \"kanban\"; else the SOURCE itself does — a JSX map over a board-shaped name\n // (ggui#1046: on candidate 20 the check flagged every stacked source locally and none on\n // the serving deployment, where the contract and prompt reach it in another shape; the\n // source is the one input every path hands over verbatim).\n const declared = boardPropNames(input.contract);\n const names = declared.length > 0\n ? declared\n : BOARD_PROMPT_RX.test(input.originalPrompt)\n ? [...BOARD_NAMES]\n : BOARD_NAMES.filter((n) => jsxMapPositions(input.sourceCode, n).length > 0);\n const perName = names.map((name) => {\n const positions = jsxMapPositions(input.sourceCode, name);\n return { name, maps: positions.length, enclosing: positions.map((pos) => enclosingLayoutTag(input.sourceCode, pos) ?? \"nothing\") };\n });\n return { declared, names, perName };\n}\n\n/** Board maps composed under something other than <Grid> / <Row>: `[propName, enclosing tag or \"nothing\"]`. */\nexport function findStackedBoardColumns(input: AxisCheckInput): Array<readonly [string, string]> {\n const stacked: Array<readonly [string, string]> = [];\n for (const { name, enclosing } of describeBoardRead(input).perName) {\n for (const tag of enclosing) if (!SIDE_BY_SIDE.has(tag)) stacked.push([name, tag]);\n }\n return stacked;\n}\n\nfunction runBoardColumnsSideBySide(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const standDown = input.designMode === \"free\";\n const stacked = standDown ? [] : findStackedBoardColumns(input);\n if (axisCheckTraceEnabled()) {\n // The check's own line beside the dispatcher's (ggui#1046): what it read, PASS and stand-down included.\n const line: BoardColumnsTrace = {\n ...describeBoardRead(input),\n designMode: input.designMode ?? \"constrained\",\n standDown,\n result: standDown ? \"stand-down\" : stacked.length > 0 ? \"fail\" : \"pass\",\n };\n console.log(JSON.stringify({ boardColumnsTrace: line }));\n }\n if (stacked.length === 0) return [];\n const [name, tag] = stacked[0]!;\n return [\n mkIssue(\n \"grid.board_columns_side_by_side\",\n `The board's \\`${name}\\` are composed under <${tag}> — a vertical stack of column sections; at md and wider the columns must sit side by side.`,\n `Wrap the ${name} map in <Grid columns={{ base: 1, md: ${name}.length }} gap=\"md\"> (each column its own <Stack> of cards); never a <Stack> of column sections.`,\n ),\n ];\n}\n\nexport const GRID_CHECKS: readonly AxisCheck[] = [\n {\n id: \"grid.board_columns_side_by_side\",\n axis: \"render\",\n values: [\"grid\"],\n run: runBoardColumnsSideBySide,\n },\n];\n","// packages/ui-gen/src/evaluation/axis-checks/extras.ts\n//\n// Axis-specific checks that had no legacy home. These fire on axis values\n// the old 3-mode dispatch didn't route (drag, swipe, compose, multi-step,\n// mixed streams). Intentionally narrow — each catches a specific failure\n// mode the fragments' prompt text tells the LLM to avoid.\n\nimport type { AxisCheck, AxisCheckInput } from \"./types.js\";\nimport type { EvalIssue } from \"../types-public.js\";\n\nfunction mkIssue(\n subcategory: string,\n description: string,\n fix: string,\n result: \"fail\" | \"warn\" = \"warn\",\n): EvalIssue {\n return { tier: 0, result, category: \"mode\", subcategory, description, fix };\n}\n\n/**\n * writeTrigger=drag → must attach onDragStart + onDrop (or onDragOver)\n * somewhere. Otherwise the drag handler is decorative.\n */\nconst dragTriggerWired: AxisCheck = {\n id: \"writeTrigger.drag.handlers_wired\",\n axis: \"writeTrigger\",\n values: [\"drag\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasStart = /onDragStart\\s*=/.test(src);\n const hasDrop = /onDrop\\s*=/.test(src);\n if (hasStart && hasDrop) return [];\n return [\n mkIssue(\n \"writeTrigger.drag.handlers_wired\",\n `Classified as writeTrigger=drag but component lacks ${!hasStart ? \"onDragStart\" : \"\"}${!hasStart && !hasDrop ? \" + \" : \"\"}${!hasDrop ? \"onDrop\" : \"\"} handlers.`,\n \"Attach onDragStart to draggable items and onDrop (with onDragOver preventDefault) to drop zones.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * writeTrigger=swipe → must wire onTouchStart + onTouchEnd. Also emit\n * a warn if no fallback click handlers exist (desktop users).\n */\nconst swipeTriggerWired: AxisCheck = {\n id: \"writeTrigger.swipe.handlers_wired\",\n axis: \"writeTrigger\",\n values: [\"swipe\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasTouch = /onTouchStart\\s*=/.test(src) && /onTouchEnd\\s*=/.test(src);\n if (!hasTouch) {\n return [\n mkIssue(\n \"writeTrigger.swipe.handlers_wired\",\n \"Classified as writeTrigger=swipe but component lacks onTouchStart + onTouchEnd handlers.\",\n \"Wire onTouchStart to record the start X/Y, onTouchEnd to classify direction and fire the action.\",\n \"fail\",\n ),\n ];\n }\n return [];\n },\n};\n\n/**\n * writes=compose → exactly one action should be called with ids sourced\n * from two different state slots. Heuristic: at least two useState or\n * props.id references should appear in the action invocation's argument\n * region.\n *\n * Light check: warn if only one id-bearing field appears near the useAction\n * invocation (hard to get false-positive free without AST).\n */\nconst composeCrossEntity: AxisCheck = {\n id: \"writes.compose.cross_entity_ids\",\n axis: \"writes\",\n values: [\"compose\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Look for an action invocation passing an object literal with >= 2\n // `*Id` or `id` keys. That's the compose signature.\n const re = /\\{\\s*[^}]*?\\b(\\w*Id|id)\\b[^}]*?,\\s*[^}]*?\\b(\\w*Id|id)\\b[^}]*?\\}/s;\n if (re.test(src)) return [];\n return [\n mkIssue(\n \"writes.compose.cross_entity_ids\",\n \"Classified as writes=compose but no action invocation passes two id-bearing keys together.\",\n \"The compose action must receive both entity ids in one payload, e.g. `schedule({ eventId, calendarId })`.\",\n \"warn\",\n ),\n ];\n },\n};\n\n/**\n * layout=multi-step → integer step state + a step-guard on Next. Re-uses\n * the form check's multi-step signal, but fires even when writes != submit\n * (e.g., multi-step wizards that never submit, like onboarding).\n */\nconst multiStepHasState: AxisCheck = {\n id: \"layout.multi_step.state_present\",\n axis: \"layout\",\n values: [\"multi-step\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n const hasIntStep = /useState(?:<number>)?\\s*\\(\\s*[0-9]+\\s*\\)/.test(src);\n if (hasIntStep) return [];\n return [\n mkIssue(\n \"layout.multi_step.state_present\",\n \"Classified as layout=multi-step but no integer-typed useState tracks the current step.\",\n \"Add `const [step, setStep] = useState(0);` and branch rendering on it.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * layout=multi-step → the design system's Stepper composite must be\n * ADOPTED (rendered). D8 (Exp 47) measured adoption at 17/18 from\n * fragment + JSDoc alone; this check gives the CHECK leg ownership of\n * the mandate so a regression surfaces as a fix turn instead of\n * silently shipping a wizard with no step affordance.\n *\n * Replaces the always-on `stepper-display-only` pitfall (deleted in the\n * same slice): with adoption carried by the WHAT leg, a 6th always-on\n * prompt rule was pure attention-dilution cost (the exp66 count-\n * sensitivity class, ~+9s blended), while this check prices at zero\n * outside multi-step cells. The pitfall's display-only guidance lives\n * on in the fix string below — delivered only when a cell actually\n * needs it.\n */\nconst stepperAdopted: AxisCheck = {\n id: \"layout.multi_step.stepper_adopted\",\n axis: \"layout\",\n values: [\"multi-step\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n // `free` design mode: the Stepper composite is optional (the prompt\n // names it as a default, not a requirement), so the adoption\n // mandate stands down. `layout.multi_step.state_present` — the\n // behavioural rule — still fires in both modes.\n if (input.designMode === \"free\") return [];\n if (/<Stepper[\\s/>]/.test(input.sourceCode)) return [];\n return [\n mkIssue(\n \"layout.multi_step.stepper_adopted\",\n \"Classified as layout=multi-step but the design system's Stepper composite is never rendered.\",\n \"Render <Stepper steps={STEPS} current={step} /> above the step body — STEPS is a top-level const array of step labels and `step` is your own useState index. Stepper is display-only: it never stores or advances the step itself.\",\n \"fail\",\n ),\n ];\n },\n};\n\n/**\n * realtime=mixed → the contract declares multiple events of different\n * kinds. Each must have its own useStream call. We approximate by\n * requiring ≥ 2 useStream calls when the vector is mixed.\n */\nconst mixedStreamsHaveHandlers: AxisCheck = {\n id: \"realtime.mixed.handlers_per_event\",\n axis: \"realtime\",\n values: [\"mixed\"],\n run(input: AxisCheckInput): EvalIssue[] {\n if (input.compiledCode === null) return [];\n const src = input.sourceCode;\n // Accept both `useStream('x')` and `useStream<T>('x')` (generic type arg).\n // The boilerplate pre-emits typed calls, so the `(` -only regex was a\n // 100%-false-positive on chat-interface + stock-ticker (Experiment 34).\n const matches = src.match(/useStream\\s*(?:<[^>]*>)?\\s*\\(/g);\n const count = matches?.length ?? 0;\n if (count >= 2) return [];\n return [\n mkIssue(\n \"realtime.mixed.handlers_per_event\",\n `Classified as realtime=mixed but only ${count} useStream call(s) found — mixed streams need one handler per event.`,\n \"Add a separate `useStream('eventName')` for each event in the contract.\",\n \"fail\",\n ),\n ];\n },\n};\n\nexport const EXTRA_CHECKS: readonly AxisCheck[] = [\n dragTriggerWired,\n swipeTriggerWired,\n composeCrossEntity,\n multiStepHasState,\n stepperAdopted,\n mixedStreamsHaveHandlers,\n];\n","// packages/ui-gen/src/evaluation/axis-checks/registry.ts\n//\n// Flat list of all axis-gated checks. The dispatcher iterates this and\n// runs every entry whose gate matches the classification's axis vector.\n\nimport type { AxisCheck } from \"./types.js\";\nimport { UNIVERSAL_CHECKS } from \"./checks/universal.js\";\nimport { STATE_MERGE_CHECKS } from \"./checks/state-merge.js\";\nimport { STATE_UI_AFFORDANCE_CHECKS } from \"./checks/state-ui-affordance.js\";\nimport { REALTIME_CHECKS } from \"./checks/realtime.js\";\nimport { WRITES_CHECKS } from \"./checks/writes.js\";\nimport { STATE_PAYLOAD_CHECKS } from \"./checks/state-payload.js\";\nimport { TOOLING_CHECKS } from \"./checks/tooling.js\";\nimport { GRID_CHECKS } from \"./checks/grid.js\";\nimport { EXTRA_CHECKS } from \"./extras.js\";\n\nexport const REGISTRY: readonly AxisCheck[] = [\n ...UNIVERSAL_CHECKS,\n ...STATE_MERGE_CHECKS,\n ...STATE_UI_AFFORDANCE_CHECKS,\n ...REALTIME_CHECKS,\n ...WRITES_CHECKS,\n ...STATE_PAYLOAD_CHECKS,\n ...TOOLING_CHECKS,\n ...GRID_CHECKS,\n ...EXTRA_CHECKS,\n];\n","// Evaluation type vocabulary shared between the harness runtime and its\n// check/evaluator surfaces. This is the narrow contract layer — the\n// type language every harness leg is written against:\n//\n// - `EvalIssue` — the single issue shape everything produces.\n// - `EvalTier` / `EvalOutcome` / `EvalCategory` — the issue's axes.\n// - `Priority` — P0/P1/P2 ranking referenced by the retry formatter.\n// - `EvalResult` — aggregate shape a runner returns.\n// - `QualityMode` / `QualityConfig` / `DEFAULT_QUALITY_CONFIG` —\n// the quality-mode knob the adapter surface consumes.\n// - `priorityForIssue` / `isBlocked` / `getActionableIssues` — the\n// purely-typed helpers over the vocabulary.\n//\n// `EvalIssue` is referenced by `PatchFn`, `TierCheck`, `LLMEvaluator`,\n// and `RuntimeRenderCheck` in the harness types hub.\n\n// ─── Priority ──────────────────────────────────────────────────────────────\n// P0 = must (compile + complete), P1 = should (safety), P2 = nice (quality).\n// Single source of truth for the retry-formatter ranking.\n\nexport type Priority = \"P0\" | \"P1\" | \"P2\";\n\nimport type { VisionFinishReason } from '../harness/llm-router.js';\nimport type { GenerationRuntimeProbeOutcome, GenerationRuntimeProbeStatus } from \"@ggui-ai/mcp-server-core\";\nimport type { CanvasClass, DesignMode } from \"../design-mode.js\";\n\n// ─── Issue shape ───────────────────────────────────────────────────────────\n\nexport type EvalTier = 0 | 1 | 2;\nexport type EvalOutcome = \"fail\" | \"warn\" | \"pass\";\n\nexport type EvalCategory =\n | \"compile\"\n | \"security\"\n | \"contract\"\n | \"types\"\n | \"imports\"\n | \"tokens\" // tier 0\n | \"mode\" // tier 0 — per-mode deterministic\n | \"functionality\"\n | \"crash\" // tier 1\n | \"interactivity\"\n | \"accessibility\"\n | \"layout\"\n | \"loading\"\n | \"visual\"; // tier 2\n\nexport interface EvalIssue {\n tier: EvalTier;\n result: EvalOutcome;\n category: EvalCategory;\n /**\n * Priority tier — threaded through to the retry formatter so the LLM can\n * rank its next patch against the prompt's P0/P1/P2 priority schema.\n * Derived from (category, result) via {@link priorityForIssue} when not\n * explicitly set. Optional on construction; check-runners typically\n * populate it before returning.\n */\n priority?: Priority;\n subcategory?: string;\n severity?: \"critical\" | \"major\";\n description: string;\n fix: string;\n line?: number;\n /**\n * The visual leg's provenance (ggui#1545): `judge` (the model's finding) or `instrument` (a deterministic\n * measurement). Absent on every other leg's issues. `visualEvaluation.actOn` acts on `judge` only.\n */\n origin?: \"judge\" | \"instrument\";\n}\n\n/**\n * Runtime-render probe execution status — four-valued so \"the probe\n * never ran\" is never conflated with \"the probe ran clean\". ONE union: the\n * same values a generation's metadata reports (`GenerationRuntimeProbeStatus`\n * in `@ggui-ai/mcp-server-core`), declared there and named here.\n *\n * - `ran` — probe executed; its findings (possibly none) are\n * in the issue stream under `runtime:*` subcategories.\n * - `infra-skipped` — probe could NOT execute (environment failure:\n * happy-dom load, user-event document capture,\n * ESM/CJS interop). Carries ZERO probe evidence;\n * consumers MUST NOT count it as a pass.\n * - `not-applicable`— nothing to probe (no compiled code, no contract\n * surface, or no runtimeRender check configured).\n * - `timed-out` — probe started but did not finish inside its\n * wall-clock bound (ggui#1299). Carries ZERO\n * evidence about the component: on a contended\n * host an ordinary component crosses the bound.\n * Consumers MUST NOT count it as a pass, and MUST\n * NOT count it as a crash either. `elapsedMs` and\n * `hostLoad` say how long it ran and how busy the\n * host was, so a reader can tell the two cases apart.\n */\nexport type RuntimeProbeStatus = GenerationRuntimeProbeStatus;\n\n/**\n * The host's 1-minute load average at a probe's start and end, beside the\n * number of CPUs the process can use (ggui#1299). A load well above\n * `cores` means the probe competed for CPU; a wall-clock bound crossed\n * there says more about the host than about the component.\n */\nexport interface ProbeHostLoad {\n readonly start: number;\n readonly end: number;\n readonly cores: number;\n}\n\n/**\n * ggui#1398 — whether the controls the probe clicked showed they were\n * working once their action was pending. Report-only: it is read by the\n * benchmark and never counted into the probe's warnings or fed back to\n * the coding loop.\n */\nexport interface ProbePendingAffordance {\n /** Controls the pending phase marked pending: those whose click dispatched their action (click or submit wiring) and that were still in the page. `visible + missing.length === dispatched`. */\n readonly dispatched: number;\n /** Of those, how many visibly changed while pending (disabled, busy, text, or replaced). */\n readonly visible: number;\n /** The actions whose control did not visibly change, including one whose card threw while pending. */\n readonly missing: readonly string[];\n /** Actions whose control was no longer in the page when its turn came (the card replaced it, or blanked after a throw): never marked, not counted as dispatched. */\n readonly gone: readonly string[];\n}\n\n/**\n * The engine's own fields on a probe's meta, beside the outcome a\n * generation's metadata reports: why a probe did not finish, its render\n * time, the host's load around it. Present on every arm of\n * {@link RuntimeProbeMeta}; each is absent when the probe had nothing to\n * say about it.\n */\nexport interface RuntimeProbeMetaDetail {\n /** Populated for `infra-skipped` / `not-applicable` / `timed-out` — why the probe didn't finish. */\n readonly reason?: string;\n /** `ran` only: the check's own render time, inside `elapsedMs`. */\n readonly renderMs?: number;\n /** Host load around the probe, when it ran isolated (absent for an in-process probe). */\n readonly hostLoad?: ProbeHostLoad;\n /** Time the check waited for a probe slot before it started, ms; present only when > 0 (ggui#1380 C2b). */\n readonly queuedMs?: number;\n /**\n * `ran` only: the pending-affordance walk (ggui#1398). Absent when no\n * action walk ran, so \"no data\" and \"0 of 0\" read differently.\n */\n readonly pendingAffordance?: ProbePendingAffordance;\n}\n\n/**\n * Probe execution meta stamped onto an `EvalResult` at the exit-decision\n * points that invoke the probe. Absence of this field means the eval\n * path never reached a probe invocation at all — consumers treat that\n * the same as not-run, never as a pass.\n *\n * ONE union with the generation metadata's probe outcome\n * (`GenerationRuntimeProbeOutcome` in `@ggui-ai/mcp-server-core`, declared\n * there and carried here with {@link RuntimeProbeMetaDetail} on every arm),\n * so the round's stamp and the metadata's record cannot say different\n * things (ggui#1380):\n *\n * - `ran` + `verdict: 'pass'` — the probe executed and no check failed;\n * - `ran` + `verdict: 'fail'` — ANY check failed; `failChecks` lists the\n * distinct check kinds that did (`RenderCheckKind`, the engine's name\n * for the same union), never empty, in the order `RENDER_CHECK_KINDS`\n * declares them, parsed from the probe's own\n * `runtime:<check>[:<subject>]` issues;\n * - `timed-out` / `infra-skipped` / `not-applicable` — no verdict, and the\n * type carries none. `elapsedMs` (on every status that reached the\n * check) and `hostLoad` say how long it ran and how busy the host was.\n *\n * The verdict and the repair trigger are two different questions. The\n * verdict is `fail` on any failing check. The one repair turn a probe-only\n * round buys fires on a `render-no-throw` fail the engine recognises\n * (`isRecoverableRenderCrash`) and on nothing else: on the PROBE-ONLY round a\n * `fail` verdict whose checks are `prop-sensitivity`, `action-wiring` or any\n * other kind is recorded here and never fed back. The same meta is stamped on\n * the EVALUATION lane, where a `prop-sensitivity` fail buys that lane's own\n * contract-feedback round (ggui#1261, `FEEDBACK_PROBE_CHECKS`) — a different\n * turn under a different rule, not the repair turn.\n */\nexport type RuntimeProbeMeta = GenerationRuntimeProbeOutcome & RuntimeProbeMetaDetail;\n\n/**\n * The one repair turn a probe-only round buys (ggui#1380). A serving\n * deployment that wires the runtime probe and configures no evaluator runs\n * the probe once after the coding turns; a render crash the engine\n * recognises buys exactly one repair turn, then one re-probe. This records\n * what came of it:\n * - `compiled: false` — the repair turn's code did not pass self-check, so\n * no re-probe ran (there is no `after`) and the pre-repair card is the\n * one served;\n * - `compiled: true` — the re-probe ran and `after` is its whole meta:\n * its status, its verdict when it ran, and the checks that still fail.\n * Whether the crash class the turn was bought for is still there is\n * `after.verdict === 'fail' && after.failChecks.includes('render-no-throw')`.\n * The two arms are exclusive by type.\n */\nexport type RuntimeProbeRepair =\n | { readonly attempted: true; readonly compiled: false; readonly trigger?: never }\n | { readonly attempted: true; readonly compiled: true; readonly trigger: RuntimeProbeMeta };\n\n/**\n * Per-criterion execution status — three-valued so \"the criterion\n * silently produced no verdict\" is never conflated with \"the criterion\n * ran clean\", and neither is conflated with \"not evaluated by design\".\n * Same doctrine and vocabulary family as `RuntimeProbeStatus` above.\n *\n * - `ran` — the LLM call completed and returned a verdict\n * for this criterion; its findings (possibly\n * none) are in `issues`.\n * - `skipped` — the call errored or returned no tool call. The\n * criterion carries ZERO evidence; the evaluator\n * fail-opens it into `pass` to avoid blocking\n * generation on flaky LLM calls, so consumers\n * MUST consult this field before treating `pass`\n * membership as a verdict. Counts AGAINST\n * coverage.\n * - `not-applicable` — the evaluator was bypassed by design for this\n * cell (e.g. the same-image low-risk bypass:\n * axis checks clean, tier-1/2 never invoked).\n * `reason` names the bypass. Excluded from\n * coverage denominators — it is neither evidence\n * nor a silent absence.\n */\nexport type CriterionRunStatus = \"ran\" | \"skipped\" | \"not-applicable\";\n\n/** Coverage row for one evaluation criterion of one eval run. */\nexport interface CriterionCoverage {\n readonly criterion: string;\n readonly tier: 1 | 2;\n readonly status: CriterionRunStatus;\n /** Populated for `skipped` / `not-applicable` — why no verdict. */\n readonly reason?: string;\n}\n\n/**\n * Coverage of the screenshot JUDGE leg for one eval round (ggui#1221) — a\n * different surface from the `visual` CRITERION in `criteriaCoverage` (the\n * LLM evaluator's read of the source). `ran` = a frame was captured and\n * judged; `skipped` = the leg was configured but produced no verdict\n * (no browser, a launch or in-page failure, an unbundlable component, an\n * unparsable judge answer) with `reason` naming why; `not-applicable` =\n * the round had no visual leg configured. Before this row a skipped leg\n * left NO trace on the result — `{ issues: [] }` read exactly like a\n * clean run, and every bootstrap mint on a browserless runtime \"passed\"\n * its visual round that way.\n */\nexport interface VisualCoverage {\n readonly status: CriterionRunStatus;\n /** Populated for `skipped` / `not-applicable` — why no verdict. */\n readonly reason?: string;\n}\n\n/**\n * The static criteria `runLLMEvaluation` runs, in stamp order — the\n * ONE list both the evaluator's coverage stamp and the harness's\n * bypass stamp derive from, so the two can never disagree on the set.\n * Tier 1 = binary pass/fail gates; tier 2 = fail/warn/pass quality.\n */\nexport const LLM_EVAL_STATIC_CRITERIA: ReadonlyArray<{ readonly criterion: string; readonly tier: 1 | 2 }> = [\n { criterion: \"functionality\", tier: 1 },\n { criterion: \"crash\", tier: 1 },\n { criterion: \"interactivity\", tier: 2 },\n { criterion: \"accessibility\", tier: 2 },\n { criterion: \"layout\", tier: 2 },\n { criterion: \"loading\", tier: 2 },\n { criterion: \"visual\", tier: 2 },\n];\n\n/**\n * Coverage rows for a cell where the evaluator was BYPASSED BY DESIGN\n * (never invoked) — one `not-applicable` row per static criterion, all\n * carrying `reason`. Harness exits that skip tier-1/2 evaluation stamp\n * this so the cell is neither a silent absence (field missing) nor\n * evidence. Same shape contract as `runLLMEvaluation`'s stamp: always\n * every criterion. Lives here (not in llm-evaluator) because the bypass\n * exit runs before the evaluator module is lazily loaded.\n */\nexport function notApplicableCoverage(reason: string): CriterionCoverage[] {\n return LLM_EVAL_STATIC_CRITERIA.map(({ criterion, tier }) => ({\n criterion,\n tier,\n status: \"not-applicable\",\n reason,\n }));\n}\n\n/** One contract-feedback round (ggui#1261): what bought it, and the source it was fed back on. */\nexport interface ContractFeedbackRecord {\n /** The exit-probe issue subcategories that bought the round, e.g. `runtime:prop-sensitivity:currentUser`. */\n readonly firedOn: readonly string[];\n /** The component source as it stood when the model was told — the round's BEFORE. */\n readonly sourceBefore: string;\n}\n\nexport interface EvalResult {\n issues: EvalIssue[];\n pass: string[];\n /**\n * Per-criterion coverage for this eval run — one row per static\n * criterion, ALWAYS all of them when present. Stamped by\n * `runLLMEvaluation` (`ran` / `skipped`) and by the harness on\n * evaluator-bypass exits (`not-applicable` + reason). The harness\n * carries it unchanged through every later re-stamp of this result.\n * Absent = coverage UNKNOWN (paths that predate the instrument, e.g.\n * `parseEvalResponse` replays) — never assume `ran`, never assume\n * bypass.\n */\n criteriaCoverage?: CriterionCoverage[];\n /**\n * Runtime-render probe execution meta. Stamped by the exit-decision\n * probe runner; absent on eval paths that never invoke the probe.\n */\n runtimeProbe?: RuntimeProbeMeta;\n /**\n * The probe-only round's repair record (ggui#1380) — present only when a\n * recoverable render crash bought the one repair turn. See\n * {@link RuntimeProbeRepair}. `runtimeProbe` beside it is the re-probe's\n * verdict when the repair compiled, else the pre-repair probe's.\n */\n runtimeProbeRepair?: RuntimeProbeRepair;\n /**\n * The contract-feedback round, when one fired this generation (ggui#1261):\n * which exit-probe findings bought it and the source as it stood when the\n * model was told. `runtimeProbe` and the `runtime:*` issues on this result\n * are the probe's verdict AFTER that round; `sourceBefore` beside the final\n * source is the round's before/after. Absent when no such round fired.\n */\n contractFeedback?: ContractFeedbackRecord;\n /**\n * Per-canvas visual verdicts. Stamped by the harness ONLY when the\n * visual leg ran with `visualEvaluation.canvases` set (arm-neutral —\n * the same judge in every design mode); absent on the single-shot\n * visual path and whenever the visual leg did not run. PNGs stay on\n * `runVisualEvaluation`'s own result (`VisualEvaluationResult.canvases[*].screenshotPng`),\n * never here — this object is serialized into reports.\n */\n visual?: VisualEvalSummary;\n /**\n * Whether the screenshot judge leg ran, was skipped (with the reason) or\n * was not configured — ALWAYS stamped by the harness's eval round\n * (ggui#1221), so a consumer can tell a clean visual run from a leg\n * that silently could not run. See {@link VisualCoverage}.\n */\n visualCoverage?: VisualCoverage;\n}\n\n/** One canvas's visual verdict, PNG-free — see `EvalResult.visual`. */\n/**\n * How one canvas's `score` was reached (ggui#1072): `k` vision calls on the\n * SAME captured frame, aggregated by `rule`. Always present — `k: 1` ⇒\n * `samples: [score]`, `sigma: 0`, `notes: [critique]` — so one shape serves\n * a single judgement and a median of many. `samples`/`notes` carry only the\n * calls the judge could parse (in call order); `k` stays the requested count,\n * so a short `samples` is visible on the row rather than filled in.\n */\nexport interface CanvasJudgeRecord {\n readonly k: number;\n readonly rule: 'median';\n readonly samples: number[];\n /** Population σ of `samples` (0 when one sample). */\n readonly sigma: number;\n /** The judge's per-canvas critique per sample — the words beside a swing. */\n readonly notes: string[];\n /**\n * ggui#1127 — the cause of each scoring sample whose answer failed to parse and was SALVAGED: its four dimensions\n * were recovered from the closed prefix, its issues kept only as far as they closed, its critique lost. One entry\n * per salvaged sample; absent when every sample parsed. The salvaged sample's score still counts.\n */\n readonly salvaged?: readonly JudgeSalvageCause[];\n /**\n * ggui#1127 — the criteria call's answer was salvaged. A salvage keeps no criteria, so that frame's judge rows read\n * \"not answered\" with this cause rather than a clean `n/a`. Absent when the call parsed or was not asked.\n */\n readonly criteriaSalvaged?: JudgeSalvageCause;\n /**\n * ggui#1687 — the model asked for, and every model the provider said answered this canvas's calls (scoring and\n * criteria), deduplicated. `served` is empty when no provider named one: unknown, never \"the requested model\".\n * When the request names an alias and the provider echoes the alias (measured on a hosted route, 125 of 125\n * canvases), `served` confirms the alias was honoured but cannot tell two snapshots behind it apart. A judge that\n * must is pinned to a dated snapshot id instead. With the alias, a snapshot change shows only as a step on a date in\n * the judge's pooled within-call spread, read by week. That is a read someone runs, not a monitor.\n */\n readonly models?: { readonly requested: string; readonly served: readonly string[] };\n}\n\n/**\n * ggui#1687 — what the criteria call's answer held, before resolution. A row the judge left unanswered reads `n/a`\n * either way; this says whether the call came back empty, cut, or with entries the parser had to drop.\n */\nexport interface CriteriaAnswerCounts {\n /** The answer carried a `criteria` array. `false`: absent or not an array, so no row was read from it. */\n readonly array: boolean;\n /** Entries in the array. */\n readonly received: number;\n /** Entries kept: an object with a string id and a verdict of pass, fail or n/a. */\n readonly kept: number;\n /** Entries dropped, by why. */\n readonly dropped: { readonly notObject: number; readonly badId: number; readonly badVerdict: number };\n}\n\n/**\n * ggui#1127 — why a judge answer that failed to parse had to be salvaged. `output-cap`: the provider reported it\n * stopped at the output cap. `malformed`: the provider reported a normal stop, so the answer ended but did not\n * parse. `stopped`: the provider stopped it for another reason it named (a safety stop, or one it reports as\n * other), so it is cut, not malformed. `unknown`: the provider or route reported no stop reason. Never inferred\n * from the answer's length.\n */\nexport type JudgeSalvageCause = \"output-cap\" | \"malformed\" | \"stopped\" | \"unknown\";\n\n/** ggui#1127 — salvaged judge answers across a canvas run, per leg, as N of M. */\nexport interface JudgeSalvageCounts {\n /** Scoring answers: `answers` = samples that parsed or were salvaged, `salvaged` = those salvaged. */\n readonly scoring: { readonly salvaged: number; readonly answers: number };\n /** Criteria calls: `answered` = calls that parsed or were salvaged, `salvaged` = those salvaged (criteria lost). */\n readonly criteria: { readonly salvaged: number; readonly answered: number };\n}\n\n// ─── Visual criteria (ggui#1436) ──────────────────────────────────────────\n// The judge's typed criteria block per canvas — report-only beside the score\n// until a later word flips a gate to it. Every field below is optional on the\n// stamps so yesterday's `eval.json` and an old judge answer still parse (N−1).\nimport type { FetchShape, LayoutShape, RenderShape, RiskTier, StateShape, WriteShape } from \"../classifier/axes.js\";\n\nexport type CriteriaSeverity = \"must\" | \"should\";\nexport type CriteriaVerdict = \"pass\" | \"fail\" | \"n/a\";\n/** The method that produces a verdict: an instrument's measurement, the vision judge off the frame, or a person's eye. */\nexport type CriteriaMethod = \"instrument\" | \"judge\" | \"human\";\n/** The method's readiness, as the bank's author wrote it — the only source of an `n/a` that is not the judge's own. */\nexport type CriteriaStatus = \"live\" | \"reference\" | \"planned\" | \"manual\";\n/**\n * How a criterion entered the selection: bank-level (`static`, an empty scope) or by the selector's\n * rules for this card (`context`). A model PROPOSING a criterion at judge time is RESERVED and not a\n * member until a consumer exists — it would be `should`-only, recorded verbatim, never a gate.\n */\nexport type CriteriaSource = \"static\" | \"context\";\nexport type CriteriaChroma = \"achromatic\" | \"chromatic\" | \"unknown\";\n/** The classifier's shape axes, as hashed into the set id. */\nexport interface CriteriaAxes {\n render: RenderShape;\n state: StateShape;\n writes: WriteShape;\n fetch: FetchShape;\n layout: LayoutShape;\n}\n/** The selector's inputs, stored with the verdict so a reader recomputes `criteriaSetId` from the record alone. */\nexport interface CriteriaContext {\n canvas: CanvasClass;\n hasActions: boolean;\n riskTier: RiskTier;\n axes: CriteriaAxes;\n chroma: CriteriaChroma;\n profilePresent: boolean;\n /** The harness's shell as named; `unknown` when the round carries none. */\n shell: string;\n /** The caller's item kind (a bootstrap mint's `hello`); hashed when present. */\n kind?: string;\n /** The styling preset in force (the profile's aesthetic id); a recipe is selected only under its preset. */\n preset?: string;\n}\n/** What was asked and why — recorded BEFORE the judge runs. Omission is the selector's decision. */\nexport interface CriteriaSelection {\n id: string;\n source: CriteriaSource;\n reason: string;\n}\n/** One criterion's verdict; `n/a` is the judge's answer (\"cannot read this off the frame\"), an unanswered id, a tie, or a method whose `status` is not live. */\nexport interface CriterionVerdict {\n id: string;\n severity: CriteriaSeverity;\n method: CriteriaMethod;\n status: CriteriaStatus;\n source: CriteriaSource;\n verdict: CriteriaVerdict;\n evidence: string;\n /**\n * ggui#1663 — a measured reading beside a judge row, REPORT-ONLY: the row's `verdict` stays the judge's, so this\n * changes no verdict, score or bar. Present only on rows an instrument answers beside the judge (`space.edge`).\n */\n instrument?: { verdict: CriteriaVerdict; evidence: string };\n}\n/** ggui#1687 — the criteria call as it came back: its answer's counts, ids it answered outside the bank, its stop. */\nexport interface CriteriaCallRecord {\n readonly answer: CriteriaAnswerCounts;\n /** Kept entries whose id names no row of the bank. */\n readonly unknownIds: number;\n /** The provider's normalized stop reason (`length` = the output cap); absent when it reported none. */\n readonly finishReason?: VisionFinishReason;\n}\nexport interface CriteriaBlock {\n /** sha256(bank version | selector version | canonical context), 16 hex — the block's own digest. */\n criteriaSetId: string;\n bankVersion: string;\n selectorVersion: string;\n context: CriteriaContext;\n selection: CriteriaSelection[];\n verdicts: CriterionVerdict[];\n /** ggui#1687 — the call that answered this block, when one did. Absent for a block resolved with no call. */\n call?: CriteriaCallRecord;\n}\n/** The roll-up across canvases; a `must` at `n/a` is listed, never counted as a pass. */\nexport interface CriteriaRollup {\n mustFailed: string[];\n shouldFailed: string[];\n mustNa: string[];\n}\n\n/** ggui#1492 — a host\"s frame round the inline card, as data. Colours are `#rrggbb`; the ring\"s `alpha` is 0..1. */\nexport interface HostInlineFrame {\n /** The frame\"s surface — what shows behind a transparent card, and under the floor\"s residual. */\n readonly surface: string;\n /** The room the frame sits in (the page ground round it). */\n readonly ground: string;\n readonly ring: { readonly widthPx: number; readonly color: string; readonly alpha: number };\n readonly radiusPx: number;\n /** The host\"s minimum frame height: a card shorter than it sits in a frame this tall, and the visitor sees the rest as void. */\n readonly minHeightPx?: number;\n}\n/** ggui#1492 — how a host presents one canvas: the label the judge is told, the page ground, and (the inline card only) its frame. */\nexport interface CanvasHostPresentation {\n readonly label: string;\n /** The page ground under a fill canvas\"s panel; the inline card\"s ground lives on its {@link HostInlineFrame}. */\n readonly ground?: string;\n readonly frame?: HostInlineFrame;\n}\n/** ggui#1492 — why the judge did not draw a canvas's host presentation. The codes are the lane reader's own. */\nexport type HostPresentationIgnoredReason = \"label_missing\" | \"color_not_hex\" | \"frame_off_inline\" | \"frame_malformed\" | \"ground_on_inline\";\n/**\n * ggui#1492 — what the judge DID with a canvas's host presentation, read from the judge itself: `applied` carries\n * the presentation it drew, `ignored` the reason it drew none. Absent when the caller supplied no presentation.\n */\nexport type CanvasPresentationOutcome =\n | { readonly status: \"applied\"; readonly applied: CanvasHostPresentation }\n | { readonly status: \"ignored\"; readonly reason: HostPresentationIgnoredReason };\n\nexport interface CanvasVisualSummary {\n canvas: CanvasClass;\n viewport: { width: number; height: number };\n /** The judge's weighted score at this canvas (0-100). */\n score: number;\n /** `score >= passThreshold`, and on the inline card: no overflow (ggui#1027). */\n passed: boolean;\n /** The document's scroll height at this canvas, CSS px; `null` when unmeasurable (ggui#1027). */\n contentHeight: number | null;\n /** `contentHeight > viewport.height` — measured on every canvas, judged per `canvasFitPolicy`. */\n overflow: boolean;\n /**\n * ggui#1120 — how far down the capture anything was painted: the last inked row over the measured\n * region's height (inside a drawn host panel's chrome on md/lg/xl), read from the screenshot's\n * pixels against their dominant colour. `0` is the blank the judge fails (`canvas-blank`); every\n * other value is reported, never scored. `null` when the capture could not be read.\n */\n inkRatio: number | null;\n /** How `score` was reached — always present (ggui#1072). */\n judge: CanvasJudgeRecord;\n /** ggui#1436 — the typed criteria block, when a bank was configured; report-only. */\n criteria?: CriteriaBlock;\n /** ggui#1492 — what the judge did with this canvas's host presentation, when one was supplied. */\n presentation?: CanvasPresentationOutcome;\n /**\n * How the judge composed the mount (ggui#1100): `'fill'` on every\n * fullscreen canvas — the served runtime's fit, the root stretched to\n * the frame; absent on the inline card, which keeps its natural height.\n */\n fit?: 'fill';\n}\n\n/**\n * ggui#1195 — the fit reading on the canvas whose policy FAILS an overflow\n * (the inline chat card): the box it was judged at (`ceiling` — the order's\n * declared viewport when one was carried, else the class box), whether that\n * box was declared, and how many px of content sit below it (0 = fits).\n * Present only when such a canvas was judged with a measurable height, so\n * the bar and the ledger read one number for \"does the hello fit\".\n */\nexport interface VisualFitStamp {\n readonly canvas: CanvasClass;\n readonly ceiling: { readonly width: number; readonly height: number };\n readonly declared: boolean;\n readonly overflowPx: number;\n}\n\n/** The visual leg's per-canvas summary — see `EvalResult.visual`. */\nexport interface VisualEvalSummary {\n /** Mean of the canvas scores (rounded). */\n score: number;\n /** Every canvas passed. */\n passed: boolean;\n canvases: CanvasVisualSummary[];\n /** ggui#1195 — see {@link VisualFitStamp}; absent when no fail-policy canvas was judged. */\n fit?: VisualFitStamp;\n /** The design tree the judge painted with (ggui#1042): `src` + `srcSha256` — `design@judge`. */\n design?: { readonly src: string; readonly srcSha256: string };\n /** The mode the judge's tokens were composed in, when the caller said (ggui#1076). */\n themeMode?: 'light' | 'dark';\n /** ggui#1436 — the criteria roll-up across canvases, when any canvas carries a block; report-only. */\n criteria?: CriteriaRollup;\n}\n\n// ─── Quality mode ──────────────────────────────────────────────────────────\n\nexport type QualityMode = \"fast\" | \"auto-improve\" | \"high-quality\";\n\nexport interface QualityConfig {\n quality: QualityMode;\n visualEval: boolean;\n maxCostPerGeneration: number;\n model?: { provider?: string; model?: string };\n}\n\nexport const DEFAULT_QUALITY_CONFIG: QualityConfig = {\n quality: \"fast\",\n visualEval: false,\n maxCostPerGeneration: 3,\n};\n\n// ─── Axis-check types ──────────────────────────────────────────────────────\n// The `AxisCheck` type vocabulary lives here. The check bodies\n// themselves (REGISTRY, per-axis implementations) live under\n// `./axis-checks/`.\n\nimport type { DataContract } from \"@ggui-ai/protocol\";\nimport type { JsonObject } from \"@ggui-ai/protocol\";\nimport type { AxisVector, Classification } from \"../classifier/axes.js\";\nimport type { AxisKey } from \"../fragments/index.js\";\n\nexport interface AxisCheckInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n /** Full classification — checks may read sibling axes. */\n classification: Classification;\n /**\n * Which triad produced the source. Checks that assert a design-package\n * component (e.g. `layout.multi_step.stepper_adopted`) read it and\n * stand down in `free` mode, where the primitive is optional. Absent\n * means `constrained`.\n */\n designMode?: DesignMode;\n /**\n * The rendering canvas the source is judged FOR (ggui#1117). A width cap on\n * the outermost element is a defect on a fullscreen canvas and a no-op in a\n * chat bubble, so a check that reads width must know the surface. Populated\n * where the harness is built (`Harness.canvas`); ABSENT for callers with no\n * rendering context — a check handles `undefined`, it never assumes a\n * default (a silent `lg` would be the same guess with a nicer face).\n */\n canvas?: CanvasClass;\n /**\n * The props the probe and the judge RENDERED the source with (ggui#1285) — a bootstrap order's\n * `sampleProps`, the bench commit's fixture. They are judging data, not the request: a literal in\n * the source that equals one of these values, and that the request never stated, is baked copy a\n * visitor sees whenever the agent leaves the prop out. Populated on the served loop and at\n * auto-commit; ABSENT where the caller has none — the check stands down, it never guesses.\n */\n fixtureProps?: JsonObject;\n}\n\n/**\n * A gated check. Runs only when the classification's axis value matches\n * one of the gate's accepted values. Multiple gates (implicit AND) support\n * cross-axis combinations.\n */\nexport interface AxisCheck {\n /** Stable id used in issue subcategories. */\n id: string;\n /** Primary axis this check gates on. */\n axis: AxisKey;\n /** Which values of that axis activate the check. */\n values: readonly string[];\n /** Optional extra gate on a sibling axis (e.g., only when state=merge AND writes=per-item). */\n and?: { axis: AxisKey; values: readonly string[] };\n /** Execute the check and emit zero or more issues. */\n run(input: AxisCheckInput): EvalIssue[];\n}\n\n/**\n * Whether a check's gate(s) match the given axis vector. Pure function,\n * no issue emission.\n */\nexport function matches(vector: AxisVector, check: AxisCheck): boolean {\n const primary = vector[check.axis] as string;\n if (!check.values.includes(primary)) return false;\n if (check.and) {\n const sibling = vector[check.and.axis] as string;\n if (!check.and.values.includes(sibling)) return false;\n }\n return true;\n}\n\n// ─── Purely-typed helpers ──────────────────────────────────────────────────\n\n/**\n * Map a tier-0 issue category to the canonical P0/P1/P2 priority.\n *\n * Sourced from the criteria priority assignments:\n * - P0 (must): compile, security, imports, contract, types, mode\n * - P1 (safety): tokens, crash, functionality\n * - P2 (quality): interactivity, accessibility, layout, loading, visual\n */\nexport function priorityForIssue(category: EvalCategory): Priority {\n if (\n category === \"interactivity\" ||\n category === \"accessibility\" ||\n category === \"layout\" ||\n category === \"loading\" ||\n category === \"visual\"\n ) {\n return \"P2\";\n }\n if (category === \"tokens\" || category === \"crash\" || category === \"functionality\") {\n return \"P1\";\n }\n // compile, security, imports, contract, types, mode → P0.\n return \"P0\";\n}\n\n/** Whether any issue blocks shipping (has result = 'fail'). */\nexport function isBlocked(result: EvalResult): boolean {\n return result.issues.some((i) => i.result === \"fail\");\n}\n\n/**\n * Return the issues the agent should act on, depending on quality mode.\n * - fast: only fails (blocking issues)\n * - auto-improve / high-quality: fails + warns\n */\nexport function getActionableIssues(result: EvalResult, mode: QualityMode): EvalIssue[] {\n if (mode === \"fast\") {\n return result.issues.filter((i) => i.result === \"fail\");\n }\n return result.issues.filter((i) => i.result === \"fail\" || i.result === \"warn\");\n}\n\n// ─── Criteria (single source of truth for coding + eval sides) ─────────────\n//\n// Each criterion is defined ONCE with both sides of the contract:\n// - codingGuidance: what the coding agent should DO\n// - evalInstruction: what the eval agent should CHECK\n// They must be compatible — changing one means reviewing the other.\n//\n// This is *validated* shipping content: it's what the hosted runtime sends\n// to every generation today. External OSS implementers building their own\n// prompts should be able to use the same rubric — hence it's open.\n\nexport interface EvalCriterion {\n /** Unique identifier matching the eval tool name (e.g., 'functionality') */\n id: string;\n /** Human-readable name shown to both agents */\n name: string;\n /** Priority tier — P0 must, P1 should, P2 nice */\n priority: Priority;\n /** What the coding agent should DO to satisfy this criterion */\n codingGuidance: string;\n /** What the eval agent should CHECK — the evaluation prompt */\n evalInstruction: string;\n /** Tier 0 = programmatic, Tier 1 = LLM critical, Tier 2 = LLM quality */\n tier: 0 | 1 | 2;\n /** Eval outcome when this criterion fails */\n failOutcome: \"fail\" | \"warn\";\n}\n\nexport const CRITERIA: readonly EvalCriterion[] = [\n // ── P0: Correctness (must satisfy — failure = broken component) ──\n\n {\n id: \"compile\",\n name: \"Compile & type-check\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance:\n \"Code must compile. The typed Props and wire hook generics are enforced by the compiler.\",\n evalInstruction: \"Checked automatically by esbuild + TypeScript. No LLM evaluation needed.\",\n },\n {\n id: \"render-props\",\n name: \"Render all Props fields\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance: \"Render every Props field in JSX. Access via props.fieldName.\",\n evalInstruction:\n \"Check that every field from interface Props appears as props.fieldName in the function body.\",\n },\n {\n id: \"wire-hooks\",\n name: \"Wire all contract hooks\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Wire every useAction/useStream and every clientCapabilities.gadgets hook (e.g., useGeolocation) to a UI element. `agentCapabilities.tools` is a catalog the AGENT invokes — NOT a component hook surface.\",\n evalInstruction:\n \"Check that every hook variable from the boilerplate appears in the JSX or an effect.\",\n },\n {\n id: \"imports\",\n name: \"Valid imports only\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance: \"Only import from react, @ggui-ai/design/*, and @ggui-ai/wire.\",\n evalInstruction: \"Flag any import from a package not in the allowlist.\",\n },\n {\n id: \"security\",\n name: \"No eval/fetch/window\",\n priority: \"P0\",\n tier: 0,\n failOutcome: \"fail\",\n codingGuidance: \"Never use eval(), fetch(), or window. Data comes from props and hooks.\",\n evalInstruction: \"Flag any call to eval(), fetch(), or window access.\",\n },\n\n // ── P1: Safety (should satisfy — failure = crash or bad UX) ──\n\n {\n id: \"functionality\",\n name: \"All features implemented\",\n priority: \"P1\",\n tier: 1,\n failOutcome: \"fail\",\n codingGuidance: \"Implement ALL features from the request AND the data contract.\",\n evalInstruction: `Evaluate FUNCTIONALITY: Does this component implement ALL features from the request AND the data contract?\n\nCheck against BOTH sources:\n1. Original request — each feature must be coded AND rendered in JSX\n2. Data contract (if present) — verify:\n - Props fields are rendered in the UI. EXCEPTION: pure identifier fields (\\`id\\`, \\`*Id\\`, keys) that exist only to be echoed back inside an action payload do NOT need to be visibly rendered.\n - ALL useAction hooks are wired to clickable UI elements\n - ALL useStream hooks are consumed — the streamed data must reach the UI. Merging stream events into rendered state (a list, a counter, the displayed records) COUNTS as consuming the stream; it need not be a literal \\`.latest\\` render.\n - ALL clientCapabilities gadgets are used. \\`clientCapabilities.gadgets\\` is keyed by npm package: built-in browser capabilities (useGeolocation / useCamera / …) import from @ggui-ai/gadgets; registered third-party gadgets (e.g. useChartTheme) import from their OWN package. Any gadget the contract declares IS a contract feature — NEVER flag it as \"not part of the contract\".\n - \\`agentCapabilities.tools\\` is a catalog declaration only; do NOT flag missing component-side calls for it\n\nA contract hook that is declared but never used at all is a MISSING feature.\n\nCRITICAL: The \"issues\" array must ONLY contain features you are CERTAIN are missing or broken — never an implemented feature. (See \"Issue-array discipline\" above: no speculative, self-negating, or \"verify that…\" entries.)`,\n },\n {\n id: \"crash\",\n name: \"No crash scenarios\",\n priority: \"P1\",\n tier: 1,\n failOutcome: \"fail\",\n codingGuidance:\n \"Guard optional props (props.field?.x). stream.latest is T|null — always null-guard. .all is always an array.\",\n evalInstruction: `Evaluate CRASH SAFETY: Are there ACTUAL runtime crash scenarios?\n\nWILL crash (include in issues):\n- .map()/.filter()/.length on an uninitialized variable\n- Accessing property of undefined without guard\n- useStream().latest.field WITHOUT null guard — .latest is T | null\n- Optional Props field accessed as props.field.x without guard\n- Array item optional field: items.map(item => item.priority.toUpperCase()) when priority is optional\n\nSAFE (do NOT include):\n- Optional chaining: props.items?.map() — SAFE\n- Fallback: items || [] — SAFE\n- useState initializer: useState([]) — SAFE\n- Null check: items && items.map() — SAFE\n- stream.latest && stream.latest.field — SAFE, guarded\n- stream.all.map(...) — SAFE, .all is always an array\n- stream.all.length — SAFE, always a number\n\nThe \"issues\" array is ONLY for a specific line that WILL throw at runtime. NEVER put a line you have determined is safe into the issues array — not even to note that it is safe (\"…so this is safely guarded\", \"…so there is no crash\"). If you cannot name a concrete line that will throw, the answer is {\"pass\": true} — return that and an empty issues array.`,\n },\n {\n id: \"tokens\",\n name: \"Design system tokens\",\n priority: \"P1\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Use CSS variables for colors (var(--ggui-color-*)); use the spacing scale for gap/padding/margin (gap=\\\"md\\\", padding=\\\"lg\\\").\",\n evalInstruction:\n \"Flag hardcoded hex colors, rgba/hsl functions, and numeric or raw-CSS-length spacing props. A t-shirt-scale spacing name (gap=\\\"md\\\") IS a token — never flag it.\",\n },\n\n // ── P2: Quality (nice to have — failure = lower score, not broken) ──\n\n {\n id: \"interactivity\",\n name: \"Sufficient interactive elements\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Add appropriate interactive elements for the component purpose.\",\n evalInstruction: `Evaluate INTERACTIVITY: Does this component have sufficient interactive elements?\n\nConsider: forms need submit buttons, lists need selection, editable content needs save/cancel.\nContract actions (if present): every useAction hook should be triggered by a visible UI element.\n\nOnly list MISSING interactive elements. Use 'fail' only for issues blocking core purpose.`,\n },\n {\n id: \"accessibility\",\n name: \"Accessible markup\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance:\n \"Add labels on form inputs, alt text on images, semantic HTML, and state ARIA (aria-checked/pressed/selected/expanded) on hand-rolled interactive controls.\",\n evalInstruction: `Evaluate ACCESSIBILITY: missing labels, alt text, semantic HTML, keyboard support, ARIA state.\n\nggui primitives bake in their own ARIA — see \"Primitive Accessibility\" in the Design System context above. NEVER flag a ggui primitive (Input/Select/TextArea, RadioGroup, Checkbox, Toggle, Progress, Slider, Spinner, Skeleton, Tabs, Accordion, Alert, Toast, Tooltip, Clickable, Icon) for a missing role / aria-* / label / keyboard handler — it is already there and not visible in the source you are reading.\n\nFlag ONLY real gaps: a raw div/span used as an interactive control; a hand-rolled control whose checked/selected/expanded/pressed state is conveyed only by styling (strikethrough, color, a check icon) with no \\`aria-checked\\` / \\`aria-pressed\\` / \\`aria-selected\\` / \\`aria-expanded\\`; an image with no alt text; an Input/Select/TextArea with no \\`label\\` prop; an icon-only Button with no aria-label; live/streaming data not wrapped in an aria-live region; inverted heading hierarchy.\n\nOnly list MISSING accessibility features. Use 'fail' only if it blocks delivery.`,\n },\n {\n id: \"layout\",\n name: \"Clean layout\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Use proper spacing and visual grouping.\",\n evalInstruction: `Evaluate LAYOUT: Check spacing, alignment, visual grouping, and composition.\n\nOnly list ACTUAL layout problems. Use 'fail' only for fundamentally broken layouts.`,\n },\n {\n id: \"loading\",\n name: \"Loading/empty/error states\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Handle async data, empty collections, and error cases.\",\n evalInstruction: `Evaluate LOADING/EMPTY/ERROR STATES: Does the component handle async data and edge cases?\n\nContract-specific: useStream should handle pre-data state. clientCapabilities hooks may return undefined / permission-denied — defensive guards expected before threading values into JSX.\nProps-only components (no async, no streams, no client capabilities) do NOT need loading states — return pass.\n\nOnly list MISSING states.`,\n },\n {\n id: \"visual\",\n name: \"Design system consistency\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance: \"Use design system tokens consistently.\",\n evalInstruction: `Evaluate VISUAL CONSISTENCY: Is the component using the design system correctly?\n\nFlag: hardcoded colors instead of CSS variables, numeric or raw-CSS-length spacing instead of the t-shirt scale, style objects bypassing design system.\nA t-shirt-scale spacing name (gap=\"md\", padding=\"lg\") IS correct token usage — never flag it.\nIntentional custom colors (status indicators) are acceptable when no semantic token fits.\n\nOnly list ACTUAL violations. Use 'fail' only for pervasive violations.`,\n },\n] as const;\n\n/**\n * `designMode: 'free'` overrides — ONLY the two criteria whose text\n * encodes the design vocabulary. `tokens` narrows to COLOR (the free arm\n * relaxes spacing / typography / radius / shadow to literals but keeps\n * brand-bearing color on the closed `--ggui-color-*` manifest, no\n * fallbacks); `visual` becomes arm-neutral (composition, hierarchy,\n * consistency, fit to canvas — no reward or penalty for design-system\n * usage). Every other criterion is shared verbatim between the modes.\n * Constraint alignment: what the free prompt says, the free evaluator\n * checks — and nothing more.\n */\nconst FREE_DESIGN_CRITERIA_OVERRIDES: readonly EvalCriterion[] = [\n {\n id: \"tokens\",\n name: \"Color tokens\",\n priority: \"P1\",\n tier: 0,\n failOutcome: \"warn\",\n codingGuidance:\n \"Every color is a bare var(--ggui-color-*) from the token manifest — no hex, rgb()/hsl(), CSS named colors or literal fallbacks, in style props and <style> blocks alike. Spacing, typography, radius and shadow geometry may be literals.\",\n evalInstruction:\n \"Flag hardcoded hex colors, rgba/hsl functions, CSS named colors, and literal fallbacks inside var(--ggui-*) references. Do NOT flag literal spacing, font sizes, radii or pixel values — they are allowed in this mode.\",\n },\n {\n id: \"visual\",\n name: \"Visual composition\",\n priority: \"P2\",\n tier: 2,\n failOutcome: \"warn\",\n codingGuidance:\n \"Compose deliberately: one clear focal point, consistent spacing rhythm, a coherent theme-token palette, a fit to the rendering canvas.\",\n evalInstruction: `Evaluate VISUAL COMPOSITION: Is the component composed deliberately for its canvas?\n\nJudge: visual hierarchy (one clear focal point, headings distinct from body text), consistent spacing rhythm and alignment, a coherent palette drawn from the theme tokens, fit to the canvas (fluid width, no fixed widths, nothing cramped or stretched).\nDo NOT reward or penalise the use of design-system primitives — raw HTML with inline CSS is a first-class choice here. Literal spacing / typography / radius values are fine.\n\nOnly list ACTUAL composition problems. Use 'fail' only for a fundamentally incoherent composition.`,\n },\n];\n\n/**\n * The criteria registry for a design mode. `constrained` IS `CRITERIA`\n * (same array, byte-identical summary); `free` swaps in the two\n * overrides above by id, preserving order.\n */\nexport function criteriaFor(designMode: DesignMode = \"constrained\"): readonly EvalCriterion[] {\n if (designMode === \"constrained\") return CRITERIA;\n return CRITERIA.map(\n (c) => FREE_DESIGN_CRITERIA_OVERRIDES.find((o) => o.id === c.id) ?? c,\n );\n}\n\n/** Get all criteria for a specific priority level */\nexport function getCriteriaByPriority(\n priority: Priority,\n designMode: DesignMode = \"constrained\",\n): EvalCriterion[] {\n return criteriaFor(designMode).filter((c) => c.priority === priority);\n}\n\n/** Get a specific criterion by ID */\nexport function getCriterionById(\n id: string,\n designMode: DesignMode = \"constrained\",\n): EvalCriterion | undefined {\n return criteriaFor(designMode).find((c) => c.id === id);\n}\n\n/** Get all LLM-evaluated criteria (tier 1 + 2) */\nexport function getLLMCriteria(designMode: DesignMode = \"constrained\"): EvalCriterion[] {\n return criteriaFor(designMode).filter((c) => c.tier > 0);\n}\n\n/**\n * Build the coding agent's criteria summary from the single source of truth.\n * Grouped by priority for the P0→P1→P2 hierarchy.\n */\nexport function buildCodingCriteriaSummary(designMode: DesignMode = \"constrained\"): string {\n const lines: string[] = [\"## Priority (P0 first, then P1, then P2)\", \"\"];\n\n for (const priority of [\"P0\", \"P1\", \"P2\"] as Priority[]) {\n const label =\n priority === \"P0\"\n ? \"Must (compile + complete)\"\n : priority === \"P1\"\n ? \"Should (safety)\"\n : \"Nice (quality)\";\n const criteria = getCriteriaByPriority(priority, designMode);\n lines.push(`**${priority} — ${label}:**`);\n for (const c of criteria) {\n lines.push(`- ${c.codingGuidance}`);\n }\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n}\n","// Axis-keyed dispatcher. Iterates the flat REGISTRY, runs each check\n// whose gate matches the classification's axis vector, and accumulates\n// issues.\n\nimport type { DataContract, JsonObject } from \"@ggui-ai/protocol\";\nimport type { Classification } from \"../../classifier/index.js\";\nimport type { EvalIssue } from \"../types-public.js\";\nimport { REGISTRY } from \"./registry.js\";\nimport { matches, type AxisCheck, type AxisCheckInput } from \"./types.js\";\nimport { axisCheckTraceEnabled } from \"./helpers.js\";\nimport { createHash } from \"node:crypto\";\nimport type { CanvasClass, DesignMode } from \"../../design-mode.js\";\n\nexport interface RunAxisChecksInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n /** Which triad produced the source — see `AxisCheckInput.designMode`. */\n designMode?: DesignMode;\n /** The canvas the source is judged for — see `AxisCheckInput.canvas` (ggui#1117); absent = no rendering context. */\n canvas?: CanvasClass;\n /** The props the source was rendered with — see `AxisCheckInput.fixtureProps` (ggui#1285); absent = the echo check stands down. */\n fixtureProps?: JsonObject;\n}\n\nexport function runAxisChecks(\n classification: Classification,\n input: RunAxisChecksInput,\n): EvalIssue[] {\n const facts: AxisTraceFacts = {\n sourceCode: input.sourceCode,\n ...(input.contract !== undefined ? { contract: input.contract } : {}),\n originalPrompt: input.originalPrompt,\n classification,\n ...(input.designMode !== undefined ? { designMode: input.designMode } : {}),\n ...(input.canvas !== undefined ? { canvas: input.canvas } : {}),\n ...(input.fixtureProps !== undefined ? { fixtureProps: input.fixtureProps } : {}),\n };\n if (input.compiledCode === null) {\n traceAxisChecksSkipped(facts, \"compiledCode null — no check ran\");\n return [];\n }\n const axisInput: AxisCheckInput = { ...facts, compiledCode: input.compiledCode };\n return runGatedAxisChecks(\n REGISTRY.filter((check) => matches(classification.vector, check)),\n axisInput,\n ).issues;\n}\n\nexport interface AxisRunResult {\n readonly issues: EvalIssue[];\n /** Check ids run, in registry order, each once. */\n readonly firedIds: string[];\n}\n\n/**\n * Run a PRE-GATED list of checks once each — the one runner the served\n * loop (`run-check.ts`, over the harness's pre-filtered `axisChecks`) and\n * `runAxisChecks` (gate + run) share, so the ggui#1046 trace line prints on\n * both paths.\n */\nexport function runGatedAxisChecks(checks: readonly AxisCheck[], input: AxisCheckInput): AxisRunResult {\n const issues: EvalIssue[] = [];\n const firedIds: string[] = [];\n const seen = new Set<string>();\n for (const check of checks) {\n if (seen.has(check.id)) continue;\n seen.add(check.id);\n firedIds.push(check.id);\n issues.push(...check.run(input));\n }\n if (axisCheckTraceEnabled()) {\n const line: AxisCheckTrace = {\n ...traceFacts(input),\n matched: [...firedIds],\n issues: issues.map((i) => ({ id: i.subcategory ?? i.category, result: i.result })),\n };\n console.log(JSON.stringify({ axisCheckTrace: line }));\n }\n return { issues, firedIds };\n}\n\n/** The dispatcher's line for a round where no check could run (a null compile), flag-gated like the rest. */\nexport function traceAxisChecksSkipped(facts: AxisTraceFacts, note: string): void {\n if (!axisCheckTraceEnabled()) return;\n const line: AxisCheckTrace = { ...traceFacts(facts), matched: [], issues: [], note };\n console.log(JSON.stringify({ axisCheckTrace: line }));\n}\n\n/** The input facts a round's verdict is built from — `AxisCheckInput` minus the compile. */\nexport type AxisTraceFacts = Omit<AxisCheckInput, \"compiledCode\">;\n\n/** One trace line per round (ggui#1046): the input facts a verdict was built from, the gates that matched, the issues that came out. */\nexport interface AxisCheckTrace {\n readonly sourceSha256: string;\n readonly originalPrompt: string;\n readonly designMode: string;\n readonly classification: Classification[\"vector\"];\n readonly propsSpecKeys: readonly string[];\n readonly propsSpecPropertyKeys: readonly string[];\n /** The canvas the verdict was built for (ggui#1117) — present only when the input carried one. */\n readonly canvas?: CanvasClass;\n readonly matched: readonly string[];\n readonly issues: ReadonlyArray<{ readonly id: string; readonly result: EvalIssue[\"result\"] }>;\n readonly note?: string;\n}\n\nfunction traceFacts(input: AxisTraceFacts): Omit<AxisCheckTrace, \"matched\" | \"issues\"> {\n const propsSpec = input.contract?.propsSpec;\n return {\n sourceSha256: createHash(\"sha256\").update(input.sourceCode, \"utf8\").digest(\"hex\"),\n originalPrompt: input.originalPrompt,\n designMode: input.designMode ?? \"constrained\",\n classification: input.classification.vector,\n propsSpecKeys: Object.keys(propsSpec ?? {}),\n propsSpecPropertyKeys: Object.keys(propsSpec?.properties ?? {}),\n // No default here, unlike designMode: an absent canvas is a fact about the caller, not a guess to paper over.\n ...(input.canvas !== undefined ? { canvas: input.canvas } : {}),\n };\n}\n"]}