@totalreclaw/core 1.1.0 → 1.3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@totalreclaw/core",
3
3
  "description": "TotalReclaw core — E2EE crypto, reranker, wallet, UserOp, store/search pipelines. Single source of truth for all clients.",
4
- "version": "1.1.0",
4
+ "version": "1.3.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -47,6 +47,21 @@ export class WasmLshHasher {
47
47
  readonly tables: number;
48
48
  }
49
49
 
50
+ /**
51
+ * Append one feedback entry to existing JSONL content.
52
+ */
53
+ export function appendFeedbackToJsonl(existing: string, entry_json: string): string;
54
+
55
+ /**
56
+ * Apply a single counterexample to the weights; returns updated ResolutionWeights JSON.
57
+ */
58
+ export function applyFeedback(weights_json: string, counterexample_json: string): string;
59
+
60
+ /**
61
+ * Assemble a full Digest from a parsed LLM response and source claims.
62
+ */
63
+ export function assembleDigestFromLlm(parsed_json: string, claims_json: string, now_unix_seconds: bigint): string;
64
+
50
65
  /**
51
66
  * Build ABI-encoded calldata for a batch of prepared facts.
52
67
  *
@@ -62,6 +77,28 @@ export function buildBatchCalldataFromPrepared(prepared_array_json: string): Uin
62
77
  */
63
78
  export function buildDebriefPrompt(stored_facts_json: string): string;
64
79
 
80
+ /**
81
+ * Build the LLM prompt for digest compilation.
82
+ * `claims_json`: JSON array of Claim (must be non-empty).
83
+ */
84
+ export function buildDigestPrompt(claims_json: string): string;
85
+
86
+ /**
87
+ * Build the profiling prompt for a batch of conversation summaries.
88
+ *
89
+ * `summaries_json`: JSON array of ChunkSummary objects.
90
+ * Returns the prompt string.
91
+ */
92
+ export function buildProfileBatchPrompt(summaries_json: string): string;
93
+
94
+ /**
95
+ * Build the merge prompt that combines partial profiles.
96
+ *
97
+ * `partials_json`: JSON array of PartialProfile objects.
98
+ * Returns the prompt string.
99
+ */
100
+ export function buildProfileMergePrompt(partials_json: string): string;
101
+
65
102
  /**
66
103
  * Build ABI-encoded calldata for a single prepared fact.
67
104
  *
@@ -70,6 +107,36 @@ export function buildDebriefPrompt(stored_facts_json: string): string;
70
107
  */
71
108
  export function buildSingleCalldataFromPrepared(prepared_json: string): Uint8Array;
72
109
 
110
+ /**
111
+ * Build a template digest from an array of active claims.
112
+ * `claims_json`: JSON array of Claim. Returns JSON-serialized Digest.
113
+ */
114
+ export function buildTemplateDigest(claims_json: string, now_unix_seconds: bigint): string;
115
+
116
+ /**
117
+ * Build the triage prompt for classifying chunks.
118
+ *
119
+ * `profile_json`: JSON string of a UserProfile.
120
+ * `summaries_json`: JSON array of ChunkSummary objects.
121
+ * Returns the prompt string.
122
+ */
123
+ export function buildTriagePrompt(profile_json: string, summaries_json: string): string;
124
+
125
+ /**
126
+ * Canonicalize a Claim JSON: strict-parse as Claim, re-serialize to canonical bytes.
127
+ * Rejects legacy or malformed input. Use before encryption so TS/Python/Rust all
128
+ * produce byte-identical blobs for the same logical claim.
129
+ */
130
+ export function canonicalizeClaim(claim_json: string): string;
131
+
132
+ /**
133
+ * Convert conversation chunks to summaries.
134
+ *
135
+ * `chunks_json`: JSON array of ConversationChunk objects.
136
+ * Returns a JsValue (JSON array of ChunkSummary objects).
137
+ */
138
+ export function chunksToSummaries(chunks_json: string): any;
139
+
73
140
  /**
74
141
  * Compute SHA-256(authKey) as a hex string.
75
142
  *
@@ -85,6 +152,11 @@ export function computeAuthKeyHash(auth_key_hex: string): string;
85
152
  */
86
153
  export function computeContentFingerprint(text: string, dedup_key_hex: string): string;
87
154
 
155
+ /**
156
+ * Compute a claim's score components for contradiction resolution.
157
+ */
158
+ export function computeScoreComponents(claim_json: string, now_unix_seconds: bigint, weights_json: string): string;
159
+
88
160
  /**
89
161
  * Cosine similarity between two f32 vectors.
90
162
  */
@@ -114,6 +186,16 @@ export function decrypt(encrypted_base64: string, encryption_key_hex: string): s
114
186
  */
115
187
  export function decryptAndRerank(facts_json: string, query: string, query_embedding: Float32Array, encryption_key_hex: string, top_k: number): any;
116
188
 
189
+ /**
190
+ * Default P2-3 resolution weights as JSON.
191
+ */
192
+ export function defaultResolutionWeights(): string;
193
+
194
+ /**
195
+ * Build a fresh default WeightsFile JSON with the given timestamp.
196
+ */
197
+ export function defaultWeightsFile(now_unix_seconds: bigint): string;
198
+
117
199
  /**
118
200
  * Derive an Ethereum EOA wallet from a BIP-39 mnemonic via BIP-44.
119
201
  *
@@ -152,6 +234,16 @@ export function deriveKeysFromMnemonicLenient(mnemonic: string): any;
152
234
  */
153
235
  export function deriveLshSeed(mnemonic: string, salt_hex: string): string;
154
236
 
237
+ /**
238
+ * Detect contradictions between a new claim and existing claims (JSON array of {claim, id, embedding}).
239
+ */
240
+ export function detectContradictions(new_claim_json: string, new_claim_id: string, new_embedding_json: string, existing_json: string, lower_threshold: number, upper_threshold: number): string;
241
+
242
+ /**
243
+ * Deterministic entity ID from a name (first 8 bytes of SHA256 as hex).
244
+ */
245
+ export function deterministicEntityId(name: string): string;
246
+
155
247
  /**
156
248
  * Encode multiple fact submissions as SimpleAccount.executeBatch() calldata.
157
249
  *
@@ -200,6 +292,21 @@ export function encodeTombstoneProtobuf(fact_id: string, owner: string): Uint8Ar
200
292
  */
