@ggui-ai/ui-gen 0.26.0 → 0.28.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 (77) 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 +233 -17
  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 +268 -28
  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 +97 -1
  21. package/dist/evaluation/axis-checks/index.js.map +1 -1
  22. package/dist/evaluation/axis-checks/registry.d.ts +1 -1
  23. package/dist/evaluation/axis-checks/registry.js +97 -1
  24. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  25. package/dist/evaluation/index.d.ts +22 -12
  26. package/dist/evaluation/index.js +138 -14
  27. package/dist/evaluation/index.js.map +1 -1
  28. package/dist/evaluation/types.d.ts +1 -1
  29. package/dist/harness/check/runtime-render/index.d.ts +3 -3
  30. package/dist/harness/index.d.ts +1 -1
  31. package/dist/harness/index.js +6 -6
  32. package/dist/harness/index.js.map +1 -1
  33. package/dist/harness/prompts.js +1 -4
  34. package/dist/harness/prompts.js.map +1 -1
  35. package/dist/harness/result-types.d.ts +14 -3
  36. package/dist/harness/result-types.js.map +1 -1
  37. package/dist/harness/runtime.d.ts +1 -1
  38. package/dist/harness/runtime.js +6 -7
  39. package/dist/harness/runtime.js.map +1 -1
  40. package/dist/harness/types-public.d.ts +1 -1
  41. package/dist/harness/types-public.js +4 -6
  42. package/dist/harness/types-public.js.map +1 -1
  43. package/dist/harness/validator-trace-sink.d.ts +1 -1
  44. package/dist/index.d.ts +6 -6
  45. package/dist/index.js +268 -28
  46. package/dist/index.js.map +1 -1
  47. package/dist/patch.d.ts +1 -1
  48. package/dist/{types-public-B7wn4ce5.d.ts → types-public-h8IMnYuh.d.ts} +4 -0
  49. package/dist/{visual-evaluator-C9L-o6ap.d.ts → visual-evaluator-C2strxqD.d.ts} +1 -1
  50. package/dist/workflows.d.ts +1 -1
  51. package/package.json +13 -13
  52. package/src/adapters/base.ts +6 -1
  53. package/src/adapters/claude/message-parser.ts +5 -6
  54. package/src/adapters/claude/sdk-tool-pins.ts +44 -0
  55. package/src/adapters/claude/sdk.ts +3 -3
  56. package/src/adapters/claude/source-capture.ts +20 -0
  57. package/src/adapters/provider-router.ts +1 -0
  58. package/src/boilerplate/system-prompt.ts +3 -2
  59. package/src/check/run-tier0.ts +61 -0
  60. package/src/create-ui-generator.ts +4 -2
  61. package/src/design-system-docs.ts +2 -1
  62. package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
  63. package/src/evaluation/axis-checks/helpers.ts +125 -0
  64. package/src/evaluation/criteria/resolve.ts +19 -1
  65. package/src/evaluation/evaluator.ts +2 -2
  66. package/src/evaluation/llm-evaluator.ts +2 -2
  67. package/src/evaluation/loop.ts +25 -4
  68. package/src/evaluation/message-parsing.ts +11 -12
  69. package/src/evaluation/types-public.ts +4 -0
  70. package/src/evaluation/visual-evaluator.ts +1 -1
  71. package/src/harness/coding/assemble-result.ts +1 -0
  72. package/src/harness/coding/dupe-break.ts +70 -0
  73. package/src/harness/coding/generate-task-runner.ts +5 -1
  74. package/src/harness/coding/run-coding-turn.ts +56 -1
  75. package/src/harness/result-types.ts +12 -0
  76. package/src/index.ts +1 -1
  77. package/src/taught-tokens.ts +5 -6
@@ -1,5 +1,5 @@
1
1
  import { C as Classification } from '../axes-CKVCzR_x.js';
2
- import { E as EvalIssue } from '../types-public-B7wn4ce5.js';
2
+ import { E as EvalIssue } from '../types-public-h8IMnYuh.js';
3
3
  import '@ggui-ai/protocol';
4
4
  import '../llm.js';
5
5
  import '@ggui-ai/mcp-server-core';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { C as CreateUiGeneratorOptions, c as createUiGenerator, e as extractComponentCode } from './create-ui-generator-N4gRXpcL.js';
2
- export { R as RuntimeRenderProbeConfig } from './adapter-BJwn74rx.js';
3
- import { Q as QualityConfig } from './types-public-B7wn4ce5.js';
4
- export { P as ProviderRetryInfo } from './types-public-B7wn4ce5.js';
5
- export { GenerationResult, SameExchangeBreak } from './harness/result-types.js';
1
+ export { C as CreateUiGeneratorOptions, c as createUiGenerator, e as extractComponentCode } from './create-ui-generator-BrZHF0cf.js';
2
+ export { R as RuntimeRenderProbeConfig } from './adapter-h4_V69LI.js';
3
+ import { Q as QualityConfig } from './types-public-h8IMnYuh.js';
4
+ export { P as ProviderRetryInfo } from './types-public-h8IMnYuh.js';
5
+ export { GenerationResult, SameExchangeBreak, SameFailureBreak } from './harness/result-types.js';
6
6
  import { GeneratorBuild, UiGenerator } from '@ggui-ai/mcp-server-core';
