@ggui-ai/ui-gen 0.6.3 → 0.7.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.
Files changed (35) hide show
  1. package/dist/adapters/generation-dispatch.js +20 -8
  2. package/dist/adapters/generation-dispatch.js.map +1 -1
  3. package/dist/adapters/index.js +1 -1
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/advanced/index.js +20 -8
  6. package/dist/advanced/index.js.map +1 -1
  7. package/dist/boilerplate.js +9 -5
  8. package/dist/boilerplate.js.map +1 -1
  9. package/dist/check/index.js.map +1 -1
  10. package/dist/evaluation/axis-checks/index.js.map +1 -1
  11. package/dist/evaluation/index.js +3 -3
  12. package/dist/evaluation/index.js.map +1 -1
  13. package/dist/harness/index.js +9 -5
  14. package/dist/harness/index.js.map +1 -1
  15. package/dist/harness/runtime.js +10 -6
  16. package/dist/harness/runtime.js.map +1 -1
  17. package/dist/harness/types-public.js +9 -5
  18. package/dist/harness/types-public.js.map +1 -1
  19. package/dist/index.js +20 -8
  20. package/dist/index.js.map +1 -1
  21. package/dist/tools/get-primitives-ts.d.ts +1 -1
  22. package/dist/tools/get-primitives-ts.js +1 -1
  23. package/dist/tools/get-primitives-ts.js.map +1 -1
  24. package/dist/validation/index.d.ts +1 -1
  25. package/dist/validation/index.js +1 -1
  26. package/dist/validation/index.js.map +1 -1
  27. package/package.json +12 -12
  28. package/src/boilerplate/generate.ts +2 -0
  29. package/src/boilerplate/system-prompt.ts +3 -1
  30. package/src/boilerplate/templates/base.tsx.tmpl +1 -1
  31. package/src/evaluation/llm-evaluator.ts +8 -1
  32. package/src/evaluation/types-public.ts +4 -3
  33. package/src/harness/primitive-slice.ts +1 -1
  34. package/src/tools/get-primitives-ts.ts +1 -1
  35. package/src/validation/primitives.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../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/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/extras.ts","../../../src/evaluation/axis-checks/registry.ts","../../../src/evaluation/types-public.ts","../../../src/evaluation/axis-checks/dispatch.ts"],"names":["REALTIME_ACTIVE","mkIssue","matches"],"mappings":";;;AAqCA,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,EAAG,CAAC,KAAK,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AAC9C,IAAA,MAAM,EAAA,GAAK,CAAA;AACX,IAAA,IAAI,IAAI,IAAA,KAAS,QAAA,IAAY,IAAI,MAAA,EAAQ,IAAA,KAAS,UAAU,OAAO,CAAA;AAAA,EACrE;AACA,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,qBAAqB,QAAA,EAAmC;AACtE,EAAA,MAAM,aAAa,QAAA,EAAU,SAAA;AAG7B,EAAA,MAAM,UAAA,GAAa,UAAA,EAAY,UAAA,IAAc,EAAC;AAC9C,EAAA,OAAO,MAAA,CAAO,QAAQ,UAAU,CAAA,CAC7B,OAAO,CAAC,GAAG,CAAC,CAAA,KAAM,CAAA,IAAK,OAAO,CAAA,KAAM,QAAA,IA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M,OAAO,EAAC;AAEzC,EAAA,MAAM,SAAA,GAA4B;AAAA,IAChC,YAAY,KAAA,CAAM,UAAA;AAAA,IAClB,cAAc,KAAA,CAAM,YAAA;AAAA,IACpB,GAAI,MAAM,QAAA,KAAa,MAAA,GAAY,EAAE,QAAA,EAAU,KAAA,CAAM,QAAA,EAAS,GAAI,EAAC;AAAA,IACnE,gBAAgB,KAAA,CAAM,cAAA;AAAA,IACtB;AAAA,GACF;AAEA,EAAA,MAAM,SAAsB,EAAC;AAC7B,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAY;AACjC,EAAA,KAAA,MAAW,SAAS,QAAA,EAAU;AAC5B,IAAA,IAAI,CAAC,OAAA,CAAQ,cAAA,CAAe,MAAA,EAAQ,KAAK,CAAA,EAAG;AAE5C,IAAA,IAAI,QAAA,CAAS,GAAA,CAAI,KAAA,CAAM,EAAE,CAAA,EAAG;AAC5B,IAAA,QAAA,CAAS,GAAA,CAAI,MAAM,EAAE,CAAA;AACrB,IAAA,MAAA,CAAO,IAAA,CAAK,GAAG,KAAA,CAAM,GAAA,CAAI,SAAS,CAAC,CAAA;AAAA,EACrC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["// 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","// 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 type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\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\nexport const UNIVERSAL_CHECKS: readonly AxisCheck[] = [\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","// 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});\\` so stream/action updates can merge into live state.`,\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 item.symbol / whatever the entity id field is).`,\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/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\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 const re = new RegExp(\n `useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?props\\\\.${name}\\\\b`,\n );\n if (re.test(src)) 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/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 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 { 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 { EXTRA_CHECKS } from \"./extras.js\";\n\nexport const REGISTRY: readonly AxisCheck[] = [\n ...UNIVERSAL_CHECKS,\n ...STATE_MERGE_CHECKS,\n ...REALTIME_CHECKS,\n ...WRITES_CHECKS,\n ...STATE_PAYLOAD_CHECKS,\n ...TOOLING_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\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\n/**\n * Runtime-render probe execution status — three-valued so \"the probe\n * never ran\" is never conflated with \"the probe ran clean\".\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 */\nexport type RuntimeProbeStatus = \"ran\" | \"infra-skipped\" | \"not-applicable\";\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 */\nexport interface RuntimeProbeMeta {\n readonly status: RuntimeProbeStatus;\n /** Populated for `infra-skipped` / `not-applicable` — why the probe didn't run. */\n readonly reason?: string;\n}\n\nexport interface EvalResult {\n issues: EvalIssue[];\n pass: string[];\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\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 { 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\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: \"Add labels on form inputs, alt text on images, semantic HTML.\",\n evalInstruction: `Evaluate ACCESSIBILITY: missing labels, alt text, semantic HTML, keyboard support.\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; 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/** Get all criteria for a specific priority level */\nexport function getCriteriaByPriority(priority: Priority): EvalCriterion[] {\n return CRITERIA.filter((c) => c.priority === priority);\n}\n\n/** Get a specific criterion by ID */\nexport function getCriterionById(id: string): EvalCriterion | undefined {\n return CRITERIA.find((c) => c.id === id);\n}\n\n/** Get all LLM-evaluated criteria (tier 1 + 2) */\nexport function getLLMCriteria(): EvalCriterion[] {\n return CRITERIA.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(): 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);\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 } 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 AxisCheckInput } from \"./types.js\";\n\nexport interface RunAxisChecksInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n}\n\nexport function runAxisChecks(\n classification: Classification,\n input: RunAxisChecksInput,\n): EvalIssue[] {\n if (input.compiledCode === null) return [];\n\n const axisInput: AxisCheckInput = {\n sourceCode: input.sourceCode,\n compiledCode: input.compiledCode,\n ...(input.contract !== undefined ? { contract: input.contract } : {}),\n originalPrompt: input.originalPrompt,\n classification,\n };\n\n const issues: EvalIssue[] = [];\n const firedIds = new Set<string>();\n for (const check of REGISTRY) {\n if (!matches(classification.vector, check)) continue;\n // Dedup by id — a check may be registered under multiple gates.\n if (firedIds.has(check.id)) continue;\n firedIds.add(check.id);\n issues.push(...check.run(axisInput));\n }\n return issues;\n}\n"]}
