@ggui-ai/ui-gen 0.23.0 → 0.25.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 (123) hide show
  1. package/dist/adapter-Cg_rkpGq.d.ts +201 -0
  2. package/dist/adapters/generation-dispatch.d.ts +58 -15
  3. package/dist/adapters/generation-dispatch.js +1418 -180
  4. package/dist/adapters/generation-dispatch.js.map +1 -1
  5. package/dist/adapters/index.js +3 -1
  6. package/dist/adapters/index.js.map +1 -1
  7. package/dist/advanced/index.d.ts +12 -8
  8. package/dist/advanced/index.js +1467 -239
  9. package/dist/advanced/index.js.map +1 -1
  10. package/dist/{axes-CzLEMDeB.d.ts → axes-CKVCzR_x.d.ts} +1 -1
  11. package/dist/bank-CT4eEkta.d.ts +118 -0
  12. package/dist/blueprint-validator.js +153 -59
  13. package/dist/blueprint-validator.js.map +1 -1
  14. package/dist/boilerplate.js +24 -12
  15. package/dist/boilerplate.js.map +1 -1
  16. package/dist/check/index.d.ts +12 -4
  17. package/dist/check/index.js +94 -2
  18. package/dist/check/index.js.map +1 -1
  19. package/dist/classifier/index.d.ts +2 -2
  20. package/dist/compose.d.ts +2 -2
  21. package/dist/{create-ui-generator-D0kbWwln.d.ts → create-ui-generator-DFnnArrv.d.ts} +43 -11
  22. package/dist/{dispatch-wxaIMwZt.d.ts → dispatch-CStl9eAw.d.ts} +5 -3
  23. package/dist/evaluation/axis-checks/index.d.ts +6 -5
  24. package/dist/evaluation/axis-checks/index.js +90 -2
  25. package/dist/evaluation/axis-checks/index.js.map +1 -1
  26. package/dist/evaluation/axis-checks/registry.d.ts +4 -3
  27. package/dist/evaluation/axis-checks/registry.js +88 -1
  28. package/dist/evaluation/axis-checks/registry.js.map +1 -1
  29. package/dist/evaluation/index.d.ts +301 -23
  30. package/dist/evaluation/index.js +746 -30
  31. package/dist/evaluation/index.js.map +1 -1
  32. package/dist/evaluation/types.d.ts +9 -1
  33. package/dist/evaluation/types.js.map +1 -1
  34. package/dist/fragments/index.d.ts +3 -3
  35. package/dist/harness/check/runtime-render/index.d.ts +30 -11
  36. package/dist/harness/check/runtime-render/index.js +203 -60
  37. package/dist/harness/check/runtime-render/index.js.map +1 -1
  38. package/dist/harness/check/runtime-render/render-check-worker.d.ts +8 -1
  39. package/dist/harness/check/runtime-render/render-check-worker.js +72 -32
  40. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  41. package/dist/harness/index.d.ts +5 -4
  42. package/dist/harness/index.js +33 -15
  43. package/dist/harness/index.js.map +1 -1
  44. package/dist/harness/prompts.js.map +1 -1
  45. package/dist/harness/result-types.d.ts +4 -3
  46. package/dist/harness/runtime.d.ts +11 -4
  47. package/dist/harness/runtime.js +26 -14
  48. package/dist/harness/runtime.js.map +1 -1
  49. package/dist/harness/types-public.d.ts +13 -4
  50. package/dist/harness/types-public.js +33 -15
  51. package/dist/harness/types-public.js.map +1 -1
  52. package/dist/harness/validator-trace-sink.d.ts +4 -3
  53. package/dist/hash.d.ts +1 -1
  54. package/dist/index.d.ts +59 -8
  55. package/dist/index.js +1476 -241
  56. package/dist/index.js.map +1 -1
  57. package/dist/{llm-router-DwwUK1bz.d.ts → llm-router-nfO7wPec.d.ts} +3 -1
  58. package/dist/patch.d.ts +4 -3
  59. package/dist/policy.d.ts +8 -5
  60. package/dist/policy.js.map +1 -1
  61. package/dist/tools/get-primitives-ts.d.ts +1 -1
  62. package/dist/tools/get-primitives-ts.js +1 -1
  63. package/dist/tools/get-primitives-ts.js.map +1 -1
  64. package/dist/tools/render-check-worker.d.ts +7 -1
  65. package/dist/tools/render-check-worker.js +55 -23
  66. package/dist/tools/render-check-worker.js.map +1 -1
  67. package/dist/{types-BOvHNG7K.d.ts → types-Dh1s4K9j.d.ts} +1 -1
  68. package/dist/{types-public-Ow-tNtFE.d.ts → types-public-BJTLpzWn.d.ts} +208 -15
  69. package/dist/validation/index.d.ts +1 -1
  70. package/dist/validation/index.js +1 -1
  71. package/dist/validation/index.js.map +1 -1
  72. package/dist/workflows.d.ts +4 -3
  73. package/package.json +12 -12
  74. package/src/adapters/generation-dispatch.ts +173 -98
  75. package/src/adapters/tools.ts +2 -1
  76. package/src/boilerplate/free-design-prompt.ts +1 -1
  77. package/src/boilerplate/generate.ts +26 -1
  78. package/src/boilerplate/hard-sections.ts +13 -13
  79. package/src/boilerplate/system-prompt.ts +1 -1
  80. package/src/check/index.ts +1 -0
  81. package/src/check/run-tier0.ts +80 -1
  82. package/src/check/sample-props.ts +63 -0
  83. package/src/coding-agent/tools.ts +4 -1
  84. package/src/create-harness.ts +3 -3
  85. package/src/create-ui-generator.ts +204 -95
  86. package/src/evaluation/__fixtures__/png.ts +100 -0
  87. package/src/evaluation/axis-checks/checks/state-merge.ts +1 -1
  88. package/src/evaluation/axis-checks/checks/universal.ts +111 -0
  89. package/src/evaluation/axis-checks/dispatch.ts +4 -1
  90. package/src/evaluation/criteria/bank.ts +85 -0
  91. package/src/evaluation/criteria/context.ts +52 -0
  92. package/src/evaluation/criteria/resolve.ts +159 -0
  93. package/src/evaluation/criteria/select.ts +79 -0
  94. package/src/evaluation/index.ts +23 -0
  95. package/src/evaluation/ink-extent.ts +200 -0
  96. package/src/evaluation/theme-css.ts +12 -5
  97. package/src/evaluation/types-public.ts +200 -11
  98. package/src/evaluation/types.ts +9 -0
  99. package/src/evaluation/visual-evaluator.ts +636 -30
  100. package/src/harness/check/runtime-render/adapter.ts +221 -75
  101. package/src/harness/check/runtime-render/index.ts +75 -2
  102. package/src/harness/check/runtime-render/render-check-host.ts +82 -19
  103. package/src/harness/check/runtime-render/render-check-worker.ts +83 -29
  104. package/src/harness/check/runtime-render/render-check.ts +154 -117
  105. package/src/harness/coding/generate-task-runner.ts +60 -4
  106. package/src/harness/coding/init-session.ts +13 -0
  107. package/src/harness/coding/run-coding-turn.ts +7 -3
  108. package/src/harness/coding/run-eval-round.ts +257 -15
  109. package/src/harness/policy.ts +11 -0
  110. package/src/harness/primitive-slice.ts +104 -0
  111. package/src/harness/runtime.ts +5 -0
  112. package/src/harness/types-public.ts +9 -1
  113. package/src/harness-tool-names.ts +38 -0
  114. package/src/index.ts +16 -0
  115. package/src/policy.ts +7 -4
  116. package/src/run-check.ts +2 -0
  117. package/src/tools/get-primitives-ts.ts +1 -1
  118. package/src/tools/get-wire.ts +1 -1
  119. package/src/tools/render-check-worker.ts +74 -23
  120. package/src/tools/render-check.ts +0 -60
  121. package/src/tools.ts +11 -1
  122. package/src/validation/primitives.ts +1 -1
  123. package/dist/render-check-Blwj8gB6.d.ts +0 -105