7
7
  import { D as DesignMode } from './design-mode-DGWN_Gkm.js';
8
8
  export { b as CANVAS_BREAKPOINTS, c as CANVAS_CLASSES, d as CANVAS_DESCRIPTORS, e as CANVAS_VIEWPORTS, C as CanvasClass, f as CanvasDescriptor, g as CanvasDisplayMode, a as CanvasViewport, h as DEFAULT_DESIGN_MODE, i as DESIGN_MODES, j as canvasDisplayModeForShell, k as canvasForRendering, l as canvasForViewportWidth, m as describeCanvas } from './design-mode-DGWN_Gkm.js';
@@ -24,7 +24,7 @@ import './evaluation/types.js';
24
24
  import './harness/types-public.js';
25
25
  import './policy.js';
26
26
  import './adapters/types.js';
27
- import './visual-evaluator-C9L-o6ap.js';
27
+ import './visual-evaluator-C2strxqD.js';
28
28
  import 'puppeteer-core';
29
29
 
30
30
  /**
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import * as esbuild2 from 'esbuild';
3
3
  import { build } from 'esbuild';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
5
  import { EXPANDED_FRAME, getCssTokens, expandedFrameScrimDecls, fillFitRule, expandedFramePanelRule, FORBIDDEN_IMPORT_SPECIFIERS } from '@ggui-ai/design/rendering';
6
- import { listContractGadgets, HOOK_NAME_RE, classifyUi, MODEL_REGISTRY, modelRefOfRoute, isGeneratorId, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, resolveAppGadgets, APP_GENERATION_PROFILE_BOUNDS, STDLIB_GADGETS_PACKAGE, anthropicRejectsForcedToolChoice, normalizeAnthropicModelId, anthropicRejectsSamplingParams, isRecord } from '@ggui-ai/protocol';
6
+ import { listContractGadgets, HOOK_NAME_RE, classifyUi, MODEL_REGISTRY, modelRefOfRoute, isGeneratorId, DEFAULT_MODEL as DEFAULT_MODEL$1, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, resolveAppGadgets, APP_GENERATION_PROFILE_BOUNDS, STDLIB_GADGETS_PACKAGE, anthropicRejectsForcedToolChoice, normalizeAnthropicModelId, anthropicRejectsSamplingParams, isRecord } from '@ggui-ai/protocol';
7
7
  import fs, { existsSync, mkdtempSync, writeFileSync, rmSync, readFileSync, readdirSync, statSync } from 'fs';
8
8
  import { contentHash } from '@ggui-ai/protocol/content-hash';
9
9
  import ts4 from 'typescript';
@@ -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.
@@ -2952,10 +2976,7 @@ var init_design_mode = __esm({
2952
2976
  var NOT_YET_TAUGHT_TOKENS, taughtTokenManifest;
2953
2977
  var init_taught_tokens = __esm({
2954
2978
  "src/taught-tokens.ts"() {
2955
- NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([
2956
- "--ggui-color-controlAccentOutline",
2957
- "--ggui-color-controlOutline"
2958
- ]);
2979
+ NOT_YET_TAUGHT_TOKENS = /* @__PURE__ */ new Set([]);
2959
2980
  taughtTokenManifest = consumedTokenManifest.filter(
2960
2981
  (token) => !NOT_YET_TAUGHT_TOKENS.has(token)
2961
2982
  );
@@ -3475,6 +3496,40 @@ function detectComponentNeverReturns(sourceCode) {
3475
3496
  for (const st of body.statements) if (!isFunctionLike(st)) visit(st);
3476
3497
  return returnsValue ? null : { jsxStatementLine };
3477
3498
  }
