@ggui-ai/ui-gen 0.13.0 → 0.15.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 (63) hide show
  1. package/dist/adapters/generation-dispatch.d.ts +2 -2
  2. package/dist/adapters/generation-dispatch.js +192 -58
  3. package/dist/adapters/generation-dispatch.js.map +1 -1
  4. package/dist/adapters/index.js +7 -9
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/advanced/index.d.ts +3 -3
  7. package/dist/advanced/index.js +192 -58
  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 +57 -16
  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 +192 -58
  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 +21 -21
  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/check/type-checker.ts +12 -2
  57. package/src/evaluation/index.ts +4 -0
  58. package/src/evaluation/llm-evaluator.ts +52 -8
  59. package/src/evaluation/types-public.ts +79 -0
  60. package/src/evaluation/visual-evaluator.ts +27 -5
  61. package/src/harness/coding/run-eval-round.ts +32 -6
  62. package/src/harness/llm-router.ts +128 -2
  63. package/src/validation/primitives.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import { DataContract, JsonObject, PropsSpec, ActionSpec, StreamSpec } from '@ggui-ai/protocol';
2
- import { b as EvalResult, E as EvalIssue } from '../types-public-DIpjC-OA.js';
2
+ import { b as EvalResult, E as EvalIssue } from '../types-public-CkNWEov9.js';
3
3
  export { j as jsonSchemaTypeToTs } from '../json-schema-ts-CbB78b3n.js';
4
4
  import '../axes-CzLEMDeB.js';
5
5
  import '../types-BOvHNG7K.js';
@@ -4,6 +4,7 @@ import path from 'path';
4
4
  import { createRequire } from 'module';
5
5
  import { Linter } from 'eslint';
6
6
  import { listContractGadgets, HOOK_NAME_RE } from '@ggui-ai/protocol';
7
+ import { consumedTokenManifest } from '@ggui-ai/design/themes';
7
8
 
8
9
  // src/check/extract-wire-calls.ts
