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/Routing.mjs
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
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 Routing_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
8
|
+
wasm.Routing_destroy(ptr);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Namespacing opaque for routing entry points (static methods taking
|
|
13
|
+
* `&Schematic` explicitly, like `Autostack`).
|
|
14
|
+
*/
|
|
15
|
+
export class Routing {
|
|
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("Routing 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
|
+
Routing_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
|
+
* Route one net from `(sx, sy, sz)` to `(dx, dy, dz)` with default
|
|
46
|
+
* rules (torch-ladder vias, stair cap 4, refresh 5) and write the
|
|
47
|
+
* emitted geometry into the schematic. Writes the routed path as a
|
|
48
|
+
* JSON array of `[x, y, z]` cells.
|
|
49
|
+
*/
|
|
50
|
+
static routeNet(schematic, sx, sy, sz, dx, dy, dz, label) {
|
|
51
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
52
|
+
|
|
53
|
+
const labelSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, label)));
|
|
54
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
55
|
+
|
|
56
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const result = wasm.Routing_route_net(diplomatReceive.buffer, schematic.ffiValue, sx, sy, sz, dx, dy, dz, labelSlice.ptr, write.buffer);
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
if (!diplomatReceive.resultFlag) {
|
|
63
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
64
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
65
|
+
}
|
|
66
|
+
return write.readString8();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
finally {
|
|
70
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
71
|
+
functionCleanupArena.free();
|
|
72
|
+
|
|
73
|
+
diplomatReceive.free();
|
|
74
|
+
write.free();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Route every net in `nets_json` with negotiated congestion
|
|
80
|
+
* (pnr-core PathFinder) in one labelled workspace, write the
|
|
81
|
+
* geometry into the schematic, and write the JSON report
|
|
82
|
+
* (`routes` with per-net `path`/`delay_rt`, `notes`,
|
|
83
|
+
* `violations`). Supports per-net-class rule overrides
|
|
84
|
+
* (`classes`: io_contract `NetClassRule`s, with `region`
|
|
85
|
+
* resolving named route zones tagged on the schematic's
|
|
86
|
+
* DefinitionRegions), plus `bounds`, `budget` and `congestion`
|
|
87
|
+
* options — see `crate::routing::route_all_schematic` for the
|
|
88
|
+
* exact request shape.
|
|
89
|
+
*/
|
|
90
|
+
static routeAll(schematic, netsJson) {
|
|
91
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
92
|
+
|
|
93
|
+
const netsJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, netsJson)));
|
|
94
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
95
|
+
|
|
96
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const result = wasm.Routing_route_all(diplomatReceive.buffer, schematic.ffiValue, netsJsonSlice.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
|
+
* LVS v1: compare an intended netlist (`{"nets": [{"name",
|
|
120
|
+
* "terminals": [[x,y,z], ...]}]}`) against the conduction
|
|
121
|
+
* netlist extracted statically from the schematic (dust
|
|
122
|
+
* adjacency incl. cut diagonals plus repeater/comparator/torch
|
|
123
|
+
* through-component edges). Writes `{"clean", "matched",
|
|
124
|
+
* "opens", "shorts", "cycles"}`.
|
|
125
|
+
*/
|
|
126
|
+
static lvs(schematic, intentJson) {
|
|
127
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
128
|
+
|
|
129
|
+
const intentJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, intentJson)));
|
|
130
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
131
|
+
|
|
132
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
const result = wasm.Routing_lvs(diplomatReceive.buffer, schematic.ffiValue, intentJsonSlice.ptr, write.buffer);
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
if (!diplomatReceive.resultFlag) {
|
|
139
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
140
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
141
|
+
}
|
|
142
|
+
return write.readString8();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
finally {
|
|
146
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
147
|
+
functionCleanupArena.free();
|
|
148
|
+
|
|
149
|
+
diplomatReceive.free();
|
|
150
|
+
write.free();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Run design-rule checks (support audit, repeater-cycle detection,
|
|
156
|
+
* optional decay) over the schematic. Writes a JSON array; each
|
|
157
|
+
* element has `kind` plus violation-specific fields. Label-aware
|
|
158
|
+
* short checking needs a labelled workspace and stays native.
|
|
159
|
+
*/
|
|
160
|
+
static drc(schematic, checkDecay) {
|
|
161
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
162
|
+
|
|
163
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const result = wasm.Routing_drc(diplomatReceive.buffer, schematic.ffiValue, checkDecay, write.buffer);
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
if (!diplomatReceive.resultFlag) {
|
|
170
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
171
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
172
|
+
}
|
|
173
|
+
return write.readString8();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
finally {
|
|
177
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
178
|
+
diplomatReceive.free();
|
|
179
|
+
write.free();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Static timing over the schematic plus a gate netlist given as
|
|
185
|
+
* JSON: `{"inputs": ["a", ...], "gates": [{"out": "y",
|
|
186
|
+
* "ins": ["a", "b"], "delay_rt": 2}, ...]}`. Writes
|
|
187
|
+
* `{"arrival_rt": {sig: rt}, "critical": [sig, ...]}`.
|
|
188
|
+
*/
|
|
189
|
+
static sta(schematic, netlistJson) {
|
|
190
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
191
|
+
|
|
192
|
+
const netlistJsonSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, netlistJson)));
|
|
193
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
194
|
+
|
|
195
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
const result = wasm.Routing_sta(diplomatReceive.buffer, schematic.ffiValue, netlistJsonSlice.ptr, write.buffer);
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
if (!diplomatReceive.resultFlag) {
|
|
202
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
203
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
204
|
+
}
|
|
205
|
+
return write.readString8();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
finally {
|
|
209
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
210
|
+
functionCleanupArena.free();
|
|
211
|
+
|
|
212
|
+
diplomatReceive.free();
|
|
213
|
+
write.free();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
constructor(symbol, ptr, selfEdge) {
|
|
218
|
+
return this.#internalConstructor(...arguments)
|
|
219
|
+
}
|
|
220
|
+
}
|
package/Schematic.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BlockPos } from "./BlockPos.mjs"
|
|
|
3
3
|
import type { BlockState } from "./BlockState.mjs"
|
|
4
4
|
import type { Dimensions } from "./Dimensions.mjs"
|
|
5
5
|
import type { NucleationError } from "./NucleationError.mjs"
|
|
6
|
+
import type { SchematicSplitResult } from "./SchematicSplitResult.mjs"
|
|
6
7
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
7
8
|
|
|
8
9
|
|
|
@@ -25,6 +26,15 @@ export class Schematic {
|
|
|
25
26
|
*/
|
|
26
27
|
deepClone(): Schematic;
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Split spatially independent machines while keeping nearby tiny
|
|
31
|
+
* detached parts with their machine. Components at least
|
|
32
|
+
* `min_standalone_blocks` large always remain independent; smaller
|
|
33
|
+
* components attach only directly to a core within `max_air_gap`.
|
|
34
|
+
* Attachment is non-transitive and the operation is lossless.
|
|
35
|
+
*/
|
|
36
|
+
splitConnectedAttachNearby(minStandaloneBlocks: number, maxAirGap: number): SchematicSplitResult;
|
|
37
|
+
|
|
28
38
|
/**
|
|
29
39
|
* The allocated dimensions (width, height, length) of the schematic's
|
|
30
40
|
* bounding box.
|
|
@@ -344,11 +354,27 @@ export class Schematic {
|
|
|
344
354
|
addEntityFromSnbt(snbt: string): void;
|
|
345
355
|
|
|
346
356
|
/**
|
|
347
|
-
* Every
|
|
357
|
+
* Every IN-BOUNDS cell as a JSON array of
|
|
348
358
|
* `{"x", "y", "z", "name", "properties"}` (the old `CBlockArray`).
|
|
359
|
+
* Air cells are materialized too — on a large sparse build this
|
|
360
|
+
* dump is `volume()`-sized and can exhaust wasm memory; renderers
|
|
361
|
+
* and analyzers want `get_non_air_blocks_json`.
|
|
349
362
|
*/
|
|
350
363
|
getAllBlocksJson(): string;
|
|
351
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Every non-air block of ONE named region (a flattened design names
|
|
367
|
+
* one per layer: `inst:{name}`, `bus:{name}`), same JSON shape as
|
|
368
|
+
* `get_all_blocks_json`. Unknown region names error.
|
|
369
|
+
*/
|
|
370
|
+
getRegionNonAirBlocksJson(regionName: string): string;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Every non-air block, same JSON shape as `get_all_blocks_json`.
|
|
374
|
+
* `block_count()`-sized regardless of the bounding volume.
|
|
375
|
+
*/
|
|
376
|
+
getNonAirBlocksJson(): string;
|
|
377
|
+
|
|
352
378
|
/**
|
|
353
379
|
* All blocks within a sub-region (chunk) of the schematic, as the same
|
|
354
380
|
* JSON array shape as `get_all_blocks_json`.
|
|
@@ -507,6 +533,22 @@ export class Schematic {
|
|
|
507
533
|
*/
|
|
508
534
|
setWeVersion(version: number): void;
|
|
509
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Standard embedded source provenance as canonical JSON. Returns an
|
|
538
|
+
* empty string when none is present.
|
|
539
|
+
*/
|
|
540
|
+
provenanceJson(): string;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Validate and set standard embedded source provenance from JSON.
|
|
544
|
+
*/
|
|
545
|
+
setProvenanceJson(json: string): void;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Remove embedded source provenance.
|
|
549
|
+
*/
|
|
550
|
+
clearProvenance(): void;
|
|
551
|
+
|
|
510
552
|
/**
|
|
511
553
|
* Mirror the default region along the X axis (in place). Block
|
|
512
554
|
* orientations, block entities, and entities are mirrored too.
|
|
@@ -718,6 +760,36 @@ export class Schematic {
|
|
|
718
760
|
*/
|
|
719
761
|
compileInsignJson(): string;
|
|
720
762
|
|
|
763
|
+
/**
|
|
764
|
+
* Embed a `CellContract` (JSON) in the schematic's metadata,
|
|
765
|
+
* validating it parses first. The contract is carried through
|
|
766
|
+
* `.schem` save/open and autodetected on open — schematic +
|
|
767
|
+
* contract = one self-describing typed cell.
|
|
768
|
+
*/
|
|
769
|
+
setCellContractJson(json: string): void;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* The contract embedded in the schematic's metadata, as JSON.
|
|
773
|
+
* Errors with `NotFound` when none is embedded, `Parse` when an
|
|
774
|
+
* embedded string exists but is corrupt (loud, never silent).
|
|
775
|
+
*/
|
|
776
|
+
cellContractJson(): string;
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Resolve the schematic's cell contract from its sources in
|
|
780
|
+
* strict precedence — embedded metadata over Insign signs — with
|
|
781
|
+
* loud conflict warnings. Writes `{"contract": ..., "warnings":
|
|
782
|
+
* [...]}`; errors with `NotFound` when no source defines one.
|
|
783
|
+
*/
|
|
784
|
+
resolveCellContractJson(): string;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Parse the schematic's IO-contract insign annotations (`#cell`
|
|
788
|
+
* header, `bus.*` port annotations, `#route_zone` zones) to JSON:
|
|
789
|
+
* `{"cell": ..., "buses": [...], "route_zones": {...}}`.
|
|
790
|
+
*/
|
|
791
|
+
compileIoContractsJson(): string;
|
|
792
|
+
|
|
721
793
|
/**
|
|
722
794
|
* Every region's palette, as a JSON object mapping region name → array of
|
|
723
795
|
* block names (the default region under `"default"`).
|
package/Schematic.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BlockPos } from "./BlockPos.mjs"
|
|
|
3
3
|
import type { BlockState } from "./BlockState.mjs"
|
|
4
4
|
import type { Dimensions } from "./Dimensions.mjs"
|
|
5
5
|
import type { NucleationError } from "./NucleationError.mjs"
|
|
6
|
+
import type { SchematicSplitResult } from "./SchematicSplitResult.mjs"
|
|
6
7
|
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
7
8
|
|
|
8
9
|
|
|
@@ -25,6 +26,15 @@ export class Schematic {
|
|
|
25
26
|
*/
|
|
26
27
|
deepClone(): Schematic;
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Split spatially independent machines while keeping nearby tiny
|
|
31
|
+
* detached parts with their machine. Components at least
|
|
32
|
+
* `min_standalone_blocks` large always remain independent; smaller
|
|
33
|
+
* components attach only directly to a core within `max_air_gap`.
|
|
34
|
+
* Attachment is non-transitive and the operation is lossless.
|
|
35
|
+
*/
|
|
36
|
+
splitConnectedAttachNearby(minStandaloneBlocks: number, maxAirGap: number): SchematicSplitResult;
|
|
37
|
+
|
|
28
38
|
/**
|
|
29
39
|
* The allocated dimensions (width, height, length) of the schematic's
|
|
30
40
|
* bounding box.
|
|
@@ -344,11 +354,27 @@ export class Schematic {
|
|
|
344
354
|
addEntityFromSnbt(snbt: string): void;
|
|
345
355
|
|
|
346
356
|
/**
|
|
347
|
-
* Every
|
|
357
|
+
* Every IN-BOUNDS cell as a JSON array of
|
|
348
358
|
* `{"x", "y", "z", "name", "properties"}` (the old `CBlockArray`).
|
|
359
|
+
* Air cells are materialized too — on a large sparse build this
|
|
360
|
+
* dump is `volume()`-sized and can exhaust wasm memory; renderers
|
|
361
|
+
* and analyzers want `get_non_air_blocks_json`.
|
|
349
362
|
*/
|
|
350
363
|
getAllBlocksJson(): string;
|
|
351
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Every non-air block of ONE named region (a flattened design names
|
|
367
|
+
* one per layer: `inst:{name}`, `bus:{name}`), same JSON shape as
|
|
368
|
+
* `get_all_blocks_json`. Unknown region names error.
|
|
369
|
+
*/
|
|
370
|
+
getRegionNonAirBlocksJson(regionName: string): string;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Every non-air block, same JSON shape as `get_all_blocks_json`.
|
|
374
|
+
* `block_count()`-sized regardless of the bounding volume.
|
|
375
|
+
*/
|
|
376
|
+
getNonAirBlocksJson(): string;
|
|
377
|
+
|
|
352
378
|
/**
|
|
353
379
|
* All blocks within a sub-region (chunk) of the schematic, as the same
|
|
354
380
|
* JSON array shape as `get_all_blocks_json`.
|
|
@@ -507,6 +533,22 @@ export class Schematic {
|
|
|
507
533
|
*/
|
|
508
534
|
setWeVersion(version: number): void;
|
|
509
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Standard embedded source provenance as canonical JSON. Returns an
|
|
538
|
+
* empty string when none is present.
|
|
539
|
+
*/
|
|
540
|
+
provenanceJson(): string;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Validate and set standard embedded source provenance from JSON.
|
|
544
|
+
*/
|
|
545
|
+
setProvenanceJson(json: string): void;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Remove embedded source provenance.
|
|
549
|
+
*/
|
|
550
|
+
clearProvenance(): void;
|
|
551
|
+
|
|
510
552
|
/**
|
|
511
553
|
* Mirror the default region along the X axis (in place). Block
|
|
512
554
|
* orientations, block entities, and entities are mirrored too.
|
|
@@ -718,6 +760,36 @@ export class Schematic {
|
|
|
718
760
|
*/
|
|
719
761
|
compileInsignJson(): string;
|
|
720
762
|
|
|
763
|
+
/**
|
|
764
|
+
* Embed a `CellContract` (JSON) in the schematic's metadata,
|
|
765
|
+
* validating it parses first. The contract is carried through
|
|
766
|
+
* `.schem` save/open and autodetected on open — schematic +
|
|
767
|
+
* contract = one self-describing typed cell.
|
|
768
|
+
*/
|
|
769
|
+
setCellContractJson(json: string): void;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* The contract embedded in the schematic's metadata, as JSON.
|
|
773
|
+
* Errors with `NotFound` when none is embedded, `Parse` when an
|
|
774
|
+
* embedded string exists but is corrupt (loud, never silent).
|
|
775
|
+
*/
|
|
776
|
+
cellContractJson(): string;
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Resolve the schematic's cell contract from its sources in
|
|
780
|
+
* strict precedence — embedded metadata over Insign signs — with
|
|
781
|
+
* loud conflict warnings. Writes `{"contract": ..., "warnings":
|
|
782
|
+
* [...]}`; errors with `NotFound` when no source defines one.
|
|
783
|
+
*/
|
|
784
|
+
resolveCellContractJson(): string;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Parse the schematic's IO-contract insign annotations (`#cell`
|
|
788
|
+
* header, `bus.*` port annotations, `#route_zone` zones) to JSON:
|
|
789
|
+
* `{"cell": ..., "buses": [...], "route_zones": {...}}`.
|
|
790
|
+
*/
|
|
791
|
+
compileIoContractsJson(): string;
|
|
792
|
+
|
|
721
793
|
/**
|
|
722
794
|
* Every region's palette, as a JSON object mapping region name → array of
|
|
723
795
|
* block names (the default region under `"default"`).
|