@ggui-ai/ui-gen 0.12.0 → 0.14.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 (62) hide show
  1. package/dist/adapters/generation-dispatch.d.ts +2 -2
  2. package/dist/adapters/generation-dispatch.js +190 -57
  3. package/dist/adapters/generation-dispatch.js.map +1 -1
  4. package/dist/adapters/index.js +5 -8
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/advanced/index.d.ts +3 -3
  7. package/dist/advanced/index.js +190 -57
  8. package/dist/advanced/index.js.map +1 -1
  9. package/dist/blueprint-validator.js +2 -7
  10. package/dist/blueprint-validator.js.map +1 -1
  11. package/dist/boilerplate.js +4 -4
  12. package/dist/boilerplate.js.map +1 -1
  13. package/dist/check/index.d.ts +1 -1
  14. package/dist/check/index.js +55 -15
  15. package/dist/check/index.js.map +1 -1
  16. package/dist/{create-ui-generator-CF0EL0Li.d.ts → create-ui-generator-D6TKuv9V.d.ts} +2 -2
  17. package/dist/{dispatch-D75M-OfZ.d.ts → dispatch-BuZfTh9r.d.ts} +1 -1
  18. package/dist/evaluation/axis-checks/index.d.ts +3 -3
  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/index.d.ts +3 -3
  22. package/dist/evaluation/index.js +79 -16
  23. package/dist/evaluation/index.js.map +1 -1
  24. package/dist/harness/check/runtime-render/index.d.ts +1 -1
  25. package/dist/harness/check/runtime-render/index.js +2 -7
  26. package/dist/harness/check/runtime-render/index.js.map +1 -1
  27. package/dist/harness/index.d.ts +2 -2
  28. package/dist/harness/index.js +64 -19
  29. package/dist/harness/index.js.map +1 -1
  30. package/dist/harness/prompts.js +2 -0
  31. package/dist/harness/prompts.js.map +1 -1
  32. package/dist/harness/result-types.d.ts +1 -1
  33. package/dist/harness/runtime.d.ts +2 -2
  34. package/dist/harness/runtime.js +5 -5
  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 -4
  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 +3 -3
  41. package/dist/index.js +190 -57
  42. package/dist/index.js.map +1 -1
  43. package/dist/{llm-router-BEVtbAb9.d.ts → llm-router-D7fjBhtr.d.ts} +39 -0
  44. package/dist/patch.d.ts +1 -1
  45. package/dist/provider-adapter-contract.js +1017 -731
  46. package/dist/provider-adapter-contract.js.map +1 -1
  47. package/dist/{types-public-DIpjC-OA.d.ts → types-public-CkNWEov9.d.ts} +64 -1
  48. package/dist/validation/index.d.ts +1 -1
  49. package/dist/validation/index.js +1 -1
  50. package/dist/validation/index.js.map +1 -1
  51. package/dist/workflows.d.ts +1 -1
  52. package/package.json +22 -22
  53. package/src/adapters/provider-router.ts +9 -0
  54. package/src/boilerplate/system-prompt.ts +4 -4
  55. package/src/check/run-tier0.ts +109 -22
  56. package/src/evaluation/index.ts +4 -0
  57. package/src/evaluation/llm-evaluator.ts +52 -8
  58. package/src/evaluation/types-public.ts +79 -0
  59. package/src/evaluation/visual-evaluator.ts +27 -5
  60. package/src/harness/coding/run-eval-round.ts +32 -6
  61. package/src/harness/llm-router.ts +128 -2
  62. package/src/validation/primitives.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { A as AxisCheck } from '../../types-public-DIpjC-OA.js';
1
+ import { A as AxisCheck } from '../../types-public-CkNWEov9.js';
2
2
  import '@ggui-ai/protocol';
3
3
  import '../../axes-CzLEMDeB.js';
4
4
  import '../../types-BOvHNG7K.js';