1
+ {"version":3,"sources":["../../../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/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/extras.ts","../../../src/evaluation/axis-checks/registry.ts","../../../src/evaluation/types-public.ts","../../../src/evaluation/axis-checks/dispatch.ts"],"names":["REALTIME_ACTIVE","mkIssue","matches"],"mappings":";;;AAqCA,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,EA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,EACrC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["// 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","// 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 type { EvalIssue } from \"../../types-public.js\";\nimport type { AxisCheck, AxisCheckInput } from \"../types.js\";\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\nexport const UNIVERSAL_CHECKS: readonly AxisCheck[] = [\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","// 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});\\` so stream/action updates can merge into live state.`,\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 item.symbol / whatever the entity id field is).`,\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/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\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 const re = new RegExp(\n `useState(?:<[^>]*>)?\\\\s*\\\\([\\\\s\\\\S]{0,400}?props\\\\.${name}\\\\b`,\n );\n if (re.test(src)) 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/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 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 { 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 { EXTRA_CHECKS } from \"./extras.js\";\n\nexport const REGISTRY: readonly AxisCheck[] = [\n ...UNIVERSAL_CHECKS,\n ...STATE_MERGE_CHECKS,\n ...REALTIME_CHECKS,\n ...WRITES_CHECKS,\n ...STATE_PAYLOAD_CHECKS,\n ...TOOLING_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\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\n/**\n * Runtime-render probe execution status — three-valued so \"the probe\n * never ran\" is never conflated with \"the probe ran clean\".\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 */\nexport type RuntimeProbeStatus = \"ran\" | \"infra-skipped\" | \"not-applicable\";\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 */\nexport interface RuntimeProbeMeta {\n readonly status: RuntimeProbeStatus;\n /** Populated for `infra-skipped` / `not-applicable` — why the probe didn't run. */\n readonly reason?: string;\n}\n\nexport interface EvalResult {\n issues: EvalIssue[];\n pass: string[];\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\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 { 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\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/** Get all criteria for a specific priority level */\nexport function getCriteriaByPriority(priority: Priority): EvalCriterion[] {\n return CRITERIA.filter((c) => c.priority === priority);\n}\n\n/** Get a specific criterion by ID */\nexport function getCriterionById(id: string): EvalCriterion | undefined {\n return CRITERIA.find((c) => c.id === id);\n}\n\n/** Get all LLM-evaluated criteria (tier 1 + 2) */\nexport function getLLMCriteria(): EvalCriterion[] {\n return CRITERIA.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(): 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);\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 } 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 AxisCheckInput } from \"./types.js\";\n\nexport interface RunAxisChecksInput {\n sourceCode: string;\n compiledCode: string | null;\n contract?: DataContract;\n originalPrompt: string;\n}\n\nexport function runAxisChecks(\n classification: Classification,\n input: RunAxisChecksInput,\n): EvalIssue[] {\n if (input.compiledCode === null) return [];\n\n const axisInput: AxisCheckInput = {\n sourceCode: input.sourceCode,\n compiledCode: input.compiledCode,\n ...(input.contract !== undefined ? { contract: input.contract } : {}),\n originalPrompt: input.originalPrompt,\n classification,\n };\n\n const issues: EvalIssue[] = [];\n const firedIds = new Set<string>();\n for (const check of REGISTRY) {\n if (!matches(classification.vector, check)) continue;\n // Dedup by id — a check may be registered under multiple gates.\n if (firedIds.has(check.id)) continue;\n firedIds.add(check.id);\n issues.push(...check.run(axisInput));\n }\n return issues;\n}\n"]}
@@ -288,12 +288,12 @@ Only list MISSING interactive elements. Use 'fail' only for issues blocking core
288
288
  priority: "P2",
289
289
  tier: 2,
290
290
  failOutcome: "warn",
291
- codingGuidance: "Add labels on form inputs, alt text on images, semantic HTML.",
292
- evalInstruction: `Evaluate ACCESSIBILITY: missing labels, alt text, semantic HTML, keyboard support.
291
+ codingGuidance: "Add labels on form inputs, alt text on images, semantic HTML, and state ARIA (aria-checked/pressed/selected/expanded) on hand-rolled interactive controls.",
292
+ evalInstruction: `Evaluate ACCESSIBILITY: missing labels, alt text, semantic HTML, keyboard support, ARIA state.
293
293
 
294
294
  ggui primitives bake in their own ARIA \u2014 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 \u2014 it is already there and not visible in the source you are reading.
295
295
 
296
- Flag ONLY real gaps: a raw div/span used as an interactive control; 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.
296
+ Flag 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.
297
297
 
298
298
  Only list MISSING accessibility features. Use 'fail' only if it blocks delivery.`
299
299
  },