3499
+ function kitControlTags(source) {
3500
+ const out = [];
3501
+ const open = new RegExp(`<(${KIT_CONTROLS.join("|")})\\b`, "g");
3502
+ for (const m of source.matchAll(open)) {
3503
+ const start = (m.index ?? 0) + m[0].length;
3504
+ let depth = 0;
3505
+ let quote = null;
3506
+ let i = start;
3507
+ for (; i < source.length; i += 1) {
3508
+ const c = source[i];
3509
+ if (quote !== null) {
3510
+ if (c === quote && source[i - 1] !== "\\") quote = null;
3511
+ } else if (c === '"' || c === "'" || c === "`") quote = c;
3512
+ else if (c === "{") depth += 1;
3513
+ else if (c === "}") depth -= 1;
3514
+ else if (c === ">" && depth === 0) break;
3515
+ }
3516
+ out.push({ name: m[1] ?? "", attrs: source.slice(start, i), line: source.slice(0, m.index ?? 0).split("\n").length });
3517
+ }
3518
+ return out;
3519
+ }
3520
+ function inlineBorderKey(attrs, source) {
3521
+ const BORDER = /\b(border(?:Top|Right|Bottom|Left)?(?:Color|Width|Style)?)\s*:/;
3522
+ const style = attrs.match(/\bstyle=\{\{([\s\S]*)\}\}/);
3523
+ if (style !== null) {
3524
+ const hit2 = (style[1] ?? "").match(BORDER);
3525
+ if (hit2 !== null) return hit2[1] ?? null;
3526
+ }
3527
+ const named = attrs.match(/\bstyle=\{\s*([A-Za-z_$][\w$]*)\s*\}/);
3528
+ if (named === null) return null;
3529
+ const decl = source.match(new RegExp(`\\b(?:const|let)\\s+${named[1]}\\b[^=]*=\\s*\\{([^{}]*)\\}`));
3530
+ const hit = decl !== null ? (decl[1] ?? "").match(BORDER) : null;
3531
+ return hit !== null ? hit[1] ?? null : null;
3532
+ }
3478
3533
  async function runTier0Checks(sourceCode, contract, buildErrors, gadgetTypes, designMode = DEFAULT_DESIGN_MODE) {
3479
3534
  const issues = [];
3480
3535
  const lines = sourceCode.split("\n");
@@ -3872,6 +3927,20 @@ ${errorDetail}`,
3872
3927
  });
3873
3928
  }
3874
3929
  }
3930
+ for (const tag of enforceDesignVocabulary ? kitControlTags(sourceCode) : []) {
3931
+ const key = inlineBorderKey(tag.attrs, sourceCode);
3932
+ if (key === null) continue;
3933
+ issues.push({
3934
+ tier: 0,
3935
+ result: "fail",
3936
+ category: "tokens",
3937
+ subcategory: "control-inline-border",
3938
+ severity: "critical",
3939
+ 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`,
3940
+ 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).`,
3941
+ line: tag.line
3942
+ });
3943
+ }
3875
3944
  if (!sourceCode.includes("interface Props") && !sourceCode.includes("type Props")) {
3876
3945
  issues.push({
3877
3946
  tier: 0,
@@ -4143,7 +4212,7 @@ async function runTier0(sourceCode, contract, designMode = DEFAULT_DESIGN_MODE)
4143
4212
  }
4144
4213
  return { issues, pass };
4145
4214
  }
4146
- var MANIFEST_TOKENS, RETIRED_TOKEN_SUCCESSORS, TOKEN_REF_RE, HOOK_NAME_FOR, CONTRACT_FIELD_FOR;
4215
+ var MANIFEST_TOKENS, RETIRED_TOKEN_SUCCESSORS, TOKEN_REF_RE, HOOK_NAME_FOR, CONTRACT_FIELD_FOR, KIT_CONTROLS;
4147
4216
  var init_run_tier0 = __esm({
4148
4217
  "src/check/run-tier0.ts"() {
4149
4218
  init_design_mode();
@@ -4172,6 +4241,7 @@ var init_run_tier0 = __esm({
4172
4241
  stream: "streamSpec",
4173
4242
  context: "contextSpec"
4174
4243
  };
4244
+ KIT_CONTROLS = ["Button", "Input", "Select", "TextArea", "Checkbox", "RadioGroup", "Toggle", "SearchField"];
4175
4245
  }
4176
4246
  });
4177
4247
 
@@ -4465,6 +4535,8 @@ var init_policy = __esm({
4465
4535
  function getBedrockModelId(model) {
4466
4536
  const BEDROCK_MAP = {
4467
4537
  "anthropic/claude-haiku-4-5": "us.anthropic.claude-haiku-4-5-20251001-v1:0",
4538
+ "anthropic/claude-haiku-5-5": "us.anthropic.claude-haiku-5-5",
4539
+ // listed ACTIVE in us-east-1 (ggui#1743)
4468
4540
  "anthropic/claude-sonnet-4-6": "us.anthropic.claude-sonnet-4-6",
4469
4541
  "anthropic/claude-opus-4-6": "us.anthropic.claude-opus-4-6-v1:0",
4470
4542
  // Claude 5-family (ggui#706, strings verified 2026-09-02 against
@@ -6981,10 +7053,16 @@ var dupe_break_exports = {};
6981
7053
  __export(dupe_break_exports, {
6982
7054
  SAME_EXCHANGE_BREAK_AT: () => SAME_EXCHANGE_BREAK_AT,
6983
7055
  SAME_EXCHANGE_NUDGE: () => SAME_EXCHANGE_NUDGE,
7056
+ SAME_FAILURE_BREAK_AT: () => SAME_FAILURE_BREAK_AT,
7057
+ SAME_FAILURE_NUDGE: () => SAME_FAILURE_NUDGE,
7058
+ SAME_FAILURE_NUDGE_AT: () => SAME_FAILURE_NUDGE_AT,
7059
+ clearWriteFailures: () => clearWriteFailures,
6984
7060
  computePatchFingerprint: () => computePatchFingerprint,
6985
7061
  createDupeBreakState: () => createDupeBreakState,
6986
7062
  errorClassBucket: () => errorClassBucket,
6987
- recordToolExchange: () => recordToolExchange
7063
+ failureSignatures: () => failureSignatures,
7064
+ recordToolExchange: () => recordToolExchange,
7065
+ recordWriteFailure: () => recordWriteFailure
6988
7066
  });
6989
7067
  function recordToolExchange(state, name, input, resultText) {
6990
7068
  const key = createHash("sha256").update(name).update("\0").update(JSON.stringify(input) ?? "undefined").update("\0").update(resultText).digest("hex");
@@ -6996,6 +7074,25 @@ function recordToolExchange(state, name, input, resultText) {
6996
7074
  }
6997
7075
  return state.consecutiveIdenticalExchanges;
6998
7076
  }
7077
+ function failureSignatures(resultText) {
7078
+ const norm = (text) => text.replace(/[0-9]+/g, "#").replace(/\s+/g, " ").trim();
7079
+ const violations = [...resultText.matchAll(/^\[[^\]\n]+\] [^\n]+/gm)].map((m) => norm(m[0]));
7080
+ if (violations.length > 0) return [...new Set(violations)];
7081
+ const rest = norm(resultText.replace(/^Committed [^\n]*\n/, ""));
7082
+ return rest.length > 0 ? [rest] : [];
7083
+ }
7084
+ function recordWriteFailure(state, resultText) {
7085
+ let top;
7086
+ for (const signature of failureSignatures(resultText)) {
7087
+ const repeats = (state.failureCounts.get(signature) ?? 0) + 1;
7088
+ state.failureCounts.set(signature, repeats);
7089
+ if (top === void 0 || repeats > top.repeats) top = { signature, repeats };
7090
+ }
7091
+ return top;
7092
+ }
7093
+ function clearWriteFailures(state) {
7094
+ state.failureCounts.clear();
7095
+ }
6999
7096
  function createDupeBreakState() {
7000
7097
  return {
7001
7098
  lastFailedPatchFingerprint: null,
@@ -7012,7 +7109,8 @@ function createDupeBreakState() {
7012
7109
  consecutiveBrokenApplies: 0,
7013
7110
  consecutiveNoToolCalls: 0,
7014
7111
  lastExchangeKey: null,
7015
- consecutiveIdenticalExchanges: 0
7112
+ consecutiveIdenticalExchanges: 0,
7113
+ failureCounts: /* @__PURE__ */ new Map()
7016
7114
  };
7017
7115
  }
7018
7116
  function errorClassBucket(errText) {
@@ -7037,11 +7135,14 @@ function computePatchFingerprint(changes, errText) {
7037
7135
  h.update(errBucket);
7038
7136
  return h.digest("hex");
7039
7137
  }
7040
- var SAME_EXCHANGE_BREAK_AT, SAME_EXCHANGE_NUDGE;
7138
+ var SAME_EXCHANGE_BREAK_AT, SAME_EXCHANGE_NUDGE, SAME_FAILURE_NUDGE_AT, SAME_FAILURE_BREAK_AT, SAME_FAILURE_NUDGE;
7041
7139
  var init_dupe_break = __esm({
7042
7140
  "src/harness/coding/dupe-break.ts"() {
7043
7141
  SAME_EXCHANGE_BREAK_AT = 3;
7044
7142
  SAME_EXCHANGE_NUDGE = "\n\n[harness] This is the SAME tool call with the SAME result as your previous turn \u2014 repeating it cannot produce new information. Use what you already have and emit an apply_changes (or scoped) call now; one more identical repeat terminates the run.";
7143
+ SAME_FAILURE_NUDGE_AT = 3;
7144
+ SAME_FAILURE_BREAK_AT = 5;
7145
+ SAME_FAILURE_NUDGE = "\n\n[harness] This same failure has now been reported for three of your patches. Changing other code does not clear it: re-read that check above and change exactly what it names. Two more reports of it end the run.";
7045
7146
  }
7046
7147
  });
7047
7148
 
@@ -7433,13 +7534,13 @@ Return your evaluation using the evaluate_${criterion} tool.`;
7433
7534
  function getDefaultEvalModel(provider) {
7434
7535
  switch (provider) {
7435
7536
  case "claude":
7436
- return "claude-haiku-4-5-20251001";
7537
+ return "claude-haiku-5-5";
7437
7538
  case "openai":
7438
7539
  return "gpt-5.6-luna";
7439
7540
  case "google":
7440
7541
  return "gemini-3.5-flash-lite";
7441
7542
  default:
7442
- return "claude-haiku-4-5-20251001";
7543
+ return "claude-haiku-5-5";
7443
7544
  }
7444
7545
  }
