@ggui-ai/ui-gen 0.24.0 → 0.26.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 (142) hide show
  1. package/README.md +2 -2
  2. package/dist/{adapter-Du7P_5Fx.d.ts → adapter-BJwn74rx.d.ts} +49 -1
  3. package/dist/adapters/generation-dispatch.d.ts +32 -7
  4. package/dist/adapters/generation-dispatch.js +1997 -216
  5. package/dist/adapters/generation-dispatch.js.map +1 -1
  6. package/dist/adapters/index.js +29 -6
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/advanced/index.d.ts +15 -12
  9. package/dist/advanced/index.js +2013 -270
  10. package/dist/advanced/index.js.map +1 -1
  11. package/dist/{axes-CzLEMDeB.d.ts → axes-CKVCzR_x.d.ts} +1 -1
  12. package/dist/bank-Ctdp3FUA.d.ts +118 -0
  13. package/dist/blueprint-validator.js +416 -92
  14. package/dist/blueprint-validator.js.map +1 -1
  15. package/dist/boilerplate.d.ts +2 -2
  16. package/dist/boilerplate.js +34 -15
  17. package/dist/boilerplate.js.map +1 -1
  18. package/dist/check/index.d.ts +13 -5
  19. package/dist/check/index.js +56 -3
  20. package/dist/check/index.js.map +1 -1
  21. package/dist/classifier/index.d.ts +2 -2
  22. package/dist/compose.d.ts +2 -2
  23. package/dist/{create-ui-generator-GIhzx08x.d.ts → create-ui-generator-N4gRXpcL.d.ts} +11 -4
  24. package/dist/{design-mode-DLufhrNp.d.ts → design-mode-DGWN_Gkm.d.ts} +1 -1
  25. package/dist/{dispatch-BnAH56p4.d.ts → dispatch-BUoXRj_r.d.ts} +6 -4
  26. package/dist/evaluation/axis-checks/index.d.ts +7 -6
  27. package/dist/evaluation/axis-checks/index.js +90 -2
  28. package/dist/evaluation/axis-checks/index.js.map +1 -1
  29. package/dist/evaluation/axis-checks/registry.d.ts +6 -5
  30. package/dist/evaluation/axis-checks/registry.js +88 -1
  31. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  32. package/dist/evaluation/index.d.ts +189 -344
  33. package/dist/evaluation/index.js +1272 -59
  34. package/dist/evaluation/index.js.map +1 -1
  35. package/dist/evaluation/types.d.ts +26 -1
  36. package/dist/evaluation/types.js.map +1 -1
  37. package/dist/fragments/index.d.ts +3 -3
  38. package/dist/{generate-9IeNT4ZY.d.ts → generate-tSO_shQ0.d.ts} +1 -1
  39. package/dist/harness/check/runtime-render/index.d.ts +7 -7
  40. package/dist/harness/check/runtime-render/index.js +416 -92
  41. package/dist/harness/check/runtime-render/index.js.map +1 -1
  42. package/dist/harness/check/runtime-render/render-check-worker.js +393 -88
  43. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  44. package/dist/harness/index.d.ts +5 -6
  45. package/dist/harness/index.js +69 -20
  46. package/dist/harness/index.js.map +1 -1
  47. package/dist/harness/prompts.d.ts +2 -2
  48. package/dist/harness/prompts.js +10 -1
  49. package/dist/harness/prompts.js.map +1 -1
  50. package/dist/harness/result-types.d.ts +19 -5
  51. package/dist/harness/result-types.js.map +1 -1
  52. package/dist/harness/runtime.d.ts +21 -7
  53. package/dist/harness/runtime.js +36 -17
  54. package/dist/harness/runtime.js.map +1 -1
  55. package/dist/harness/types-public.d.ts +6 -4
  56. package/dist/harness/types-public.js +43 -18
  57. package/dist/harness/types-public.js.map +1 -1
  58. package/dist/harness/validator-trace-sink.d.ts +6 -5
  59. package/dist/hash.d.ts +1 -1
  60. package/dist/index.d.ts +64 -13
  61. package/dist/index.js +2023 -270
  62. package/dist/index.js.map +1 -1
  63. package/dist/patch.d.ts +5 -5
  64. package/dist/policy.d.ts +1 -1
  65. package/dist/{prompts-YU9piOgs.d.ts → prompts-BhNUuRoZ.d.ts} +1 -1
  66. package/dist/tools/get-primitives-ts.d.ts +1 -1
  67. package/dist/tools/get-primitives-ts.js +1 -1
  68. package/dist/tools/get-primitives-ts.js.map +1 -1
  69. package/dist/tools/render-check-worker.js +8 -1
  70. package/dist/tools/render-check-worker.js.map +1 -1
  71. package/dist/{types-BOvHNG7K.d.ts → types-Dh1s4K9j.d.ts} +1 -1
  72. package/dist/types-public-B7wn4ce5.d.ts +959 -0
  73. package/dist/validation/index.d.ts +1 -1
  74. package/dist/validation/index.js +1 -1
  75. package/dist/validation/index.js.map +1 -1
  76. package/dist/visual-evaluator-C9L-o6ap.d.ts +639 -0
  77. package/dist/workflows.d.ts +5 -5
  78. package/package.json +12 -12
  79. package/src/adapters/generation-dispatch.ts +38 -2
  80. package/src/adapters/tools.ts +2 -1
  81. package/src/boilerplate/free-design-prompt.ts +4 -4
  82. package/src/boilerplate/generate.ts +26 -1
  83. package/src/boilerplate/hard-sections.ts +14 -14
  84. package/src/boilerplate/system-prompt.ts +1 -1
  85. package/src/boilerplate/templates/layouts/chat-mobile.tsx.tmpl +3 -1
  86. package/src/boilerplate/templates/layouts/chat-universal.tsx.tmpl +3 -1
  87. package/src/boilerplate/templates/layouts/fullscreen-desktop.tsx.tmpl +3 -1
  88. package/src/boilerplate/templates/layouts/fullscreen-universal.tsx.tmpl +3 -1
  89. package/src/check/index.ts +1 -0
  90. package/src/check/run-tier0.ts +6 -3
  91. package/src/check/sample-props.ts +63 -0
  92. package/src/coding-agent/tools.ts +4 -1
  93. package/src/contract-context.ts +1 -1
  94. package/src/create-harness.ts +3 -3
  95. package/src/create-ui-generator.ts +20 -1
  96. package/src/evaluation/__fixtures__/png.ts +100 -0
  97. package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
  98. package/src/evaluation/axis-checks/checks/universal.ts +111 -0
  99. package/src/evaluation/axis-checks/dispatch.ts +4 -1
  100. package/src/evaluation/cost-tracker.ts +54 -6
  101. package/src/evaluation/criteria/bank.ts +85 -0
  102. package/src/evaluation/criteria/context.ts +52 -0
  103. package/src/evaluation/criteria/edge-probe.ts +286 -0
  104. package/src/evaluation/criteria/edge.ts +202 -0
  105. package/src/evaluation/criteria/resolve.ts +207 -0
  106. package/src/evaluation/criteria/select.ts +79 -0
  107. package/src/evaluation/index.ts +27 -0
  108. package/src/evaluation/ink-extent.ts +200 -0
  109. package/src/evaluation/judge-spend.ts +48 -0
  110. package/src/evaluation/theme-css.ts +12 -5
  111. package/src/evaluation/types-public.ts +221 -3
  112. package/src/evaluation/types.ts +19 -0
  113. package/src/evaluation/visual-evaluator.ts +853 -51
  114. package/src/harness/check/runtime-render/adapter.ts +18 -0
  115. package/src/harness/check/runtime-render/probe-pending.ts +111 -0
  116. package/src/harness/check/runtime-render/render-check-host.ts +10 -6
  117. package/src/harness/check/runtime-render/render-check-worker.ts +6 -3
  118. package/src/harness/check/runtime-render/render-check.ts +417 -133
  119. package/src/harness/check/runtime-render/walk.ts +200 -0
  120. package/src/harness/coding/assemble-result.ts +2 -0
  121. package/src/harness/coding/generate-task-runner.ts +30 -0
  122. package/src/harness/coding/init-session.ts +5 -3
  123. package/src/harness/coding/run-coding-turn.ts +12 -4
  124. package/src/harness/coding/run-eval-round.ts +82 -3
  125. package/src/harness/in-loop-evaluation.ts +39 -0
  126. package/src/harness/llm-router.ts +58 -1
  127. package/src/harness/result-types.ts +9 -0
  128. package/src/harness/runtime.ts +14 -0
  129. package/src/harness/types-public.ts +10 -1
  130. package/src/harness-tool-names.ts +38 -0
  131. package/src/index.ts +17 -0
  132. package/src/internal/verdict-line.ts +33 -0
  133. package/src/run-check.ts +2 -0
  134. package/src/taught-tokens.ts +32 -0
  135. package/src/tools/get-primitives-ts.ts +1 -1
  136. package/src/tools/get-wire.ts +1 -1
  137. package/src/tools/render-check-worker.ts +2 -1
  138. package/src/tools/render-check.ts +8 -67
  139. package/src/tools.ts +11 -1
  140. package/src/validation/primitives.ts +1 -1
  141. package/dist/llm-router-DwwUK1bz.d.ts +0 -265
  142. package/dist/types-public-Bk6d1WLN.d.ts +0 -451
