@ggui-ai/ui-gen 0.5.0-rc.2 → 0.6.1

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 (71) hide show
  1. package/dist/adapters/base.js +1 -0
  2. package/dist/adapters/base.js.map +1 -1
  3. package/dist/adapters/generation-dispatch.d.ts +1 -1
  4. package/dist/adapters/generation-dispatch.js +286 -168
  5. package/dist/adapters/generation-dispatch.js.map +1 -1
  6. package/dist/adapters/index.js +13 -2
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/advanced/index.d.ts +2 -2
  9. package/dist/advanced/index.js +287 -168
  10. package/dist/advanced/index.js.map +1 -1
  11. package/dist/blueprint-validator.js +1 -1
  12. package/dist/blueprint-validator.js.map +1 -1
  13. package/dist/boilerplate.js +13 -24
  14. package/dist/boilerplate.js.map +1 -1
  15. package/dist/check/index.d.ts +3 -3
  16. package/dist/check/index.js.map +1 -1
  17. package/dist/classifier/index.d.ts +14 -17
  18. package/dist/classifier/index.js +3 -7
  19. package/dist/classifier/index.js.map +1 -1
  20. package/dist/{create-ui-generator-CQiyjb5D.d.ts → create-ui-generator-GX7tvbyH.d.ts} +1 -1
  21. package/dist/{dispatch-CzRfy1J7.d.ts → dispatch-Deo9qzrG.d.ts} +1 -1
  22. package/dist/evaluation/axis-checks/index.d.ts +3 -3
  23. package/dist/evaluation/axis-checks/registry.d.ts +1 -1
  24. package/dist/evaluation/index.d.ts +2 -2
  25. package/dist/evaluation/index.js +12 -4
  26. package/dist/evaluation/index.js.map +1 -1
  27. package/dist/harness/check/runtime-render/index.d.ts +1 -1
  28. package/dist/harness/check/runtime-render/index.js.map +1 -1
  29. package/dist/harness/index.d.ts +1 -1
  30. package/dist/harness/index.js +25 -28
  31. package/dist/harness/index.js.map +1 -1
  32. package/dist/harness/result-types.d.ts +1 -1
  33. package/dist/harness/runtime.d.ts +1 -1
  34. package/dist/harness/runtime.js +14 -25
  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 +13 -24
  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 +2 -2
  41. package/dist/index.js +288 -168
  42. package/dist/index.js.map +1 -1
  43. package/dist/patch.d.ts +1 -1
  44. package/dist/provider-adapter-contract.js +61 -44
  45. package/dist/provider-adapter-contract.js.map +1 -1
  46. package/dist/providers/index.d.ts +2 -2
  47. package/dist/providers/index.js.map +1 -1
  48. package/dist/{types-public-D9swfbNi.d.ts → types-public-C36k1q6s.d.ts} +1 -1
  49. package/dist/validation/index.d.ts +1 -1
  50. package/dist/validation/index.js +5 -0
  51. package/dist/validation/index.js.map +1 -1
  52. package/dist/workflows.d.ts +1 -1
  53. package/package.json +12 -12
  54. package/src/blueprint-validator.ts +1 -1
  55. package/src/boilerplate/generate.ts +20 -31
  56. package/src/boilerplate/system-prompt.ts +2 -2
  57. package/src/check/extract-wire-calls.ts +2 -2
  58. package/src/classifier/axes.ts +2 -2
  59. package/src/classifier/classifier.ts +2 -2
  60. package/src/classifier/infer-layout.ts +1 -1
  61. package/src/classifier/infer-render.ts +1 -1
  62. package/src/classifier/infer-tooling.ts +1 -1
  63. package/src/classifier/infer-trigger.ts +3 -12
  64. package/src/classifier/inspect.ts +7 -7
  65. package/src/coding-agent/self-check.ts +1 -1
  66. package/src/evaluation/cost-tracker.ts +39 -11
  67. package/src/harness/check/runtime-render/render-check.ts +4 -4
  68. package/src/harness/llm-router.ts +2 -2
  69. package/src/providers/bedrock.ts +2 -2
  70. package/src/tools/get-wire.ts +1 -1
  71. package/src/validation/primitives.ts +2 -0