7445
7546
  function callTokens(response) {
@@ -7899,6 +8000,7 @@ function instrumentRead(kind, m) {
7899
8000
  return { verdict: "n/a", evidence: `fill ${m.inkRatio.toFixed(3)} reported; no floor ruled` };
7900
8001
  }
7901
8002
  function readRow(row, answers, m, unansweredReason) {
8003
+ if (row.evaluation === "judge" && REQUIRES_POST_ACTION_CAPTURE.has(row.id) && m.postActionCapture !== true) return { verdict: "n/a", evidence: NO_POST_ACTION };
7902
8004
  if (row.evaluation === "judge") return majority(row.id, answers, unansweredReason);
7903
8005
  if (row.evaluation === "human") return { verdict: "n/a", evidence: `reader's column (status ${row.status})` };
7904
8006
  if (row.status !== "live") return { verdict: "n/a", evidence: `not implemented (status ${row.status})` };
@@ -7957,14 +8059,14 @@ ${text}
7957
8059
  }
7958
8060
  function buildCriteriaJudgeBlock(bank, selected, inputs = {}) {
7959
8061
  const byId = new Map(bankRows(bank).map((r) => [r.id, r]));
7960
- const asked = selected.selection.map((s) => byId.get(s.id)).filter((r) => r !== void 0 && r.evaluation === "judge");
8062
+ 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));
7961
8063
  if (asked.length === 0) return "";
