@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.
Files changed (67) hide show
  1. package/dist/adapter-Du7P_5Fx.d.ts +201 -0
  2. package/dist/adapters/generation-dispatch.d.ts +33 -12
  3. package/dist/adapters/generation-dispatch.js +510 -128
  4. package/dist/adapters/generation-dispatch.js.map +1 -1
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/advanced/index.d.ts +5 -3
  7. package/dist/advanced/index.js +551 -142
  8. package/dist/advanced/index.js.map +1 -1
  9. package/dist/blueprint-validator.js +153 -59
  10. package/dist/blueprint-validator.js.map +1 -1
  11. package/dist/boilerplate.js.map +1 -1
  12. package/dist/check/index.d.ts +2 -1
  13. package/dist/check/index.js +47 -1
  14. package/dist/check/index.js.map +1 -1
  15. package/dist/{create-ui-generator-D0kbWwln.d.ts → create-ui-generator-GIhzx08x.d.ts} +34 -10
  16. package/dist/{dispatch-wxaIMwZt.d.ts → dispatch-BnAH56p4.d.ts} +1 -1
  17. package/dist/evaluation/axis-checks/index.d.ts +4 -3
  18. package/dist/evaluation/axis-checks/index.js.map +1 -1
  19. package/dist/evaluation/axis-checks/registry.d.ts +2 -1
  20. package/dist/evaluation/index.d.ts +4 -3
  21. package/dist/evaluation/index.js.map +1 -1
  22. package/dist/harness/check/runtime-render/index.d.ts +29 -10
  23. package/dist/harness/check/runtime-render/index.js +203 -60
  24. package/dist/harness/check/runtime-render/index.js.map +1 -1
  25. package/dist/harness/check/runtime-render/render-check-worker.d.ts +8 -1
  26. package/dist/harness/check/runtime-render/render-check-worker.js +72 -32
  27. package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
  28. package/dist/harness/index.d.ts +2 -1
  29. package/dist/harness/index.js.map +1 -1
  30. package/dist/harness/prompts.js.map +1 -1
  31. package/dist/harness/result-types.d.ts +2 -1
  32. package/dist/harness/runtime.d.ts +2 -1
  33. package/dist/harness/runtime.js.map +1 -1
  34. package/dist/harness/types-public.d.ts +11 -2
  35. package/dist/harness/types-public.js.map +1 -1
  36. package/dist/harness/validator-trace-sink.d.ts +2 -1
  37. package/dist/index.d.ts +38 -3
  38. package/dist/index.js +553 -143
  39. package/dist/index.js.map +1 -1
  40. package/dist/patch.d.ts +2 -1
  41. package/dist/policy.d.ts +7 -4
  42. package/dist/policy.js.map +1 -1
  43. package/dist/tools/render-check-worker.d.ts +7 -1
  44. package/dist/tools/render-check-worker.js +55 -23
  45. package/dist/tools/render-check-worker.js.map +1 -1
  46. package/dist/{types-public-Ow-tNtFE.d.ts → types-public-Bk6d1WLN.d.ts} +77 -11
  47. package/dist/workflows.d.ts +2 -1
  48. package/package.json +12 -12
  49. package/src/adapters/generation-dispatch.ts +137 -96
  50. package/src/check/run-tier0.ts +80 -1
  51. package/src/create-ui-generator.ts +185 -95
  52. package/src/evaluation/types-public.ts +73 -11
  53. package/src/harness/check/runtime-render/adapter.ts +221 -75
  54. package/src/harness/check/runtime-render/index.ts +75 -2
  55. package/src/harness/check/runtime-render/render-check-host.ts +82 -19
  56. package/src/harness/check/runtime-render/render-check-worker.ts +83 -29
  57. package/src/harness/check/runtime-render/render-check.ts +154 -117
  58. package/src/harness/coding/generate-task-runner.ts +57 -4
  59. package/src/harness/coding/init-session.ts +13 -0
  60. package/src/harness/coding/run-eval-round.ts +238 -15
  61. package/src/harness/policy.ts +11 -0
  62. package/src/harness/primitive-slice.ts +104 -0
  63. package/src/harness/types-public.ts +9 -1
  64. package/src/index.ts +4 -0
  65. package/src/policy.ts +7 -4
  66. package/src/tools/render-check-worker.ts +74 -23
  67. package/dist/render-check-Blwj8gB6.d.ts +0 -105
