@ggui-ai/ui-gen 0.23.0 → 0.25.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 (123) hide show
  1. package/dist/adapter-Cg_rkpGq.d.ts +201 -0
  2. package/dist/adapters/generation-dispatch.d.ts +58 -15
  3. package/dist/adapters/generation-dispatch.js +1418 -180
  4. package/dist/adapters/generation-dispatch.js.map +1 -1
  5. package/dist/adapters/index.js +3 -1
  6. package/dist/adapters/index.js.map +1 -1
  7. package/dist/advanced/index.d.ts +12 -8
  8. package/dist/advanced/index.js +1467 -239
  9. package/dist/advanced/index.js.map +1 -1
  10. package/dist/{axes-CzLEMDeB.d.ts → axes-CKVCzR_x.d.ts} +1 -1
  11. package/dist/bank-CT4eEkta.d.ts +118 -0
  12. package/dist/blueprint-validator.js +153 -59
  13. package/dist/blueprint-validator.js.map +1 -1
  14. package/dist/boilerplate.js +24 -12
  15. package/dist/boilerplate.js.map +1 -1
  16. package/dist/check/index.d.ts +12 -4
  17. package/dist/check/index.js +94 -2
  18. package/dist/check/index.js.map +1 -1
  19. package/dist/classifier/index.d.ts +2 -2
  20. package/dist/compose.d.ts +2 -2
  21. package/dist/{create-ui-generator-D0kbWwln.d.ts → create-ui-generator-DFnnArrv.d.ts} +43 -11
  22. package/dist/{dispatch-wxaIMwZt.d.ts → dispatch-CStl9eAw.d.ts} +5 -3
  23. package/dist/evaluation/axis-checks/index.d.ts +6 -5
  24. package/dist/evaluation/axis-checks/index.js +90 -2
  25. package/dist/evaluation/axis-checks/index.js.map +1 -1
  26. package/dist/evaluation/axis-checks/registry.d.ts +4 -3
  27. package/dist/evaluation/axis-checks/registry.js +88 -1
  28. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  29. package/dist/evaluation/index.d.ts +301 -23
  30. package/dist/evaluation/index.js +746 -30
  31. package/dist/evaluation/index.js.map +1 -1
  32. package/dist/evaluation/types.d.ts +9 -1
  33. package/dist/evaluation/types.js.map +1 -1
  34. package/dist/fragments/index.d.ts +3 -3
  35. package/dist/harness/check/runtime-render/index.d.ts +30 -11
  36. package/dist/harness/check/runtime-render/index.js +203 -60
  37. package/dist/harness/check/runtime-render/index.js.map +1 -1
  38. package/dist/harness/check/runtime-render/render-check-worker.d.ts +8 -1
  39. package/dist/harness/check/runtime-render/render-check-worker.js +72 -32
  40. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  41. package/dist/harness/index.d.ts +5 -4
  42. package/dist/harness/index.js +33 -15
  43. package/dist/harness/index.js.map +1 -1
  44. package/dist/harness/prompts.js.map +1 -1
  45. package/dist/harness/result-types.d.ts +4 -3
  46. package/dist/harness/runtime.d.ts +11 -4
  47. package/dist/harness/runtime.js +26 -14
  48. package/dist/harness/runtime.js.map +1 -1
  49. package/dist/harness/types-public.d.ts +13 -4
  50. package/dist/harness/types-public.js +33 -15
  51. package/dist/harness/types-public.js.map +1 -1
  52. package/dist/harness/validator-trace-sink.d.ts +4 -3
  53. package/dist/hash.d.ts +1 -1
  54. package/dist/index.d.ts +59 -8
  55. package/dist/index.js +1476 -241
  56. package/dist/index.js.map +1 -1
  57. package/dist/{llm-router-DwwUK1bz.d.ts → llm-router-nfO7wPec.d.ts} +3 -1
  58. package/dist/patch.d.ts +4 -3
  59. package/dist/policy.d.ts +8 -5
  60. package/dist/policy.js.map +1 -1
  61. package/dist/tools/get-primitives-ts.d.ts +1 -1
  62. package/dist/tools/get-primitives-ts.js +1 -1
  63. package/dist/tools/get-primitives-ts.js.map +1 -1
  64. package/dist/tools/render-check-worker.d.ts +7 -1
  65. package/dist/tools/render-check-worker.js +55 -23
  66. package/dist/tools/render-check-worker.js.map +1 -1
  67. package/dist/{types-BOvHNG7K.d.ts → types-Dh1s4K9j.d.ts} +1 -1
  68. package/dist/{types-public-Ow-tNtFE.d.ts → types-public-BJTLpzWn.d.ts} +208 -15
  69. package/dist/validation/index.d.ts +1 -1
  70. package/dist/validation/index.js +1 -1
  71. package/dist/validation/index.js.map +1 -1
  72. package/dist/workflows.d.ts +4 -3
  73. package/package.json +12 -12
  74. package/src/adapters/generation-dispatch.ts +173 -98
  75. package/src/adapters/tools.ts +2 -1
  76. package/src/boilerplate/free-design-prompt.ts +1 -1
  77. package/src/boilerplate/generate.ts +26 -1
  78. package/src/boilerplate/hard-sections.ts +13 -13
  79. package/src/boilerplate/system-prompt.ts +1 -1
  80. package/src/check/index.ts +1 -0
  81. package/src/check/run-tier0.ts +80 -1
  82. package/src/check/sample-props.ts +63 -0
  83. package/src/coding-agent/tools.ts +4 -1
  84. package/src/create-harness.ts +3 -3
  85. package/src/create-ui-generator.ts +204 -95
  86. package/src/evaluation/__fixtures__/png.ts +100 -0
  87. package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
  88. package/src/evaluation/axis-checks/checks/universal.ts +111 -0
  89. package/src/evaluation/axis-checks/dispatch.ts +4 -1
  90. package/src/evaluation/criteria/bank.ts +85 -0
  91. package/src/evaluation/criteria/context.ts +52 -0
  92. package/src/evaluation/criteria/resolve.ts +159 -0
  93. package/src/evaluation/criteria/select.ts +79 -0
  94. package/src/evaluation/index.ts +23 -0
  95. package/src/evaluation/ink-extent.ts +200 -0
  96. package/src/evaluation/theme-css.ts +12 -5
  97. package/src/evaluation/types-public.ts +200 -11
  98. package/src/evaluation/types.ts +9 -0
  99. package/src/evaluation/visual-evaluator.ts +636 -30
  100. package/src/harness/check/runtime-render/adapter.ts +221 -75
  101. package/src/harness/check/runtime-render/index.ts +75 -2
  102. package/src/harness/check/runtime-render/render-check-host.ts +82 -19
  103. package/src/harness/check/runtime-render/render-check-worker.ts +83 -29
  104. package/src/harness/check/runtime-render/render-check.ts +154 -117
  105. package/src/harness/coding/generate-task-runner.ts +60 -4
  106. package/src/harness/coding/init-session.ts +13 -0
  107. package/src/harness/coding/run-coding-turn.ts +7 -3
  108. package/src/harness/coding/run-eval-round.ts +257 -15
  109. package/src/harness/policy.ts +11 -0
  110. package/src/harness/primitive-slice.ts +104 -0
  111. package/src/harness/runtime.ts +5 -0
  112. package/src/harness/types-public.ts +9 -1
  113. package/src/harness-tool-names.ts +38 -0
  114. package/src/index.ts +16 -0
  115. package/src/policy.ts +7 -4
  116. package/src/run-check.ts +2 -0
  117. package/src/tools/get-primitives-ts.ts +1 -1
  118. package/src/tools/get-wire.ts +1 -1
  119. package/src/tools/render-check-worker.ts +74 -23
  120. package/src/tools/render-check.ts +0 -60
  121. package/src/tools.ts +11 -1
  122. package/src/validation/primitives.ts +1 -1
  123. package/dist/render-check-Blwj8gB6.d.ts +0 -105
