@ggui-ai/ui-gen 0.26.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 (60) hide show
  1. package/dist/{adapter-BJwn74rx.d.ts → adapter-h4_V69LI.d.ts} +1 -1
  2. package/dist/adapters/base.d.ts +6 -1
  3. package/dist/adapters/base.js.map +1 -1
  4. package/dist/adapters/generation-dispatch.d.ts +2 -2
  5. package/dist/adapters/generation-dispatch.js +61 -10
  6. package/dist/adapters/generation-dispatch.js.map +1 -1
  7. package/dist/adapters/index.js +36 -14
  8. package/dist/adapters/index.js.map +1 -1
  9. package/dist/advanced/index.d.ts +4 -4
  10. package/dist/advanced/index.js +94 -19
  11. package/dist/advanced/index.js.map +1 -1
  12. package/dist/boilerplate.js +4 -6
  13. package/dist/boilerplate.js.map +1 -1
  14. package/dist/check/index.d.ts +1 -7
  15. package/dist/check/index.js +50 -4
  16. package/dist/check/index.js.map +1 -1
  17. package/dist/{create-ui-generator-N4gRXpcL.d.ts → create-ui-generator-BrZHF0cf.d.ts} +2 -2
  18. package/dist/{dispatch-BUoXRj_r.d.ts → dispatch-B07TI30d.d.ts} +1 -1
  19. package/dist/evaluation/axis-checks/index.d.ts +3 -3
  20. package/dist/evaluation/axis-checks/index.js.map +1 -1
  21. package/dist/evaluation/axis-checks/registry.d.ts +1 -1
  22. package/dist/evaluation/index.d.ts +22 -12
  23. package/dist/evaluation/index.js +36 -10
  24. package/dist/evaluation/index.js.map +1 -1
  25. package/dist/evaluation/types.d.ts +1 -1
  26. package/dist/harness/check/runtime-render/index.d.ts +3 -3
  27. package/dist/harness/index.d.ts +1 -1
  28. package/dist/harness/index.js +4 -6
  29. package/dist/harness/index.js.map +1 -1
  30. package/dist/harness/prompts.js +1 -4
  31. package/dist/harness/prompts.js.map +1 -1
  32. package/dist/harness/result-types.d.ts +2 -2
  33. package/dist/harness/runtime.d.ts +1 -1
  34. package/dist/harness/runtime.js +6 -7
  35. package/dist/harness/runtime.js.map +1 -1
  36. package/dist/harness/types-public.d.ts +1 -1
  37. package/dist/harness/types-public.js +4 -6
  38. package/dist/harness/types-public.js.map +1 -1
  39. package/dist/harness/validator-trace-sink.d.ts +1 -1
  40. package/dist/index.d.ts +5 -5
  41. package/dist/index.js +94 -19
  42. package/dist/index.js.map +1 -1
  43. package/dist/patch.d.ts +1 -1
  44. package/dist/{types-public-B7wn4ce5.d.ts → types-public-h8IMnYuh.d.ts} +4 -0
  45. package/dist/{visual-evaluator-C9L-o6ap.d.ts → visual-evaluator-C2strxqD.d.ts} +1 -1
  46. package/dist/workflows.d.ts +1 -1
  47. package/package.json +12 -12
  48. package/src/adapters/base.ts +6 -1
  49. package/src/adapters/claude/message-parser.ts +5 -6
  50. package/src/adapters/claude/sdk-tool-pins.ts +44 -0
  51. package/src/adapters/claude/sdk.ts +3 -3
  52. package/src/adapters/claude/source-capture.ts +20 -0
  53. package/src/boilerplate/system-prompt.ts +3 -2
  54. package/src/check/run-tier0.ts +61 -0
  55. package/src/design-system-docs.ts +2 -1
  56. package/src/evaluation/criteria/resolve.ts +19 -1
  57. package/src/evaluation/loop.ts +25 -4
  58. package/src/evaluation/message-parsing.ts +11 -12
  59. package/src/evaluation/types-public.ts +4 -0
  60. package/src/taught-tokens.ts +5 -6