@@ -1,10 +1,10 @@
1
- export { A as AxisCheck, a as AxisCheckInput, C as CRITERIA, D as DEFAULT_QUALITY_CONFIG, d as EvalCategory, e as EvalCriterion, E as EvalIssue, f as EvalOutcome, b as EvalResult, c as EvalTier, P as Priority, Q as QualityConfig, g as QualityMode, h as buildCodingCriteriaSummary, i as getActionableIssues, j as getCriteriaByPriority, k as getCriterionById, l as getLLMCriteria, n as isBlocked, m as matches, p as priorityForIssue } from '../types-public-DIpjC-OA.js';
1
+ export { A as AxisCheck, a as AxisCheckInput, C as CRITERIA, d as CriterionCoverage, e as CriterionRunStatus, D as DEFAULT_QUALITY_CONFIG, f as EvalCategory, g as EvalCriterion, E as EvalIssue, h as EvalOutcome, b as EvalResult, c as EvalTier, L as LLM_EVAL_STATIC_CRITERIA, P as Priority, Q as QualityConfig, i as QualityMode, j as buildCodingCriteriaSummary, k as getActionableIssues, l as getCriteriaByPriority, n as getCriterionById, o as getLLMCriteria, p as isBlocked, m as matches, q as notApplicableCoverage, r as priorityForIssue } from '../types-public-CkNWEov9.js';
2
2
  import * as _anthropic_ai_claude_agent_sdk from '@anthropic-ai/claude-agent-sdk';
