@bendyline/molen-tooling 0.0.1

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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +15 -0
  3. package/README.md +91 -0
  4. package/dist/capture/THIRD-PARTY-NOTICES.md +223 -0
  5. package/dist/capture/basis/LICENSE.txt +55 -0
  6. package/dist/capture/basis/basis_transcoder.js +19 -0
  7. package/dist/capture/basis/basis_transcoder.wasm +0 -0
  8. package/dist/capture/capture.html +15 -0
  9. package/dist/capture/harness.js +4671 -0
  10. package/dist/capture/worldgen-preview.html +15 -0
  11. package/dist/capture/worldgen-preview.js +4617 -0
  12. package/dist/cli.d.mts +1 -0
  13. package/dist/cli.mjs +1276 -0
  14. package/dist/docs-src/guide/3d-art-guidelines.md +157 -0
  15. package/dist/docs-src/guide/3d-model-assets.md +286 -0
  16. package/dist/docs-src/guide/adaptive-performance.md +89 -0
  17. package/dist/docs-src/guide/agent-loop.md +156 -0
  18. package/dist/docs-src/guide/aircraft.md +225 -0
  19. package/dist/docs-src/guide/browser-mount.md +185 -0
  20. package/dist/docs-src/guide/building-interiors.md +175 -0
  21. package/dist/docs-src/guide/capability-authoring.md +69 -0
  22. package/dist/docs-src/guide/determinism.md +285 -0
  23. package/dist/docs-src/guide/entities.md +47 -0
  24. package/dist/docs-src/guide/examples.md +58 -0
  25. package/dist/docs-src/guide/experience-playback.md +57 -0
  26. package/dist/docs-src/guide/figures.md +164 -0
  27. package/dist/docs-src/guide/game-samples.md +100 -0
  28. package/dist/docs-src/guide/graphics-performance.md +167 -0
  29. package/dist/docs-src/guide/input.md +205 -0
  30. package/dist/docs-src/guide/materials.md +125 -0
  31. package/dist/docs-src/guide/project.md +157 -0
  32. package/dist/docs-src/guide/quickstart.md +63 -0
  33. package/dist/docs-src/guide/recognizable-places.md +158 -0
  34. package/dist/docs-src/guide/rendering-backends.md +231 -0
  35. package/dist/docs-src/guide/scripting.md +330 -0
  36. package/dist/docs-src/guide/sky.md +192 -0
  37. package/dist/docs-src/guide/source-bundles.md +42 -0
  38. package/dist/docs-src/guide/structure-library.md +114 -0
  39. package/dist/docs-src/guide/surface-rendering.md +203 -0
  40. package/dist/docs-src/guide/terrain.md +389 -0
  41. package/dist/docs-src/guide/three-surface.md +70 -0
  42. package/dist/docs-src/guide/vehicle-interiors.md +126 -0
  43. package/dist/docs-src/guide/vehicles.md +110 -0
  44. package/dist/docs-src/guide/weather.md +123 -0
  45. package/dist/docs-src/guide/worldgen.md +434 -0
  46. package/dist/docs-src/llms.txt +129 -0
  47. package/dist/docs-src/schemas/README.md +36 -0
  48. package/dist/docs-src/schemas/archstyle.md +2340 -0
  49. package/dist/docs-src/schemas/assert.md +169 -0
  50. package/dist/docs-src/schemas/asset.md +543 -0
  51. package/dist/docs-src/schemas/business-catalog.md +162 -0
  52. package/dist/docs-src/schemas/cameratrack.md +132 -0
  53. package/dist/docs-src/schemas/command.md +112 -0
  54. package/dist/docs-src/schemas/components.md +5826 -0
  55. package/dist/docs-src/schemas/delta.md +204 -0
  56. package/dist/docs-src/schemas/experience-play.md +452 -0
  57. package/dist/docs-src/schemas/figure.md +290 -0
  58. package/dist/docs-src/schemas/interior-catalog.md +230 -0
  59. package/dist/docs-src/schemas/keyframe.md +314 -0
  60. package/dist/docs-src/schemas/landmark-catalog.md +56 -0
  61. package/dist/docs-src/schemas/landmark.md +293 -0
  62. package/dist/docs-src/schemas/matgraph.md +1163 -0
  63. package/dist/docs-src/schemas/pack-index.md +82 -0
  64. package/dist/docs-src/schemas/pack-source.md +139 -0
  65. package/dist/docs-src/schemas/pack.md +225 -0
  66. package/dist/docs-src/schemas/pixelgrid.md +108 -0
  67. package/dist/docs-src/schemas/prefab.md +106 -0
  68. package/dist/docs-src/schemas/project.md +271 -0
  69. package/dist/docs-src/schemas/region-atlas.md +612 -0
  70. package/dist/docs-src/schemas/replay.md +807 -0
  71. package/dist/docs-src/schemas/scatter.md +541 -0
  72. package/dist/docs-src/schemas/scene.md +1152 -0
  73. package/dist/docs-src/schemas/source-bundle.md +266 -0
  74. package/dist/docs-src/schemas/stylepack.md +420 -0
  75. package/dist/docs-src/schemas/terrain-package.md +731 -0
  76. package/dist/docs-src/schemas/terrain.md +313 -0
  77. package/dist/docs-src/schemas/types.md +218 -0
  78. package/dist/docs-src/schemas/uvpaint.md +149 -0
  79. package/dist/docs-src/schemas/worldgen-batch.md +743 -0
  80. package/dist/index.d.mts +1271 -0
  81. package/dist/index.mjs +78 -0
  82. package/dist/mcp-BFnCWrg0.mjs +796 -0
  83. package/dist/ops-BGxhSP6w.mjs +7246 -0
  84. package/package.json +96 -0