@@ -1,13 +1,19 @@
1
1
  import { JsonObject, DataContract } from '@ggui-ai/protocol';
2
2
  export { ActionSpec, DataContract, JsonSchema, PropsSpec, StreamSpec } from '@ggui-ai/protocol';
3
3
  import { AdapterResult } from '../adapters/types.js';
4
- import { R as RenderingContext } from '../prompts-YU9piOgs.js';
5
- import { b as EvalResult } from '../types-public-Bk6d1WLN.js';
6
- import { D as DesignMode, C as CanvasClass } from '../design-mode-DLufhrNp.js';
4
+ import { R as RenderingContext } from '../prompts-BhNUuRoZ.js';
5
+ import { e as EvalResult } from '../types-public-B7wn4ce5.js';
6
+ import { V as VisualLegTokens } from '../visual-evaluator-C9L-o6ap.js';
7
+ import { D as DesignMode, C as CanvasClass } from '../design-mode-DGWN_Gkm.js';
7
8
  import 'zod';
9
+ import '../llm.js';
8
10
  import '@ggui-ai/mcp-server-core';
9
- import '../axes-CzLEMDeB.js';
10
- import '../types-BOvHNG7K.js';
11
+ import '../axes-CKVCzR_x.js';
12
+ import '../types-Dh1s4K9j.js';
13
+ import '../styling-profile-CxfvV48g.js';
14
+ import '../bank-Ctdp3FUA.js';
15
+ import '../evaluation/types.js';
16
+ import 'puppeteer-core';
11
17
 