@@ -1,11 +1,11 @@
1
1
  import { GeneratorTier, UiGenerator } from '@ggui-ai/mcp-server-core';
2
2
  import { ModelRef, JsonObject } from '@ggui-ai/protocol';
3
3
  import { BehaviorFailure, PlaywrightModule } from '@ggui-ai/ui-visual-tester';
4
- import { C as CreateUiGeneratorOptions } from '../create-ui-generator-N4gRXpcL.js';
5
- import { a as RenderCheckIssue } from '../adapter-BJwn74rx.js';
4
+ import { C as CreateUiGeneratorOptions } from '../create-ui-generator-BrZHF0cf.js';
5
+ import { a as RenderCheckIssue } from '../adapter-h4_V69LI.js';
6
6
  import '../harness/runtime.js';
7
7
  import '../styling-profile-CxfvV48g.js';
8
- import '../types-public-B7wn4ce5.js';
8
+ import '../types-public-h8IMnYuh.js';
9
9
  import '../llm.js';
10
10
  import '../design-mode-DGWN_Gkm.js';
11
11
  import '../axes-CKVCzR_x.js';
@@ -21,7 +21,7 @@ import '../policy.js';
21
21
  import '../harness/result-types.js';
22
22
  import '../adapters/types.js';
23
23
  import '../prompts-BhNUuRoZ.js';
24
- import '../visual-evaluator-C9L-o6ap.js';
24
+ import '../visual-evaluator-C2strxqD.js';
25
25
  import 'puppeteer-core';
26
26
 
