@ggui-ai/ui-gen 0.21.0 → 0.23.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 (87) hide show
  1. package/dist/adapters/generation-dispatch.d.ts +1 -1
  2. package/dist/adapters/generation-dispatch.js +253 -76
  3. package/dist/adapters/generation-dispatch.js.map +1 -1
  4. package/dist/adapters/index.js +36 -11
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/advanced/index.d.ts +3 -3
  7. package/dist/advanced/index.js +447 -76
  8. package/dist/advanced/index.js.map +1 -1
  9. package/dist/blueprint-validator.js +37 -7
  10. package/dist/blueprint-validator.js.map +1 -1
  11. package/dist/boilerplate.js +1 -0
  12. package/dist/boilerplate.js.map +1 -1
  13. package/dist/check/index.d.ts +1 -1
  14. package/dist/check/index.js.map +1 -1
  15. package/dist/{create-ui-generator-D7kOXNjJ.d.ts → create-ui-generator-D0kbWwln.d.ts} +1 -1
  16. package/dist/{dispatch-DGvhmARp.d.ts → dispatch-wxaIMwZt.d.ts} +1 -1
  17. package/dist/evaluation/axis-checks/index.d.ts +3 -3
  18. package/dist/evaluation/axis-checks/index.js +19 -4
  19. package/dist/evaluation/axis-checks/index.js.map +1 -1
  20. package/dist/evaluation/axis-checks/registry.d.ts +1 -1
  21. package/dist/evaluation/axis-checks/registry.js +19 -4
  22. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  23. package/dist/evaluation/index.d.ts +3 -3
  24. package/dist/evaluation/index.js +58 -26
  25. package/dist/evaluation/index.js.map +1 -1
  26. package/dist/harness/check/runtime-render/index.d.ts +4 -4
  27. package/dist/harness/check/runtime-render/index.js +26 -6
  28. package/dist/harness/check/runtime-render/index.js.map +1 -1
  29. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  30. package/dist/harness/index.d.ts +1 -1
  31. package/dist/harness/index.js +37 -11
  32. package/dist/harness/index.js.map +1 -1
  33. package/dist/harness/prompts.js +1 -1
  34. package/dist/harness/prompts.js.map +1 -1
  35. package/dist/harness/result-types.d.ts +15 -2
  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 +2 -1
  39. package/dist/harness/runtime.js.map +1 -1
  40. package/dist/harness/types-public.d.ts +9 -5
  41. package/dist/harness/types-public.js +1 -0
  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 +22 -6
  45. package/dist/index.js +436 -75
  46. package/dist/index.js.map +1 -1
  47. package/dist/patch.d.ts +1 -1
  48. package/dist/{render-check-C0CqVceF.d.ts → render-check-Blwj8gB6.d.ts} +18 -0
  49. package/dist/tools/get-primitives-ts.d.ts +1 -1
  50. package/dist/tools/get-primitives-ts.js +1 -1
  51. package/dist/tools/get-primitives-ts.js.map +1 -1
  52. package/dist/{types-public-CzYqZclY.d.ts → types-public-Ow-tNtFE.d.ts} +41 -3
  53. package/dist/validation/index.d.ts +1 -1
  54. package/dist/validation/index.js +1 -1
  55. package/dist/validation/index.js.map +1 -1
  56. package/dist/workflows.d.ts +1 -1
  57. package/package.json +12 -12
  58. package/src/adapters/claude/claude-code-login.ts +62 -7
  59. package/src/adapters/claude/sdk.ts +6 -5
  60. package/src/advanced/generator.ts +16 -1
  61. package/src/blueprint-validator.ts +21 -6
  62. package/src/boilerplate/hard-sections.ts +1 -0
  63. package/src/boilerplate/templates/layouts/chat-mobile.tsx.tmpl +7 -3
  64. package/src/boilerplate/templates/layouts/chat-universal.tsx.tmpl +7 -3
  65. package/src/coding-agent/tools.ts +6 -1
  66. package/src/contract-context.ts +1 -1
  67. package/src/create-ui-generator.ts +30 -0
  68. package/src/evaluation/axis-checks/checks/state-payload.ts +29 -4
  69. package/src/evaluation/index.ts +1 -0
  70. package/src/evaluation/llm-evaluator.ts +40 -13
  71. package/src/evaluation/types-public.ts +42 -2
  72. package/src/evaluation/visual-evaluator.ts +9 -6
  73. package/src/generator-build.ts +158 -0
  74. package/src/harness/check/runtime-render/adapter.ts +19 -0
  75. package/src/harness/check/runtime-render/render-check-host.ts +31 -9
  76. package/src/harness/check/runtime-render/render-check.ts +19 -0
  77. package/src/harness/claude-code-login-query.ts +5 -4
  78. package/src/harness/coding/assemble-result.ts +8 -1
  79. package/src/harness/coding/generate-task-runner.ts +75 -36
  80. package/src/harness/coding/run-coding-turn.ts +9 -0
  81. package/src/harness/coding/run-eval-round.ts +162 -5
  82. package/src/harness/llm-router.ts +3 -3
  83. package/src/harness/result-types.ts +14 -0
  84. package/src/harness/types-public.ts +9 -5
  85. package/src/index.ts +2 -1
  86. package/src/tools/get-primitives-ts.ts +1 -1
  87. package/src/validation/primitives.ts +1 -1