@@ -1,9 +1,10 @@
1
1
  import { DataContract, JsonObject, PropsSpec, ActionSpec, StreamSpec } from '@ggui-ai/protocol';
2
2
  import { D as DesignMode } from '../design-mode-DLufhrNp.js';
3
- import { b as EvalResult, E as EvalIssue } from '../types-public-Ow-tNtFE.js';
3
+ import { b as EvalResult, E as EvalIssue } from '../types-public-BJTLpzWn.js';
4
4
  export { j as jsonSchemaTypeToTs } from '../json-schema-ts-CbB78b3n.js';
5
- import '../axes-CzLEMDeB.js';
6
- import '../types-BOvHNG7K.js';
5
+ import '@ggui-ai/mcp-server-core';
6
+ import '../axes-CKVCzR_x.js';
7
+ import '../types-Dh1s4K9j.js';
7
8
 
8
9
  /**
9
10
  * The four contract-declared wire kinds, matching `@ggui-ai/wire` hooks.
@@ -243,4 +244,11 @@ designMode?: DesignMode): Promise<EvalIssue[]>;
243
244
  */
244
245
  declare function runTier0(sourceCode: string, contract?: DataContract, designMode?: DesignMode): Promise<EvalResult>;
245
246
 
246
- export { type ContractIssue, type ReactLintDiagnostic, type TypeCheckDiagnostic, type TypeCheckResult, type WireCallSite, type WireImportReport, type WireImportSite, type WireKind, type WirePreservationReport, checkWireImports, checkWirePreservation, collectExpectedWires, extractPropsInterface, extractWireCallSites, extractWireImports, inferPropsSpecFromSampleData, lintReactHooks, propsSpecToTypeScript, runTier0, runTier0Checks, typecheck, validateActionSpecConformance, validateAllContracts, validatePropsAgainstSchema, validateStreamSpecConformance };
247
+ /**
248
+ * Generate sample props from a PropsSpec contract.
249
+ * Uses `example` values from each PropEntry when available,
250
+ * otherwise synthesizes plausible defaults from the JSON Schema.
251
+ */
252
+ declare function generateSampleProps(spec: PropsSpec): JsonObject;
253
+
254
+ export { type ContractIssue, type ReactLintDiagnostic, type TypeCheckDiagnostic, type TypeCheckResult, type WireCallSite, type WireImportReport, type WireImportSite, type WireKind, type WirePreservationReport, checkWireImports, checkWirePreservation, collectExpectedWires, extractPropsInterface, extractWireCallSites, extractWireImports, generateSampleProps, inferPropsSpecFromSampleData, lintReactHooks, propsSpecToTypeScript, runTier0, runTier0Checks, typecheck, validateActionSpecConformance, validateAllContracts, validatePropsAgainstSchema, validateStreamSpecConformance };
@@ -1024,6 +1024,52 @@ function detectCertainDoubleWiredActions(sourceCode, actionBindings, designMode
1024
1024
  return issues;
1025
1025
  }