@@ -0,0 +1,1271 @@
1
+ import { LandmarkDocs, ResolvedStylePack, WorldgenBatchDoc, WorldgenStats } from "@bendyline/molen-worldgen/kernel";
2
+ import { WorldgenQualityPreset } from "@bendyline/molen-worldgen-earth/kernel";
3
+ import { CameraTrackDoc } from "@bendyline/molen-client/camera-track";
4
+ import { AssertionDoc, AssetSidecar, Command, ComponentRegistry, ComponentSummary, ContentIdentity, JsonObject, JsonValue, NamespaceReservation, ProjectManifest, SceneManifest, SchemaSummary, TypesDoc, ValidationIssue, Vec3 } from "@bendyline/molen-schema";
5
+ import { NodeIO } from "@gltf-transform/core";
6
+ import { ResolvedTypes, World, WorldSetup } from "@bendyline/molen-kernel";
7
+ import { PackSet } from "@bendyline/molen-pack";
8
+ import { AssertionResult, ComponentDiff, RecordedEvent } from "@bendyline/molen-kernel/testing";
9
+ import { PMTiles } from "pmtiles";
10
+ //#region src/golden.d.ts
11
+ interface ImageDiff {
12
+ match: boolean;
13
+ diffPixels: number;
14
+ diffRatio: number;
15
+ reason?: string;
16
+ }
17
+ /** Pixel-diff two PNGs; writes a diff image. Per-pixel threshold 0.1. */
18
+ declare function diffImages(aPath: string, bPath: string, diffPath: string, maxDiffRatio?: number): Promise<ImageDiff>;
19
+ interface GoldenResult {
20
+ ok: boolean;
21
+ created: boolean;
22
+ reason?: string;
23
+ diffRatio?: number;
24
+ }
25
+ interface GoldenOptions {
26
+ /** Maximum fraction of differing pixels tolerated (default 0.003). */
27
+ maxDiffRatio?: number;
28
+ }
29
+ /**
30
+ * Compare a freshly rendered candidate PNG against a committed golden. Records the golden only
31
+ * when UPDATE_GOLDENS=1. Tolerance: per-pixel threshold 0.1, max `maxDiffRatio` differing
32
+ * pixels (default 0.3%).
33
+ *
34
+ * A missing golden **fails**. Silently adopting the candidate would make "this test has no
35
+ * reference image" indistinguishable from "this test passed" — and in a fresh CI checkout every
36
+ * uncommitted golden would take that branch, so a suite could report green while comparing
37
+ * nothing.
38
+ */
39
+ declare function compareGolden(candidatePath: string, goldenPath: string, diffPath: string, opts?: GoldenOptions): Promise<GoldenResult>;
40
+ //#endregion
41
+ //#region src/ops/asset-import.d.ts
42
+ interface ImportAssetInput {
43
+ /** Source model file (.glb / .gltf). */
44
+ path: string;
45
+ /** Asset id (default: slugged filename). Dotted ids fall under namespace reservations. */
46
+ id?: string;
47
+ /** Output assets root (default: <project dir>/assets, else ./assets). */
48
+ outDir?: string;
49
+ /** Also extract a whole-asset collision trimesh into collision.bin. */
50
+ trimesh?: boolean;
51
+ /** Skip the normalize pass (dedup/prune/weld/quantize). */
52
+ optimize?: boolean;
53
+ /** Explicit project.json (default: discovered; import still works without one). */
54
+ projectPath?: string;
55
+ /** Directory the discovery starts from (default: process.cwd()). */
56
+ cwd?: string;
57
+ /** Replace files in an existing asset directory. Default false. */
58
+ force?: boolean;
59
+ }
60
+ interface ImportAssetOutput {
61
+ ok: boolean;
62
+ id?: string;
63
+ dir?: string;
64
+ sidecarPath?: string;
65
+ sidecar?: AssetSidecar;
66
+ /** True when the asset was registered into a project manifest. */
67
+ registered?: boolean;
68
+ /** The project.json that was (or would have been) updated — always report it. */
69
+ projectPath?: string;
70
+ warnings?: string[];
71
+ error?: string;
72
+ }
73
+ /**
74
+ * Import a glTF/GLB into the project's asset store: validate + normalize (dedup/prune/weld/
75
+ * quantize; Draco always decoded, never re-encoded — the canonical GLB needs no external
76
+ * decoders), extract bounds + per-node convex hulls (+ optional whole-asset trimesh) for
77
+ * headless physics, write the molen/asset@1 sidecar, and register into project.json.
78
+ */
79
+ declare function importAsset(input: ImportAssetInput): Promise<ImportAssetOutput>;
80
+ //#endregion
81
+ //#region src/ops/asset-inspect.d.ts
82
+ interface InspectAssetInput {
83
+ /** Sidecar path, or a project asset id. */
84
+ ref: string;
85
+ /** Re-hash files.main / collision.bin and compare against the sidecar. */
86
+ verify?: boolean;
87
+ projectPath?: string;
88
+ cwd?: string;
89
+ }
90
+ interface InspectAssetOutput {
91
+ ok: boolean;
92
+ sidecarPath?: string;
93
+ sidecar?: AssetSidecar;
94
+ verified?: boolean;
95
+ verifyErrors?: string[];
96
+ error?: string;
97
+ }
98
+ /** Read + validate a sidecar (by path or project asset id); optionally verify file hashes. */
99
+ declare function inspectAsset(input: InspectAssetInput): Promise<InspectAssetOutput>;
100
+ interface ListAssetsOutput {
101
+ ok: boolean;
102
+ assets?: {
103
+ id: string;
104
+ sidecar: string;
105
+ kind?: string;
106
+ triangles?: number;
107
+ }[];
108
+ error?: string;
109
+ }
110
+ /** List the assets registered in the surrounding project. */
111
+ declare function listAssets(input: {
112
+ projectPath?: string;
113
+ cwd?: string;
114
+ }): Promise<ListAssetsOutput>;
115
+ //#endregion
116
+ //#region src/ops/asset-pack.d.ts
117
+ type PackTextureMode = "etc1s" | "uastc";
118
+ interface PackAssetInput {
119
+ /** Project asset id, or a sidecar path. Omit with `all: true` to pack every project asset. */
120
+ ref?: string;
121
+ /** Pack every asset registered in the project manifest. */
122
+ all?: boolean;
123
+ projectPath?: string;
124
+ cwd?: string;
125
+ /** Variant name recorded in the sidecar (default "ktx2"); the file is model.<variant>.glb. */
126
+ variant?: string;
127
+ /** Force one codec for every texture; "auto" (default) picks per slot / color space. */
128
+ mode?: "auto" | PackTextureMode;
129
+ /** Longest texture side after resizing (default 2048). */
130
+ maxSize?: number;
131
+ /** Snap each texture side to the nearest power of two (default true; mip-friendly). */
132
+ powerOfTwo?: boolean;
133
+ /** ETC1S quality 1..255 (default 128). */
134
+ etc1sQuality?: number;
135
+ /** UASTC pack quality 0..4 (default 2; higher is slower and slightly better). */
136
+ uastcQuality?: number;
137
+ }
138
+ interface PackedTexture {
139
+ name: string;
140
+ /** Material slots the texture feeds (e.g. baseColorTexture, normalTexture). */
141
+ slots: string[];
142
+ mode: PackTextureMode;
143
+ colorSpace: "srgb" | "linear";
144
+ source: {
145
+ width: number;
146
+ height: number;
147
+ bytes: number;
148
+ mimeType: string;
149
+ };
150
+ packed: {
151
+ width: number;
152
+ height: number;
153
+ bytes: number;
154
+ levels: number;
155
+ };
156
+ }
157
+ interface PackedAsset {
158
+ id: string;
159
+ sidecarPath: string;
160
+ variant: string;
161
+ /** Absolute path of the written variant GLB. */
162
+ path: string;
163
+ textures: PackedTexture[];
164
+ /** File sizes of the canonical main GLB and the packed variant. */
165
+ bytes: {
166
+ main: number;
167
+ variant: number;
168
+ };
169
+ /**
170
+ * Estimated GPU texture memory (with mips) before/after: RGBA8 source vs. 8 bits per texel
171
+ * (ASTC 4x4 / BC7). Real ETC1S transcode targets (BC1/ETC1) are half that on some GPUs.
172
+ */
173
+ gpuBytesEstimate: {
174
+ rgba8: number;
175
+ compressed: number;
176
+ };
177
+ }
178
+ interface PackAssetOutput {
179
+ ok: boolean;
180
+ assets?: PackedAsset[];
181
+ warnings?: string[];
182
+ error?: string;
183
+ }
184
+ /** Pack one or every project asset into a KTX2 runtime variant (see module comment). */
185
+ declare function packAsset(input: PackAssetInput): Promise<PackAssetOutput>;
186
+ //#endregion
187
+ //#region src/ops/camera.d.ts
188
+ interface CameraSpec {
189
+ position: Vec3;
190
+ lookAt?: Vec3;
191
+ }
192
+ //#endregion
193
+ //#region src/ops/screenshot.d.ts
194
+ interface TerrainShot {
195
+ /** Validated terrain descriptor, or a path to one. */
196
+ descriptor?: unknown;
197
+ descriptorPath?: string;
198
+ /** Path to a 16-bit grayscale heightmap PNG. */
199
+ heightmapPath?: string;
200
+ /** Raw heightmap PNG bytes (alternative to heightmapPath). */
201
+ heightmapPng?: Uint8Array;
202
+ }
203
+ interface ScreenshotInput {
204
+ /** A full manifest or any raw scene doc (it is validated and defaulted internally). */
205
+ scene?: SceneManifest | Record<string, unknown>;
206
+ /** Scene file path, or a scene NAME from the surrounding project.json. */
207
+ scenePath?: string;
208
+ /** Explicit project.json (default: discovered by walking up from the scene). */
209
+ projectPath?: string;
210
+ setup?: WorldSetup;
211
+ setupModule?: string;
212
+ /** Render packed asset variants (e.g. "ktx2" from `molen asset pack`) where present. */
213
+ assetVariant?: string;
214
+ ticks: number;
215
+ camera?: CameraSpec;
216
+ size?: [number, number];
217
+ outPath: string;
218
+ terrain?: TerrainShot;
219
+ /** Background clear color; defaults to sky-blue with terrain, else dark. */
220
+ clearColor?: string;
221
+ }
222
+ interface RenderStats {
223
+ entitiesRendered: number;
224
+ drawCalls: number;
225
+ triangles: number;
226
+ }
227
+ interface ScreenshotOutput {
228
+ ok: boolean;
229
+ imagePath?: string;
230
+ tick?: number;
231
+ stateHash?: string;
232
+ renderStats?: RenderStats;
233
+ error?: string;
234
+ }
235
+ /**
236
+ * Simulate a scene to tick N in Node, serialize a keyframe, then render exactly one
237
+ * deterministic frame in headless Chromium (SwiftShader) and save a PNG with a stats block
238
+ * (docs-src/guide/agent-loop.md, "Screenshot"). The capture page boots a snapshot viewer — no
239
+ * live kernel. gltf renderables are served to the page over an ephemeral localhost HTTP server.
240
+ */
241
+ declare function screenshotScene(input: ScreenshotInput): Promise<ScreenshotOutput>;
242
+ //#endregion
243
+ //#region src/ops/asset-shot.d.ts
244
+ interface AssetShotInput {
245
+ /** Project asset id, or a sidecar path. */
246
+ ref: string;
247
+ projectPath?: string;
248
+ /** Render this packed variant (e.g. "ktx2") instead of the canonical main GLB. */
249
+ assetVariant?: string;
250
+ /** Number of turntable angles (default 4: front/right/back/left, slightly elevated). */
251
+ angles?: number;
252
+ /** Play this clip and pose it at `clipTime` seconds (default: bind pose). */
253
+ clip?: string;
254
+ clipTime?: number;
255
+ size?: [number, number];
256
+ clearColor?: string;
257
+ outDir: string;
258
+ }
259
+ interface AssetShotOutput {
260
+ ok: boolean;
261
+ frames?: {
262
+ name: string;
263
+ path: string;
264
+ renderStats?: RenderStats;
265
+ }[];
266
+ triangles?: number;
267
+ error?: string;
268
+ }
269
+ /** Render turntable views of an imported asset. */
270
+ declare function screenshotAsset(input: AssetShotInput): Promise<AssetShotOutput>;
271
+ //#endregion
272
+ //#region src/ops/asset-stage.d.ts
273
+ declare const ASSET_INDEX_FILE = "assets.index.json";
274
+ interface StageAssetsInput {
275
+ projectPath?: string;
276
+ cwd?: string;
277
+ /** Output directory (created). */
278
+ outDir: string;
279
+ /** Prefer this packed variant (e.g. "ktx2"); assets without it stage their main file. */
280
+ variant?: string;
281
+ /** Require the variant on every asset instead of falling back to the main file. */
282
+ requireVariant?: boolean;
283
+ /** Remove a previous staging output first (only a directory holding assets.index.json). */
284
+ clean?: boolean;
285
+ }
286
+ interface StagedAsset {
287
+ id: string;
288
+ /** Staged model URL relative to outDir (also the index entry). */
289
+ file: string;
290
+ /** The variant that was staged, when one was. */
291
+ variant?: string;
292
+ bytes: number;
293
+ }
294
+ interface StageAssetsOutput {
295
+ ok: boolean;
296
+ outDir?: string;
297
+ indexPath?: string;
298
+ index?: Record<string, string>;
299
+ assets?: StagedAsset[];
300
+ warnings?: string[];
301
+ error?: string;
302
+ }
303
+ /** Stage registered assets (+ optional packed variant) into a browser-servable directory. */
304
+ declare function stageAssets(input: StageAssetsInput): Promise<StageAssetsOutput>;
305
+ //#endregion
306
+ //#region src/project.d.ts
307
+ /** Walk from startDir up to the fs root looking for a project.json with the right envelope. */
308
+ declare function findProjectFile(startDir: string): Promise<string | undefined>;
309
+ interface ProjectContext {
310
+ path: string;
311
+ dir: string;
312
+ manifest: ProjectManifest;
313
+ typesDocs: {
314
+ doc: TypesDoc;
315
+ source: string;
316
+ }[];
317
+ /** File-backed scripts declared by registry types, before their paths are inlined. */
318
+ typeScriptFiles: {
319
+ typeId: string;
320
+ scriptId: string;
321
+ file: string;
322
+ declaration: string;
323
+ config: JsonObject;
324
+ }[];
325
+ /** Project-level cross-check issues (duplicates, ownership, dangling refs). */
326
+ typeIssues: ValidationIssue[];
327
+ /** Flattened type id -> final component map (what the kernel consumes). */
328
+ resolvedTypes: ResolvedTypes;
329
+ /** Content packs the project uses (project.json `packs`, then MOLEN_PACKS). */
330
+ packs: PackSet;
331
+ /** Which pack content the project's worlds are built from; empty without packs. */
332
+ content: ContentIdentity;
333
+ componentRegistry: ComponentRegistry;
334
+ /** Resolve a scene name (from manifest.scenes) or a path into an absolute scene path. */
335
+ resolveScenePath(nameOrPath: string): string;
336
+ }
337
+ /** Load + validate a project manifest and every types document it references. Throws on invalid. */
338
+ declare function loadProject(path: string): Promise<ProjectContext>;
339
+ /**
340
+ * The single write path for project.json: lockfile (O_EXCL, stale after 30s, bounded retry),
341
+ * re-read, mutate, validate, write temp + atomic rename. Concurrent agents (asset import,
342
+ * types reserve) serialize here instead of clobbering each other.
343
+ */
344
+ declare function updateProjectFile(path: string, mutate: (manifest: ProjectManifest) => void): Promise<ProjectManifest>;
345
+ declare function updateProjectFile(path: string, mutate: (manifest: ProjectManifest) => ProjectManifest): Promise<ProjectManifest>;
346
+ interface LoadSceneOptions {
347
+ /** Explicit project.json path; otherwise discovered by walking up from the scene/cwd. */
348
+ projectPath?: string;
349
+ cwd?: string;
350
+ }
351
+ interface LoadedScene {
352
+ manifest: SceneManifest;
353
+ scenePath: string;
354
+ /** Non-fatal advisories from validation (e.g. deprecated_format after a v1 auto-upgrade). */
355
+ notices: ValidationIssue[];
356
+ project?: ProjectContext;
357
+ }
358
+ /**
359
+ * Load a scene by path or by project scene name: validate (legacy versions auto-upgrade),
360
+ * resolve `scripts[].path` file refs into inline `code` (scene-file-relative), and thread the
361
+ * surrounding project (for registry types). Throws with a formatted message on invalid input.
362
+ */
363
+ declare function loadSceneDocument(ref: string, opts?: LoadSceneOptions): Promise<LoadedScene>;
364
+ /** Load a setup module: accepts `export default setup`, `export setup`, or a defineExperience result. */
365
+ declare function loadSetupLike(modulePath: string): Promise<WorldSetup>;
366
+ //#endregion
367
+ //#region src/ops/build.d.ts
368
+ /**
369
+ * Resolve asset ids to their sidecar-declared primary files for browser renderers. With
370
+ * `variant`, a packed variant (molen asset pack) replaces the main file where present.
371
+ */
372
+ declare function assetFileIndex(project: ProjectContext, opts?: {
373
+ variant?: string;
374
+ }): Promise<Record<string, string>>;
375
+ //#endregion
376
+ //#region src/ops/check-scripts.d.ts
377
+ interface CheckScriptsInput {
378
+ projectPath?: string;
379
+ cwd?: string;
380
+ }
381
+ interface ScriptDiagnostic {
382
+ /** Project-relative script path. */
383
+ file: string;
384
+ line: number;
385
+ column: number;
386
+ code: string;
387
+ message: string;
388
+ }
389
+ interface CheckScriptsOutput {
390
+ ok: boolean;
391
+ error?: string;
392
+ /** Number of script files checked. */
393
+ checked?: number;
394
+ diagnostics?: ScriptDiagnostic[];
395
+ /** Generated artifacts that no longer match the scenes (regenerate before trusting a check). */
396
+ stale?: string[];
397
+ /** Directories whose declarations were never generated. */
398
+ ungenerated?: string[];
399
+ }
400
+ /** Typecheck every file-backed scene or registry-type script in the project. */
401
+ declare function checkScripts(input: CheckScriptsInput): Promise<CheckScriptsOutput>;
402
+ //#endregion
403
+ //#region src/ops/describe.d.ts
404
+ interface OpParam {
405
+ name: string;
406
+ type: string;
407
+ required: boolean;
408
+ description: string;
409
+ /**
410
+ * True for a parameter that exists only on the CLI — the MCP tool derives it (for example an
411
+ * output directory the tool allocates and returns images from). test/catalog.test.ts requires
412
+ * every other param to match the MCP tool's input schema exactly.
413
+ */
414
+ cliOnly?: boolean;
415
+ }
416
+ interface OpDescriptor {
417
+ /** Stable op name (matches the MCP tool name where one exists). */
418
+ name: string;
419
+ summary: string;
420
+ /** CLI invocation form, if exposed on the CLI. */
421
+ cli?: string;
422
+ /** MCP tool name, if exposed over MCP. */
423
+ mcpTool?: string;
424
+ params: OpParam[];
425
+ }
426
+ /**
427
+ * Machine-readable contract for every agent-facing operation. The CLI help and the MCP
428
+ * `describe_op` tool both render this, so an agent can discover I/O without reading source.
429
+ */
430
+ declare const OPS_CATALOG: OpDescriptor[];
431
+ /** Return the full catalog, or just the entry whose name/cli/mcpTool matches `name`. */
432
+ declare function describeOps(name?: string): OpDescriptor[];
433
+ /** Render one descriptor as agent-facing help text. */
434
+ declare function formatOp(op: OpDescriptor): string;
435
+ //#endregion
436
+ //#region src/ops/docs.d.ts
437
+ interface SearchDocsInput {
438
+ query: string;
439
+ k?: number;
440
+ /**
441
+ * Also search the historical design plan in docs/, which may lag the code. Off by default —
442
+ * those hits describe intent, not the shipped engine. When on, they are tagged.
443
+ */
444
+ includeDesign?: boolean;
445
+ /** Override the base dir to search from (defaults to the located bundle root). */
446
+ baseDir?: string;
447
+ }
448
+ interface DocHit {
449
+ path: string;
450
+ score: number;
451
+ excerpt: string;
452
+ design: boolean;
453
+ }
454
+ interface SearchDocsOutput {
455
+ ok: boolean;
456
+ hits: DocHit[];
457
+ root?: string;
458
+ formatted: string;
459
+ }
460
+ /**
461
+ * Locate the docs bundle root by walking up from a start dir until a folder containing
462
+ * docs-src/llms.txt is found. Falls back to the start dir. This makes search_docs work
463
+ * regardless of the cwd the MCP server / CLI was launched from.
464
+ */
465
+ declare function locateDocsRoot(start?: string): Promise<string>;
466
+ /** Lexical doc search (term-frequency ranking) over the shipped bundle. */
467
+ declare function searchDocs(input: SearchDocsInput): Promise<SearchDocsOutput>;
468
+ //#endregion
469
+ //#region src/ops/drive.d.ts
470
+ interface DriveAction {
471
+ /** Tick this action applies at (actions are processed in ascending order). */
472
+ at: number;
473
+ /** Submit a command (envelope is filled: source "drive", auto seq, tick = at). */
474
+ command?: {
475
+ type: string;
476
+ payload?: JsonValue;
477
+ };
478
+ /** Capture a named frame once the world reaches this tick. */
479
+ screenshot?: string;
480
+ /** Camera for this and subsequent frames (default: the scene's camera block). */
481
+ camera?: CameraSpec;
482
+ }
483
+ interface DriveInput {
484
+ scenePath?: string;
485
+ scene?: SceneManifest | Record<string, unknown>;
486
+ projectPath?: string;
487
+ setupModule?: string;
488
+ setup?: WorldSetup;
489
+ /** Render packed asset variants (e.g. "ktx2" from `molen asset pack`) where present. */
490
+ assetVariant?: string;
491
+ actions: DriveAction[];
492
+ /** Step to this tick after the last action (default: the last action's tick). */
493
+ until?: number;
494
+ assertPath?: string;
495
+ assertDoc?: AssertionDoc;
496
+ size?: [number, number];
497
+ clearColor?: string;
498
+ /** Directory frames are written to (<name>.png). */
499
+ outDir: string;
500
+ }
501
+ interface DriveFrame {
502
+ tick: number;
503
+ name: string;
504
+ path: string;
505
+ renderStats?: RenderStats;
506
+ }
507
+ interface DriveOutput {
508
+ ok: boolean;
509
+ tick?: number;
510
+ stateHash?: string;
511
+ frames?: DriveFrame[];
512
+ events?: {
513
+ tick: number;
514
+ type: string;
515
+ payload: JsonValue;
516
+ }[];
517
+ assertionResults?: AssertionResult[];
518
+ assertionsFormatted?: string;
519
+ error?: string;
520
+ }
521
+ /** Drive a scene: commands in, frames out, deterministically. */
522
+ declare function driveScene(input: DriveInput): Promise<DriveOutput>;
523
+ //#endregion
524
+ //#region src/ops/experience-play.d.ts
525
+ interface ExperiencePlayActionBase {
526
+ note?: string;
527
+ }
528
+ type ExperiencePlayAction = ExperiencePlayActionBase & ({
529
+ type: "wait";
530
+ durationMs: number;
531
+ } | {
532
+ type: "wait-for";
533
+ selector: string;
534
+ text?: string;
535
+ timeoutMs?: number;
536
+ } | {
537
+ type: "wait-for-stable";
538
+ selector: string;
539
+ text?: string;
540
+ stableMs?: number;
541
+ timeoutMs?: number;
542
+ } | {
543
+ type: "keys";
544
+ keys: string[];
545
+ durationMs: number;
546
+ } | {
547
+ type: "key-down";
548
+ keys: string[];
549
+ } | {
550
+ type: "key-up";
551
+ keys: string[];
552
+ } | {
553
+ type: "drag";
554
+ selector: string;
555
+ from: [number, number];
556
+ to: [number, number];
557
+ durationMs?: number;
558
+ steps?: number;
559
+ } | {
560
+ type: "click";
561
+ selector: string;
562
+ } | {
563
+ type: "select";
564
+ selector: string;
565
+ value: string;
566
+ } | {
567
+ type: "navigate";
568
+ path: string;
569
+ } | {
570
+ type: "screenshot";
571
+ name: string;
572
+ settleMs?: number;
573
+ fullPage?: boolean;
574
+ timeoutMs?: number;
575
+ });
576
+ interface ExperiencePlayScenario {
577
+ format: "molen/experience-play@1";
578
+ name: string;
579
+ path?: string;
580
+ viewport?: [number, number];
581
+ probes?: {
582
+ name: string;
583
+ selector: string;
584
+ }[];
585
+ actions: ExperiencePlayAction[];
586
+ }
587
+ /** Register the play-scenario schema into the shared registry (idempotent). */
588
+ declare function registerExperiencePlaySchema(): void;
589
+ interface ExperiencePlayInput {
590
+ /** Built browser-app directory containing index.html and its static assets. */
591
+ appDir: string;
592
+ scenario: ExperiencePlayScenario | Record<string, unknown>;
593
+ outDir: string;
594
+ headed?: boolean;
595
+ }
596
+ interface ExperiencePlayDiagnostic {
597
+ kind: "console" | "page-error" | "request-failed";
598
+ level?: string;
599
+ text: string;
600
+ url?: string;
601
+ actionIndex: number;
602
+ }
603
+ interface ExperiencePlayFrame {
604
+ name: string;
605
+ path: string;
606
+ actionIndex: number;
607
+ probes: Record<string, string>;
608
+ }
609
+ interface ExperiencePlayOutput {
610
+ ok: boolean;
611
+ scenario?: string;
612
+ manifestPath?: string;
613
+ frames?: ExperiencePlayFrame[];
614
+ diagnostics?: ExperiencePlayDiagnostic[];
615
+ error?: string;
616
+ }
617
+ declare function parseExperiencePlayScenario(value: ExperiencePlayScenario | Record<string, unknown>): ExperiencePlayScenario;
618
+ /** Play a built browser experience: browser inputs in, screenshots and diagnostics out. */
619
+ declare function playExperience(input: ExperiencePlayInput): Promise<ExperiencePlayOutput>;
620
+ //#endregion
621
+ //#region src/ops/export-frames.d.ts
622
+ interface ExportFramesInput {
623
+ scene?: SceneManifest | Record<string, unknown>;
624
+ /** Scene file path, or a scene NAME from the surrounding project.json. */
625
+ scenePath?: string;
626
+ /** Explicit project.json (default: discovered by walking up from the scene). */
627
+ projectPath?: string;
628
+ setup?: WorldSetup;
629
+ setupModule?: string;
630
+ /** Render packed asset variants (e.g. "ktx2" from `molen asset pack`) where present. */
631
+ assetVariant?: string;
632
+ /** Inclusive tick range and stride. */
633
+ from: number;
634
+ to: number;
635
+ step?: number;
636
+ /** A camera track (inline or path) followed over the range; else a fixed camera. */
637
+ track?: CameraTrackDoc;
638
+ trackPath?: string;
639
+ camera?: CameraSpec;
640
+ size?: [number, number];
641
+ clearColor?: string;
642
+ /** Directory frames are written to (frame_0000.png, …). */
643
+ outDir: string;
644
+ }
645
+ interface ExportFramesOutput {
646
+ ok: boolean;
647
+ dir?: string;
648
+ frameCount?: number;
649
+ frames?: string[];
650
+ error?: string;
651
+ }
652
+ /**
653
+ * Render a sequence of frames over a tick range, optionally following a camera track (machinima).
654
+ * Builds the world once and steps incrementally so every frame is from the same timeline.
655
+ */
656
+ declare function exportFrames(input: ExportFramesInput): Promise<ExportFramesOutput>;
657
+ //#endregion
658
+ //#region src/ops/generate-types.d.ts
659
+ interface GenerateTypesInput {
660
+ projectPath?: string;
661
+ cwd?: string;
662
+ /** Override the output path (default: project.codegen.out). */
663
+ out?: string;
664
+ /** Compare only — exit stale without writing (CI / types check). */
665
+ check?: boolean;
666
+ }
667
+ /** One generated artifact beside a scripts directory (the ambient types, or its jsconfig). */
668
+ interface GeneratedScriptArtifact {
669
+ path: string;
670
+ written: boolean;
671
+ stale: boolean;
672
+ }
673
+ interface GenerateTypesOutput {
674
+ ok: boolean;
675
+ outPath?: string;
676
+ /** Ambient script types written (or checked) beside each scripts directory. */
677
+ scriptArtifacts?: GeneratedScriptArtifact[];
678
+ /** True when --check found the committed file out of date (or missing). */
679
+ stale?: boolean;
680
+ written?: boolean;
681
+ componentCount?: number;
682
+ typeCount?: number;
683
+ error?: string;
684
+ }
685
+ /** Render the generated module (deterministic given the registry + project types). */
686
+ declare function renderTypesModule(project: ProjectContext): string;
687
+ /** Generate (or verify with `check`) the project's typed component/type-id module. */
688
+ declare function generateTypes(input: GenerateTypesInput): Promise<GenerateTypesOutput>;
689
+ //#endregion
690
+ //#region src/ops/pack.d.ts
691
+ interface BuildPackInput {
692
+ /** Pack source directory (holds molen-pack.source.json). */
693
+ sourceDir: string;
694
+ outDir: string;
695
+ /** Group small text files into solid blocks (default: the source config's setting). */
696
+ solid?: boolean;
697
+ }
698
+ interface BuildPackOutput {
699
+ ok: boolean;
700
+ id?: string;
701
+ version?: string;
702
+ file?: string;
703
+ path?: string;
704
+ size?: number;
705
+ contentHash?: string;
706
+ files?: number;
707
+ indexPath?: string;
708
+ error?: string;
709
+ }
710
+ declare function buildContentPack(input: BuildPackInput): Promise<BuildPackOutput>;
711
+ interface InspectPackInput {
712
+ /** Built pack file, pack source directory, or http(s) URL. */
713
+ source: string;
714
+ }
715
+ interface InspectPackOutput {
716
+ ok: boolean;
717
+ id?: string;
718
+ version?: string;
719
+ title?: string;
720
+ license?: string;
721
+ contentHash?: string;
722
+ /** Size of the pack file (absent for a URL or source directory). */
723
+ fileSize?: number;
724
+ /** Total uncompressed size of every file. */
725
+ contentSize?: number;
726
+ files?: number;
727
+ blocks?: {
728
+ name: string;
729
+ size: number;
730
+ files: number;
731
+ }[];
732
+ ids?: Record<string, string>;
733
+ provides?: Record<string, string[]>;
734
+ largest?: {
735
+ path: string;
736
+ size: number;
737
+ mediaType: string;
738
+ }[];
739
+ error?: string;
740
+ }
741
+ declare function inspectContentPack(input: InspectPackInput): Promise<InspectPackOutput>;
742
+ interface VerifyPackIssue {
743
+ path: string;
744
+ message: string;
745
+ }
746
+ interface VerifyPackOutput {
747
+ ok: boolean;
748
+ id?: string;
749
+ /** Files read and checked. */
750
+ checked?: number;
751
+ /** JSON documents validated against their registered schema. */
752
+ validated?: number;
753
+ issues?: VerifyPackIssue[];
754
+ error?: string;
755
+ }
756
+ /**
757
+ * Read every file (checking CRC and sha256), validate each JSON document whose `format` is a
758
+ * registered schema, and check that asset sidecars' hashes match their models.
759
+ */
760
+ declare function verifyContentPack(input: InspectPackInput): Promise<VerifyPackOutput>;
761
+ interface ExtractPackInput {
762
+ /** Built pack file or http(s) URL. */
763
+ source: string;
764
+ outDir: string;
765
+ }
766
+ interface ExtractPackOutput {
767
+ ok: boolean;
768
+ id?: string;
769
+ outDir?: string;
770
+ files?: number;
771
+ error?: string;
772
+ }
773
+ declare function extractContentPack(input: ExtractPackInput): Promise<ExtractPackOutput>;
774
+ interface FetchPackInput {
775
+ /** URL of a pack file, or of a molen/pack-index@1 listing packs. */
776
+ url: string;
777
+ /** With an index URL, fetch only these pack ids (default: all). */
778
+ ids?: string[];
779
+ /** Download directory (default: packs/ beside project.json, else ./packs). */
780
+ outDir?: string;
781
+ projectPath?: string;
782
+ cwd?: string;
783
+ }
784
+ interface FetchedPack {
785
+ id: string;
786
+ version: string;
787
+ file: string;
788
+ contentHash: string;
789
+ size: number;
790
+ }
791
+ interface FetchPackOutput {
792
+ ok: boolean;
793
+ packs?: FetchedPack[];
794
+ outDir?: string;
795
+ /** The project.json whose `packs` list was updated, when there is one. */
796
+ projectPath?: string;
797
+ error?: string;
798
+ }
799
+ /**
800
+ * Download packs into a project so it runs offline, and pin them in project.json `packs` with
801
+ * their contentHash. Nothing is fetched implicitly anywhere else: this is the explicit step.
802
+ */
803
+ declare function fetchContentPack(input: FetchPackInput): Promise<FetchPackOutput>;
804
+ //#endregion
805
+ //#region src/ops/project-ops.d.ts
806
+ interface ProjectInfoInput {
807
+ projectPath?: string;
808
+ cwd?: string;
809
+ }
810
+ interface ProjectInfoOutput {
811
+ ok: boolean;
812
+ path?: string;
813
+ name?: string;
814
+ scenes?: Record<string, string>;
815
+ defaultScene?: string;
816
+ typeIds?: string[];
817
+ assets?: Record<string, string>;
818
+ reservations?: NamespaceReservation[];
819
+ setup?: string;
820
+ issues?: ValidationIssue[];
821
+ error?: string;
822
+ }
823
+ declare function projectInfo(input: ProjectInfoInput): Promise<ProjectInfoOutput>;
824
+ interface ListTypesOutput {
825
+ ok: boolean;
826
+ types?: {
827
+ id: string;
828
+ doc?: string;
829
+ extends?: string;
830
+ source: string;
831
+ }[];
832
+ error?: string;
833
+ }
834
+ declare function listTypes(input: ProjectInfoInput): Promise<ListTypesOutput>;
835
+ interface CheckTypesOutput {
836
+ ok: boolean;
837
+ issues?: ValidationIssue[];
838
+ codegenStale?: boolean;
839
+ error?: string;
840
+ }
841
+ declare function checkTypesOp(input: ProjectInfoInput): Promise<CheckTypesOutput>;
842
+ interface ReserveNamespaceInput {
843
+ namespace: string;
844
+ owner: string;
845
+ note?: string;
846
+ projectPath?: string;
847
+ cwd?: string;
848
+ }
849
+ interface ReserveNamespaceOutput {
850
+ ok: boolean;
851
+ /** True when the same owner already held the namespace (no-op). */
852
+ alreadyReserved?: boolean;
853
+ /** Set on conflict: who holds the overlapping namespace. */
854
+ conflict?: NamespaceReservation;
855
+ reservations?: NamespaceReservation[];
856
+ error?: string;
857
+ }
858
+ declare function reserveNamespace(input: ReserveNamespaceInput): Promise<ReserveNamespaceOutput>;
859
+ //#endregion
860
+ //#region src/ops/rasterize.d.ts
861
+ interface RasterizeInput {
862
+ /** Path to a material doc (*.matgraph.json, *.pixelgrid.json, or *.svg) or inline doc. */
863
+ path?: string;
864
+ inline?: unknown;
865
+ /** Or a "palette:#rrggbb" / "#rrggbb" inline material ref. */
866
+ ref?: string;
867
+ /** Output PNG path for the baseColor slot. */
868
+ outPath: string;
869
+ /** Optional override size for palette refs / SVG raster width. */
870
+ size?: number;
871
+ }
872
+ interface RasterizeOutput {
873
+ ok: boolean;
874
+ imagePath?: string;
875
+ width?: number;
876
+ height?: number;
877
+ slots?: string[];
878
+ error?: string;
879
+ }
880
+ /** Bake a material (graph or palette) to a PNG. The MCP `rasterize_material` tool. */
881
+ declare function rasterizeMaterial(input: RasterizeInput): Promise<RasterizeOutput>;
882
+ //#endregion
883
+ //#region src/ops/replay.d.ts
884
+ interface RunReplayInput {
885
+ /** Path to a *.replay.json fixture. */
886
+ path: string;
887
+ /** Module providing systems + command handlers (default/named `setup`). */
888
+ setupModule?: string;
889
+ /** Explicit project.json for the fixture's scene (default: discovered from the scene path). */
890
+ projectPath?: string;
891
+ /**
892
+ * Regenerate `expected.stateHash` + `expected.tickHashes` from the current build and write
893
+ * them back to the fixture (run after an intentional engine/content change).
894
+ */
895
+ record?: boolean;
896
+ }
897
+ interface RunReplayOutput {
898
+ ok: boolean;
899
+ expectedHash?: string;
900
+ actualHash?: string;
901
+ expectedEventCount?: number;
902
+ actualEventCount?: number;
903
+ ticks?: number;
904
+ /** True when the build reproduces itself run-to-run (only checked on a hash mismatch). */
905
+ deterministic?: boolean;
906
+ /** Classifies a mismatch so the fix is obvious. */
907
+ divergence?: "non-deterministic" | "behavior-drift";
908
+ /** First tick at which state diverged (from the self-determinism check or tickHashes). */
909
+ firstDivergentTick?: number;
910
+ /** Component-level diff at the divergent tick (available for non-deterministic builds). */
911
+ diff?: ComponentDiff[];
912
+ /** Agent-facing summary of what happened and what to do. */
913
+ report?: string;
914
+ /** Set when something failed before running (bad fixture/scene). */
915
+ error?: string;
916
+ }
917
+ /**
918
+ * Replay a recorded fixture and compare the final state hash. On a mismatch, localize the
919
+ * divergence instead of just reporting "hash differs":
920
+ * 1. re-run the build against itself — if it diverges from itself, the build is
921
+ * NON-DETERMINISTIC; report the first divergent tick + a component-level diff.
922
+ * 2. otherwise the build is deterministic but its result drifted from the recording (an
923
+ * intentional engine/content change, or a regression). If the fixture stored per-tick
924
+ * hashes, report the first tick that differs from the recording.
925
+ */
926
+ declare function runReplayFile(input: RunReplayInput): Promise<RunReplayOutput>;
927
+ interface DiffSnapshotsInput {
928
+ /** Two keyframe JSON file paths (before, after). */
929
+ a: string;
930
+ b: string;
931
+ }
932
+ interface DiffSnapshotsOutput {
933
+ ok: boolean;
934
+ diffs?: ComponentDiff[];
935
+ error?: string;
936
+ }
937
+ /** Diff two keyframe snapshots at the component level. */
938
+ declare function diffSnapshots(input: DiffSnapshotsInput): Promise<DiffSnapshotsOutput>;
939
+ //#endregion
940
+ //#region src/ops/scaffold.d.ts
941
+ interface ScaffoldInput {
942
+ /** Experience name; also the output folder name and the type namespace. */
943
+ name: string;
944
+ /** Parent directory (default: cwd). */
945
+ dir?: string;
946
+ /** Replace scaffold-owned files that already exist. Default false. */
947
+ force?: boolean;
948
+ }
949
+ interface ScaffoldOutput {
950
+ ok: boolean;
951
+ dir?: string;
952
+ files?: string[];
953
+ nextSteps?: string[];
954
+ error?: string;
955
+ }
956
+ /** Scaffold a complete, runnable project (manifest + scene + types + scripts + setup + browser app). */
957
+ declare function scaffoldExperience(input: ScaffoldInput): Promise<ScaffoldOutput>;
958
+ //#endregion
959
+ //#region src/ops/schema.d.ts
960
+ interface GetSchemaOutput {
961
+ ok: boolean;
962
+ id?: string;
963
+ docsRef?: string;
964
+ examples?: unknown[];
965
+ jsonSchema?: unknown;
966
+ error?: string;
967
+ }
968
+ /** List every registered asset schema kind. */
969
+ declare function listSchemasOp(): SchemaSummary[];
970
+ /** Get one schema kind: JSON Schema + examples + docs reference. */
971
+ declare function getSchemaOp(kind: string): GetSchemaOutput;
972
+ /** List the known component vocabulary (name + description + owning layer). */
973
+ declare function listComponentsOp(registry?: ComponentRegistry): ComponentSummary[];
974
+ interface GetComponentOutput {
975
+ ok: boolean;
976
+ name?: string;
977
+ description?: string;
978
+ owner?: string;
979
+ docsRef?: string;
980
+ examples?: unknown[];
981
+ jsonSchema?: unknown;
982
+ error?: string;
983
+ }
984
+ /** Get one component's schema + examples. */
985
+ declare function getComponentOp(name: string, registry?: ComponentRegistry): GetComponentOutput;
986
+ //#endregion
987
+ //#region src/ops/simulate.d.ts
988
+ interface SimulateInput {
989
+ /** Scene file path, or a scene NAME from the surrounding project.json. */
990
+ scenePath?: string;
991
+ scene?: SceneManifest;
992
+ ticks: number;
993
+ commandsPath?: string;
994
+ commands?: Command[];
995
+ assertPath?: string;
996
+ assertDoc?: AssertionDoc;
997
+ /** Explicit project.json (default: discovered by walking up from the scene). */
998
+ projectPath?: string;
999
+ /** Path to a module exporting setup(world, manifest) or a defineExperience(...) result. */
1000
+ setupModule?: string;
1001
+ /** Programmatic setup (systems + command handlers); takes precedence over setupModule. */
1002
+ setup?: WorldSetup;
1003
+ }
1004
+ interface SimulateOutput {
1005
+ ok: boolean;
1006
+ tick: number;
1007
+ stateHash: string;
1008
+ eventCount: number;
1009
+ events: RecordedEvent[];
1010
+ assertionResults: AssertionResult[];
1011
+ assertionsFormatted?: string;
1012
+ /** The scene's physics engine, when declared (kinematics = cross-platform deterministic). */
1013
+ physics?: NonNullable<SceneManifest["physics"]>["engine"];
1014
+ /** Non-fatal advisories (e.g. deprecated scene format). */
1015
+ notices?: ValidationIssue[];
1016
+ /** The pack content the world was built from (project.json `packs`, MOLEN_PACKS). */
1017
+ content?: ContentIdentity;
1018
+ /** Set when something failed before running (bad scene, etc.). */
1019
+ error?: string;
1020
+ }
1021
+ /** Run a scene headlessly for N ticks, applying commands and evaluating assertions. */
1022
+ declare function runSimulation(input: SimulateInput): Promise<SimulateOutput>;
1023
+ //#endregion
1024
+ //#region src/ops/types-test.d.ts
1025
+ interface TestTypesInput {
1026
+ projectPath?: string;
1027
+ cwd?: string;
1028
+ /** Ticks to simulate each type for (default 30). */
1029
+ ticks?: number;
1030
+ /** Only test these type ids (default: all). */
1031
+ only?: string[];
1032
+ }
1033
+ interface TypeTestResult {
1034
+ id: string;
1035
+ ok: boolean;
1036
+ issues?: ValidationIssue[];
1037
+ error?: string;
1038
+ }
1039
+ interface TestTypesOutput {
1040
+ ok: boolean;
1041
+ results?: TypeTestResult[];
1042
+ error?: string;
1043
+ }
1044
+ /** Spawn + simulate every registry type in isolation; report per-type verdicts. */
1045
+ declare function testTypes(input: TestTypesInput): Promise<TestTypesOutput>;
1046
+ //#endregion
1047
+ //#region src/ops/uvpaint.d.ts
1048
+ interface ApplyUvPaintInput {
1049
+ /** Painted texture (from an image model). */
1050
+ paintedPath: string;
1051
+ /** Island map (flat-filled islands on a transparent/black background). */
1052
+ islandMapPath: string;
1053
+ outPath: string;
1054
+ maskToIslands?: boolean;
1055
+ dilationPx?: number;
1056
+ }
1057
+ interface ApplyUvPaintOutput {
1058
+ ok: boolean;
1059
+ imagePath?: string;
1060
+ width?: number;
1061
+ height?: number;
1062
+ error?: string;
1063
+ }
1064
+ /**
1065
+ * Import a painted UV template: mask it to the island map and dilate the gutters
1066
+ * (docs-src/guide/materials.md, "Rung 5 — UV paint-by-numbers"). The MCP `apply_uv_paint` tool.
1067
+ * (Template/sidecar generation from a mesh via xatlas is a separate, heavier Node toolchain
1068
+ * step.)
1069
+ */
1070
+ declare function applyUvPaintOp(input: ApplyUvPaintInput): Promise<ApplyUvPaintOutput>;
1071
+ //#endregion
1072
+ //#region src/ops/validate.d.ts
1073
+ interface ValidateInput {
1074
+ /** Path to a JSON document, or inline data. One of the two is required. */
1075
+ path?: string;
1076
+ inline?: unknown;
1077
+ /** Force a schema kind (any registered kind); otherwise detected from the envelope. */
1078
+ kind?: string;
1079
+ /** For terrain-package files, stream-check declared paths, sizes, and SHA-256 hashes. */
1080
+ verifyFiles?: boolean;
1081
+ /**
1082
+ * Explicit project.json giving a scene its registry types (default: discovered by walking up
1083
+ * from `path`). With a project, entity/prefab `type` references are checked too.
1084
+ */
1085
+ projectPath?: string;
1086
+ }
1087
+ interface ValidateOutput {
1088
+ ok: boolean;
1089
+ kind?: string;
1090
+ /** Present when ok: the parsed (defaults-applied) value. */
1091
+ value?: unknown;
1092
+ /** Present when not ok: the agent-facing formatted error block. */
1093
+ formatted?: string;
1094
+ issues?: unknown[];
1095
+ verifiedFiles?: number;
1096
+ }
1097
+ /** Validate an asset document against its schema (kind auto-detected when omitted). */
1098
+ declare function validateAsset(input: ValidateInput): Promise<ValidateOutput>;
1099
+ //#endregion
1100
+ //#region src/ops/watch.d.ts
1101
+ interface SimWatchInput extends SimulateInput {
1102
+ /** Extra files/directories to watch (transitive project/scene inputs are automatic). */
1103
+ watchPaths?: string[];
1104
+ /** Called after every completed run with the result + a diff line against the previous run. */
1105
+ onRun(result: SimulateOutput, diff: string): void;
1106
+ }
1107
+ interface SimWatchHandle {
1108
+ close(): void;
1109
+ }
1110
+ /** Run once, then rerun (debounced) on every change to any transitive input. */
1111
+ declare function simWatch(input: SimWatchInput): Promise<SimWatchHandle>;
1112
+ //#endregion
1113
+ //#region src/ops/worldgen-bake.d.ts
1114
+ interface WorldgenBakeInput {
1115
+ /** A `molen/worldgen-batch@1` document; or give `outline` (+ `styleId`) for one building. */
1116
+ batchPath?: string;
1117
+ /** "x,z;x,z;..." in meters, one building. */
1118
+ outline?: string;
1119
+ /** Force every building onto this style id (required with `outline`). */
1120
+ styleId?: string;
1121
+ /** Style pack manifest or directory (default: the shipped default pack). */
1122
+ packPath?: string;
1123
+ /** Assets root the baked asset directory is created under. */
1124
+ outDir: string;
1125
+ /** Asset id (default: the batch name, slugged). */
1126
+ id?: string;
1127
+ ground?: "flat" | "slope";
1128
+ /** Replace an existing asset directory. */
1129
+ force?: boolean;
1130
+ projectPath?: string;
1131
+ }
1132
+ interface WorldgenBakeOutput {
1133
+ ok: boolean;
1134
+ id?: string;
1135
+ dir?: string;
1136
+ sidecarPath?: string;
1137
+ sidecar?: AssetSidecar;
1138
+ stats?: WorldgenStats;
1139
+ /** Instanced placements the mesh does not contain (roof props, scatter). */
1140
+ placements?: {
1141
+ modelRef: string;
1142
+ count: number;
1143
+ }[];
1144
+ hash?: string;
1145
+ glbBytes?: number;
1146
+ warnings?: string[];
1147
+ error?: string;
1148
+ }
1149
+ declare function bakeWorldgen(input: WorldgenBakeInput): Promise<WorldgenBakeOutput>;
1150
+ //#endregion
1151
+ //#region src/ops/worldgen-pack.d.ts
1152
+ interface LoadedStylePackFiles {
1153
+ pack: ResolvedStylePack;
1154
+ /** Directory every pack path resolves against. */
1155
+ dir: string;
1156
+ path: string;
1157
+ /** Landmark models (signs, street furniture) from the pack that provides them, if any. */
1158
+ landmarks?: LandmarkDocs;
1159
+ }
1160
+ type PackOptions = {
1161
+ projectPath?: string;
1162
+ cwd?: string;
1163
+ };
1164
+ /**
1165
+ * Load a style pack from `packPath` (a stylepack.json, a directory holding one, a content pack
1166
+ * file, URL or source directory) or, without one, from the content packs the project uses.
1167
+ */
1168
+ declare function loadStylePackFromDisk(packPath?: string, options?: PackOptions): Promise<LoadedStylePackFiles>;
1169
+ /** One of each footprint class in a row along +x (40 m apart), generic labels, flat ground. */
1170
+ declare function lineupBatchDoc(spacing?: number): WorldgenBatchDoc;
1171
+ //#endregion
1172
+ //#region src/ops/worldgen-preview.d.ts
1173
+ interface WorldgenPreviewInput {
1174
+ /** A standalone `molen/archstyle@1` document to preview (injected into the pack). */
1175
+ stylePath?: string;
1176
+ /** Style pack manifest or directory (default: the shipped default pack). */
1177
+ packPath?: string;
1178
+ /** Force every building onto this style id (default: the pack's own rules). */
1179
+ styleId?: string;
1180
+ /** A `molen/worldgen-batch@1` document (default: the built-in lineup of every shape class). */
1181
+ batchPath?: string;
1182
+ scatterId?: string;
1183
+ ground?: "flat" | "slope";
1184
+ /** Turntable angles (default 1). */
1185
+ angles?: number;
1186
+ size?: [number, number];
1187
+ /** PNG path; with several angles the index is appended before the extension. */
1188
+ outPath: string;
1189
+ clearColor?: string;
1190
+ }
1191
+ interface WorldgenPreviewFrame {
1192
+ path: string;
1193
+ yawDeg: number;
1194
+ }
1195
+ interface WorldgenPreviewRenderStats {
1196
+ drawCalls: number;
1197
+ triangles: number;
1198
+ instances: number;
1199
+ }
1200
+ interface WorldgenPreviewOutput {
1201
+ ok: boolean;
1202
+ frames?: WorldgenPreviewFrame[];
1203
+ stats?: WorldgenStats;
1204
+ renderStats?: WorldgenPreviewRenderStats;
1205
+ hash?: string;
1206
+ /** Material references the page could not bake (rendered flat). */
1207
+ materialFailures?: string[];
1208
+ error?: string;
1209
+ }
1210
+ declare function previewWorldgen(input: WorldgenPreviewInput): Promise<WorldgenPreviewOutput>;
1211
+ //#endregion
1212
+ //#region src/ops/worldgen-stats.d.ts
1213
+ interface WorldgenStatsInput {
1214
+ /** terrain-package.json path. */
1215
+ packagePath: string;
1216
+ /** "z/x/y" tile address; omit to use the tile at the package center (`auto` searches around it). */
1217
+ tile?: string;
1218
+ /** Search the 9x9 tiles around the center for the one with the most buildings. */
1219
+ auto?: boolean;
1220
+ packPath?: string;
1221
+ atlasPath?: string;
1222
+ /** Force every building onto this style id. */
1223
+ styleId?: string;
1224
+ quality?: WorldgenQualityPreset;
1225
+ /** Write the adapted batch document here. */
1226
+ dumpPath?: string;
1227
+ }
1228
+ interface WorldgenStatsOutput {
1229
+ ok: boolean;
1230
+ tile?: {
1231
+ level: number;
1232
+ x: number;
1233
+ y: number;
1234
+ };
1235
+ region?: string;
1236
+ scatter?: string;
1237
+ source?: {
1238
+ buildings: number;
1239
+ landcover: number;
1240
+ roads: number;
1241
+ water: number;
1242
+ };
1243
+ stats?: WorldgenStats;
1244
+ skippedByOwnership?: number;
1245
+ clippedPieces?: number;
1246
+ /** Buildings whose identity came from a quantized centroid (no feature id in the source). */
1247
+ buildingsWithoutIds?: number;
1248
+ placements?: {
1249
+ modelRef: string;
1250
+ count: number;
1251
+ }[];
1252
+ generateMs?: {
1253
+ first: number;
1254
+ second: number;
1255
+ };
1256
+ hash?: string;
1257
+ deterministic?: boolean;
1258
+ dumpPath?: string;
1259
+ warnings?: string[];
1260
+ error?: string;
1261
+ }
1262
+ declare function worldgenStats(input: WorldgenStatsInput): Promise<WorldgenStatsOutput>;
1263
+ //#endregion
1264
+ //#region src/schema-to-ts.d.ts
1265
+ /** Print a JSON Schema node as a TS type expression. Unknown constructs degrade to `unknown`. */
1266
+ declare function schemaToTsType(schema: unknown, indent?: string): string;
1267
+ //#endregion
1268
+ //#region src/index.d.ts
1269
+ declare const TOOLING_PACKAGE = "@bendyline/molen-tooling";
1270
+ //#endregion
1271
+ export { ASSET_INDEX_FILE, type ApplyUvPaintInput, type ApplyUvPaintOutput, type AssetShotInput, type AssetShotOutput, type CameraSpec, type CheckTypesOutput, type DiffSnapshotsInput, type DiffSnapshotsOutput, type DocHit, type DriveAction, type DriveFrame, type DriveInput, type DriveOutput, type ExperiencePlayAction, type ExperiencePlayDiagnostic, type ExperiencePlayFrame, type ExperiencePlayInput, type ExperiencePlayOutput, type ExperiencePlayScenario, type ExportFramesInput, type ExportFramesOutput, type GenerateTypesInput, type GenerateTypesOutput, type GetComponentOutput, type GetSchemaOutput, type GoldenOptions, type GoldenResult, type ImageDiff, type ImportAssetInput, type ImportAssetOutput, type InspectAssetInput, type InspectAssetOutput, type ListAssetsOutput, type ListTypesOutput, type LoadSceneOptions, type LoadedScene, OPS_CATALOG, type OpDescriptor, type OpParam, type PackAssetInput, type PackAssetOutput, type PackTextureMode, type PackedAsset, type PackedTexture, type ProjectContext, type ProjectInfoInput, type ProjectInfoOutput, type RasterizeInput, type RasterizeOutput, type RenderStats, type ReserveNamespaceInput, type ReserveNamespaceOutput, type RunReplayInput, type RunReplayOutput, type ScaffoldInput, type ScaffoldOutput, type ScreenshotInput, type ScreenshotOutput, type ScriptDiagnostic, type SearchDocsInput, type SearchDocsOutput, type SimWatchHandle, type SimWatchInput, type SimulateInput, type SimulateOutput, type StageAssetsInput, type StageAssetsOutput, type StagedAsset, TOOLING_PACKAGE, type TestTypesInput, type TestTypesOutput, type TypeTestResult, type ValidateInput, type ValidateOutput, type WorldgenBakeInput, type WorldgenBakeOutput, type WorldgenPreviewInput, type WorldgenPreviewOutput, type WorldgenStatsInput, type WorldgenStatsOutput, applyUvPaintOp, assetFileIndex, bakeWorldgen, buildContentPack, checkScripts, checkTypesOp, compareGolden, describeOps, diffImages, diffSnapshots, driveScene, exportFrames, extractContentPack, fetchContentPack, findProjectFile, formatOp, generateTypes, getComponentOp, getSchemaOp, importAsset, inspectAsset, inspectContentPack, lineupBatchDoc, listAssets, listComponentsOp, listSchemasOp, listTypes, loadProject, loadSceneDocument, loadSetupLike, loadStylePackFromDisk, locateDocsRoot, packAsset, parseExperiencePlayScenario, playExperience, previewWorldgen, projectInfo, rasterizeMaterial, registerExperiencePlaySchema, renderTypesModule, reserveNamespace, runReplayFile, runSimulation, scaffoldExperience, schemaToTsType, screenshotAsset, screenshotScene, searchDocs, simWatch, stageAssets, testTypes, updateProjectFile, validateAsset, verifyContentPack, worldgenStats };