nucleation 0.10.9 → 0.10.13
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/AnimationEffect.d.mts +1 -1
- package/AnimationEffect.d.ts +1 -1
- package/AnimationEffect.mjs +2 -2
- package/Schematic.d.mts +72 -0
- package/Schematic.d.ts +72 -0
- package/Schematic.mjs +243 -0
- package/nucleation.wasm +0 -0
- package/package.json +1 -1
package/AnimationEffect.d.mts
CHANGED
|
@@ -33,7 +33,7 @@ export class AnimationEffect {
|
|
|
33
33
|
* `x`, `y`, `z`, `rotateX`, `rotateY`, `rotateZ`, `scale`, `opacity`,
|
|
34
34
|
* `tintR/G/B/A`, and `emissiveR/G/B`.
|
|
35
35
|
*/
|
|
36
|
-
addTween(propertyName: string,
|
|
36
|
+
addTween(propertyName: string, start: number, end: number, easingName: string): void;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Add a normalised keyframe (`at` in `0..=1`) to a property track.
|
package/AnimationEffect.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export class AnimationEffect {
|
|
|
33
33
|
* `x`, `y`, `z`, `rotateX`, `rotateY`, `rotateZ`, `scale`, `opacity`,
|
|
34
34
|
* `tintR/G/B/A`, and `emissiveR/G/B`.
|
|
35
35
|
*/
|
|
36
|
-
addTween(propertyName: string,
|
|
36
|
+
addTween(propertyName: string, start: number, end: number, easingName: string): void;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Add a normalised keyframe (`at` in `0..=1`) to a property track.
|
package/AnimationEffect.mjs
CHANGED
|
@@ -135,7 +135,7 @@ export class AnimationEffect {
|
|
|
135
135
|
* `x`, `y`, `z`, `rotateX`, `rotateY`, `rotateZ`, `scale`, `opacity`,
|
|
136
136
|
* `tintR/G/B/A`, and `emissiveR/G/B`.
|
|
137
137
|
*/
|
|
138
|
-
addTween(propertyName,
|
|
138
|
+
addTween(propertyName, start, end, easingName) {
|
|
139
139
|
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
140
140
|
|
|
141
141
|
const propertyNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, propertyName)));
|
|
@@ -143,7 +143,7 @@ export class AnimationEffect {
|
|
|
143
143
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
const result = wasm.AnimationEffect_add_tween(diplomatReceive.buffer, this.ffiValue, propertyNameSlice.ptr,
|
|
146
|
+
const result = wasm.AnimationEffect_add_tween(diplomatReceive.buffer, this.ffiValue, propertyNameSlice.ptr, start, end, easingNameSlice.ptr);
|
|
147
147
|
|
|
148
148
|
try {
|
|
149
149
|
if (!diplomatReceive.resultFlag) {
|
package/Schematic.d.mts
CHANGED
|
@@ -26,6 +26,31 @@ export class Schematic {
|
|
|
26
26
|
*/
|
|
27
27
|
deepClone(): Schematic;
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Inspect a versioned transform-plan JSON document without modifying
|
|
31
|
+
* this schematic. Writes a deterministic audit-report JSON document.
|
|
32
|
+
*/
|
|
33
|
+
inspectTransformPlanJson(planJson: string): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Atomically apply a versioned transform-plan JSON document. Policy
|
|
37
|
+
* rejection is represented by `report.rejected == true` and leaves the
|
|
38
|
+
* schematic unchanged; malformed plans raise `InvalidArgument`.
|
|
39
|
+
*/
|
|
40
|
+
applyTransformPlanJson(planJson: string): string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Apply the bundled deterministic, lossless canonicalization preset.
|
|
44
|
+
*/
|
|
45
|
+
canonicalizeJson(): string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Inspect the bundled public-registry policy without modifying this
|
|
49
|
+
* schematic. Applications should review `rejected` and `quarantined`
|
|
50
|
+
* before choosing whether to call `apply_transform_plan_json`.
|
|
51
|
+
*/
|
|
52
|
+
inspectRegistrySafeJson(): string;
|
|
53
|
+
|
|
29
54
|
/**
|
|
30
55
|
* Split spatially independent machines while keeping nearby tiny
|
|
31
56
|
* detached parts with their machine. Components at least
|
|
@@ -61,6 +86,14 @@ export class Schematic {
|
|
|
61
86
|
*/
|
|
62
87
|
static fromData(data: Array<number>): Schematic;
|
|
63
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Decode untrusted bytes using a serialized `DecodeLimits` object.
|
|
91
|
+
* Empty JSON selects the conservative library defaults. Limits are
|
|
92
|
+
* enforced while decompressing/parsing and again before region
|
|
93
|
+
* allocations are accepted.
|
|
94
|
+
*/
|
|
95
|
+
static fromDataBounded(data: Array<number>, limitsJson: string): Schematic;
|
|
96
|
+
|
|
64
97
|
/**
|
|
65
98
|
* Build a schematic from Litematic data.
|
|
66
99
|
*/
|
|
@@ -181,6 +214,32 @@ export class Schematic {
|
|
|
181
214
|
*/
|
|
182
215
|
setBlocks(positions: Array<number>, blockName: string): number;
|
|
183
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Sequentially hand-place the same block at many positions in one
|
|
219
|
+
* local simulated component. `positions` is flat
|
|
220
|
+
* `[x0,y0,z0, x1,y1,z1, ...]`; placements run in that order and each
|
|
221
|
+
* settles before the next. Returns the number of final cells written
|
|
222
|
+
* back, including neighbours changed by redstone or pistons.
|
|
223
|
+
*
|
|
224
|
+
* Nearby passive blocks are loaded as environmental context, but the
|
|
225
|
+
* write-back is confined to the active component's effect window. Its
|
|
226
|
+
* runtime is therefore independent of unrelated schematic volume.
|
|
227
|
+
* Use `set_blocks_simulated_full_world` to opt into global updates.
|
|
228
|
+
*
|
|
229
|
+
* This is the efficient bulk form of repeated `{simulate=true}`:
|
|
230
|
+
* structure conversion and simulator wiring happen once for the
|
|
231
|
+
* complete sequence. Propagation is not constant-time—a placement can
|
|
232
|
+
* affect an arbitrarily large circuit—but fixed setup is amortized.
|
|
233
|
+
*/
|
|
234
|
+
setBlocksSimulated(positions: Array<number>, blockName: string): number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Explicit full-world counterpart to `set_blocks_simulated`.
|
|
238
|
+
* Unrelated schematic volume participates in setup and any resulting
|
|
239
|
+
* changes anywhere in the loaded world are written back.
|
|
240
|
+
*/
|
|
241
|
+
setBlocksSimulatedFullWorld(positions: Array<number>, blockName: string): number;
|
|
242
|
+
|
|
184
243
|
/**
|
|
185
244
|
* Batch-get block names at multiple positions. `positions` is flat
|
|
186
245
|
* `[x0,y0,z0, ...]` (length must be a multiple of 3). Writes a JSON array,
|
|
@@ -549,6 +608,19 @@ export class Schematic {
|
|
|
549
608
|
*/
|
|
550
609
|
clearProvenance(): void;
|
|
551
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Content-addressed processing history as a JSON array. This audit
|
|
613
|
+
* trail is deliberately separate from immutable source provenance.
|
|
614
|
+
*/
|
|
615
|
+
transformationHistoryJson(): string;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Clear processing history without changing source provenance or
|
|
619
|
+
* schematic content. Intended for callers constructing a new artifact
|
|
620
|
+
* lineage, not for hiding registry audit records.
|
|
621
|
+
*/
|
|
622
|
+
clearTransformationHistory(): void;
|
|
623
|
+
|
|
552
624
|
/**
|
|
553
625
|
* Mirror the default region along the X axis (in place). Block
|
|
554
626
|
* orientations, block entities, and entities are mirrored too.
|
package/Schematic.d.ts
CHANGED
|
@@ -26,6 +26,31 @@ export class Schematic {
|
|
|
26
26
|
*/
|
|
27
27
|
deepClone(): Schematic;
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Inspect a versioned transform-plan JSON document without modifying
|
|
31
|
+
* this schematic. Writes a deterministic audit-report JSON document.
|
|
32
|
+
*/
|
|
33
|
+
inspectTransformPlanJson(planJson: string): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Atomically apply a versioned transform-plan JSON document. Policy
|
|
37
|
+
* rejection is represented by `report.rejected == true` and leaves the
|
|
38
|
+
* schematic unchanged; malformed plans raise `InvalidArgument`.
|
|
39
|
+
*/
|
|
40
|
+
applyTransformPlanJson(planJson: string): string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Apply the bundled deterministic, lossless canonicalization preset.
|
|
44
|
+
*/
|
|
45
|
+
canonicalizeJson(): string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Inspect the bundled public-registry policy without modifying this
|
|
49
|
+
* schematic. Applications should review `rejected` and `quarantined`
|
|
50
|
+
* before choosing whether to call `apply_transform_plan_json`.
|
|
51
|
+
*/
|
|
52
|
+
inspectRegistrySafeJson(): string;
|
|
53
|
+
|
|
29
54
|
/**
|
|
30
55
|
* Split spatially independent machines while keeping nearby tiny
|
|
31
56
|
* detached parts with their machine. Components at least
|
|
@@ -61,6 +86,14 @@ export class Schematic {
|
|
|
61
86
|
*/
|
|
62
87
|
static fromData(data: Array<number>): Schematic;
|
|
63
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Decode untrusted bytes using a serialized `DecodeLimits` object.
|
|
91
|
+
* Empty JSON selects the conservative library defaults. Limits are
|
|
92
|
+
* enforced while decompressing/parsing and again before region
|
|
93
|
+
* allocations are accepted.
|
|
94
|
+
*/
|
|
95
|
+
static fromDataBounded(data: Array<number>, limitsJson: string): Schematic;
|
|
96
|
+
|
|
64
97
|
/**
|
|
65
98
|
* Build a schematic from Litematic data.
|
|
66
99
|
*/
|
|
@@ -181,6 +214,32 @@ export class Schematic {
|
|
|
181
214
|
*/
|
|
182
215
|
setBlocks(positions: Array<number>, blockName: string): number;
|
|
183
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Sequentially hand-place the same block at many positions in one
|
|
219
|
+
* local simulated component. `positions` is flat
|
|
220
|
+
* `[x0,y0,z0, x1,y1,z1, ...]`; placements run in that order and each
|
|
221
|
+
* settles before the next. Returns the number of final cells written
|
|
222
|
+
* back, including neighbours changed by redstone or pistons.
|
|
223
|
+
*
|
|
224
|
+
* Nearby passive blocks are loaded as environmental context, but the
|
|
225
|
+
* write-back is confined to the active component's effect window. Its
|
|
226
|
+
* runtime is therefore independent of unrelated schematic volume.
|
|
227
|
+
* Use `set_blocks_simulated_full_world` to opt into global updates.
|
|
228
|
+
*
|
|
229
|
+
* This is the efficient bulk form of repeated `{simulate=true}`:
|
|
230
|
+
* structure conversion and simulator wiring happen once for the
|
|
231
|
+
* complete sequence. Propagation is not constant-time—a placement can
|
|
232
|
+
* affect an arbitrarily large circuit—but fixed setup is amortized.
|
|
233
|
+
*/
|
|
234
|
+
setBlocksSimulated(positions: Array<number>, blockName: string): number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Explicit full-world counterpart to `set_blocks_simulated`.
|
|
238
|
+
* Unrelated schematic volume participates in setup and any resulting
|
|
239
|
+
* changes anywhere in the loaded world are written back.
|
|
240
|
+
*/
|
|
241
|
+
setBlocksSimulatedFullWorld(positions: Array<number>, blockName: string): number;
|
|
242
|
+
|
|
184
243
|
/**
|
|
185
244
|
* Batch-get block names at multiple positions. `positions` is flat
|
|
186
245
|
* `[x0,y0,z0, ...]` (length must be a multiple of 3). Writes a JSON array,
|
|
@@ -549,6 +608,19 @@ export class Schematic {
|
|
|
549
608
|
*/
|
|
550
609
|
clearProvenance(): void;
|
|
551
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Content-addressed processing history as a JSON array. This audit
|
|
613
|
+
* trail is deliberately separate from immutable source provenance.
|
|
614
|
+
*/
|
|
615
|
+
transformationHistoryJson(): string;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Clear processing history without changing source provenance or
|
|
619
|
+
* schematic content. Intended for callers constructing a new artifact
|
|
620
|
+
* lineage, not for hiding registry audit records.
|
|
621
|
+
*/
|
|
622
|
+
clearTransformationHistory(): void;
|
|
623
|
+
|
|
552
624
|
/**
|
|
553
625
|
* Mirror the default region along the X axis (in place). Block
|
|
554
626
|
* orientations, block entities, and entities are mirrored too.
|
package/Schematic.mjs
CHANGED
|
@@ -78,6 +78,109 @@ export class Schematic {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Inspect a versioned transform-plan JSON document without modifying
|
|
83
|
+
* this schematic. Writes a deterministic audit-report JSON document.
|
|
84
|
+
*/
|
|
85
|
+
inspectTransformPlanJson(planJson) {
|
|
86
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
87
|
+
|
|
88
|
+
const planJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, planJson)));
|
|
89
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
90
|
+
|
|
91
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
const result = wasm.Schematic_inspect_transform_plan_json(diplomatReceive.buffer, this.ffiValue, planJsonSlice.ptr, write.buffer);
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
if (!diplomatReceive.resultFlag) {
|
|
98
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
99
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
100
|
+
}
|
|
101
|
+
return write.readString8();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
finally {
|
|
105
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
106
|
+
functionCleanupArena.free();
|
|
107
|
+
|
|
108
|
+
diplomatReceive.free();
|
|
109
|
+
write.free();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Atomically apply a versioned transform-plan JSON document. Policy
|
|
115
|
+
* rejection is represented by `report.rejected == true` and leaves the
|
|
116
|
+
* schematic unchanged; malformed plans raise `InvalidArgument`.
|
|
117
|
+
*/
|
|
118
|
+
applyTransformPlanJson(planJson) {
|
|
119
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
120
|
+
|
|
121
|
+
const planJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, planJson)));
|
|
122
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
123
|
+
|
|
124
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
const result = wasm.Schematic_apply_transform_plan_json(diplomatReceive.buffer, this.ffiValue, planJsonSlice.ptr, write.buffer);
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
if (!diplomatReceive.resultFlag) {
|
|
131
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
132
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
133
|
+
}
|
|
134
|
+
return write.readString8();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
finally {
|
|
138
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
139
|
+
functionCleanupArena.free();
|
|
140
|
+
|
|
141
|
+
diplomatReceive.free();
|
|
142
|
+
write.free();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Apply the bundled deterministic, lossless canonicalization preset.
|
|
148
|
+
*/
|
|
149
|
+
canonicalizeJson() {
|
|
150
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
151
|
+
|
|
152
|
+
wasm.Schematic_canonicalize_json(this.ffiValue, write.buffer);
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
return write.readString8();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
finally {
|
|
159
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
160
|
+
write.free();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Inspect the bundled public-registry policy without modifying this
|
|
166
|
+
* schematic. Applications should review `rejected` and `quarantined`
|
|
167
|
+
* before choosing whether to call `apply_transform_plan_json`.
|
|
168
|
+
*/
|
|
169
|
+
inspectRegistrySafeJson() {
|
|
170
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
171
|
+
|
|
172
|
+
wasm.Schematic_inspect_registry_safe_json(this.ffiValue, write.buffer);
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
return write.readString8();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
finally {
|
|
179
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
180
|
+
write.free();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
81
184
|
/**
|
|
82
185
|
* Split spatially independent machines while keeping nearby tiny
|
|
83
186
|
* detached parts with their machine. Components at least
|
|
@@ -205,6 +308,38 @@ export class Schematic {
|
|
|
205
308
|
}
|
|
206
309
|
}
|
|
207
310
|
|
|
311
|
+
/**
|
|
312
|
+
* Decode untrusted bytes using a serialized `DecodeLimits` object.
|
|
313
|
+
* Empty JSON selects the conservative library defaults. Limits are
|
|
314
|
+
* enforced while decompressing/parsing and again before region
|
|
315
|
+
* allocations are accepted.
|
|
316
|
+
*/
|
|
317
|
+
static fromDataBounded(data, limitsJson) {
|
|
318
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
319
|
+
|
|
320
|
+
const dataSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, data, "u8")));
|
|
321
|
+
const limitsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, limitsJson)));
|
|
322
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
const result = wasm.Schematic_from_data_bounded(diplomatReceive.buffer, dataSlice.ptr, limitsJsonSlice.ptr);
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
if (!diplomatReceive.resultFlag) {
|
|
329
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
330
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
331
|
+
}
|
|
332
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
finally {
|
|
336
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
337
|
+
functionCleanupArena.free();
|
|
338
|
+
|
|
339
|
+
diplomatReceive.free();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
208
343
|
/**
|
|
209
344
|
* Build a schematic from Litematic data.
|
|
210
345
|
*/
|
|
@@ -823,6 +958,80 @@ export class Schematic {
|
|
|
823
958
|
}
|
|
824
959
|
}
|
|
825
960
|
|
|
961
|
+
/**
|
|
962
|
+
* Sequentially hand-place the same block at many positions in one
|
|
963
|
+
* local simulated component. `positions` is flat
|
|
964
|
+
* `[x0,y0,z0, x1,y1,z1, ...]`; placements run in that order and each
|
|
965
|
+
* settles before the next. Returns the number of final cells written
|
|
966
|
+
* back, including neighbours changed by redstone or pistons.
|
|
967
|
+
*
|
|
968
|
+
* Nearby passive blocks are loaded as environmental context, but the
|
|
969
|
+
* write-back is confined to the active component's effect window. Its
|
|
970
|
+
* runtime is therefore independent of unrelated schematic volume.
|
|
971
|
+
* Use `set_blocks_simulated_full_world` to opt into global updates.
|
|
972
|
+
*
|
|
973
|
+
* This is the efficient bulk form of repeated `{simulate=true}`:
|
|
974
|
+
* structure conversion and simulator wiring happen once for the
|
|
975
|
+
* complete sequence. Propagation is not constant-time—a placement can
|
|
976
|
+
* affect an arbitrarily large circuit—but fixed setup is amortized.
|
|
977
|
+
*/
|
|
978
|
+
setBlocksSimulated(positions, blockName) {
|
|
979
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
980
|
+
|
|
981
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
982
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
983
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
const result = wasm.Schematic_set_blocks_simulated(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, blockNameSlice.ptr);
|
|
987
|
+
|
|
988
|
+
try {
|
|
989
|
+
if (!diplomatReceive.resultFlag) {
|
|
990
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
991
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
992
|
+
}
|
|
993
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
finally {
|
|
997
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
998
|
+
functionCleanupArena.free();
|
|
999
|
+
|
|
1000
|
+
diplomatReceive.free();
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Explicit full-world counterpart to `set_blocks_simulated`.
|
|
1006
|
+
* Unrelated schematic volume participates in setup and any resulting
|
|
1007
|
+
* changes anywhere in the loaded world are written back.
|
|
1008
|
+
*/
|
|
1009
|
+
setBlocksSimulatedFullWorld(positions, blockName) {
|
|
1010
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
1011
|
+
|
|
1012
|
+
const positionsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, positions, "i32")));
|
|
1013
|
+
const blockNameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blockName)));
|
|
1014
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
const result = wasm.Schematic_set_blocks_simulated_full_world(diplomatReceive.buffer, this.ffiValue, positionsSlice.ptr, blockNameSlice.ptr);
|
|
1018
|
+
|
|
1019
|
+
try {
|
|
1020
|
+
if (!diplomatReceive.resultFlag) {
|
|
1021
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
1022
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
1023
|
+
}
|
|
1024
|
+
return (new Int32Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
finally {
|
|
1028
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
1029
|
+
functionCleanupArena.free();
|
|
1030
|
+
|
|
1031
|
+
diplomatReceive.free();
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
826
1035
|
/**
|
|
827
1036
|
* Batch-get block names at multiple positions. `positions` is flat
|
|
828
1037
|
* `[x0,y0,z0, ...]` (length must be a multiple of 3). Writes a JSON array,
|
|
@@ -2193,6 +2402,40 @@ export class Schematic {
|
|
|
2193
2402
|
}
|
|
2194
2403
|
}
|
|
2195
2404
|
|
|
2405
|
+
/**
|
|
2406
|
+
* Content-addressed processing history as a JSON array. This audit
|
|
2407
|
+
* trail is deliberately separate from immutable source provenance.
|
|
2408
|
+
*/
|
|
2409
|
+
transformationHistoryJson() {
|
|
2410
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
2411
|
+
|
|
2412
|
+
wasm.Schematic_transformation_history_json(this.ffiValue, write.buffer);
|
|
2413
|
+
|
|
2414
|
+
try {
|
|
2415
|
+
return write.readString8();
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
finally {
|
|
2419
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2420
|
+
write.free();
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Clear processing history without changing source provenance or
|
|
2426
|
+
* schematic content. Intended for callers constructing a new artifact
|
|
2427
|
+
* lineage, not for hiding registry audit records.
|
|
2428
|
+
*/
|
|
2429
|
+
clearTransformationHistory() {
|
|
2430
|
+
wasm.Schematic_clear_transformation_history(this.ffiValue);
|
|
2431
|
+
|
|
2432
|
+
try {}
|
|
2433
|
+
|
|
2434
|
+
finally {
|
|
2435
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2196
2439
|
/**
|
|
2197
2440
|
* Mirror the default region along the X axis (in place). Block
|
|
2198
2441
|
* orientations, block entities, and entities are mirrored too.
|
package/nucleation.wasm
CHANGED
|
Binary file
|