@@ -1,5 +1,5 @@
1
- import { S as StreamEventKind, C as Classification, A as AxisVector, R as RiskTier, F as FetchShape, a as AxisSource, L as LayoutShape, b as RealtimeShape, c as RenderShape, d as StateShape, T as ToolingShape, W as WriteTrigger, e as WriteShape } from '../axes-CzLEMDeB.js';
2
- export { f as AxisProvenance } from '../axes-CzLEMDeB.js';
1
+ import { b as StreamEventKind, C as Classification, A as AxisVector, R as RiskTier, F as FetchShape, c as AxisSource, L as LayoutShape, d as RealtimeShape, a as RenderShape, S as StateShape, T as ToolingShape, e as WriteTrigger, W as WriteShape } from '../axes-CKVCzR_x.js';
2
+ export { f as AxisProvenance } from '../axes-CKVCzR_x.js';
3
3
  import * as _ggui_ai_protocol from '@ggui-ai/protocol';
4
4
  import { ClientCapabilitiesSpec } from '@ggui-ai/protocol';
5
5
 
package/dist/compose.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Classification } from './axes-CzLEMDeB.js';
2
- import { C as ComposedHarness } from './types-BOvHNG7K.js';
1
+ import { C as Classification } from './axes-CKVCzR_x.js';
2
+ import { C as ComposedHarness } from './types-Dh1s4K9j.js';
3
3
 
