@totalreclaw/core 1.4.0 → 1.5.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.4.0",
4
+ "version": "1.5.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,6 +1,21 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Contradiction candidate cap constant.
6
+ */
7
+ export function CONTRADICTION_CANDIDATE_CAP(): number;
8
+
9
+ /**
10
+ * Decision log max lines constant.
11
+ */
12
+ export function DECISION_LOG_MAX_LINES(): number;
13
+
14
+ /**
15
+ * Tie-zone score tolerance constant.
16
+ */
17
+ export function TIE_ZONE_SCORE_TOLERANCE(): number;
18
+
4
19
  /**
5
20
  * Random Hyperplane LSH hasher (WASM wrapper).
6
21
  *
@@ -47,6 +62,11 @@ export class WasmLshHasher {
47
62
  readonly tables: number;
48
63
  }
49
64
 
65
+ /**
66
+ * Append one decision entry to existing JSONL content. Non-fallible.
67
+ */
68
+ export function appendDecisionEntry(existing_content: string, entry_json: string): string;
69
+
50
70
  /**
51
71
  * Append one feedback entry to existing JSONL content.
52
72
  */
@@ -77,12 +97,25 @@ export function buildBatchCalldataFromPrepared(prepared_array_json: string): Uin
77
97
  */
78
98
  export function buildDebriefPrompt(stored_facts_json: string): string;
79
99
 
100
+ /**
101
+ * Build decision log entries from resolution actions.
102
+ *
103
+ * Returns a JSON array of `DecisionLogEntry`.
104
+ */
105
+ export function buildDecisionLogEntries(actions_json: string, new_claim_json: string, existing_claims_json: string, mode: string, now_unix: bigint): string;
106
+
80
107
  /**
81
108
  * Build the LLM prompt for digest compilation.
82
109
  * `claims_json`: JSON array of Claim (must be non-empty).
83
110
  */
84
111
  export function buildDigestPrompt(claims_json: string): string;
85
112
 
113
+ /**
114
+ * Build a FeedbackEntry JSON from a decision-log entry JSON + pin action.
115
+ * Returns the JSON string, or the literal string "null" on failure.
116
+ */
117
+ export function buildFeedbackFromDecision(decision_json: string, action: string, now_unix: bigint): string;
118
+
86
119
  /**
87
120
  * Build the profiling prompt for a batch of conversation summaries.
88
121
  *
@@ -137,6 +170,16 @@ export function canonicalizeClaim(claim_json: string): string;
137
170
  */
138
171
  export function chunksToSummaries(chunks_json: string): any;
139
172
 
173
+ /**
174
+ * WASM binding for `cluster_facts`.
175
+ *
176
+ * `candidates_json`: JSON array of `ConsolidationCandidate` objects.
177
+ * `threshold`: Cosine similarity threshold for clustering.
178
+ *
179
+ * Returns JSON array of `{ representative: string, duplicates: string[] }`.
180
+ */
181
+ export function clusterFacts(candidates_json: string, threshold: number): any;
182
+
140
183
  /**
141
184
  * Compute SHA-256(authKey) as a hex string.
142
185
  *
@@ -308,7 +351,37 @@ export function enrichExtractionPrompt(profile_json: string, base_prompt: string
308
351
  export function feedbackToCounterexample(entry_json: string): string;
309
352
 
310
353
  /**
311
- * WASM binding for `find_near_duplicate`.
354
+ * Filter resolution actions by mode ("active" passes through, "shadow"/"off" returns empty).
355
+ *
356
+ * Returns a JSON array of `ResolutionAction`.
357
+ */
358
+ export function filterShadowMode(actions_json: string, mode: string): string;
359
+
360
+ /**
361
+ * WASM binding for `find_best_near_duplicate`.
362
+ *
363
+ * `new_embedding_json`: JSON array of floats (embedding vector).
364
+ * `existing_json`: JSON array of `{ id: string, embedding: number[] }` objects.
365
+ * `threshold`: Cosine similarity threshold.
366
+ *
367
+ * Returns JSON `{ fact_id: string, similarity: number }` or null.
368
+ */
369
+ export function findBestNearDuplicate(new_embedding_json: string, existing_json: string, threshold: number): any;
370
+
371
+ /**
372
+ * Find a decision-log entry matching a fact as winner or loser.
373
+ * Returns the JSON-serialized DecisionLogEntry, or the literal string "null".
374
+ */
375
+ export function findDecisionForPin(fact_id: string, role: string, log_content: string): string;
376
+
377
+ /**
378
+ * Find the loser claim JSON from the decision log for a given fact ID.
379
+ * Returns the loser_claim_json string, or the literal string "null" if not found.
380
+ */
381
+ export function findLoserClaimInDecisionLog(fact_id: string, log_content: string): string;
382
+
383
+ /**
384
+ * WASM binding for `find_near_duplicate` (deprecated — use `findBestNearDuplicate`).
312
385
  *
313
386
  * `new_embedding`: Float32Array of the new fact's embedding.
314
387
  * `existing_json`: JSON array of `{ id: string, embedding: number[] }` objects.
@@ -449,6 +522,11 @@ export function hashUserOp(userop_json: string, entrypoint: string, chain_id: bi
449
522
  */