7962
8064
  const lines = asked.map((r) => `- ${r.id} (${r.severity}): ${r.text} Evidence must name: ${r.evidence}`);
7963
8065
  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)}
7964
8066
  ` : "") + (inputs.propsJson !== void 0 ? criteriaPropsSection(inputs.propsJson) : "") + `${lines.join("\n")}
7965
8067
  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.`;
7966
8068
  }
7967
- var INSTRUMENT_BY_ID, INSTRUMENT_BESIDE_JUDGE, CRITERIA_PROPS_MAX_CHARS;
8069
+ var INSTRUMENT_BY_ID, INSTRUMENT_BESIDE_JUDGE, REQUIRES_POST_ACTION_CAPTURE, NO_POST_ACTION, CRITERIA_PROPS_MAX_CHARS;
7968
8070
  var init_resolve = __esm({
7969
8071
  "src/evaluation/criteria/resolve.ts"() {
7970
8072
  init_bank();
@@ -7977,6 +8079,8 @@ var init_resolve = __esm({
7977
8079
  INSTRUMENT_BESIDE_JUDGE = {
7978
8080
  "space.edge": "edge"
7979
8081
  };
8082
+ REQUIRES_POST_ACTION_CAPTURE = /* @__PURE__ */ new Set(["state.feedback"]);
8083
+ NO_POST_ACTION = "not evaluated: no post-action capture";
7980
8084
  CRITERIA_PROPS_MAX_CHARS = 2e3;
7981
8085
  }
7982
8086
  });
@@ -9514,7 +9618,7 @@ function parseCriteriaAnswers(raw) {
9514
9618
  function getDefaultVisualModel(provider) {
9515
9619
  switch (provider) {
9516
9620
  case "claude":
9517
- return "claude-haiku-4-5-20251001";
9621
+ return "claude-haiku-5-5";
9518
9622
  case "google":
9519
9623
  return "gemini-3-flash-preview";
9520
9624
  }
@@ -10148,6 +10252,7 @@ These tokens adapt automatically to any theme (light, dark, branded). **ALWAYS u
10148
10252
  | 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 |
10149
10253
  | outline | var(--ggui-color-outline) | Borders, dividers |
10150
10254
  | outlineVariant | var(--ggui-color-outlineVariant) | Subtle borders |
10255
+ | controlOutline | var(--ggui-color-controlOutline) | A control's edge \u2014 clears 3:1 on its surface; kit controls draw it themselves |
10151
10256
 
10152
10257
  **Usage pattern:**
10153
10258
  - Page/section background \u2192 \`var(--ggui-color-ground)\`
@@ -10272,7 +10377,7 @@ Use \`var(--ggui-spacing-N)\` for all padding, gap, and margin values. **Never u
10272
10377
  ### Color usage guide
10273
10378
  - **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
10274
10379
  - **primary-50/100**: Section backgrounds, highlight strips, card headers
10275
- - **primary-200/300**: Borders, dividers, focus rings, input outlines
10380
+ - **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
10276
10381
  - **primary-500/600**: Filled buttons, CTAs, badges, icon fills, active indicators \u2014 fills and borders, NOT a text color
10277
10382
  - **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\`)
10278
10383
  - **primary-700/800/900**: Headings and text on light primary backgrounds
@@ -11757,10 +11862,96 @@ function getInitialValuePropNames(contract) {
11757
11862
  }
11758
11863
  return names;
11759
11864
  }
11865
+ function objectLiteralKeysAt(src, open) {
11866
+ if (src[open] !== "{") return void 0;
11867
+ const keys = [];
11868
+ let depth = 0;
11869
+ let expectKey = true;
11870
+ for (let i = open; i < src.length; i++) {
11871
+ const c = src[i];
11872
+ if (c === '"' || c === "'" || c === "`") {
11873
+ let j = i + 1;
11874
+ while (j < src.length && src[j] !== c) j += src[j] === "\\" ? 2 : 1;
11875
+ if (depth === 1 && expectKey && /^\s*:/.test(src.slice(j + 1))) keys.push(src.slice(i + 1, j));
11876
+ i = j;
11877
+ expectKey = false;
11878
+ continue;
11879
+ }
11880
+ if (c === "{" || c === "[" || c === "(") {
11881
+ depth++;
11882
+ if (depth === 1) expectKey = true;
11883
+ continue;
11884
+ }
11885
+ if (c === "}" || c === "]" || c === ")") {
11886
+ depth--;
11887
+ if (depth === 0) return keys;
11888
+ continue;
11889
+ }
11890
+ if (depth !== 1) continue;
11891
+ if (c === ",") {
11892
+ expectKey = true;
11893
+ continue;
11894
+ }
11895
+ if (expectKey && /[A-Za-z_$]/.test(c ?? "")) {
11896
+ const m = /^([A-Za-z_$][\w$]*)\s*(:|,|\})/.exec(src.slice(i));
11897
+ if (m !== null && m[1] !== void 0) keys.push(m[1]);
11898
+ expectKey = false;
11899
+ }
11900
+ }
11901
+ return keys;
11902
+ }
11903
+ function callArgsAt(src, open) {
11904
+ const args = [];
11905
+ let depth = 0;
11906
+ let start = open + 1;
11907
+ for (let i = open; i < src.length; i++) {
11908
+ const c = src[i];
11909
+ if (c === '"' || c === "'" || c === "`") {
11910
+ let j = i + 1;
11911
+ while (j < src.length && src[j] !== c) j += src[j] === "\\" ? 2 : 1;
11912
+ i = j;
11913
+ continue;
11914
+ }
11915
+ if (c === "(" || c === "{" || c === "[") depth++;
11916
+ else if (c === ")" || c === "}" || c === "]") {
11917
+ depth--;
11918
+ if (depth === 0) {
11919
+ args.push(src.slice(start, i));
11920
+ return args;
11921
+ }
11922
+ } else if (c === "," && depth === 1) {
11923
+ args.push(src.slice(start, i));
11924
+ start = i + 1;
11925
+ }
11926
+ }
11927
+ return args;
11928
+ }
11929
+ function initialStateKeys(src, argStart, argText) {
11930
+ const lead = argText.length - argText.trimStart().length;
11931
+ let at = argStart + lead;
11932
+ let text = argText.trim();
11933
+ const lazy = /^\(\s*\)\s*=>\s*\(?\s*/.exec(text);
11934
+ if (lazy !== null) {
11935
+ at += lazy[0].length;
11936
+ text = text.slice(lazy[0].length);
11937
+ }
11938
+ if (text.startsWith("{")) return objectLiteralKeysAt(src, at) ?? [];
11939
+ const ident = /^([A-Za-z_$][\w$]*)\s*\)?\s*$/.exec(text);
11940
+ if (ident === null || ident[1] === void 0) return [];
11941
+ const decls = [...src.matchAll(new RegExp(`(?:const|let|var)\\s+${ident[1]}\\s*(?::[^=]{1,200})?=\\s*`, "g"))];
11942
+ const decl = decls.length === 1 ? decls[0] : void 0;
11943
+ if (decl === void 0) return [];
11944
+ return objectLiteralKeysAt(src, (decl.index ?? 0) + decl[0].length) ?? [];
11945
+ }
11760
11946
  function collectStateKeys(src) {
11761
11947
  const keys = /* @__PURE__ */ new Set();
11762
11948
  const varRe = /const\s*\[\s*(\w+)\s*,\s*(\w+)\s*\]\s*=\s*useState/g;
11763
11949
  for (const m of src.matchAll(varRe)) keys.add(m[1]);
11950
+ const contextRe = /const\s*\[\s*(\w+)\s*,\s*\w+\s*\]\s*=\s*useGguiContext\s*(?:<[^>]*>)?\s*\(\s*['"`](\w+)['"`]/g;
11951
+ for (const m of src.matchAll(contextRe)) {
11952
+ keys.add(m[1]);
11953
+ keys.add(m[2]);
11954
+ }
11764
11955
  const objRe = /useState(?:<[^>]*>)?\s*\(\s*\{([\s\S]*?)\}\s*\)/g;
11765
11956
  for (const m of src.matchAll(objRe)) {
11766
11957
  const keyRe = /(?:^|,)\s*(\w+)\s*:/g;
@@ -11771,6 +11962,16 @@ function collectStateKeys(src) {
11771
11962
  const keyRe = /(?:^|,)\s*(\w+)\s*:/g;
11772
11963
  for (const km of m[1].matchAll(keyRe)) keys.add(km[1]);
11773
11964
  }
11965
+ for (const m of src.matchAll(/\b(useState|useReducer)\s*(?:<[^>]*>)?\s*\(/g)) {
11966
+ const open = (m.index ?? 0) + m[0].length - 1;
11967
+ const args = callArgsAt(src, open);
11968
+ const which = m[1] === "useReducer" ? 1 : 0;
11969
+ const arg = args[which];
11970
+ if (arg === void 0) continue;
11971
+ let argStart = open + 1;
11972
+ for (let k = 0; k < which; k++) argStart += (args[k]?.length ?? 0) + 1;
11973
+ for (const key of initialStateKeys(src, argStart, arg)) keys.add(key);
11974
+ }
11774
11975
  return keys;
11775
11976
  }
11776
11977
  function mkIssue(subcategory, description, fix, result = "fail") {
@@ -12383,7 +12584,7 @@ function runNoHardcodedEntities(input) {
12383
12584
  mkIssue(
12384
12585
  "state.merge.no_hardcoded_entities",
12385
12586
  `Hardcoded entity array literal (multiple objects with "${idField}") in the component \u2014 entity data should come from state/props.`,
12386
- `Remove the literal array. Seed state from props.{entityProp} and merge updates via stream.`
12587
+ `Remove the literal array: this data comes from ${all.filter((e) => e.idField === idField).map((e) => `props.${e.name}`).join(" / ") || "props"}. Read it there (\`?? []\` for an absent value, never a literal default), seed state from it, and merge updates via stream.`
12387
12588
  )
12388
12589
  );
12389
12590
  }
@@ -15275,13 +15476,14 @@ MANDATORY:
15275
15476
  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))\`.
15276
15477
  3. NEVER invent your own palette. The system provides primary, neutral, success, warning, error, and info \u2014 use ONLY these.
15277
15478
  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.
15479
+ 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).
15278
15480
 
15279
15481
  Token categories:
15280
15482
  - Brand fills: \`var(--ggui-color-primary-600)\`, \`var(--ggui-color-primary-50)\`
15281
15483
  - Accent text: \`var(--ggui-color-link)\` \u2014 eyebrows, taglines, links, labels; readable per mode (never a bare \`primary-<stop>\` as a text color)
15282
15484
  - Text: \`var(--ggui-color-onContainer)\`, \`var(--ggui-color-onSunken)\`
15283
15485
  - Backgrounds: \`var(--ggui-color-container)\`, \`var(--ggui-color-sunken)\`
15284
- - Borders: \`var(--ggui-color-outline)\`
15486
+ - Borders: \`var(--ggui-color-outline)\` \u2014 dividers and the edges of non-interactive boxes; a control's edge is the kit's (rule 5)
15285
15487
  - Spacing: \`var(--ggui-spacing-4)\`, \`var(--ggui-spacing-6)\`
15286
15488
  - Typography: \`var(--ggui-font-size-sm)\`, \`var(--ggui-font-weight-semibold)\`
15287
15489
  - Shadows: \`var(--ggui-shape-shadow-sm)\`, \`var(--ggui-shape-shadow-md)\`, \`var(--ggui-shape-shadow-lg)\`
@@ -15296,7 +15498,7 @@ Use the FULL primary palette throughout the component \u2014 NOT only on submit
15296
15498
  | Element | Token | Purpose |
15297
15499
  |---------|-------|---------|
15298
15500
  | Section headers, hero areas, highlight strips | \`primary-50\` / \`primary-100\` | Subtle branded backgrounds |
15299
- | Borders, dividers, focus rings, input focus | \`primary-200\` / \`primary-300\` | Branded structure |
15501
+ | Dividers, section rules, edges of non-interactive boxes | \`primary-200\` / \`primary-300\` | Branded structure \u2014 never a control's border (rule 5) |
15300
15502
  | 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 |
15301
15503
  | Icon fills, badges, active indicators | \`primary-500\` / \`primary-600\` | Core accent fill |
15302
15504
  | Buttons, CTAs, filled interactive elements | \`primary-600\` / \`primary-700\` | Primary actions |
@@ -18274,6 +18476,7 @@ async function assembleGenerationResult(input) {
18274
18476
  evalResult: telemetry.evalResult !== void 0 && telemetry.contractFeedback !== void 0 ? { ...telemetry.evalResult, contractFeedback: telemetry.contractFeedback } : telemetry.evalResult,
18275
18477
  // ggui#404 — present only when the same-exchange guard ended the run.
18276
18478
  ...telemetry.sameExchangeBreak !== void 0 ? { sameExchangeBreak: telemetry.sameExchangeBreak } : {},
18479
+ ...telemetry.sameFailureBreak !== void 0 ? { sameFailureBreak: telemetry.sameFailureBreak } : {},
18277
18480
  needsBackgroundImprovement,
18278
18481
  selfCheckPassed: telemetry.selfCheckPassed,
18279
18482
  timing,
@@ -19213,6 +19416,18 @@ Repeated error: ${errText}
19213
19416
  augmentedResultText += SAME_EXCHANGE_NUDGE;
19214
19417
  }
19215
19418
  }
19419
+ const isWrite = call.name === "apply_changes" || call.name === "rewrite";
19420
+ let repeatedFailure;
19421
+ if (ctx.dupeBreak && isWrite) {
19422
+ if (result.done) {
19423
+ clearWriteFailures(ctx.dupeBreak);
19424
+ } else {
19425
+ repeatedFailure = recordWriteFailure(ctx.dupeBreak, result.result);
19426
+ if (repeatedFailure?.repeats === SAME_FAILURE_NUDGE_AT) {
19427
+ augmentedResultText += SAME_FAILURE_NUDGE;
19428
+ }
19429
+ }
19430
+ }
19216
19431
  await codingAgent.sendToolResult([{
19217
19432
  callId: call.id,
19218
19433
  name: call.name,
@@ -19241,6 +19456,29 @@ Repeated error: ${errText}
19241
19456
  sameExchangeBreak: { tool: call.name, repeats: sameExchangeRepeats }
19242
19457
  };
19243
19458
  }
19459
+ if (repeatedFailure !== void 0 && repeatedFailure.repeats >= SAME_FAILURE_BREAK_AT) {
19460
+ const signature = repeatedFailure.signature.slice(0, 160);
19461
+ console.log(
19462
+ `[coding-agent] SAME_FAILURE_BREAK | tool=${call.name} | repeats=${repeatedFailure.repeats} | failure=${JSON.stringify(signature.slice(0, 80))} \u2014 terminating run (ggui#1791)`
19463
+ );
19464
+ return {
19465
+ control: "break",
19466
+ compiledCode: "",
19467
+ selfCheckPassed: false,
19468
+ outcome: void 0,
19469
+ phase: void 0,
19470
+ tokens,
19471
+ ...cacheTokens,
19472
+ llmMs,
19473
+ toolMs,
19474
+ lastResultText: augmentedResultText,
19475
+ lastDiffFailed: false,
19476
+ isEvalFeedback: false,
19477
+ iconNamesCache,
19478
+ preWarmedContext,
19479
+ sameFailureBreak: { signature, repeats: repeatedFailure.repeats }
19480
+ };
19481
+ }
19244
19482
  const turnDiffFailed = !!result.error && result.result.includes("DIFF");
19245
19483
  const isDiffFail = turnDiffFailed && !isPatchInvalid;
19246
19484
  const outcome = result.done ? "PASS" : isPatchInvalid ? "PATCH_INVALID" : isDiffFail ? "DIFF_FAIL" : "SELF_CHECK_FAIL";
@@ -20228,6 +20466,7 @@ function createTelemetry() {
20228
20466
  probeRepairTrigger: void 0,
20229
20467
  contractFeedback: void 0,
20230
20468
  sameExchangeBreak: void 0,
20469
+ sameFailureBreak: void 0,
20231
20470
  compiledCode: "",
20232
20471
  pairedSource: "",
20233
20472
  selfCheckPassed: false,
@@ -20283,6 +20522,7 @@ function absorbTurn(telemetry, turn) {
20283
20522
  else telemetry.counters.outcomes.selfCheckFail++;
20284
20523
  }
20285
20524
  if (turn.sameExchangeBreak !== void 0) telemetry.sameExchangeBreak = turn.sameExchangeBreak;
20525
+ if (turn.sameFailureBreak !== void 0) telemetry.sameFailureBreak = turn.sameFailureBreak;
20286
20526
  }
20287
20527
  function createGenerateTaskRunner(input) {
20288
20528
  const { session, params, classification, telemetry } = input;
@@ -21442,7 +21682,7 @@ function injectVariance(userPrompt, variance, options) {
21442
21682
  init_design_mode();
21443
21683
  init_provider_router();
21444
21684
  var DEFAULT_TIER = "default";
21445
- var DEFAULT_MODEL = "anthropic/claude-haiku-4-5";
21685
+ var DEFAULT_MODEL = DEFAULT_MODEL$1;
21446
21686
  function createUiGenerator(options = {}) {
21447
21687
  const {
21448
21688
  enableRuntimeRender = false,