@ggui-ai/ui-gen 0.25.0 → 0.27.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 (117) hide show
  1. package/README.md +2 -2
  2. package/dist/{adapter-Cg_rkpGq.d.ts → adapter-h4_V69LI.d.ts} +49 -1
  3. package/dist/adapters/base.d.ts +6 -1
  4. package/dist/adapters/base.js.map +1 -1
  5. package/dist/adapters/generation-dispatch.d.ts +8 -5
  6. package/dist/adapters/generation-dispatch.js +1174 -198
  7. package/dist/adapters/generation-dispatch.js.map +1 -1
  8. package/dist/adapters/index.js +59 -16
  9. package/dist/adapters/index.js.map +1 -1
  10. package/dist/advanced/index.d.ts +10 -9
  11. package/dist/advanced/index.js +1215 -216
  12. package/dist/advanced/index.js.map +1 -1
  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 +10 -5
  17. package/dist/boilerplate.js.map +1 -1
  18. package/dist/check/index.d.ts +3 -8
  19. package/dist/check/index.js +55 -2
  20. package/dist/check/index.js.map +1 -1
  21. package/dist/{create-ui-generator-DFnnArrv.d.ts → create-ui-generator-BrZHF0cf.d.ts} +3 -4
  22. package/dist/{design-mode-DLufhrNp.d.ts → design-mode-DGWN_Gkm.d.ts} +1 -1
  23. package/dist/{dispatch-CStl9eAw.d.ts → dispatch-B07TI30d.d.ts} +2 -2
  24. package/dist/evaluation/axis-checks/index.d.ts +5 -4
  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/index.d.ts +124 -546
  28. package/dist/evaluation/index.js +588 -65
  29. package/dist/evaluation/index.js.map +1 -1
  30. package/dist/evaluation/types.d.ts +17 -0
  31. package/dist/evaluation/types.js.map +1 -1
  32. package/dist/{generate-9IeNT4ZY.d.ts → generate-tSO_shQ0.d.ts} +1 -1
  33. package/dist/harness/check/runtime-render/index.d.ts +5 -5
  34. package/dist/harness/check/runtime-render/index.js +416 -92
  35. package/dist/harness/check/runtime-render/index.js.map +1 -1
  36. package/dist/harness/check/runtime-render/render-check-worker.js +393 -88
  37. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  38. package/dist/harness/index.d.ts +4 -5
  39. package/dist/harness/index.js +36 -7
  40. package/dist/harness/index.js.map +1 -1
  41. package/dist/harness/prompts.d.ts +2 -2
  42. package/dist/harness/prompts.js +7 -1
  43. package/dist/harness/prompts.js.map +1 -1
  44. package/dist/harness/result-types.d.ts +17 -3
  45. package/dist/harness/result-types.js.map +1 -1
  46. package/dist/harness/runtime.d.ts +14 -6
  47. package/dist/harness/runtime.js +13 -7
  48. package/dist/harness/runtime.js.map +1 -1
  49. package/dist/harness/types-public.d.ts +4 -2
  50. package/dist/harness/types-public.js +10 -5
  51. package/dist/harness/types-public.js.map +1 -1
  52. package/dist/harness/validator-trace-sink.d.ts +4 -3
  53. package/dist/index.d.ts +46 -11
  54. package/dist/index.js +1217 -214
  55. package/dist/index.js.map +1 -1
  56. package/dist/patch.d.ts +3 -3
  57. package/dist/{prompts-YU9piOgs.d.ts → prompts-BhNUuRoZ.d.ts} +1 -1
  58. package/dist/tools/render-check-worker.js +8 -1
  59. package/dist/tools/render-check-worker.js.map +1 -1
  60. package/dist/{types-public-BJTLpzWn.d.ts → types-public-h8IMnYuh.d.ts} +388 -3
  61. package/dist/validation/index.d.ts +1 -1
  62. package/dist/validation/index.js +1 -1
  63. package/dist/validation/index.js.map +1 -1
  64. package/dist/visual-evaluator-C2strxqD.d.ts +639 -0
  65. package/dist/workflows.d.ts +3 -3
  66. package/package.json +12 -12
  67. package/src/adapters/base.ts +6 -1
  68. package/src/adapters/claude/message-parser.ts +5 -6
  69. package/src/adapters/claude/sdk-tool-pins.ts +44 -0
  70. package/src/adapters/claude/sdk.ts +3 -3
  71. package/src/adapters/claude/source-capture.ts +20 -0
  72. package/src/adapters/generation-dispatch.ts +2 -0
  73. package/src/boilerplate/free-design-prompt.ts +3 -3
  74. package/src/boilerplate/hard-sections.ts +1 -1
  75. package/src/boilerplate/system-prompt.ts +3 -2
  76. package/src/boilerplate/templates/layouts/chat-mobile.tsx.tmpl +3 -1
  77. package/src/boilerplate/templates/layouts/chat-universal.tsx.tmpl +3 -1
  78. package/src/boilerplate/templates/layouts/fullscreen-desktop.tsx.tmpl +3 -1
  79. package/src/boilerplate/templates/layouts/fullscreen-universal.tsx.tmpl +3 -1
  80. package/src/check/run-tier0.ts +67 -3
  81. package/src/contract-context.ts +1 -1
  82. package/src/design-system-docs.ts +2 -1
  83. package/src/evaluation/cost-tracker.ts +54 -6
  84. package/src/evaluation/criteria/edge-probe.ts +286 -0
  85. package/src/evaluation/criteria/edge.ts +202 -0
  86. package/src/evaluation/criteria/resolve.ts +74 -8
  87. package/src/evaluation/index.ts +5 -1
  88. package/src/evaluation/judge-spend.ts +48 -0
  89. package/src/evaluation/loop.ts +25 -4
  90. package/src/evaluation/message-parsing.ts +11 -12
  91. package/src/evaluation/types-public.ts +95 -0
  92. package/src/evaluation/types.ts +10 -0
  93. package/src/evaluation/visual-evaluator.ts +236 -40
  94. package/src/harness/check/runtime-render/adapter.ts +18 -0
  95. package/src/harness/check/runtime-render/probe-pending.ts +111 -0
  96. package/src/harness/check/runtime-render/render-check-host.ts +10 -6
  97. package/src/harness/check/runtime-render/render-check-worker.ts +6 -3
  98. package/src/harness/check/runtime-render/render-check.ts +417 -133
  99. package/src/harness/check/runtime-render/walk.ts +200 -0
  100. package/src/harness/coding/assemble-result.ts +2 -0
  101. package/src/harness/coding/generate-task-runner.ts +27 -0
  102. package/src/harness/coding/init-session.ts +5 -3
  103. package/src/harness/coding/run-coding-turn.ts +5 -1
  104. package/src/harness/coding/run-eval-round.ts +63 -3
  105. package/src/harness/in-loop-evaluation.ts +39 -0
  106. package/src/harness/llm-router.ts +58 -1
  107. package/src/harness/result-types.ts +9 -0
  108. package/src/harness/runtime.ts +9 -0
  109. package/src/harness/types-public.ts +10 -1
  110. package/src/index.ts +5 -0
  111. package/src/internal/verdict-line.ts +33 -0
  112. package/src/taught-tokens.ts +31 -0
  113. package/src/tools/render-check-worker.ts +2 -1
  114. package/src/tools/render-check.ts +8 -7
  115. package/src/validation/primitives.ts +1 -1
  116. package/dist/llm-router-nfO7wPec.d.ts +0 -267
  117. package/dist/{bank-CT4eEkta.d.ts → bank-Ctdp3FUA.d.ts} +3 -3