27
27
  /**
@@ -338,6 +338,21 @@ var init_raw = __esm({
338
338
  }
339
339
  });
340
340
 
341
+ // src/adapters/claude/source-capture.ts
342
+ function sourceCodeFromToolUse(name, input) {
343
+ if (typeof name !== "string") return void 0;
344
+ const field2 = name === "Write" ? "content" : name.endsWith(COMPILE_TOOL_SUFFIX) ? "code" : void 0;
345
+ if (field2 === void 0 || typeof input !== "object" || input === null) return void 0;
346
+ const value = Reflect.get(input, field2);
347
+ return typeof value === "string" && value.length > 0 ? value : void 0;
348
+ }
349
+ var COMPILE_TOOL_SUFFIX;
350
+ var init_source_capture = __esm({
351
+ "src/adapters/claude/source-capture.ts"() {
352
+ COMPILE_TOOL_SUFFIX = "__compile_component";
353
+ }
354
+ });
355
+
341
356
  // src/adapters/claude/message-parser.ts
342
357
  function createArtifacts() {
343
358
  return {
@@ -457,12 +472,9 @@ function extractSourceCode(message, artifacts) {
457
472
  const content = assistantMsg.message?.content;
458
473
  if (!Array.isArray(content)) return;
459
474
  for (const block of content) {
460
- if (block.type === "tool_use" && block.name === "Write") {
461
- const input = block.input;
462
- if (input?.content) {
463
- artifacts.sourceCode = input.content;
464
- }
465
- }
475
+ if (block.type !== "tool_use") continue;
476
+ const value = sourceCodeFromToolUse(block.name, block.input);
477
+ if (value !== void 0) artifacts.sourceCode = value;
466
478
  }
467
479
  }
468
480
  function unescapeJsonString(s) {
@@ -500,6 +512,7 @@ function extractGeneratorMeta(message, artifacts) {
500
512
  }
501
513
  var init_message_parser = __esm({
502
514
  "src/adapters/claude/message-parser.ts"() {
515
+ init_source_capture();
503
516
  }
504
517
  });
505
518
 
@@ -595,6 +608,17 @@ var init_claude_code_login = __esm({
595
608
  }
596
609
  });
597
610
 
611
+ // src/adapters/claude/sdk-tool-pins.ts
612
+ function sdkToolPins(input) {
613
+ const builtins = [...input.builtinTools ?? []];
614
+ const approved = input.allowedTools !== void 0 ? [...input.allowedTools] : Object.keys(input.mcpServers ?? {}).map((name) => `mcp__${name}`);
615
+ return { tools: builtins, settingSources: [], allowedTools: [...approved, ...builtins] };
616
+ }
617
+ var init_sdk_tool_pins = __esm({
618
+ "src/adapters/claude/sdk-tool-pins.ts"() {
619
+ }
620
+ });
621
+
598
622
  // src/adapters/claude/sdk.ts
599
623
  var sdk_exports = {};
600
624
  __export(sdk_exports, {
@@ -621,6 +645,7 @@ var init_sdk = __esm({
621
645
  init_message_parser();
622
646
  init_tool_bridge2();
623
647
  init_claude_code_login();
648
+ init_sdk_tool_pins();
624
649
  ClaudeSdkAdapter = class extends GeneratorAdapter {
625
650
  provider = "claude";
626
651
  mode = "sdk";
@@ -660,9 +685,8 @@ var init_sdk = __esm({
660
685
  systemPrompt: params.systemPrompt,
661
686
  ...mcpServers && { mcpServers },
662
687
  ...cfg.agents && { agents: cfg.agents },
663
- ...allowedTools && { allowedTools },
664
- permissionMode: "bypassPermissions",
665
- allowDangerouslySkipPermissions: true,
688
+ // ggui#1714 — no CLI built-ins unless asked for, no host settings, no permission bypass.
689
+ ...sdkToolPins({ mcpServers, allowedTools, builtinTools: cfg.builtinTools }),
666
690
  ...cfg.cliPath && { pathToClaudeCodeExecutable: cfg.cliPath },
667
691
  ...cfg.stderr && { stderr: cfg.stderr },
668
692
  // ggui#1185 — tool-less, config-less, non-bare; the model is pinned above.
@@ -2944,10 +2968,7 @@ var init_design_mode = __esm({
2944
2968
  var NOT_YET_TAUGHT_TOKENS, taughtTokenManifest;
2945
2969
  var init_taught_tokens = __esm({
2946
2970
  "src/taught-tokens.ts"() {
2947
- NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([
2948
- "--ggui-color-controlAccentOutline",
2949
- "--ggui-color-controlOutline"
2950
- ]);
2971
+ NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([]);
2951
2972
  taughtTokenManifest = consumedTokenManifest.filter(
2952
2973
  (token) => !NOT_YET_TAUGHT_TOKENS.has(token)
2953
2974
  );
@@ -3467,6 +3488,40 @@ function detectComponentNeverReturns(sourceCode) {
3467
3488
  for (const st of body.statements) if (!isFunctionLike(st)) visit(st);
3468
3489
  return returnsValue ? null : { jsxStatementLine };
3469
3490
  }
3491
+ function kitControlTags(source) {
3492
+ const out = [];
3493
+ const open = new RegExp(`<(${KIT_CONTROLS.join("|")})\\b`, "g");
3494
+ for (const m of source.matchAll(open)) {
3495
+ const start = (m.index ?? 0) + m[0].length;
3496
+ let depth = 0;
3497
+ let quote = null;
3498
+ let i = start;
3499
+ for (; i < source.length; i += 1) {
3500
+ const c = source[i];
3501
+ if (quote !== null) {
3502
+ if (c === quote && source[i - 1] !== "\\") quote = null;
3503
+ } else if (c === '"' || c === "'" || c === "`") quote = c;
3504
+ else if (c === "{") depth += 1;
3505
+ else if (c === "}") depth -= 1;
3506
+ else if (c === ">" && depth === 0) break;
3507
+ }
3508
+ out.push({ name: m[1] ?? "", attrs: source.slice(start, i), line: source.slice(0, m.index ?? 0).split("\n").length });
3509
+ }
3510
+ return out;
3511
+ }
3512
+ function inlineBorderKey(attrs, source) {
3513
+ const BORDER = /\b(border(?:Top|Right|Bottom|Left)?(?:Color|Width|Style)?)\s*:/;
3514
+ const style = attrs.match(/\bstyle=\{\{([\s\S]*)\}\}/);
3515
+ if (style !== null) {
3516
+ const hit2 = (style[1] ?? "").match(BORDER);
3517
+ if (hit2 !== null) return hit2[1] ?? null;
3518
+ }
3519
+ const named = attrs.match(/\bstyle=\{\s*([A-Za-z_$][\w$]*)\s*\}/);
3520
+ if (named === null) return null;
3521
+ const decl = source.match(new RegExp(`\\b(?:const|let)\\s+${named[1]}\\b[^=]*=\\s*\\{([^{}]*)\\}`));
3522
+ const hit = decl !== null ? (decl[1] ?? "").match(BORDER) : null;
3523
+ return hit !== null ? hit[1] ?? null : null;
3524
+ }
3470
3525
  async function runTier0Checks(sourceCode, contract, buildErrors, gadgetTypes, designMode = DEFAULT_DESIGN_MODE) {
3471
3526
  const issues = [];
3472
3527
  const lines = sourceCode.split("\n");
@@ -3864,6 +3919,20 @@ ${errorDetail}`,
3864
3919
  });
3865
3920
  }
3866
3921
  }
3922
+ for (const tag of enforceDesignVocabulary ? kitControlTags(sourceCode) : []) {
3923
+ const key = inlineBorderKey(tag.attrs, sourceCode);
3924
+ if (key === null) continue;
3925
+ issues.push({
3926
+ tier: 0,
3927
+ result: "fail",
3928
+ category: "tokens",
3929
+ subcategory: "control-inline-border",
3930
+ severity: "critical",
3931
+ description: `control-inline-border: <${tag.name}> sets an inline \`${key}\` \u2014 a kit control draws its own boundary, and an inline border paints over it`,
3932
+ fix: `Remove the border from <${tag.name}>'s style (keep borderRadius if you need it). An outline chip is <Button variant="outline"> exactly as it comes; a control-like edge on your own element uses var(--ggui-color-controlOutline).`,
3933
+ line: tag.line
3934
+ });
3935
+ }
3867
3936
  if (!sourceCode.includes("interface Props") && !sourceCode.includes("type Props")) {
3868
3937
  issues.push({
3869
3938
  tier: 0,
@@ -4135,7 +4204,7 @@ async function runTier0(sourceCode, contract, designMode = DEFAULT_DESIGN_MODE)
4135
4204
  }
4136
4205
  return { issues, pass };
4137
4206
  }
4138
- var MANIFEST_TOKENS, RETIRED_TOKEN_SUCCESSORS, TOKEN_REF_RE, HOOK_NAME_FOR, CONTRACT_FIELD_FOR;
4207
+ var MANIFEST_TOKENS, RETIRED_TOKEN_SUCCESSORS, TOKEN_REF_RE, HOOK_NAME_FOR, CONTRACT_FIELD_FOR, KIT_CONTROLS;
4139
4208
  var init_run_tier0 = __esm({
4140
4209
  "src/check/run-tier0.ts"() {
4141
4210
  init_design_mode();
@@ -4164,6 +4233,7 @@ var init_run_tier0 = __esm({
4164
4233
  stream: "streamSpec",
4165
4234
  context: "contextSpec"
4166
4235
  };
4236
+ KIT_CONTROLS = ["Button", "Input", "Select", "TextArea", "Checkbox", "RadioGroup", "Toggle", "SearchField"];
4167
4237
  }
4168
4238
  });
4169
4239
 
@@ -7891,6 +7961,7 @@ function instrumentRead(kind, m) {
7891
7961
  return { verdict: "n/a", evidence: `fill ${m.inkRatio.toFixed(3)} reported; no floor ruled` };
7892
7962
  }
7893
7963
  function readRow(row, answers, m, unansweredReason) {
7964
+ if (row.evaluation === "judge" && REQUIRES_POST_ACTION_CAPTURE.has(row.id) && m.postActionCapture !== true) return { verdict: "n/a", evidence: NO_POST_ACTION };
7894
7965
  if (row.evaluation === "judge") return majority(row.id, answers, unansweredReason);
7895
7966
  if (row.evaluation === "human") return { verdict: "n/a", evidence: `reader's column (status ${row.status})` };
7896
7967
  if (row.status !== "live") return { verdict: "n/a", evidence: `not implemented (status ${row.status})` };
@@ -7949,14 +8020,14 @@ ${text}
7949
8020
  }
7950
8021
  function buildCriteriaJudgeBlock(bank, selected, inputs = {}) {
7951
8022
  const byId = new Map(bankRows(bank).map((r) => [r.id, r]));
7952
- const asked = selected.selection.map((s) => byId.get(s.id)).filter((r) => r !== void 0 && r.evaluation === "judge");
8023
+ const asked = selected.selection.map((s) => byId.get(s.id)).filter((r) => r !== void 0 && r.evaluation === "judge").filter((r) => inputs.postActionCapture === true || !REQUIRES_POST_ACTION_CAPTURE.has(r.id));
7953
8024
  if (asked.length === 0) return "";
7954
8025
  const lines = asked.map((r) => `- ${r.id} (${r.severity}): ${r.text} Evidence must name: ${r.evidence}`);
7955
8026
  return "## Criteria \u2014 answer each one from the FRAME only\nRead these off the screenshot. Never infer them from the request, the styling profile or any direction text above.\n" + (inputs.frame !== void 0 ? `${criteriaFrameLine(inputs.frame)}
7956
8027
  ` : "") + (inputs.propsJson !== void 0 ? criteriaPropsSection(inputs.propsJson) : "") + `${lines.join("\n")}
7957
8028
  Add to your JSON a top-level "criteria" array with exactly these ids: [{ "id": "<id>", "verdict": "pass" | "fail" | "n/a", "evidence": "<one sentence naming the region or element you read it from>" }]. Every row here was selected as applicable to this card, so "n/a" never means "does not apply": use it ONLY when this frame cannot show the criterion \u2014 it is then recorded as not evaluated.`;
7958
8029
  }
7959
- var INSTRUMENT_BY_ID, INSTRUMENT_BESIDE_JUDGE, CRITERIA_PROPS_MAX_CHARS;
8030
+ var INSTRUMENT_BY_ID, INSTRUMENT_BESIDE_JUDGE, REQUIRES_POST_ACTION_CAPTURE, NO_POST_ACTION, CRITERIA_PROPS_MAX_CHARS;
7960
8031
  var init_resolve = __esm({
7961
8032
  "src/evaluation/criteria/resolve.ts"() {
7962
8033
  init_bank();
@@ -7969,6 +8040,8 @@ var init_resolve = __esm({
7969
8040
  INSTRUMENT_BESIDE_JUDGE = {
7970
8041
  "space.edge": "edge"
7971
8042
  };
8043
+ REQUIRES_POST_ACTION_CAPTURE = /* @__PURE__ */ new Set(["state.feedback"]);
8044
+ NO_POST_ACTION = "not evaluated: no post-action capture";
7972
8045
  CRITERIA_PROPS_MAX_CHARS = 2e3;
