nucleation 0.10.4 → 0.10.7
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/CellExecutor.d.mts +51 -0
- package/CellExecutor.d.ts +51 -0
- package/CellExecutor.mjs +171 -0
- package/Curve3D.mjs +1 -1
- package/DefinitionRegion.mjs +4 -4
- package/Design.d.mts +348 -0
- package/Design.d.ts +348 -0
- package/Design.mjs +1334 -0
- package/Hdl.d.mts +56 -0
- package/Hdl.d.ts +56 -0
- package/Hdl.mjs +163 -0
- package/MchprsWorld.mjs +2 -2
- package/MeshConfig.mjs +4 -4
- package/MeshResult.d.mts +11 -0
- package/MeshResult.d.ts +11 -0
- package/MeshResult.mjs +38 -1
- package/NucleationError.d.mts +12 -0
- package/NucleationError.d.ts +12 -0
- package/NucleationError.mjs +25 -0
- package/Routing.d.mts +66 -0
- package/Routing.d.ts +66 -0
- package/Routing.mjs +220 -0
- package/Schematic.d.mts +73 -1
- package/Schematic.d.ts +73 -1
- package/Schematic.mjs +259 -1
- package/SchematicSplitResult.d.mts +26 -0
- package/SchematicSplitResult.d.ts +26 -0
- package/SchematicSplitResult.mjs +84 -0
- package/Store.d.mts +1 -1
- package/Store.d.ts +1 -1
- package/Store.mjs +1 -1
- package/TickSimulation.d.mts +231 -0
- package/TickSimulation.d.ts +231 -0
- package/TickSimulation.mjs +404 -2
- package/index.d.mts +10 -0
- package/index.d.ts +10 -0
- package/index.mjs +10 -0
- package/nucleation.wasm +0 -0
- package/package.json +6 -1
- package/veneer/design.d.ts +167 -0
- package/veneer/design.mjs +480 -0
package/Hdl.d.mts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Namespacing opaque for the HDL compiler entry points (static methods,
|
|
10
|
+
* like `Routing`).
|
|
11
|
+
*/
|
|
12
|
+
export class Hdl {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Compile combinational BLIF text into a redstone PLA schematic.
|
|
21
|
+
*
|
|
22
|
+
* `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
|
|
23
|
+
* rejected — combinational only). One floor lever per `.inputs` net
|
|
24
|
+
* drives the build; every signal has a dust probe. `bake=true`
|
|
25
|
+
* settles the build in the tick engine first and saves it at rest
|
|
26
|
+
* (needs the `mc-tick` feature, else errors).
|
|
27
|
+
*
|
|
28
|
+
* Probe/lever coordinates and stats come from `compile_blif_report`.
|
|
29
|
+
*/
|
|
30
|
+
static compileBlif(blif: string, name: string, bake: boolean): Schematic;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Compile `blif` and write the JSON report: stats (`prims`,
|
|
34
|
+
* `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
|
|
35
|
+
* lever drive order), `outputs` (each `{name, probe}` or `{name,
|
|
36
|
+
* const}`), `levers` (`{signal, pos}`), and `probes`
|
|
37
|
+
* (signal -> `[x, y, z]` dust cell, in the schematic's own
|
|
38
|
+
* coordinates).
|
|
39
|
+
*/
|
|
40
|
+
static compileBlifReport(blif: string, name: string): string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Compile `blif` and write its typed-cell contract as JSON — the
|
|
44
|
+
* `CellContract` file format (name, `io` with typed ports/buses,
|
|
45
|
+
* `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
|
|
46
|
+
* into word buses (LSB = index 0); single bits are boolean. Input
|
|
47
|
+
* port positions are the drive levers, output positions the dust
|
|
48
|
+
* probes, in the same schematic coordinates as `compile_blif`.
|
|
49
|
+
*
|
|
50
|
+
* The `physical.delays_rt` table is ESTIMATED from levelization
|
|
51
|
+
* depth (2 redstone ticks per level), not measured; `paste_safe`
|
|
52
|
+
* is false until proven. Pair with `compile_blif` for the
|
|
53
|
+
* schematic: schematic + this contract = an executable typed cell.
|
|
54
|
+
*/
|
|
55
|
+
static compileBlifContract(blif: string, name: string): string;
|
|
56
|
+
}
|
package/Hdl.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Namespacing opaque for the HDL compiler entry points (static methods,
|
|
10
|
+
* like `Routing`).
|
|
11
|
+
*/
|
|
12
|
+
export class Hdl {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Compile combinational BLIF text into a redstone PLA schematic.
|
|
21
|
+
*
|
|
22
|
+
* `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
|
|
23
|
+
* rejected — combinational only). One floor lever per `.inputs` net
|
|
24
|
+
* drives the build; every signal has a dust probe. `bake=true`
|
|
25
|
+
* settles the build in the tick engine first and saves it at rest
|
|
26
|
+
* (needs the `mc-tick` feature, else errors).
|
|
27
|
+
*
|
|
28
|
+
* Probe/lever coordinates and stats come from `compile_blif_report`.
|
|
29
|
+
*/
|
|
30
|
+
static compileBlif(blif: string, name: string, bake: boolean): Schematic;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Compile `blif` and write the JSON report: stats (`prims`,
|
|
34
|
+
* `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
|
|
35
|
+
* lever drive order), `outputs` (each `{name, probe}` or `{name,
|
|
36
|
+
* const}`), `levers` (`{signal, pos}`), and `probes`
|
|
37
|
+
* (signal -> `[x, y, z]` dust cell, in the schematic's own
|
|
38
|
+
* coordinates).
|
|
39
|
+
*/
|
|
40
|
+
static compileBlifReport(blif: string, name: string): string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Compile `blif` and write its typed-cell contract as JSON — the
|
|
44
|
+
* `CellContract` file format (name, `io` with typed ports/buses,
|
|
45
|
+
* `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
|
|
46
|
+
* into word buses (LSB = index 0); single bits are boolean. Input
|
|
47
|
+
* port positions are the drive levers, output positions the dust
|
|
48
|
+
* probes, in the same schematic coordinates as `compile_blif`.
|
|
49
|
+
*
|
|
50
|
+
* The `physical.delays_rt` table is ESTIMATED from levelization
|
|
51
|
+
* depth (2 redstone ticks per level), not measured; `paste_safe`
|
|
52
|
+
* is false until proven. Pair with `compile_blif` for the
|
|
53
|
+
* schematic: schematic + this contract = an executable typed cell.
|
|
54
|
+
*/
|
|
55
|
+
static compileBlifContract(blif: string, name: string): string;
|
|
56
|
+
}
|
package/Hdl.mjs
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
5
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
6
|
+
|
|
7
|
+
const Hdl_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
8
|
+
wasm.Hdl_destroy(ptr);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Namespacing opaque for the HDL compiler entry points (static methods,
|
|
13
|
+
* like `Routing`).
|
|
14
|
+
*/
|
|
15
|
+
export class Hdl {
|
|
16
|
+
// Internal ptr reference:
|
|
17
|
+
#ptr = null;
|
|
18
|
+
|
|
19
|
+
// Lifetimes are only to keep dependencies alive.
|
|
20
|
+
// Since JS won't garbage collect until there are no incoming edges.
|
|
21
|
+
#selfEdge = [];
|
|
22
|
+
|
|
23
|
+
#internalConstructor(symbol, ptr, selfEdge) {
|
|
24
|
+
if (symbol !== diplomatRuntime.internalConstructor) {
|
|
25
|
+
console.error("Hdl is an Opaque type. You cannot call its constructor.");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.#ptr = ptr;
|
|
29
|
+
this.#selfEdge = selfEdge;
|
|
30
|
+
|
|
31
|
+
// Are we being borrowed? If not, we can register.
|
|
32
|
+
if (this.#selfEdge.length === 0) {
|
|
33
|
+
Hdl_box_destroy_registry.register(this, this.#ptr);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
get ffiValue() {
|
|
40
|
+
return this.#ptr;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Compile combinational BLIF text into a redstone PLA schematic.
|
|
46
|
+
*
|
|
47
|
+
* `blif` is yosys `write_blif` output (`.latch`/`.subckt` are
|
|
48
|
+
* rejected — combinational only). One floor lever per `.inputs` net
|
|
49
|
+
* drives the build; every signal has a dust probe. `bake=true`
|
|
50
|
+
* settles the build in the tick engine first and saves it at rest
|
|
51
|
+
* (needs the `mc-tick` feature, else errors).
|
|
52
|
+
*
|
|
53
|
+
* Probe/lever coordinates and stats come from `compile_blif_report`.
|
|
54
|
+
*/
|
|
55
|
+
static compileBlif(blif, name, bake) {
|
|
56
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
57
|
+
|
|
58
|
+
const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
|
|
59
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
60
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const result = wasm.Hdl_compile_blif(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, bake);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
if (!diplomatReceive.resultFlag) {
|
|
67
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
68
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
69
|
+
}
|
|
70
|
+
return new Schematic(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
finally {
|
|
74
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
75
|
+
functionCleanupArena.free();
|
|
76
|
+
|
|
77
|
+
diplomatReceive.free();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Compile `blif` and write the JSON report: stats (`prims`,
|
|
83
|
+
* `levels`, `peephole_removed`, `blocks`, `bounds`), `inputs` (=
|
|
84
|
+
* lever drive order), `outputs` (each `{name, probe}` or `{name,
|
|
85
|
+
* const}`), `levers` (`{signal, pos}`), and `probes`
|
|
86
|
+
* (signal -> `[x, y, z]` dust cell, in the schematic's own
|
|
87
|
+
* coordinates).
|
|
88
|
+
*/
|
|
89
|
+
static compileBlifReport(blif, name) {
|
|
90
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
91
|
+
|
|
92
|
+
const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
|
|
93
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
94
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
95
|
+
|
|
96
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const result = wasm.Hdl_compile_blif_report(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, write.buffer);
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
if (!diplomatReceive.resultFlag) {
|
|
103
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
104
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
105
|
+
}
|
|
106
|
+
return write.readString8();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
finally {
|
|
110
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
111
|
+
functionCleanupArena.free();
|
|
112
|
+
|
|
113
|
+
diplomatReceive.free();
|
|
114
|
+
write.free();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Compile `blif` and write its typed-cell contract as JSON — the
|
|
120
|
+
* `CellContract` file format (name, `io` with typed ports/buses,
|
|
121
|
+
* `physical` sidecar). Vector ports (`a[0..3]` or `a0..a3`) group
|
|
122
|
+
* into word buses (LSB = index 0); single bits are boolean. Input
|
|
123
|
+
* port positions are the drive levers, output positions the dust
|
|
124
|
+
* probes, in the same schematic coordinates as `compile_blif`.
|
|
125
|
+
*
|
|
126
|
+
* The `physical.delays_rt` table is ESTIMATED from levelization
|
|
127
|
+
* depth (2 redstone ticks per level), not measured; `paste_safe`
|
|
128
|
+
* is false until proven. Pair with `compile_blif` for the
|
|
129
|
+
* schematic: schematic + this contract = an executable typed cell.
|
|
130
|
+
*/
|
|
131
|
+
static compileBlifContract(blif, name) {
|
|
132
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
133
|
+
|
|
134
|
+
const blifSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, blif)));
|
|
135
|
+
const nameSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, name)));
|
|
136
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
137
|
+
|
|
138
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
const result = wasm.Hdl_compile_blif_contract(diplomatReceive.buffer, blifSlice.ptr, nameSlice.ptr, write.buffer);
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
if (!diplomatReceive.resultFlag) {
|
|
145
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
146
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
147
|
+
}
|
|
148
|
+
return write.readString8();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
finally {
|
|
152
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
153
|
+
functionCleanupArena.free();
|
|
154
|
+
|
|
155
|
+
diplomatReceive.free();
|
|
156
|
+
write.free();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
constructor(symbol, ptr, selfEdge) {
|
|
161
|
+
return this.#internalConstructor(...arguments)
|
|
162
|
+
}
|
|
163
|
+
}
|
package/MchprsWorld.mjs
CHANGED
|
@@ -195,7 +195,7 @@ export class MchprsWorld {
|
|
|
195
195
|
const result = wasm.MchprsWorld_get_lever_power(this.ffiValue, x, y, z);
|
|
196
196
|
|
|
197
197
|
try {
|
|
198
|
-
return result;
|
|
198
|
+
return result === 1;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
finally {
|
|
@@ -211,7 +211,7 @@ export class MchprsWorld {
|
|
|
211
211
|
const result = wasm.MchprsWorld_is_lit(this.ffiValue, x, y, z);
|
|
212
212
|
|
|
213
213
|
try {
|
|
214
|
-
return result;
|
|
214
|
+
return result === 1;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
finally {
|
package/MeshConfig.mjs
CHANGED
|
@@ -78,7 +78,7 @@ export class MeshConfig {
|
|
|
78
78
|
const result = wasm.MeshConfig_cull_hidden_faces(this.ffiValue);
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
return result;
|
|
81
|
+
return result === 1;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
finally {
|
|
@@ -107,7 +107,7 @@ export class MeshConfig {
|
|
|
107
107
|
const result = wasm.MeshConfig_ambient_occlusion(this.ffiValue);
|
|
108
108
|
|
|
109
109
|
try {
|
|
110
|
-
return result;
|
|
110
|
+
return result === 1;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
finally {
|
|
@@ -262,7 +262,7 @@ export class MeshConfig {
|
|
|
262
262
|
const result = wasm.MeshConfig_cull_occluded_blocks(this.ffiValue);
|
|
263
263
|
|
|
264
264
|
try {
|
|
265
|
-
return result;
|
|
265
|
+
return result === 1;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
finally {
|
|
@@ -292,7 +292,7 @@ export class MeshConfig {
|
|
|
292
292
|
const result = wasm.MeshConfig_greedy_meshing(this.ffiValue);
|
|
293
293
|
|
|
294
294
|
try {
|
|
295
|
-
return result;
|
|
295
|
+
return result === 1;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
finally {
|
package/MeshResult.d.mts
CHANGED
|
@@ -28,6 +28,17 @@ export class MeshResult {
|
|
|
28
28
|
*/
|
|
29
29
|
static createUsdz(schematic: Schematic, pack: ResourcePack, config: MeshConfig): MeshResult;
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A schematic plus a run timeline, as an animated GLB, base64-encoded.
|
|
33
|
+
*
|
|
34
|
+
* `timeline_json` is what `TickSimulation::animation_timeline_json`
|
|
35
|
+
* produces, and `schematic` the scene it starts from
|
|
36
|
+
* (`selection_schematic_b64`). Static rather than a method on a mesh
|
|
37
|
+
* because the animation is built from the schematic and the timeline
|
|
38
|
+
* together — there is no intermediate `MeshResult` to hang it off.
|
|
39
|
+
*/
|
|
40
|
+
static animatedGlbB64(schematic: Schematic, pack: ResourcePack, timelineJson: string): string;
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* The mesh as a binary GLB, base64-encoded.
|
|
33
44
|
*/
|
package/MeshResult.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ export class MeshResult {
|
|
|
28
28
|
*/
|
|
29
29
|
static createUsdz(schematic: Schematic, pack: ResourcePack, config: MeshConfig): MeshResult;
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A schematic plus a run timeline, as an animated GLB, base64-encoded.
|
|
33
|
+
*
|
|
34
|
+
* `timeline_json` is what `TickSimulation::animation_timeline_json`
|
|
35
|
+
* produces, and `schematic` the scene it starts from
|
|
36
|
+
* (`selection_schematic_b64`). Static rather than a method on a mesh
|
|
37
|
+
* because the animation is built from the schematic and the timeline
|
|
38
|
+
* together — there is no intermediate `MeshResult` to hang it off.
|
|
39
|
+
*/
|
|
40
|
+
static animatedGlbB64(schematic: Schematic, pack: ResourcePack, timelineJson: string): string;
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* The mesh as a binary GLB, base64-encoded.
|
|
33
44
|
*/
|
package/MeshResult.mjs
CHANGED
|
@@ -89,6 +89,43 @@ export class MeshResult {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A schematic plus a run timeline, as an animated GLB, base64-encoded.
|
|
94
|
+
*
|
|
95
|
+
* `timeline_json` is what `TickSimulation::animation_timeline_json`
|
|
96
|
+
* produces, and `schematic` the scene it starts from
|
|
97
|
+
* (`selection_schematic_b64`). Static rather than a method on a mesh
|
|
98
|
+
* because the animation is built from the schematic and the timeline
|
|
99
|
+
* together — there is no intermediate `MeshResult` to hang it off.
|
|
100
|
+
*/
|
|
101
|
+
static animatedGlbB64(schematic, pack, timelineJson) {
|
|
102
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
103
|
+
|
|
104
|
+
const timelineJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, timelineJson)));
|
|
105
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
106
|
+
|
|
107
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
const result = wasm.MeshResult_animated_glb_b64(diplomatReceive.buffer, schematic.ffiValue, pack.ffiValue, timelineJsonSlice.ptr, write.buffer);
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
if (!diplomatReceive.resultFlag) {
|
|
114
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
115
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
116
|
+
}
|
|
117
|
+
return write.readString8();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
finally {
|
|
121
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
122
|
+
functionCleanupArena.free();
|
|
123
|
+
|
|
124
|
+
diplomatReceive.free();
|
|
125
|
+
write.free();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
92
129
|
/**
|
|
93
130
|
* The mesh as a binary GLB, base64-encoded.
|
|
94
131
|
*/
|
|
@@ -199,7 +236,7 @@ export class MeshResult {
|
|
|
199
236
|
const result = wasm.MeshResult_has_transparency(this.ffiValue);
|
|
200
237
|
|
|
201
238
|
try {
|
|
202
|
-
return result;
|
|
239
|
+
return result === 1;
|
|
203
240
|
}
|
|
204
241
|
|
|
205
242
|
finally {
|
package/NucleationError.d.mts
CHANGED
|
@@ -37,5 +37,17 @@ export class NucleationError {
|
|
|
37
37
|
static Generation : NucleationError;
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Why the last failing bridge call on this thread failed, in words.
|
|
42
|
+
*
|
|
43
|
+
* The enum cannot carry a message across the FFI, so a caught error
|
|
44
|
+
* is a bare variant — `InvalidArgument` — while the layer that
|
|
45
|
+
* refused already knew it was "19.2M cells over the 8M cap". Modules
|
|
46
|
+
* that know the story record it; this reads it back, so an exception
|
|
47
|
+
* handler holding the error value can ask it for the words. Empty
|
|
48
|
+
* when the last detail-carrying call succeeded.
|
|
49
|
+
*/
|
|
50
|
+
detail(): string;
|
|
51
|
+
|
|
40
52
|
constructor(value: NucleationError | string );
|
|
41
53
|
}
|
package/NucleationError.d.ts
CHANGED
|
@@ -37,5 +37,17 @@ export class NucleationError {
|
|
|
37
37
|
static Generation : NucleationError;
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Why the last failing bridge call on this thread failed, in words.
|
|
42
|
+
*
|
|
43
|
+
* The enum cannot carry a message across the FFI, so a caught error
|
|
44
|
+
* is a bare variant — `InvalidArgument` — while the layer that
|
|
45
|
+
* refused already knew it was "19.2M cells over the 8M cap". Modules
|
|
46
|
+
* that know the story record it; this reads it back, so an exception
|
|
47
|
+
* handler holding the error value can ask it for the words. Empty
|
|
48
|
+
* when the last detail-carrying call succeeded.
|
|
49
|
+
*/
|
|
50
|
+
detail(): string;
|
|
51
|
+
|
|
40
52
|
constructor(value: NucleationError | string );
|
|
41
53
|
}
|
package/NucleationError.mjs
CHANGED
|
@@ -105,6 +105,31 @@ export class NucleationError {
|
|
|
105
105
|
static Generation = NucleationError.#objectValues[12];
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Why the last failing bridge call on this thread failed, in words.
|
|
110
|
+
*
|
|
111
|
+
* The enum cannot carry a message across the FFI, so a caught error
|
|
112
|
+
* is a bare variant — `InvalidArgument` — while the layer that
|
|
113
|
+
* refused already knew it was "19.2M cells over the 8M cap". Modules
|
|
114
|
+
* that know the story record it; this reads it back, so an exception
|
|
115
|
+
* handler holding the error value can ask it for the words. Empty
|
|
116
|
+
* when the last detail-carrying call succeeded.
|
|
117
|
+
*/
|
|
118
|
+
detail() {
|
|
119
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
120
|
+
|
|
121
|
+
wasm.NucleationError_detail(this.ffiValue, write.buffer);
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
return write.readString8();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
finally {
|
|
128
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
129
|
+
write.free();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
constructor(value) {
|
|
109
134
|
return this.#internalConstructor(...arguments)
|
|
110
135
|
}
|
package/Routing.d.mts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Namespacing opaque for routing entry points (static methods taking
|
|
10
|
+
* `&Schematic` explicitly, like `Autostack`).
|
|
11
|
+
*/
|
|
12
|
+
export class Routing {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Route one net from `(sx, sy, sz)` to `(dx, dy, dz)` with default
|
|
21
|
+
* rules (torch-ladder vias, stair cap 4, refresh 5) and write the
|
|
22
|
+
* emitted geometry into the schematic. Writes the routed path as a
|
|
23
|
+
* JSON array of `[x, y, z]` cells.
|
|
24
|
+
*/
|
|
25
|
+
static routeNet(schematic: Schematic, sx: number, sy: number, sz: number, dx: number, dy: number, dz: number, label: string): string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Route every net in `nets_json` with negotiated congestion
|
|
29
|
+
* (pnr-core PathFinder) in one labelled workspace, write the
|
|
30
|
+
* geometry into the schematic, and write the JSON report
|
|
31
|
+
* (`routes` with per-net `path`/`delay_rt`, `notes`,
|
|
32
|
+
* `violations`). Supports per-net-class rule overrides
|
|
33
|
+
* (`classes`: io_contract `NetClassRule`s, with `region`
|
|
34
|
+
* resolving named route zones tagged on the schematic's
|
|
35
|
+
* DefinitionRegions), plus `bounds`, `budget` and `congestion`
|
|
36
|
+
* options — see `crate::routing::route_all_schematic` for the
|
|
37
|
+
* exact request shape.
|
|
38
|
+
*/
|
|
39
|
+
static routeAll(schematic: Schematic, netsJson: string): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* LVS v1: compare an intended netlist (`{"nets": [{"name",
|
|
43
|
+
* "terminals": [[x,y,z], ...]}]}`) against the conduction
|
|
44
|
+
* netlist extracted statically from the schematic (dust
|
|
45
|
+
* adjacency incl. cut diagonals plus repeater/comparator/torch
|
|
46
|
+
* through-component edges). Writes `{"clean", "matched",
|
|
47
|
+
* "opens", "shorts", "cycles"}`.
|
|
48
|
+
*/
|
|
49
|
+
static lvs(schematic: Schematic, intentJson: string): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Run design-rule checks (support audit, repeater-cycle detection,
|
|
53
|
+
* optional decay) over the schematic. Writes a JSON array; each
|
|
54
|
+
* element has `kind` plus violation-specific fields. Label-aware
|
|
55
|
+
* short checking needs a labelled workspace and stays native.
|
|
56
|
+
*/
|
|
57
|
+
static drc(schematic: Schematic, checkDecay: boolean): string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Static timing over the schematic plus a gate netlist given as
|
|
61
|
+
* JSON: `{"inputs": ["a", ...], "gates": [{"out": "y",
|
|
62
|
+
* "ins": ["a", "b"], "delay_rt": 2}, ...]}`. Writes
|
|
63
|
+
* `{"arrival_rt": {sig: rt}, "critical": [sig, ...]}`.
|
|
64
|
+
*/
|
|
65
|
+
static sta(schematic: Schematic, netlistJson: string): string;
|
|
66
|
+
}
|
package/Routing.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { NucleationError } from "./NucleationError.mjs"
|
|
3
|
+
import type { Schematic } from "./Schematic.mjs"
|
|
4
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Namespacing opaque for routing entry points (static methods taking
|
|
10
|
+
* `&Schematic` explicitly, like `Autostack`).
|
|
11
|
+
*/
|
|
12
|
+
export class Routing {
|
|
13
|
+
/** @internal */
|
|
14
|
+
get ffiValue(): pointer;
|
|
15
|
+
/** @internal */
|
|
16
|
+
constructor();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Route one net from `(sx, sy, sz)` to `(dx, dy, dz)` with default
|
|
21
|
+
* rules (torch-ladder vias, stair cap 4, refresh 5) and write the
|
|
22
|
+
* emitted geometry into the schematic. Writes the routed path as a
|
|
23
|
+
* JSON array of `[x, y, z]` cells.
|
|
24
|
+
*/
|
|
25
|
+
static routeNet(schematic: Schematic, sx: number, sy: number, sz: number, dx: number, dy: number, dz: number, label: string): string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Route every net in `nets_json` with negotiated congestion
|
|
29
|
+
* (pnr-core PathFinder) in one labelled workspace, write the
|
|
30
|
+
* geometry into the schematic, and write the JSON report
|
|
31
|
+
* (`routes` with per-net `path`/`delay_rt`, `notes`,
|
|
32
|
+
* `violations`). Supports per-net-class rule overrides
|
|
33
|
+
* (`classes`: io_contract `NetClassRule`s, with `region`
|
|
34
|
+
* resolving named route zones tagged on the schematic's
|
|
35
|
+
* DefinitionRegions), plus `bounds`, `budget` and `congestion`
|
|
36
|
+
* options — see `crate::routing::route_all_schematic` for the
|
|
37
|
+
* exact request shape.
|
|
38
|
+
*/
|
|
39
|
+
static routeAll(schematic: Schematic, netsJson: string): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* LVS v1: compare an intended netlist (`{"nets": [{"name",
|
|
43
|
+
* "terminals": [[x,y,z], ...]}]}`) against the conduction
|
|
44
|
+
* netlist extracted statically from the schematic (dust
|
|
45
|
+
* adjacency incl. cut diagonals plus repeater/comparator/torch
|
|
46
|
+
* through-component edges). Writes `{"clean", "matched",
|
|
47
|
+
* "opens", "shorts", "cycles"}`.
|
|
48
|
+
*/
|
|
49
|
+
static lvs(schematic: Schematic, intentJson: string): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Run design-rule checks (support audit, repeater-cycle detection,
|
|
53
|
+
* optional decay) over the schematic. Writes a JSON array; each
|
|
54
|
+
* element has `kind` plus violation-specific fields. Label-aware
|
|
55
|
+
* short checking needs a labelled workspace and stays native.
|
|
56
|
+
*/
|
|
57
|
+
static drc(schematic: Schematic, checkDecay: boolean): string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Static timing over the schematic plus a gate netlist given as
|
|
61
|
+
* JSON: `{"inputs": ["a", ...], "gates": [{"out": "y",
|
|
62
|
+
* "ins": ["a", "b"], "delay_rt": 2}, ...]}`. Writes
|
|
63
|
+
* `{"arrival_rt": {sig: rt}, "critical": [sig, ...]}`.
|
|
64
|
+
*/
|
|
65
|
+
static sta(schematic: Schematic, netlistJson: string): string;
|
|
66
|
+
}
|