@@ -1,7 +1,7 @@
1
1
  import { Harness } from './types-public.js';
2
2
  export { CheckLeg, CheckResult, CreateHarnessInput, DefaultTaskRunner, HarnessConstructionContext, HarnessId, HarnessMeta, HarnessName, HarnessOverrides, HarnessRevision, HowLeg, IterationRecord, LLMEvaluator, PatchFn, Phase, PhaseRunResult, PlannerDecision, PlannerFn, ProcessLeg, PromptBuilder, RetryPolicy, RunCheckInput, RunHarnessInput, RunHarnessReason, RunHarnessResult, RunWorkflowInput, Task, TaskContext, TaskRunner, TierCheck, WhatLeg, Workflow, WorkflowRunResult, createHarness, runCheck, runHarness, runWorkflow } from './types-public.js';
3
3
  export { applyLineRanges, defaultApplyPatch } from '../patch.js';
4
- export { A as AgentConfig, L as LLMResponse, P as ProviderRetryInfo, c as callLLM, a as createAgent } from '../llm-router-nfO7wPec.js';
4
+ export { b as AgentConfig, L as LLMResponse, P as ProviderRetryInfo, c as callLLM, d as createAgent } from '../types-public-h8IMnYuh.js';
5
5
  export { WORKFLOWS, WorkflowId, pickWorkflow } from '../workflows.js';