7973
8046
  }
7974
8047
  });
@@ -10140,6 +10213,7 @@ These tokens adapt automatically to any theme (light, dark, branded). **ALWAYS u
10140
10213
  | link | var(--ggui-color-link) | Accent TEXT \u2014 eyebrows, taglines, links, labels, inline arrows: the brand's readable ink, derived per mode to clear 4.5:1 on the container and the ground |
10141
10214
  | outline | var(--ggui-color-outline) | Borders, dividers |
10142
10215
  | outlineVariant | var(--ggui-color-outlineVariant) | Subtle borders |
10216
+ | controlOutline | var(--ggui-color-controlOutline) | A control's edge \u2014 clears 3:1 on its surface; kit controls draw it themselves |
10143
10217
 
10144
10218
  **Usage pattern:**
10145
10219
  - Page/section background \u2192 \`var(--ggui-color-ground)\`
@@ -10264,7 +10338,7 @@ Use \`var(--ggui-spacing-N)\` for all padding, gap, and margin values. **Never u
10264
10338
  ### Color usage guide
10265
10339
  - **Layering roles** (ground, container, elevated, sunken + their on* inks; outline): one kind of AREA each \u2014 use them for every background/text/border decision; they adapt to any theme
10266
10340
  - **primary-50/100**: Section backgrounds, highlight strips, card headers
10267
- - **primary-200/300**: Borders, dividers, focus rings, input outlines
10341
+ - **primary-200/300**: Dividers and section rules \u2014 never a control's border: kit controls draw their own edge (\`controlOutline\` / \`controlAccentOutline\`), so set no inline border on them
10268
10342
  - **primary-500/600**: Filled buttons, CTAs, badges, icon fills, active indicators \u2014 fills and borders, NOT a text color
10269
10343
  - **link**: Accent TEXT \u2014 eyebrows, taglines, links, labels, inline arrows; the brand's readable ink per mode (a bare \`primary-300\u2026600\` as a text color fails tier-0: \`universal.accent_text_ink\`)
10270
10344
  - **primary-700/800/900**: Headings and text on light primary backgrounds
@@ -15267,13 +15341,14 @@ MANDATORY:
15267
15341
  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))\`.
15268
15342
  3. NEVER invent your own palette. The system provides primary, neutral, success, warning, error, and info \u2014 use ONLY these.
15269
15343
  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.
15344
+ 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).
15270
15345
 
15271
15346
  Token categories:
15272
15347
  - Brand fills: \`var(--ggui-color-primary-600)\`, \`var(--ggui-color-primary-50)\`
15273
15348
  - Accent text: \`var(--ggui-color-link)\` \u2014 eyebrows, taglines, links, labels; readable per mode (never a bare \`primary-<stop>\` as a text color)
15274
15349
  - Text: \`var(--ggui-color-onContainer)\`, \`var(--ggui-color-onSunken)\`
15275
15350
  - Backgrounds: \`var(--ggui-color-container)\`, \`var(--ggui-color-sunken)\`
15276
- - Borders: \`var(--ggui-color-outline)\`
15351
+ - Borders: \`var(--ggui-color-outline)\` \u2014 dividers and the edges of non-interactive boxes; a control's edge is the kit's (rule 5)
15277
15352
  - Spacing: \`var(--ggui-spacing-4)\`, \`var(--ggui-spacing-6)\`
15278
15353
  - Typography: \`var(--ggui-font-size-sm)\`, \`var(--ggui-font-weight-semibold)\`
15279
15354
  - Shadows: \`var(--ggui-shape-shadow-sm)\`, \`var(--ggui-shape-shadow-md)\`, \`var(--ggui-shape-shadow-lg)\`
@@ -15288,7 +15363,7 @@ Use the FULL primary palette throughout the component \u2014 NOT only on submit
15288
15363
  | Element | Token | Purpose |
15289
15364
  |---------|-------|---------|
15290
15365
  | Section headers, hero areas, highlight strips | \`primary-50\` / \`primary-100\` | Subtle branded backgrounds |
15291
- | Borders, dividers, focus rings, input focus | \`primary-200\` / \`primary-300\` | Branded structure |
15366
+ | Dividers, section rules, edges of non-interactive boxes | \`primary-200\` / \`primary-300\` | Branded structure \u2014 never a control's border (rule 5) |
15292
15367
  | 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 |
15293
15368
  | Icon fills, badges, active indicators | \`primary-500\` / \`primary-600\` | Core accent fill |
15294
15369
  | Buttons, CTAs, filled interactive elements | \`primary-600\` / \`primary-700\` | Primary actions |