201
293
  export function encrypt(plaintext: string, encryption_key_hex: string): string;
202
294
 
295
+ /**
296
+ * Enrich an extraction prompt with user profile context.
297
+ *
298
+ * `profile_json`: JSON string of a UserProfile.
299
+ * `base_prompt`: The base extraction prompt to enrich.
300
+ * Returns the enriched prompt string.
301
+ */
302
+ export function enrichExtractionPrompt(profile_json: string, base_prompt: string): string;
303
+
304
+ /**
305
+ * Convert a feedback entry into a counterexample for weight tuning. Returns
306
+ * JSON Counterexample or the literal string "null" if the entry has no signal.
307
+ */
308
+ export function feedbackToCounterexample(entry_json: string): string;
309
+
203
310
  /**
204
311
  * WASM binding for `find_near_duplicate`.
205
312
  *
@@ -342,6 +449,11 @@ export function hashUserOp(userop_json: string, entrypoint: string, chain_id: bi
342
449
  */
343
450
  export function hexBlobToBase64(hex_blob: string): string | undefined;
344
451
 
452
+ /**
453
+ * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
454
+ */
455
+ export function normalizeEntityName(name: string): string;
456
+
345
457
  /**
346
458
  * Normalize text (NFC, lowercase, collapse whitespace, trim).
347
459
  */
@@ -355,6 +467,12 @@ export function normalizeText(text: string): string;
355
467
  */
356
468
  export function parseBroadenedResponse(response_json: string): any;
357
469
 
470
+ /**
471
+ * Parse a decrypted blob as a Claim, falling back to legacy formats.
472
+ * Returns JSON-serialized Claim.
473
+ */
474
+ export function parseClaimOrLegacy(decrypted: string): string;
475
+
358
476
  /**
359
477
  * Parse a debrief LLM response into validated items.
360
478
  *
@@ -362,6 +480,28 @@ export function parseBroadenedResponse(response_json: string): any;
362
480
  */
363
481
  export function parseDebriefResponse(response: string): any;
364
482
 
483
+ /**
484
+ * Parse an LLM digest response.
485
+ * Returns JSON-serialized ParsedDigestResponse.
486
+ */
487
+ export function parseDigestResponse(raw: string): string;
488
+
489
+ /**
490
+ * Parse a batch profiling LLM response into a PartialProfile.
491
+ *
492
+ * `llm_output`: Raw LLM response string.
493
+ * Returns a JsValue (PartialProfile object).
494
+ */
495
+ export function parseProfileBatchResponse(llm_output: string): any;
496
+
497
+ /**
498
+ * Parse the merge LLM response into a UserProfile.
499
+ *
500
+ * `llm_output`: Raw LLM response string.
501
+ * Returns a JsValue (UserProfile object).
502
+ */
503
+ export function parseProfileResponse(llm_output: string): any;
504
+
365
505
  /**
366
506
  * Parse a blind index search GraphQL response into SubgraphFact list.
367
507
  *
@@ -370,6 +510,19 @@ export function parseDebriefResponse(response: string): any;
370
510
  */
371
511
  export function parseSearchResponse(response_json: string): any;
372
512
 
513
+ /**
514
+ * Parse the triage LLM response into chunk decisions.
515
+ *
516
+ * `llm_output`: Raw LLM response string.
517
+ * Returns a JsValue (JSON array of ChunkDecision objects).
518
+ */
519
+ export function parseTriageResponse(llm_output: string): any;
520
+
521
+ /**
522
+ * Parse a WeightsFile from JSON; rejects unknown versions and malformed input.
523
+ */
524
+ export function parseWeightsFile(content: string): string;
525
+
373
526
  /**
374
527
  * Prepare a fact for on-chain storage.
375
528
  *
@@ -400,6 +553,11 @@ export function prepareFactWithDecayScore(text: string, encryption_key_hex: stri
400
553
  */
401
554
  export function prepareTombstone(fact_id: string, owner: string): Uint8Array;
402
555
 
556
+ /**
557
+ * Parse JSONL content. Returns JSON: `{"entries": [...], "warnings": [...]}`.
558
+ */
559
+ export function readFeedbackJsonl(content: string): string;
560
+
403
561
  /**
404
562
  * Rerank candidates using BM25 + Cosine + RRF fusion.
405
563
  *
@@ -408,6 +566,21 @@ export function prepareTombstone(fact_id: string, owner: string): Uint8Array;
408
566
  */
409
567
  export function rerank(query: string, query_embedding: Float32Array, candidates_json: string, top_k: number): any;
410
568
 
569
+ /**
570
+ * Run the resolution formula on two contradicting claims; returns ResolutionOutcome JSON.
571
+ */
572
+ export function resolvePair(claim_a_json: string, claim_a_id: string, claim_b_json: string, claim_b_id: string, now_unix_seconds: bigint, weights_json: string): string;
573
+
574
+ /**
575
+ * Keep only the most recent `max_lines` non-empty feedback log lines. Non-falliable.
576
+ */
577
+ export function rotateFeedbackLog(content: string, max_lines: bigint): string;
578
+
579
+ /**
580
+ * Serialize a WeightsFile JSON to pretty-printed JSON (2-space indent).
581
+ */
582
+ export function serializeWeightsFile(file_json: string): string;
583
+
411
584
  /**
412
585
  * WASM binding: determine if a new fact should supersede an existing one.
413
586
  */