12
18
  /**
13
19
  * Model role — each internal task in the harness can use a different model.
@@ -49,6 +55,14 @@ interface GenerationResult extends AdapterResult {
49
55
  passesUsed: number;
50
56
  /** Three-tier evaluation result (tier 0 + LLM tier 1+2 + visual) */
51
57
  evalResult?: EvalResult;
58
+ /**
59
+ * ggui#1522 — what the IN-LOOP visual judge spent during this generation (its scoring calls, and its report-only
60
+ * criteria calls apart), priced at the visual agent's model. NOT inside `tokens`, which covers the coding turns
61
+ * and the text evaluator. And NOT the same calls as a post-generation judge's own visual pass (a benchmark
62
+ * report's `meta.costs.visualUsd`): a cost rule that adds both is correct, one read as the other double-counts.
63
+ * Absent when no in-loop visual leg ran or it reported no tokens.
64
+ */
65
+ inLoopVisualTokens?: VisualLegTokens;
52
66
  /** Set only when the same-exchange guard ended the run (ggui#404); no key otherwise. */
53
67
  sameExchangeBreak?: SameExchangeBreak;
54
68
  /** Whether background improvement should be spawned (auto-improve mode) */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/harness/result-types.ts"],"names":[],"mappings":";AAkLA,SAAS,iBAAiB,OAAA,EAAyB;AACjD,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AACtC,EAAA,OAAO,cAAc,CAAA,GAAI,OAAA,CAAQ,KAAA,CAAM,UAAA,GAAa,CAAC,CAAA,GAAI,OAAA;AAC3D;AAOO,SAAS,mBAAA,CACd,IAAA,EACA,MAAA,EACA,QAAA,EACQ;AACR,EAAA,IAAI,CAAC,QAAQ,OAAO,QAAA;AACpB,EAAA,MAAM,QAAA,GAAW,MAAA,CAAO,IAAI,CAAA,IAAK,OAAO,OAAA,IAAW,QAAA;AACnD,EAAA,OAAO,iBAAiB,QAAQ,CAAA;AAClC","file":"result-types.js","sourcesContent":["// packages/ui-gen/src/harness/result-types.ts\n//\n// Result shapes returned by the harness runtime.\n//\n// Two output types travel the dispatch surface:\n// - AdapterResult — raw adapter output (provider-direct path)\n// - GenerationResult — full harness output (run-loop, eval, breakdown)\n//\n// ModelRoles + resolveModelForRole live here too (the harness decides\n// which model to use per internal task).\n\nimport type { DataContract, JsonObject } from \"@ggui-ai/protocol\";\nimport type { AdapterResult } from \"../adapters/types.js\";\nimport type { RenderingContext } from \"../contract-context.js\";\nimport type { EvalResult } from \"../evaluation/types-public.js\";\nimport type { CanvasClass, DesignMode } from \"../design-mode.js\";\n\n// =============================================================================\n// Model Roles\n// =============================================================================\n\n/**\n * Model role — each internal task in the harness can use a different model.\n *\n * - thinking: planning, design decisions, architecture (use frontier/thinking model)\n * - coding: writing TSX, implementing the design (use fast model)\n * - evaluation: scoring quality, finding issues (use balanced model)\n * - default: fallback for any role not explicitly set\n */\nexport type ModelRole = \"thinking\" | \"coding\" | \"evaluation\" | \"default\";\n\n/**\n * Maps model roles to model IDs.\n * Any role not specified falls back to 'default', then to params.model.\n *\n * @example\n * // Opus plans, Haiku codes, Sonnet evaluates\n * { thinking: 'claude-opus-4-6', coding: 'claude-haiku-4-5', default: 'claude-sonnet-4-6' }\n *\n * // All Haiku (cheapest)\n * { default: 'claude-haiku-4-5' }\n *\n * // All Opus (highest quality)\n * { default: 'claude-opus-4-6' }\n */\nexport type ModelRoles = Partial<Record<ModelRole, string>>;\n\n// =============================================================================\n// Generation Result\n// =============================================================================\n\n/**\n * The same-exchange guard (ggui#404) ended this generation: the coding model\n * made one identical tool exchange (same tool, same input, same result)\n * `repeats` times, so the loop stopped instead of burning its remaining turns.\n * Present ONLY when that guard ended the run — whether anything shipped is\n * the compiled code's to say (the loop falls back to an earlier build).\n */\nexport interface SameExchangeBreak {\n readonly tool: string;\n readonly repeats: number;\n}\n\nexport interface GenerationResult extends AdapterResult {\n /** Number of generation passes the harness performed */\n passesUsed: number;\n /** Three-tier evaluation result (tier 0 + LLM tier 1+2 + visual) */\n evalResult?: EvalResult;\n /** Set only when the same-exchange guard ended the run (ggui#404); no key otherwise. */\n sameExchangeBreak?: SameExchangeBreak;\n /** Whether background improvement should be spawned (auto-improve mode) */\n needsBackgroundImprovement?: boolean;\n /** Whether at least one commit passed the self-check (compile + type check + lint) */\n selfCheckPassed?: boolean;\n /** Which model was used for each role (for benchmark reporting) */\n modelRolesUsed?: Record<string, string>;\n /**\n * The triad this generation ran under — recorded ONLY when the caller\n * set `designMode` on the dispatch (a bench arm switch, an operator\n * option). Absent = the constrained default path, byte-identical to\n * the pre-`designMode` result.\n */\n designMode?: DesignMode;\n /**\n * The canvas class the `free` prompt stated — the explicit `canvas`\n * when the caller passed one, else the shell × screen derivation the\n * prompt itself used. Absent in constrained mode (that prompt states\n * no canvas) unless the caller passed one explicitly.\n */\n canvas?: CanvasClass;\n /** Phase-level timing breakdown (ms) */\n timing?: Record<string, number>;\n /** Per-turn/per-outcome breakdown for benchmark analysis.\n * Machine-parseable summary — phases counted by role, outcomes counted by rejection class. */\n breakdown?: {\n phases: { impl: number; patch: number; evalFix: number; scaffold?: number; fill?: number };\n outcomes: { pass: number; patchInvalid: number; selfCheckFail: number; diffFail: number };\n evalRounds: number;\n /** Coding-turn LLM wall-time (sum of per-turn llm=Xms). Stable semantics. */\n llmMs: number;\n /** Eval-round LLM wall-time (parallel LLM+visual). Added 2026-04-14. */\n evalLlmMs?: number;\n toolMs: number;\n /** Eval-round wall-clock (fix: was structurally 0 before 2026-04-14). */\n evalMs: number;\n /** Coding-only wall-time (inner loop minus eval). Added 2026-04-14. */\n codingMs?: number;\n /** Session setup+cleanup wall-time (outside inner loop). Added 2026-04-14. */\n setupMs?: number;\n };\n}\n\n// =============================================================================\n// Generation Context\n// =============================================================================\n\nexport interface GenerationContext {\n /** Progress callback */\n onProgress?: (event: unknown) => void;\n\n /** Called with initial result before evaluation loop (for early delivery) */\n onInitialResult?: (result: {\n componentCode: string;\n sourceCode?: string;\n }) => void | Promise<void>;\n\n /** Original user prompt (for evaluation context) */\n originalPrompt: string;\n\n /** Design context for evaluation */\n designContext?: string;\n\n /** Model roles — which model to use for each internal task */\n models?: ModelRoles;\n\n /** Rendering context — device and shell type affect layout strategy */\n rendering?: RenderingContext;\n\n /** Data contract — bind the component to its consumers */\n contract?: DataContract;\n\n /** Evaluation configuration */\n evaluation?: EvaluationConfig;\n}\n\n// Rendering context — canonical definition lives in\n// `../contract-context.ts` (one type, one prompt-builder family).\n// Re-exported here because this subpath is the harness's type hub.\nexport type { RenderingContext } from \"../contract-context.js\";\n\n// Data contract — re-exported from protocol (canonical types)\nexport type {\n ActionSpec,\n DataContract,\n JsonSchema,\n PropsSpec,\n StreamSpec,\n} from \"@ggui-ai/protocol\";\n\nexport interface EvaluationConfig {\n enabled: boolean;\n passThreshold: number;\n maxRounds?: number;\n model?: string;\n provider?: \"claude\" | \"openai\" | \"google\" | \"openrouter\";\n maxBudgetPerEval?: number;\n maxBudgetPerFix?: number;\n generatorOptions?: JsonObject;\n}\n\n// =============================================================================\n// Helpers\n// =============================================================================\n\n/**\n * Strip provider prefix from LiteLLM-format model IDs.\n * 'anthropic/claude-sonnet-4-6' -> 'claude-sonnet-4-6'\n */\nfunction stripModelPrefix(modelId: string): string {\n const slashIndex = modelId.indexOf(\"/\");\n return slashIndex >= 0 ? modelId.slice(slashIndex + 1) : modelId;\n}\n\n/**\n * Resolve the model ID for a given role.\n * Priority: role-specific → default role → params.model\n * Strips provider prefix (e.g., 'anthropic/') so the result is a native API model ID.\n */\nexport function resolveModelForRole(\n role: ModelRole,\n models: ModelRoles | undefined,\n fallback: string\n): string {\n if (!models) return fallback;\n const resolved = models[role] ?? models.default ?? fallback;\n return stripModelPrefix(resolved);\n}\n"]}
