nucleation 0.9.2 → 0.10.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.
package/Schematic.d.mts CHANGED
@@ -413,7 +413,12 @@ export class Schematic {
413
413
  debugJsonString(): string;
414
414
 
415
415
  /**
416
- * The schematic name. `NotFound` if not set.
416
+ * The schematic name, or the empty string if not set.
417
+ *
418
+ * Total, like every other metadata accessor: absence is a blank
419
+ * field, not an error — a file that simply doesn't carry the field
420
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
421
+ * the same value a litematic round-trip of an unset field yields.
417
422
  */
418
423
  name(): string;
419
424
 
@@ -423,7 +428,12 @@ export class Schematic {
423
428
  setName(name: string): void;
424
429
 
425
430
  /**
426
- * The schematic author. `NotFound` if not set.
431
+ * The schematic author, or the empty string if not set.
432
+ *
433
+ * Total, like every other metadata accessor: absence is a blank
434
+ * field, not an error — a file that simply doesn't carry the field
435
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
436
+ * the same value a litematic round-trip of an unset field yields.
427
437
  */
428
438
  author(): string;
429
439
 
@@ -433,7 +443,12 @@ export class Schematic {
433
443
  setAuthor(author: string): void;
434
444
 
435
445
  /**
436
- * The schematic description. `NotFound` if not set.
446
+ * The schematic description, or the empty string if not set.
447
+ *
448
+ * Total, like every other metadata accessor: absence is a blank
449
+ * field, not an error — a file that simply doesn't carry the field
450
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
451
+ * the same value a litematic round-trip of an unset field yields.
437
452
  */
438
453
  description(): string;
439
454
 
package/Schematic.d.ts CHANGED
@@ -413,7 +413,12 @@ export class Schematic {
413
413
  debugJsonString(): string;
414
414
 
415
415
  /**
416
- * The schematic name. `NotFound` if not set.
416
+ * The schematic name, or the empty string if not set.
417
+ *
418
+ * Total, like every other metadata accessor: absence is a blank
419
+ * field, not an error — a file that simply doesn't carry the field
420
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
421
+ * the same value a litematic round-trip of an unset field yields.
417
422
  */
418
423
  name(): string;
419
424
 
@@ -423,7 +428,12 @@ export class Schematic {
423
428
  setName(name: string): void;
424
429
 
425
430
  /**
426
- * The schematic author. `NotFound` if not set.
431
+ * The schematic author, or the empty string if not set.
432
+ *
433
+ * Total, like every other metadata accessor: absence is a blank
434
+ * field, not an error — a file that simply doesn't carry the field
435
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
436
+ * the same value a litematic round-trip of an unset field yields.
427
437
  */
428
438
  author(): string;
429
439
 
@@ -433,7 +443,12 @@ export class Schematic {
433
443
  setAuthor(author: string): void;
434
444
 
435
445
  /**
436
- * The schematic description. `NotFound` if not set.
446
+ * The schematic description, or the empty string if not set.
447
+ *
448
+ * Total, like every other metadata accessor: absence is a blank
449
+ * field, not an error — a file that simply doesn't carry the field
450
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
451
+ * the same value a litematic round-trip of an unset field yields.
437
452
  */
438
453
  description(): string;
439
454
 
package/Schematic.mjs CHANGED
@@ -1732,7 +1732,12 @@ export class Schematic {
1732
1732
  }
1733
1733
 
1734
1734
  /**
1735
- * The schematic name. `NotFound` if not set.
1735
+ * The schematic name, or the empty string if not set.
1736
+ *
1737
+ * Total, like every other metadata accessor: absence is a blank
1738
+ * field, not an error — a file that simply doesn't carry the field
1739
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
1740
+ * the same value a litematic round-trip of an unset field yields.
1736
1741
  */
1737
1742
  name() {
1738
1743
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
@@ -1785,7 +1790,12 @@ export class Schematic {
1785
1790
  }
1786
1791
 
1787
1792
  /**
1788
- * The schematic author. `NotFound` if not set.
1793
+ * The schematic author, or the empty string if not set.
1794
+ *
1795
+ * Total, like every other metadata accessor: absence is a blank
1796
+ * field, not an error — a file that simply doesn't carry the field
1797
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
1798
+ * the same value a litematic round-trip of an unset field yields.
1789
1799
  */
1790
1800
  author() {
1791
1801
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
@@ -1838,7 +1848,12 @@ export class Schematic {
1838
1848
  }
1839
1849
 
1840
1850
  /**
1841
- * The schematic description. `NotFound` if not set.
1851
+ * The schematic description, or the empty string if not set.
1852
+ *
1853
+ * Total, like every other metadata accessor: absence is a blank
1854
+ * field, not an error — a file that simply doesn't carry the field
1855
+ * (Sponge without attribution, a fresh schematic) reads as `""`,
1856
+ * the same value a litematic round-trip of an unset field yields.
1842
1857
  */
1843
1858
  description() {
1844
1859
  const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
@@ -309,4 +309,33 @@ export class TickSimulation {
309
309
  changesCount(): number;
310
310
 
311
311
  worldSnapshotJson(): string;
312
+
313
+ /**
314
+ * Static structural analysis of the build standing in this world.
315
+ *
316
+ * One call, one JSON document: adhesion groups, piston/observer/source
317
+ * nodes, the four edge kinds, every minimal self-translating subgraph
318
+ * (the engine), payload, kickers, dead weight, and any proof that the
319
+ * machine cannot move.
320
+ *
321
+ * The analysis lives in the engine rather than in the caller on
322
+ * purpose. Every "what would this piston move?" answer comes from
323
+ * `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
324
+ * tick loop runs — and a second copy of Minecraft's push rules written
325
+ * on the far side of this boundary would drift from it silently.
326
+ */
327
+ machineGraphJson(): string;
328
+
329
+ /**
330
+ * GA pre-filter: static verdicts for a whole batch of genomes.
331
+ *
332
+ * Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
333
+ * immediately before it: whatever this rejects never needs simulating.
334
+ * Writes one row per genome, `[rejected, rejected_for_sustained,
335
+ * engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
336
+ *
337
+ * The registry, behaviour table and movability rules are built once for
338
+ * the batch — building them per genome costs more than the analysis.
339
+ */
340
+ static machineGraphBatchJson(bx: number, by: number, bz: number, travel: number, xOff: number, palette: string, cells: Array<number>, airIndex: number): string;
312
341
  }
@@ -309,4 +309,33 @@ export class TickSimulation {
309
309
  changesCount(): number;
310
310
 
311
311
  worldSnapshotJson(): string;
312
+
313
+ /**
314
+ * Static structural analysis of the build standing in this world.
315
+ *
316
+ * One call, one JSON document: adhesion groups, piston/observer/source
317
+ * nodes, the four edge kinds, every minimal self-translating subgraph
318
+ * (the engine), payload, kickers, dead weight, and any proof that the
319
+ * machine cannot move.
320
+ *
321
+ * The analysis lives in the engine rather than in the caller on
322
+ * purpose. Every "what would this piston move?" answer comes from
323
+ * `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
324
+ * tick loop runs — and a second copy of Minecraft's push rules written
325
+ * on the far side of this boundary would drift from it silently.
326
+ */
327
+ machineGraphJson(): string;
328
+
329
+ /**
330
+ * GA pre-filter: static verdicts for a whole batch of genomes.
331
+ *
332
+ * Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
333
+ * immediately before it: whatever this rejects never needs simulating.
334
+ * Writes one row per genome, `[rejected, rejected_for_sustained,
335
+ * engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
336
+ *
337
+ * The registry, behaviour table and movability rules are built once for
338
+ * the batch — building them per genome costs more than the analysis.
339
+ */
340
+ static machineGraphBatchJson(bx: number, by: number, bz: number, travel: number, xOff: number, palette: string, cells: Array<number>, airIndex: number): string;
312
341
  }
@@ -822,6 +822,75 @@ export class TickSimulation {
822
822
  }
823
823
  }
824
824
 
825
+ /**
826
+ * Static structural analysis of the build standing in this world.
827
+ *
828
+ * One call, one JSON document: adhesion groups, piston/observer/source
829
+ * nodes, the four edge kinds, every minimal self-translating subgraph
830
+ * (the engine), payload, kickers, dead weight, and any proof that the
831
+ * machine cannot move.
832
+ *
833
+ * The analysis lives in the engine rather than in the caller on
834
+ * purpose. Every "what would this piston move?" answer comes from
835
+ * `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
836
+ * tick loop runs — and a second copy of Minecraft's push rules written
837
+ * on the far side of this boundary would drift from it silently.
838
+ */
839
+ machineGraphJson() {
840
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
841
+
842
+ wasm.TickSimulation_machine_graph_json(this.ffiValue, write.buffer);
843
+
844
+ try {
845
+ return write.readString8();
846
+ }
847
+
848
+ finally {
849
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
850
+ write.free();
851
+ }
852
+ }
853
+
854
+ /**
855
+ * GA pre-filter: static verdicts for a whole batch of genomes.
856
+ *
857
+ * Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
858
+ * immediately before it: whatever this rejects never needs simulating.
859
+ * Writes one row per genome, `[rejected, rejected_for_sustained,
860
+ * engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
861
+ *
862
+ * The registry, behaviour table and movability rules are built once for
863
+ * the batch — building them per genome costs more than the analysis.
864
+ */
865
+ static machineGraphBatchJson(bx, by, bz, travel, xOff, palette, cells, airIndex) {
866
+ let functionCleanupArena = new diplomatRuntime.CleanupArena();
867
+
868
+ const paletteSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, palette)));
869
+ const cellsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, cells, "u16")));
870
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
871
+
872
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
873
+
874
+
875
+ const result = wasm.TickSimulation_machine_graph_batch_json(diplomatReceive.buffer, bx, by, bz, travel, xOff, paletteSlice.ptr, cellsSlice.ptr, airIndex, write.buffer);
876
+
877
+ try {
878
+ if (!diplomatReceive.resultFlag) {
879
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
880
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
881
+ }
882
+ return write.readString8();
883
+ }
884
+
885
+ finally {
886
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
887
+ functionCleanupArena.free();
888
+
889
+ diplomatReceive.free();
890
+ write.free();
891
+ }
892
+ }
893
+
825
894
  constructor(symbol, ptr, selfEdge) {
826
895
  return this.#internalConstructor(...arguments)
827
896
  }
package/nucleation.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleation",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
4
4
  "description": "A high-performance Minecraft schematic parser and utility library",
5
5
  "type": "module",
6
6
  "main": "index.mjs",