4
4
  declare function compose(classification: Classification): ComposedHarness;
5
5
 
@@ -2,11 +2,13 @@ import { SingleComponentParams } from './harness/runtime.js';
2
2
  import { ModelRef } from '@ggui-ai/protocol';
3
3
  import { GadgetCatalogAdapter } from '@ggui-ai/gadgets';
4
4
  import { GeneratorTier, UiGenerator } from '@ggui-ai/mcp-server-core';
5
+ import { VisualEvalAgentSpec } from './adapters/generation-dispatch.js';
6
+ import { R as RuntimeRenderProbeConfig } from './adapter-Cg_rkpGq.js';
5
7
  import { GenerationResult } from './harness/result-types.js';
6
8
  import { D as DesignMode } from './design-mode-DLufhrNp.js';
7
- import { Q as QualityConfig } from './types-public-Ow-tNtFE.js';
9
+ import { Q as QualityConfig } from './types-public-BJTLpzWn.js';
8
10
  import { EvaluationConfig } from './evaluation/types.js';
9
- import { A as AgentConfig } from './llm-router-DwwUK1bz.js';
11
+ import { A as AgentConfig } from './llm-router-nfO7wPec.js';
10
12
 
11
13
  /**
12
14
  * `createUiGenerator` — full-harness UI generation factory.
@@ -44,16 +46,39 @@ import { A as AgentConfig } from './llm-router-DwwUK1bz.js';
44
46
 
45
47
  interface CreateUiGeneratorOptions {
46
48
  /**
47
- * Wire `DEFAULT_RUNTIME_RENDER_CHECK` into the harness's check leg.
48
- * When `true`, every coding turn ends with a happy-dom runtime-render
49
- * probe that catches contract-wiring bugs (missing `useAction()`,
50
- * wrong stream channel name, etc.).
49
+ * Wire the runtime-render check into the harness's check leg — one
50
+ * instance per generator, built from `runtimeRenderProbe` (the default
51
+ * bounds when it is absent). When `true`, the runtime-render probe runs
52
+ * ONCE at the exit decision,
53
+ * after the coding turns, in an isolated subprocess: it mounts the
54
+ * compiled component against the contract and catches crash-class and
55
+ * contract-wiring bugs (a render that throws, a missing `useAction()`,
56
+ * a wrong stream channel name). It is never on the per-turn hot path.
51
57
  *
52
- * Default: `false` for OSS — keeps cold-start light. The probe pulls
53
- * happy-dom + @testing-library on first use (~700-1500ms cold). Bench
54
- * enables it via dispatch's own default for stricter quality gating.
58
+ * Without an `evaluation` config the round is observe + one repair turn
59
+ * (ggui#1380): a recoverable render crash buys exactly one repair turn
60
+ * and one re-probe, then the generation serves what it has; a probe that
61
+ * timed out, could not run, or had nothing to probe never blocks and
62
+ * never repairs. The probe's status and timing ride the result's
63
+ * metadata (`runtimeProbe`, `evalMs`). With an `evaluation` config the
64
+ * probe is the evaluation round's exit gate instead.
65
+ *
66
+ * Default: `false` — keeps cold-start light. The probe pulls happy-dom
67
+ * + @testing-library on first use (~700-1500ms cold). A serving
68
+ * deployment that wants the probe's verdict on every card sets it.
55
69
  */
