@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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { RuntimeRenderCheck } from './harness/types-public.js';
|
|
2
|
+
import { GenerationRuntimeProbeCheck } from '@ggui-ai/mcp-server-core';
|
|
3
|
+
import { JsonObject, DataContract } from '@ggui-ai/protocol';
|
|
4
|
+
import { P as ProbeHostLoad } from './types-public-Bk6d1WLN.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The subprocess bounds of one isolated check (ggui#1380). They are
|
|
8
|
+
* INPUTS of the host, not constants: a serving deployment runs the probe
|
|
9
|
+
* under its own memory and latency budget and sets them per check
|
|
10
|
+
* instance (`createRuntimeRenderCheck`); the evaluation lane runs on the
|
|
11
|
+
* defaults below, which are the values the host always used.
|
|
12
|
+
*/
|
|
13
|
+
interface RenderCheckHostBounds {
|
|
14
|
+
/**
|
|
15
|
+
* Wall-clock bound for one isolated check. The rich probe renders,
|
|
16
|
+
* clicks every declared action, and re-renders streams — slower than
|
|
17
|
+
* the smoke worker's 12s budget; 30s bounds runaway components while
|
|
18
|
+
* staying far under any generation-turn budget.
|
|
19
|
+
*/
|
|
20
|
+
readonly timeoutMs: number;
|
|
21
|
+
/**
|
|
22
|
+
* V8 heap cap. The worker realm loads react-dom, happy-dom and
|
|
23
|
+
* testing-library on top of the component itself; 512 MB leaves
|
|
24
|
+
* headroom while still bounding pathological allocation.
|
|
25
|
+
*/
|
|
26
|
+
readonly heapMb: number;
|
|
27
|
+
/**
|
|
28
|
+
* Grace between SIGTERM and SIGKILL once the bound is crossed. The
|
|
29
|
+
* effective value is `min(gracePeriodMs, floor(timeoutMs / 2))` —
|
|
30
|
+
* `runSandboxed` requires the grace to be strictly below the bound, so
|
|
31
|
+
* a short bound never trips its RangeError.
|
|
32
|
+
*/
|
|
33
|
+
readonly gracePeriodMs: number;
|
|
34
|
+
}
|
|
35
|
+
/** Options of {@link runRenderCheckViaWorker}. */
|
|
36
|
+
interface RenderCheckHostOptions {
|
|
37
|
+
/** Subprocess bounds; every field omitted falls to {@link DEFAULT_RENDER_CHECK_HOST_BOUNDS}. */
|
|
38
|
+
readonly bounds?: Partial<RenderCheckHostBounds>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 3-state outcome. Internal to runtime-render.
|
|
43
|
+
* The adapter maps this to existing EvalIssue shapes:
|
|
44
|
+
* verified → no issue
|
|
45
|
+
* failed → fail
|
|
46
|
+
* unverified → warn
|
|
47
|
+
* skipped → no issue
|
|
48
|
+
*/
|
|
49
|
+
type CheckOutcome = "verified" | "failed" | "unverified" | "skipped";
|
|
50
|
+
/**
|
|
51
|
+
* The checks this probe runs, by name (ggui#1380). ONE union: the same
|
|
52
|
+
* values a generation's metadata lists in `failChecks`
|
|
53
|
+
* (`GenerationRuntimeProbeCheck` in `@ggui-ai/mcp-server-core`), declared
|
|
54
|
+
* there and named here — the same pattern as `RuntimeProbeStatus`.
|
|
55
|
+
*/
|
|
56
|
+
type RenderCheckKind = GenerationRuntimeProbeCheck;
|
|
57
|
+
/**
|
|
58
|
+
* Every {@link RenderCheckKind}, once, in the order the union declares them.
|
|
59
|
+
* The order is the order a probe's `failChecks` lists the checks that failed,
|
|
60
|
+
* so a render crash always reads first. `satisfies` refuses a kind outside
|
|
61
|
+
* the union; the pin beside the adapter refuses a member missing here.
|
|
62
|
+
*/
|
|
63
|
+
declare const RENDER_CHECK_KINDS: readonly ["render-no-throw", "prop-sensitivity", "action-wiring", "selection-identity", "prop-coverage", "optional-props-omitted", "stream-rerender"];
|
|
64
|
+
interface RenderCheckIssue {
|
|
65
|
+
readonly check: RenderCheckKind;
|
|
66
|
+
readonly outcome: CheckOutcome;
|
|
67
|
+
readonly subject?: string;
|
|
68
|
+
readonly reason: string;
|
|
69
|
+
/** Optional element description ("button[aria-label='Save']") for action-wiring failures. */
|
|
70
|
+
readonly elementHint?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Diagnostic context from probe + AST analysis. Populated for richer feedback
|
|
73
|
+
* to the coding agent (which native props the callback flows into, what the
|
|
74
|
+
* probe observed firing, etc.).
|
|
75
|
+
*/
|
|
76
|
+
readonly diagnostics?: {
|
|
77
|
+
readonly observedJsxElements?: readonly string[];
|
|
78
|
+
readonly observedNativeProps?: readonly string[];
|
|
79
|
+
readonly observedCustomProps?: readonly string[];
|
|
80
|
+
/** For action-wiring: which actions DID fire from probe clicks (helps surface mis-wiring). */
|
|
81
|
+
readonly actionsFiredFromClicks?: readonly string[];
|
|
82
|
+
/** Surfaced to the agent: prop sourceTool hints from the contract (only if present). */
|
|
83
|
+
readonly sourceToolHints?: Readonly<Record<string, string>>;
|
|
84
|
+
/**
|
|
85
|
+
* For action-wiring (ggui#1187): what input priming did before the
|
|
86
|
+
* synthetic dispatch — how many controls it filled, or why it could not
|
|
87
|
+
* run. A "did not dispatch it" on an input-gated action reads differently
|
|
88
|
+
* beside `{ primed: 0 }` or `{ error }` than beside `{ primed: 1 }`.
|
|
89
|
+
*/
|
|
90
|
+
readonly inputPriming?: InputPrimingDiagnostic;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Outcome of `primeInputs` before the action-wiring probe (ggui#1187). A
|
|
95
|
+
* priming failure never aborts the check — it is recorded here, on every
|
|
96
|
+
* action-wiring issue, so it is visible in the feedback instead of vanishing.
|
|
97
|
+
*/
|
|
98
|
+
type InputPrimingDiagnostic = {
|
|
99
|
+
readonly primed: number;
|
|
100
|
+
} | {
|
|
101
|
+
readonly error: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* The check started but did not finish (ggui#1299). The only kind is a
|
|
105
|
+
* wall-clock timeout in the isolated worker. It is not a verdict on the
|
|
106
|
+
* component: `issues` is empty and `ok` is false because nothing was
|
|
107
|
+
* verified, never because something failed.
|
|
108
|
+
*/
|
|
109
|
+
interface RenderCheckIncomplete {
|
|
110
|
+
readonly kind: "timeout";
|
|
111
|
+
/** How long the worker ran before it was stopped. */
|
|
112
|
+
readonly elapsedMs: number;
|
|
113
|
+
/** The wall-clock bound it crossed. */
|
|
114
|
+
readonly boundMs: number;
|
|
115
|
+
}
|
|
116
|
+
interface RenderCheckResult {
|
|
117
|
+
readonly ok: boolean;
|
|
118
|
+
readonly issues: readonly RenderCheckIssue[];
|
|
119
|
+
/** Present only when the check did not finish; see {@link RenderCheckIncomplete}. */
|
|
120
|
+
readonly incomplete?: RenderCheckIncomplete;
|
|
121
|
+
readonly stats: {
|
|
122
|
+
readonly actionsChecked: number;
|
|
123
|
+
readonly streamsChecked: number;
|
|
124
|
+
readonly renderMs: number;
|
|
125
|
+
/** Host load around an isolated check (absent in-process). */
|
|
126
|
+
readonly hostLoad?: ProbeHostLoad;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface RunRenderCheckInput {
|
|
130
|
+
readonly sourceCode: string;
|
|
131
|
+
readonly mockupProps: JsonObject;
|
|
132
|
+
readonly contract?: DataContract;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Options of {@link runRenderCheck} (ggui#1380): the host's options —
|
|
136
|
+
* `bounds` are the isolated subprocess's wall-clock, heap and grace (see
|
|
137
|
+
* `RenderCheckHostBounds`); they apply to the worker path only and are
|
|
138
|
+
* ignored in-process. One shape, declared once on the host.
|
|
139
|
+
*/
|
|
140
|
+
type RunRenderCheckOptions = RenderCheckHostOptions;
|
|
141
|
+
/**
|
|
142
|
+
* Run the in-loop runtime render check.
|
|
143
|
+
*
|
|
144
|
+
* Isolation dispatcher (#592): when the CALLING environment already
|
|
145
|
+
* owns a DOM (`window` + `document` on `globalThis` — e.g. a vitest
|
|
146
|
+
* `happy-dom` environment, where the environment owner installed the
|
|
147
|
+
* globals deliberately), the check runs in-process exactly as before.
|
|
148
|
+
* In a plain Node process it runs in an ISOLATED SUBPROCESS
|
|
149
|
+
* (`render-check-host.ts` → `render-check-worker.ts`), because the
|
|
150
|
+
* in-process path installs happy-dom globals on `globalThis`
|
|
151
|
+
* process-wide — a TOCTOU hazard for anything that sniffs `window`
|
|
152
|
+
* concurrently (provider SDKs throw "browser-like environment" at
|
|
153
|
+
* client construction; two overlapping checks corrupt each other's
|
|
154
|
+
* teardown). See #592 for the measured incident (4 bench cells hard-
|
|
155
|
+
* failed on the 2026-08-19 run).
|
|
156
|
+
*
|
|
157
|
+
* The host is loaded lazily so the worker bundle (which imports this
|
|
158
|
+
* module for `runRenderCheckInProcess`) never drags in the sandbox
|
|
159
|
+
* spawn machinery.
|
|
160
|
+
*/
|
|
161
|
+
declare function runRenderCheck(input: RunRenderCheckInput, options?: RunRenderCheckOptions): Promise<RenderCheckResult>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* How one runtime-render check instance runs its isolated worker
|
|
165
|
+
* (ggui#1380). A serving deployment sets the probe's wall-clock bound,
|
|
166
|
+
* worker heap and concurrency here; every field omitted is the evaluation
|
|
167
|
+
* lane's behaviour — the host's default bounds and no concurrency cap.
|
|
168
|
+
*/
|
|
169
|
+
interface RuntimeRenderProbeConfig {
|
|
170
|
+
/** Wall-clock bound of one isolated check, ms. Default: the host's (30 000). */
|
|
171
|
+
readonly timeoutMs?: number;
|
|
172
|
+
/** V8 heap cap of the worker, MB. Default: the host's (512). */
|
|
173
|
+
readonly heapMb?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Live workers this instance may have at once. The (K+1)th check waits
|
|
176
|
+
* in FIFO order and spawns only when a slot frees; a check that throws
|
|
177
|
+
* releases its slot. Default: unbounded. Must be a positive integer.
|
|
178
|
+
*/
|
|
179
|
+
readonly maxConcurrent?: number;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Build a runtime-render check instance. One FIFO limiter per instance;
|
|
183
|
+
* the bounds reach `runRenderCheck` on every run. `createRuntimeRenderCheck()`
|
|
184
|
+
* with no config is {@link DEFAULT_RUNTIME_RENDER_CHECK}'s behaviour.
|
|
185
|
+
*/
|
|
186
|
+
declare function createRuntimeRenderCheck(config?: RuntimeRenderProbeConfig): RuntimeRenderCheck;
|
|
187
|
+
/** The evaluation lane's instance: the host's default bounds, no concurrency cap. */
|
|
188
|
+
declare const DEFAULT_RUNTIME_RENDER_CHECK: RuntimeRenderCheck;
|
|
189
|
+
declare function isRecoverableRenderCrash(reason: string): boolean;
|
|
190
|
+
declare function classifyRenderCrashFix(reason: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* The check a probe issue's subcategory names (ggui#1380) — the inverse of
|
|
193
|
+
* the `runtime:<check>[:<subject>]` form {@link toEvalIssue} writes, so a
|
|
194
|
+
* round can list WHICH checks failed from the issues alone. `undefined` for
|
|
195
|
+
* anything that is not a probe subcategory naming a member of
|
|
196
|
+
* {@link RENDER_CHECK_KINDS} (an axis check's subcategory, a did-not-run
|
|
197
|
+
* code such as `runtime:probe-timeout`, a bare check name).
|
|
198
|
+
*/
|
|
199
|
+
declare function parseRuntimeSubcategory(subcategory: string): RenderCheckKind | undefined;
|
|
200
|
+
|
|
201
|
+
export { DEFAULT_RUNTIME_RENDER_CHECK as D, type RuntimeRenderProbeConfig as R, type RenderCheckIssue as a, type RenderCheckHostBounds as b, RENDER_CHECK_KINDS as c, type RenderCheckHostOptions as d, type RenderCheckKind as e, type RenderCheckResult as f, classifyRenderCrashFix as g, createRuntimeRenderCheck as h, isRecoverableRenderCrash as i, parseRuntimeSubcategory as p, runRenderCheck as r };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { EvaluationConfig } from '../evaluation/types.js';
|
|
2
|
+
import { RuntimeRenderCheck } from '../harness/types-public.js';
|
|
2
3
|
import { ModelRoles, GenerationResult } from '../harness/result-types.js';
|
|
3
4
|
import { ProviderName, ToolDefinition } from './types.js';
|
|
4
|
-
import { Q as QualityConfig } from '../types-public-
|
|
5
|
+
import { Q as QualityConfig } from '../types-public-Bk6d1WLN.js';
|
|
5
6
|
import { A as AgentConfig } from '../llm-router-DwwUK1bz.js';
|
|
6
7
|
import { DataContract, JsonObject, GadgetDescriptor } from '@ggui-ai/protocol';
|
|
7
8
|
import { C as CanvasClass, D as DesignMode } from '../design-mode-DLufhrNp.js';
|
|
8
9
|
import { G as GenerationProfileInput } from '../styling-profile-CxfvV48g.js';
|
|
9
10
|
import { R as RenderingContext } from '../prompts-YU9piOgs.js';
|
|
10
|
-
import 'zod';
|
|
11
11
|
import '../axes-CzLEMDeB.js';
|
|
12
|
-
import '../types-BOvHNG7K.js';
|
|
13
12
|
import '../llm.js';
|
|
13
|
+
import '../types-BOvHNG7K.js';
|
|
14
|
+
import '../policy.js';
|
|
15
|
+
import 'zod';
|
|
16
|
+
import '@ggui-ai/mcp-server-core';
|
|
14
17
|
|
|
15
18
|
interface GenerationDispatchParams {
|
|
16
19
|
provider: ProviderName;
|
|
@@ -75,20 +78,38 @@ interface GenerationDispatchParams {
|
|
|
75
78
|
*/
|
|
76
79
|
fixtureProps?: JsonObject;
|
|
77
80
|
/**
|
|
78
|
-
* Whether to wire `
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
81
|
+
* Whether to wire the runtime-render check (`runtimeRender` when given,
|
|
82
|
+
* else `DEFAULT_RUNTIME_RENDER_CHECK`) into the harness's check leg.
|
|
83
|
+
* When `true` (default), the runtime-render probe runs ONCE
|
|
84
|
+
* at the exit decision, after the coding turns, in an isolated
|
|
85
|
+
* subprocess — never on the per-turn hot path. Without an `evaluation`
|
|
86
|
+
* config that round is observe + one repair turn (ggui#1380): a
|
|
87
|
+
* recoverable render crash buys exactly one repair turn and one
|
|
88
|
+
* re-probe, then the generation serves what it has; a probe that timed
|
|
89
|
+
* out, could not run, or had nothing to probe never blocks and never
|
|
90
|
+
* repairs. With an `evaluation` config the probe is the evaluation
|
|
91
|
+
* round's exit gate. Its status and timing land on
|
|
92
|
+
* `evalResult.runtimeProbe` (and on the generation's metadata through
|
|
93
|
+
* `createUiGenerator`).
|
|
82
94
|
*
|
|
83
|
-
* When `false`, the harness omits runtime-render
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* Bench callers can run the probe externally as a final post-gen
|
|
87
|
-
* check to get pass/fail visibility without slowing the loop.
|
|
95
|
+
* When `false`, the harness omits runtime-render entirely: no probe
|
|
96
|
+
* round runs, and a caller can run the probe externally as a final
|
|
97
|
+
* post-generation check instead.
|
|
88
98
|
*
|
|
89
99
|
* Default: `true`.
|
|
90
100
|
*/
|
|
91
101
|
enableRuntimeRender?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The runtime-render check to wire (ggui#1380) — built by the CALLER with
|
|
104
|
+
* `createRuntimeRenderCheck(config)` and kept for the caller's lifetime,
|
|
105
|
+
* because the check instance owns the probe's concurrency cap: one
|
|
106
|
+
* instance per generator bounds the workers a serving deployment has
|
|
107
|
+
* live at once; one per dispatch would give every generation its own
|
|
108
|
+
* free slots and bound nothing. Absent ⇒ `DEFAULT_RUNTIME_RENDER_CHECK`
|
|
109
|
+
* (the evaluation lane's bounds, no concurrency cap). Only read when
|
|
110
|
+
* `enableRuntimeRender` is on.
|
|
111
|
+
*/
|
|
112
|
+
runtimeRender?: RuntimeRenderCheck;
|
|
92
113
|
/**
|
|
93
114
|
* Operator-registered gadget catalog forwarded to the
|
|
94
115
|
* code-gen system prompt's `clientCapabilities — registered
|