6
6
  export { LlmTraceEvent, LlmTraceKind, LlmTraceProvider, LlmTraceSink, getLlmTraceSink, setLlmTraceSink } from './llm-trace-sink.js';
7
7
  export { ValidatorTraceEvent, ValidatorTraceSink, getValidatorTraceSink, setValidatorTraceSink } from './validator-trace-sink.js';
@@ -10,11 +10,10 @@ export { computeHarnessId, computeHarnessName, hashClassification } from '../has
10
10
  import '@ggui-ai/protocol';
11
11
  import '../styling-profile-CxfvV48g.js';
12
12
  import '../axes-CKVCzR_x.js';
13
- import '../types-public-BJTLpzWn.js';
14
- import '@ggui-ai/mcp-server-core';
15
- import '../design-mode-DLufhrNp.js';
16
- import '../types-Dh1s4K9j.js';
17
13
  import '../llm.js';
14
+ import '../types-Dh1s4K9j.js';
15
+ import '../design-mode-DGWN_Gkm.js';
16
+ import '@ggui-ai/mcp-server-core';
18
17
 
19
18
  /**
20
19
  * Fingerprint a materialized Harness. `h.id` is already a deterministic
@@ -1650,6 +1650,10 @@ ${body}
1650
1650
  AXIS_SECTIONS: composedSections ?? ""
1651
1651
  }, designMode);
1652
1652
  }
1653
+ var NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([]);
1654
+ var taughtTokenManifest = consumedTokenManifest.filter(
1655
+ (token) => !NOT_YET_TAUGHT_TOKENS.has(token)
1656
+ );
1653
1657
 
1654
1658
  // src/boilerplate/hard-sections.ts
1655
1659
  var PROTOCOL_NOTES = `## Protocol Notes
@@ -1859,7 +1863,7 @@ The width works the same way, and the mistake is the mirror image: **your outerm
1859
1863
 
1860
1864
  - Never put \`maxWidth\` (or a \`max-w-*\` class) on the element you return at the top. On a wide canvas that turns your card into a narrow strip with the frame's ground on either side of it, and on a narrow one it does nothing \u2014 the same composition reading differently at two sizes.
1861
1865
  - DO cap the reading measure inside: a column of prose is easiest to read at 60\u201370 characters, so wrap the TEXT in a \`<Container maxWidth="sm">\` (or your own \`max-width\`) and leave the root filling. A hero band, a toolbar, a table or an image then still uses the whole width, which is what makes a wide card look composed rather than padded.
1862
- - Centre that inner column with the container's own centring, not by shrinking the root.
1866
+ - Centre that inner column with the container's own centring, not by shrinking the root \u2014 and give the card ONE column: every block of the reading flow (a heading, its text, and the chips or buttons that answer it) sits in a \`<Container>\` of the same \`maxWidth\`, so their left edges line up even where a full-width band runs between them.
1863
1867
  - **They are two different elements.** Even when the whole card is one column of text, the root still fills and the column sits INSIDE it \u2014 \`<Box padding="lg"><Container maxWidth="sm">\u2026</Container></Box>\`, never a root that is itself the container. A centred card is centring inside a filled frame, not a shrunken frame.`;
1864
1868
  var COMPONENT_STRUCTURE = `## Component Structure
1865
1869
 
@@ -1936,7 +1940,7 @@ function colorVocabularyFromManifest(manifest) {
1936
1940
  function renderRamp(r) {
1937
1941
  return `\`${r.family}-${r.steps.join("/")}\`${r.bare ? ` (plus bare \`${r.family}\`)` : ""}`;
1938
1942
  }
1939
- function renderFreeColorRule(manifest = consumedTokenManifest) {
1943
+ function renderFreeColorRule(manifest = taughtTokenManifest) {
1940
1944
  const { ramps, roles } = colorVocabularyFromManifest(manifest);
1941
1945
  const brand = ramps.filter((r) => r.family === "primary" || r.family === "neutral");
1942
1946
  const state = ramps.filter((r) => r.family !== "primary" && r.family !== "neutral");
@@ -2026,7 +2030,7 @@ var TOKEN_GROUPS = [
2026
2030
  { label: "Radius (optional)", prefixes: ["--ggui-shape-radius-"], note: "" },
2027
2031
  { label: "Shadow (optional)", prefixes: ["--ggui-shape-shadow-"], note: "" }
2028
2032
  ];
2029
- function renderTokenVocabulary(manifest = consumedTokenManifest) {
2033
+ function renderTokenVocabulary(manifest = taughtTokenManifest) {
2030
2034
  const sorted = [...manifest].sort();
2031
2035
  const claimed = /* @__PURE__ */ new Set();