56
70
  readonly enableRuntimeRender?: boolean;
71
+ /**
72
+ * How the runtime-render probe runs its isolated worker (ggui#1380). A
73
+ * serving deployment sets the probe's wall-clock bound, worker heap and
74
+ * concurrency here; the defaults are the evaluation lane's (30 s, 512 MB,
75
+ * no concurrency cap). The generator builds ONE check from it and hands
76
+ * that instance to every generation it dispatches — the concurrency cap
77
+ * lives on the instance, so it bounds the workers this generator has
78
+ * live at once. Only read when `enableRuntimeRender` is on. Never part
79
+ * of the prompt or the identity.
80
+ */
81
+ readonly runtimeRenderProbe?: RuntimeRenderProbeConfig;
57
82
  /** Maximum coding attempts per generation pass. */
58
83
  readonly maxAttempts?: number;
59
84
  /** Maximum evaluation rounds. */
@@ -71,7 +96,14 @@ interface CreateUiGeneratorOptions {
71
96
  * stylesheet to render under). Forwarded verbatim; never part of the
72
97
  * prompt or the identity. Default: none — the round runs as today.
73
98
  */
74
- readonly visualEvaluation?: SingleComponentParams['visualEvaluation'];
99
+ readonly visualEvaluation?: SingleComponentParams["visualEvaluation"];
100
+ /**
101
+ * ggui#1250 — the in-loop VISUAL judge as its own agent (a vision provider, a model, and that
102
+ * provider's key when the caller resolves keys itself). Absent (default): the judge is the
103
+ * evaluation agent's provider, which on a lane without a vision path records the score half as
104
+ * skipped (#1248). Forwarded verbatim to the dispatch; never part of the prompt or the identity.
105
+ */
106
+ readonly visualEvalAgent?: VisualEvalAgentSpec;
75
107
  /** Quality config controlling eval tiers + improvement behavior. */
76
108
  readonly qualityConfig?: QualityConfig;
77
109
  /**
@@ -152,7 +184,7 @@ interface CreateUiGeneratorOptions {
152
184
  * request. Absent (default) is a no-op — retries still happen and
153
185
  * still log via `console.warn`, just without a caller-side hook.
154
186
  */
155
- readonly onRetry?: AgentConfig['onRetry'];
187
+ readonly onRetry?: AgentConfig["onRetry"];
156
188
  /**
157
189
  * Generation observer. Invoked once per successful `generate()` with
158
190
  * the FULL harness result — source, compiled code, token counters,
@@ -1,6 +1,6 @@
1
- import { DataContract } from '@ggui-ai/protocol';
2
- import { C as Classification } from './axes-CzLEMDeB.js';
3
- import { E as EvalIssue } from './types-public-Ow-tNtFE.js';
1
+ import { DataContract, JsonObject } from '@ggui-ai/protocol';
2
+ import { C as Classification } from './axes-CKVCzR_x.js';
3
+ import { E as EvalIssue } from './types-public-BJTLpzWn.js';
4
4
  import { D as DesignMode, C as CanvasClass } from './design-mode-DLufhrNp.js';
5
5
 
6
6
  interface RunAxisChecksInput {
@@ -12,6 +12,8 @@ interface RunAxisChecksInput {
12
12
  designMode?: DesignMode;
13
13
  /** The canvas the source is judged for — see `AxisCheckInput.canvas` (ggui#1117); absent = no rendering context. */
