@auspicion/provident-storeroom-js-wasm 0.0.0-stage → 2.0.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,484 @@
1
+ // **⟶ THE ADDON SLOT — THE MODULE EVERY PART REACHES ITS BINDINGS THROUGH, HELD BY THE REALM AND INSTALLED INTO
2
+ // THIS PART — 2026-11-17** (`D-156` item 1; the loader split's step 3, `docs/L3/wasm-realm/design.md` §5's
3
+ // `artefact.mjs` row: *"`withAddon()` answers the injected bindings: `loadAddon()` gains one arm at its head and the
4
+ // walk is not reached"* — **injected**, *"`adoptModuleContext` is already an injection seam"*).
5
+ //
6
+ // **WHY IT IS A FILE OF ITS OWN, AT THE BYTE.** `withAddon()` reads the module-level slot that `loadAddon()`'s
7
+ // three-rung walk writes, and both of those lived in `artefact.mjs` — whose Node half (`artefact-node.mjs`) carries
8
+ // the three static `node:` imports and therefore **cannot even be LOADED on the arm this split is for**. So the
9
+ // READER and the FORM moved here, and the WALK stayed there: this file carries **no `node:` specifier and no import
10
+ // of `artefact-node.mjs`**, and the host-borne arm reaches it only through the two setters below.
11
+ //
12
+ // **WHAT MOVED, AND FROM WHERE — BYTE FOR BYTE**: `addonLoadMessage()` · `withAddon()` · `spellDottedContainer()` ·
13
+ // `boundaryReject()` from `artefact.mjs`, and `generatorFilePathUnreachable()` from `artefact-node.mjs` (it is the
14
+ // generator's own rendering of ONE subject, which is a form and not a host fact — and it is the reason
15
+ // `artefact-node.mjs` now imports THIS file rather than the other way round). **THEIR ANSWERS DO NOT MOVE.**
16
+ // **ONE TOKEN MOVED AND IT IS NAMED:** `boundaryReject`'s absent-generator arm rendered
17
+ // `generatorFilePathUnreachable(ADDON_PATH)`; `ADDON_PATH` is the host-borne arm's own live path, so the arm is read
18
+ // through `artefactPath()` below, which answers **that same live path** on the Node arm and the arm's own declared
19
+ // absence on the injected one. **THE NODE ARM'S STRING IS BYTE-IDENTICAL**; what changed is that this file no longer
20
+ // has to import the half that owns the path to render it.
21
+ //
22
+ // **THE TWO ARMS, AND THE ONE THING THAT MUST NOT MOVE.**
23
+ //
24
+ // * **THE HOST-BORNE ARM (Node)** installs a LOAD PATH, `installAddonPath({ loadAddon, absentSubject,
25
+ // artefactPath })`, from `artefact.mjs` at ITS evaluation. The first `withAddon()` (or `addonLoadMessage()`)
26
+ // runs that path — the three-rung walk — and copies the walk's own answer into the slot: **the walk still
27
+ // happens at the first construction and never at load**, so this entry still reads no file at its evaluation,
28
+ // and the mismatch arm the walk answers with is carried beside the module (`addonArm`).
29
+ // * **THE INJECTED ARM (WebAssembly)** installs the BINDINGS, `installAddon(bindings)`, from the second realm's
30
+ // entry, which takes them from its own caller. **THERE IS NO WALK AND NO HOST THERE** — the bindings are handed
31
+ // in, so `loadAddon()` is a no-op and the slot is filled by the one setter.
32
+ //
33
+ // **★ AND `withAddon()`'S OBSERVABLE IS THE SAME ON BOTH ARMS, WHICH IS THE WHOLE OF THE CLAUSE**: with no module
34
+ // in the slot it answers **the surface's declared absent-artefact form** — `FilePathUnreachable`, thrown in the
35
+ // entry's ONE four-member shape (`fail` builds it) — and never a silent store and never a second form. The SUBJECT
36
+ // of that message is the ARM's own: on the Node arm it is the attempt list the walk recorded (one path where one
37
+ // rung was tried, both where both were — `absentSubject()` in `artefact-node.mjs`, unmoved); **on the injected arm
38
+ // there is no path to be absent, so the subject is `'bindings'`** — the name of the one position the injection
39
+ // arrives at — **and that is the arm's own DECLARED absence, rendered by the same generator clause byte for byte**
40
+ // (`'bindings' is not reachable at construction, …`). The design's §8 puts the *status* this arm should answer to
41
+ // the architect and names no ruling; **this file answers the status the surface already declares for the
42
+ // absent-artefact state rather than minting a member of the closed set for a state no clause names** (`DD-40`:
43
+ // nothing here mints a status).
44
+ //
45
+ // **⟶ AND THE INJECTED ARM'S MODULE IS A NAMESPACE OF FREE FUNCTIONS, SO THE READER ANSWERS A DISPATCH TABLE AND
46
+ // THE TWENTY-TWO-ODD RECEIVER-HANDED CALL SITES MOVE ZERO BYTES** (`design.md` §1: *"FREE FUNCTIONS EACH TAKING A
47
+ // HANDLE"*). The parts call `Reflect.apply(entryOf().read, this, args)` and `.call(state.receiver, …)`; on the Node
48
+ // arm the module is a Node-API addon whose entries resolve their store from the receiver's own `STORE_INDEX` row
49
+ // (`facade.rs`'s `store_index_of`), and on this arm the entries are the wasm module's free functions whose FIRST
50
+ // position is that same index. **THE TWO ARE THE SAME DATUM**, so the table is the whole of the difference: each
51
+ // wrapped entry reads the receiver's OWN row (`storeIndexOf` below — `[[GetOwnProperty]]`, never the chain) and
52
+ // prepends it, and a receiver that names no row reaches the wasm frame's class-miss arm, which answers the ONE
53
+ // declared form for a call whose receiver names no live store exactly as the Node arm's does (`design.md` §1 ground
54
+ // 2; `C-W10`). **`state.receiver` KEEPS ITS NAME, ITS VALUE AND ITS MEANING, and `state.handle` is not minted**: one
55
+ // routing datum, and it is the one the parts already read.
56
+ //
57
+ // **AND `delete` → `_delete` AT THAT SAME TABLE** (`wasm-realm.md` §15: the toolchain emits the entry as `_delete`
58
+ // because the published name is a reserved word), so the parts' `entryOf().delete` is spelled as the module's own
59
+ // `_delete` in one place and no site learns a second name. `commitFile` is **ABSENT** from the injected export set
60
+ // (`D-155` item 4; **nineteen of the Node arm's twenty** from 2026-11-19 — *"the Node arm's twenty minus
61
+ // `commitFile`"*, the arithmetic unchanged and its figure re-cut at this sentence), so the table carries no such
62
+ // member and this file mints no stand-in for it: a save that names it on that arm is the design's own declared
63
+ // absence, not a table's omission.
64
+ //
65
+ // **⟶ AND `storeRelease` IS THE NINETEENTH, AND IT JOINS `PASSED_THROUGH_ENTRIES` — 2026-11-19, THE ARCHITECT'S
66
+ // CLOSURE ANSWER, ARM `a`.** **THE TWO SENTENCES THAT STOOD HERE ARE QUOTED BEFORE THEY ARE RETIRED**: *"eighteen of
67
+ // the Node arm's twenty, which is NINETEEN UNTIL 2026-11-19 AND TWENTY FROM THE `storeRelease` LANDING —
68
+ // `facade.rs`'s retirement entry, which has no wasm twin"* and *"AND THE SAME HOLDS OF `storeRelease` ON THIS ARM:
69
+ // `state.mjs`'s `STORE_RETIREMENT` calls it, the injected table carries no such member, and the registry's own
70
+ // `try`/`catch` is what makes that absence SILENT rather than a throwable crossing a finalizer — the arm's declared
71
+ // state is that its table never retires a store (`docs/L1/wasm-realm.md:311`), and nothing here mints a stand-in."*
72
+ // **THE TWIN EXISTS NOW (`bindings/js/src/wasm.rs`'s `storeRelease`), the table CARRIES it, and the registry's
73
+ // `catch` is no longer the arm's whole answer — it is the guard it always was on both arms.** **IT IS A
74
+ // PASSED-THROUGH MEMBER AND NOT A HANDLE-FIRST ONE**, and that is the shape of its position, not a choice: the entry
75
+ // takes THE STORE'S OWN INDEX, which the finalizer hands as its held value, so there is no receiver whose row could
76
+ // be prepended — prepending one would hand the entry a second integer and leave the first as a stranger. **A plain
77
+ // forwarder is therefore the exact table entry**, and `state.mjs`'s callback reaches the module unchanged.
78
+ //
79
+ // **NO `node:` SPECIFIER APPEARS IN THIS FILE AND NONE MAY** — that is the whole of the seam.
80
+
81
+ import { appendOwn, fail } from './refusal.mjs';
82
+ // **⟶ AND THE CLASS SPELLING IS THE TREE'S OWN, 2026-11-17** (`D-157` item 2): `classSpelling` is
83
+ // `class-decision.mjs`'s declared spelling of a value's class, so the class form's message names the class the way
84
+ // every other class refusal in this package names it — one spelling, one home, and no `node:` specifier here.
85
+ import { classSpelling } from './class-decision.mjs';
86
+
87
+ // ---------------------------------------------------------------------------------------------
88
+ // THE SLOT — and the arm's own facts, where the arm has any
89
+ // ---------------------------------------------------------------------------------------------
90
+
91
+ /// **THE MODULE THE READER ANSWERS** — `null` before anything is installed, the walked module's own object on the
92
+ /// host-borne arm, and the dispatch table below on the injected one. **IT IS THE ONE NAME `withAddon` ANSWERS AND
93
+ /// THE ONE NAME `boundaryReject` AND `addonLoadMessage` READ**, exactly as it was in `artefact.mjs`.
94
+ let addon = null;
95
+
96
+ /// **THE MODULE THE DISPATCH TABLE WAS BUILT FROM** — the identity test `installAddon` takes and nothing else. **IT
97
+ /// IS NOT A SECOND ROUTING DATUM**: the route is the receiver's own `STORE_INDEX` row, so no call reads this.
98
+ let installed = null;
99
+
100
+ /// **THE ARM THE LOAD PATH ANSWERED WITH, WHERE THE STATE IS THE VERSION MISMATCH** (`docs/specs/storeroom-publish/
101
+ /// contract.md §1.5` item 2: the arm is TERMINAL and is re-thrown at every later call). **IT IS THE DECLARED FORM ITSELF AND NEVER
102
+ /// A HOST `Error`** (`§1.4` item 1 admits one shape), and on the injected arm there is no version read to reach it
103
+ /// (`design.md` §8: *"`version`'s mismatch arm is **unreachable** on this arm"*), so it is `null` there by
104
+ /// construction and not by an arm test.
105
+ let addonArm = null;
106
+
107
+ /// **THE HOST-BORNE ARM'S OWN FACTS, OR `null` WHERE THE ARM HAS NONE** — the three the walk needs and the form
108
+ /// renders: the walk itself, the absent state's subject from the attempt list, and the artefact path the
109
+ /// boundary's absent-generator arm names. **ONE INSTALLATION, AT THAT ARM'S OWN EVALUATION, AND NOT ONE BYTE OF IT
110
+ /// IS A HOST IMPORT**: a function slot the realm fills is the pattern `class-instrument.mjs` already carries.
111
+ let loadPath = null;
112
+
113
+ /// **THE SUBJECT THE INJECTED ARM'S ABSENT FORM RENDERS** — the one position the bindings arrive at. **IT IS THE
114
+ /// ARM'S OWN DECLARED ABSENCE AND NOT A PATH**: a realm that injects its bindings has no artefact to be absent, and
115
+ /// the case the state covered does not vanish — it becomes *"the factory was handed nothing, or something that is not
116
+ /// the bindings"* (`design.md` §8) — so the form is the surface's and the subject is the arm's.
117
+ const INJECTED_ABSENT_SUBJECT = 'bindings';
118
+
119
+ /// **THE ROW THE STORE'S OWN INDEX IS PUBLISHED ON, NAMED BY THE REGISTERED SYMBOL AND NOT BY A SHARED OBJECT** —
120
+ /// `state.mjs`'s `STORE_INDEX` (`receiver-and-refusal.md` §1) publishes it on the instance and `facade.rs`'s
121
+ /// `store_index_of` reads it from the receiver; this file reads the SAME row, so it spells the SAME registered key.
122
+ /// **`Symbol.for` IS THE DECLARED MECHANISM AND NOT A SECOND HOME**: the two sides never share an object, and a
123
+ /// registered symbol is the only spelling both can name without one holding the other's reference (the clause
124
+ /// `state.mjs` already states at its own byte).
125
+ const STORE_INDEX = Symbol.for('provident-storeroom.storeIndex');
126
+
127
+ /// **THE ONE SETTER FOR THE HOST-BORNE ARM'S LOAD PATH**, called at `artefact.mjs`'s own evaluation. **A RECORD
128
+ /// MISSING ONE OF ITS THREE FUNCTIONS IS REFUSED** rather than held: the failure would otherwise be a host
129
+ /// `TypeError` at the first construction — a second failure form on a path `DD-12` allows none — so it is a
130
+ /// load-time programming error and a plain `TypeError` on purpose, exactly as `installClassInstrument` refuses a
131
+ /// non-function. **IT MINTS NO STATUS AND CAN REACH NO CALLER** (`DD-40`): its only caller is a module's evaluation.
132
+ export function installAddonPath(path) {
133
+ if (path === null || typeof path !== 'object'
134
+ || typeof path.loadAddon !== 'function'
135
+ || typeof path.absentSubject !== 'function'
136
+ || typeof path.artefactPath !== 'function') {
137
+ throw new TypeError('installAddonPath: the load path is an object carrying loadAddon, absentSubject and artefactPath');
138
+ }
139
+ loadPath = path;
140
+ }
141
+
142
+ /// **THE ONE SETTER FOR THE MODULE, CALLED ONCE BY THE INJECTED ARM'S ENTRY** (`storeCreate(bindings, cfg)`).
143
+ ///
144
+ /// **THE DOMAIN IS AN OBJECT CARRYING A CALLABLE OWN `storeCreate`, AND EVERYTHING ELSE IS REFUSED IN THE DECLARED
145
+ /// FORM** — `null`, `undefined`, a primitive, a function, and an object that carries no such member. The class test
146
+ /// is an OWN DATA read (`getOwnPropertyDescriptor`), so a caller's own accessor is never invoked and no trap runs on
147
+ /// this path (`A76`; `DD-34`'s discipline one layer over). **THE REFUSAL IS THE SAME ONE `withAddon()` ANSWERS WITH
148
+ /// AN EMPTY SLOT** — `FilePathUnreachable` in the four-member form, the subject the arm declares — because *"the
149
+ /// factory was handed nothing, or something that is not the bindings"* is the state `design.md` §8 names and no
150
+ /// ruling gives it a member of its own; **the slot is left EMPTY by the refusal**, so every later call answers the
151
+ /// same form rather than a half-installed table.
152
+ ///
153
+ /// **A REPEATED INSTALL OF THE SAME MODULE REBUILDS NOTHING**: the table is built once per module object, so the
154
+ /// answer a part takes at `entryOf()` is stable for the life of the construction. (A host that hands a SECOND
155
+ /// module to a second `storeCreate` replaces the table; the two arms' stores are the crate's `INSTANCES` rows and
156
+ /// the row a receiver carries is its own, so the table's identity is not what routes a call.)
157
+ export function installAddon(module) {
158
+ if (isBindings(module) !== true) {
159
+ addon = null;
160
+ installed = null;
161
+ // **⟶ AND A HOST THAT HANDS THE FACTORY NOTHING IS REFUSED IN THE PACKAGE'S OWN CLASS FORM — `D-157` ITEM 2, THE
162
+ // ARCHITECT'S *"2 - d"*.** **THE FORM IS `PAR-JS-12`'S ONE `TypeError`: its `status` MEMBER IS ABSENT and its string
163
+ // `message` is required** — the shape the commit position's own class refusal takes, and the shape this file's
164
+ // `installAddonPath` already throws two functions above.
165
+ //
166
+ // **WHY NOT A STORE STATUS, SAID AT THE BYTE INSTEAD OF LEFT TO A READER.** The state is *"the injected arm's factory
167
+ // was called without its bindings, or with an object that is not them"*, and **NOTHING OF THE STORE IS IN IT**: no
168
+ // instance exists, no verb is reached, no op is minted and no journal is touched. **A member of the closed set would
169
+ // name a state the STORE cannot be in**, and the corpus keeps the store's set for the store's states — the one
170
+ // package-produced member it carries (rank `23` `ListenerBodyRejected`) is a failure of a delivery the STORE's own
171
+ // pass asked for, which is not this. **It is a CALL-SHAPE error and `PAR-JS-12` is the corpus's form for exactly that**,
172
+ // read with `D-154`'s second realm and `D-155` item 3's injected instance (the factory's first position is the
173
+ // architect's own spelling, so its misuse is the host's and not a store state).
174
+ //
175
+ // **AND THE SLOT IS STILL LEFT EMPTY BY THE REFUSAL**, so every later call answers the same class form rather than a
176
+ // half-installed table.
177
+ throw new TypeError(
178
+ `storeCreate: the injected bindings are ${classSpelling(module)}, and the first position is the WebAssembly module's own namespace object`,
179
+ );
180
+ }
181
+ if (installed === module) return;
182
+ installed = module;
183
+ addon = dispatchTable(module);
184
+ }
185
+
186
+ // ---------------------------------------------------------------------------------------------
187
+ // THE ARM'S OWN FACTS, READ THROUGH THE SLOT — the three names the moved functions spell
188
+ // ---------------------------------------------------------------------------------------------
189
+
190
+ /// **THE ARM'S WALK, WHERE IT HAS ONE.** Both moved readers call this at their head, so the walk still happens at
191
+ /// the first construction and `loadAddon()`'s body — and its three-rung order, its mismatch arm and its idempotence —
192
+ /// is unmoved in `artefact-node.mjs`. **THE WALK'S OWN ANSWER IS COPIED INTO THE SLOT HERE AND NOWHERE ELSE**: the
193
+ /// host-borne arm hands `{ addon, arm }` back (its own two module-level slots, read as live bindings), so the reader
194
+ /// below never imports the half that walks.
195
+ function loadAddon() {
196
+ if (loadPath === null) return;
197
+ const answered = loadPath.loadAddon();
198
+ addon = answered.addon;
199
+ addonArm = answered.arm;
200
+ }
201
+
202
+ /// **THE SUBJECT THE DECLARED ABSENT FORM RENDERS** — the attempt list on the host-borne arm (the paths that were
203
+ /// tried, in the order they were tried) and the arm's own declared absence on the injected one.
204
+ function absentSubject() {
205
+ return loadPath === null ? INJECTED_ABSENT_SUBJECT : loadPath.absentSubject();
206
+ }
207
+
208
+ /// **THE PATH THE BOUNDARY'S ABSENT-GENERATOR ARM NAMES** — the host-borne arm's own artefact path, live, and the
209
+ /// injected arm's declared absence where no path exists. **IT REPLACES THE SINGLE TOKEN `ADDON_PATH` THE MOVED
210
+ /// `boundaryReject` CARRIED AND IT ANSWERS THE SAME BYTES ON THE ARM THAT HAS A PATH.**
211
+ function artefactPath() {
212
+ return loadPath === null ? INJECTED_ABSENT_SUBJECT : loadPath.artefactPath();
213
+ }
214
+
215
+ // ---------------------------------------------------------------------------------------------
216
+ // **THE DECLARED ABSENT FORM'S MESSAGE** — moved BYTE FOR BYTE from `artefact.mjs`, whose own clause stands above it
217
+ // there; the four lines of its body are unmoved and the two names it reads (`loadAddon`, `absentSubject`) are this
218
+ // file's own. **THE ONE THING ADDED HERE IS THE ARM'S SUBJECT, STATED AT ITS BYTE ABOVE**: `absentSubject()`
219
+ // answers the attempt list on the host-borne arm and `'bindings'` on the injected one.
220
+ // ---------------------------------------------------------------------------------------------
221
+ /// **THE DECLARED ABSENT FORM'S MESSAGE** — the store's own generator's string for `FilePathUnreachable`
222
+ /// at the subject `absentSubject()` fixes (`docs/specs/storeroom-publish/contract.md §1.4` items 1–2). **WHERE AN ARTEFACT LOADED FAR ENOUGH TO
223
+ /// CARRY THE GENERATOR, THE GENERATOR AUTHORS THE STRING** (`A75`: *"reached through the addon where it
224
+ /// loaded far enough to carry the generator"*) — `addon.errorMessage` at each subject in turn.
225
+ /// **WHERE THE GENERATOR IS UNREACHABLE — which is exactly this state, since the artefact that carries it
226
+ /// is the thing that failed to load — THE STRING IS THE GENERATOR'S OWN RENDERING OF THAT SUBJECT,
227
+ /// REPRODUCED BYTE-FOR-BYTE** (`JS-3`'s fix) and **NOT hand-authored** (`docs/specs/storeroom-js/surface.md §2.5` item 2).
228
+ function addonLoadMessage() {
229
+ loadAddon();
230
+ const subject = absentSubject();
231
+ if (addon !== null && typeof addon.errorMessage === 'function') {
232
+ return addon.errorMessage('FilePathUnreachable', subject);
233
+ }
234
+ // THE GENERATOR'S OWN RENDERING OF THIS SUBJECT, where it could not be reached (`JS-3`'s fix).
235
+ return generatorFilePathUnreachable(subject);
236
+ }
237
+
238
+ /// **THE STORE'S GENERATOR'S OWN RENDERING OF `FilePathUnreachable` FOR A SUBJECT** — the ONE row this file
239
+ /// reproduces, and it reproduces it because there is exactly ONE state in which the generator cannot be
240
+ /// reached at all: the state in which the generator is the thing that failed to load. **IT IS NEVER A
241
+ /// HAND-AUTHORED MESSAGE** (`docs/specs/storeroom-js/surface.md §2.5` item 2): it is the generator's clause, subject slot included, rendered
242
+ /// byte-for-byte — see the derivation above this block.
243
+ ///
244
+ /// **⟶ AND ITS HOME IS THIS FILE FROM 2026-11-17, NOT THE NODE HALF'S**: its three readers were `mismatchArmMessage`
245
+ /// (which stays in `artefact-node.mjs` and imports it from HERE), `addonLoadMessage` below and `boundaryReject`'s
246
+ /// absent-generator arm beside it — **two of the three are realm-neutral, and a form is the surface's and not the
247
+ /// host's.** `artefact-node.mjs` importing this file closes no cycle: nothing here imports that half.
248
+ export function generatorFilePathUnreachable(subject) {
249
+ return `'${subject}' is not reachable at construction, the path must exist or the application must be able to write it`;
250
+ }
251
+
252
+ /// **⟶ `withAddon()` — THE NAMED MODULE, OR THE DECLARED FORM** — moved BYTE FOR BYTE from `artefact.mjs`.
253
+ ///
254
+ /// **ITS BODY IS UNMOVED AND THAT IS THE POINT**: `loadAddon()` at its head (a no-op on the arm that injects), the
255
+ /// mismatch arm FIRST (the load path's own declared answer, terminal by construction), then the absent arm, then the
256
+ /// module. **ON THE INJECTED ARM THE FIRST LINE DOES NOTHING AND THE SECOND IS UNREACHABLE** (`design.md` §8), so
257
+ /// what a part receives there is the slot's dispatch table; on the host-borne arm it is the walked module itself
258
+ /// and the twenty-odd receiver-handed sites reach a Node-API entry exactly as they did.
259
+ export function withAddon() {
260
+ loadAddon();
261
+ // **THE MISMATCH ARM STANDS FIRST, AND IT IS THE ARM THE LOAD PATH ITSELF ANSWERED WITH** (`docs/specs/storeroom-publish/contract.md §1.5` item 2;
262
+ // `PUB-R-3`): where the version read refused, THE WALK IS OVER — no rung-two attempt is made here and none
263
+ // is made at any later call, and the value re-thrown is the arm's own `{status, message}` and not a state
264
+ // re-derived from a path list.
265
+ if (addonArm !== null) fail(addonArm);
266
+ if (addon === null) {
267
+ // **⟶ AND THE EMPTY SLOT IS TWO STATES AND NOT ONE — `D-157` ITEM 2, THE ARCHITECT'S *"2 - d"*, AT ITS BYTE.**
268
+ // **A LOAD PATH STANDS ONLY ON THE HOST-BORNE ARM** (`installAddonPath`, called once by `index.mjs`), **so the two
269
+ // cases are told apart by this file's own fact and by no flag**: where a path stands and the walk still answered
270
+ // nothing, **the artefact is absent and the surface's declared absent form is the answer** (`FilePathUnreachable`,
271
+ // rendered by the store's generator, with the attempt list as its subject — `PUB-R-3`'s own arm, UNMOVED). **Where
272
+ // NO path stands, this is the injected arm and no bindings were ever installed**: *"the factory was handed nothing"*,
273
+ // which is a CALL-SHAPE error and **not a store state** — **`PAR-JS-12`'s one `TypeError`, its `status` member
274
+ // ABSENT and a string `message` required**, the same form `installAddon` throws one screen above and the same form
275
+ // the commit position's class refusal takes. **IT IS THE CORRECT ANSWER FOR THE STATE AND NOT A NARROWING OF THE
276
+ // DECLARED ONE**: nothing of the store exists to be absent, so `FilePathUnreachable` *"would name a file path that was
277
+ // never sought"* (`D-157` item 2's ground).
278
+ if (loadPath === null) {
279
+ throw new TypeError(
280
+ 'storeCreate: no bindings are installed, and the first position is the WebAssembly module\'s own namespace object',
281
+ );
282
+ }
283
+ fail({ status: 'FilePathUnreachable', message: addonLoadMessage() });
284
+ }
285
+ return addon;
286
+ }
287
+
288
+ // ---------------------------------------------------------------------------------------------
289
+ // THE DISPATCH TABLE — **THE ONE PLACE THE TWO ARMS' CALLING CONVENTIONS DIFFER**, built once per installed module
290
+ // ---------------------------------------------------------------------------------------------
291
+
292
+ /// **THE FIFTEEN ENTRIES THAT TAKE THE HANDLE FIRST** (`design.md` §1's table, read at the crate's own export set:
293
+ /// the instance's fifteen members are the fifteen entries, `wasm-realm.md` §15). **THE NAMES ARE THE PACKAGE'S OWN
294
+ /// MEMBER NAMES**, because the parts spell them: `entryOf().read`, `addon_.listen`, `addon_.register` and the rest.
295
+ const HANDLE_FIRST_ENTRIES = [
296
+ 'read', 'readLiteral', 'readTiered', 'write', 'delete', 'rollback', 'listen', 'unlisten', 'removeListener',
297
+ 'exportImage', 'saveSucceeded', 'saveFailed', 'restoreMark', 'journalMark', 'register',
298
+ ];
299
+
300
+ /// **THE MODULE'S OWN SPELLING WHERE IT DIFFERS FROM THE MEMBER'S** — `delete` is a reserved word, so the toolchain
301
+ /// publishes that entry as `_delete` (`wasm-realm.md` §15's measured line). **ONE ROW, ONE PLACE, AND NO CALL SITE
302
+ /// LEARNS A SECOND NAME.**
303
+ const MODULE_SPELLING = { delete: '_delete' };
304
+
305
+ /// **THE FOUR ENTRIES THAT TAKE NO HANDLE AND CROSS AS THEY ARE** — the construction (`storeCreate`, whose one
306
+ /// position is the encoded config and whose answer is the handle), the version read, the store's generator, **and,
307
+ /// ⟶ FROM 2026-11-19, THE RETIREMENT: `storeRelease(storeIndex)`** (`bindings/js/src/wasm.rs`; `D-171`; the
308
+ /// architect's closure answer, arm `a`). **THE RELEASE IS NOT A HANDLE-FIRST MEMBER AND THAT IS ITS POSITION AND
309
+ /// NOT ITS CONVENIENCE**: the one caller that exists is `state.mjs`'s `STORE_RETIREMENT`, whose held value is THE
310
+ /// STORE'S OWN INDEX — a finalizer has no receiver to be called on and may not hold the store — so the integer the
311
+ /// callback hands IS the entry's first real position, and prepending a receiver's row would hand it a second one.
312
+ /// **`passedThroughEntry` is therefore the whole of what this member needs: no row is read, no argument is added,
313
+ /// and the release reaches the module with the bytes the finalizer passed it.** **THE NODE ARM MOVES NO BYTE**:
314
+ /// `withAddon()` there answers the walked module itself, so this table is not on that arm's path at all.
315
+ const PASSED_THROUGH_ENTRIES = ['storeCreate', 'version', 'errorMessage', 'storeRelease'];
316
+
317
+ /// **THE TABLE AN INSTALLED MODULE IS READ THROUGH.** Each handle-first member becomes a function that takes the
318
+ /// positions the PARTS hand it (`(address, tier)` and so on) and calls the module's free function with the
319
+ /// receiver's own index prepended; each passed-through member becomes a plain forwarder. **A MEMBER THE MODULE DOES
320
+ /// NOT CARRY IS NOT MINTED** — the table is the module's own reachable set, so an entry the injected arm does not
321
+ /// export (today: `commitFile`, `D-155` item 4) has no stand-in here and a call naming it is that entry's declared
322
+ /// absence rather than this file's invention.
323
+ function dispatchTable(bindings) {
324
+ const table = {};
325
+ for (let i = 0; i < HANDLE_FIRST_ENTRIES.length; i += 1) {
326
+ const name = HANDLE_FIRST_ENTRIES[i];
327
+ const spelled = MODULE_SPELLING[name] === undefined ? name : MODULE_SPELLING[name];
328
+ const member = ownMember(bindings, spelled);
329
+ if (typeof member !== 'function') continue;
330
+ defineEntry(table, name, handleFirstEntry(member));
331
+ }
332
+ for (let i = 0; i < PASSED_THROUGH_ENTRIES.length; i += 1) {
333
+ const name = PASSED_THROUGH_ENTRIES[i];
334
+ const member = ownMember(bindings, name);
335
+ if (typeof member !== 'function') continue;
336
+ defineEntry(table, name, passedThroughEntry(member));
337
+ }
338
+ return table;
339
+ }
340
+
341
+ /// **ONE HANDLE-FIRST ENTRY, WRAPPED** — the receiver's own index at the FIRST position, then the caller's positions
342
+ /// in their own order. **THE LIST IS FRESH AND DENSE AND BUILT BY `appendOwn`** (the design's `withHandle` idiom,
343
+ /// `design.md` §1): no caller's array is mutated, no `Array.prototype` member is taken, and `Reflect.apply`'s
344
+ /// by-index guarantee is kept. **`this` IS DELIBERATELY NOT PASSED ON**: the module's entries are free functions that
345
+ /// ignore a receiver, and the handle they read is the FIRST POSITION.
346
+ function handleFirstEntry(member) {
347
+ return function handleFirstCall() {
348
+ const args = [];
349
+ appendOwn(args, storeIndexOf(this));
350
+ for (let i = 0; i < arguments.length; i += 1) appendOwn(args, arguments[i]);
351
+ return Reflect.apply(member, undefined, args);
352
+ };
353
+ }
354
+
355
+ /// **ONE PASSED-THROUGH ENTRY, FORWARDED** — the positions as the caller supplied them and nothing added, on the
356
+ /// same fresh dense list. `addon_.storeCreate(encoded)` reaches the module's own construction and answers the handle
357
+ /// the instance publishes; `addon_.errorMessage(status, subject)` reaches the store's generator and answers a string.
358
+ function passedThroughEntry(member) {
359
+ return function passedThroughCall() {
360
+ const args = [];
361
+ for (let i = 0; i < arguments.length; i += 1) appendOwn(args, arguments[i]);
362
+ return Reflect.apply(member, undefined, args);
363
+ };
364
+ }
365
+
366
+ /// **THE RECEIVER'S OWN STORE INDEX** — the SAME row the Node-API frame reads, taken here by
367
+ /// `[[GetOwnProperty]]` and never through the chain (`D-35`'s read half), so a caller's prototype cannot answer a
368
+ /// handle this package did not publish. **EVERY VALUE THAT IS NOT AN OBJECT NAMING THAT ROW ANSWERS `undefined`** —
369
+ /// a detached call, a clone (which carries no row, the row being non-enumerable), a foreign object and a primitive
370
+ /// alike — and the wasm frame's class-miss arm answers those with the ONE declared form, exactly as the Node arm's
371
+ /// does (`design.md` §1 ground 2; `no_instance_at`).
372
+ function storeIndexOf(receiver) {
373
+ if (receiver === null || receiver === undefined) return undefined;
374
+ if (typeof receiver !== 'object' && typeof receiver !== 'function') return undefined;
375
+ return ownMember(receiver, STORE_INDEX);
376
+ }
377
+
378
+ /// **AN OWN DATA MEMBER OF A HANDED VALUE, READ OR NOT AT ALL** — `[[GetOwnProperty]]`'s answer with no chain and no
379
+ /// conversion (`D-35`; the reading `refusal.mjs`, `state.mjs` and the kernel take). It is this file's own copy of the
380
+ /// one three-line read it needs, taken rather than imported so that the slot imports no part and closes no cycle.
381
+ function ownMember(value, name) {
382
+ if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return undefined;
383
+ const descriptor = Object.getOwnPropertyDescriptor(value, name);
384
+ if (descriptor === undefined || !Object.hasOwn(descriptor, 'value')) return undefined;
385
+ return descriptor.value;
386
+ }
387
+
388
+ /// **ONE TABLE MEMBER, DEFINED AND NEVER SET** — `[[Set]]` walks the chain and an own accessor at this name on a
389
+ /// caller's `Object.prototype` would turn a lawful construction into a raw host `TypeError` (`D-35`; the device the
390
+ /// entry's own `durable_without_path` member takes).
391
+ function defineEntry(table, name, entry) {
392
+ Object.defineProperty(table, name, { value: entry, writable: true, enumerable: true, configurable: true });
393
+ }
394
+
395
+ /// **WHETHER A HANDED VALUE IS THE BINDINGS** — an object carrying a callable OWN data `storeCreate`, read by
396
+ /// descriptor so no caller's accessor runs and no trap is invoked (`A76`'s class-first discipline, one layer over).
397
+ function isBindings(module) {
398
+ return module !== null && typeof module === 'object' && typeof ownMember(module, 'storeCreate') === 'function';
399
+ }
400
+
401
+ // ---------------------------------------------------------------------------------------------
402
+ // THE BOUNDARY'S OWN REFUSAL — moved from `artefact.mjs`, its bytes unmoved but for the one token named at the head
403
+ // of this file
404
+ // ---------------------------------------------------------------------------------------------
405
+
406
+ /// **`A76`'S VERBOSE REJECTION, AT THE PACKAGE'S OWN EDGE** — used where the refusal is the BOUNDARY's own:
407
+ /// a class the walk rejects BEFORE any verb is called, and whose carrier the store's own tables do not
408
+ /// declare. **THE MESSAGE NAMES THE FAILING TARGET AND WHY.** The target is rendered by the **STORE'S OWN
409
+ /// GENERATOR** — reached through the addon's `errorMessage`, so the message is never hand-authored here
410
+ /// (`docs/specs/storeroom-js/surface.md §2.5` item 2) — and the clause the ruling requires beside it is the CLASS that failed, plus the
411
+ /// POSITION where the carrier declares one. **THE STATUS IS NEVER MINTED** (`DD-40`): it is the member of
412
+ /// the store's closed set that the crossing's own table declares for the row the class falls under, and it
413
+ /// is passed as an argument at each site rather than chosen here.
414
+ /// **AND NO SECOND FORM EXISTS** (`A76`'s reach, verbatim: *"it does NOT license a SECOND failure form"*):
415
+ /// the rejection travels inside the one `{status, message}` and never as a raw host error — **which is why
416
+ /// NOTHING on this path coerces the value: no `Number(...)`, no `String(...)`, no `valueOf`, no
417
+ /// `Symbol.toPrimitive` and no trap is ever invoked, so no host `TypeError` can be raised from this frame
418
+ /// in the first place.**
419
+ ///
420
+ /// **⟶ AND THE FAILING SEGMENT'S CONTAINER IS HANDED TO THE GENERATOR'S OWN `<container>` SLOT, ADDED
421
+ /// 2026-10-17 (`§2.5` item 5 (a)–(b) AND ITS `CF-3` AUTHORITY SPLIT; `docs/specs/storeroom-native/contract.md`
422
+ /// §8.2's `MessageArgs.container`, *"the container or node the mismatch was found in: `''` for the register,
423
+ /// a dotted path otherwise"*).** **THE DEFECT IT CLOSES, NAMED: the two-slot route filled `segment` and
424
+ /// `path` ALONE, so `container` took its default and PART ONE READ *"the number 1.5 is not a legal address
425
+ /// segment in `''`"* — a FALSE container — while PART TWO appended *"in 'a'"* and the store's own bytes for
426
+ /// that same input are `the number 1.5 is not a legal address segment in 'a'` (`src/store.rs`'s `listen`
427
+ /// arm, whose container is the prefix `['a']`; `src/error.rs`'s `malformed_segment`).** **TWO CONTAINERS
428
+ /// STOOD, ONE OF THEM FALSE; ONE STANDS NOW AND IT IS THE TRUE ONE.** **`container` is the failing
429
+ /// segment's OWN PREFIX — the store's own `dotted_address` spelling of it — and `undefined` at every site
430
+ /// that declares none, where the slot is left at its default and THE GENERATOR'S OWN BYTES ARE UNMOVED**
431
+ /// (the two-argument `errorMessage(code, subject)` call included).
432
+ ///
433
+ /// **⟶ AND THE DOTTED SPELLING TAKES NOTHING FROM A MUTABLE PROTOTYPE FROM 2026-10-24** (`contract.md §2.1`'s
434
+ /// clause of this date on `F7-1`, items `(2b)`'s row `40` and `(10d)`): the as-built limb was
435
+ /// `container.map((segment) => String(segment)).join('.')` — `Array.prototype.map` and `Array.prototype.join`
436
+ /// taken off a MUTABLE PROTOTYPE on a REFUSAL path — so a caller's `map` answering a string made the next
437
+ /// `.join` throw a raw host `TypeError` out of a refusal (`§2.5` item 5 (e) allows no second form), and a
438
+ /// caller's `join` answering a marker wrote that marker into the store's own `<container>` slot as
439
+ /// `in 'OPMARK'`. **`spellDottedContainer` below is item `(1c)(i)`'s local loop**; the separator, the bare
440
+ /// spellings and the absent-container default are unmoved.
441
+ function spellDottedContainer(container) {
442
+ let spelled = '';
443
+ for (let i = 0; i < container.length; i += 1) {
444
+ spelled += i === 0 ? String(container[i]) : `.${String(container[i])}`;
445
+ }
446
+ return spelled;
447
+ }
448
+
449
+ /// **⟶ AND ONE APPENDED FIFTH PARAMETER IS THE ARM TOKEN, ADDED 2026-11-01 (`D-98` item 4; `C-7`/`C-12`;
450
+ /// §3.2, §3.7).** `boundaryReject(status, subject, clause, container, token)` — **POSITIONS 1–4 ARE UNMOVED, so
451
+ /// every one of the `27` existing call sites is BYTE-IDENTICAL**, and the token is supplied by the four
452
+ /// cross-kind arms alone.
453
+ ///
454
+ /// **WHAT IT IS, EXACTLY: A CLOSED ARM TOKEN AND NEVER TEXT.** The one token this correction requires is
455
+ /// `'handle'`. It is **not** a message, a clause, a spelling or a member name the store will print: the store
456
+ /// renders ITS OWN WORDS from the flag the token sets (`src/error.rs`'s two qualified branches, §3.3), and **an
457
+ /// unknown token leaves the slot absent, so the ordinary rendering stands — which is the two-argument call's
458
+ /// bytes.** **NO CALLER-SUPPLIED TEXT CAN ENTER A GENERATED SENTENCE** (`surface.md §2.5` item 2, `DD-52`).
459
+ ///
460
+ /// **WHY A TOKEN AND NOT A BETTER CONTAINER** (§3.2 (e)–(f), refused there on two measured grounds): no container
461
+ /// repairs a DOMAIN claim, `Some('')` is already occupied by genuine register-level refusals, and a sentinel
462
+ /// spelling would be **an identity carried by a spelling** — exactly the seam `D-22` deleted by name. **The
463
+ /// qualified arm prints NO `<CONTAINER>` slot at all**, which is why the fourth position is passed `undefined`
464
+ /// ON PURPOSE at those four sites: it is a DECLARATION and not an omission (§3.4).
465
+ export function boundaryReject(status, subject, clause, container, token) {
466
+ const addon_ = withAddon();
467
+ if (typeof addon_.errorMessage !== 'function') {
468
+ // An artefact that LOADED but does not carry the generator is not the declared artefact: the state is
469
+ // the declared absent/failed-addon one, and its message is the generator's own rendering reproduced.
470
+ fail({ status: 'FilePathUnreachable', message: generatorFilePathUnreachable(artefactPath()) });
471
+ }
472
+ // **THE CONTAINER IS THE PREFIX'S OWN DOTTED SPELLING AND NOTHING ELSE** (`src/error.rs`'s
473
+ // `dotted_address`: a key bare, an index bare, joined by `.`) — the same reading the store's own
474
+ // `malformed_segment` triggers take, where the container is the segment the mismatch was found in.
475
+ const where = container === undefined ? undefined : spellDottedContainer(container);
476
+ // **THE TOKEN REACHES THE GENERATOR'S APPENDED FOURTH POSITION, AND THE THREE-POSITION AND TWO-POSITION CALLS
477
+ // ARE THE BYTES THEY WERE**: a call that supplies no token takes the branch it always took, so **not one byte
478
+ // of the generator's output moves where no token is supplied** (`facade.rs`'s own `..Default::default()`
479
+ // device, reused at this site).
480
+ const generated = token === undefined
481
+ ? (where === undefined ? addon_.errorMessage(status, subject) : addon_.errorMessage(status, subject, where))
482
+ : addon_.errorMessage(status, subject, where, token);
483
+ fail({ status, message: `${generated}, ${clause}` });
484
+ }