@@ -110,6 +110,97 @@ class WasmLshHasher {
110
110
  if (Symbol.dispose) WasmLshHasher.prototype[Symbol.dispose] = WasmLshHasher.prototype.free;
111
111
  exports.WasmLshHasher = WasmLshHasher;
112
112
 
113
+ /**
114
+ * Append one feedback entry to existing JSONL content.
115
+ * @param {string} existing
116
+ * @param {string} entry_json
117
+ * @returns {string}
118
+ */
119
+ function appendFeedbackToJsonl(existing, entry_json) {
120
+ let deferred4_0;
121
+ let deferred4_1;
122
+ try {
123
+ const ptr0 = passStringToWasm0(existing, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
124
+ const len0 = WASM_VECTOR_LEN;
125
+ const ptr1 = passStringToWasm0(entry_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
126
+ const len1 = WASM_VECTOR_LEN;
127
+ const ret = wasm.appendFeedbackToJsonl(ptr0, len0, ptr1, len1);
128
+ var ptr3 = ret[0];
129
+ var len3 = ret[1];
130
+ if (ret[3]) {
131
+ ptr3 = 0; len3 = 0;
132
+ throw takeFromExternrefTable0(ret[2]);
133
+ }
134
+ deferred4_0 = ptr3;
135
+ deferred4_1 = len3;
136
+ return getStringFromWasm0(ptr3, len3);
137
+ } finally {
138
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
139
+ }
140
+ }
141
+ exports.appendFeedbackToJsonl = appendFeedbackToJsonl;
142
+
143
+ /**
144
+ * Apply a single counterexample to the weights; returns updated ResolutionWeights JSON.
145
+ * @param {string} weights_json
146
+ * @param {string} counterexample_json
147
+ * @returns {string}
148
+ */
149
+ function applyFeedback(weights_json, counterexample_json) {
150
+ let deferred4_0;
151
+ let deferred4_1;
152
+ try {
153
+ const ptr0 = passStringToWasm0(weights_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
+ const len0 = WASM_VECTOR_LEN;
155
+ const ptr1 = passStringToWasm0(counterexample_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
156
+ const len1 = WASM_VECTOR_LEN;
157
+ const ret = wasm.applyFeedback(ptr0, len0, ptr1, len1);
158
+ var ptr3 = ret[0];
159
+ var len3 = ret[1];
160
+ if (ret[3]) {
161
+ ptr3 = 0; len3 = 0;
162
+ throw takeFromExternrefTable0(ret[2]);
163
+ }
164
+ deferred4_0 = ptr3;
165
+ deferred4_1 = len3;
166
+ return getStringFromWasm0(ptr3, len3);
167
+ } finally {
168
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
169
+ }
170
+ }
171
+ exports.applyFeedback = applyFeedback;
172
+
173
+ /**
174
+ * Assemble a full Digest from a parsed LLM response and source claims.
175
+ * @param {string} parsed_json
176
+ * @param {string} claims_json
177
+ * @param {bigint} now_unix_seconds
178
+ * @returns {string}
179
+ */
180
+ function assembleDigestFromLlm(parsed_json, claims_json, now_unix_seconds) {
181
+ let deferred4_0;
182
+ let deferred4_1;
183
+ try {
184
+ const ptr0 = passStringToWasm0(parsed_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
185
+ const len0 = WASM_VECTOR_LEN;
186
+ const ptr1 = passStringToWasm0(claims_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
187
+ const len1 = WASM_VECTOR_LEN;
188
+ const ret = wasm.assembleDigestFromLlm(ptr0, len0, ptr1, len1, now_unix_seconds);
189
+ var ptr3 = ret[0];
190
+ var len3 = ret[1];
191
+ if (ret[3]) {
192
+ ptr3 = 0; len3 = 0;
193
+ throw takeFromExternrefTable0(ret[2]);
194
+ }
195
+ deferred4_0 = ptr3;
196
+ deferred4_1 = len3;
197
+ return getStringFromWasm0(ptr3, len3);
198
+ } finally {
199
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
200
+ }
201
+ }
202
+ exports.assembleDigestFromLlm = assembleDigestFromLlm;
203
+
113
204
  /**
114
205
  * Build ABI-encoded calldata for a batch of prepared facts.
115
206
  *
@@ -160,6 +251,94 @@ function buildDebriefPrompt(stored_facts_json) {
160
251
  }
161
252
  exports.buildDebriefPrompt = buildDebriefPrompt;
162
253
 
254
+ /**
255
+ * Build the LLM prompt for digest compilation.
256
+ * `claims_json`: JSON array of Claim (must be non-empty).
257
+ * @param {string} claims_json
258
+ * @returns {string}
259
+ */
260
+ function buildDigestPrompt(claims_json) {
261
+ let deferred3_0;
262
+ let deferred3_1;
263
+ try {
264
+ const ptr0 = passStringToWasm0(claims_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.buildDigestPrompt(ptr0, len0);
267
+ var ptr2 = ret[0];
268
+ var len2 = ret[1];
269
+ if (ret[3]) {
270
+ ptr2 = 0; len2 = 0;
271
+ throw takeFromExternrefTable0(ret[2]);
272
+ }
273
+ deferred3_0 = ptr2;
274
+ deferred3_1 = len2;
275
+ return getStringFromWasm0(ptr2, len2);
276
+ } finally {
277
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
278
+ }
279
+ }
280
+ exports.buildDigestPrompt = buildDigestPrompt;
281
+
282
+ /**
283
+ * Build the profiling prompt for a batch of conversation summaries.
284
+ *
285
+ * `summaries_json`: JSON array of ChunkSummary objects.
286
+ * Returns the prompt string.
287
+ * @param {string} summaries_json
288
+ * @returns {string}
289
+ */
290
+ function buildProfileBatchPrompt(summaries_json) {
291
+ let deferred3_0;
292
+ let deferred3_1;
293
+ try {
294
+ const ptr0 = passStringToWasm0(summaries_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ const ret = wasm.buildProfileBatchPrompt(ptr0, len0);
297
+ var ptr2 = ret[0];
298
+ var len2 = ret[1];
299
+ if (ret[3]) {
300
+ ptr2 = 0; len2 = 0;
301
+ throw takeFromExternrefTable0(ret[2]);
302
+ }
303
+ deferred3_0 = ptr2;
304
+ deferred3_1 = len2;
305
+ return getStringFromWasm0(ptr2, len2);
306
+ } finally {
307
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
308
+ }
309
+ }
310
+ exports.buildProfileBatchPrompt = buildProfileBatchPrompt;
311
+
312
+ /**
313
+ * Build the merge prompt that combines partial profiles.
314
+ *
315
+ * `partials_json`: JSON array of PartialProfile objects.
316
+ * Returns the prompt string.
317
+ * @param {string} partials_json
318
+ * @returns {string}
319
+ */
320
+ function buildProfileMergePrompt(partials_json) {
321
+ let deferred3_0;
322
+ let deferred3_1;
323
+ try {
324
+ const ptr0 = passStringToWasm0(partials_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
325
+ const len0 = WASM_VECTOR_LEN;
326
+ const ret = wasm.buildProfileMergePrompt(ptr0, len0);
327
+ var ptr2 = ret[0];
328
+ var len2 = ret[1];
329
+ if (ret[3]) {
330
+ ptr2 = 0; len2 = 0;
331
+ throw takeFromExternrefTable0(ret[2]);
332
+ }
333
+ deferred3_0 = ptr2;
334
+ deferred3_1 = len2;
335
+ return getStringFromWasm0(ptr2, len2);
336
+ } finally {
337
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
338
+ }
339
+ }
340
+ exports.buildProfileMergePrompt = buildProfileMergePrompt;
341
+
163
342
  /**
164
343
  * Build ABI-encoded calldata for a single prepared fact.
165
344
  *
@@ -181,6 +360,117 @@ function buildSingleCalldataFromPrepared(prepared_json) {
181
360
  }
182
361
  exports.buildSingleCalldataFromPrepared = buildSingleCalldataFromPrepared;
183
362
 
363
+ /**
364
+ * Build a template digest from an array of active claims.
365
+ * `claims_json`: JSON array of Claim. Returns JSON-serialized Digest.
366
+ * @param {string} claims_json
367
+ * @param {bigint} now_unix_seconds
368
+ * @returns {string}
369
+ */
370
+ function buildTemplateDigest(claims_json, now_unix_seconds) {
371
+ let deferred3_0;
372
+ let deferred3_1;
373
+ try {
374
+ const ptr0 = passStringToWasm0(claims_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
375
+ const len0 = WASM_VECTOR_LEN;
376
+ const ret = wasm.buildTemplateDigest(ptr0, len0, now_unix_seconds);
377
+ var ptr2 = ret[0];
378
+ var len2 = ret[1];
379
+ if (ret[3]) {
380
+ ptr2 = 0; len2 = 0;
381
+ throw takeFromExternrefTable0(ret[2]);
382
+ }
383
+ deferred3_0 = ptr2;
384
+ deferred3_1 = len2;
385
+ return getStringFromWasm0(ptr2, len2);
386
+ } finally {
387
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
388
+ }
389
+ }
390
+ exports.buildTemplateDigest = buildTemplateDigest;
391
+
392
+ /**
393
+ * Build the triage prompt for classifying chunks.
394
+ *
395
+ * `profile_json`: JSON string of a UserProfile.
396
+ * `summaries_json`: JSON array of ChunkSummary objects.
397
+ * Returns the prompt string.
398
+ * @param {string} profile_json
399
+ * @param {string} summaries_json
400
+ * @returns {string}
401
+ */
402
+ function buildTriagePrompt(profile_json, summaries_json) {
403
+ let deferred4_0;
404
+ let deferred4_1;
405
+ try {
406
+ const ptr0 = passStringToWasm0(profile_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
407
+ const len0 = WASM_VECTOR_LEN;
408
+ const ptr1 = passStringToWasm0(summaries_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
409
+ const len1 = WASM_VECTOR_LEN;
410
+ const ret = wasm.buildTriagePrompt(ptr0, len0, ptr1, len1);
411
+ var ptr3 = ret[0];
412
+ var len3 = ret[1];
413
+ if (ret[3]) {
414
+ ptr3 = 0; len3 = 0;
415
+ throw takeFromExternrefTable0(ret[2]);
416
+ }
417
+ deferred4_0 = ptr3;
418
+ deferred4_1 = len3;
419
+ return getStringFromWasm0(ptr3, len3);
420
+ } finally {
421
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
422
+ }
423
+ }
424
+ exports.buildTriagePrompt = buildTriagePrompt;
425
+
426
+ /**
427
+ * Canonicalize a Claim JSON: strict-parse as Claim, re-serialize to canonical bytes.
428
+ * Rejects legacy or malformed input. Use before encryption so TS/Python/Rust all
429
+ * produce byte-identical blobs for the same logical claim.
430
+ * @param {string} claim_json
431
+ * @returns {string}
432
+ */
433
+ function canonicalizeClaim(claim_json) {
434
+ let deferred3_0;
435
+ let deferred3_1;
436
+ try {
437
+ const ptr0 = passStringToWasm0(claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ const ret = wasm.canonicalizeClaim(ptr0, len0);
440
+ var ptr2 = ret[0];
441
+ var len2 = ret[1];
442
+ if (ret[3]) {
443
+ ptr2 = 0; len2 = 0;
444
+ throw takeFromExternrefTable0(ret[2]);
445
+ }
446
+ deferred3_0 = ptr2;
447
+ deferred3_1 = len2;
448
+ return getStringFromWasm0(ptr2, len2);
449
+ } finally {
450
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
451
+ }
452
+ }
453
+ exports.canonicalizeClaim = canonicalizeClaim;
454
+
455
+ /**
456
+ * Convert conversation chunks to summaries.
457
+ *
458
+ * `chunks_json`: JSON array of ConversationChunk objects.
459
+ * Returns a JsValue (JSON array of ChunkSummary objects).
460
+ * @param {string} chunks_json
461
+ * @returns {any}
462
+ */
463
+ function chunksToSummaries(chunks_json) {
464
+ const ptr0 = passStringToWasm0(chunks_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ const len0 = WASM_VECTOR_LEN;
466
+ const ret = wasm.chunksToSummaries(ptr0, len0);
467
+ if (ret[2]) {
468
+ throw takeFromExternrefTable0(ret[1]);
469
+ }
470
+ return takeFromExternrefTable0(ret[0]);
471
+ }
472
+ exports.chunksToSummaries = chunksToSummaries;
473
+
184
474
  /**
185
475
  * Compute SHA-256(authKey) as a hex string.
186
476
  *
@@ -243,6 +533,37 @@ function computeContentFingerprint(text, dedup_key_hex) {
243
533
  }
244
534
  exports.computeContentFingerprint = computeContentFingerprint;
245
535
 
536
+ /**
537
+ * Compute a claim's score components for contradiction resolution.
538
+ * @param {string} claim_json
539
+ * @param {bigint} now_unix_seconds
540
+ * @param {string} weights_json
541
+ * @returns {string}
542
+ */
543
+ function computeScoreComponents(claim_json, now_unix_seconds, weights_json) {
544
+ let deferred4_0;
545
+ let deferred4_1;
546
+ try {
547
+ const ptr0 = passStringToWasm0(claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
548
+ const len0 = WASM_VECTOR_LEN;
549
+ const ptr1 = passStringToWasm0(weights_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
550
+ const len1 = WASM_VECTOR_LEN;
551
+ const ret = wasm.computeScoreComponents(ptr0, len0, now_unix_seconds, ptr1, len1);
552
+ var ptr3 = ret[0];
553
+ var len3 = ret[1];
554
+ if (ret[3]) {
555
+ ptr3 = 0; len3 = 0;
556
+ throw takeFromExternrefTable0(ret[2]);
557
+ }
558
+ deferred4_0 = ptr3;
559
+ deferred4_1 = len3;
560
+ return getStringFromWasm0(ptr3, len3);
561
+ } finally {
562
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
563
+ }
564
+ }
565
+ exports.computeScoreComponents = computeScoreComponents;
566
+
246
567
  /**
247
568
  * Cosine similarity between two f32 vectors.
248
569
  * @param {Float32Array} a
@@ -329,6 +650,55 @@ function decryptAndRerank(facts_json, query, query_embedding, encryption_key_hex
329
650
  }
330
651
  exports.decryptAndRerank = decryptAndRerank;
331
652
 
653
+ /**
654
+ * Default P2-3 resolution weights as JSON.
655
+ * @returns {string}
656
+ */
657
+ function defaultResolutionWeights() {
658
+ let deferred2_0;
659
+ let deferred2_1;
660
+ try {
661
+ const ret = wasm.defaultResolutionWeights();
662
+ var ptr1 = ret[0];
663
+ var len1 = ret[1];
664
+ if (ret[3]) {
665
+ ptr1 = 0; len1 = 0;
666
+ throw takeFromExternrefTable0(ret[2]);
667
+ }
668
+ deferred2_0 = ptr1;
669
+ deferred2_1 = len1;
670
+ return getStringFromWasm0(ptr1, len1);
671
+ } finally {
672
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
673
+ }
674
+ }
675
+ exports.defaultResolutionWeights = defaultResolutionWeights;
676
+
677
+ /**
678
+ * Build a fresh default WeightsFile JSON with the given timestamp.
679
+ * @param {bigint} now_unix_seconds
680
+ * @returns {string}
681
+ */
682
+ function defaultWeightsFile(now_unix_seconds) {
683
+ let deferred2_0;
684
+ let deferred2_1;
685
+ try {
686
+ const ret = wasm.defaultWeightsFile(now_unix_seconds);
687
+ var ptr1 = ret[0];
688
+ var len1 = ret[1];
689
+ if (ret[3]) {
690
+ ptr1 = 0; len1 = 0;
691
+ throw takeFromExternrefTable0(ret[2]);
692
+ }
693
+ deferred2_0 = ptr1;
694
+ deferred2_1 = len1;
695
+ return getStringFromWasm0(ptr1, len1);
696
+ } finally {
697
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
698
+ }
699
+ }
700
+ exports.defaultWeightsFile = defaultWeightsFile;
701
+
332
702
  /**
333
703
  * Derive an Ethereum EOA wallet from a BIP-39 mnemonic via BIP-44.
334
704
  *
@@ -447,6 +817,65 @@ function deriveLshSeed(mnemonic, salt_hex) {
447
817
  }
448
818
  exports.deriveLshSeed = deriveLshSeed;
449
819
 
820
+ /**
821
+ * Detect contradictions between a new claim and existing claims (JSON array of {claim, id, embedding}).
822
+ * @param {string} new_claim_json
823
+ * @param {string} new_claim_id
824
+ * @param {string} new_embedding_json
825
+ * @param {string} existing_json
826
+ * @param {number} lower_threshold
827
+ * @param {number} upper_threshold
828
+ * @returns {string}
829
+ */
830
+ function detectContradictions(new_claim_json, new_claim_id, new_embedding_json, existing_json, lower_threshold, upper_threshold) {
831
+ let deferred6_0;
832
+ let deferred6_1;
833
+ try {
834
+ const ptr0 = passStringToWasm0(new_claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
835
+ const len0 = WASM_VECTOR_LEN;
836
+ const ptr1 = passStringToWasm0(new_claim_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
837
+ const len1 = WASM_VECTOR_LEN;
838
+ const ptr2 = passStringToWasm0(new_embedding_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
839
+ const len2 = WASM_VECTOR_LEN;
840
+ const ptr3 = passStringToWasm0(existing_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
841
+ const len3 = WASM_VECTOR_LEN;
842
+ const ret = wasm.detectContradictions(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, lower_threshold, upper_threshold);
843
+ var ptr5 = ret[0];
844
+ var len5 = ret[1];
845
+ if (ret[3]) {
846
+ ptr5 = 0; len5 = 0;
847
+ throw takeFromExternrefTable0(ret[2]);
848
+ }
849
+ deferred6_0 = ptr5;
850
+ deferred6_1 = len5;
851
+ return getStringFromWasm0(ptr5, len5);
852
+ } finally {
853
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
854
+ }
855
+ }
856
+ exports.detectContradictions = detectContradictions;
857
+
858
+ /**
859
+ * Deterministic entity ID from a name (first 8 bytes of SHA256 as hex).
860
+ * @param {string} name
861
+ * @returns {string}
862
+ */
863
+ function deterministicEntityId(name) {
864
+ let deferred2_0;
865
+ let deferred2_1;
866
+ try {
867
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
868
+ const len0 = WASM_VECTOR_LEN;
869
+ const ret = wasm.deterministicEntityId(ptr0, len0);
870
+ deferred2_0 = ret[0];
871
+ deferred2_1 = ret[1];
872
+ return getStringFromWasm0(ret[0], ret[1]);
873
+ } finally {
874
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
875
+ }
876
+ }
877
+ exports.deterministicEntityId = deterministicEntityId;
878
+
450
879
  /**
451
880
  * Encode multiple fact submissions as SimpleAccount.executeBatch() calldata.
452
881
  *
@@ -569,6 +998,68 @@ function encrypt(plaintext, encryption_key_hex) {
569
998
  }
570
999
  exports.encrypt = encrypt;
571
1000
 
1001
+ /**
1002
+ * Enrich an extraction prompt with user profile context.
1003
+ *
1004
+ * `profile_json`: JSON string of a UserProfile.
1005
+ * `base_prompt`: The base extraction prompt to enrich.
1006
+ * Returns the enriched prompt string.
1007
+ * @param {string} profile_json
1008
+ * @param {string} base_prompt
1009
+ * @returns {string}
1010
+ */
1011
+ function enrichExtractionPrompt(profile_json, base_prompt) {
1012
+ let deferred4_0;
1013
+ let deferred4_1;
1014
+ try {
1015
+ const ptr0 = passStringToWasm0(profile_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1016
+ const len0 = WASM_VECTOR_LEN;
1017
+ const ptr1 = passStringToWasm0(base_prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1018
+ const len1 = WASM_VECTOR_LEN;
1019
+ const ret = wasm.enrichExtractionPrompt(ptr0, len0, ptr1, len1);
1020
+ var ptr3 = ret[0];
1021
+ var len3 = ret[1];
1022
+ if (ret[3]) {
1023
+ ptr3 = 0; len3 = 0;
1024
+ throw takeFromExternrefTable0(ret[2]);
1025
+ }
1026
+ deferred4_0 = ptr3;
1027
+ deferred4_1 = len3;
1028
+ return getStringFromWasm0(ptr3, len3);
1029
+ } finally {
1030
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1031
+ }
1032
+ }
1033
+ exports.enrichExtractionPrompt = enrichExtractionPrompt;
1034
+
1035
+ /**
1036
+ * Convert a feedback entry into a counterexample for weight tuning. Returns
1037
+ * JSON Counterexample or the literal string "null" if the entry has no signal.
1038
+ * @param {string} entry_json
1039
+ * @returns {string}
1040
+ */
1041
+ function feedbackToCounterexample(entry_json) {
1042
+ let deferred3_0;
1043
+ let deferred3_1;
1044
+ try {
1045
+ const ptr0 = passStringToWasm0(entry_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1046
+ const len0 = WASM_VECTOR_LEN;
1047
+ const ret = wasm.feedbackToCounterexample(ptr0, len0);
1048
+ var ptr2 = ret[0];
1049
+ var len2 = ret[1];
1050
+ if (ret[3]) {
1051
+ ptr2 = 0; len2 = 0;
1052
+ throw takeFromExternrefTable0(ret[2]);
1053
+ }
1054
+ deferred3_0 = ptr2;
1055
+ deferred3_1 = len2;
1056
+ return getStringFromWasm0(ptr2, len2);
1057
+ } finally {
1058
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1059
+ }
1060
+ }
1061
+ exports.feedbackToCounterexample = feedbackToCounterexample;
1062
+
572
1063
  /**
573
1064
  * WASM binding for `find_near_duplicate`.
574
1065
  *
@@ -974,6 +1465,27 @@ function hexBlobToBase64(hex_blob) {
974
1465
  }
975
1466
  exports.hexBlobToBase64 = hexBlobToBase64;
976
1467
 
1468
+ /**
1469
+ * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
1470
+ * @param {string} name
1471
+ * @returns {string}
1472
+ */
1473
+ function normalizeEntityName(name) {
1474
+ let deferred2_0;
1475
+ let deferred2_1;
1476
+ try {
1477
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1478
+ const len0 = WASM_VECTOR_LEN;
1479
+ const ret = wasm.normalizeEntityName(ptr0, len0);
1480
+ deferred2_0 = ret[0];
1481
+ deferred2_1 = ret[1];
1482
+ return getStringFromWasm0(ret[0], ret[1]);
1483
+ } finally {
1484
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1485
+ }
1486
+ }
1487
+ exports.normalizeEntityName = normalizeEntityName;
1488
+
977
1489
  /**
978
1490
  * Normalize text (NFC, lowercase, collapse whitespace, trim).
979
1491
  * @param {string} text
@@ -1014,6 +1526,34 @@ function parseBroadenedResponse(response_json) {
1014
1526
  }
1015
1527
  exports.parseBroadenedResponse = parseBroadenedResponse;
1016
1528
 
1529
+ /**
1530
+ * Parse a decrypted blob as a Claim, falling back to legacy formats.
1531
+ * Returns JSON-serialized Claim.
1532
+ * @param {string} decrypted
1533
+ * @returns {string}
1534
+ */
1535
+ function parseClaimOrLegacy(decrypted) {
1536
+ let deferred3_0;
1537
+ let deferred3_1;
1538
+ try {
1539
+ const ptr0 = passStringToWasm0(decrypted, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1540
+ const len0 = WASM_VECTOR_LEN;
1541
+ const ret = wasm.parseClaimOrLegacy(ptr0, len0);
1542
+ var ptr2 = ret[0];
1543
+ var len2 = ret[1];
1544
+ if (ret[3]) {
1545
+ ptr2 = 0; len2 = 0;
1546
+ throw takeFromExternrefTable0(ret[2]);
1547
+ }
1548
+ deferred3_0 = ptr2;
1549
+ deferred3_1 = len2;
1550
+ return getStringFromWasm0(ptr2, len2);
1551
+ } finally {
1552
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1553
+ }
1554
+ }
1555
+ exports.parseClaimOrLegacy = parseClaimOrLegacy;
1556
+
1017
1557
  /**
1018
1558
  * Parse a debrief LLM response into validated items.
1019
1559
  *
@@ -1032,6 +1572,72 @@ function parseDebriefResponse(response) {
1032
1572
  }
1033
1573
  exports.parseDebriefResponse = parseDebriefResponse;
1034
1574
 
1575
+ /**
1576
+ * Parse an LLM digest response.
1577
+ * Returns JSON-serialized ParsedDigestResponse.
1578
+ * @param {string} raw
1579
+ * @returns {string}
1580
+ */
1581
+ function parseDigestResponse(raw) {
1582
+ let deferred3_0;
1583
+ let deferred3_1;
1584
+ try {
1585
+ const ptr0 = passStringToWasm0(raw, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1586
+ const len0 = WASM_VECTOR_LEN;
1587
+ const ret = wasm.parseDigestResponse(ptr0, len0);
1588
+ var ptr2 = ret[0];
1589
+ var len2 = ret[1];
1590
+ if (ret[3]) {
1591
+ ptr2 = 0; len2 = 0;
1592
+ throw takeFromExternrefTable0(ret[2]);
1593
+ }
1594
+ deferred3_0 = ptr2;
1595
+ deferred3_1 = len2;
1596
+ return getStringFromWasm0(ptr2, len2);
1597
+ } finally {
1598
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1599
+ }
1600
+ }
1601
+ exports.parseDigestResponse = parseDigestResponse;
1602
+
1603
+ /**
1604
+ * Parse a batch profiling LLM response into a PartialProfile.
1605
+ *
1606
+ * `llm_output`: Raw LLM response string.
1607
+ * Returns a JsValue (PartialProfile object).
1608
+ * @param {string} llm_output
1609
+ * @returns {any}
1610
+ */
1611
+ function parseProfileBatchResponse(llm_output) {
1612
+ const ptr0 = passStringToWasm0(llm_output, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1613
+ const len0 = WASM_VECTOR_LEN;
1614
+ const ret = wasm.parseProfileBatchResponse(ptr0, len0);
1615
+ if (ret[2]) {
1616
+ throw takeFromExternrefTable0(ret[1]);
1617
+ }
1618
+ return takeFromExternrefTable0(ret[0]);
1619
+ }
1620
+ exports.parseProfileBatchResponse = parseProfileBatchResponse;
1621
+
1622
+ /**
1623
+ * Parse the merge LLM response into a UserProfile.
1624
+ *
1625
+ * `llm_output`: Raw LLM response string.
1626
+ * Returns a JsValue (UserProfile object).
1627
+ * @param {string} llm_output
1628
+ * @returns {any}
1629
+ */
1630
+ function parseProfileResponse(llm_output) {
1631
+ const ptr0 = passStringToWasm0(llm_output, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1632
+ const len0 = WASM_VECTOR_LEN;
1633
+ const ret = wasm.parseProfileResponse(ptr0, len0);
1634
+ if (ret[2]) {
1635
+ throw takeFromExternrefTable0(ret[1]);
1636
+ }
1637
+ return takeFromExternrefTable0(ret[0]);
1638
+ }
1639
+ exports.parseProfileResponse = parseProfileResponse;
1640
+
1035
1641
  /**
1036
1642
  * Parse a blind index search GraphQL response into SubgraphFact list.
1037
1643
  *
@@ -1051,6 +1657,52 @@ function parseSearchResponse(response_json) {
1051
1657
  }
1052
1658
  exports.parseSearchResponse = parseSearchResponse;
1053
1659
 
1660
+ /**
1661
+ * Parse the triage LLM response into chunk decisions.
1662
+ *
1663
+ * `llm_output`: Raw LLM response string.
1664
+ * Returns a JsValue (JSON array of ChunkDecision objects).
1665
+ * @param {string} llm_output
1666
+ * @returns {any}
1667
+ */
1668
+ function parseTriageResponse(llm_output) {
1669
+ const ptr0 = passStringToWasm0(llm_output, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1670
+ const len0 = WASM_VECTOR_LEN;
1671
+ const ret = wasm.parseTriageResponse(ptr0, len0);
1672
+ if (ret[2]) {
1673
+ throw takeFromExternrefTable0(ret[1]);
1674
+ }
1675
+ return takeFromExternrefTable0(ret[0]);
1676
+ }
1677
+ exports.parseTriageResponse = parseTriageResponse;
1678
+
1679
+ /**
1680
+ * Parse a WeightsFile from JSON; rejects unknown versions and malformed input.
1681
+ * @param {string} content
1682
+ * @returns {string}
1683
+ */
1684
+ function parseWeightsFile(content) {
1685
+ let deferred3_0;
1686
+ let deferred3_1;
1687
+ try {
1688
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1689
+ const len0 = WASM_VECTOR_LEN;
1690
+ const ret = wasm.parseWeightsFile(ptr0, len0);
1691
+ var ptr2 = ret[0];
1692
+ var len2 = ret[1];
1693
+ if (ret[3]) {
1694
+ ptr2 = 0; len2 = 0;
1695
+ throw takeFromExternrefTable0(ret[2]);
1696
+ }
1697
+ deferred3_0 = ptr2;
1698
+ deferred3_1 = len2;
1699
+ return getStringFromWasm0(ptr2, len2);
1700
+ } finally {
1701
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1702
+ }
1703
+ }
1704
+ exports.parseWeightsFile = parseWeightsFile;
1705
+
1054
1706
  /**
1055
1707
  * Prepare a fact for on-chain storage.
1056
1708
  *
@@ -1158,6 +1810,33 @@ function prepareTombstone(fact_id, owner) {
1158
1810
  }
1159
1811
  exports.prepareTombstone = prepareTombstone;
1160
1812
 
1813
+ /**
1814
+ * Parse JSONL content. Returns JSON: `{"entries": [...], "warnings": [...]}`.
1815
+ * @param {string} content
1816
+ * @returns {string}
1817
+ */
1818
+ function readFeedbackJsonl(content) {
1819
+ let deferred3_0;
1820
+ let deferred3_1;
1821
+ try {
1822
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1823
+ const len0 = WASM_VECTOR_LEN;
1824
+ const ret = wasm.readFeedbackJsonl(ptr0, len0);
1825
+ var ptr2 = ret[0];
1826
+ var len2 = ret[1];
1827
+ if (ret[3]) {
1828
+ ptr2 = 0; len2 = 0;
1829
+ throw takeFromExternrefTable0(ret[2]);
1830
+ }
1831
+ deferred3_0 = ptr2;
1832
+ deferred3_1 = len2;
1833
+ return getStringFromWasm0(ptr2, len2);
1834
+ } finally {
1835
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1836
+ }
1837
+ }
1838
+ exports.readFeedbackJsonl = readFeedbackJsonl;
1839
+
1161
1840
  /**
1162
1841
  * Rerank candidates using BM25 + Cosine + RRF fusion.
1163
1842
  *
@@ -1184,6 +1863,95 @@ function rerank(query, query_embedding, candidates_json, top_k) {
1184
1863
  }
1185
1864
  exports.rerank = rerank;
1186
1865
 
1866
+ /**
1867
+ * Run the resolution formula on two contradicting claims; returns ResolutionOutcome JSON.
1868
+ * @param {string} claim_a_json
1869
+ * @param {string} claim_a_id
1870
+ * @param {string} claim_b_json
1871
+ * @param {string} claim_b_id
1872
+ * @param {bigint} now_unix_seconds
1873
+ * @param {string} weights_json
1874
+ * @returns {string}
1875
+ */
1876
+ function resolvePair(claim_a_json, claim_a_id, claim_b_json, claim_b_id, now_unix_seconds, weights_json) {
1877
+ let deferred7_0;
1878
+ let deferred7_1;
1879
+ try {
1880
+ const ptr0 = passStringToWasm0(claim_a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1881
+ const len0 = WASM_VECTOR_LEN;
1882
+ const ptr1 = passStringToWasm0(claim_a_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1883
+ const len1 = WASM_VECTOR_LEN;
1884
+ const ptr2 = passStringToWasm0(claim_b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1885
+ const len2 = WASM_VECTOR_LEN;
1886
+ const ptr3 = passStringToWasm0(claim_b_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1887
+ const len3 = WASM_VECTOR_LEN;
1888
+ const ptr4 = passStringToWasm0(weights_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1889
+ const len4 = WASM_VECTOR_LEN;
1890
+ const ret = wasm.resolvePair(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, now_unix_seconds, ptr4, len4);
1891
+ var ptr6 = ret[0];
1892
+ var len6 = ret[1];
1893
+ if (ret[3]) {
1894
+ ptr6 = 0; len6 = 0;
1895
+ throw takeFromExternrefTable0(ret[2]);
1896
+ }
1897
+ deferred7_0 = ptr6;
1898
+ deferred7_1 = len6;
1899
+ return getStringFromWasm0(ptr6, len6);
1900
+ } finally {
1901
+ wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
1902
+ }
1903
+ }
1904
+ exports.resolvePair = resolvePair;
1905
+
1906
+ /**
1907
+ * Keep only the most recent `max_lines` non-empty feedback log lines. Non-falliable.
1908
+ * @param {string} content
1909
+ * @param {bigint} max_lines
1910
+ * @returns {string}
1911
+ */
1912
+ function rotateFeedbackLog(content, max_lines) {
1913
+ let deferred2_0;
1914
+ let deferred2_1;
1915
+ try {
1916
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1917
+ const len0 = WASM_VECTOR_LEN;
1918
+ const ret = wasm.rotateFeedbackLog(ptr0, len0, max_lines);
1919
+ deferred2_0 = ret[0];
1920
+ deferred2_1 = ret[1];
1921
+ return getStringFromWasm0(ret[0], ret[1]);
1922
+ } finally {
1923
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1924
+ }
1925
+ }
1926
+ exports.rotateFeedbackLog = rotateFeedbackLog;
1927
+
1928
+ /**
1929
+ * Serialize a WeightsFile JSON to pretty-printed JSON (2-space indent).
1930
+ * @param {string} file_json
1931
+ * @returns {string}
1932
+ */
1933
+ function serializeWeightsFile(file_json) {
1934
+ let deferred3_0;
1935
+ let deferred3_1;
1936
+ try {
1937
+ const ptr0 = passStringToWasm0(file_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1938
+ const len0 = WASM_VECTOR_LEN;
1939
+ const ret = wasm.serializeWeightsFile(ptr0, len0);
1940
+ var ptr2 = ret[0];
1941
+ var len2 = ret[1];
1942
+ if (ret[3]) {
1943
+ ptr2 = 0; len2 = 0;
1944
+ throw takeFromExternrefTable0(ret[2]);
1945
+ }
1946
+ deferred3_0 = ptr2;
1947
+ deferred3_1 = len2;
1948
+ return getStringFromWasm0(ptr2, len2);
1949
+ } finally {
1950
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1951
+ }
1952
+ }
1953
+ exports.serializeWeightsFile = serializeWeightsFile;
1954
+
1187
1955
  /**
1188
1956
  * WASM binding: determine if a new fact should supersede an existing one.
1189
1957
  * @param {number} new_importance
@@ -1377,6 +2145,11 @@ function __wbg_get_imports() {
1377
2145
  const ret = getStringFromWasm0(arg0, arg1);
1378
2146
  return ret;
1379
2147
  },
2148
+ __wbindgen_cast_0000000000000004: function(arg0) {
2149
+ // Cast intrinsic for `U64 -> Externref`.
2150
+ const ret = BigInt.asUintN(64, arg0);
2151
+ return ret;
2152
+ },
1380
2153
  __wbindgen_init_externref_table: function() {
1381
2154
  const table = wasm.__wbindgen_externrefs;
1382
2155
  const offset = table.grow(4);
Binary file