@@ -1,12 +1,14 @@
1
- export { R as RenderCheckIssue, a as RenderCheckResult, r as runRenderCheck } from '../../../render-check-Blwj8gB6.js';
1
+ import { b as RenderCheckHostBounds } from '../../../adapter-Du7P_5Fx.js';
2
+ export { D as DEFAULT_RUNTIME_RENDER_CHECK, c as RENDER_CHECK_KINDS, d as RenderCheckHostOptions, a as RenderCheckIssue, e as RenderCheckKind, f as RenderCheckResult, R as RuntimeRenderProbeConfig, g as classifyRenderCrashFix, h as createRuntimeRenderCheck, i as isRecoverableRenderCrash, p as parseRuntimeSubcategory, r as runRenderCheck } from '../../../adapter-Du7P_5Fx.js';
2
3
  import { WireConfig } from '@ggui-ai/wire';
3
4
  import { JsonObject, DataContract } from '@ggui-ai/protocol';
4
- import { RuntimeRenderCheck } from '../../types-public.js';
5
- import '../../../types-public-Ow-tNtFE.js';
6
- import '../../../design-mode-DLufhrNp.js';
5
+ import '../../types-public.js';
6
+ import '../../../styling-profile-CxfvV48g.js';
7
7
  import '../../../axes-CzLEMDeB.js';
8
+ import '../../../types-public-Bk6d1WLN.js';
9
+ import '@ggui-ai/mcp-server-core';
10
+ import '../../../design-mode-DLufhrNp.js';
8
11
  import '../../../types-BOvHNG7K.js';
9
- import '../../../styling-profile-CxfvV48g.js';
10
12
  import '../../../llm.js';
11
13
  import '../../../policy.js';
12
14
 
