@ggui-ai/ui-gen 0.8.0 → 0.10.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 (100) hide show
  1. package/dist/adapters/generation-dispatch.d.ts +18 -1
  2. package/dist/adapters/generation-dispatch.js +819 -1577
  3. package/dist/adapters/generation-dispatch.js.map +1 -1
  4. package/dist/adapters/index.js +28 -11
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/advanced/index.d.ts +5 -3
  7. package/dist/advanced/index.js +838 -1579
  8. package/dist/advanced/index.js.map +1 -1
  9. package/dist/blueprint-validator.js +109 -3
  10. package/dist/blueprint-validator.js.map +1 -1
  11. package/dist/boilerplate.js +17 -4
  12. package/dist/boilerplate.js.map +1 -1
  13. package/dist/check/index.d.ts +1 -1
  14. package/dist/check/index.js +11 -1
  15. package/dist/check/index.js.map +1 -1
  16. package/dist/compose.js +5 -5
  17. package/dist/compose.js.map +1 -1
  18. package/dist/{create-ui-generator-GX7tvbyH.d.ts → create-ui-generator-CF0EL0Li.d.ts} +26 -1
  19. package/dist/{dispatch-Deo9qzrG.d.ts → dispatch-D75M-OfZ.d.ts} +1 -1
  20. package/dist/evaluation/axis-checks/index.d.ts +3 -3
  21. package/dist/evaluation/axis-checks/index.js +133 -1
  22. package/dist/evaluation/axis-checks/index.js.map +1 -1
  23. package/dist/evaluation/axis-checks/registry.d.ts +1 -1
  24. package/dist/evaluation/axis-checks/registry.js +133 -1
  25. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  26. package/dist/evaluation/index.d.ts +46 -3
  27. package/dist/evaluation/index.js +410 -24
  28. package/dist/evaluation/index.js.map +1 -1
  29. package/dist/fragments/index.js +5 -5
  30. package/dist/fragments/index.js.map +1 -1
  31. package/dist/harness/check/runtime-render/index.d.ts +2 -2
  32. package/dist/harness/check/runtime-render/index.js +110 -3
  33. package/dist/harness/check/runtime-render/index.js.map +1 -1
  34. package/dist/harness/index.d.ts +5 -126
  35. package/dist/harness/index.js +292 -32
  36. package/dist/harness/index.js.map +1 -1
  37. package/dist/harness/llm-trace-sink.d.ts +1 -1
  38. package/dist/harness/llm-trace-sink.js.map +1 -1
  39. package/dist/harness/prompts.js +17 -3
  40. package/dist/harness/prompts.js.map +1 -1
  41. package/dist/harness/result-types.d.ts +1 -1
  42. package/dist/harness/runtime.d.ts +17 -1
  43. package/dist/harness/runtime.js +23 -8
  44. package/dist/harness/runtime.js.map +1 -1
  45. package/dist/harness/types-public.d.ts +1 -1
  46. package/dist/harness/types-public.js +22 -9
  47. package/dist/harness/types-public.js.map +1 -1
  48. package/dist/harness/validator-trace-sink.d.ts +1 -1
  49. package/dist/index.d.ts +5 -3
  50. package/dist/index.js +838 -1579
  51. package/dist/index.js.map +1 -1
  52. package/dist/llm-router-BEVtbAb9.d.ts +213 -0
  53. package/dist/patch.d.ts +1 -1
  54. package/dist/provider-adapter.d.ts +16 -6
  55. package/dist/provider-adapter.js.map +1 -1
  56. package/dist/providers/index.d.ts +54 -99
  57. package/dist/providers/index.js +13 -8
  58. package/dist/providers/index.js.map +1 -1
  59. package/dist/{render-check-CNZjHD5g.d.ts → render-check-BNYGVDJd.d.ts} +1 -1
  60. package/dist/{types-public-C36k1q6s.d.ts → types-public-DIpjC-OA.d.ts} +1 -1
  61. package/dist/validation/index.js +2 -2
  62. package/dist/validation/index.js.map +1 -1
  63. package/dist/workflows.d.ts +1 -1
  64. package/package.json +18 -18
  65. package/src/adapters/generation-dispatch.ts +28 -2
  66. package/src/adapters/openrouter/client.ts +2 -2
  67. package/src/adapters/openrouter/types.ts +10 -0
  68. package/src/boilerplate/generate.ts +10 -2
  69. package/src/boilerplate/json-schema-ts.ts +22 -2
  70. package/src/boilerplate/system-prompt.ts +4 -2
  71. package/src/compile.ts +1 -1
  72. package/src/contract-context.ts +10 -2
  73. package/src/create-ui-generator.ts +58 -11
  74. package/src/design-system-docs.ts +6 -4
  75. package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
  76. package/src/evaluation/axis-checks/checks/state-ui-affordance.ts +162 -0
  77. package/src/evaluation/axis-checks/checks/universal.ts +39 -0
  78. package/src/evaluation/axis-checks/registry.ts +2 -0
  79. package/src/evaluation/index.ts +11 -0
  80. package/src/evaluation/llm-evaluator.ts +26 -3
  81. package/src/evaluation/visual-evaluator.ts +49 -66
  82. package/src/fragments/realtime.ts +3 -3
  83. package/src/fragments/state.ts +2 -2
  84. package/src/harness/check/runtime-render/adapter.ts +18 -0
  85. package/src/harness/check/runtime-render/index.ts +8 -0
  86. package/src/harness/check/runtime-render/prepare-mockup.ts +14 -0
  87. package/src/harness/check/runtime-render/production-act-shim.ts +158 -0
  88. package/src/harness/check/runtime-render/render-check.ts +72 -1
  89. package/src/harness/coding/init-session.ts +4 -1
  90. package/src/harness/coding/run-eval-round.ts +67 -5
  91. package/src/harness/index.ts +1 -1
  92. package/src/harness/llm-router.ts +451 -27
  93. package/src/harness/llm-trace-sink.ts +2 -1
  94. package/src/harness/runtime.ts +15 -0
  95. package/src/index.ts +5 -5
  96. package/src/provider-adapter.ts +16 -6
  97. package/src/providers/bedrock.ts +89 -26
  98. package/src/providers/index.ts +16 -4
  99. package/src/tools/render-check.ts +19 -7
  100. package/src/validation/ui-compiler.ts +2 -2