@@ -1,10 +1,10 @@
1
- import { C as CanvasJudgeRecord, E as EvalIssue, V as VisualEvalSummary, d as VisualCoverage } from '../types-public-CzYqZclY.js';
2
- export { A as AxisCheck, a as AxisCheckInput, e as CRITERIA, f as CanvasVisualSummary, g as CriterionCoverage, h as CriterionRunStatus, D as DEFAULT_QUALITY_CONFIG, i as EvalCategory, j as EvalCriterion, k as EvalOutcome, b as EvalResult, c as EvalTier, L as LLM_EVAL_STATIC_CRITERIA, P as Priority, Q as QualityConfig, l as QualityMode, n as buildCodingCriteriaSummary, o as criteriaFor, p as getActionableIssues, q as getCriteriaByPriority, r as getCriterionById, s as getLLMCriteria, t as isBlocked, m as matches, u as notApplicableCoverage, v as priorityForIssue } from '../types-public-CzYqZclY.js';
1
+ import { C as CanvasJudgeRecord, E as EvalIssue, V as VisualEvalSummary, d as VisualCoverage } from '../types-public-Ow-tNtFE.js';
2
+ export { A as AxisCheck, a as AxisCheckInput, e as CRITERIA, f as CanvasVisualSummary, g as ContractFeedbackRecord, h as CriterionCoverage, i as CriterionRunStatus, D as DEFAULT_QUALITY_CONFIG, j as EvalCategory, k as EvalCriterion, l as EvalOutcome, b as EvalResult, c as EvalTier, L as LLM_EVAL_STATIC_CRITERIA, n as Priority, Q as QualityConfig, o as QualityMode, p as buildCodingCriteriaSummary, q as criteriaFor, r as getActionableIssues, s as getCriteriaByPriority, t as getCriterionById, u as getLLMCriteria, v as isBlocked, m as matches, w as notApplicableCoverage, x as priorityForIssue } from '../types-public-Ow-tNtFE.js';
3
3
  import * as _anthropic_ai_claude_agent_sdk from '@anthropic-ai/claude-agent-sdk';
