@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.
package/index.mjs ADDED
@@ -0,0 +1,132 @@
1
+ // **⟶ THE SECOND REALM'S ENTRY — `provident-storeroom` FOR A WEBASSEMBLY BUILD — 2026-11-17** (`D-154` item 5;
2
+ // `D-155` item 3; `D-156` item 1; the loader split's last step, `docs/L3/wasm-realm/design.md` §2 and §5).
3
+ //
4
+ // **WHAT THIS FILE IS, IN ONE SENTENCE: THE SAME PACKAGE, WITH ITS BINDINGS HANDED IN INSTEAD OF LOOKED FOR.** The
5
+ // Node arm's entry (`index.mjs`) is a head — five `node:` imports, the two facts it derives from its own
6
+ // `import.meta.url`, the module-context seam and the class instrument — and the body beneath it, which is
7
+ // `src/entry/instance.mjs` and is **ONE copy** (`design.md` §5: *"the shared body — the fifteen members, `deliver`,
8
+ // the kernel glue — is ONE copy"*). **THIS FILE IS THE SECOND HEAD**: it imports that same body verbatim, supplies
9
+ // the class instrument's home and the kernel's reach, and differs from the Node arm in exactly one function — how
10
+ // the module of free functions arrives.
11
+ //
12
+ // **NO `node:` SPECIFIER APPEARS IN THIS FILE, DIRECTLY OR TRANSITIVELY, AND NONE MAY** (`design.md` §2: *"the WASM
13
+ // arm is a second module with **no `node:` specifier at all**, importing the same parts and the same shared
14
+ // instance-building body"*). The transitive set is the seven realm-neutral parts, the three parts this split added
15
+ // (`addon-slot.mjs`, `kernel-loader.mjs`, `instance.mjs`), the five kernel parts, the barrel — and **not
16
+ // `artefact-node.mjs`**, which carries `node:fs`, `node:path` and `node:url` and is the Node arm's alone.
17
+ //
18
+ // **AND IT IS THE ONLY ARM WHOSE BINDINGS ARE INJECTED** (`D-155` item 3: *"the host fetches the bytes and calls
19
+ // `initSync`; the entry imports the glue statically and calls functions"*; `design.md` §2's shape **(A)**, priced
20
+ // there and drawn there): `storeCreate(bindings, cfg)` takes the initialised module at its FIRST position and the
21
+ // caller's config at its second. **THE SPELLING IS THE ARCHITECT'S AND THE SHAPE IS THE DESIGN'S**; the Node arm's
22
+ // `storeCreate(cfg)` is byte-unmoved, one position, one export — the two arms are two modules, which is exactly what
23
+ // `wasm-realm.md §2` row 2's *"closed at one member per build"* means.
24
+ //
25
+ // **WHAT HAPPENS AT THE FIRST POSITION IS ONE SETTER AND NOTHING ELSE**: `installAddon(bindings)` fills the slot
26
+ // every part reads (`addon-slot.mjs`), and then the shared body runs — `storeCreate(cfg)`'s own first act is
27
+ // `withAddon()`, which on this arm answers the dispatch table built over those bindings. **A REFUSED FIRST POSITION
28
+ // IS THE DECLARED ABSENT FORM AND NOT A HOST ERROR**: `installAddon` refuses `null`, `undefined`, a primitive, a
29
+ // function and an object carrying no callable `storeCreate`, throwing `FilePathUnreachable` in the package's one
30
+ // four-member shape, with the subject this arm declares for the state — `'bindings'`, the position that was not
31
+ // handed over (`design.md` §8 names the state and leaves its member to the architect; this entry answers the status
32
+ // the surface already declares for the absent-artefact form rather than minting one).
33
+ //
34
+ // **★ AND THE RECEIVER-HANDED SITES IN THE PARTS MOVE ZERO BYTES, WHICH IS THE WHOLE OF THE FORK'S PRICE.** The
35
+ // package reaches the addon with `Reflect.apply(entryOf().read, this, args)` and `.call(state.receiver, …)`
36
+ // throughout `delivery.mjs`, `constraints.mjs`, `state.mjs` and the body. On this arm the module's entries are
37
+ // **FREE FUNCTIONS TAKING THE HANDLE FIRST** (`design.md` §1), and the handle is the SAME row the Node-API frame
38
+ // reads off the receiver — `STORE_INDEX` (`Symbol.for('provident-storeroom.storeIndex')`), published on the instance
39
+ // by the shared body at its own construction. So `addon-slot.mjs`'s reader answers a table whose members prepend
40
+ // **the receiver's own index**, `state.receiver` keeps its name and its value (the instance object, unmoved), and no
41
+ // call site learns a handle, a second routing datum or a second spelling of `delete` (`delete → _delete` lives in
42
+ // that one table). **`state.handle` IS NOT MINTED.**
43
+ //
44
+ // **THE CLASS INSTRUMENT IS `NOT CHOSEN` ON THIS ARM AND THIS ENTRY INSTALLS NONE — STATED HERE SO NO READER MISTAKES
45
+ // IT FOR A LANDING** (`design.md` §4: *"`util.types.isProxy` has no browser equivalent … Four arms, **priced and
46
+ // none chosen**"*; the choice is the architect's). `class-instrument.mjs`'s predicate therefore answers its declared
47
+ // default — `false` — for every value here, which is **a SILENT LOSS of `DD-34`'s `Proxy` refusal on this arm and
48
+ // nothing else**: the seam is in place, its one setter is one line away, and no byte of any part moves on the day
49
+ // the ruling lands.
50
+ //
51
+ // **AND THE KERNEL'S REACH IS A STATIC IMPORT, WHICH IS WHAT THE DESIGN ASKS FOR ON THIS ARM** (`design.md` §5's
52
+ // `constraints.mjs` row: *"a browser build ships the package, so the laziness has no subject — and an
53
+ // `await import()` would make the first constraint act asynchronous and break `DD-17`"*): `kernel-loader.mjs`'s one
54
+ // slot is filled here with a resolver over the namespace import below, and `constraints.mjs` asks the slot on the
55
+ // first constraint act exactly as it asks it on the Node arm.
56
+ //
57
+ // **TWO THINGS THIS FILE DOES NOT DO, BOTH NAMED BY THE DESIGN RATHER THAN DISCOVERED HERE** (`design.md` §8):
58
+ // **it instantiates nothing** — `initSync` is the HOST's act, and this entry imports the initialised module's
59
+ // namespace and calls functions — and **it has no `version` read**, because there is no `package.json` on this arm to
60
+ // compare against, so the load path's mismatch arm is unreachable here by construction and not by a guard.
61
+ import * as KERNEL from './src/constraint-kernel.mjs';
62
+ import { installAddon } from './src/entry/addon-slot.mjs';
63
+ import { installKernelResolver } from './src/entry/kernel-loader.mjs';
64
+ // **⟶ AND THE CLASS-DECISION INSTRUMENT'S SETTER IS THE SECOND HEAD'S TOO, 2026-11-17 — `D-156` ITEM 1, TAKEN.**
65
+ // **The Node head installs `types.isProxy`; THIS head installs the `structuredClone` probe the ruling chose**, and the
66
+ // seam is the same one-import, one-call shape: `isProxyOf` is the ONE predicate the five parts decide `DD-34`'s
67
+ // refusal with, and **without this line the fork would answer its `false` default for every value — a SILENT LOSS of
68
+ // the refusal, which is exactly what `D-156` forbids.** A value the probe cannot clone is refused; a `Proxy` cannot be
69
+ // cloned at all, so **the refusal fires BEFORE ANY TRAP RUNS**, which is `DD-34`'s whole property.
70
+ import { installClassInstrument } from './src/entry/class-instrument.mjs';
71
+ import { storeCreate as storeCreateInstance } from './src/entry/instance.mjs';
72
+
73
+ // **THE KERNEL'S REACH, INSTALLED AT THIS ENTRY'S OWN EVALUATION** — the barrel is in this module's graph from the
74
+ // start (a browser build ships the package), so the resolver answers the namespace and mints nothing.
75
+ installKernelResolver(() => KERNEL);
76
+ // **⟶ AND THE INSTRUMENT IS INSTALLED AT THIS HEAD'S OWN EVALUATION, BEFORE ANY VERB AND BEFORE ANY PART
77
+ // CLASSIFIES A VALUE** (`D-156` item 1; `docs/L3/wasm-realm/design.md` §4's arm (iv), taken). **A `Proxy` is not
78
+ // serializable — the structured-serialisation algorithm throws `DataCloneError` — so the probe is a detector that
79
+ // RUNS NO TRAP BEFORE THE REFUSAL**, which is the property `DD-34` states and the Node arm keeps with
80
+ // `util.types.isProxy`. **IT DOES DOUBLE DUTY AND THAT IS WHY IT IS THE RIGHT INSTRUMENT HERE**: it is the `Proxy`
81
+ // detector AND the test that a value is clone-compatible at all — `invariant 2`'s domain (*"if it cannot cross IPC
82
+ // it cannot be stored"*) landing one layer earlier. **THE PRICE IS THE DESIGN'S OWN AND IS ACCEPTED: one clone per
83
+ // value on this arm's crossing** (`D-156` item 3 of its unsettled — priced, NOT MEASURED).
84
+ //
85
+ // **AND IT IS A PROBE AND NOT A CARRIER**: the clone's result is DISCARDED, because the crossing's own readers build
86
+ // the store's value from the value itself and `D-156`'s deep-clone law is about what the store HOLDS, not about this
87
+ // call. Nothing here hands a cloned value to any reader.
88
+ //
89
+ // **⟶ AND THE SETTER'S SECOND POSITION IS THIS ARM'S CARRIER ANSWER, WHICH IS `false` — `D-167`, 2026-11-17.**
90
+ // **THE ARCHITECT'S RULING, VERBATIM: *"The clone requirement is for data that has to enter the Rust store.
91
+ // constraints, listeners, and the saveCall do not"*** — and on THIS arm the probe cannot be asked of a carrier at
92
+ // all: **`structuredClone` throws for BOTH a `Proxy` and any object carrying a function** (`D-166` items 1–2,
93
+ // measured: `structuredClone({ saveCall: () => {} })` and `structuredClone(new Proxy({}, {}))` fail identically),
94
+ // **and the carriers the API requires are function-bearing by definition** (`cfg.saveCall`, a listener's
95
+ // `listener`, a constraint's `constraint`). **SO THE DECLARATION IS TAKEN HERE, AT THE BYTE THAT TAKES IT: a
96
+ // `Proxy` at a carrier gate is NOT DETECTED on this arm** — the arm cannot tell one from its lawful carrier, and
97
+ // it chooses the answer that leaves the store constructible over the one that refuses the only store it exists for
98
+ // (`D-154` item 4). **WHAT DOES NOT MOVE IS THE VALUE CROSSING**: the first position above is still the probe, so a
99
+ // `Proxy` handed to a verb as a VALUE is still refused in the declared form with NO TRAP RUN — `DD-34`'s property,
100
+ // kept on the population it is about. **The `false` is a FUNCTION AND NOT AN OMITTED ARGUMENT** on purpose: the
101
+ // setter requires both, so this arm states the answer it takes instead of inheriting a default that means the same
102
+ // thing by accident. The predicate, the declaration and its price are `class-instrument.mjs`'s `isProxyOfCarrier`.
103
+ installClassInstrument((value) => {
104
+ try {
105
+ structuredClone(value);
106
+ return false;
107
+ } catch {
108
+ return true;
109
+ }
110
+ }, () => false);
111
+
112
+ // ---------------------------------------------------------------------------------------------
113
+ // THE SURFACE — `surface.md §2.9` item 1: the ONE value-level name, `storeCreate`, and NOTHING else.
114
+ // ---------------------------------------------------------------------------------------------
115
+
116
+ /// **THE FACTORY, AT TWO POSITIONS — THE BINDINGS FIRST AND THE CONFIG SECOND** (`design.md` §2 shape (A): *"a
117
+ /// factory `storeCreate(bindings, cfg)` in the WASM arm's own module"*; `D-155` item 3's injected instance).
118
+ ///
119
+ /// **THE ORDER OF THE TWO ACTS IS THE CLAUSE**: the bindings are installed FIRST, through the one setter, so a first
120
+ /// position that is not the bindings is refused in the declared absent form **before any byte of the caller's `cfg`
121
+ /// is read** — and where it IS the bindings, the shared body runs and `withAddon()` at its head answers the dispatch
122
+ /// table. **NOTHING IS DECIDED HERE THAT THE SHARED BODY DOES NOT DECIDE**: no `cfg` key is read, no constraint is
123
+ /// walked, no store is constructed and no refusal is minted in this file.
124
+ ///
125
+ /// **AND `installAddon` IS CALLED ONCE PER CONSTRUCTION AND IS IDEMPOTENT FOR ONE MODULE** (`addon-slot.mjs`'s
126
+ /// clause): a host that hands the same initialised module to two constructions builds the table once, and a host
127
+ /// that hands a second module replaces it — the row a receiver carries is its own, so the route is never the table's
128
+ /// identity.
129
+ export function storeCreate(bindings, cfg) {
130
+ installAddon(bindings);
131
+ return storeCreateInstance(cfg);
132
+ }
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@auspicion/provident-storeroom-js-wasm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0",
4
+ "description": "provident-storeroom for a WebAssembly host — the same store, the same package, with its bindings handed in.",
5
+ "type": "module",
6
+ "main": "index.mjs",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "import": "./index.mjs"
12
+ }
13
+ },
14
+ "files": [
15
+ "index.mjs",
16
+ "index.d.ts",
17
+ "storeroom_js_binding.js",
18
+ "storeroom_js_binding_bg.wasm",
19
+ "storeroom_js_binding.d.ts",
20
+ "storeroom_js_binding_bg.wasm.d.ts",
21
+ "src/entry/",
22
+ "src/constraint-kernel.mjs",
23
+ "LICENSE",
24
+ "README.md",
25
+ "BUILD-INFO.txt"
26
+ ],
27
+ "engines": {
28
+ "node": ">=22.12.0"
29
+ },
30
+ "license": "AGPL-3.0",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/LittleKingsguard/Provident-Storeroom.git"
34
+ },
35
+ "homepage": "https://github.com/LittleKingsguard/Provident-Storeroom#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/LittleKingsguard/Provident-Storeroom/issues"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }
@@ -0,0 +1,4 @@
1
+ export { register, remove } from './entry/kernel-registration.mjs';
2
+ export { commit } from './entry/kernel-commit.mjs';
3
+ export { runAttempt } from './entry/kernel-attempt.mjs';
4
+ export { log, report } from './entry/kernel-terminal.mjs';