@ggui-ai/ui-gen 0.22.0 → 0.24.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.
- package/dist/adapter-Du7P_5Fx.d.ts +201 -0
- package/dist/adapters/generation-dispatch.d.ts +33 -12
- package/dist/adapters/generation-dispatch.js +549 -129
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +5 -3
- package/dist/advanced/index.js +601 -144
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +178 -54
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.js +1 -0
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +2 -1
- package/dist/check/index.js +47 -1
- package/dist/check/index.js.map +1 -1
- package/dist/{create-ui-generator-BEkzEtNz.d.ts → create-ui-generator-GIhzx08x.d.ts} +34 -10
- package/dist/{dispatch-DJNpQ7DI.d.ts → dispatch-BnAH56p4.d.ts} +1 -1
- package/dist/evaluation/axis-checks/index.d.ts +4 -3
- package/dist/evaluation/axis-checks/index.js +19 -4
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +2 -1
- package/dist/evaluation/axis-checks/registry.js +19 -4
- package/dist/evaluation/axis-checks/registry.js.map +1 -1
- package/dist/evaluation/index.d.ts +4 -3
- package/dist/evaluation/index.js +21 -6
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +27 -8
- package/dist/harness/check/runtime-render/index.js +217 -54
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/check/runtime-render/render-check-worker.d.ts +8 -1
- package/dist/harness/check/runtime-render/render-check-worker.js +72 -32
- package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
- package/dist/harness/index.d.ts +2 -1
- package/dist/harness/index.js +3 -2
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/result-types.d.ts +2 -1
- package/dist/harness/runtime.d.ts +2 -1
- package/dist/harness/runtime.js +2 -1
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +18 -5
- package/dist/harness/types-public.js +1 -0
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +2 -1
- package/dist/index.d.ts +38 -3
- package/dist/index.js +592 -144
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +2 -1
- package/dist/policy.d.ts +7 -4
- package/dist/policy.js.map +1 -1
- package/dist/tools/get-primitives-ts.d.ts +1 -1
- package/dist/tools/get-primitives-ts.js +1 -1
- package/dist/tools/get-primitives-ts.js.map +1 -1
- package/dist/tools/render-check-worker.d.ts +7 -1
- package/dist/tools/render-check-worker.js +55 -23
- package/dist/tools/render-check-worker.js.map +1 -1
- package/dist/{types-public-mM_-1Yk3.d.ts → types-public-Bk6d1WLN.d.ts} +98 -9
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/workflows.d.ts +2 -1
- package/package.json +12 -12
- package/src/adapters/generation-dispatch.ts +137 -96
- package/src/advanced/generator.ts +16 -1
- package/src/blueprint-validator.ts +21 -6
- package/src/boilerplate/hard-sections.ts +1 -0
- package/src/check/run-tier0.ts +80 -1
- package/src/coding-agent/tools.ts +6 -1
- package/src/create-ui-generator.ts +185 -95
- package/src/evaluation/axis-checks/checks/state-payload.ts +29 -4
- package/src/evaluation/types-public.ts +94 -8
- package/src/harness/check/runtime-render/adapter.ts +223 -58
- package/src/harness/check/runtime-render/index.ts +75 -2
- package/src/harness/check/runtime-render/render-check-host.ts +111 -26
- package/src/harness/check/runtime-render/render-check-worker.ts +83 -29
- package/src/harness/check/runtime-render/render-check.ts +173 -117
- package/src/harness/coding/generate-task-runner.ts +57 -4
- package/src/harness/coding/init-session.ts +13 -0
- package/src/harness/coding/run-eval-round.ts +238 -13
- package/src/harness/llm-router.ts +3 -3
- package/src/harness/policy.ts +11 -0
- package/src/harness/primitive-slice.ts +104 -0
- package/src/harness/types-public.ts +17 -5
- package/src/index.ts +4 -0
- package/src/policy.ts +7 -4
- package/src/tools/get-primitives-ts.ts +1 -1
- package/src/tools/render-check-worker.ts +74 -23
- package/src/validation/primitives.ts +1 -1
- package/dist/render-check-C0CqVceF.d.ts +0 -87
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse one input document, run the check, write the verdict. Whatever
|
|
3
|
+
* happens after parsing, esbuild's service is stopped before this
|
|
4
|
+
* returns (or rejects). If the service was never started, `stop()` is a
|
|
5
|
+
* no-op.
|
|
6
|
+
*/
|
|
7
|
+
declare function workerMain(raw: string): Promise<void>;
|
|
1
8
|
|
|
2
|
-
export {
|
|
9
|
+
export { workerMain };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { realpathSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import * as esbuild from 'esbuild';
|
|
1
5
|
import { listContractGadgets, HOOK_NAME_RE } from '@ggui-ai/protocol';
|
|
2
6
|
import ts from 'typescript';
|
|
3
7
|
import { createRequire } from 'module';
|
|
4
8
|
import { primeInputs } from '@ggui-ai/ui-visual-tester/prime-inputs';
|
|
5
9
|
|
|
6
|
-
// src/harness/check/runtime-render/render-check.ts
|
|
10
|
+
// src/harness/check/runtime-render/render-check-worker.ts
|
|
7
11
|
|
|
8
12
|
// src/harness/check/runtime-render/probe.ts
|
|
9
13
|
function makeInternals() {
|
|
@@ -142,9 +146,9 @@ function createProbeWireConfig(probe) {
|
|
|
142
146
|
|
|
143
147
|
// src/internal/evaluate-component-source.ts
|
|
144
148
|
async function evaluateComponentSource(sourceCode, sandboxRequire) {
|
|
145
|
-
const
|
|
149
|
+
const esbuild2 = await import('esbuild');
|
|
146
150
|
const { Script } = await import('vm');
|
|
147
|
-
const cjsResult = await
|
|
151
|
+
const cjsResult = await esbuild2.transform(sourceCode, {
|
|
148
152
|
loader: "tsx",
|
|
149
153
|
target: "es2020",
|
|
150
154
|
format: "cjs",
|
|
@@ -534,7 +538,7 @@ async function runRenderCheckInProcess(input) {
|
|
|
534
538
|
const Wire = await import('@ggui-ai/wire');
|
|
535
539
|
const { GguiWireProvider } = Wire;
|
|
536
540
|
const moduleResolutions = {
|
|
537
|
-
|
|
541
|
+
react: React,
|
|
538
542
|
"react/jsx-runtime": ReactJsxRuntime,
|
|
539
543
|
"@ggui-ai/wire": Wire
|
|
540
544
|
};
|
|
@@ -650,14 +654,23 @@ async function runRenderCheckInProcess(input) {
|
|
|
650
654
|
)
|
|
651
655
|
);
|
|
652
656
|
const timeoutPromise = new Promise((_, reject) => {
|
|
653
|
-
setTimeout(
|
|
657
|
+
setTimeout(
|
|
658
|
+
() => reject(
|
|
659
|
+
new Error(
|
|
660
|
+
`[runtime-render] render exceeded ${RENDER_TIMEOUT_MS}ms \u2014 classified as runtime-hang`
|
|
661
|
+
)
|
|
662
|
+
),
|
|
663
|
+
RENDER_TIMEOUT_MS
|
|
664
|
+
).unref?.();
|
|
654
665
|
});
|
|
655
666
|
renderResult = await Promise.race([renderPromise, timeoutPromise]);
|
|
656
667
|
} catch (e) {
|
|
657
668
|
const msg = e instanceof Error ? e.message : String(e);
|
|
658
669
|
const errStack = e instanceof Error ? e.stack ?? "" : "";
|
|
659
670
|
const baseReason = loopSignature ? `Infinite render loop (${loopSignature}) \u2014 likely setState/dispatch inside useEffect with missing or unstable dependency` : /runtime-hang/.test(msg) ? `Render wall-clock exceeded ${RENDER_TIMEOUT_MS}ms \u2014 likely async effect loop or unresolved promise` : `Render threw: ${msg}`;
|
|
660
|
-
const userFrames = errStack.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).filter(
|
|
671
|
+
const userFrames = errStack.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).filter(
|
|
672
|
+
(l) => !/(node_modules|happy-dom|@testing-library|react-dom|node:internal|node:async)/.test(l)
|
|
673
|
+
).slice(0, 5);
|
|
661
674
|
const stackSource = boundaryRef.stack ?? capturedComponentStack ?? "";
|
|
662
675
|
const componentFrames = stackSource.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).slice(0, 4);
|
|
663
676
|
const stackBlock = userFrames.length ? `
|
|
@@ -1122,9 +1135,7 @@ function idLikeRequiredStringField(schema) {
|
|
|
1122
1135
|
const required = schema["required"];
|
|
1123
1136
|
if (properties === null || typeof properties !== "object") return null;
|
|
1124
1137
|
if (!Array.isArray(required)) return null;
|
|
1125
|
-
for (const [propName, propSchema] of Object.entries(
|
|
1126
|
-
properties
|
|
1127
|
-
)) {
|
|
1138
|
+
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
1128
1139
|
if (!/id$/i.test(propName)) continue;
|
|
1129
1140
|
if (!required.includes(propName)) continue;
|
|
1130
1141
|
const t = propSchema !== null && typeof propSchema === "object" ? propSchema["type"] : void 0;
|
|
@@ -1155,9 +1166,7 @@ async function checkSelectionIdentity(input) {
|
|
|
1155
1166
|
return void 0;
|
|
1156
1167
|
}
|
|
1157
1168
|
await flushPromises();
|
|
1158
|
-
const events = probe.getFireLog().slice(before).filter(
|
|
1159
|
-
(e) => e.kind === "action.fired" && e.name === actionName
|
|
1160
|
-
);
|
|
1169
|
+
const events = probe.getFireLog().slice(before).filter((e) => e.kind === "action.fired" && e.name === actionName);
|
|
1161
1170
|
return events.length > 0 ? events[events.length - 1].payload : void 0;
|
|
1162
1171
|
};
|
|
1163
1172
|
const first = await payloadFor(group[0]);
|
|
@@ -1218,7 +1227,10 @@ async function dispatchTrigger(el, kind, user) {
|
|
|
1218
1227
|
case "submit": {
|
|
1219
1228
|
const form = closestForm(el);
|
|
1220
1229
|
if (!form) return;
|
|
1221
|
-
const ev = new globalThis.Event("submit", {
|
|
1230
|
+
const ev = new globalThis.Event("submit", {
|
|
1231
|
+
bubbles: true,
|
|
1232
|
+
cancelable: true
|
|
1233
|
+
});
|
|
1222
1234
|
toEventDispatcher(form).dispatchEvent(ev);
|
|
1223
1235
|
return;
|
|
1224
1236
|
}
|
|
@@ -1435,29 +1447,57 @@ function emit(value) {
|
|
|
1435
1447
|
process.stdout.write(`${JSON.stringify(value)}
|
|
1436
1448
|
`);
|
|
1437
1449
|
}
|
|
1438
|
-
async function
|
|
1439
|
-
const raw = await readAllStdin();
|
|
1440
|
-
let input;
|
|
1450
|
+
async function workerMain(raw) {
|
|
1441
1451
|
try {
|
|
1442
|
-
input
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1452
|
+
let input;
|
|
1453
|
+
try {
|
|
1454
|
+
input = JSON.parse(raw);
|
|
1455
|
+
} catch (err) {
|
|
1456
|
+
process.stderr.write(
|
|
1457
|
+
`render-check worker: malformed input JSON \u2014 ${err instanceof Error ? err.message : String(err)}
|
|
1446
1458
|
`
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1459
|
+
);
|
|
1460
|
+
process.exitCode = 1;
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
if (typeof input.sourceCode !== "string" || input.sourceCode.length === 0) {
|
|
1464
|
+
process.stderr.write(
|
|
1465
|
+
"render-check worker: input.sourceCode must be a non-empty string\n"
|
|
1466
|
+
);
|
|
1467
|
+
process.exitCode = 1;
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
const result = await runRenderCheckInProcess(input);
|
|
1471
|
+
emit(result);
|
|
1472
|
+
} finally {
|
|
1473
|
+
try {
|
|
1474
|
+
await esbuild.stop();
|
|
1475
|
+
} catch (err) {
|
|
1476
|
+
process.stderr.write(
|
|
1477
|
+
`render-check worker: esbuild.stop() failed \u2014 ${err instanceof Error ? err.message : String(err)}
|
|
1478
|
+
`
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1450
1481
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1482
|
+
}
|
|
1483
|
+
async function main() {
|
|
1484
|
+
await workerMain(await readAllStdin());
|
|
1485
|
+
}
|
|
1486
|
+
function isProcessEntry() {
|
|
1487
|
+
const entry = process.argv[1];
|
|
1488
|
+
if (entry === void 0) return false;
|
|
1489
|
+
let entryReal;
|
|
1490
|
+
try {
|
|
1491
|
+
entryReal = realpathSync(resolve(entry));
|
|
1492
|
+
} catch {
|
|
1493
|
+
return false;
|
|
1457
1494
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1495
|
+
return entryReal === realpathSync(fileURLToPath(import.meta.url));
|
|
1496
|
+
}
|
|
1497
|
+
if (isProcessEntry()) {
|
|
1498
|
+
void main();
|
|
1460
1499
|
}
|
|
1461
|
-
|
|
1500
|
+
|
|
1501
|
+
export { workerMain };
|
|
1462
1502
|
//# sourceMappingURL=render-check-worker.js.map
|
|
1463
1503
|
//# sourceMappingURL=render-check-worker.js.map
|