@onimaxxing/worldgen 0.15.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.
@@ -0,0 +1,852 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Arm the per-pair thermal tracer used to bisect the OASIS W1
6
+ * wasm-vs-native divergence. Targets one sim cell index, one tick.
7
+ */
8
+ export function arm_thermal_pair_trace(target_sim_idx: number, target_tick: number): void;
9
+
10
+ /**
11
+ * Bench harness — time just the Rust `generate_with_settings` call without
12
+ * the JSON-serialization overhead every production entry point pays.
13
+ *
14
+ * Gated behind `debug` so release WASM doesn't ship with it. Returns a
15
+ * small JSON blob containing per-phase wall-clock in ms so the bench
16
+ * script can separate cluster-gen time from
17
+ * `build_result` + `serde_json::to_string` cost.
18
+ */
19
+ export function bench_cluster_phases(seed: number, cluster_id: string): string;
20
+
21
+ /**
22
+ * Bench harness — returns the accumulated phase totals as JSON
23
+ * (`{"phase": {"ms": number, "calls": number}, ...}`) and clears the
24
+ * accumulator. Gated behind `debug`.
25
+ */
26
+ export function bench_profile_dump(): string;
27
+
28
+ /**
29
+ * Bench harness — enable the fine-grained `oni_worldgen::profile`
30
+ * phase accumulator. Pair with `bench_profile_dump()` after running the
31
+ * measured work. Gated behind `debug`.
32
+ */
33
+ export function bench_profile_enable(): void;
34
+
35
+ /**
36
+ * Drop the cached cluster. Snapshot edits persist.
37
+ */
38
+ export function clear_cluster_cache(): void;
39
+
40
+ /**
41
+ * Compute a `ClusterDigest` from a coordinate, returning JSON.
42
+ *
43
+ * This is the canonical Rust path for digest regeneration — calling
44
+ * this function from JS via wasm-pack ensures the digest comes from
45
+ * the SAME math the production WASM build uses, not from a separate
46
+ * native binary that might have different precision.
47
+ *
48
+ * `mode` must be either "templates" or "notemplates".
49
+ *
50
+ * On parse error returns a JSON object with an `error` field.
51
+ * Variant of [`compute_digest_from_coordinate`] that takes the
52
+ * cluster id directly instead of going through `parse_coordinate`.
53
+ * Required when the coordinate's prefix maps to multiple clusters —
54
+ * e.g. when a mod registers several clusters with the same
55
+ * `coordinatePrefix` (Cluster Generation Manager has three clusters
56
+ * at `CGSM-C`). The C# side disambiguates via `SNAPSHOT_CLUSTER`
57
+ * for the same reason; this is the symmetric Rust knob.
58
+ *
59
+ * `coordinate` is still used for output schema fields (`coordinate`,
60
+ * story/mixing extraction via the matching CS-side parser), but the
61
+ * cluster lookup is performed against `cluster_id` directly. For
62
+ * vanilla unambiguous prefixes the two functions produce identical
63
+ * digests when `cluster_id` matches the prefix's mapped cluster.
64
+ */
65
+ export function compute_digest_for_cluster(coordinate: string, cluster_id: string, seed: number, mode: string): string;
66
+
67
+ export function compute_digest_from_coordinate(coordinate: string, mode: string): string;
68
+
69
+ /**
70
+ * Apply a structured mutations payload to the generated cluster
71
+ * before computing the digest. Used by mod extensions to fold
72
+ * post-snapshot overrides (CGM geyser swap, SO_POI pins, vanilla-
73
+ * starmap replacement) into the digest without modifying the
74
+ * worldgen pipeline.
75
+ *
76
+ * The `overrides_json` schema is generic — not CGM-named — so any
77
+ * mod can use it:
78
+ * ```json
79
+ * {
80
+ * "entityReplacements": [
81
+ * { "worldIdx": 0, "cell": 100, "newTag": "GeyserGeneric_hot_water",
82
+ * "newResolvedTemplate": "hot_water" }
83
+ * ],
84
+ * "worldLocationOverrides": [
85
+ * { "worldIdx": 2, "q": 3, "r": -2 }
86
+ * ],
87
+ * "poiUpserts": [
88
+ * { "poiType": "HarvestableSpacePOI_X", "q": 5, "r": 5 }
89
+ * ],
90
+ * "vanillaDestinationsReplace": [
91
+ * { "destType": "CarbonaceousAsteroid", "distance": 0 }
92
+ * ]
93
+ * }
94
+ * ```
95
+ *
96
+ * Pass `""` or `"{}"` for `overrides_json` to skip mutations entirely
97
+ * (equivalent to [`compute_digest_for_cluster`]).
98
+ */
99
+ export function compute_digest_with_overrides(coordinate: string, cluster_id: string, seed: number, mode: string, overrides_json: string): string;
100
+
101
+ /**
102
+ * Geyser stats compute, exposed for the mod-extensions transformer.
103
+ * After a CGM blacklist re-roll substitutes a generic geyser
104
+ * template, this function re-derives the 5 MNI-projected ints
105
+ * (emit/avg/idle/erupt/dormant/active) the digest hashes.
106
+ *
107
+ * `template` is a bare geyser id (no `GeyserGeneric_` prefix) —
108
+ * e.g. `"hot_water"`, `"small_volcano"`, `"oil_drip"`. Returns
109
+ * `{"error": "..."}` for unknown templates.
110
+ *
111
+ * `seed` is the per-cell `globalWorldSeed + cluster_x + cluster_y` —
112
+ * same as the existing geyser RNG path.
113
+ *
114
+ * Output JSON schema mirrors the `GeyserStats` interface in the
115
+ * `mod-extensions` transformer module:
116
+ * ```json
117
+ * {
118
+ * "rate": 4310,
119
+ * "idle": 112,
120
+ * "erupt": 500,
121
+ * "dorm": 71,
122
+ * "active": 125
123
+ * }
124
+ * ```
125
+ */
126
+ export function compute_geyser_stats(seed: number, template: string): string;
127
+
128
+ /**
129
+ * are sampled. Used for vibe-checking U59 backwall plumbing.
130
+ */
131
+ export function debug_dump_backwall_distribution(coordinate: string, world_idx: number): string;
132
+
133
+ /**
134
+ * Probe the cluster-level (overworld) PointGenerator seed state for a
135
+ * coordinate. Returns the values that drive the very first PD pass in
136
+ * `WorldLayout.GenerateOverworld` so we can diff them against the C#
137
+ * snapshot's equivalent fields to localize early OW-site divergence.
138
+ */
139
+ export function debug_dump_cluster_pd_seed_state(coordinate: string): string;
140
+
141
+ /**
142
+ * Probe per-channel noise hashes for one coordinate. Output:
143
+ * `{"base":"<sha>","override":"...","density":"...","heat":"..."}`.
144
+ * Used to find which noise channel diverges from CS for AQU-A.
145
+ */
146
+ export function debug_dump_noise_channel_hashes(coordinate: string): string;
147
+
148
+ /**
149
+ * Per-TC backwall lookup tag inspector. For each spawn_backwall TC,
150
+ * dumps: node_type, tags, biome_tag found, derived band name, and
151
+ * whether the lookup resolves in base or DLC-scoped form.
152
+ * Bisect tool for "Reef/Abyss backwall stamps never fire" findings.
153
+ */
154
+ export function debug_dump_noise_channels(coordinate: string, world_idx: number): string;
155
+
156
+ /**
157
+ * Dump `placed_templates` (template name + cluster-space anchor cell)
158
+ * per world for one coordinate. Returns
159
+ * `{"worlds":[{"name":..,"placed":[[name,x,y],...]},...]}`.
160
+ */
161
+ export function debug_dump_placed_templates(coordinate: string): string;
162
+
163
+ export function debug_dump_tc_backwall_lookup(coordinate: string, world_idx: number): string;
164
+
165
+ /**
166
+ * Dump the U59 backwall layer for one world of a coordinate.
167
+ *
168
+ * Returns JSON:
169
+ * ```json
170
+ * {
171
+ * "world_name": "...", "width": w, "height": h,
172
+ * "spawn_backwall_tc_count": N,
173
+ * "total_tc_count": M,
174
+ * "backwall_histogram": { "Vacuum": k, "Coquina": k, ... },
175
+ * "samples_by_tc": [
176
+ * {"tc_idx": i, "node_type": "...", "biome_tag": "...",
177
+ * "all_cells_count": n, "spawn_backwall": true|false,
178
+ * "sample_cells": [{"cell": idx, "element": "...", "mass": f, "temp": f}, ...]}
179
+ * ]
180
+ * }
181
+ * ```
182
+ * Sampling: up to `max_tc_samples` TCs whose `spawn_backwall=true` are
183
+ * shown; for each, up to 5 random cells (deterministic seed = tc_idx)
184
+ * Dump raw backwall_noise samples + per-cell backwall element
185
+ * for selected TCs. Filters cells to `available_terrain_points`
186
+ * (the actually-stamped set), so reports the TRUE noise / element
187
+ * distribution rather than the broader polygon containment set
188
+ * that the prior vibe check used.
189
+ */
190
+ export function debug_dump_tc_backwall_noise(coordinate: string, world_idx: number, target_biome: string): string;
191
+
192
+ /**
193
+ * Dump TC properties for parity diff. Returns per-TC type, position,
194
+ * poly vertices (hex bits), all_cells count, available_terrain count.
195
+ */
196
+ export function debug_dump_tc_details(coordinate: string, world_idx: number): string;
197
+
198
+ /**
199
+ * Dump per-TC RNG states for one coordinate. Each entry mirrors CS
200
+ * rng_trace format: (pre_inext, pre_inextp, pre_seed, post_inext,
201
+ * post_inextp, post_seed) per terrain cell. Used to localize the first
202
+ * TC where RNG state diverges from CS.
203
+ */
204
+ export function debug_dump_tc_rng_states(coordinate: string): string;
205
+
206
+ /**
207
+ * Dump raw `mob_spawns` for one world of a coordinate, as JSON
208
+ * `{template:[{cell,tag,...},...], ambient:[...], world_name, width, height}`.
209
+ * Debug-only — used to localize the V-AQU w[0] +1000 ambient mob delta.
210
+ */
211
+ export function debug_dump_world_mobs(coordinate: string, world_idx: number): string;
212
+
213
+ /**
214
+ * Diagnostic: return the current SETTINGS.element_overrides as JSON.
215
+ * Lets callers verify a `snapshot_*` push actually landed in the
216
+ * thread-local cache before invoking a `generate_*` / digest call.
217
+ * Gated behind the `debug` feature so production builds stay slim.
218
+ */
219
+ export function debug_settings_element_overrides(): string;
220
+
221
+ /**
222
+ * Drain the per-thread debug-capture buffer populated by
223
+ * instrumented points in `oni-worldgen`. Returns the accumulated
224
+ * lines as a single newline-separated string and empties the
225
+ * buffer. Pair with `compute_digest_for_cluster` or
226
+ * `dump_tc_polys_for_cluster` to capture intermediate state during
227
+ * worldgen.
228
+ */
229
+ export function drain_debug_capture(): string;
230
+
231
+ /**
232
+ * Diagnostic: dump the cluster layout's world placements as seen by
233
+ * Rust after snapshot merge. Used to verify CGM augmentations
234
+ * (sizeMultiplier, forcedWorldTraits, etc) survived the JSON
235
+ * round-trip into Rust's `WorldPlacement` struct.
236
+ */
237
+ export function dump_cluster_placements(cluster_id: string): string;
238
+
239
+ /**
240
+ * Diagnostic: dump every terrain cell's polygon vertices. Returns a
241
+ * JSON object `{ site_id: [[vx_hex, vy_hex], ...], ... }` so the
242
+ * mod-parity scripts can diff per-cell polygons against the CS
243
+ * snapshot. Pairs with `dump_tc_positions_for_cluster` for full
244
+ * per-cell geometry diff.
245
+ */
246
+ export function dump_tc_polys_for_cluster(coordinate: string, cluster_id: string, seed: number, world_idx: number): string;
247
+
248
+ /**
249
+ * Diagnostic: dump every terrain cell's site_id + node_type +
250
+ * polygon centroid (raw bits) for a generated cluster. Lets the
251
+ * mod-parity scripts diff per-cell positions directly against the
252
+ * CS snapshot's `tc_positions` field when only `tc_positions_sha`
253
+ * fails. Output is a JSON array of "site_id,node_type,cx_hex,cy_hex"
254
+ * strings sorted by site_id (matching the digest hash input).
255
+ */
256
+ export function dump_tc_positions_for_cluster(coordinate: string, cluster_id: string, seed: number, world_idx: number): string;
257
+
258
+ /**
259
+ * Diagnostic: dump every terrain cell's node_type for a given world
260
+ * in a CGM-style pipeline run. Comparing direct vs pipeline output
261
+ * reveals whether the divergence is in subworld assignment (upstream
262
+ * of element bands) or in element-band sampling (downstream).
263
+ */
264
+ export function dump_terrain_cell_node_types(cluster_id: string, seed: number, world_idx: number, coordinate: string): string;
265
+
266
+ /**
267
+ * Diagnostic: compute f32 transcendentals on a list of test inputs and
268
+ * dump the bit patterns. Used to confirm wasm32 libm vs x86 ucrt have
269
+ * different f32::ln/f32::exp outputs (suspected root of OASIS W1
270
+ * thermal divergence).
271
+ */
272
+ export function dump_transcendental_test(): string;
273
+
274
+ /**
275
+ * Diagnostic: dump per-cell element_idx + mass-bits + temp-bits for
276
+ * one world's `sim_cells`. Used to find the FIRST concretely-different
277
+ * cell when a digest hash diverges. Output is TSV (idx, elem_idx,
278
+ * mass_bits, temp_bits) — bits so f32s round-trip exactly through JSON.
279
+ */
280
+ export function dump_world_cells(coordinate: string, cluster_id: string, seed: number, mode: string, world_idx: number, overrides_json: string): string;
281
+
282
+ /**
283
+ * Dump cell state after exactly N settle ticks for a specific world.
284
+ * Used to bisect wasm-vs-native f32 divergence at tick granularity.
285
+ */
286
+ export function dump_world_cells_at_tick(coordinate: string, world_idx: number, target_tick: number): string;
287
+
288
+ /**
289
+ * Dump post-settle cell-state for a specific world (debug feature).
290
+ *
291
+ * Returns NDJSON-like JSON `{ "world_index": N, "width": W, "height": H,
292
+ * "element_idx": [Rust idx per cell], "element_names": [Rust ELEMENTS],
293
+ * "mass_hex": ["%08X" per cell, BE digit order],
294
+ * "temp_hex": ["%08X" per cell, BE digit order] }`.
295
+ *
296
+ * Mirrors `compute_digest_from_coordinate` setup so the post-settle
297
+ * state is identical to what the digest hashes — enables cell-by-cell
298
+ * diff between WASM and native, which is the diagnostic needed to
299
+ * hunt the OASIS W1 wasm-vs-native settle divergence (May 2026).
300
+ * Variant of [`dump_world_cells_settled`] that takes the cluster id +
301
+ * seed directly instead of going through `parse_coordinate`. Mirrors
302
+ * `compute_digest_for_cluster` — required when the coordinate prefix
303
+ * is ambiguous across mod clusters (e.g. CGSM has 3 clusters at
304
+ * `CGSM-C`).
305
+ */
306
+ export function dump_world_cells_for_cluster(cluster_id: string, seed: number, world_idx: number): string;
307
+
308
+ /**
309
+ * Variant that ALSO sets story / mixing levels from a coordinate
310
+ * string (matching the `compute_digest_for_cluster` semantics). Use
311
+ * when you want the dump to reflect the same worldgen pass the
312
+ * digest is computed against.
313
+ */
314
+ export function dump_world_cells_for_cluster_coord(cluster_id: string, seed: number, world_idx: number, coordinate: string): string;
315
+
316
+ export function dump_world_cells_settled(coordinate: string, world_idx: number): string;
317
+
318
+ /**
319
+ * Diagnostic: dump per-TC info (node_id, position, node_type, tags)
320
+ * for one world. Used to detect per-overworld-cell subworld-assignment
321
+ * drift when `ow_types_sha` matches (set/count) but actual placement
322
+ * differs.
323
+ */
324
+ export function dump_world_tcs(coordinate: string, cluster_id: string, seed: number, mode: string, world_idx: number): string;
325
+
326
+ /**
327
+ * Diagnostic: dump per-world traits + subworld files for a generated
328
+ * cluster. Used to debug `world_traits_sha` / `subworld_files_sha`
329
+ * divergence — once a digest hash diverges, this tells you the
330
+ * actual content difference.
331
+ */
332
+ export function dump_world_traits(coordinate: string, cluster_id: string, seed: number, mode: string): string;
333
+
334
+ /**
335
+ * Evaluate a noise tree over a `width × height` 2D grid and return
336
+ * one `f32` per cell, row-major (`y * width + x`). Values are
337
+ * unnormalised; the consumer applies any colour ramp.
338
+ *
339
+ * `tree_kind`:
340
+ * - `"named"`: look up `tree_value` in the live `SettingsCache.noise`
341
+ * map (the same map the editor mutates).
342
+ * - `"inline"`: parse `tree_value` as a YAML document in isolation.
343
+ *
344
+ * Output is bit-identical to the engine's own evaluation at the
345
+ * given seed. Sample coords map `width × height` linearly onto the
346
+ * tree's `settings.lowerBound..upperBound` rectangle (cell-centred),
347
+ * at `z = 0` (worldgen samples the XZ plane at y = 0).
348
+ */
349
+ export function evaluate_noise(tree_kind: string, tree_value: string, width: number, height: number, seed: number): Float32Array;
350
+
351
+ /**
352
+ * Extract the parts of a generated cluster's state that mod
353
+ * extensions (CGM and equivalents) need to compute post-snapshot
354
+ * overrides. Companion to [`compute_digest_with_overrides`].
355
+ *
356
+ * Mod-extensions consume this snapshot, compute structured
357
+ * mutations (e.g. CGM's geyser blacklist re-rolls, SO_POI pins,
358
+ * vanilla-starmap replacements) in TS, then pass the resulting
359
+ * `overrides_json` back to [`compute_digest_with_overrides`] to
360
+ * fold them into the digest.
361
+ *
362
+ * Schema (JSON):
363
+ * ```json
364
+ * {
365
+ * "globalWorldSeed": 1000824071,
366
+ * "isExpansion1": true,
367
+ * "worlds": [
368
+ * { "placementIndex": 0, "offsetX": 0, "offsetY": 0,
369
+ * "worldWidth": 96, "clusterLocation": { "q": 0, "r": 0 },
370
+ * "entitySpawners": [
371
+ * { "tag": "GeyserGeneric", "cell": 100,
372
+ * "resolvedGeyserTemplate": "hot_water" }
373
+ * ]
374
+ * }
375
+ * ],
376
+ * "poiLocations": [
377
+ * { "poiType": "HarvestableSpacePOI_X", "location": { "q": 5, "r": 5 } }
378
+ * ],
379
+ * "vanillaDestinations": [ { "destType": "...", "distance": 0 } ]
380
+ * }
381
+ * ```
382
+ *
383
+ * The schema is the symmetric input to the TS `Snapshot` interface
384
+ * in `packages/oxygen-not-included-mod-extensions/src/cgm/transformer.ts`.
385
+ */
386
+ export function extract_overrideable_state(coordinate: string, cluster_id: string, seed: number, mode: string): string;
387
+
388
+ /**
389
+ * The ONI game build this WASM was parity-baselined against (e.g.
390
+ * `"737195"`).
391
+ */
392
+ export function game_version(): string;
393
+
394
+ /**
395
+ * Generate a cluster by cluster id + seed. Returns a `ClusterResult`
396
+ * JSON envelope. For the coordinate-string form (story traits +
397
+ * mixing) use `generate_from_coordinate`.
398
+ */
399
+ export function generate_cluster(seed: number, cluster_id: string): string;
400
+
401
+ /**
402
+ * Generate all worlds in a cluster and return per-cell polygon data for each.
403
+ *
404
+ * Returns JSON: `{ "cluster_id", "seed", "worlds": [{ "name", "width", "height", "is_starting", "cells": [...] }] }`
405
+ */
406
+ export function generate_cluster_cells(seed: number, cluster_id: string): string;
407
+
408
+ /**
409
+ * Generate a cluster and return the rendered SimCell grid for each world.
410
+ * Returns JSON with element_idx, mass_hex, temp_hex, disease_idx, disease_count arrays.
411
+ * This is the same data format as the C# snapshot for parity verification.
412
+ */
413
+ export function generate_cluster_rendered(seed: number, cluster_id: string): string;
414
+
415
+ /**
416
+ * Generate a cluster with provided cluster YAML config override.
417
+ */
418
+ export function generate_cluster_with_configs(seed: number, cluster_id: string, cluster_yaml: string, _world_yamls: string): string;
419
+
420
+ /**
421
+ * Generate a cluster from a game coordinate string (e.g.
422
+ * `"SNDST-A-42-0-4A-MUWF1"`). Returns a `ClusterResult` JSON
423
+ * envelope; for the typed-array `MapData` shape use
424
+ * `generate_map_data`.
425
+ */
426
+ export function generate_from_coordinate(coordinate: string): string;
427
+
428
+ /**
429
+ * Generate the layout for a cluster's starting world and return
430
+ * per-cell data as JSON: `{ cells: [{ site_id, x, y, type }, ...] }`.
431
+ * Used for cell-level comparison against C# reference snapshots.
432
+ */
433
+ export function generate_layout_cells(seed: number, cluster_id: string): string;
434
+
435
+ /**
436
+ * Generate a cluster from a game coordinate and return a `MapData`
437
+ * value: per-world element grids, biome cell polygons, entity spawns,
438
+ * and starmap locations. Caches the cluster for the two-phase API
439
+ * (`settle_cluster_advance`, `get_entity_spawners`).
440
+ *
441
+ * Per-cell grids ship as typed arrays (`Uint16Array`, `Float32Array`,
442
+ * etc.) on `JsValue` so JS consumers don't pay a JSON parse.
443
+ */
444
+ export function generate_map_data(coordinate: string): any;
445
+
446
+ /**
447
+ * Generate a cluster from coordinate and return per-world element grids.
448
+ * Used for parity verification against C# snapshots.
449
+ */
450
+ export function generate_rendered_from_coordinate(coordinate: string): string;
451
+
452
+ /**
453
+ * Generate a single SandstoneDefault world and return timing + cell count data.
454
+ */
455
+ export function generate_sandstone_default(seed: number): string;
456
+
457
+ /**
458
+ * Generate terrain cells for the starting world and return as JSON.
459
+ * Used to verify WASM vs native parity.
460
+ */
461
+ export function generate_terrain_cells(seed: number, cluster_id: string): string;
462
+
463
+ /**
464
+ * Generate a VanillaSandstoneCluster (8-world DLC cluster) and return timing + cell count data.
465
+ */
466
+ export function generate_vanilla_sandstone_cluster(seed: number): string;
467
+
468
+ /**
469
+ * Re-run ambient mob spawning against the cached cluster's current
470
+ * cell state and return the refreshed entity lists. Call after
471
+ * `settle_cluster_advance` chunks when settled liquid/gas flow may
472
+ * have invalidated earlier mob placements. Requires a prior
473
+ * `generate_map_data`. Template-placed entities (geysers, oil wells,
474
+ * props) persist across calls.
475
+ */
476
+ export function get_entity_spawners(): string;
477
+
478
+ export function initThreadPool(num_threads: number): Promise<any>;
479
+
480
+ /**
481
+ * Returns a JSON-encoded `NoiseNodeKindSpec[]` enumerating every
482
+ * noise node variant the engine recognises (primitives, filters,
483
+ * modifiers, transformers, selectors, combiners) plus its param
484
+ * schema. Static across the lifetime of the build.
485
+ */
486
+ export function noise_node_kinds(): string;
487
+
488
+ /**
489
+ * Diagnostic: hash every category of the active SettingsCache to a
490
+ * stable JSON fingerprint. Used to compare load_generated state vs
491
+ * post-snapshot-roundtrip state to find which category drifts.
492
+ */
493
+ export function probe_settings_fingerprint(): string;
494
+
495
+ /**
496
+ * Diagnostic: serialize a specific subworld via its name lookup and
497
+ * return both an alphabetical-keys hash AND an iteration-order JSON.
498
+ * The two should match across "direct load" and "snapshot roundtrip"
499
+ * paths if the bug isn't in HashMap iteration order.
500
+ */
501
+ export function probe_subworld_raw_json(name: string): string;
502
+
503
+ /**
504
+ * Diagnostic: dump cache.subworlds in its raw HashMap iteration
505
+ * order (NOT sorted), with each subworld's JSON. Used to detect
506
+ * HashMap iteration-order drift that's invisible to sorted-key
507
+ * fingerprints.
508
+ */
509
+ export function probe_subworlds_iteration_order_hash(): string;
510
+
511
+ /**
512
+ * Toggle template placement. WASM-side counterpart of the native
513
+ * `SKIP_TEMPLATES` env var.
514
+ */
515
+ export function set_skip_templates(skip: boolean): void;
516
+
517
+ /**
518
+ * Toggle the per-thread oni-voronoi debug-capture flag. Off by
519
+ * default so production hot paths don't pay for the per-iteration
520
+ * trace. Mod-parity diff scripts flip this on around the worldgen
521
+ * call.
522
+ */
523
+ export function set_voronoi_debug_capture(enabled: boolean): void;
524
+
525
+ /**
526
+ * Drop both the SettingsCache and the cluster cache. The next
527
+ * `generate_*` call reloads the embedded stock defaults.
528
+ */
529
+ export function settings_reset(): void;
530
+
531
+ /**
532
+ * Advance the cached cluster's settle sim to `target_tick` and
533
+ * return a binary snapshot at that tick covering every world. Call
534
+ * repeatedly with increasing ticks to paint intermediate frames;
535
+ * `target_tick = 499` finalises the cluster.
536
+ *
537
+ * `target_tick` must be in `1..=499`. A tick `<=` the current cached
538
+ * tick re-emits the current frame. Returns an empty buffer on
539
+ * out-of-range tick or empty/stale cache; call `generate_map_data`
540
+ * first to populate.
541
+ *
542
+ * Binary format (all little-endian, v5):
543
+ * - `u32` version tag (= 5)
544
+ * - `u32` tick
545
+ * - `u32` world count
546
+ * - per world: `u32` width, `u32` height, then `width * height`
547
+ * cells of 25 bytes each: `u16 elem, f32 mass, f32 temp, u8 dis,
548
+ * i32 dis_count, u16 bw_elem, f32 bw_mass, f32 bw_temp`. Worlds
549
+ * without `backwallNoise` emit Vacuum + 0 mass + 0 temp.
550
+ */
551
+ export function settle_cluster_advance(target_tick: number): Uint8Array;
552
+
553
+ /**
554
+ * Drain the in-memory log buffer for `channel` (e.g. `"ppc_prng"`).
555
+ * WASM-side stand-in for native diag sites that would write to
556
+ * `std::fs::*`.
557
+ */
558
+ export function sim_env_drain_log(channel: string): string;
559
+
560
+ /**
561
+ * Set a `(key, value)` in the cross-target env overlay read by
562
+ * `oni_sim::sim_env::var`. WASM-side stand-in for the `SIM_*_PATH` /
563
+ * `SIM_*_TICK` env vars used by native diag sites.
564
+ */
565
+ export function sim_env_set(key: string, value: string): void;
566
+
567
+ /**
568
+ * Stable hex hash of a snapshot JSON. Alias of
569
+ * `snapshot_checksum_canonical`; same content always hashes to the
570
+ * same value regardless of HashMap/IndexMap iteration order.
571
+ */
572
+ export function snapshot_checksum(snapshot_json: string): string;
573
+
574
+ /**
575
+ * Byte-hash variant: FNV-1a-64 over the raw input bytes. Weak
576
+ * contract; same logical content with different HashMap/IndexMap
577
+ * iteration orders produces different hashes. Only safe when the
578
+ * consumer caches the exact bytes it hashed.
579
+ */
580
+ export function snapshot_checksum_bytes(snapshot_json: string): string;
581
+
582
+ /**
583
+ * Canonical-form variant: parses to a `serde_json::Value` (sorted
584
+ * keys at every level), then FNV-1a-64 with type tags + length
585
+ * prefixes. Same logical content always produces the same hash;
586
+ * what `snapshot_checksum` (the default) and `snapshot_state_checksum`
587
+ * route through.
588
+ */
589
+ export function snapshot_checksum_canonical(snapshot_json: string): string;
590
+
591
+ /**
592
+ * Build a `WorldgenSnapshot` from a `{path: JSON-string}` files map,
593
+ * apply it to SETTINGS, and return the resulting snapshot JSON.
594
+ * Strict mode.
595
+ */
596
+ export function snapshot_from_files(files_json: string): string;
597
+
598
+ /**
599
+ * Extensions-mode counterpart of `snapshot_from_files`.
600
+ */
601
+ export function snapshot_from_files_extensions(files_json: string): string;
602
+
603
+ /**
604
+ * Reset SETTINGS to the embedded U59 vanilla baseline and return the
605
+ * vanilla snapshot as a JSON string. Strict mode.
606
+ */
607
+ export function snapshot_load_vanilla(): string;
608
+
609
+ /**
610
+ * Extensions-mode counterpart of `snapshot_load_vanilla`. Subsequent
611
+ * `merge_files` calls accept mod-defined enum extensions.
612
+ */
613
+ export function snapshot_load_vanilla_extensions(): string;
614
+
615
+ /**
616
+ * Merge a `{path: JSON-string}` files map into an existing snapshot
617
+ * JSON. Last-wins on duplicate paths. Applies the merged snapshot to
618
+ * SETTINGS as a side effect.
619
+ */
620
+ export function snapshot_merge_files(snapshot_json: string, files_json: string): string;
621
+
622
+ /**
623
+ * Drop `paths_json` (a JSON array of path strings) from a snapshot
624
+ * JSON, apply the result to SETTINGS, and return the updated
625
+ * snapshot JSON. Paths not present are silently ignored; mode and
626
+ * element overrides are preserved.
627
+ */
628
+ export function snapshot_remove_paths(snapshot_json: string, paths_json: string): string;
629
+
630
+ /**
631
+ * Stable hex hash of the resident snapshot. Same content produces
632
+ * the same hash regardless of HashMap/IndexMap iteration order or
633
+ * load history. Auto-loads vanilla if empty.
634
+ */
635
+ export function snapshot_state_checksum(): string;
636
+
637
+ /**
638
+ * Drop the listed paths from the resident snapshot. `paths_json` is
639
+ * a JSON array of path strings; paths not present are silently
640
+ * ignored.
641
+ */
642
+ export function snapshot_state_drop_paths(paths_json: string): number;
643
+
644
+ /**
645
+ * Return the resident snapshot as a JSON-encoded
646
+ * `{path: JSON-string}` files map. Auto-loads vanilla if empty.
647
+ */
648
+ export function snapshot_state_files(): string;
649
+
650
+ /**
651
+ * Replace the resident snapshot from a `{path: JSON-string}` files
652
+ * map. Strict; atomic. Throws and leaves the snapshot untouched on
653
+ * invalid input.
654
+ */
655
+ export function snapshot_state_load(files_json: string): number;
656
+
657
+ /**
658
+ * Extensions-mode counterpart of `snapshot_state_load`. Subsequent
659
+ * merges inherit the Extensions mode from the loaded snapshot.
660
+ */
661
+ export function snapshot_state_load_extensions(files_json: string): number;
662
+
663
+ /**
664
+ * Merge a `{path: JSON-string}` files map into the resident snapshot.
665
+ * Last-wins on duplicate paths. Auto-loads vanilla if empty; atomic
666
+ * on parse failure. Mode is inherited from the resident snapshot.
667
+ */
668
+ export function snapshot_state_merge(files_json: string): number;
669
+
670
+ /**
671
+ * Clear the resident snapshot and bump the version. The next
672
+ * `snapshot_state_*` call auto-loads vanilla.
673
+ */
674
+ export function snapshot_state_reset(): void;
675
+
676
+ /**
677
+ * Reset the resident snapshot to the embedded vanilla baseline.
678
+ * Strict mode.
679
+ */
680
+ export function snapshot_state_vanilla(): number;
681
+
682
+ /**
683
+ * Same as `snapshot_state_vanilla`, Extensions mode. Subsequent
684
+ * merges accept mod-defined enum extensions.
685
+ */
686
+ export function snapshot_state_vanilla_extensions(): number;
687
+
688
+ /**
689
+ * Monotonic mutation counter. Bumps on every successful mutation;
690
+ * 0 if the slot has never been touched.
691
+ */
692
+ export function snapshot_state_version(): number;
693
+
694
+ /**
695
+ * Convert a snapshot JSON into a `{path: JSON-string}` files map.
696
+ * Round-trips back through `snapshot_from_files`.
697
+ */
698
+ export function snapshot_to_files(snapshot_json: string): string;
699
+
700
+ /**
701
+ * Drain the thermal pair trace buffer (one entry per pair-fire).
702
+ */
703
+ export function take_thermal_pair_trace(): string;
704
+
705
+ /**
706
+ * Diagnostic: test f64::cos / f64::sin for a specific input. Used
707
+ * to verify WASM precision against native Rust + system libm.
708
+ */
709
+ export function test_cos_sin(angle_bits: bigint): string;
710
+
711
+ /**
712
+ * Diagnostic: ucrt-port logf on a JSON list of input bit patterns.
713
+ * Returns per-input output bit pattern for cross-platform verification.
714
+ */
715
+ export function ucrt_logf_batch(input_bits_json: string): string;
716
+
717
+ export class wbg_rayon_PoolBuilder {
718
+ private constructor();
719
+ free(): void;
720
+ [Symbol.dispose](): void;
721
+ build(): void;
722
+ numThreads(): number;
723
+ receiver(): number;
724
+ }
725
+
726
+ export function wbg_rayon_start_worker(receiver: number): void;
727
+
728
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
729
+
730
+ export interface InitOutput {
731
+ readonly bench_cluster_phases: (a: number, b: number, c: number) => [number, number];
732
+ readonly bench_profile_dump: () => [number, number];
733
+ readonly compute_digest_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
734
+ readonly compute_digest_from_coordinate: (a: number, b: number, c: number, d: number) => [number, number];
735
+ readonly compute_digest_with_overrides: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
736
+ readonly compute_geyser_stats: (a: number, b: number, c: number) => [number, number];
737
+ readonly debug_dump_backwall_distribution: (a: number, b: number, c: number) => [number, number];
738
+ readonly debug_dump_cluster_pd_seed_state: (a: number, b: number) => [number, number];
739
+ readonly debug_dump_noise_channel_hashes: (a: number, b: number) => [number, number];
740
+ readonly debug_dump_noise_channels: (a: number, b: number, c: number) => [number, number];
741
+ readonly debug_dump_placed_templates: (a: number, b: number) => [number, number];
742
+ readonly debug_dump_tc_backwall_lookup: (a: number, b: number, c: number) => [number, number];
743
+ readonly debug_dump_tc_backwall_noise: (a: number, b: number, c: number, d: number, e: number) => [number, number];
744
+ readonly debug_dump_tc_details: (a: number, b: number, c: number) => [number, number];
745
+ readonly debug_dump_tc_rng_states: (a: number, b: number) => [number, number];
746
+ readonly debug_dump_world_mobs: (a: number, b: number, c: number) => [number, number];
747
+ readonly debug_settings_element_overrides: () => [number, number];
748
+ readonly drain_debug_capture: () => [number, number];
749
+ readonly dump_cluster_placements: (a: number, b: number) => [number, number];
750
+ readonly dump_tc_polys_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
751
+ readonly dump_tc_positions_for_cluster: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
752
+ readonly dump_terrain_cell_node_types: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
753
+ readonly dump_transcendental_test: () => [number, number];
754
+ readonly dump_world_cells: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
755
+ readonly dump_world_cells_at_tick: (a: number, b: number, c: number, d: number) => [number, number];
756
+ readonly dump_world_cells_for_cluster: (a: number, b: number, c: number, d: number) => [number, number];
757
+ readonly dump_world_cells_for_cluster_coord: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
758
+ readonly dump_world_cells_settled: (a: number, b: number, c: number) => [number, number];
759
+ readonly dump_world_tcs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
760
+ readonly dump_world_traits: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
761
+ readonly evaluate_noise: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
762
+ readonly extract_overrideable_state: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
763
+ readonly game_version: () => [number, number];
764
+ readonly generate_cluster: (a: number, b: number, c: number) => [number, number];
765
+ readonly generate_cluster_cells: (a: number, b: number, c: number) => [number, number];
766
+ readonly generate_cluster_rendered: (a: number, b: number, c: number) => [number, number];
767
+ readonly generate_cluster_with_configs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
768
+ readonly generate_from_coordinate: (a: number, b: number) => [number, number];
769
+ readonly generate_layout_cells: (a: number, b: number, c: number) => [number, number];
770
+ readonly generate_map_data: (a: number, b: number) => any;
771
+ readonly generate_rendered_from_coordinate: (a: number, b: number) => [number, number];
772
+ readonly generate_sandstone_default: (a: number) => [number, number];
773
+ readonly generate_terrain_cells: (a: number, b: number, c: number) => [number, number];
774
+ readonly generate_vanilla_sandstone_cluster: (a: number) => [number, number];
775
+ readonly get_entity_spawners: () => [number, number];
776
+ readonly noise_node_kinds: () => [number, number];
777
+ readonly probe_settings_fingerprint: () => [number, number];
778
+ readonly probe_subworld_raw_json: (a: number, b: number) => [number, number];
779
+ readonly probe_subworlds_iteration_order_hash: () => [number, number];
780
+ readonly set_skip_templates: (a: number) => void;
781
+ readonly set_voronoi_debug_capture: (a: number) => void;
782
+ readonly settings_reset: () => void;
783
+ readonly settle_cluster_advance: (a: number) => [number, number];
784
+ readonly sim_env_drain_log: (a: number, b: number) => [number, number];
785
+ readonly sim_env_set: (a: number, b: number, c: number, d: number) => void;
786
+ readonly snapshot_checksum: (a: number, b: number) => [number, number, number, number];
787
+ readonly snapshot_checksum_bytes: (a: number, b: number) => [number, number];
788
+ readonly snapshot_from_files: (a: number, b: number) => [number, number, number, number];
789
+ readonly snapshot_from_files_extensions: (a: number, b: number) => [number, number, number, number];
790
+ readonly snapshot_load_vanilla: () => [number, number, number, number];
791
+ readonly snapshot_load_vanilla_extensions: () => [number, number, number, number];
792
+ readonly snapshot_merge_files: (a: number, b: number, c: number, d: number) => [number, number, number, number];
793
+ readonly snapshot_remove_paths: (a: number, b: number, c: number, d: number) => [number, number, number, number];
794
+ readonly snapshot_state_checksum: () => [number, number, number, number];
795
+ readonly snapshot_state_drop_paths: (a: number, b: number) => [number, number, number];
796
+ readonly snapshot_state_files: () => [number, number, number, number];
797
+ readonly snapshot_state_load: (a: number, b: number) => [number, number, number];
798
+ readonly snapshot_state_load_extensions: (a: number, b: number) => [number, number, number];
799
+ readonly snapshot_state_merge: (a: number, b: number) => [number, number, number];
800
+ readonly snapshot_state_reset: () => void;
801
+ readonly snapshot_state_vanilla: () => number;
802
+ readonly snapshot_state_vanilla_extensions: () => number;
803
+ readonly snapshot_to_files: (a: number, b: number) => [number, number, number, number];
804
+ readonly take_thermal_pair_trace: () => [number, number];
805
+ readonly test_cos_sin: (a: bigint) => [number, number];
806
+ readonly ucrt_logf_batch: (a: number, b: number) => [number, number];
807
+ readonly bench_profile_enable: () => void;
808
+ readonly snapshot_checksum_canonical: (a: number, b: number) => [number, number, number, number];
809
+ readonly clear_cluster_cache: () => void;
810
+ readonly snapshot_state_version: () => number;
811
+ readonly arm_thermal_pair_trace: (a: number, b: number) => void;
812
+ readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
813
+ readonly initThreadPool: (a: number) => any;
814
+ readonly wbg_rayon_poolbuilder_build: (a: number) => void;
815
+ readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
816
+ readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
817
+ readonly wbg_rayon_start_worker: (a: number) => void;
818
+ readonly memory: WebAssembly.Memory;
819
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
820
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
821
+ readonly __wbindgen_exn_store: (a: number) => void;
822
+ readonly __externref_table_alloc: () => number;
823
+ readonly __wbindgen_externrefs: WebAssembly.Table;
824
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
825
+ readonly __externref_table_dealloc: (a: number) => void;
826
+ readonly __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
827
+ readonly __wbindgen_start: (a: number) => void;
828
+ }
829
+
830
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
831
+
832
+ /**
833
+ * Instantiates the given `module`, which can either be bytes or
834
+ * a precompiled `WebAssembly.Module`.
835
+ *
836
+ * @param {{ module: SyncInitInput, memory?: WebAssembly.Memory, thread_stack_size?: number }} module - Passing `SyncInitInput` directly is deprecated.
837
+ * @param {WebAssembly.Memory} memory - Deprecated.
838
+ *
839
+ * @returns {InitOutput}
840
+ */
841
+ export function initSync(module: { module: SyncInitInput, memory?: WebAssembly.Memory, thread_stack_size?: number } | SyncInitInput, memory?: WebAssembly.Memory): InitOutput;
842
+
843
+ /**
844
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
845
+ * for everything else, calls `WebAssembly.instantiate` directly.
846
+ *
847
+ * @param {{ module_or_path: InitInput | Promise<InitInput>, memory?: WebAssembly.Memory, thread_stack_size?: number }} module_or_path - Passing `InitInput` directly is deprecated.
848
+ * @param {WebAssembly.Memory} memory - Deprecated.
849
+ *
850
+ * @returns {Promise<InitOutput>}
851
+ */
852
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput>, memory?: WebAssembly.Memory, thread_stack_size?: number } | InitInput | Promise<InitInput>, memory?: WebAssembly.Memory): Promise<InitOutput>;