2032
2036
  const lines = [
@@ -2558,13 +2562,14 @@ MANDATORY:
2558
2562
  2. NEVER use CSS gradients with custom colors. If you need a gradient: \`linear-gradient(to bottom, var(--ggui-color-primary-500), var(--ggui-color-primary-700))\`.
2559
2563
  3. NEVER invent your own palette. The system provides primary, neutral, success, warning, error, and info \u2014 use ONLY these.
2560
2564
  4. NEVER include literal fallback values in ANY token reference \u2014 colors, spacing, typography, radius, shadows alike. Write \`var(--ggui-spacing-4)\` bare, never \`var(--ggui-spacing-4, 16px)\`; \`var(--ggui-color-primary-600)\` bare, never \`var(--ggui-color-primary-600, #0284c7)\`. The runtime injects every token; a literal fallback paints the wrong value exactly when the operator's theme matters most.
2565
+ 5. NEVER set an inline \`border\`, \`borderColor\`, \`borderWidth\` or \`borderStyle\` on a kit control \u2014 \`Button\`, \`Input\`, \`Select\`, \`TextArea\`, \`Checkbox\`, \`RadioGroup\`, \`Toggle\`, \`SearchField\`. The control draws its own boundary, and it clears 3:1 on its surface in every theme: an outline chip is \`<Button variant="outline">\` exactly as it comes (its edge is \`controlAccentOutline\`). Where you draw a control-like edge on your own element, use \`var(--ggui-color-controlOutline)\`. A ramp step such as \`primary-200\` as a control's border is nearly invisible (about 1.1:1).
2561
2566
 
2562
2567
  Token categories:
2563
2568
  - Brand fills: \`var(--ggui-color-primary-600)\`, \`var(--ggui-color-primary-50)\`
2564
2569
  - Accent text: \`var(--ggui-color-link)\` \u2014 eyebrows, taglines, links, labels; readable per mode (never a bare \`primary-<stop>\` as a text color)
2565
2570
  - Text: \`var(--ggui-color-onContainer)\`, \`var(--ggui-color-onSunken)\`
2566
2571
  - Backgrounds: \`var(--ggui-color-container)\`, \`var(--ggui-color-sunken)\`
2567
- - Borders: \`var(--ggui-color-outline)\`
2572
+ - Borders: \`var(--ggui-color-outline)\` \u2014 dividers and the edges of non-interactive boxes; a control's edge is the kit's (rule 5)
2568
2573
  - Spacing: \`var(--ggui-spacing-4)\`, \`var(--ggui-spacing-6)\`
2569
2574
  - Typography: \`var(--ggui-font-size-sm)\`, \`var(--ggui-font-weight-semibold)\`
2570
2575
  - Shadows: \`var(--ggui-shape-shadow-sm)\`, \`var(--ggui-shape-shadow-md)\`, \`var(--ggui-shape-shadow-lg)\`
@@ -2579,7 +2584,7 @@ Use the FULL primary palette throughout the component \u2014 NOT only on submit
2579
2584
  | Element | Token | Purpose |
2580
2585
  |---------|-------|---------|
2581
2586
  | Section headers, hero areas, highlight strips | \`primary-50\` / \`primary-100\` | Subtle branded backgrounds |
2582
- | Borders, dividers, focus rings, input focus | \`primary-200\` / \`primary-300\` | Branded structure |
2587
+ | Dividers, section rules, edges of non-interactive boxes | \`primary-200\` / \`primary-300\` | Branded structure \u2014 never a control's border (rule 5) |
2583
2588
  | Accent TEXT \u2014 eyebrows, taglines, links, labels, inline arrows | \`link\` (\`var(--ggui-color-link)\`) or \`<Text tone="emphasized">\` | The brand's READABLE ink, derived per mode to clear 4.5:1 \u2014 a bare \`primary-300\u2026600\` as a text color fails tier-0 |
2584
2589
  | Icon fills, badges, active indicators | \`primary-500\` / \`primary-600\` | Core accent fill |
2585
2590
  | Buttons, CTAs, filled interactive elements | \`primary-600\` / \`primary-700\` | Primary actions |
@@ -3649,6 +3654,26 @@ async function collectLoginTurn(stream, opts) {
3649
3654
  }
3650
3655
 
3651
3656
  // src/harness/llm-router.ts
3657
+ function servedModelOf(name) {
3658
+ return typeof name === "string" && name.length > 0 ? { servedModel: name } : {};
3659
+ }
3660
+ function anthropicFinishReason(stopReason) {
3661
+ if (stopReason === null || stopReason === void 0) return void 0;
3662
+ if (stopReason === "end_turn" || stopReason === "stop_sequence") return "stop";
3663
+ if (stopReason === "max_tokens") return "length";
3664
+ if (stopReason === "refusal") return "content-filter";
3665
+ return "other";
3666
+ }
3667
+ function googleFinishReason(finishReason) {
3668
+ if (finishReason === null || finishReason === void 0) return void 0;
3669
+ if (finishReason === "STOP") return "stop";
3670
+ if (finishReason === "MAX_TOKENS") return "length";
3671
+ if (["SAFETY", "RECITATION", "BLOCKLIST", "PROHIBITED_CONTENT", "SPII", "IMAGE_SAFETY"].includes(finishReason)) return "content-filter";
3672
+ return "other";
3673
+ }
3674
+ function visionFinish(finishReason) {
3675
+ return finishReason !== void 0 ? { finishReason } : {};
3676
+ }
3652
3677
  function addStrictSchemaConstraints(schema) {
3653
3678
  const result = { ...schema };
3654
3679
  if (result.type === "object" && result.properties) {
@@ -3999,7 +4024,9 @@ var AnthropicAgent = class extends LLMAgent {
3999
4024
  return {
4000
4025
  text,
4001
4026
  inputTokens: response.usage.input_tokens,
4002
- outputTokens: response.usage.output_tokens
4027
+ outputTokens: response.usage.output_tokens,
4028
+ ...visionFinish(anthropicFinishReason(response.stop_reason)),
4029
+ ...servedModelOf(response.model)
4003
4030
  };
4004
4031
  } catch (e) {
4005
4032
  const endedAt = Date.now();
@@ -4670,7 +4697,9 @@ var GoogleAgent = class extends LLMAgent {
4670
4697
  text,
4671
4698
  // ggui#1186 (third site): `promptTokenCount` includes `cachedContentTokenCount` — report the non-cached input.
4672
4699
  inputTokens: splitCacheInclusiveUsage(usage?.promptTokenCount ?? 0, usage?.candidatesTokenCount ?? 0, usage?.cachedContentTokenCount ?? 0).tokens.input,
4673
- outputTokens: usage?.candidatesTokenCount ?? 0
4700
+ outputTokens: usage?.candidatesTokenCount ?? 0,
4701
+ ...visionFinish(googleFinishReason(response.candidates?.[0]?.finishReason)),
4702
+ ...servedModelOf(response.modelVersion)
4674
4703
  };
4675
4704
  const endedAt = Date.now();
4676
4705
  emitLlmTraceEvent({