@helix3/helix-cli 0.1.14-helix3.162 → 0.1.14-helix3.164

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.
@@ -0,0 +1,131 @@
1
+ import { type HelperTimeoutState } from './browser/launch';
2
+ /** The query parameter that boots a world for baking. `=1` and nothing else. */
3
+ export declare const BAKE_PARAM = "helixBake";
4
+ /** The artifact the bake writes, next to the visual contract it is pointed at from. */
5
+ export declare const BAKE_ARTIFACT_FILE = "helix.visuals.bake.json";
6
+ /** K sun keys, the driver's own default. Below 2 the planner cannot place both horizon keys. */
7
+ export declare const DEFAULT_BAKE_KEYS = 9;
8
+ /** Boot budget. SwiftShader boots a world minutes slower than a real GPU, so this is seconds-times-hundreds. */
9
+ export declare const DEFAULT_BAKE_BOOT_TIMEOUT_S = 300;
10
+ export type BakePhase = 'idle' | 'warm-up' | 'audit' | 'key' | 'practicals' | 'geometry' | 'done' | 'failed';
11
+ export type BakeProgress = {
12
+ phase: BakePhase;
13
+ done: number;
14
+ total: number;
15
+ };
16
+ export type BakeKeyTiming = {
17
+ hours: number;
18
+ elevationDeg: number;
19
+ azimuthDeg: number;
20
+ ms: number;
21
+ bakeMs: number;
22
+ };
23
+ export type BakeAuditSummary = {
24
+ probes: number;
25
+ flagged: number;
26
+ counts: Record<string, number>;
27
+ blockedEdges: number;
28
+ leakingEdges: number;
29
+ ms: number;
30
+ };
31
+ export type BakeRepairSummary = {
32
+ damaged: number;
33
+ substituted: number;
34
+ leftDark: number;
35
+ donorPool: number;
36
+ occludedCandidates: number;
37
+ maxDonorGridDistance: number;
38
+ /** THE TRIPWIRE: a donated probe whose donor it cannot see is a cross-zone light teleport. MUST read 0. */
39
+ donorsOccluded: number;
40
+ ms: number;
41
+ };
42
+ /** Whether the probe volume fits the space the world is played in — a PLACEMENT verdict, not a bake defect. */
43
+ export type BakeVolumeFitSummary = {
44
+ layers: number;
45
+ /** Probe layers carrying at least `litShare` of the strongest layer's energy. */
46
+ litLayers: number;
47
+ litShare: number;
48
+ /** Total DC irradiance per Y layer, bottom first. */
49
+ layerEnergy: number[];
50
+ /** False = most of the box baked darkness or open sky. */
51
+ fits: boolean;
52
+ };
53
+ export type BakeSummary = {
54
+ keys: number;
55
+ probes: number;
56
+ totalMs: number;
57
+ warmUpMs: number;
58
+ perKey: BakeKeyTiming[];
59
+ practicalsMs: number;
60
+ geometryMs: number;
61
+ auditKey: number;
62
+ audit: BakeAuditSummary;
63
+ repair: BakeRepairSummary;
64
+ /** OPTIONAL against the ENGINE, not against the contract: a world bundles its own @helix/visual, so a build
65
+ * made before the volume-fit verdict existed reports no `volumeFit` at all and simply gets no warning. */
66
+ volumeFit?: BakeVolumeFitSummary;
67
+ repairs: number;
68
+ volume: {
69
+ probes: [number, number, number];
70
+ size: [number, number, number];
71
+ center: [number, number, number];
72
+ };
73
+ /** False when the tier ran without DDGI visibility — the artifact then ships SH only. */
74
+ geometry: boolean;
75
+ fieldBytes: number;
76
+ geometryBytes: number;
77
+ };
78
+ /** Where the bake serves from and which roots take the artifact + the pointer. */
79
+ export type BakeTargets = {
80
+ /** The built bundle the browser loads. */
81
+ servedDir: string;
82
+ /** The world roots written to: the source `public/` (when it exists) and the built bundle root. */
83
+ roots: string[];
84
+ };
85
+ export type BakeWrite = {
86
+ path: string;
87
+ kind: 'artifact' | 'contract';
88
+ bytes: number;
89
+ /** True when the file did not exist and this run created it. */
90
+ created: boolean;
91
+ };
92
+ export type BakeLightingOptions = {
93
+ directory: string;
94
+ keys?: number | undefined;
95
+ /** Boot budget in ms — the wait for `window.__helixBake`, NOT a cap on the bake itself. */
96
+ timeoutMs?: number | undefined;
97
+ onProgress?: ((message: string) => void) | undefined;
98
+ };
99
+ export type BakeLightingResult = {
100
+ summary: BakeSummary;
101
+ written: BakeWrite[];
102
+ servedDir: string;
103
+ };
104
+ /**
105
+ * Which bundle is served and which roots are written. Mirrors the convention `helix validate` reads the visual
106
+ * contract under: the built bundle serves it from the ROOT, a source tree keeps it in `public/` — so both copies
107
+ * are patched, leaving the just-baked build publishable and the next build carrying the same pointer.
108
+ */
109
+ export declare function resolveBakeTargets(directory: string): BakeTargets;
110
+ /**
111
+ * The contract patch: `mode: "baked"` plus the artifact pointer, every other key carried verbatim and in place.
112
+ * `null` text creates the minimal v1 document — a world may declare no visual contract at all until it is baked.
113
+ */
114
+ export declare function patchVisualsConfigText(text: string | null, artifact?: string): string;
115
+ /**
116
+ * THE GATE. A donated probe whose donor it cannot see is light teleported across a wall, so the artifact is
117
+ * refused rather than written: the run is sound only while this reads 0. Null when the field is clean.
118
+ */
119
+ export declare function bakeGateFailure(summary: BakeSummary): string | null;
120
+ export declare function formatDuration(ms: number): string;
121
+ export declare function formatBakeProgress(progress: BakeProgress, elapsedMs: number): string;
122
+ /** The compact end-of-run report: what was baked, what it cost, what the audit found, and what landed on disk. */
123
+ export declare function formatBakeSummary(summary: BakeSummary, written: readonly BakeWrite[]): string[];
124
+ /** Page errors FIRST — a VisualInvariantError name is the diagnosis, and the reason below it is the consequence. */
125
+ export declare function composeBakeFailure(reason: string, errors: readonly string[]): string;
126
+ export declare function composeBakeTimeoutDiagnosis(state: HelperTimeoutState, errors: string[]): string;
127
+ /**
128
+ * Serve, boot, bake, gate, write. The bake itself is MINUTES of blocking GPU work inside one `page.evaluate`,
129
+ * which Playwright does not time out; `--timeout` bounds only the wait for the handle.
130
+ */
131
+ export declare function bakeLighting(opts: BakeLightingOptions): Promise<BakeLightingResult>;
@@ -0,0 +1,363 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.DEFAULT_BAKE_BOOT_TIMEOUT_S = exports.DEFAULT_BAKE_KEYS = exports.BAKE_ARTIFACT_FILE = exports.BAKE_PARAM = void 0;
37
+ exports.resolveBakeTargets = resolveBakeTargets;
38
+ exports.patchVisualsConfigText = patchVisualsConfigText;
39
+ exports.bakeGateFailure = bakeGateFailure;
40
+ exports.formatDuration = formatDuration;
41
+ exports.formatBakeProgress = formatBakeProgress;
42
+ exports.formatBakeSummary = formatBakeSummary;
43
+ exports.composeBakeFailure = composeBakeFailure;
44
+ exports.composeBakeTimeoutDiagnosis = composeBakeTimeoutDiagnosis;
45
+ exports.bakeLighting = bakeLighting;
46
+ // The publish-time lighting bake behind `helix bake-lighting`: serves the world's BUILT bundle, drives the
47
+ // in-page bake handle (window.__helixBake) over Playwright, then writes the field artifact and points the
48
+ // world's visual contract at it. Nothing here imports the engine — this module only speaks its window protocol.
49
+ // SYNC OBLIGATION: mirrors helix-web-engine-new/systems/visual/src/runtime/bakeDriver.ts — `BAKE_PARAM`
50
+ // ('helixBake'), `BAKE_HANDLE_KEY` ('__helixBake'), the ready/failed handle shapes, and the `BakeSummary` /
51
+ // `BakeProgress` fields read below. Fix protocol bugs there first, then mirror here; drift surfaces as a missing
52
+ // field at the END of a multi-minute run, so it has to be findable from either side.
53
+ const node_fs_1 = require("node:fs");
54
+ const node_path_1 = require("node:path");
55
+ const helix_manifest_1 = require("@hypersoniclabs/helix-manifest");
56
+ const launch_1 = require("./browser/launch");
57
+ const staticServe_1 = require("./screenshot/staticServe");
58
+ const visualsConfig_1 = require("./visualsConfig");
59
+ /** The query parameter that boots a world for baking. `=1` and nothing else. */
60
+ exports.BAKE_PARAM = 'helixBake';
61
+ /** The artifact the bake writes, next to the visual contract it is pointed at from. */
62
+ exports.BAKE_ARTIFACT_FILE = 'helix.visuals.bake.json';
63
+ /** K sun keys, the driver's own default. Below 2 the planner cannot place both horizon keys. */
64
+ exports.DEFAULT_BAKE_KEYS = 9;
65
+ /** Boot budget. SwiftShader boots a world minutes slower than a real GPU, so this is seconds-times-hundreds. */
66
+ exports.DEFAULT_BAKE_BOOT_TIMEOUT_S = 300;
67
+ const PROGRESS_POLL_MS = 2000;
68
+ // A 2 s poll over a multi-minute bake would print hundreds of identical lines, so a line goes out when the
69
+ // phase/key count MOVES and otherwise on this heartbeat — which is what tells a stalled bake from a slow key.
70
+ const PROGRESS_HEARTBEAT_MS = 15000;
71
+ const MAX_DIAGNOSTIC_LINES = 6;
72
+ const DIAGNOSTIC_LINE_MAX_CHARS = 300;
73
+ const isDirectory = (path) => {
74
+ try {
75
+ return (0, node_fs_1.statSync)(path).isDirectory();
76
+ }
77
+ catch {
78
+ return false;
79
+ }
80
+ };
81
+ // A built world bundle is an entry HTML plus the manifest at its ROOT — the pair `helix validate` reads. A vite
82
+ // source tree carries index.html at the root too but keeps its manifest (and its visual contract) in `public/`,
83
+ // so the pair is what tells the two apart and stops the bake serving un-transpiled source.
84
+ const isBuiltBundle = (dir) => (0, node_fs_1.existsSync)((0, node_path_1.join)(dir, 'index.html')) && (0, node_fs_1.existsSync)((0, node_path_1.join)(dir, helix_manifest_1.MANIFEST_FILENAME));
85
+ /**
86
+ * Which bundle is served and which roots are written. Mirrors the convention `helix validate` reads the visual
87
+ * contract under: the built bundle serves it from the ROOT, a source tree keeps it in `public/` — so both copies
88
+ * are patched, leaving the just-baked build publishable and the next build carrying the same pointer.
89
+ */
90
+ function resolveBakeTargets(directory) {
91
+ const root = (0, node_path_1.resolve)(directory);
92
+ if (!(0, node_fs_1.existsSync)(root))
93
+ throw new Error(`${root} does not exist`);
94
+ const dist = (0, node_path_1.join)(root, 'dist');
95
+ if (isBuiltBundle(dist)) {
96
+ const source = (0, node_path_1.join)(root, 'public');
97
+ return { servedDir: dist, roots: isDirectory(source) ? [source, dist] : [dist] };
98
+ }
99
+ if (isBuiltBundle(root)) {
100
+ // `<world>/dist` handed in straight: the source contract sits one level up, in the tree vite copies from.
101
+ const source = (0, node_path_1.basename)(root) === 'dist' ? (0, node_path_1.join)((0, node_path_1.dirname)(root), 'public') : null;
102
+ return { servedDir: root, roots: source !== null && isDirectory(source) ? [source, root] : [root] };
103
+ }
104
+ throw new Error(`${root} has no built bundle — bake-lighting bakes the BUILT world (index.html + ${helix_manifest_1.MANIFEST_FILENAME}), not the source ` +
105
+ `project. Expected one at ${dist} or at the directory itself; run your build first (npm run build).`);
106
+ }
107
+ // Rewriting a hand-authored document with a different indent (or a flipped line ending) turns a two-line patch
108
+ // into a whole-file diff in the creator's repo, so the shape is read off the file rather than assumed.
109
+ function detectJsonStyle(text) {
110
+ if (text === null)
111
+ return { indent: 2, newline: '\n', trailingNewline: true };
112
+ const indented = /\n([ \t]+)\S/.exec(text);
113
+ const indent = indented ? (indented[1].startsWith('\t') ? '\t' : indented[1].length) : 2;
114
+ return { indent, newline: text.includes('\r\n') ? '\r\n' : '\n', trailingNewline: text.endsWith('\n') };
115
+ }
116
+ /**
117
+ * The contract patch: `mode: "baked"` plus the artifact pointer, every other key carried verbatim and in place.
118
+ * `null` text creates the minimal v1 document — a world may declare no visual contract at all until it is baked.
119
+ */
120
+ function patchVisualsConfigText(text, artifact = exports.BAKE_ARTIFACT_FILE) {
121
+ const source = text !== null && text.trim() !== '' ? text : null;
122
+ const style = detectJsonStyle(source);
123
+ let doc;
124
+ if (source === null) {
125
+ doc = { version: visualsConfig_1.VISUALS_CONFIG_VERSION, mode: 'baked' };
126
+ }
127
+ else {
128
+ const parsed = JSON.parse(source);
129
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
130
+ throw new Error('the visual contract must be a JSON object');
131
+ }
132
+ doc = { ...parsed };
133
+ if (typeof doc.version !== 'number')
134
+ doc.version = visualsConfig_1.VISUALS_CONFIG_VERSION;
135
+ doc.mode = 'baked';
136
+ }
137
+ doc.bakedLighting = { version: visualsConfig_1.BAKED_LIGHTING_VERSION, artifact };
138
+ const json = JSON.stringify(doc, null, style.indent) + (style.trailingNewline ? '\n' : '');
139
+ // JSON.stringify escapes newlines inside strings, so only the formatting ones are here to convert.
140
+ return style.newline === '\n' ? json : json.replace(/\n/g, style.newline);
141
+ }
142
+ /**
143
+ * THE GATE. A donated probe whose donor it cannot see is light teleported across a wall, so the artifact is
144
+ * refused rather than written: the run is sound only while this reads 0. Null when the field is clean.
145
+ */
146
+ function bakeGateFailure(summary) {
147
+ const occluded = summary.repair.donorsOccluded;
148
+ if (occluded <= 0)
149
+ return null;
150
+ return (`GATE FAILED — ${occluded} of this field's de-ghost donors are OCCLUDED from the probe they donated to, so the ` +
151
+ 'artifact carries teleported light across a surface. NOTHING was written. The donor visibility rule regressed ' +
152
+ 'engine-side (systems/visual/src/probes/probeAudit.ts); re-bake once it is fixed.');
153
+ }
154
+ function formatDuration(ms) {
155
+ if (ms < 1000)
156
+ return `${Math.round(ms)}ms`;
157
+ if (ms < 60000)
158
+ return `${(ms / 1000).toFixed(1)}s`;
159
+ const seconds = Math.round(ms / 1000);
160
+ return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`;
161
+ }
162
+ function formatBytes(bytes) {
163
+ if (bytes < 1024)
164
+ return `${bytes} B`;
165
+ if (bytes < 1024 * 1024)
166
+ return `${(bytes / 1024).toFixed(1)} KB`;
167
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
168
+ }
169
+ function formatBakeProgress(progress, elapsedMs) {
170
+ return ` [${formatDuration(elapsedMs)}] ${progress.phase} · ${progress.done}/${progress.total} keys`;
171
+ }
172
+ const row = (label, text) => ` ${label.padEnd(8)} ${text}`;
173
+ /** The compact end-of-run report: what was baked, what it cost, what the audit found, and what landed on disk. */
174
+ function formatBakeSummary(summary, written) {
175
+ const [px, py, pz] = summary.volume.probes;
176
+ const keysMs = summary.perKey.reduce((total, key) => total + key.ms, 0);
177
+ const counts = Object.entries(summary.audit.counts)
178
+ .filter(([, count]) => count > 0)
179
+ .map(([issue, count]) => `${issue} ${count}`)
180
+ .join(', ');
181
+ const lines = [
182
+ `✔ Baked ${summary.keys} keys + practicals · ${summary.probes} probes (${px}×${py}×${pz}) in ${formatDuration(summary.totalMs)}`,
183
+ row('phases', `warm-up ${formatDuration(summary.warmUpMs)} · keys ${formatDuration(keysMs)} · practicals ` +
184
+ `${formatDuration(summary.practicalsMs)} · geometry ${formatDuration(summary.geometryMs)}`),
185
+ row('audit', `${summary.audit.flagged} flagged of ${summary.audit.probes}${counts ? ` (${counts})` : ''} · ` +
186
+ `${summary.audit.leakingEdges} leaking edges of ${summary.audit.blockedEdges} blocked`),
187
+ row('repair', `${summary.repairs} probes repaired of ${summary.repair.damaged} damaged · donors occluded ` +
188
+ `${summary.repair.donorsOccluded}${summary.repair.leftDark > 0 ? ` · ${summary.repair.leftDark} left dark (no visible donor)` : ''}`),
189
+ row('artifact', `${Math.round(summary.fieldBytes / 1024)} KB field + ${Math.round(summary.geometryBytes / 1024)} KB geometry`),
190
+ ];
191
+ if (!summary.geometry) {
192
+ lines.push(' ⚠ SH-ONLY FIELD — this bake ran without DDGI visibility, so a world playing it degrades visibility OFF and its', ' indirect light LEAKS THROUGH WALLS. Re-bake on a tier that carries the probe rung to get the geometry half.');
193
+ }
194
+ const fit = summary.volumeFit;
195
+ if (fit && !fit.fits) {
196
+ const [sx, sy, sz] = summary.volume.size;
197
+ const [cx, cy, cz] = summary.volume.center;
198
+ lines.push(` ⚠ THE PROBE VOLUME DOES NOT FIT THIS WORLD — only ${fit.litLayers} of ${fit.layers} probe layers sit inside the lit space.`, ` The rest of the ${sx}×${sy}×${sz} m box at [${cx}, ${cy}, ${cz}] baked DARKNESS OR OPEN SKY, and the interpolation`, ' washes that back down over the room — a red or blue smear on ceilings is the usual tell. An interior should', ` author "probes": { "center": [x, y, z], "size": [w, h, d] } in ${visualsConfig_1.VISUALS_CONFIG_FILE} to fit the box to its room,`, ' then re-bake. The probe budget is fixed, so a smaller box costs nothing: the cells shrink to fit.');
199
+ }
200
+ written.forEach((file, index) => {
201
+ lines.push(row(index === 0 ? 'wrote' : '', `${file.path} (${formatBytes(file.bytes)}${file.created ? ', created' : ''})`));
202
+ });
203
+ return lines;
204
+ }
205
+ /** Page errors FIRST — a VisualInvariantError name is the diagnosis, and the reason below it is the consequence. */
206
+ function composeBakeFailure(reason, errors) {
207
+ if (errors.length === 0)
208
+ return reason;
209
+ return `page errors during the bake:\n${errors.map((line) => ` - ${line}`).join('\n')}\n\n${reason}`;
210
+ }
211
+ // "absent" — no handle at all — is the real cause here: the page never called createVisualRuntime, so the world
212
+ // is not runtime-lit and there is no probe field to bake. "present" can only be the handle landing on the
213
+ // deadline itself, because the runtime publishes it whole (ready true OR false).
214
+ function composeBakeTimeoutDiagnosis(state, errors) {
215
+ return (0, launch_1.composeTimeoutDiagnosisWith)(state, errors, {
216
+ absent: 'This world never published the bake handle (window.__helixBake) — nothing on the page called the visual ' +
217
+ "runtime's createVisualRuntime, so the world is not runtime-lit and has no probe field to bake. Check that " +
218
+ 'the built world boots standalone, and raise --timeout <s> if the boot is simply slow (SwiftShader is).',
219
+ present: 'The bake handle landed as the deadline expired — the boot is slower than the budget, not broken. Re-run ' +
220
+ 'with a longer --timeout <s>.',
221
+ });
222
+ }
223
+ // Every file is READ and patched before any is written: a world whose contract is unparseable must fail with the
224
+ // bake still intact on the page, not half-written across two roots.
225
+ function planWrites(roots, storeJson) {
226
+ const planned = [];
227
+ for (const root of roots) {
228
+ const artifactPath = (0, node_path_1.join)(root, exports.BAKE_ARTIFACT_FILE);
229
+ planned.push({ path: artifactPath, kind: 'artifact', text: storeJson, created: !(0, node_fs_1.existsSync)(artifactPath) });
230
+ const configPath = (0, node_path_1.join)(root, visualsConfig_1.VISUALS_CONFIG_FILE);
231
+ const existing = (0, node_fs_1.existsSync)(configPath) ? (0, node_fs_1.readFileSync)(configPath, 'utf8') : null;
232
+ try {
233
+ planned.push({ path: configPath, kind: 'contract', text: patchVisualsConfigText(existing), created: existing === null });
234
+ }
235
+ catch (err) {
236
+ throw new Error(`cannot patch ${configPath}: ${err instanceof Error ? err.message : String(err)}`);
237
+ }
238
+ }
239
+ return planned;
240
+ }
241
+ function commitWrites(planned) {
242
+ return planned.map((write) => {
243
+ (0, node_fs_1.writeFileSync)(write.path, write.text);
244
+ return { path: write.path, kind: write.kind, bytes: Buffer.byteLength(write.text), created: write.created };
245
+ });
246
+ }
247
+ /**
248
+ * Serve, boot, bake, gate, write. The bake itself is MINUTES of blocking GPU work inside one `page.evaluate`,
249
+ * which Playwright does not time out; `--timeout` bounds only the wait for the handle.
250
+ */
251
+ async function bakeLighting(opts) {
252
+ const onProgress = opts.onProgress ?? (() => undefined);
253
+ const keys = opts.keys ?? exports.DEFAULT_BAKE_KEYS;
254
+ const timeoutMs = opts.timeoutMs ?? exports.DEFAULT_BAKE_BOOT_TIMEOUT_S * 1000;
255
+ const targets = resolveBakeTargets(opts.directory);
256
+ const playwright = await Promise.resolve().then(() => __importStar(require('playwright')));
257
+ const server = await (0, staticServe_1.startStaticServer)(targets.servedDir);
258
+ let browser;
259
+ try {
260
+ const attempts = [];
261
+ for (const candidate of (0, launch_1.browserCandidates)()) {
262
+ try {
263
+ browser = await playwright.chromium.launch(candidate.launchOptions);
264
+ onProgress(` using ${candidate.label}`);
265
+ break;
266
+ }
267
+ catch (err) {
268
+ attempts.push({ key: candidate.key, label: candidate.label, message: err instanceof Error ? err.message : String(err) });
269
+ }
270
+ }
271
+ if (!browser)
272
+ throw new Error((0, launch_1.composeLaunchFailure)(attempts));
273
+ const page = await browser.newPage({ viewport: { width: 1280, height: 720 }, deviceScaleFactor: 1 });
274
+ // Listening from before the navigation: the invariant the bake trips is thrown during BOOT, and its name is
275
+ // the whole diagnosis on every failure path below.
276
+ const pageErrors = [];
277
+ const recordPageError = (line) => {
278
+ const truncated = line.length > DIAGNOSTIC_LINE_MAX_CHARS ? `${line.slice(0, DIAGNOSTIC_LINE_MAX_CHARS)}…` : line;
279
+ pageErrors.push(truncated);
280
+ if (pageErrors.length > MAX_DIAGNOSTIC_LINES)
281
+ pageErrors.shift();
282
+ };
283
+ page.on('pageerror', (err) => recordPageError(err.message));
284
+ page.on('console', (msg) => {
285
+ if (msg.type() === 'error')
286
+ recordPageError(msg.text());
287
+ });
288
+ onProgress(` serving ${targets.servedDir} on 127.0.0.1:${server.port}`);
289
+ await page.goto(`http://127.0.0.1:${server.port}/?${exports.BAKE_PARAM}=1`, { timeout: timeoutMs });
290
+ onProgress(` waiting up to ${Math.round(timeoutMs / 1000)}s for the bake handle`);
291
+ try {
292
+ await page.waitForFunction("typeof window.__helixBake !== 'undefined'", undefined, { timeout: timeoutMs });
293
+ }
294
+ catch {
295
+ const state = await page.evaluate(() => typeof window.__helixBake === 'undefined' ? 'absent' : 'present');
296
+ throw new Error(`Timed out after ${Math.round(timeoutMs / 1000)}s waiting for the bake handle (window.__helixBake). ` +
297
+ composeBakeTimeoutDiagnosis(state, pageErrors));
298
+ }
299
+ // `ready: false` is TERMINAL — the runtime publishes it rather than fall back to a configuration that would
300
+ // bake a wrong artifact quietly, so there is nothing to retry.
301
+ const handle = await page.evaluate(() => ({
302
+ ready: window.__helixBake.ready === true,
303
+ error: String(window.__helixBake.error ?? ''),
304
+ }));
305
+ if (!handle.ready) {
306
+ throw new Error(composeBakeFailure(`this world cannot be baked: ${handle.error}`, pageErrors));
307
+ }
308
+ onProgress(` handle ready — baking ${keys} keys + practicals (minutes; do not interrupt)`);
309
+ const started = Date.now();
310
+ // The store comes back already stringified: the artifact ships the driver's JSON verbatim, and a Node-side
311
+ // re-serialization of a CDP-decoded object is one more thing that could differ from what the engine wrote.
312
+ let settled = false;
313
+ const run = page
314
+ .evaluate(({ keys: count }) => window.__helixBake
315
+ .run({ keys: count })
316
+ .then((result) => ({ store: JSON.stringify(result.store), summary: result.summary })), { keys })
317
+ .then((result) => {
318
+ settled = true;
319
+ return result;
320
+ }, (err) => {
321
+ settled = true;
322
+ throw err;
323
+ });
324
+ run.catch(() => undefined); // reported at the await below; this only keeps the poll loop's window quiet
325
+ let lastPrinted = 0;
326
+ let lastLine = '';
327
+ while (!settled) {
328
+ await new Promise((done) => setTimeout(done, PROGRESS_POLL_MS));
329
+ if (settled)
330
+ break;
331
+ let progress;
332
+ try {
333
+ progress = await page.evaluate(() => window.__helixBake.progress());
334
+ }
335
+ catch {
336
+ break; // the page went away — the run promise carries the real error
337
+ }
338
+ const line = `${progress.phase} ${progress.done}/${progress.total}`;
339
+ const elapsed = Date.now() - started;
340
+ if (line !== lastLine || elapsed - lastPrinted >= PROGRESS_HEARTBEAT_MS) {
341
+ onProgress(formatBakeProgress(progress, elapsed));
342
+ lastLine = line;
343
+ lastPrinted = elapsed;
344
+ }
345
+ }
346
+ let result;
347
+ try {
348
+ result = await run;
349
+ }
350
+ catch (err) {
351
+ throw new Error(composeBakeFailure(`the bake failed: ${err instanceof Error ? err.message : String(err)}`, pageErrors));
352
+ }
353
+ const gate = bakeGateFailure(result.summary);
354
+ if (gate)
355
+ throw new Error(composeBakeFailure(gate, pageErrors));
356
+ return { summary: result.summary, written: commitWrites(planWrites(targets.roots, result.store)), servedDir: targets.servedDir };
357
+ }
358
+ finally {
359
+ await browser?.close();
360
+ await server.close();
361
+ }
362
+ }
363
+ //# sourceMappingURL=bakeLighting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bakeLighting.js","sourceRoot":"","sources":["../src/bakeLighting.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsJA,gDAkBC;AAiBD,wDAmBC;AAMD,0CAQC;AAED,wCAKC;AAQD,gDAEC;AAKD,8CAgDC;AAGD,gDAGC;AAKD,kEAUC;AAiCD,oCA4HC;AAldD,2GAA2G;AAC3G,0GAA0G;AAC1G,gHAAgH;AAChH,wGAAwG;AACxG,4GAA4G;AAC5G,iHAAiH;AACjH,qFAAqF;AACrF,qCAA4E;AAC5E,yCAA6D;AAC7D,mEAAmE;AAEnE,6CAM0B;AAC1B,0DAA6D;AAC7D,mDAAsG;AAEtG,gFAAgF;AACnE,QAAA,UAAU,GAAG,WAAW,CAAC;AAEtC,uFAAuF;AAC1E,QAAA,kBAAkB,GAAG,yBAAyB,CAAC;AAE5D,gGAAgG;AACnF,QAAA,iBAAiB,GAAG,CAAC,CAAC;AAEnC,gHAAgH;AACnG,QAAA,2BAA2B,GAAG,GAAG,CAAC;AAE/C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,2GAA2G;AAC3G,8GAA8G;AAC9G,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,yBAAyB,GAAG,GAAG,CAAC;AA6FtC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE;IAC5C,IAAI,CAAC;QACH,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,gHAAgH;AAChH,gHAAgH;AAChH,2FAA2F;AAC3F,MAAM,aAAa,GAAG,CAAC,GAAW,EAAW,EA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BAChB,WAAW,GAAG,OAAO,CAAC;YACxB,CAAC;QACH,CAAC;QAED,IAAI,MAA+C,CAAC;QACpD,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,GAAG,CAAC;QACrB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,oBAAoB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;QAC1H,CAAC;QAED,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;IACnI,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC;QACvB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
package/dist/bundle.d.ts CHANGED
@@ -11,6 +11,8 @@ export type BundleCheck = {
11
11
  errors: string[];
12
12
  /** Not publish-blocking, but the creator must SEE them. See streamablePayload. */
13
13
  warnings: string[];
14
+ /** One line per optional contract file that IS present, saying what it declares. Nothing is wrong. */
15
+ notes: string[];
14
16
  };
15
17
  export declare function streamablePayload(files: BundleFile[]): {
16
18
  files: BundleFile[];