1
+ {"version":3,"sources":["../../src/harness/result-types.ts"],"names":[],"mappings":";AA2LA,SAAS,iBAAiB,OAAA,EAAyB;AACjD,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AACtC,EAAA,OAAO,cAAc,CAAA,GAAI,OAAA,CAAQ,KAAA,CAAM,UAAA,GAAa,CAAC,CAAA,GAAI,OAAA;AAC3D;AAOO,SAAS,mBAAA,CACd,IAAA,EACA,MAAA,EACA,QAAA,EACQ;AACR,EAAA,IAAI,CAAC,QAAQ,OAAO,QAAA;AACpB,EAAA,MAAM,QAAA,GAAW,MAAA,CAAO,IAAI,CAAA,IAAK,OAAO,OAAA,IAAW,QAAA;AACnD,EAAA,OAAO,iBAAiB,QAAQ,CAAA;AAClC","file":"result-types.js","sourcesContent":["// packages/ui-gen/src/harness/result-types.ts\n//\n// Result shapes returned by the harness runtime.\n//\n// Two output types travel the dispatch surface:\n// - AdapterResult — raw adapter output (provider-direct path)\n// - GenerationResult — full harness output (run-loop, eval, breakdown)\n//\n// ModelRoles + resolveModelForRole live here too (the harness decides\n// which model to use per internal task).\n\nimport type { DataContract, JsonObject } from \"@ggui-ai/protocol\";\nimport type { AdapterResult } from \"../adapters/types.js\";\nimport type { RenderingContext } from \"../contract-context.js\";\nimport type { EvalResult } from \"../evaluation/types-public.js\";\nimport type { VisualLegTokens } from \"../evaluation/visual-evaluator.js\";\nimport type { CanvasClass, DesignMode } from \"../design-mode.js\";\n\n// =============================================================================\n// Model Roles\n// =============================================================================\n\n/**\n * Model role — each internal task in the harness can use a different model.\n *\n * - thinking: planning, design decisions, architecture (use frontier/thinking model)\n * - coding: writing TSX, implementing the design (use fast model)\n * - evaluation: scoring quality, finding issues (use balanced model)\n * - default: fallback for any role not explicitly set\n */\nexport type ModelRole = \"thinking\" | \"coding\" | \"evaluation\" | \"default\";\n\n/**\n * Maps model roles to model IDs.\n * Any role not specified falls back to 'default', then to params.model.\n *\n * @example\n * // Opus plans, Haiku codes, Sonnet evaluates\n * { thinking: 'claude-opus-4-6', coding: 'claude-haiku-4-5', default: 'claude-sonnet-4-6' }\n *\n * // All Haiku (cheapest)\n * { default: 'claude-haiku-4-5' }\n *\n * // All Opus (highest quality)\n * { default: 'claude-opus-4-6' }\n */\nexport type ModelRoles = Partial<Record<ModelRole, string>>;\n\n// =============================================================================\n// Generation Result\n// =============================================================================\n\n/**\n * The same-exchange guard (ggui#404) ended this generation: the coding model\n * made one identical tool exchange (same tool, same input, same result)\n * `repeats` times, so the loop stopped instead of burning its remaining turns.\n * Present ONLY when that guard ended the run — whether anything shipped is\n * the compiled code's to say (the loop falls back to an earlier build).\n */\nexport interface SameExchangeBreak {\n readonly tool: string;\n readonly repeats: number;\n}\n\nexport interface GenerationResult extends AdapterResult {\n /** Number of generation passes the harness performed */\n passesUsed: number;\n /** Three-tier evaluation result (tier 0 + LLM tier 1+2 + visual) */\n evalResult?: EvalResult;\n /**\n * ggui#1522 — what the IN-LOOP visual judge spent during this generation (its scoring calls, and its report-only\n * criteria calls apart), priced at the visual agent's model. NOT inside `tokens`, which covers the coding turns\n * and the text evaluator. And NOT the same calls as a post-generation judge's own visual pass (a benchmark\n * report's `meta.costs.visualUsd`): a cost rule that adds both is correct, one read as the other double-counts.\n * Absent when no in-loop visual leg ran or it reported no tokens.\n */\n inLoopVisualTokens?: VisualLegTokens;\n /** Set only when the same-exchange guard ended the run (ggui#404); no key otherwise. */\n sameExchangeBreak?: SameExchangeBreak;\n /** Whether background improvement should be spawned (auto-improve mode) */\n needsBackgroundImprovement?: boolean;\n /** Whether at least one commit passed the self-check (compile + type check + lint) */\n selfCheckPassed?: boolean;\n /** Which model was used for each role (for benchmark reporting) */\n modelRolesUsed?: Record<string, string>;\n /**\n * The triad this generation ran under — recorded ONLY when the caller\n * set `designMode` on the dispatch (a bench arm switch, an operator\n * option). Absent = the constrained default path, byte-identical to\n * the pre-`designMode` result.\n */\n designMode?: DesignMode;\n /**\n * The canvas class the `free` prompt stated — the explicit `canvas`\n * when the caller passed one, else the shell × screen derivation the\n * prompt itself used. Absent in constrained mode (that prompt states\n * no canvas) unless the caller passed one explicitly.\n */\n canvas?: CanvasClass;\n /** Phase-level timing breakdown (ms) */\n timing?: Record<string, number>;\n /** Per-turn/per-outcome breakdown for benchmark analysis.\n * Machine-parseable summary — phases counted by role, outcomes counted by rejection class. */\n breakdown?: {\n phases: { impl: number; patch: number; evalFix: number; scaffold?: number; fill?: number };\n outcomes: { pass: number; patchInvalid: number; selfCheckFail: number; diffFail: number };\n evalRounds: number;\n /** Coding-turn LLM wall-time (sum of per-turn llm=Xms). Stable semantics. */\n llmMs: number;\n /** Eval-round LLM wall-time (parallel LLM+visual). Added 2026-04-14. */\n evalLlmMs?: number;\n toolMs: number;\n /** Eval-round wall-clock (fix: was structurally 0 before 2026-04-14). */\n evalMs: number;\n /** Coding-only wall-time (inner loop minus eval). Added 2026-04-14. */\n codingMs?: number;\n /** Session setup+cleanup wall-time (outside inner loop). Added 2026-04-14. */\n setupMs?: number;\n };\n}\n\n// =============================================================================\n// Generation Context\n// =============================================================================\n\nexport interface GenerationContext {\n /** Progress callback */\n onProgress?: (event: unknown) => void;\n\n /** Called with initial result before evaluation loop (for early delivery) */\n onInitialResult?: (result: {\n componentCode: string;\n sourceCode?: string;\n }) => void | Promise<void>;\n\n /** Original user prompt (for evaluation context) */\n originalPrompt: string;\n\n /** Design context for evaluation */\n designContext?: string;\n\n /** Model roles — which model to use for each internal task */\n models?: ModelRoles;\n\n /** Rendering context — device and shell type affect layout strategy */\n rendering?: RenderingContext;\n\n /** Data contract — bind the component to its consumers */\n contract?: DataContract;\n\n /** Evaluation configuration */\n evaluation?: EvaluationConfig;\n}\n\n// Rendering context — canonical definition lives in\n// `../contract-context.ts` (one type, one prompt-builder family).\n// Re-exported here because this subpath is the harness's type hub.\nexport type { RenderingContext } from \"../contract-context.js\";\n\n// Data contract — re-exported from protocol (canonical types)\nexport type {\n ActionSpec,\n DataContract,\n JsonSchema,\n PropsSpec,\n StreamSpec,\n} from \"@ggui-ai/protocol\";\n\nexport interface EvaluationConfig {\n enabled: boolean;\n passThreshold: number;\n maxRounds?: number;\n model?: string;\n provider?: \"claude\" | \"openai\" | \"google\" | \"openrouter\";\n maxBudgetPerEval?: number;\n maxBudgetPerFix?: number;\n generatorOptions?: JsonObject;\n}\n\n// =============================================================================\n// Helpers\n// =============================================================================\n\n/**\n * Strip provider prefix from LiteLLM-format model IDs.\n * 'anthropic/claude-sonnet-4-6' -> 'claude-sonnet-4-6'\n */\nfunction stripModelPrefix(modelId: string): string {\n const slashIndex = modelId.indexOf(\"/\");\n return slashIndex >= 0 ? modelId.slice(slashIndex + 1) : modelId;\n}\n\n/**\n * Resolve the model ID for a given role.\n * Priority: role-specific → default role → params.model\n * Strips provider prefix (e.g., 'anthropic/') so the result is a native API model ID.\n */\nexport function resolveModelForRole(\n role: ModelRole,\n models: ModelRoles | undefined,\n fallback: string\n): string {\n if (!models) return fallback;\n const resolved = models[role] ?? models.default ?? fallback;\n return stripModelPrefix(resolved);\n}\n"]}
@@ -1,13 +1,14 @@
1
1
  import { G as GenerationProfileInput } from '../styling-profile-CxfvV48g.js';