@@ -121,6 +121,29 @@ export interface EvalRoundResult {
121
121
  /** Cap feedback to N issues per eval-fix turn so the LLM stays surgical. */
122
122
  const MAX_FEEDBACK_ISSUES = 3;
123
123
 
124
+ /**
125
+ * Pick the ≤{@link MAX_FEEDBACK_ISSUES} issues an eval-fix turn feeds
126
+ * back. Provenance-aware (Exp 54 P1 addendum): ONE slot is reserved
127
+ * for the first deterministic tier-0 fail (axis/mode checks —
128
+ * machine-verified findings) when one exists; the rest fill
129
+ * fails-first then warns. Without the reservation, the merge order
130
+ * put deterministic findings last and any round with ≥3 LLM-judge
131
+ * fails silently starved them — the model never saw a precision-1.00
132
+ * structural finding while the stuck detector blamed it for not
133
+ * fixing it. Exactly one slot, so crash-class LLM fails keep the
134
+ * other two. Exported for the pins.
135
+ */
136
+ export function selectActionableFeedback(issues: readonly EvalIssue[]): EvalIssue[] {
137
+ const pool = issues.filter((i) => i.result === "fail" || i.result === "warn");
138
+ const reserved = pool.find((i) => i.tier === 0 && i.result === "fail");
139
+ return [
140
+ ...(reserved ? [reserved] : []),
141
+ ...pool
142
+ .filter((i) => i !== reserved)
143
+ .sort((a, b) => (a.result === "fail" ? 0 : 1) - (b.result === "fail" ? 0 : 1)),
144
+ ].slice(0, MAX_FEEDBACK_ISSUES);
145
+ }
146
+
124
147
  /**
125
148
  * Fingerprint a fail issue for cross-round stuck detection. Identifies the
126
149
  * "same fail" without being thrown by minor description-text variation.
@@ -418,6 +441,19 @@ export async function runEvalRound(
418
441
  {
419
442
  provider: mapProviderForEvaluator(evaluationAgent.provider),
420
443
  model: evaluationAgent.model,
444
+ // #484 — thread the coding-agent's routing override
445
+ // through to the evaluator so its LLM call never falls
446
+ // back to `process.env` either (the eval calls run
447
+ // inside the same concurrent generation, so the race is
448
+ // real here too, not just on the coding turn).
449
+ routeOverride: evaluationAgent.routeOverride,
450
+ // #489 — thread the same provider-429-retry observer.
451
+ // Without this, a rate-limited retry inside the
452
+ // evaluation agent's apiCall() happens (the base-class
453
+ // retry loop is unconditional) but never reaches the
454
+ // caller, silently missing the host application's
455
+ // structured log.
456
+ onRetry: evaluationAgent.onRetry,
421
457
  },
422
458
  preWarmedContext,
423
459
  )
@@ -431,6 +467,14 @@ export async function runEvalRound(
431
467
  passThreshold: visualThreshold,
432
468
  sampleProps: visualEvaluation?.sampleProps,
433
469
  viewport: visualEvaluation?.viewport,
470
+ // #484/#489 — same threading as the LLM-eval leg above:
471
+ // the visual eval's multimodal call runs inside the same
472
+ // concurrent generation, so it needs the same routing
473
+ // override (never fall back to `process.env`) and the
474
+ // same provider-429-retry observer (retries reach the
475
+ // host application's structured log).
476
+ routeOverride: visualEvalAgent.routeOverride,
477
+ onRetry: visualEvalAgent.onRetry,
434
478
  },
435
479
  )
436
480
  : null,
@@ -752,10 +796,19 @@ export async function runEvalRound(
752
796
  // Feeding too many issues at once causes the LLM to make many simultaneous
753
797
  // changes, breaking JSX nesting in complex components. Prioritize fails
754
798
  // first, then warns, capped to keep fixes surgical.
755
- const allActionable = evalResult.issues
756
- .filter((i) => i.result === "fail" || i.result === "warn")
757
- .sort((a, b) => (a.result === "fail" ? 0 : 1) - (b.result === "fail" ? 0 : 1))
758
- .slice(0, MAX_FEEDBACK_ISSUES);
799
+ //
800
+ // Provenance-aware selection (Exp 54 P1 addendum): deterministic
801
+ // tier-0 fails (axis/mode checks — machine-verified, precision-1.00
802
+ // findings) get ONE reserved slot, first. Before this, the merge
803
+ // order (`allIssues = [...llm, ...visual, ...mode]`) + stable sort
804
+ // + slice meant any round where the LLM leg emitted ≥3 fails
805
+ // silently starved every deterministic finding — the model never
806
+ // saw it, the fingerprint set still recorded it, and the stuck
807
+ // detector exited on an issue that was never delivered (2/9 cells
808
+ // shipped a P0 structural defect this way, one displaced by
809
+ // design-token nits). Exactly one slot is reserved so crash-class
810
+ // LLM fails keep the other two.
811
+ const allActionable = selectActionableFeedback(evalResult.issues);
759
812
  const issueLines = allActionable.map((issue) => {
760
813
  const tag = issue.result === "fail" ? "FAIL" : "WARN";
761
814
  return `[${tag}] ${issue.category}${issue.subcategory ? "/" + issue.subcategory : ""}: ${issue.description}\n Fix: ${issue.fix}`;
@@ -771,7 +824,16 @@ export async function runEvalRound(
771
824
  evalResult,
772
825
  evalRoundsUsed,
773
826
  prevModeSubcats: updatedPrevModeSubcats,
774
- prevFailFingerprints: currFailFingerprints,
827
+ // DELIVERED fails only (Exp 54 P1 addendum, proposal 2): the
828
+ // stuck detector's premise is "the LLM saw these and did not
829
+ // resolve them" — recording fails that the MAX_FEEDBACK_ISSUES
830
+ // cap cut from the feedback turns truncation into a premature
831
+ // stuck-exit (the model never saw the issue it is blamed for
832
+ // not fixing). An undelivered fail recurring next round now
833
+ // reads as NEW, gets delivered, and earns its fix round.
834
+ prevFailFingerprints: new Set(
835
+ allActionable.filter((i) => i.result === "fail").map(fingerprintFail),
836
+ ),
775
837
  preWarmedContext,
776
838
  evalTokens,
777
839
  evalLlmMs,
@@ -27,7 +27,7 @@ export type {
27
27
  } from "./types-public.js";
28
28
  export { defaultApplyPatch, applyLineRanges } from "../patch.js";
29
29
  export { callLLM, createAgent } from "./llm-router.js";
30
- export type { AgentConfig, LLMResponse } from "./llm-router.js";
30
+ export type { AgentConfig, LLMResponse, ProviderRetryInfo } from "./llm-router.js";
31
31
  export {
32
32
  computeHarnessId,
33
33
  computeHarnessName,