9
10
  var HOOK_TO_KIND = {
@@ -564,7 +565,8 @@ async function loadVfs() {
564
565
  function resolveRelativeInVfs(vfs, containingFile, importPath) {
565
566
  const normalized = containingFile.startsWith("/") ? containingFile.slice(1) : containingFile;
566
567
  const dir = path.posix.dirname(normalized);
567
- const resolved2 = path.posix.normalize(`${dir}/${importPath}`);
568
+ const specifier = importPath.replace(/\.(?:m|c)?js$/, "");
569
+ const resolved2 = path.posix.normalize(`${dir}/${specifier}`);
568
570
  const withDts = `${resolved2}.d.ts`;
569
571
  if (vfs.has(withDts)) return withDts;
570
572
  const withIndexDts = `${resolved2}/index.d.ts`;
@@ -1014,6 +1016,8 @@ function detectCertainDoubleWiredActions(sourceCode, actionBindings) {
1014
1016
  visit(sf);
1015
1017
  return issues;
1016
1018
  }
1019
+ var MANIFEST_TOKENS = new Set(consumedTokenManifest);
1020
+ var TOKEN_REF_RE = /var\(\s*(--ggui-[a-zA-Z0-9-]+)/g;
1017
1021
  var HOOK_NAME_FOR = {
1018
1022
  action: "useAction",
1019
1023
  stream: "useStream",
@@ -1129,23 +1133,25 @@ ${errorDetail}`,
1129
1133
  });
1130
1134
  }
1131
1135
  }
1136
+ const literalFallbackMatch = line.match(
1137
+ /var\(\s*(--ggui-[a-zA-Z0-9-]+)\s*,\s*([^)]+)\)/
1138
+ );
1139
+ const literalFallback = literalFallbackMatch !== null && !literalFallbackMatch[2].trim().startsWith("var(") ? { token: literalFallbackMatch[1], literal: literalFallbackMatch[2].trim() } : null;
1140
+ if (literalFallback !== null && !assetEscapedLines.has(lineNum)) {
1141
+ issues.push({
1142
+ tier: 0,
1143
+ result: "fail",
1144
+ category: "tokens",
1145
+ subcategory: "token-fallback",
1146
+ severity: "critical",
1147
+ description: `Literal fallback "${literalFallback.literal}" inside a token reference \u2014 the runtime injects every token, and the fallback paints the wrong value exactly when the theme matters most.`,
1148
+ fix: `Drop the fallback: write var(${literalFallback.token}) bare. If the token might not exist, that is a vocabulary problem to fix by choosing a token from the design-system docs, never by a literal.`,
1149
+ line: lineNum
1150
+ });
1151
+ }
1132
1152
  const hexMatch = line.match(/#[0-9a-fA-F]{3,8}\b/);
1133
1153
  if (hexMatch && !assetEscapedLines.has(lineNum)) {
1134
- const fallbackVarMatch = line.match(
1135
- /var\((--ggui-[a-zA-Z0-9-]+)\s*,[^)]*#[0-9a-fA-F]{3,8}/
1136
- );
1137
- if (fallbackVarMatch) {
1138
- issues.push({
1139
- tier: 0,
1140
- result: "fail",
1141
- category: "tokens",
1142
- subcategory: "token-fallback",
1143
- severity: "critical",
1144
- description: `Literal fallback "${hexMatch[0]}" inside a token reference \u2014 the runtime injects every token, and the fallback paints the wrong brand exactly when the theme matters most.`,
1145
- fix: `Drop the fallback: write var(${fallbackVarMatch[1]}) bare. If the token might not exist, that is a vocabulary problem to fix by choosing a token from the design-system docs, never by a literal.`,
1146
- line: lineNum
1147
- });
1148
- } else if (!line.includes("// fallback")) {
1154
+ if (literalFallback !== null && literalFallback.literal.includes(hexMatch[0])) ; else if (!line.includes("// fallback")) {
1149
1155
  issues.push({
1150
1156
  tier: 0,
1151
1157
  result: "fail",
@@ -1171,6 +1177,23 @@ ${errorDetail}`,
1171
1177
  line: lineNum
1172
1178
  });
1173
1179
  }
1180
+ const offManifest = /* @__PURE__ */ new Set();
1181
+ for (const m of line.matchAll(TOKEN_REF_RE)) {
1182
+ const name = m[1];
1183
+ if (!MANIFEST_TOKENS.has(name)) offManifest.add(name);
1184
+ }
1185
+ for (const name of offManifest) {
1186
+ issues.push({
1187
+ tier: 0,
1188
+ result: "fail",
1189
+ category: "tokens",
1190
+ subcategory: "off-manifest-token",
1191
+ severity: "critical",
1192
+ description: `Token "${name}" is not in the design system's token manifest \u2014 no theme defines it, so it renders unset.`,
1193
+ fix: `Choose a token that exists: the closed vocabulary is the manifest the design-system docs list (colors: var(--ggui-color-primary-500), var(--ggui-color-onSurface), \u2026; spacing: var(--ggui-spacing-4); type: var(--ggui-font-size-sm)). Never invent a name and never add a literal fallback.`,
1194
+ line: lineNum
1195
+ });
1196
+ }
1174
1197
  const rawSpacingMatch = line.match(
1175
1198
  /\b(gap|padding|paddingX|paddingY|margin|radius)\s*=\s*["'][\d.]+(?:px|rem|em)["']/
1176
1199
  );
@@ -1332,6 +1355,24 @@ ${errorDetail}`,
1332
1355
  ...detectCertainDoubleWiredActions(sourceCode, actionBindings)
1333
1356
  );
1334
1357
  }
1358
+ if (/\buseRender\s*\(/.test(sourceCode)) {
1359
+ const suppressionRe = /(?<![\w-])disabled\s*=\s*\{([^}]*)\}/gs;
1360
+ for (const m of sourceCode.matchAll(suppressionRe)) {
1361
+ const expr = m[1];
1362
+ if (!/\bisConnected\b/.test(expr)) continue;
1363
+ const attrLine = sourceCode.slice(0, m.index ?? 0).split("\n").length;
1364
+ issues.push({
1365
+ tier: 0,
1366
+ result: "fail",
1367
+ category: "interactivity",
1368
+ subcategory: "connection-suppression",
1369
+ severity: "critical",
1370
+ description: `\`disabled\` is bound to the connection state (\`${expr.trim().replace(/\s+/g, " ")}\`) \u2014 that strips the click handler, and the click is how the runtime detects that the host can relay actions again. The control stays dead after recovery.`,
1371
+ fix: "Leave the control enabled \u2014 never bind `disabled` to the connection state. The runtime presents the dead zone itself (a standing notice, then a per-gesture cue) and the attempt is how it detects recovery; a suppressed control stays dead after the host recovers.",
1372
+ line: attrLine
1373
+ });
1374
+ }
1375
+ }
1335
1376
  const propsInterfaceMatch = sourceCode.match(/interface Props\s*\{([^}]+)\}/);
1336
1377
  if (propsInterfaceMatch) {
1337
1378
  const propsBody = propsInterfaceMatch[1];