2
- import { Q as QualityConfig } from '../types-public-Bk6d1WLN.js';
2
+ import { Q as QualityConfig, b as AgentConfig } from '../types-public-B7wn4ce5.js';
3
3
  import { DataContract, JsonObject, GadgetDescriptor } from '@ggui-ai/protocol';
4
- import { A as AgentConfig } from '../llm-router-DwwUK1bz.js';
5
- import { C as CanvasClass, D as DesignMode } from '../design-mode-DLufhrNp.js';
6
- export { g as generateBoilerplate } from '../generate-9IeNT4ZY.js';
7
- import '@ggui-ai/mcp-server-core';
8
- import '../axes-CzLEMDeB.js';
9
- import '../types-BOvHNG7K.js';
4
+ import { C as CriteriaBank } from '../bank-Ctdp3FUA.js';
5
+ import { C as CanvasClass, D as DesignMode } from '../design-mode-DGWN_Gkm.js';
6
+ export { g as generateBoilerplate } from '../generate-tSO_shQ0.js';
10
7
  import '../llm.js';
8
+ import '@ggui-ai/mcp-server-core';
9
+ import '../axes-CKVCzR_x.js';
10
+ import '../types-Dh1s4K9j.js';
11
+ import 'zod';
11
12
 
12
13
  type Provider = "anthropic" | "openai" | "google" | "openrouter";