450
523
  export function hexBlobToBase64(hex_blob: string): string | undefined;
451
524
 
525
+ /**
526
+ * Check whether a JSON-serialized claim has pinned status.
527
+ */
528
+ export function isPinnedClaim(claim_json: string): boolean;
529
+
452
530
  /**
453
531
  * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
454
532
  */
@@ -571,6 +649,19 @@ export function rerank(query: string, query_embedding: Float32Array, candidates_
571
649
  */
572
650
  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
651
 
652
+ /**
653
+ * Orchestrate contradiction detection + resolution for a new claim against candidates.
654
+ *
655
+ * Returns a JSON array of `ResolutionAction`.
656
+ */
657
+ export function resolveWithCandidates(new_claim_json: string, new_claim_id: string, new_embedding_json: string, candidates_json: string, weights_json: string, threshold_lower: number, threshold_upper: number, now_unix: bigint, tie_tolerance: number): string;
658
+
659
+ /**
660
+ * Apply pin-status and tie-zone checks to a resolution outcome.
661
+ * Returns a JSON-serialized `ResolutionAction`.
662
+ */
663
+ export function respectPinInResolution(existing_claim_json: string, new_claim_id: string, existing_claim_id: string, resolution_winner: string, score_gap: number, similarity: number, tie_tolerance: number): string;
664
+
574
665
  /**
575
666
  * Keep only the most recent `max_lines` non-empty feedback log lines. Non-falliable.
576
667
  */
@@ -1,5 +1,35 @@
1
1
  /* @ts-self-types="./totalreclaw_core.d.ts" */
2
2
 
3
+ /**
4
+ * Contradiction candidate cap constant.
5
+ * @returns {number}
6
+ */
7
+ function CONTRADICTION_CANDIDATE_CAP() {
8
+ const ret = wasm.CONTRADICTION_CANDIDATE_CAP();
9
+ return ret >>> 0;
10
+ }
11
+ exports.CONTRADICTION_CANDIDATE_CAP = CONTRADICTION_CANDIDATE_CAP;
12
+
13
+ /**
14
+ * Decision log max lines constant.
15
+ * @returns {number}
16
+ */
17
+ function DECISION_LOG_MAX_LINES() {
18
+ const ret = wasm.DECISION_LOG_MAX_LINES();
19
+ return ret >>> 0;
20
+ }
21
+ exports.DECISION_LOG_MAX_LINES = DECISION_LOG_MAX_LINES;
22
+
23
+ /**
24
+ * Tie-zone score tolerance constant.
25
+ * @returns {number}
26
+ */
27
+ function TIE_ZONE_SCORE_TOLERANCE() {
28
+ const ret = wasm.TIE_ZONE_SCORE_TOLERANCE();
29
+ return ret;
30
+ }
31
+ exports.TIE_ZONE_SCORE_TOLERANCE = TIE_ZONE_SCORE_TOLERANCE;
32
+
3
33
  /**
4
34
  * Random Hyperplane LSH hasher (WASM wrapper).
5
35
  *
@@ -110,6 +140,30 @@ class WasmLshHasher {
110
140
  if (Symbol.dispose) WasmLshHasher.prototype[Symbol.dispose] = WasmLshHasher.prototype.free;
111
141
  exports.WasmLshHasher = WasmLshHasher;
112
142
 
143
+ /**
144
+ * Append one decision entry to existing JSONL content. Non-fallible.
145
+ * @param {string} existing_content
146
+ * @param {string} entry_json
147
+ * @returns {string}
148
+ */
149
+ function appendDecisionEntry(existing_content, entry_json) {
150
+ let deferred3_0;
151
+ let deferred3_1;
152
+ try {
153
+ const ptr0 = passStringToWasm0(existing_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
+ const len0 = WASM_VECTOR_LEN;
155
+ const ptr1 = passStringToWasm0(entry_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
156
+ const len1 = WASM_VECTOR_LEN;
157
+ const ret = wasm.appendDecisionEntry(ptr0, len0, ptr1, len1);
158
+ deferred3_0 = ret[0];
159
+ deferred3_1 = ret[1];
160
+ return getStringFromWasm0(ret[0], ret[1]);
161
+ } finally {
162
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
163
+ }
164
+ }
165
+ exports.appendDecisionEntry = appendDecisionEntry;
166
+
113
167
  /**
114
168
  * Append one feedback entry to existing JSONL content.
115
169
  * @param {string} existing
@@ -251,6 +305,45 @@ function buildDebriefPrompt(stored_facts_json) {
251
305
  }
252
306
  exports.buildDebriefPrompt = buildDebriefPrompt;
253
307
 
308
+ /**
309
+ * Build decision log entries from resolution actions.
310
+ *
311
+ * Returns a JSON array of `DecisionLogEntry`.
312
+ * @param {string} actions_json
313
+ * @param {string} new_claim_json
314
+ * @param {string} existing_claims_json
315
+ * @param {string} mode
316
+ * @param {bigint} now_unix
317
+ * @returns {string}
318
+ */
319
+ function buildDecisionLogEntries(actions_json, new_claim_json, existing_claims_json, mode, now_unix) {
320
+ let deferred6_0;
321
+ let deferred6_1;
322
+ try {
323
+ const ptr0 = passStringToWasm0(actions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ptr1 = passStringToWasm0(new_claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
326
+ const len1 = WASM_VECTOR_LEN;
327
+ const ptr2 = passStringToWasm0(existing_claims_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
+ const len2 = WASM_VECTOR_LEN;
329
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
330
+ const len3 = WASM_VECTOR_LEN;
331
+ const ret = wasm.buildDecisionLogEntries(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, now_unix);
332
+ var ptr5 = ret[0];
333
+ var len5 = ret[1];
334
+ if (ret[3]) {
335
+ ptr5 = 0; len5 = 0;
336
+ throw takeFromExternrefTable0(ret[2]);
337
+ }
338
+ deferred6_0 = ptr5;
339
+ deferred6_1 = len5;
340
+ return getStringFromWasm0(ptr5, len5);
341
+ } finally {
342
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
343
+ }
344
+ }
345
+ exports.buildDecisionLogEntries = buildDecisionLogEntries;
346
+
254
347
  /**
255
348
  * Build the LLM prompt for digest compilation.
256
349
  * `claims_json`: JSON array of Claim (must be non-empty).
@@ -279,6 +372,32 @@ function buildDigestPrompt(claims_json) {
279
372
  }
280
373
  exports.buildDigestPrompt = buildDigestPrompt;
281
374
 
375
+ /**
376
+ * Build a FeedbackEntry JSON from a decision-log entry JSON + pin action.
377
+ * Returns the JSON string, or the literal string "null" on failure.
378
+ * @param {string} decision_json
379
+ * @param {string} action
380
+ * @param {bigint} now_unix
381
+ * @returns {string}
382
+ */
383
+ function buildFeedbackFromDecision(decision_json, action, now_unix) {
384
+ let deferred3_0;
385
+ let deferred3_1;
386
+ try {
387
+ const ptr0 = passStringToWasm0(decision_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
388
+ const len0 = WASM_VECTOR_LEN;
389
+ const ptr1 = passStringToWasm0(action, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
390
+ const len1 = WASM_VECTOR_LEN;
391
+ const ret = wasm.buildFeedbackFromDecision(ptr0, len0, ptr1, len1, now_unix);
392
+ deferred3_0 = ret[0];
393
+ deferred3_1 = ret[1];
394
+ return getStringFromWasm0(ret[0], ret[1]);
395
+ } finally {
396
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
397
+ }
398
+ }
399
+ exports.buildFeedbackFromDecision = buildFeedbackFromDecision;
400
+
282
401
  /**
283
402
  * Build the profiling prompt for a batch of conversation summaries.
284
403
  *
@@ -471,6 +590,28 @@ function chunksToSummaries(chunks_json) {
471
590
  }
472
591
  exports.chunksToSummaries = chunksToSummaries;
473
592
 
593
+ /**
594
+ * WASM binding for `cluster_facts`.
595
+ *
596
+ * `candidates_json`: JSON array of `ConsolidationCandidate` objects.
597
+ * `threshold`: Cosine similarity threshold for clustering.
598
+ *
599
+ * Returns JSON array of `{ representative: string, duplicates: string[] }`.
600
+ * @param {string} candidates_json
601
+ * @param {number} threshold
602
+ * @returns {any}
603
+ */
604
+ function clusterFacts(candidates_json, threshold) {
605
+ const ptr0 = passStringToWasm0(candidates_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
606
+ const len0 = WASM_VECTOR_LEN;
607
+ const ret = wasm.clusterFacts(ptr0, len0, threshold);
608
+ if (ret[2]) {
609
+ throw takeFromExternrefTable0(ret[1]);
610
+ }
611
+ return takeFromExternrefTable0(ret[0]);
612
+ }
613
+ exports.clusterFacts = clusterFacts;
614
+
474
615
  /**
475
616
  * Compute SHA-256(authKey) as a hex string.
476
617
  *
@@ -1061,7 +1202,118 @@ function feedbackToCounterexample(entry_json) {
1061
1202
  exports.feedbackToCounterexample = feedbackToCounterexample;
1062
1203
 
1063
1204
  /**
1064
- * WASM binding for `find_near_duplicate`.
1205
+ * Filter resolution actions by mode ("active" passes through, "shadow"/"off" returns empty).
1206
+ *
1207
+ * Returns a JSON array of `ResolutionAction`.
1208
+ * @param {string} actions_json
1209
+ * @param {string} mode
1210
+ * @returns {string}
1211
+ */
1212
+ function filterShadowMode(actions_json, mode) {
1213
+ let deferred4_0;
1214
+ let deferred4_1;
1215
+ try {
1216
+ const ptr0 = passStringToWasm0(actions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1217
+ const len0 = WASM_VECTOR_LEN;
1218
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1219
+ const len1 = WASM_VECTOR_LEN;
1220
+ const ret = wasm.filterShadowMode(ptr0, len0, ptr1, len1);
1221
+ var ptr3 = ret[0];
1222
+ var len3 = ret[1];
1223
+ if (ret[3]) {
1224
+ ptr3 = 0; len3 = 0;
1225
+ throw takeFromExternrefTable0(ret[2]);
1226
+ }
1227
+ deferred4_0 = ptr3;
1228
+ deferred4_1 = len3;
1229
+ return getStringFromWasm0(ptr3, len3);
1230
+ } finally {
1231
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1232
+ }
1233
+ }
1234
+ exports.filterShadowMode = filterShadowMode;
1235
+
1236
+ /**
1237
+ * WASM binding for `find_best_near_duplicate`.
1238
+ *
1239
+ * `new_embedding_json`: JSON array of floats (embedding vector).
1240
+ * `existing_json`: JSON array of `{ id: string, embedding: number[] }` objects.
1241
+ * `threshold`: Cosine similarity threshold.
1242
+ *
1243
+ * Returns JSON `{ fact_id: string, similarity: number }` or null.
1244
+ * @param {string} new_embedding_json
1245
+ * @param {string} existing_json
1246
+ * @param {number} threshold
1247
+ * @returns {any}
1248
+ */
1249
+ function findBestNearDuplicate(new_embedding_json, existing_json, threshold) {
1250
+ const ptr0 = passStringToWasm0(new_embedding_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1251
+ const len0 = WASM_VECTOR_LEN;
1252
+ const ptr1 = passStringToWasm0(existing_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1253
+ const len1 = WASM_VECTOR_LEN;
1254
+ const ret = wasm.findBestNearDuplicate(ptr0, len0, ptr1, len1, threshold);
1255
+ if (ret[2]) {
1256
+ throw takeFromExternrefTable0(ret[1]);
1257
+ }
1258
+ return takeFromExternrefTable0(ret[0]);
1259
+ }
1260
+ exports.findBestNearDuplicate = findBestNearDuplicate;
1261
+
1262
+ /**
1263
+ * Find a decision-log entry matching a fact as winner or loser.
1264
+ * Returns the JSON-serialized DecisionLogEntry, or the literal string "null".
1265
+ * @param {string} fact_id
1266
+ * @param {string} role
1267
+ * @param {string} log_content
1268
+ * @returns {string}
1269
+ */
1270
+ function findDecisionForPin(fact_id, role, log_content) {
1271
+ let deferred4_0;
1272
+ let deferred4_1;
1273
+ try {
1274
+ const ptr0 = passStringToWasm0(fact_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1275
+ const len0 = WASM_VECTOR_LEN;
1276
+ const ptr1 = passStringToWasm0(role, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1277
+ const len1 = WASM_VECTOR_LEN;
1278
+ const ptr2 = passStringToWasm0(log_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1279
+ const len2 = WASM_VECTOR_LEN;
1280
+ const ret = wasm.findDecisionForPin(ptr0, len0, ptr1, len1, ptr2, len2);
1281
+ deferred4_0 = ret[0];
1282
+ deferred4_1 = ret[1];
1283
+ return getStringFromWasm0(ret[0], ret[1]);
1284
+ } finally {
1285
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1286
+ }
1287
+ }
1288
+ exports.findDecisionForPin = findDecisionForPin;
1289
+
1290
+ /**
1291
+ * Find the loser claim JSON from the decision log for a given fact ID.
1292
+ * Returns the loser_claim_json string, or the literal string "null" if not found.
1293
+ * @param {string} fact_id
1294
+ * @param {string} log_content
1295
+ * @returns {string}
1296
+ */
1297
+ function findLoserClaimInDecisionLog(fact_id, log_content) {
1298
+ let deferred3_0;
1299
+ let deferred3_1;
1300
+ try {
1301
+ const ptr0 = passStringToWasm0(fact_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1302
+ const len0 = WASM_VECTOR_LEN;
1303
+ const ptr1 = passStringToWasm0(log_content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1304
+ const len1 = WASM_VECTOR_LEN;
1305
+ const ret = wasm.findLoserClaimInDecisionLog(ptr0, len0, ptr1, len1);
1306
+ deferred3_0 = ret[0];
1307
+ deferred3_1 = ret[1];
1308
+ return getStringFromWasm0(ret[0], ret[1]);
1309
+ } finally {
1310
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1311
+ }
1312
+ }
1313
+ exports.findLoserClaimInDecisionLog = findLoserClaimInDecisionLog;
1314
+
1315
+ /**
1316
+ * WASM binding for `find_near_duplicate` (deprecated — use `findBestNearDuplicate`).
1065
1317
  *
1066
1318
  * `new_embedding`: Float32Array of the new fact's embedding.
1067
1319
  * `existing_json`: JSON array of `{ id: string, embedding: number[] }` objects.
@@ -1465,6 +1717,19 @@ function hexBlobToBase64(hex_blob) {
1465
1717
  }
1466
1718
  exports.hexBlobToBase64 = hexBlobToBase64;
1467
1719
 
1720
+ /**
1721
+ * Check whether a JSON-serialized claim has pinned status.
1722
+ * @param {string} claim_json
1723
+ * @returns {boolean}
1724
+ */
1725
+ function isPinnedClaim(claim_json) {
1726
+ const ptr0 = passStringToWasm0(claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1727
+ const len0 = WASM_VECTOR_LEN;
1728
+ const ret = wasm.isPinnedClaim(ptr0, len0);
1729
+ return ret !== 0;
1730
+ }
1731
+ exports.isPinnedClaim = isPinnedClaim;
1732
+
1468
1733
  /**
1469
1734
  * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
1470
1735
  * @param {string} name
@@ -1903,6 +2168,91 @@ function resolvePair(claim_a_json, claim_a_id, claim_b_json, claim_b_id, now_uni
1903
2168
  }
1904
2169
  exports.resolvePair = resolvePair;
1905
2170
 
2171
+ /**
2172
+ * Orchestrate contradiction detection + resolution for a new claim against candidates.
2173
+ *
2174
+ * Returns a JSON array of `ResolutionAction`.
2175
+ * @param {string} new_claim_json
2176
+ * @param {string} new_claim_id
2177
+ * @param {string} new_embedding_json
2178
+ * @param {string} candidates_json
2179
+ * @param {string} weights_json
2180
+ * @param {number} threshold_lower
2181
+ * @param {number} threshold_upper
2182
+ * @param {bigint} now_unix
2183
+ * @param {number} tie_tolerance
2184
+ * @returns {string}
2185
+ */
2186
+ function resolveWithCandidates(new_claim_json, new_claim_id, new_embedding_json, candidates_json, weights_json, threshold_lower, threshold_upper, now_unix, tie_tolerance) {
2187
+ let deferred7_0;
2188
+ let deferred7_1;
2189
+ try {
2190
+ const ptr0 = passStringToWasm0(new_claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2191
+ const len0 = WASM_VECTOR_LEN;
2192
+ const ptr1 = passStringToWasm0(new_claim_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2193
+ const len1 = WASM_VECTOR_LEN;
2194
+ const ptr2 = passStringToWasm0(new_embedding_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2195
+ const len2 = WASM_VECTOR_LEN;
2196
+ const ptr3 = passStringToWasm0(candidates_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2197
+ const len3 = WASM_VECTOR_LEN;
2198
+ const ptr4 = passStringToWasm0(weights_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2199
+ const len4 = WASM_VECTOR_LEN;
2200
+ const ret = wasm.resolveWithCandidates(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, threshold_lower, threshold_upper, now_unix, tie_tolerance);
2201
+ var ptr6 = ret[0];
2202
+ var len6 = ret[1];
2203
+ if (ret[3]) {
2204
+ ptr6 = 0; len6 = 0;
2205
+ throw takeFromExternrefTable0(ret[2]);
2206
+ }
2207
+ deferred7_0 = ptr6;
2208
+ deferred7_1 = len6;
2209
+ return getStringFromWasm0(ptr6, len6);
2210
+ } finally {
2211
+ wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
2212
+ }
2213
+ }
2214
+ exports.resolveWithCandidates = resolveWithCandidates;
2215
+
2216
+ /**
2217
+ * Apply pin-status and tie-zone checks to a resolution outcome.
2218
+ * Returns a JSON-serialized `ResolutionAction`.
2219
+ * @param {string} existing_claim_json
2220
+ * @param {string} new_claim_id
2221
+ * @param {string} existing_claim_id
2222
+ * @param {string} resolution_winner
2223
+ * @param {number} score_gap
2224
+ * @param {number} similarity
2225
+ * @param {number} tie_tolerance
2226
+ * @returns {string}
2227
+ */
2228
+ function respectPinInResolution(existing_claim_json, new_claim_id, existing_claim_id, resolution_winner, score_gap, similarity, tie_tolerance) {
2229
+ let deferred6_0;
2230
+ let deferred6_1;
2231
+ try {
2232
+ const ptr0 = passStringToWasm0(existing_claim_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2233
+ const len0 = WASM_VECTOR_LEN;
2234
+ const ptr1 = passStringToWasm0(new_claim_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2235
+ const len1 = WASM_VECTOR_LEN;
2236
+ const ptr2 = passStringToWasm0(existing_claim_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2237
+ const len2 = WASM_VECTOR_LEN;
2238
+ const ptr3 = passStringToWasm0(resolution_winner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2239
+ const len3 = WASM_VECTOR_LEN;
2240
+ const ret = wasm.respectPinInResolution(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, score_gap, similarity, tie_tolerance);
2241
+ var ptr5 = ret[0];
2242
+ var len5 = ret[1];
2243
+ if (ret[3]) {
2244
+ ptr5 = 0; len5 = 0;
2245
+ throw takeFromExternrefTable0(ret[2]);
2246
+ }
2247
+ deferred6_0 = ptr5;
2248
+ deferred6_1 = len5;
2249
+ return getStringFromWasm0(ptr5, len5);
2250
+ } finally {
2251
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
2252
+ }
2253
+ }
2254
+ exports.respectPinInResolution = respectPinInResolution;
2255
+
1906
2256
  /**
1907
2257
  * Keep only the most recent `max_lines` non-empty feedback log lines. Non-falliable.
1908
2258
  * @param {string} content
Binary file