14
14
  canvas?: CanvasClass;
15
+ /** The props the source was rendered with — see `AxisCheckInput.fixtureProps` (ggui#1285); absent = the echo check stands down. */
16
+ fixtureProps?: JsonObject;
15
17
  }
16
18
  declare function runAxisChecks(classification: Classification, input: RunAxisChecksInput): EvalIssue[];
17
19
 
@@ -1,11 +1,12 @@
1
- export { R as RunAxisChecksInput, r as runAxisChecks } from '../../dispatch-wxaIMwZt.js';
1
+ export { R as RunAxisChecksInput, r as runAxisChecks } from '../../dispatch-CStl9eAw.js';
2
2
  export { REGISTRY } from './registry.js';
3
- import { A as AxisCheck } from '../../types-public-Ow-tNtFE.js';
4
- export { a as AxisCheckInput, m as matches } from '../../types-public-Ow-tNtFE.js';
3
+ import { A as AxisCheck } from '../../types-public-BJTLpzWn.js';
4
+ export { a as AxisCheckInput, m as matches } from '../../types-public-BJTLpzWn.js';
5
5
  import '@ggui-ai/protocol';
6
- import '../../axes-CzLEMDeB.js';
6
+ import '../../axes-CKVCzR_x.js';
7
7
  import '../../design-mode-DLufhrNp.js';
8
- import '../../types-BOvHNG7K.js';
8
+ import '@ggui-ai/mcp-server-core';
9
+ import '../../types-Dh1s4K9j.js';
9
10
 
10
11
  declare const EXTRA_CHECKS: readonly AxisCheck[];
11
12
 
@@ -569,6 +569,81 @@ function runActionLabelDropped(input) {
569
569
  )
570
570
  );
571
571
  }