4
4
  import { McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
5
5
  import { EvaluationContext, EvaluationConfig, QualityMetadata, EvaluationResult, EvaluationIssue } from './types.js';
6
6
  export { DEFAULT_EVAL_MAX_ROUNDS, DimensionScores, MAX_EVAL_ROUNDS_HARD_LIMIT } from './types.js';
7
- export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-DGvhmARp.js';
7
+ export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-wxaIMwZt.js';
8
8
  import { A as AgentConfig, L as LLMResponse } from '../llm-router-DwwUK1bz.js';
9
9
  import { G as GenerationProfileInput } from '../styling-profile-CxfvV48g.js';
10
10
  import { LaunchOptions } from 'puppeteer-core';
@@ -6,7 +6,7 @@ import { LUCIDE_ICON_NAMES, maxWidth } from '@ggui-ai/design';
6
6
  import { createHash } from 'crypto';
7
7
  import { build } from 'esbuild';
8
8
  import { getCssTokens, composeThemeCss, fillFitRule } from '@ggui-ai/design/rendering';
9
- import { readFileSync, readdirSync, statSync, mkdirSync, writeFileSync, unlinkSync, existsSync } from 'fs';
9
+ import { readFileSync, readdirSync, statSync, mkdtempSync, writeFileSync, rmSync, existsSync } from 'fs';
10
10
  import { resolve, relative, dirname } from 'path';
11
11
  import { fileURLToPath } from 'url';
12
12
  import { createRequire } from 'module';
@@ -427,17 +427,42 @@ function createAnthropicClient(rawKey) {
427
427
  }
428
428
 
429
429
  // src/adapters/claude/claude-code-login.ts
430
- var PROVIDER_KEY_ENV_NAMES = [
431
- "ANTHROPIC_API_KEY",
432
- "CLAUDE_API_KEY",
433
- "ANTHROPIC_AUTH_TOKEN",
434
- "ANTHROPIC_BASE_URL"
430
+ var LOGIN_CHILD_ENV_NAMES = [
431
+ "PATH",
432
+ "HOME",
433
+ "USER",
434
+ "LOGNAME",
435
+ "SHELL",
436
+ "TMPDIR",
437
+ "TMP",
438
+ "TEMP",
439
+ "TERM",
440
+ "TZ",
441
+ "LANG",
442
+ "CLAUDE_CONFIG_DIR",
443
+ "CLAUDE_CODE_OAUTH_TOKEN",
444
+ "XDG_CONFIG_HOME",
445
+ "XDG_DATA_HOME",
446
+ "XDG_CACHE_HOME",
447
+ "XDG_STATE_HOME",
448
+ "XDG_RUNTIME_DIR",
449
+ "HTTPS_PROXY",
450
+ "https_proxy",
451
+ "HTTP_PROXY",
452
+ "http_proxy",
453
+ "NO_PROXY",
454
+ "no_proxy",
455
+ "ALL_PROXY",
456
+ "all_proxy",
457
+ "NODE_EXTRA_CA_CERTS",
458
+ "SSL_CERT_FILE",
459
+ "SSL_CERT_DIR"
435
460
  ];
436
- function stripProviderKeyEnv(env) {
461
+ var LOGIN_CHILD_ENV = new Set(LOGIN_CHILD_ENV_NAMES);
462
+ function loginChildEnv(env) {
437
463
  const out = {};
438
- const drop = new Set(PROVIDER_KEY_ENV_NAMES);
439
464
  for (const [k, v] of Object.entries(env)) {
440
- if (v !== void 0 && !drop.has(k)) out[k] = v;
465
+ if (v !== void 0 && (LOGIN_CHILD_ENV.has(k) || k.startsWith("LC_"))) out[k] = v;
441
466
  }
442
467
  return out;
443
468
  }
@@ -585,7 +610,7 @@ function buildLoginQueryOptions(params) {
585
610
  systemPrompt: params.systemPrompt,
586
611
  maxTurns: 1,
587
612
  thinking: { type: "disabled" },
588
- env: stripProviderKeyEnv(params.env ?? process.env),
613
+ env: loginChildEnv(params.env ?? process.env),
589
614
  ...claudeCodeLoginQueryOptions(),
590
615
  ...params.tools !== void 0 ? {
591
616
  mcpServers: { [MCP_SERVER_NAME]: params.tools.server },
@@ -1162,7 +1187,7 @@ var AnthropicAgent = class extends LLMAgent {
1162
1187
  const appliedToolChoice = toolChoice === "required" && anthropicRejectsForcedToolChoice(resolvedModel) ? "auto" : toolChoice;
1163
1188
  if (appliedToolChoice !== toolChoice) {
1164
1189
  console.warn(
1165
- `[anthropic] callTools: ${normalizeAnthropicModelId(resolvedModel)} rejects forced tool_choice (HTTP 400); caller's 'required' downgraded to 'auto'`
1190
+ `[anthropic] callTools: ${normalizeAnthropicModelId(resolvedModel)} would reject a forced tool_choice (the API answers 400); caller's 'required' downgraded to 'auto' before sending`
1166
1191
  );
1167
1192
  }
1168
1193
  const response = await this.apiCall(
@@ -2014,7 +2039,7 @@ var OpenRouterAgent = class extends LLMAgent {
2014
2039
  const appliedToolChoice = requested === "required" && anthropicRejectsForcedToolChoice(resolved) ? "auto" : requested;
2015
2040
  if (appliedToolChoice !== requested) {
2016
2041
  console.warn(
2017
- `[openrouter] callTools: ${resolved} rejects forced tool_choice (HTTP 400); caller's 'required' downgraded to 'auto'`
2042
+ `[openrouter] callTools: ${resolved} would reject a forced tool_choice (the API answers 400); caller's 'required' downgraded to 'auto' before sending`
2018
2043
  );
2019
2044
  }
2020
2045
  const response = await this.apiCall(
@@ -3772,16 +3797,31 @@ function runStateCoversPayload(input) {
3772
3797
  }
3773
3798
  return issues;
3774
3799
  }
3800
+ function seedsFromProp(src, name) {
3801
+ const propRef = `props\\??\\.${name}\\b`;
3802
+ const initializerReads = (ref) => new RegExp(`useState(?:<[^>]*>)?\\s*\\([\\s\\S]{0,400}?${ref}`).test(src);
3803
+ if (initializerReads(propRef)) return true;
3804
+ const locals = /* @__PURE__ */ new Set();
3805
+ for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\s+(\\w+)\\s*(?::[^=]{1,80})?=\\s*[^;]{0,300}?${propRef}`, "g"))) {
3806
+ const id = m[1];
3807
+ if (id !== void 0) locals.add(id);
3808
+ }
3809
+ for (const m of src.matchAll(new RegExp(`(?:const|let|var)\\s*\\{([^}]{1,400})\\}\\s*=\\s*[^;]{0,300}?${propRef}`, "g"))) {
3810
+ for (const part of (m[1] ?? "").split(",")) {
3811
+ const id = part.split(":").pop()?.split("=")[0]?.trim();
3812
+ if (id !== void 0 && /^\w+$/.test(id)) locals.add(id);
3813
+ }
3814
+ }
3815
+ for (const id of locals) if (initializerReads(`\\b${id}\\b`)) return true;
3816
+ return false;
3817
+ }
3775
3818
  function runInitialValuesSeeded(input) {
3776
3819
  if (input.compiledCode === null) return [];
3777
3820
  const src = input.sourceCode;
3778
3821
  const initialProps = getInitialValuePropNames(input.contract);
3779
3822
  const issues = [];
3780
3823
  for (const name of initialProps) {
3781
- const re = new RegExp(
3782
- `useState(?:<[^>]*>)?\\s*\\([\\s\\S]{0,400}?props\\.${name}\\b`
3783
- );
3784
- if (re.test(src)) continue;
3824
+ if (seedsFromProp(src, name)) continue;
3785
3825
  issues.push(
3786
3826
  mkIssue(
3787
3827
  "state.payload.initial_values_seeded",
@@ -4573,8 +4613,7 @@ function resolveDesignPackageDir() {
4573
4613
  }
4574
4614
  }
4575
4615
  async function bundleForRendering(compiledCode, sampleProps, designSrc = resolve(resolveDesignPackageDir(), "src")) {
4576
- const tmpDir = resolve(tmpdir(), "ggui-visual-eval-" + Date.now());
4577
- mkdirSync(tmpDir, { recursive: true });
4616
+ const tmpDir = mkdtempSync(resolve(tmpdir(), "ggui-visual-eval-"));
4578
4617
  const componentFile = resolve(tmpDir, "component.tsx");
4579
4618
  const entryFile = resolve(tmpDir, "entry.tsx");
4580
4619
  const designPkgDir = resolve(designSrc, "..");
@@ -4649,14 +4688,7 @@ try {
4649
4688
  });
4650
4689
  return result.outputFiles[0]?.text ?? "";
4651
4690
  } finally {
4652
- try {
4653
- unlinkSync(entryFile);
4654
- } catch {
4655
- }
4656
- try {
4657
- unlinkSync(componentFile);
4658
- } catch {
4659
- }
4691
+ rmSync(tmpDir, { recursive: true, force: true });
4660
4692
  }
4661
4693
  }
4662
4694
  function buildRenderHTML(bundledCode, cssTokens, fit) {