13
14
  /** Agent config — provider + model pair. */
@@ -73,6 +74,19 @@ interface SingleComponentParams {
73
74
  * default tokens. Never part of the prompt or the identity.
74
75
  */
75
76
  cssTokens?: string;
77
+ /** ggui#1436 — the visual criteria bank (data, parsed by `parseCriteriaBank`); absent = no block, today's judge. */
78
+ criteriaBank?: CriteriaBank;
79
+ /** ggui#1436 — the caller's item kind for the selector (a bootstrap mint's `hello`); absent = not gated by kind. */
80
+ criteriaKind?: string;
81
+ /**
82
+ * ggui#1542 — which of the VISUAL leg's own findings may start another eval round when the quality mode is `fast`.
83
+ * `'critical'` (the default, today's behaviour): only a critical finding, which the harness makes a blocking fail.
84
+ * `'major'`: the visual JUDGE's major findings (tier-2 warns) too. The fit measurement's own warn-level overflow is
85
+ * not among them (fit runs with or without a judge, so it is its own feedback source), and neither are the text
86
+ * evaluator's warns. The other quality modes already act on every warn, so the setting changes nothing there. The
87
+ * fix turn is fed as any continuing round is (fails first, then warns).
88
+ */
89
+ actOn?: "critical" | "major";
76
90
  };
77
91
  onProgress?: (event: unknown) => void;
78
92
  onInitialResult?: (result: {