572
+ var MIN_ECHO_CHARS = 12;
573
+ function collectStrings(value, out) {
574
+ if (typeof value === "string") {
575
+ out.push(value);
576
+ } else if (Array.isArray(value)) {
577
+ for (const v of value) collectStrings(v, out);
578
+ } else if (value !== null && typeof value === "object") {
579
+ for (const v of Object.values(value)) collectStrings(v, out);
580
+ }
581
+ }
582
+ function fixtureOnlyStrings(input) {
583
+ if (input.fixtureProps === void 0) return [];
584
+ const values = [];
585
+ collectStrings(input.fixtureProps, values);
586
+ const stated = `${input.originalPrompt}
587
+ ${input.contract === void 0 ? "" : JSON.stringify(input.contract)}`;
588
+ const seen = /* @__PURE__ */ new Set();
589
+ const out = [];
590
+ for (const v of values) {
591
+ const t = v.trim();
592
+ if (t.length < MIN_ECHO_CHARS || !t.includes(" ") || seen.has(t)) continue;
593
+ seen.add(t);
594
+ if (stated.includes(t)) continue;
595
+ out.push(t);
596
+ }
597
+ return out;
598
+ }
599
+ function runFixtureDefaultEcho(input) {
600
+ if (input.compiledCode === null) return [];
601
+ const src = input.sourceCode;
602
+ const issues = [];
603
+ for (const value of fixtureOnlyStrings(input)) {
604
+ if (!src.includes(value)) continue;
605
+ issues.push(
606
+ mkIssue(
607
+ "universal.fixture_default_echo",
608
+ `A literal in the source equals a fixture value the request never stated: "${value.length > 60 ? `${value.slice(0, 57)}\u2026` : value}". The fixture is judging data; a visitor sees this copy whenever the agent leaves the prop out.`,
609
+ "Take that copy from the prop it renders and drop the literal \u2014 no default, fallback or placeholder that repeats a fixture value. A default may only carry text the request itself states.",
610
+ "warn"
611
+ )
612
+ );
613
+ }
614
+ return issues;
615
+ }
616
+ var FORM_OPEN_RX = /<form\b[^<>]*\bonSubmit\s*=[^<>]*>/g;
617
+ var CONTROL_TAG_RX = /<(?:Button|button|input)\b[^<>]*>/g;
618
+ var SUBMIT_TYPE_RX = /\btype\s*=\s*(?:["']submit["']|\{\s*["']submit["']\s*\})/;
619
+ function submitForms(sourceCode) {
620
+ const out = [];
621
+ for (const m of sourceCode.matchAll(FORM_OPEN_RX)) {
622
+ const start = m.index ?? 0;
623
+ const end = sourceCode.indexOf("</form>", start + m[0].length);
624
+ out.push(end === -1 ? sourceCode.slice(start) : sourceCode.slice(start, end + "</form>".length));
625
+ }
626
+ return out;
627
+ }
628
+ function runFormSubmitControl(input) {
629
+ if (input.compiledCode === null) return [];
630
+ const issues = [];
631
+ for (const form of submitForms(input.sourceCode)) {
632
+ const controls = [...form.matchAll(CONTROL_TAG_RX)].map((m) => m[0]);
633
+ if (controls.length === 0) continue;
634
+ if (controls.some((tag) => SUBMIT_TYPE_RX.test(tag))) continue;
635
+ const named = controls.find((tag) => /<Button\b/.test(tag)) ?? controls[0];
636
+ issues.push(
637
+ mkIssue(
638
+ "universal.form_submit_control",
639
+ `A <form onSubmit> renders ${controls.length} control(s) and none submits it: the design Button defaults to type="button", so clicking ${named.length > 60 ? `${named.slice(0, 57)}\u2026` : named} does nothing \u2014 only Enter in a field submits.`,
640
+ 'Give the control that submits this form type="submit" \u2014 a Button inside a form defaults to type="button" and never submits on click; keep type="button" on the others.',
641
+ "fail"
642
+ )
643
+ );
644
+ }
645
+ return issues;
646
+ }
572
647
  var UNIVERSAL_CHECKS = [
573
648
  {
574
649
  id: "universal.icon_name_known",
@@ -606,6 +681,18 @@ var UNIVERSAL_CHECKS = [
606
681
  values: ALL_RENDER_VALUES,
607
682
  run: runTerminalActionUnguarded
608
683
  },
684
+ {
685
+ id: "universal.form_submit_control",
686
+ axis: "render",
687
+ values: ALL_RENDER_VALUES,
688
+ run: runFormSubmitControl
689
+ },
690
+ {
691
+ id: "universal.fixture_default_echo",
692
+ axis: "render",
693
+ values: ALL_RENDER_VALUES,
694
+ run: runFixtureDefaultEcho
695
+ },
609
696
  {
610
697
  id: "universal.accent_text_ink",
611
698
  axis: "render",
@@ -729,7 +816,7 @@ function runMapKeyIsId(input) {
729
816
  mkIssue(
730
817
  "render.map_key_is_id",
731
818
  `Array key uses index variable "${key}" \u2014 reorders and stream merges will break React reconciliation.`,
732
- `Replace key={${key}} with key={item.id} (or item.symbol / whatever the entity id field is).`
819
+ `Replace key={${key}} with key={item.id} \u2014 or, when the items carry no id, with the field that names each one (item.label / item.symbol / item.name).`
733
820
  )
734
821
  );
735
822
  }
@@ -1676,7 +1763,8 @@ function runAxisChecks(classification, input) {
1676
1763
  originalPrompt: input.originalPrompt,
1677
1764
  classification,
1678
1765
  ...input.designMode !== void 0 ? { designMode: input.designMode } : {},
1679
- ...input.canvas !== void 0 ? { canvas: input.canvas } : {}
1766
+ ...input.canvas !== void 0 ? { canvas: input.canvas } : {},
1767
+ ...input.fixtureProps !== void 0 ? { fixtureProps: input.fixtureProps } : {}
1680
1768
  };
1681
1769
  if (input.compiledCode === null) {
1682
1770
  traceAxisChecksSkipped(facts, "compiledCode null \u2014 no check ran");