1026
1026
  var MANIFEST_TOKENS = new Set(consumedTokenManifest);
1027
+ var RETIRED_TOKEN_SUCCESSORS = /* @__PURE__ */ new Map([
1028
+ ["--ggui-color-surface", "--ggui-color-container"],
1029
+ ["--ggui-color-onSurface", "--ggui-color-onContainer"],
1030
+ ["--ggui-color-surfaceVariant", "--ggui-color-sunken"],
1031
+ ["--ggui-color-onSurfaceVariant", "--ggui-color-onSunken"]
1032
+ ]);
1033
+ function suggestManifestTokens(name) {
1034
+ const successor = RETIRED_TOKEN_SUCCESSORS.get(name);
1035
+ if (successor !== void 0) return [successor];
1036
+ const segments = name.split("-").filter((segment) => segment.length > 0);
1037
+ const own = name.endsWith("-") ? segments.length : segments.length - 1;
1038
+ for (let n = own; n >= 2; n--) {
1039
+ const prefix = `--${segments.slice(0, n).join("-")}-`;
1040
+ const family = consumedTokenManifest.filter((token) => token.startsWith(prefix));
1041
+ if (family.length > 0) return wordHitsFirst(name, rolesFirst(family));
1042
+ }
1043
+ const words = new Set(
1044
+ segments.slice(1).filter((segment) => segment.length >= 4).map((segment) => segment.toLowerCase())
1045
+ );
1046
+ return rolesFirst(
1047
+ consumedTokenManifest.filter(
1048
+ (token) => token.split("-").some((segment) => words.has(segment.toLowerCase()))
1049
+ )
1050
+ );
1051
+ }
1052
+ function wordHitsFirst(name, family) {
1053
+ const word = name.slice(name.lastIndexOf("-") + 1).toLowerCase();
1054
+ if (word.length < 4) return family;
1055
+ const hit = (token) => token.slice(token.lastIndexOf("-") + 1).toLowerCase().includes(word);
1056
+ return [...family.filter(hit), ...family.filter((token) => !hit(token))];
1057
+ }
1058
+ function rolesFirst(tokens) {
1059
+ const isRole = (token) => !/^\d+$/.test(token.slice(token.lastIndexOf("-") + 1));
1060
+ return [...tokens.filter(isRole), ...tokens.filter((token) => !isRole(token))];
1061
+ }
1062
+ function offManifestHint(name) {
1063
+ const successor = RETIRED_TOKEN_SUCCESSORS.get(name);
1064
+ if (successor !== void 0) {
1065
+ return `"${name}" was retired (ggui#987); the current name is var(${successor}). `;
1066
+ }
1067
+ const near = suggestManifestTokens(name);
1068
+ if (near.length === 0) return "";
1069
+ const shown = near.slice(0, 8).map((token) => `var(${token})`).join(", ");
1070
+ const more = near.length > 8 ? ` (and ${near.length - 8} more in that family)` : "";
1071
+ return `Nearest names in the manifest: ${shown}${more}. `;
1072
+ }
1027
1073
  var TOKEN_REF_RE = /var\(\s*(--ggui-[a-zA-Z0-9-]+)/g;
1028
1074
  var HOOK_NAME_FOR = {
1029
1075
  action: "useAction",
@@ -1257,7 +1303,7 @@ ${errorDetail}`,
1257
1303
  subcategory: "off-manifest-token",
1258
1304
  severity: "critical",
1259
1305
  description: `Token "${name}" is not in the design system's token manifest \u2014 no theme defines it, so it renders unset.`,
1260
- 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-onContainer), \u2026; spacing: var(--ggui-spacing-4); type: var(--ggui-font-size-sm)). Never invent a name and never add a literal fallback.`,
1306
+ fix: `${offManifestHint(name)}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-onContainer), \u2026; spacing: var(--ggui-spacing-4); type: var(--ggui-font-size-sm)). Never invent a name and never add a literal fallback.`,
1261
1307
  line: lineNum
1262
1308
  });
1263
1309
  }
@@ -1775,6 +1821,52 @@ async function runTier0(sourceCode, contract, designMode = DEFAULT_DESIGN_MODE)
1775
1821
  return { issues, pass };
1776
1822
  }
1777
1823
 
1778
- export { checkWireImports, checkWirePreservation, collectExpectedWires, extractPropsInterface, extractWireCallSites, extractWireImports, inferPropsSpecFromSampleData, jsonSchemaTypeToTs, lintReactHooks, propsSpecToTypeScript, runTier0, runTier0Checks, typecheck, validateActionSpecConformance, validateAllContracts, validatePropsAgainstSchema, validateStreamSpecConformance };
1824
+ // src/check/sample-props.ts
1825
+ function generateSampleProps(spec) {
1826
+ const props = {};
1827
+ for (const [name, entry] of Object.entries(spec.properties)) {
1828
+ if (entry.example !== void 0) {
1829
+ props[name] = entry.example;
1830
+ continue;
1831
+ }
1832
+ if (entry.default !== void 0) {
1833
+ props[name] = entry.default;
1834
+ continue;
1835
+ }
1836
+ props[name] = synthesizeFromSchema(entry.schema);
1837
+ }
1838
+ return props;
1839
+ }
1840
+ function synthesizeFromSchema(schema) {
1841
+ const declared = Array.isArray(schema.type) ? schema.type.find((t) => t !== "null") : schema.type;
1842
+ switch (declared) {
1843
+ case "string":
1844
+ return "sample";
1845
+ case "number":
1846
+ case "integer":
1847
+ return 0;
1848
+ case "boolean":
1849
+ return false;
1850
+ case "null":
1851
+ return null;
1852
+ case "array": {
1853
+ if (schema.items) return [synthesizeFromSchema(schema.items) ?? null];
1854
+ return [];
1855
+ }
1856
+ case "object": {
1857
+ const obj = {};
1858
+ if (schema.properties) {
1859
+ for (const [k, v] of Object.entries(schema.properties)) {
1860
+ obj[k] = synthesizeFromSchema(v);
1861
+ }
1862
+ }
1863
+ return obj;
1864
+ }
1865
+ default:
1866
+ return void 0;
1867
+ }
1868
+ }
1869
+
1870
+ export { checkWireImports, checkWirePreservation, collectExpectedWires, extractPropsInterface, extractWireCallSites, extractWireImports, generateSampleProps, inferPropsSpecFromSampleData, jsonSchemaTypeToTs, lintReactHooks, propsSpecToTypeScript, runTier0, runTier0Checks, typecheck, validateActionSpecConformance, validateAllContracts, validatePropsAgainstSchema, validateStreamSpecConformance };
1779
1871
  //# sourceMappingURL=index.js.map
1780
1872
  //# sourceMappingURL=index.js.map