@@ -109,10 +111,6 @@ interface PrepareMockupInput {
109
111
  */
110
112
  declare function prepareMockupProps(input: PrepareMockupInput): MockupPropsResult;
111
113
 
112
- declare const DEFAULT_RUNTIME_RENDER_CHECK: RuntimeRenderCheck;
113
- declare function isRecoverableRenderCrash(reason: string): boolean;
114
- declare function classifyRenderCrashFix(reason: string): string;
115
-
116
114
  /**
117
115
  * Pre-warm the runtime-render probe's runtime dependencies so the first
118
116
  * actual probe call hits a warm Node module cache.
@@ -139,5 +137,26 @@ declare function warmupRuntimeRenderProbe(): Promise<{
139
137
  loaded: number;
140
138
  missing: number;
141
139
  }>;
140
+ /**
141
+ * Warm the PROCESS that runs every probe (ggui#1380): spawn one real check
142
+ * worker on a trivial component through the same host every probe uses.
143
+ * Afterwards the node binary, the worker's module tree and esbuild's
144
+ * service have all run once on this machine (OS page cache warm), and the
145
+ * result says whether that process can run a check at all — which
146
+ * `warmupRuntimeRenderProbe` (an import in THIS process) cannot tell.
147
+ *
148
+ * `bounds` are the subprocess bounds for the one run; a serving deployment
149
+ * passes the same bounds it will probe with. Never throws: a worker that
150
+ * cannot run is `{ ok: false, reason }`, so a boot sequence can log it and
151
+ * decide, instead of dying in a fire-and-forget.
152
+ */
153
+ declare function warmupRuntimeRenderWorker(bounds?: Partial<RenderCheckHostBounds>): Promise<{
154
+ ok: true;
155
+ ms: number;
156
+ } | {
157
+ ok: false;
158
+ ms: number;
159
+ reason: string;
160
+ }>;
142
161
 
143
- export { DEFAULT_RUNTIME_RENDER_CHECK, type MockupPropsResult, type Probe, classifyRenderCrashFix, createProbe, createProbeWireConfig, isRecoverableRenderCrash, prepareMockupProps, warmupRuntimeRenderProbe };
162
+ export { type MockupPropsResult, type Probe, RenderCheckHostBounds, createProbe, createProbeWireConfig, prepareMockupProps, warmupRuntimeRenderProbe, warmupRuntimeRenderWorker };
@@ -20,9 +20,25 @@ var __export = (target, all) => {
20
20
  // src/harness/check/runtime-render/render-check-host.ts
21
21
  var render_check_host_exports = {};
22
22
  __export(render_check_host_exports, {
23
+ DEFAULT_RENDER_CHECK_HOST_BOUNDS: () => DEFAULT_RENDER_CHECK_HOST_BOUNDS,
23
24
  mapSandboxResultToCheckResult: () => mapSandboxResultToCheckResult,
25
+ resolveRenderCheckHostBounds: () => resolveRenderCheckHostBounds,
26
+ resolveWorkerSpawn: () => resolveWorkerSpawn,
24
27
  runRenderCheckViaWorker: () => runRenderCheckViaWorker
25
28
  });
29
+ function resolveRenderCheckHostBounds(bounds = {}) {
30
+ const timeoutMs = bounds.timeoutMs ?? DEFAULT_RENDER_CHECK_HOST_BOUNDS.timeoutMs;
31
+ const heapMb = bounds.heapMb ?? DEFAULT_RENDER_CHECK_HOST_BOUNDS.heapMb;
32
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 2) {
33
+ throw new RangeError(`render-check: timeoutMs must be an integer \u2265 2, got ${timeoutMs}`);
34
+ }
35
+ if (!Number.isInteger(heapMb) || heapMb < 1) {
36
+ throw new RangeError(`render-check: heapMb must be a positive integer, got ${heapMb}`);
37
+ }
38
+ const requestedGrace = bounds.gracePeriodMs ?? DEFAULT_RENDER_CHECK_HOST_BOUNDS.gracePeriodMs;
39
+ const gracePeriodMs = Math.max(1, Math.min(requestedGrace, Math.floor(timeoutMs / 2)));
40
+ return { timeoutMs, heapMb, gracePeriodMs };
41
+ }
26
42
  function resolveWorkerSpawn() {
27
43
  const jsCandidates = [
28
44
  // Sibling — when import.meta.url is already .../harness/check/runtime-render/.
@@ -71,12 +87,12 @@ function unverified(reason, t0) {
71
87
  stats: { actionsChecked: 0, streamsChecked: 0, renderMs: Date.now() - t0 }
72
88
  };
73
89
  }
74
- function mapSandboxResultToCheckResult(result, t0) {
90
+ function mapSandboxResultToCheckResult(result, t0, boundMs = DEFAULT_RENDER_CHECK_HOST_BOUNDS.timeoutMs) {
75
91
  if (result.outcome === "timeout") {
76
92
  return {
77
93
  ok: false,
78
94
  issues: [],
79
- incomplete: { kind: "timeout", elapsedMs: result.durationMs, boundMs: CHECK_TIMEOUT_MS },
95
+ incomplete: { kind: "timeout", elapsedMs: result.durationMs, boundMs },
80
96
  stats: { actionsChecked: 0, streamsChecked: 0, renderMs: Date.now() - t0 }
81
97
  };
82
98
  }
@@ -121,8 +137,9 @@ function mapSandboxResultToCheckResult(result, t0) {
121
137
  );
122
138
  }
123
139
  }
124
- async function runRenderCheckViaWorker(input) {
140
+ async function runRenderCheckViaWorker(input, options = {}) {
125
141
  const t0 = Date.now();
142
+ const bounds = resolveRenderCheckHostBounds(options.bounds);
126
143
  let spawn;
127
144
  try {
128
145
  spawn = resolveWorkerSpawn();
@@ -133,9 +150,10 @@ async function runRenderCheckViaWorker(input) {
133
150
  const result = await runSandboxed({
134
151
  command: spawn.command,
135
152
  args: spawn.args,
136
- timeoutMs: CHECK_TIMEOUT_MS,
153
+ timeoutMs: bounds.timeoutMs,
154
+ gracePeriodMs: bounds.gracePeriodMs,
137
155
  maxStdoutBytes: CHECK_STDOUT_CAP,
138
- nodeHeapMb: CHECK_NODE_HEAP_MB,
156
+ nodeHeapMb: bounds.heapMb,
139
157
  stdin: JSON.stringify(input),
140
158
  // NODE_ENV steers React's production vs development build — keep
141
159
  // parity with the caller; everything else stays on the sandbox's
@@ -147,15 +165,18 @@ async function runRenderCheckViaWorker(input) {
147
165
  end: loadavg()[0] ?? 0,
148
166
  cores: availableParallelism()
149
167
  };
150
- const mapped = mapSandboxResultToCheckResult(result, t0);
168
+ const mapped = mapSandboxResultToCheckResult(result, t0, bounds.timeoutMs);
151
169
  return { ...mapped, stats: { ...mapped.stats, hostLoad } };
152
170
  }
153
- var CHECK_TIMEOUT_MS, CHECK_STDOUT_CAP, CHECK_NODE_HEAP_MB, WORKER_BASENAME;
171
+ var DEFAULT_RENDER_CHECK_HOST_BOUNDS, CHECK_STDOUT_CAP, WORKER_BASENAME;
154
172
  var init_render_check_host = __esm({
155
173
  "src/harness/check/runtime-render/render-check-host.ts"() {
156
- CHECK_TIMEOUT_MS = 3e4;
174
+ DEFAULT_RENDER_CHECK_HOST_BOUNDS = {
175
+ timeoutMs: 3e4,
176
+ heapMb: 512,
177
+ gracePeriodMs: 2e3
178
+ };
157
179
  CHECK_STDOUT_CAP = 2 * 1024 * 1024;
158
- CHECK_NODE_HEAP_MB = 512;
159
180
  WORKER_BASENAME = "render-check-worker";
160
181
  }
161
182
  });
@@ -677,13 +698,22 @@ function editableSurface(el) {
677
698
  function parentLink(node) {
678
699
  return node;
679
700
  }
680
- async function runRenderCheck(input) {
701
+ var RENDER_CHECK_KINDS = [
702
+ "render-no-throw",
703
+ "prop-sensitivity",
704
+ "action-wiring",
705
+ "selection-identity",
706
+ "prop-coverage",
707
+ "optional-props-omitted",
708
+ "stream-rerender"
709
+ ];
710
+ async function runRenderCheck(input, options = {}) {
681
711
  const g = hostGlobals();
682
712
  if ("window" in g && "document" in g) {
683
713
  return runRenderCheckInProcess(input);
684
714
  }
685
715
  const { runRenderCheckViaWorker: runRenderCheckViaWorker2 } = await Promise.resolve().then(() => (init_render_check_host(), render_check_host_exports));
686
- return runRenderCheckViaWorker2(input);
716
+ return runRenderCheckViaWorker2(input, options);
687
717
  }
688
718
  async function runRenderCheckInProcess(input) {
689
719
  const t0 = Date.now();
@@ -697,7 +727,7 @@ async function runRenderCheckInProcess(input) {
697
727
  const Wire = await import('@ggui-ai/wire');
698
728
  const { GguiWireProvider } = Wire;
699
729
  const moduleResolutions = {
700
- "react": React,
730
+ react: React,
701
731
  "react/jsx-runtime": ReactJsxRuntime,
702
732
  "@ggui-ai/wire": Wire
703
733
  };
@@ -813,14 +843,23 @@ async function runRenderCheckInProcess(input) {
813
843
  )
814
844
  );
815
845
  const timeoutPromise = new Promise((_, reject) => {
816
- setTimeout(() => reject(new Error(`[runtime-render] render exceeded ${RENDER_TIMEOUT_MS}ms \u2014 classified as runtime-hang`)), RENDER_TIMEOUT_MS).unref?.();
846
+ setTimeout(
847
+ () => reject(
848
+ new Error(
849
+ `[runtime-render] render exceeded ${RENDER_TIMEOUT_MS}ms \u2014 classified as runtime-hang`
850
+ )
851
+ ),
852
+ RENDER_TIMEOUT_MS
853
+ ).unref?.();
817
854
  });
818
855
  renderResult = await Promise.race([renderPromise, timeoutPromise]);
819
856
  } catch (e) {
820
857
  const msg = e instanceof Error ? e.message : String(e);
821
858
  const errStack = e instanceof Error ? e.stack ?? "" : "";
822
859
  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}`;
823
- const userFrames = errStack.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).filter((l) => !/(node_modules|happy-dom|@testing-library|react-dom|node:internal|node:async)/.test(l)).slice(0, 5);
860
+ const userFrames = errStack.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).filter(
861
+ (l) => !/(node_modules|happy-dom|@testing-library|react-dom|node:internal|node:async)/.test(l)
862
+ ).slice(0, 5);
824
863
  const stackSource = boundaryRef.stack ?? capturedComponentStack ?? "";
825
864
  const componentFrames = stackSource.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("at ")).slice(0, 4);
826
865
  const stackBlock = userFrames.length ? `
@@ -1285,9 +1324,7 @@ function idLikeRequiredStringField(schema) {
1285
1324
  const required = schema["required"];
1286
1325
  if (properties === null || typeof properties !== "object") return null;
1287
1326
  if (!Array.isArray(required)) return null;
1288
- for (const [propName, propSchema] of Object.entries(
1289
- properties
1290
- )) {
1327
+ for (const [propName, propSchema] of Object.entries(properties)) {
1291
1328
  if (!/id$/i.test(propName)) continue;
1292
1329
  if (!required.includes(propName)) continue;
1293
1330
  const t = propSchema !== null && typeof propSchema === "object" ? propSchema["type"] : void 0;
@@ -1318,9 +1355,7 @@ async function checkSelectionIdentity(input) {
1318
1355
  return void 0;
1319
1356
  }
1320
1357
  await flushPromises();
1321
- const events = probe.getFireLog().slice(before).filter(
1322
- (e) => e.kind === "action.fired" && e.name === actionName
1323
- );
1358
+ const events = probe.getFireLog().slice(before).filter((e) => e.kind === "action.fired" && e.name === actionName);
1324
1359
  return events.length > 0 ? events[events.length - 1].payload : void 0;
1325
1360
  };
1326
1361
  const first = await payloadFor(group[0]);
@@ -1381,7 +1416,10 @@ async function dispatchTrigger(el, kind, user) {
1381
1416
  case "submit": {
1382
1417
  const form = closestForm(el);
1383
1418
  if (!form) return;
1384
- const ev = new globalThis.Event("submit", { bubbles: true, cancelable: true });
1419
+ const ev = new globalThis.Event("submit", {
1420
+ bubbles: true,
1421
+ cancelable: true
1422
+ });
1385
1423
  toEventDispatcher(form).dispatchEvent(ev);
1386
1424
  return;
1387
1425
  }
@@ -1718,47 +1756,112 @@ function synthesizeFromSchema(schema, hint, warnings, depth, ordinal) {
1718
1756
  }
1719
1757
 
1720
1758
  // src/harness/check/runtime-render/adapter.ts
1721
- var DEFAULT_RUNTIME_RENDER_CHECK = {
1722
- id: "runtime-render",
1723
- run: async (input) => {
1724
- const { sourceCode, compiledCode, contract, fixtureProps } = input;
1725
- if (compiledCode === null) {
1726
- return { status: "not-applicable", issues: [], reason: "no compiled code" };
1727
- }
1728
- if (!contract) {
1729
- return { status: "not-applicable", issues: [], reason: "no contract surface" };
1730
- }
1731
- const mockup = prepareMockupProps({ contract, fixtureProps });
1732
- let result;
1733
- try {
1734
- result = await runRenderCheck({
1735
- sourceCode,
1736
- mockupProps: mockup.props,
1737
- contract
1759
+ init_render_check_host();
1760
+ function createSlotLimiter(maxConcurrent) {
1761
+ if (maxConcurrent === void 0) return (task) => task(0);
1762
+ if (!Number.isInteger(maxConcurrent) || maxConcurrent < 1) {
1763
+ throw new RangeError(
1764
+ `createRuntimeRenderCheck: maxConcurrent must be a positive integer, got ${maxConcurrent}`
1765
+ );
1766
+ }
1767
+ let active = 0;
1768
+ const waiting = [];
1769
+ const acquire = () => {
1770
+ if (active < maxConcurrent) {
1771
+ active += 1;
1772
+ return Promise.resolve(0);
1773
+ }
1774
+ const enqueuedAt = Date.now();
1775
+ return new Promise((resolve) => {
1776
+ waiting.push(() => {
1777
+ active += 1;
1778
+ resolve(Date.now() - enqueuedAt);
1738
1779
  });
1739
- } catch (e) {
1740
- const message = e instanceof Error ? e.message : String(e);
1741
- console.warn(
1742
- `[runtime-render] probe skipped \u2014 infra failure: ${message}`
1743
- );
1744
- return { status: "infra-skipped", issues: [], reason: message };
1780
+ });
1781
+ };
1782
+ const release = () => {
1783
+ active -= 1;
1784
+ const next = waiting.shift();
1785
+ if (next !== void 0) next();
1786
+ };
1787
+ return async (task) => {
1788
+ const waitedMs = await acquire();
1789
+ try {
1790
+ return await task(waitedMs);
1791
+ } finally {
1792
+ release();
1745
1793
  }
1746
- const hostLoad = result.stats.hostLoad;
1747
- const load = hostLoad !== void 0 ? { hostLoad } : {};
1748
- if (result.incomplete !== void 0) {
1749
- const { elapsedMs, boundMs } = result.incomplete;
1750
- const loadNote = hostLoad !== void 0 ? `; host load ${hostLoad.start.toFixed(1)} \u2192 ${hostLoad.end.toFixed(1)} on ${hostLoad.cores} CPUs` : "";
1751
- const reason = `render check did not finish within ${boundMs} ms (stopped at ${elapsedMs} ms)${loadNote}`;
1752
- console.warn(`[runtime-render] probe timed out \u2014 ${reason}`);
1753
- return { status: "timed-out", issues: [], reason, elapsedMs, ...load };
1794
+ };
1795
+ }
1796
+ function queuedField(queuedMs) {
1797
+ return queuedMs > 0 ? { queuedMs } : {};
1798
+ }
1799
+ function toRenderCheckOptions(config) {
1800
+ if (config.timeoutMs === void 0 && config.heapMb === void 0) return void 0;
1801
+ return {
1802
+ bounds: {
1803
+ ...config.timeoutMs !== void 0 ? { timeoutMs: config.timeoutMs } : {},
1804
+ ...config.heapMb !== void 0 ? { heapMb: config.heapMb } : {}
1754
1805
  }
1755
- return {
1756
- status: "ran",
1757
- issues: result.issues.map(toEvalIssue).filter((x) => x !== null),
1758
- ...load
1759
- };
1760
- }
1761
- };
1806
+ };
1807
+ }
1808
+ function createRuntimeRenderCheck(config = {}) {
1809
+ const limit = createSlotLimiter(config.maxConcurrent);
1810
+ const options = toRenderCheckOptions(config);
1811
+ if (options !== void 0) resolveRenderCheckHostBounds(options.bounds);
1812
+ return {
1813
+ id: "runtime-render",
1814
+ run: async (input) => {
1815
+ const { sourceCode, compiledCode, contract, fixtureProps } = input;
1816
+ if (compiledCode === null) {
1817
+ return { status: "not-applicable", issues: [], reason: "no compiled code" };
1818
+ }
1819
+ if (!contract) {
1820
+ return { status: "not-applicable", issues: [], reason: "no contract surface" };
1821
+ }
1822
+ const mockup = prepareMockupProps({ contract, fixtureProps });
1823
+ let queuedMs = 0;
1824
+ let t0 = Date.now();
1825
+ let result;
1826
+ try {
1827
+ result = await limit((waitedMs) => {
1828
+ queuedMs = waitedMs;
1829
+ t0 = Date.now();
1830
+ return runRenderCheck(
1831
+ {
1832
+ sourceCode,
1833
+ mockupProps: mockup.props,
1834
+ contract
1835
+ },
1836
+ options
1837
+ );
1838
+ });
1839
+ } catch (e) {
1840
+ const message = e instanceof Error ? e.message : String(e);
1841
+ console.warn(`[runtime-render] probe skipped \u2014 infra failure: ${message}`);
1842
+ return { status: "infra-skipped", issues: [], reason: message, elapsedMs: Date.now() - t0, ...queuedField(queuedMs) };
1843
+ }
1844
+ const hostLoad = result.stats.hostLoad;
1845
+ const load = hostLoad !== void 0 ? { hostLoad } : {};
1846
+ if (result.incomplete !== void 0) {
1847
+ const { elapsedMs, boundMs } = result.incomplete;
1848
+ const loadNote = hostLoad !== void 0 ? `; host load ${hostLoad.start.toFixed(1)} \u2192 ${hostLoad.end.toFixed(1)} on ${hostLoad.cores} CPUs` : "";
1849
+ const reason = `render check did not finish within ${boundMs} ms (stopped at ${elapsedMs} ms)${loadNote}`;
1850
+ console.warn(`[runtime-render] probe timed out \u2014 ${reason}`);
1851
+ return { status: "timed-out", issues: [], reason, elapsedMs: Date.now() - t0, ...queuedField(queuedMs), ...load };
1852
+ }
1853
+ return {
1854
+ status: "ran",
1855
+ issues: result.issues.map(toEvalIssue).filter((x) => x !== null),
1856
+ elapsedMs: Date.now() - t0,
1857
+ ...queuedField(queuedMs),
1858
+ renderMs: result.stats.renderMs,
1859
+ ...load
1860
+ };
1861
+ }
1862
+ };
1863
+ }
1864
+ var DEFAULT_RUNTIME_RENDER_CHECK = createRuntimeRenderCheck();
1762
1865
  var CLASS_SPECIFIC_PATTERNS = [
1763
1866
  /too many re-renders/i,
1764
1867
  /maximum update depth/i,
@@ -1797,6 +1900,14 @@ function classifyRenderCrashFix(reason) {
1797
1900
  }
1798
1901
  return "Add null guards on optional props, handle empty arrays/strings, and verify all hook outputs before destructuring.";
1799
1902
  }
1903
+ var RUNTIME_SUBCATEGORY_PREFIX = "runtime:";
1904
+ function parseRuntimeSubcategory(subcategory) {
1905
+ if (!subcategory.startsWith(RUNTIME_SUBCATEGORY_PREFIX)) return void 0;
1906
+ const rest = subcategory.slice(RUNTIME_SUBCATEGORY_PREFIX.length);
1907
+ const separator = rest.indexOf(":");
1908
+ const check = separator === -1 ? rest : rest.slice(0, separator);
1909
+ return RENDER_CHECK_KINDS.find((kind) => kind === check);
1910
+ }
1800
1911
  function toEvalIssue(issue) {
1801
1912
  if (issue.outcome === "verified" || issue.outcome === "skipped") return null;
1802
1913
  const result = issue.outcome === "failed" ? "fail" : "warn";
@@ -1919,7 +2030,39 @@ async function warmupRuntimeRenderProbe() {
1919
2030
  ]);
1920
2031
  return { ms: Date.now() - start, loaded, missing };
1921
2032
  }
2033
+ var WARMUP_COMPONENT = "export default function Warmup() { return <div>warm</div>; }";
2034
+ async function warmupRuntimeRenderWorker(bounds) {
2035
+ const start = Date.now();
2036
+ try {
2037
+ const { runRenderCheckViaWorker: runRenderCheckViaWorker2 } = await Promise.resolve().then(() => (init_render_check_host(), render_check_host_exports));
2038
+ const result = await runRenderCheckViaWorker2(
2039
+ { sourceCode: WARMUP_COMPONENT, mockupProps: {}, contract: {} },
2040
+ bounds !== void 0 ? { bounds } : {}
2041
+ );
2042
+ const ms = Date.now() - start;
2043
+ if (result.incomplete !== void 0) {
2044
+ return {
2045
+ ok: false,
2046
+ ms,
2047
+ reason: `the warm-up check did not finish within ${result.incomplete.boundMs} ms (stopped at ${result.incomplete.elapsedMs} ms)`
2048
+ };
2049
+ }
2050
+ const blocking = result.issues.find(
2051
+ (i) => i.outcome === "failed" || i.outcome === "unverified"
2052
+ );
2053
+ if (blocking !== void 0) {
2054
+ return { ok: false, ms, reason: `${blocking.check} ${blocking.outcome}: ${blocking.reason}` };
2055
+ }
2056
+ return { ok: true, ms };
2057
+ } catch (err) {
2058
+ return {
2059
+ ok: false,
2060
+ ms: Date.now() - start,
2061
+ reason: err instanceof Error ? err.message : String(err)
2062
+ };
2063
+ }
2064
+ }
1922
2065
 
1923
- export { DEFAULT_RUNTIME_RENDER_CHECK, classifyRenderCrashFix, createProbe, createProbeWireConfig, isRecoverableRenderCrash, prepareMockupProps, runRenderCheck, warmupRuntimeRenderProbe };
2066
+ export { DEFAULT_RUNTIME_RENDER_CHECK, RENDER_CHECK_KINDS, classifyRenderCrashFix, createProbe, createProbeWireConfig, createRuntimeRenderCheck, isRecoverableRenderCrash, parseRuntimeSubcategory, prepareMockupProps, runRenderCheck, warmupRuntimeRenderProbe, warmupRuntimeRenderWorker };
1924
2067
  //# sourceMappingURL=index.js.map
1925
2068
  //# sourceMappingURL=index.js.map