@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.
- package/dist/adapters/base.js +1 -0
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/generation-dispatch.d.ts +1 -1
- package/dist/adapters/generation-dispatch.js +286 -168
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +13 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +2 -2
- package/dist/advanced/index.js +287 -168
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +1 -1
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.js +13 -24
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +3 -3
- package/dist/check/index.js.map +1 -1
- package/dist/classifier/index.d.ts +14 -17
- package/dist/classifier/index.js +3 -7
- package/dist/classifier/index.js.map +1 -1
- package/dist/{create-ui-generator-CQiyjb5D.d.ts → create-ui-generator-GX7tvbyH.d.ts} +1 -1
- package/dist/{dispatch-CzRfy1J7.d.ts → dispatch-Deo9qzrG.d.ts} +1 -1
- package/dist/evaluation/axis-checks/index.d.ts +3 -3
- package/dist/evaluation/axis-checks/registry.d.ts +1 -1
- package/dist/evaluation/index.d.ts +2 -2
- package/dist/evaluation/index.js +12 -4
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +1 -1
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +25 -28
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/result-types.d.ts +1 -1
- package/dist/harness/runtime.d.ts +1 -1
- package/dist/harness/runtime.js +14 -25
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +1 -1
- package/dist/harness/types-public.js +13 -24
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +288 -168
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +1 -1
- package/dist/provider-adapter-contract.js +61 -44
- package/dist/provider-adapter-contract.js.map +1 -1
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/{types-public-D9swfbNi.d.ts → types-public-C36k1q6s.d.ts} +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +12 -12
- package/src/blueprint-validator.ts +1 -1
- package/src/boilerplate/generate.ts +20 -31
- package/src/boilerplate/system-prompt.ts +2 -2
- package/src/check/extract-wire-calls.ts +2 -2
- package/src/classifier/axes.ts +2 -2
- package/src/classifier/classifier.ts +2 -2
- package/src/classifier/infer-layout.ts +1 -1
- package/src/classifier/infer-render.ts +1 -1
- package/src/classifier/infer-tooling.ts +1 -1
- package/src/classifier/infer-trigger.ts +3 -12
- package/src/classifier/inspect.ts +7 -7
- package/src/coding-agent/self-check.ts +1 -1
- package/src/evaluation/cost-tracker.ts +39 -11
- package/src/harness/check/runtime-render/render-check.ts +4 -4
- package/src/harness/llm-router.ts +2 -2
- package/src/providers/bedrock.ts +2 -2
- package/src/tools/get-wire.ts +1 -1
- package/src/validation/primitives.ts +2 -0
package/dist/boilerplate.js
CHANGED
|
@@ -218,28 +218,17 @@ function inferTypeFromExample(example) {
|
|
|
218
218
|
}
|
|
219
219
|
function generateBoilerplate(_userPrompt, contract, shellType, screen, composedSections, appGadgets) {
|
|
220
220
|
const propsFields = [];
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
jsonSchemaTypeToTs(schema)
|
|
233
|
-
) : "unknown";
|
|
234
|
-
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
235
|
-
const parts = [];
|
|
236
|
-
if (spec.description) parts.push(String(spec.description));
|
|
237
|
-
if (spec.default !== void 0) parts.push(`(default: ${JSON.stringify(spec.default)})`);
|
|
238
|
-
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
239
|
-
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
240
|
-
} else {
|
|
241
|
-
propsFields.push(` ${key}: ${typeof value === "string" ? value : "unknown"};`);
|
|
242
|
-
}
|
|
221
|
+
const propsProperties = contract?.propsSpec?.properties ?? {};
|
|
222
|
+
for (const [key, entry] of Object.entries(propsProperties)) {
|
|
223
|
+
const required = entry.required !== false;
|
|
224
|
+
const nullable = entry.schema.nullable === true;
|
|
225
|
+
const tsType = jsonSchemaTypeToTs(entry.schema);
|
|
226
|
+
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
227
|
+
const parts = [];
|
|
228
|
+
if (entry.description) parts.push(entry.description);
|
|
229
|
+
if (entry.default !== void 0) parts.push(`(default: ${JSON.stringify(entry.default)})`);
|
|
230
|
+
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
231
|
+
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
243
232
|
}
|
|
244
233
|
const actionTypeAliases = [];
|
|
245
234
|
const actionHookCalls = [];
|
|
@@ -985,10 +974,10 @@ A \`DataContract\` declares everything a GguiSession exchanges with the outside
|
|
|
985
974
|
|
|
986
975
|
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.**
|
|
987
976
|
|
|
988
|
-
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.
|
|
977
|
+
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.all, stream.latest, etc.
|
|
989
978
|
- **Object access**: optional-chain through nested fields. \`props.user?.name ?? 'Anonymous'\` not \`props.user.name\`.
|
|
990
979
|
- **Number ops**: default before arithmetic. \`(props.count ?? 0) + 1\` not \`props.count + 1\`.
|
|
991
|
-
- **Stream latest**: \`useStream\` returns \`{latest: T |
|
|
980
|
+
- **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\`.
|
|
992
981
|
- **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.
|
|
993
982
|
- **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.
|
|
994
983
|
- **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.
|