3
3
  import { McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
4
4
  import { EvaluationContext, EvaluationConfig, QualityMetadata, EvaluationResult, EvaluationIssue } from './types.js';
5
5
  export { DEFAULT_EVAL_MAX_ROUNDS, DimensionScores, MAX_EVAL_ROUNDS_HARD_LIMIT } from './types.js';
6
- export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-D75M-OfZ.js';
7
- import { A as AgentConfig, L as LLMResponse } from '../llm-router-BEVtbAb9.js';
6
+ export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-BuZfTh9r.js';
7
+ import { A as AgentConfig, L as LLMResponse } from '../llm-router-D7fjBhtr.js';
8
8
  import '@ggui-ai/protocol';
9
9
  import '../axes-CzLEMDeB.js';
10
10
  import '../types-BOvHNG7K.js';
@@ -3,16 +3,12 @@ import Anthropic from '@anthropic-ai/sdk';
3
3
  import { z } from 'zod';
4
4
  import { listContractGadgets, HOOK_NAME_RE, STDLIB_GADGETS_PACKAGE } from '@ggui-ai/protocol';
5
5
  import 'esbuild';
6
+ import '@ggui-ai/design/rendering';
6
7
 
7
8
  var __defProp = Object.defineProperty;
8
9
  var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __esm = (fn, res, err) => function __init() {
10
- if (err) throw err[0];
11
- try {
12
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
- } catch (e) {
14
- throw err = [e], e;
15
- }
10
+ var __esm = (fn, res) => function __init() {
11
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
12
  };
17
13
  var __export = (target, all) => {
18
14
  for (var name in all)
@@ -132,6 +128,23 @@ var init_client = __esm({
132
128
  });
133
129
 
134
130
  // src/evaluation/types-public.ts
131
+ var LLM_EVAL_STATIC_CRITERIA = [
132
+ { criterion: "functionality", tier: 1 },
133
+ { criterion: "crash", tier: 1 },
134
+ { criterion: "interactivity", tier: 2 },
135
+ { criterion: "accessibility", tier: 2 },
136
+ { criterion: "layout", tier: 2 },
137
+ { criterion: "loading", tier: 2 },
138
+ { criterion: "visual", tier: 2 }
139
+ ];
140
+ function notApplicableCoverage(reason) {
141
+ return LLM_EVAL_STATIC_CRITERIA.map(({ criterion, tier }) => ({
142
+ criterion,
143
+ tier,
144
+ status: "not-applicable",
145
+ reason
146
+ }));
147
+ }
135
148
  var DEFAULT_QUALITY_CONFIG = {
136
149
  quality: "fast",
137
150
  visualEval: false,
@@ -380,7 +393,16 @@ function getBedrockModelId(model) {
380
393
  const BEDROCK_MAP = {
381
394
  "anthropic/claude-haiku-4-5": "us.anthropic.claude-haiku-4-5-20251001-v1:0",
382
395
  "anthropic/claude-sonnet-4-6": "us.anthropic.claude-sonnet-4-6",
383
- "anthropic/claude-opus-4-6": "us.anthropic.claude-opus-4-6-v1:0"
396
+ "anthropic/claude-opus-4-6": "us.anthropic.claude-opus-4-6-v1:0",
397
+ // Claude 5-family (ggui#706, strings verified 2026-09-02 against
398
+ // platform.claude.com; Bedrock base form `anthropic.<id>`, upcast to
399
+ // the cross-region profile). Explicit so the ids are pinned by test,
400
+ // not merely reachable through the generic fallback below.
401
+ "anthropic/claude-fable-5-1": "us.anthropic.claude-fable-5-1",
402
+ "anthropic/claude-opus-5": "us.anthropic.claude-opus-5",
403
+ "anthropic/claude-sonnet-5": "us.anthropic.claude-sonnet-5",
404
+ // Legacy (still available; registry state `legacy`, not deprecated).
405
+ "anthropic/claude-fable-5": "us.anthropic.claude-fable-5"
384
406
  };
385
407
  const normalized = model.replace(/^anthropic\./, "anthropic/");
386
408
  if (BEDROCK_MAP[normalized]) return BEDROCK_MAP[normalized];
@@ -619,6 +641,32 @@ var LLMAgent = class {
619
641
  }
620
642
  }
621
643
  };
644
+ function normalizeAnthropicModelId(model) {
645
+ return model.replace(/^anthropic\//, "").replace(/^(?:[a-z]{2}\.)?anthropic\./, "");
646
+ }
647
+ function anthropicRejectsSamplingParams(model) {
648
+ return /^claude-(?:opus-4-7|opus-5|sonnet-5|fable-5)(?:-|$)/.test(
649
+ normalizeAnthropicModelId(model)
650
+ );
651
+ }
652
+ function anthropicRejectsForcedToolChoice(model) {
653
+ return /^claude-fable-5-1(?:-|$)/.test(normalizeAnthropicModelId(model));
654
+ }
655
+ function resolveAnthropicSampling(model, temperature) {
656
+ if (temperature === void 0) {
657
+ return { request: {}, applied: { temperature: "provider-default" } };
658
+ }
659
+ if (anthropicRejectsSamplingParams(model)) {
660
+ return {
661
+ request: {},
662
+ applied: {
663
+ temperature: "provider-default",
664
+ strippedReason: `${normalizeAnthropicModelId(model)} rejects non-default sampling params (HTTP 400 on Opus 4.7+/5-family); caller's temperature=${temperature} was not sent`
665
+ }
666
+ };
667
+ }
668
+ return { request: { temperature }, applied: { temperature } };
669
+ }
622
670
  var AnthropicAgent = class extends LLMAgent {
623
671
  provider = "anthropic";
624
672
  resolveModel(model) {
@@ -650,6 +698,10 @@ var AnthropicAgent = class extends LLMAgent {
650
698
  cache_control: { type: "ephemeral" }
651
699
  }
652
700
  ];
701
+ const sampling = resolveAnthropicSampling(resolvedModel, temperature);
702
+ if (sampling.applied.strippedReason !== void 0) {
703
+ console.warn(`[anthropic] callText: ${sampling.applied.strippedReason}`);
704
+ }
653
705
  try {
654
706
  const response = await this.apiCall(
655
707
  () => client.messages.create({
@@ -657,7 +709,7 @@ var AnthropicAgent = class extends LLMAgent {
657
709
  max_tokens: maxTokens ?? 4096,
658
710
  system,
659
711
  messages: [{ role: "user", content: userPrompt }],
660
- ...temperature !== void 0 && { temperature }
712
+ ...sampling.request
661
713
  })
662
714
  );
663
715
  const usage = response.usage;
@@ -689,7 +741,8 @@ var AnthropicAgent = class extends LLMAgent {
689
741
  return {
690
742
  text,
691
743
  inputTokens: response.usage.input_tokens,
692
- outputTokens: response.usage.output_tokens
744
+ outputTokens: response.usage.output_tokens,
745
+ sampling: sampling.applied
693
746
  };
694
747
  } catch (e) {
695
748
  emitLlmTraceEvent({
@@ -775,6 +828,12 @@ var AnthropicAgent = class extends LLMAgent {
775
828
  ...i === tools.length - 1 ? { cache_control: { type: "ephemeral" } } : {}
776
829
  }));
777
830
  try {
831
+ const appliedToolChoice = toolChoice === "required" && anthropicRejectsForcedToolChoice(resolvedModel) ? "auto" : toolChoice;
832
+ if (appliedToolChoice !== toolChoice) {
833
+ console.warn(
834
+ `[anthropic] callTools: ${normalizeAnthropicModelId(resolvedModel)} rejects forced tool_choice (HTTP 400); caller's 'required' downgraded to 'auto'`
835
+ );
836
+ }
778
837
  const response = await this.apiCall(
779
838
  () => client.messages.stream({
780
839
  model: resolvedModel,
@@ -782,7 +841,7 @@ var AnthropicAgent = class extends LLMAgent {
782
841
  system,
783
842
  messages: [{ role: "user", content: userPrompt }],
784
843
  tools: cachedTools,
785
- tool_choice: { type: toolChoice === "required" ? "any" : "auto" }
844
+ tool_choice: { type: appliedToolChoice === "required" ? "any" : "auto" }
786
845
  }).finalMessage()
787
846
  );
788
847
  const usage = response.usage;
@@ -824,7 +883,8 @@ var AnthropicAgent = class extends LLMAgent {
824
883
  inputTokens: response.usage.input_tokens,
825
884
  outputTokens: response.usage.output_tokens,
826
885
  cacheReadTokens: cacheRead,
827
- cacheCreationTokens: cacheCreated
886
+ cacheCreationTokens: cacheCreated,
887
+ appliedToolChoice
828
888
  };
829
889
  } catch (e) {
830
890
  emitLlmTraceEvent({
@@ -958,7 +1018,8 @@ var OpenAIAgent = class extends LLMAgent {
958
1018
  return {
959
1019
  text,
960
1020
  inputTokens: response.usage?.input_tokens ?? 0,
961
- outputTokens: response.usage?.output_tokens ?? 0
1021
+ outputTokens: response.usage?.output_tokens ?? 0,
1022
+ sampling: { temperature: temperature ?? "provider-default" }
962
1023
  };
963
1024
  }
964
1025
  async callTools(model, systemPrompt, userPrompt, tools, toolChoice = "required", _scopedTools) {
@@ -1127,7 +1188,8 @@ var GoogleAgent = class extends LLMAgent {
1127
1188
  return {
1128
1189
  text: interactionText(interaction),
1129
1190
  inputTokens: interaction.usage?.total_input_tokens ?? 0,
1130
- outputTokens: interaction.usage?.total_output_tokens ?? 0
1191
+ outputTokens: interaction.usage?.total_output_tokens ?? 0,
1192
+ sampling: { temperature: temperature ?? "provider-default" }
1131
1193
  };
1132
1194
  }
1133
1195
  async callVision(model, systemPrompt, userPrompt, image, maxTokens) {
@@ -1409,7 +1471,8 @@ var OpenRouterAgent = class extends LLMAgent {
1409
1471
  return {
1410
1472
  text,
1411
1473
  inputTokens: response.usage.prompt_tokens,
1412
- outputTokens: response.usage.completion_tokens
1474
+ outputTokens: response.usage.completion_tokens,
1475
+ sampling: { temperature: temperature ?? "provider-default" }
1413
1476
  };
1414
1477
  }
1415
1478
  async callTools(model, systemPrompt, userPrompt, tools, toolChoice, _scopedTools) {
@@ -3261,6 +3324,6 @@ Evaluate the screenshot of the generated component.`;
3261
3324
  );
3262
3325
  }
3263
3326
 
3264
- export { CRITERIA, DEFAULT_EVAL_MAX_ROUNDS, DEFAULT_QUALITY_CONFIG, MAX_EVAL_ROUNDS_HARD_LIMIT, buildCodingCriteriaSummary, buildFixPrompt, callMultimodalLLM, computeEvaluationScore, createEvaluationToolsServer, extractCompiledCode, extractCompiledCodeFromMessage, extractEvalResult, extractSourceCode, extractSourceCodeFromMessage, extractToolResultTexts, getActionableIssues, getCriteriaByPriority, getCriterionById, getEvaluatorSystemPrompt, getLLMCriteria, isBlocked, matches, priorityForIssue, runAxisChecks, runEvaluation, runEvaluationLoop };
3327
+ export { CRITERIA, DEFAULT_EVAL_MAX_ROUNDS, DEFAULT_QUALITY_CONFIG, LLM_EVAL_STATIC_CRITERIA, MAX_EVAL_ROUNDS_HARD_LIMIT, buildCodingCriteriaSummary, buildFixPrompt, callMultimodalLLM, computeEvaluationScore, createEvaluationToolsServer, extractCompiledCode, extractCompiledCodeFromMessage, extractEvalResult, extractSourceCode, extractSourceCodeFromMessage, extractToolResultTexts, getActionableIssues, getCriteriaByPriority, getCriterionById, getEvaluatorSystemPrompt, getLLMCriteria, isBlocked, matches, notApplicableCoverage, priorityForIssue, runAxisChecks, runEvaluation, runEvaluationLoop };
3265
3328
  //# sourceMappingURL=index.js.map
3266
3329
  //# sourceMappingURL=index.js.map