@ggui-ai/ui-gen 0.23.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 +510 -128
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +5 -3
- package/dist/advanced/index.js +551 -142
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +153 -59
- package/dist/blueprint-validator.js.map +1 -1
- 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-D0kbWwln.d.ts → create-ui-generator-GIhzx08x.d.ts} +34 -10
- package/dist/{dispatch-wxaIMwZt.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.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +2 -1
- package/dist/evaluation/index.d.ts +4 -3
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +29 -10
- package/dist/harness/check/runtime-render/index.js +203 -60
- 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.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.map +1 -1
- package/dist/harness/types-public.d.ts +11 -2
- 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 +553 -143
- 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/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-Ow-tNtFE.d.ts → types-public-Bk6d1WLN.d.ts} +77 -11
- package/dist/workflows.d.ts +2 -1
- package/package.json +12 -12
- package/src/adapters/generation-dispatch.ts +137 -96
- package/src/check/run-tier0.ts +80 -1
- package/src/create-ui-generator.ts +185 -95
- package/src/evaluation/types-public.ts +73 -11
- package/src/harness/check/runtime-render/adapter.ts +221 -75
- package/src/harness/check/runtime-render/index.ts +75 -2
- package/src/harness/check/runtime-render/render-check-host.ts +82 -19
- package/src/harness/check/runtime-render/render-check-worker.ts +83 -29
- package/src/harness/check/runtime-render/render-check.ts +154 -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 -15
- package/src/harness/policy.ts +11 -0
- package/src/harness/primitive-slice.ts +104 -0
- package/src/harness/types-public.ts +9 -1
- package/src/index.ts +4 -0
- package/src/policy.ts +7 -4
- package/src/tools/render-check-worker.ts +74 -23
- package/dist/render-check-Blwj8gB6.d.ts +0 -105
|
@@ -28,7 +28,20 @@
|
|
|
28
28
|
* (the render SMOKE worker): reached by spawn path, never by import
|
|
29
29
|
* specifier; registered as a tsup entry so `dist/harness/check/
|
|
30
30
|
* runtime-render/render-check-worker.js` ships.
|
|
31
|
+
*
|
|
32
|
+
* Shutdown (ggui#1380): the compile runs on esbuild's service, a child
|
|
33
|
+
* process esbuild keeps alive for the life of this worker. After the
|
|
34
|
+
* verdict is written the worker calls `esbuild.stop()` so that child is
|
|
35
|
+
* gone before the worker is; a worker stopped at its wall-clock bound is
|
|
36
|
+
* killed by the host, and the service's stdin closing with it is what
|
|
37
|
+
* ends the service in that case. `workerMain` is exported for the
|
|
38
|
+
* process-shape pins; `main()` runs only when this file is the process
|
|
39
|
+
* entry, so importing it never reads stdin.
|
|
31
40
|
*/
|
|
41
|
+
import { realpathSync } from 'node:fs';
|
|
42
|
+
import { resolve as resolvePath } from 'node:path';
|
|
43
|
+
import { fileURLToPath } from 'node:url';
|
|
44
|
+
import * as esbuild from 'esbuild';
|
|
32
45
|
import { runRenderCheckInProcess } from './render-check.js';
|
|
33
46
|
import type { RunRenderCheckInput } from './render-check.js';
|
|
34
47
|
|
|
@@ -44,37 +57,78 @@ function emit(value: unknown): void {
|
|
|
44
57
|
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Parse one input document, run the check, write the verdict. Whatever
|
|
62
|
+
* happens after parsing, esbuild's service is stopped before this
|
|
63
|
+
* returns (or rejects). If the service was never started, `stop()` is a
|
|
64
|
+
* no-op.
|
|
65
|
+
*/
|
|
66
|
+
export async function workerMain(raw: string): Promise<void> {
|
|
50
67
|
try {
|
|
51
|
-
input
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
let input: RunRenderCheckInput;
|
|
69
|
+
try {
|
|
70
|
+
input = JSON.parse(raw) as RunRenderCheckInput;
|
|
71
|
+
} catch (err) {
|
|
72
|
+
process.stderr.write(
|
|
73
|
+
`render-check worker: malformed input JSON — ${
|
|
74
|
+
err instanceof Error ? err.message : String(err)
|
|
75
|
+
}\n`,
|
|
76
|
+
);
|
|
77
|
+
process.exitCode = 1;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof input.sourceCode !== 'string' || input.sourceCode.length === 0) {
|
|
81
|
+
process.stderr.write(
|
|
82
|
+
'render-check worker: input.sourceCode must be a non-empty string\n',
|
|
83
|
+
);
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The in-process check never throws for component failures (they are
|
|
89
|
+
// reported as issues); an escape here is a harness defect — let it
|
|
90
|
+
// crash the worker so the host maps it to `unverified` with the
|
|
91
|
+
// stderr tail as the reason.
|
|
92
|
+
const result = await runRenderCheckInProcess(input);
|
|
93
|
+
emit(result);
|
|
94
|
+
// The check's async-infra grace period (React scheduler drain) holds
|
|
95
|
+
// handlers for ~100ms; exit through the event loop naturally so that
|
|
96
|
+
// drain completes inside the worker instead of leaking crashes.
|
|
97
|
+
} finally {
|
|
98
|
+
// Post-verdict work must never turn a written verdict into a failure:
|
|
99
|
+
// a rejecting `stop()` would otherwise become an unhandled rejection,
|
|
100
|
+
// exit code 1, and the host discarding the verdict on stdout.
|
|
101
|
+
try {
|
|
102
|
+
await esbuild.stop();
|
|
103
|
+
} catch (err) {
|
|
104
|
+
process.stderr.write(
|
|
105
|
+
`render-check worker: esbuild.stop() failed — ${err instanceof Error ? err.message : String(err)}\n`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
67
108
|
}
|
|
109
|
+
}
|
|
68
110
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//
|
|
111
|
+
async function main(): Promise<void> {
|
|
112
|
+
await workerMain(await readAllStdin());
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** True when this file is the process entry (`node <this file>`), not an import. */
|
|
116
|
+
function isProcessEntry(): boolean {
|
|
117
|
+
const entry = process.argv[1];
|
|
118
|
+
if (entry === undefined) return false;
|
|
119
|
+
// Resolve BOTH sides through the filesystem: `import.meta.url` is this
|
|
120
|
+
// file's realpath while argv[1] is whatever the spawner passed — a
|
|
121
|
+
// symlinked spawn path must still read as the entry, or the worker would
|
|
122
|
+
// exit with no verdict and the host would read a silent `unverified`.
|
|
123
|
+
let entryReal: string;
|
|
124
|
+
try {
|
|
125
|
+
entryReal = realpathSync(resolvePath(entry));
|
|
126
|
+
} catch {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return entryReal === realpathSync(fileURLToPath(import.meta.url));
|
|
78
130
|
}
|
|
79
131
|
|
|
80
|
-
|
|
132
|
+
if (isProcessEntry()) {
|
|
133
|
+
void main();
|
|
134
|
+
}
|