@coproduct_inc/verify 0.1.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/README.md +119 -0
- package/dist/attestation.d.ts +182 -0
- package/dist/attestation.js +295 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +108 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +69 -0
- package/examples/openclaw-replay.mjs +80 -0
- package/package.json +61 -0
- package/wasm/nodejs/nucleus_wasm.d.ts +199 -0
- package/wasm/nodejs/nucleus_wasm.js +538 -0
- package/wasm/nodejs/nucleus_wasm_bg.wasm +0 -0
- package/wasm/nodejs/nucleus_wasm_bg.wasm.d.ts +23 -0
- package/wasm/nodejs/package.json +9 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/* @ts-self-types="./nucleus_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* **Day 3-4 export**: run the selective-recomputation analyzer.
|
|
5
|
+
*
|
|
6
|
+
* Takes the JSONL chain + a JSON-serialized [`CorrectionEvent`].
|
|
7
|
+
* Returns a [`RecomputationPlan`] serialized as a `JsValue`. The
|
|
8
|
+
* browser orchestrator renders the partition + lets the visitor
|
|
9
|
+
* expand any decision to see its `PreservationProof` or
|
|
10
|
+
* `RecomputationProof` inline.
|
|
11
|
+
* @param {string} chain_jsonl
|
|
12
|
+
* @param {string} correction_json
|
|
13
|
+
* @returns {any}
|
|
14
|
+
*/
|
|
15
|
+
function analyze_correction_event(chain_jsonl, correction_json) {
|
|
16
|
+
const ptr0 = passStringToWasm0(chain_jsonl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
17
|
+
const len0 = WASM_VECTOR_LEN;
|
|
18
|
+
const ptr1 = passStringToWasm0(correction_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
19
|
+
const len1 = WASM_VECTOR_LEN;
|
|
20
|
+
const ret = wasm.analyze_correction_event(ptr0, len0, ptr1, len1);
|
|
21
|
+
if (ret[2]) {
|
|
22
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
23
|
+
}
|
|
24
|
+
return takeFromExternrefTable0(ret[0]);
|
|
25
|
+
}
|
|
26
|
+
exports.analyze_correction_event = analyze_correction_event;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* **Day 3-4 export**: build the dependency graph from a JSONL chain.
|
|
30
|
+
*
|
|
31
|
+
* Returns a [`DependencyGraph`] serialized as a `JsValue` — the JS
|
|
32
|
+
* side gets a plain object with `nodes: Vec<StepNode>` it can
|
|
33
|
+
* visualize without further parsing.
|
|
34
|
+
* @param {string} chain_jsonl
|
|
35
|
+
* @returns {any}
|
|
36
|
+
*/
|
|
37
|
+
function compute_dependency_graph(chain_jsonl) {
|
|
38
|
+
const ptr0 = passStringToWasm0(chain_jsonl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
39
|
+
const len0 = WASM_VECTOR_LEN;
|
|
40
|
+
const ret = wasm.compute_dependency_graph(ptr0, len0);
|
|
41
|
+
if (ret[2]) {
|
|
42
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
43
|
+
}
|
|
44
|
+
return takeFromExternrefTable0(ret[0]);
|
|
45
|
+
}
|
|
46
|
+
exports.compute_dependency_graph = compute_dependency_graph;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* **Day 10 export**: compute the typed savings summary from a
|
|
50
|
+
* recomputation plan + a per-step cost map.
|
|
51
|
+
*
|
|
52
|
+
* `plan_json` is a serialized [`RecomputationPlan`]; `cost_map_json` is
|
|
53
|
+
* `{ step_id: cost_micro_usd, ... }`. Returns:
|
|
54
|
+
* ```json
|
|
55
|
+
* {
|
|
56
|
+
* "total_steps": N,
|
|
57
|
+
* "preserved_steps": M,
|
|
58
|
+
* "recomputed_steps": K,
|
|
59
|
+
* "preservation_ratio": 0.0..=1.0,
|
|
60
|
+
* "baseline_cost_micro_usd": sum-of-all-step-costs,
|
|
61
|
+
* "selective_cost_micro_usd": sum-of-recompute-step-costs,
|
|
62
|
+
* "naive_restart_cost_micro_usd": 2 × baseline (the modeled "start over" worst case),
|
|
63
|
+
* "savings_vs_naive_ratio": 1 - selective / naive_restart
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* Costs are integer micro-USD (per workspace f64-discipline rule —
|
|
68
|
+
* money math stays in integers). The ratio is computed as `f64` only
|
|
69
|
+
* because it's a display-layer value (the page renders `XX.X%`).
|
|
70
|
+
*
|
|
71
|
+
* Steps absent from `cost_map` contribute zero — the JS side should
|
|
72
|
+
* pre-populate every step_id; the missing-key case is a no-op rather
|
|
73
|
+
* than a hard error so a malformed cost map doesn't blow up the
|
|
74
|
+
* browser tab.
|
|
75
|
+
* @param {string} plan_json
|
|
76
|
+
* @param {string} cost_map_json
|
|
77
|
+
* @returns {any}
|
|
78
|
+
*/
|
|
79
|
+
function compute_savings_summary(plan_json, cost_map_json) {
|
|
80
|
+
const ptr0 = passStringToWasm0(plan_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
81
|
+
const len0 = WASM_VECTOR_LEN;
|
|
82
|
+
const ptr1 = passStringToWasm0(cost_map_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
83
|
+
const len1 = WASM_VECTOR_LEN;
|
|
84
|
+
const ret = wasm.compute_savings_summary(ptr0, len0, ptr1, len1);
|
|
85
|
+
if (ret[2]) {
|
|
86
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
87
|
+
}
|
|
88
|
+
return takeFromExternrefTable0(ret[0]);
|
|
89
|
+
}
|
|
90
|
+
exports.compute_savings_summary = compute_savings_summary;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Install a browser-friendly panic hook. The hook routes any wasm-side
|
|
94
|
+
* `panic!` into `console.error`, which means failed assertions in the
|
|
95
|
+
* dependency analysis or signature verification path become visible in
|
|
96
|
+
* the visitor's DevTools instead of an opaque `RuntimeError: unreachable`.
|
|
97
|
+
*
|
|
98
|
+
* Idempotent — calling it more than once is harmless. Browsers should
|
|
99
|
+
* invoke this once on module load.
|
|
100
|
+
*/
|
|
101
|
+
function init() {
|
|
102
|
+
wasm.init();
|
|
103
|
+
}
|
|
104
|
+
exports.init = init;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* **Day 10 export**: parse a raw Claude Code session JSONL (the format
|
|
108
|
+
* Claude Code writes under `~/.claude/projects/.../<UUID>.jsonl`) into
|
|
109
|
+
* a renderable step list.
|
|
110
|
+
*
|
|
111
|
+
* This is the drag-and-drop path: the visitor's browser receives a
|
|
112
|
+
* session log it didn't sign and runs the dependency analyzer against
|
|
113
|
+
* it locally. The mapper produces unsigned [`nucleus_lineage::LineageEdge`]s;
|
|
114
|
+
* `signed = false` is set on the returned [`RenderableChain`] so the UI
|
|
115
|
+
* can label the source ("unsigned — your local session" vs. "signed
|
|
116
|
+
* corpus from coproduct-opensource/nucleus-recompute-corpus").
|
|
117
|
+
*
|
|
118
|
+
* Source-of-truth: the parse + map logic lives in `claude-code-capture`
|
|
119
|
+
* (the same code the server-side capture binary uses). One canonical
|
|
120
|
+
* implementation, shared between native + wasm.
|
|
121
|
+
* @param {string} session_jsonl
|
|
122
|
+
* @returns {any}
|
|
123
|
+
*/
|
|
124
|
+
function parse_claude_code_session(session_jsonl) {
|
|
125
|
+
const ptr0 = passStringToWasm0(session_jsonl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
126
|
+
const len0 = WASM_VECTOR_LEN;
|
|
127
|
+
const ret = wasm.parse_claude_code_session(ptr0, len0);
|
|
128
|
+
if (ret[2]) {
|
|
129
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
130
|
+
}
|
|
131
|
+
return takeFromExternrefTable0(ret[0]);
|
|
132
|
+
}
|
|
133
|
+
exports.parse_claude_code_session = parse_claude_code_session;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* **Day 10 export**: parse a JSONL chain of signed lineage edges into
|
|
137
|
+
* a renderable step list (one [`RenderableStep`] per edge in chain
|
|
138
|
+
* order). The orchestrator on the JS side consumes this directly to
|
|
139
|
+
* render the dependency graph + per-step drawer.
|
|
140
|
+
*
|
|
141
|
+
* Wire format: `chain_jsonl` is one `LineageEdge` per line (the same
|
|
142
|
+
* format `verify_chain_signatures` expects). Signature verification is
|
|
143
|
+
* NOT performed here — call `verify_chain_signatures` first if the
|
|
144
|
+
* chain's provenance matters.
|
|
145
|
+
* @param {string} chain_jsonl
|
|
146
|
+
* @returns {any}
|
|
147
|
+
*/
|
|
148
|
+
function parse_lineage_chain(chain_jsonl) {
|
|
149
|
+
const ptr0 = passStringToWasm0(chain_jsonl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
150
|
+
const len0 = WASM_VECTOR_LEN;
|
|
151
|
+
const ret = wasm.parse_lineage_chain(ptr0, len0);
|
|
152
|
+
if (ret[2]) {
|
|
153
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
154
|
+
}
|
|
155
|
+
return takeFromExternrefTable0(ret[0]);
|
|
156
|
+
}
|
|
157
|
+
exports.parse_lineage_chain = parse_lineage_chain;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* **Offline auction-receipt verifier — the "verify this receipt"
|
|
161
|
+
* button.** Given a signed `AuctionReceipt` JSON + a pinned JWKS
|
|
162
|
+
* document, re-build the canonical envelope, re-hash it (BLAKE3), and
|
|
163
|
+
* Ed25519-verify the signature against the issuer key matched by `kid`
|
|
164
|
+
* — all in the visitor's tab, with zero hub access.
|
|
165
|
+
*
|
|
166
|
+
* Returns a [`ReceiptVerifyReport`] serialized as a `JsValue`:
|
|
167
|
+
* ```json
|
|
168
|
+
* {
|
|
169
|
+
* "ok": true,
|
|
170
|
+
* "reason": null,
|
|
171
|
+
* "auction_id": "...", "issuer_kid": "...", "root_hash_hex": "...",
|
|
172
|
+
* "issued_at_micros": 1717…, "winner_spiffe_id": "spiffe://…",
|
|
173
|
+
* "clearing_price_micro_usd": 250000, "bid_count": 3
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* Never throws on a bad receipt — `ok = false` with a `reason` string
|
|
178
|
+
* is the FAIL path (so the page renders PASS/FAIL rather than a thrown
|
|
179
|
+
* error). A `JsValue` error is only returned if the report itself
|
|
180
|
+
* can't be serialized, which shouldn't happen.
|
|
181
|
+
* @param {string} receipt_json
|
|
182
|
+
* @param {string} jwks_json
|
|
183
|
+
* @returns {any}
|
|
184
|
+
*/
|
|
185
|
+
function verify_auction_receipt(receipt_json, jwks_json) {
|
|
186
|
+
const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
187
|
+
const len0 = WASM_VECTOR_LEN;
|
|
188
|
+
const ptr1 = passStringToWasm0(jwks_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
189
|
+
const len1 = WASM_VECTOR_LEN;
|
|
190
|
+
const ret = wasm.verify_auction_receipt(ptr0, len0, ptr1, len1);
|
|
191
|
+
if (ret[2]) {
|
|
192
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
193
|
+
}
|
|
194
|
+
return takeFromExternrefTable0(ret[0]);
|
|
195
|
+
}
|
|
196
|
+
exports.verify_auction_receipt = verify_auction_receipt;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* **Bet C — the full offline verifier.** Combines the signature +
|
|
200
|
+
* root-hash check ([`verify_auction_receipt`]) with the local
|
|
201
|
+
* clearing-price recomputation ([`verify_clearing_recompute`]) into a
|
|
202
|
+
* single call, so an agent NEVER trusts the hub's price: the wasm
|
|
203
|
+
* recomputes it locally from the signed bids and asserts equality.
|
|
204
|
+
*
|
|
205
|
+
* The drop-in story (`@nucleus/verify`):
|
|
206
|
+
* ```js
|
|
207
|
+
* import { verify } from '@nucleus/verify';
|
|
208
|
+
* const r = await verify(receiptJson, jwksJson);
|
|
209
|
+
* if (!r.ok) throw new Error(r.reason);
|
|
210
|
+
* // r.ok === signature_ok && root_hash_ok && price_recomputed_ok
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* Returns a [`FullVerifyReport`] as a `JsValue`. All prices are `u64`
|
|
214
|
+
* micro-USD (fit JS `Number` / Python `int`); the kernel's internal
|
|
215
|
+
* `u128` math never crosses this boundary.
|
|
216
|
+
* @param {string} receipt_json
|
|
217
|
+
* @param {string} jwks_json
|
|
218
|
+
* @returns {any}
|
|
219
|
+
*/
|
|
220
|
+
function verify_auction_receipt_full(receipt_json, jwks_json) {
|
|
221
|
+
const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
222
|
+
const len0 = WASM_VECTOR_LEN;
|
|
223
|
+
const ptr1 = passStringToWasm0(jwks_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
|
+
const len1 = WASM_VECTOR_LEN;
|
|
225
|
+
const ret = wasm.verify_auction_receipt_full(ptr0, len0, ptr1, len1);
|
|
226
|
+
if (ret[2]) {
|
|
227
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
228
|
+
}
|
|
229
|
+
return takeFromExternrefTable0(ret[0]);
|
|
230
|
+
}
|
|
231
|
+
exports.verify_auction_receipt_full = verify_auction_receipt_full;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Day-1 entry point. Parses a JSONL chain + a JWKS document and runs
|
|
235
|
+
* per-edge Ed25519 signature verification.
|
|
236
|
+
*
|
|
237
|
+
* Wire format:
|
|
238
|
+
* - `chain_jsonl`: one signed [`nucleus_lineage::LineageEdge`] per line.
|
|
239
|
+
* - `jwks_json`: a JSON document with a top-level `{ "keys": [...] }` array,
|
|
240
|
+
* each entry an Ed25519 JWK.
|
|
241
|
+
*
|
|
242
|
+
* Returns a [`VerifyReport`] serialized as a `JsValue` (so the JS side
|
|
243
|
+
* gets a plain object, not a string it has to re-parse). Errors are
|
|
244
|
+
* surfaced as `JsValue` strings — wrap with `wasm_bindgen::throw_str`
|
|
245
|
+
* downstream if richer error types are needed.
|
|
246
|
+
* @param {string} chain_jsonl
|
|
247
|
+
* @param {string} jwks_json
|
|
248
|
+
* @returns {any}
|
|
249
|
+
*/
|
|
250
|
+
function verify_chain_signatures(chain_jsonl, jwks_json) {
|
|
251
|
+
const ptr0 = passStringToWasm0(chain_jsonl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
253
|
+
const ptr1 = passStringToWasm0(jwks_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
254
|
+
const len1 = WASM_VECTOR_LEN;
|
|
255
|
+
const ret = wasm.verify_chain_signatures(ptr0, len0, ptr1, len1);
|
|
256
|
+
if (ret[2]) {
|
|
257
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
258
|
+
}
|
|
259
|
+
return takeFromExternrefTable0(ret[0]);
|
|
260
|
+
}
|
|
261
|
+
exports.verify_chain_signatures = verify_chain_signatures;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* **Bet C moat-closer — recompute-only export.** Re-runs the auction
|
|
265
|
+
* clearing locally from the receipt's signed bid set and reports whether
|
|
266
|
+
* the recomputed price matches the receipt's claimed price. Does NOT
|
|
267
|
+
* check the signature — pair with [`verify_auction_receipt`] (or use
|
|
268
|
+
* [`verify_auction_receipt_full`], which does both).
|
|
269
|
+
*
|
|
270
|
+
* Returns a [`recompute::RecomputeReport`] as a `JsValue`:
|
|
271
|
+
* ```json
|
|
272
|
+
* {
|
|
273
|
+
* "recomputed_price_micro_usd": 400000,
|
|
274
|
+
* "receipt_price_micro_usd": 400000,
|
|
275
|
+
* "matches_receipt": true,
|
|
276
|
+
* "path": "vickrey",
|
|
277
|
+
* "recomputed_winner_spiffe_id": "spiffe://…",
|
|
278
|
+
* "winner_matches": true,
|
|
279
|
+
* "pigou_vcg_clearing_micro_usd": null,
|
|
280
|
+
* "reason": null
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
* @param {string} receipt_json
|
|
284
|
+
* @returns {any}
|
|
285
|
+
*/
|
|
286
|
+
function verify_clearing_recompute(receipt_json) {
|
|
287
|
+
const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ret = wasm.verify_clearing_recompute(ptr0, len0);
|
|
290
|
+
if (ret[2]) {
|
|
291
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
+
}
|
|
293
|
+
return takeFromExternrefTable0(ret[0]);
|
|
294
|
+
}
|
|
295
|
+
exports.verify_clearing_recompute = verify_clearing_recompute;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* **Day 3-4 export**: independently verify a single
|
|
299
|
+
* [`PreservationProof`].
|
|
300
|
+
*
|
|
301
|
+
* The browser surfaces this on the demo's "expand any preserved step
|
|
302
|
+
* to see its proof" affordance. The proof is JSON-serializable; the
|
|
303
|
+
* WASM call re-runs the structural check and returns `null` on
|
|
304
|
+
* success or an error string on falsification.
|
|
305
|
+
* @param {string} proof_json
|
|
306
|
+
*/
|
|
307
|
+
function verify_preservation(proof_json) {
|
|
308
|
+
const ptr0 = passStringToWasm0(proof_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ret = wasm.verify_preservation(ptr0, len0);
|
|
311
|
+
if (ret[1]) {
|
|
312
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
exports.verify_preservation = verify_preservation;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* **Day 3-4 export**: independently verify a single
|
|
319
|
+
* [`RecomputationProof`].
|
|
320
|
+
*
|
|
321
|
+
* Same shape as [`verify_preservation`] — re-runs the witness-hash
|
|
322
|
+
* check, returns a `JsValue` error on falsification.
|
|
323
|
+
* @param {string} proof_json
|
|
324
|
+
*/
|
|
325
|
+
function verify_recomputation_necessity(proof_json) {
|
|
326
|
+
const ptr0 = passStringToWasm0(proof_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
327
|
+
const len0 = WASM_VECTOR_LEN;
|
|
328
|
+
const ret = wasm.verify_recomputation_necessity(ptr0, len0);
|
|
329
|
+
if (ret[1]) {
|
|
330
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.verify_recomputation_necessity = verify_recomputation_necessity;
|
|
334
|
+
function __wbg_get_imports() {
|
|
335
|
+
const import0 = {
|
|
336
|
+
__proto__: null,
|
|
337
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
338
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
339
|
+
return ret;
|
|
340
|
+
},
|
|
341
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
342
|
+
const ret = String(arg1);
|
|
343
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
344
|
+
const len1 = WASM_VECTOR_LEN;
|
|
345
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
346
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
347
|
+
},
|
|
348
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
349
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
350
|
+
},
|
|
351
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
352
|
+
let deferred0_0;
|
|
353
|
+
let deferred0_1;
|
|
354
|
+
try {
|
|
355
|
+
deferred0_0 = arg0;
|
|
356
|
+
deferred0_1 = arg1;
|
|
357
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
358
|
+
} finally {
|
|
359
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
__wbg_getRandomValues_8aa3112c6615eef6: function() { return handleError(function (arg0, arg1) {
|
|
363
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
364
|
+
}, arguments); },
|
|
365
|
+
__wbg_getTime_00b3f7db575e4ef5: function(arg0) {
|
|
366
|
+
const ret = arg0.getTime();
|
|
367
|
+
return ret;
|
|
368
|
+
},
|
|
369
|
+
__wbg_new_0_445c13a750296eb6: function() {
|
|
370
|
+
const ret = new Date();
|
|
371
|
+
return ret;
|
|
372
|
+
},
|
|
373
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
374
|
+
const ret = new Error();
|
|
375
|
+
return ret;
|
|
376
|
+
},
|
|
377
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
378
|
+
const ret = new Object();
|
|
379
|
+
return ret;
|
|
380
|
+
},
|
|
381
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
382
|
+
const ret = new Array();
|
|
383
|
+
return ret;
|
|
384
|
+
},
|
|
385
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
386
|
+
arg0[arg1] = arg2;
|
|
387
|
+
},
|
|
388
|
+
__wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
|
|
389
|
+
arg0[arg1 >>> 0] = arg2;
|
|
390
|
+
},
|
|
391
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
392
|
+
const ret = arg1.stack;
|
|
393
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
395
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
396
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
397
|
+
},
|
|
398
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
399
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
400
|
+
const ret = arg0;
|
|
401
|
+
return ret;
|
|
402
|
+
},
|
|
403
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
404
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
405
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
406
|
+
return ret;
|
|
407
|
+
},
|
|
408
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
409
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
410
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
411
|
+
return ret;
|
|
412
|
+
},
|
|
413
|
+
__wbindgen_init_externref_table: function() {
|
|
414
|
+
const table = wasm.__wbindgen_externrefs;
|
|
415
|
+
const offset = table.grow(4);
|
|
416
|
+
table.set(0, undefined);
|
|
417
|
+
table.set(offset + 0, undefined);
|
|
418
|
+
table.set(offset + 1, null);
|
|
419
|
+
table.set(offset + 2, true);
|
|
420
|
+
table.set(offset + 3, false);
|
|
421
|
+
},
|
|
422
|
+
};
|
|
423
|
+
return {
|
|
424
|
+
__proto__: null,
|
|
425
|
+
"./nucleus_wasm_bg.js": import0,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function addToExternrefTable0(obj) {
|
|
430
|
+
const idx = wasm.__externref_table_alloc();
|
|
431
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
432
|
+
return idx;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
436
|
+
ptr = ptr >>> 0;
|
|
437
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let cachedDataViewMemory0 = null;
|
|
441
|
+
function getDataViewMemory0() {
|
|
442
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
443
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
444
|
+
}
|
|
445
|
+
return cachedDataViewMemory0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getStringFromWasm0(ptr, len) {
|
|
449
|
+
return decodeText(ptr >>> 0, len);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
let cachedUint8ArrayMemory0 = null;
|
|
453
|
+
function getUint8ArrayMemory0() {
|
|
454
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
455
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
456
|
+
}
|
|
457
|
+
return cachedUint8ArrayMemory0;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function handleError(f, args) {
|
|
461
|
+
try {
|
|
462
|
+
return f.apply(this, args);
|
|
463
|
+
} catch (e) {
|
|
464
|
+
const idx = addToExternrefTable0(e);
|
|
465
|
+
wasm.__wbindgen_exn_store(idx);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
470
|
+
if (realloc === undefined) {
|
|
471
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
472
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
473
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
474
|
+
WASM_VECTOR_LEN = buf.length;
|
|
475
|
+
return ptr;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
let len = arg.length;
|
|
479
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
480
|
+
|
|
481
|
+
const mem = getUint8ArrayMemory0();
|
|
482
|
+
|
|
483
|
+
let offset = 0;
|
|
484
|
+
|
|
485
|
+
for (; offset < len; offset++) {
|
|
486
|
+
const code = arg.charCodeAt(offset);
|
|
487
|
+
if (code > 0x7F) break;
|
|
488
|
+
mem[ptr + offset] = code;
|
|
489
|
+
}
|
|
490
|
+
if (offset !== len) {
|
|
491
|
+
if (offset !== 0) {
|
|
492
|
+
arg = arg.slice(offset);
|
|
493
|
+
}
|
|
494
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
495
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
496
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
497
|
+
|
|
498
|
+
offset += ret.written;
|
|
499
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
WASM_VECTOR_LEN = offset;
|
|
503
|
+
return ptr;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function takeFromExternrefTable0(idx) {
|
|
507
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
508
|
+
wasm.__externref_table_dealloc(idx);
|
|
509
|
+
return value;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
513
|
+
cachedTextDecoder.decode();
|
|
514
|
+
function decodeText(ptr, len) {
|
|
515
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const cachedTextEncoder = new TextEncoder();
|
|
519
|
+
|
|
520
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
521
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
522
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
523
|
+
view.set(buf);
|
|
524
|
+
return {
|
|
525
|
+
read: arg.length,
|
|
526
|
+
written: buf.length
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
let WASM_VECTOR_LEN = 0;
|
|
532
|
+
|
|
533
|
+
const wasmPath = `${__dirname}/nucleus_wasm_bg.wasm`;
|
|
534
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
535
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
536
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
537
|
+
let wasm = wasmInstance.exports;
|
|
538
|
+
wasm.__wbindgen_start();
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const analyze_correction_event: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
5
|
+
export const compute_dependency_graph: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const compute_savings_summary: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
7
|
+
export const parse_claude_code_session: (a: number, b: number) => [number, number, number];
|
|
8
|
+
export const parse_lineage_chain: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const verify_auction_receipt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
10
|
+
export const verify_auction_receipt_full: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
11
|
+
export const verify_chain_signatures: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
12
|
+
export const verify_clearing_recompute: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const verify_preservation: (a: number, b: number) => [number, number];
|
|
14
|
+
export const verify_recomputation_necessity: (a: number, b: number) => [number, number];
|
|
15
|
+
export const init: () => void;
|
|
16
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
17
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
18
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
19
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
20
|
+
export const __externref_table_alloc: () => number;
|
|
21
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
22
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
23
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nucleus-wasm-nodejs-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "nucleus_wasm.js",
|
|
7
|
+
"types": "nucleus_wasm.d.ts",
|
|
8
|
+
"comment": "wasm-pack `nodejs` target (CommonJS). This nested package.json pins `type: commonjs` so the CJS `require`/`module.exports`/`__dirname` glue keeps working when imported from the ESM `@nucleus/verify` parent. Regenerated by `pnpm build:wasm`; do not hand-edit the sibling .js/.wasm."
|
|
9
|
+
}
|