@@ -9,7 +9,7 @@ export { ValidatorTraceEvent, ValidatorTraceSink, getValidatorTraceSink, setVali
9
9
  export { ProcessMode } from '../policy.js';
10
10
  export { computeHarnessId, computeHarnessName, hashClassification } from '../hash.js';
11
11
  import '../axes-CzLEMDeB.js';
12
- import '../types-public-D9swfbNi.js';
12
+ import '../types-public-C36k1q6s.js';
13
13
  import '../types-BOvHNG7K.js';
14
14
 
15
15
  interface AgentConfig {
@@ -9,8 +9,13 @@ import 'zod';
9
9
 
10
10
  var __defProp = Object.defineProperty;
11
11
  var __getOwnPropNames = Object.getOwnPropertyNames;
12
- var __esm = (fn, res) => function __init() {
13
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
+ var __esm = (fn, res, err) => function __init() {
13
+ if (err) throw err[0];
14
+ try {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ } catch (e) {
17
+ throw err = [e], e;
18
+ }
14
19
  };
15
20
  var __export = (target, all) => {
16
21
  for (var name in all)
@@ -28,6 +33,8 @@ var init_types = __esm({
28
33
  this.code = code;
29
34
  this.name = "OpenRouterError";
30
35
  }
36
+ status;
37
+ code;
31
38
  get isTransient() {
32
39
  return this.status === 408 || this.status === 429 || this.status === 502 || this.status === 503;
33
40
  }
@@ -56,6 +63,7 @@ var init_client = __esm({
56
63
  "X-Title": config.siteName ?? process.env.OPENROUTER_SITE_NAME ?? "ggui"
57
64
  };
58
65
  }
66
+ config;
59
67
  baseUrl;
60
68
  headers;
61
69
  /**
@@ -1021,28 +1029,17 @@ function inferTypeFromExample(example) {
1021
1029
  }
1022
1030
  function generateBoilerplate(_userPrompt, contract, shellType, screen, composedSections, appGadgets) {
1023
1031
  const propsFields = [];
1024
- const propsData = contract?.propsSpec;
1025
- const propsProperties = propsData?.properties ?? propsData ?? {};
1026
- for (const [key, value] of Object.entries(propsProperties)) {
1027
- if (typeof value === "object" && value !== null) {
1028
- const spec = value;
1029
- const schema = spec.schema;
1030
- const required = spec.required !== false;
1031
- const nullable = schema?.nullable === true;
1032
- const tsType = schema ? (
1033
- // JsonSchema extends JsonObject, so this is a plain structural
1034
- // downcast (no `unknown` erasure) of already-shaped contract data.
1035
- jsonSchemaTypeToTs(schema)
1036
- ) : "unknown";
1037
- const fullType = nullable ? `${tsType} | null` : tsType;
1038
- const parts = [];
1039
- if (spec.description) parts.push(String(spec.description));
1040
- if (spec.default !== void 0) parts.push(`(default: ${JSON.stringify(spec.default)})`);
1041
- const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
1042
- propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
1043
- } else {
1044
- propsFields.push(` ${key}: ${typeof value === "string" ? value : "unknown"};`);
1045
- }
1032
+ const propsProperties = contract?.propsSpec?.properties ?? {};
1033
+ for (const [key, entry] of Object.entries(propsProperties)) {
1034
+ const required = entry.required !== false;
1035
+ const nullable = entry.schema.nullable === true;
1036
+ const tsType = jsonSchemaTypeToTs(entry.schema);
1037
+ const fullType = nullable ? `${tsType} | null` : tsType;
1038
+ const parts = [];
1039
+ if (entry.description) parts.push(entry.description);
1040
+ if (entry.default !== void 0) parts.push(`(default: ${JSON.stringify(entry.default)})`);
1041
+ const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
1042
+ propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
1046
1043
  }
1047
1044
  const actionTypeAliases = [];
1048
1045
  const actionHookCalls = [];
@@ -1788,10 +1785,10 @@ A \`DataContract\` declares everything a GguiSession exchanges with the outside
1788
1785
 
1789
1786
  Props arrive via \`ggui_update\` and may be partial on first render. Stream channels start empty and fill over time. Context slots start at their declared default (often \`null\`). **Never assume a field exists before you read it.**
1790
1787
 
1791
- - **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.history, stream.latest, etc.
1788
+ - **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.all, stream.latest, etc.
1792
1789
  - **Object access**: optional-chain through nested fields. \`props.user?.name ?? 'Anonymous'\` not \`props.user.name\`.
1793
1790
  - **Number ops**: default before arithmetic. \`(props.count ?? 0) + 1\` not \`props.count + 1\`.
1794
- - **Stream latest**: \`useStream\` returns \`{latest: T | undefined, history: T[]}\`. The default \`history\` is \`[]\` so it's safe to map; \`latest\` is undefined until the first frame arrives \u2014 guard before reading \`.foo\`.
1791
+ - **Stream latest**: \`useStream\` returns \`{latest: T | null, all: T[], isComplete: boolean}\`. The default \`all\` is \`[]\` so it's safe to map; \`latest\` is null until the first frame arrives \u2014 guard before reading \`.foo\`.
1795
1792
  - **Stream reconciliation**: when a stream event carries an \`action\` discriminant (e.g. \`create | move | edit | delete\`), the channel is a CRUD feed \u2014 your handler MUST branch on EVERY value: append on \`create\`, drop on \`delete\`, replace-by-id on \`move\` / \`edit\`. Merging only the "edit" case silently loses created and deleted items. Reconcile into the SAME state that seeds from \`props\` (e.g. \`useState(() => props.tasks ?? [])\`) so the seed data and the live feed render as one list \u2014 and handle an event whose id is not yet present (a \`create\` for an unknown item) by inserting it, not ignoring it.
1796
1793
  - **Loading state**: while data is still absent, render \`<Skeleton>\` placeholders \u2014 never a blank screen. \`<Skeleton variant="text" />\` for a text line, \`variant="circle"\` for an avatar slot, default \`rect\` for a block.
1797
1794
  - **Empty state**: when a list or results array is empty, render \`<EmptyState title="\u2026" description="\u2026" />\` \u2014 a region that renders nothing when empty looks broken to the user.
@@ -3298,7 +3295,7 @@ var OpenAIAgent = class extends LLMAgent {
3298
3295
  };
3299
3296
  function interactionText(interaction) {
3300
3297
  let text = "";
3301
- for (const step of interaction.steps) {
3298
+ for (const step of interaction.steps ?? []) {
3302
3299
  if (step.type === "model_output") {
3303
3300
  for (const content of step.content ?? []) {
3304
3301
  if (content.type === "text") {
@@ -3310,7 +3307,7 @@ function interactionText(interaction) {
3310
3307
  return text;
3311
3308
  }
3312
3309
  function functionCallSteps(interaction) {
3313
- return interaction.steps.filter(
3310
+ return (interaction.steps ?? []).filter(
3314
3311
  (s) => s.type === "function_call"
3315
3312
  );
3316
3313
  }