@totalreclaw/core 2.7.0 → 2.8.0-rc.2

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.
@@ -27,6 +27,89 @@ export function TIE_ZONE_SCORE_TOLERANCE() {
27
27
  return ret;
28
28
  }
29
29
 
30
+ /**
31
+ * Keyed blind-tag generator (index scheme 1). Construct from the vault's
32
+ * `encryptionKey`; `indexKey` is derived inside core and never exposed (no
33
+ * key getter, no string conversion).
34
+ */
35
+ export class WasmBlindIndexer {
36
+ __destroy_into_raw() {
37
+ const ptr = this.__wbg_ptr;
38
+ this.__wbg_ptr = 0;
39
+ WasmBlindIndexerFinalization.unregister(this);
40
+ return ptr;
41
+ }
42
+ free() {
43
+ const ptr = this.__destroy_into_raw();
44
+ wasm.__wbg_wasmblindindexer_free(ptr, 0);
45
+ }
46
+ /**
47
+ * Tag of the digest-fact marker.
48
+ * @returns {string}
49
+ */
50
+ digestMarkerTag() {
51
+ let deferred1_0;
52
+ let deferred1_1;
53
+ try {
54
+ const ret = wasm.wasmblindindexer_digestMarkerTag(this.__wbg_ptr);
55
+ deferred1_0 = ret[0];
56
+ deferred1_1 = ret[1];
57
+ return getStringFromWasm0(ret[0], ret[1]);
58
+ } finally {
59
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
60
+ }
61
+ }
62
+ /**
63
+ * Tag of an entity name (normalised in core).
64
+ * @param {string} name
65
+ * @returns {string}
66
+ */
67
+ entityTag(name) {
68
+ let deferred2_0;
69
+ let deferred2_1;
70
+ try {
71
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
72
+ const len0 = WASM_VECTOR_LEN;
73
+ const ret = wasm.wasmblindindexer_entityTag(this.__wbg_ptr, ptr0, len0);
74
+ deferred2_0 = ret[0];
75
+ deferred2_1 = ret[1];
76
+ return getStringFromWasm0(ret[0], ret[1]);
77
+ } finally {
78
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
79
+ }
80
+ }
81
+ /**
82
+ * `encryption_key_hex`: 64-char hex string (32 bytes).
83
+ * @param {string} encryption_key_hex
84
+ */
85
+ constructor(encryption_key_hex) {
86
+ const ptr0 = passStringToWasm0(encryption_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
87
+ const len0 = WASM_VECTOR_LEN;
88
+ const ret = wasm.wasmblindindexer_new(ptr0, len0);
89
+ if (ret[2]) {
90
+ throw takeFromExternrefTable0(ret[1]);
91
+ }
92
+ this.__wbg_ptr = ret[0] >>> 0;
93
+ WasmBlindIndexerFinalization.register(this, this.__wbg_ptr, this);
94
+ return this;
95
+ }
96
+ /**
97
+ * Stem tags of a text, sorted and deduplicated. JSON array of hex strings.
98
+ * @param {string} text
99
+ * @returns {any}
100
+ */
101
+ stemTags(text) {
102
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
103
+ const len0 = WASM_VECTOR_LEN;
104
+ const ret = wasm.wasmblindindexer_stemTags(this.__wbg_ptr, ptr0, len0);
105
+ if (ret[2]) {
106
+ throw takeFromExternrefTable0(ret[1]);
107
+ }
108
+ return takeFromExternrefTable0(ret[0]);
109
+ }
110
+ }
111
+ if (Symbol.dispose) WasmBlindIndexer.prototype[Symbol.dispose] = WasmBlindIndexer.prototype.free;
112
+
30
113
  /**
31
114
  * Random Hyperplane LSH hasher (WASM wrapper).
32
115
  *
@@ -84,6 +167,23 @@ export class WasmLshHasher {
84
167
  }
85
168
  return takeFromExternrefTable0(ret[0]);
86
169
  }
170
+ /**
171
+ * Hash an embedding vector to KEYED bucket tags (index scheme 1).
172
+ *
173
+ * Returns a JSON array of hex strings (one per table). `lshBucketKey` is
174
+ * derived from the seed inside core and never exposed.
175
+ * @param {Float64Array} embedding
176
+ * @returns {any}
177
+ */
178
+ hashKeyed(embedding) {
179
+ const ptr0 = passArrayF64ToWasm0(embedding, wasm.__wbindgen_malloc);
180
+ const len0 = WASM_VECTOR_LEN;
181
+ const ret = wasm.wasmlshhasher_hashKeyed(this.__wbg_ptr, ptr0, len0);
182
+ if (ret[2]) {
183
+ throw takeFromExternrefTable0(ret[1]);
184
+ }
185
+ return takeFromExternrefTable0(ret[0]);
186
+ }
87
187
  /**
88
188
  * Create a new LSH hasher with default parameters (20 tables, 32 bits).
89
189
  *
@@ -755,6 +855,56 @@ export function computeScoreComponents(claim_json, now_unix_seconds, weights_jso
755
855
  }
756
856
  }
757
857
 
858
+ /**
859
+ * State of one fact: `"active"`, `"inactive"` or `"missing"`. `"missing"` is
860
+ * not a confirmed delete. Throws on an unreadable response or a bad id/owner.
861
+ * @param {string} owner
862
+ * @param {string} id
863
+ * @param {string} response_json
864
+ * @returns {string}
865
+ */
866
+ export function confirmLookupParse(owner, id, response_json) {
867
+ let deferred5_0;
868
+ let deferred5_1;
869
+ try {
870
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
871
+ const len0 = WASM_VECTOR_LEN;
872
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
873
+ const len1 = WASM_VECTOR_LEN;
874
+ const ptr2 = passStringToWasm0(response_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
875
+ const len2 = WASM_VECTOR_LEN;
876
+ const ret = wasm.confirmLookupParse(ptr0, len0, ptr1, len1, ptr2, len2);
877
+ var ptr4 = ret[0];
878
+ var len4 = ret[1];
879
+ if (ret[3]) {
880
+ ptr4 = 0; len4 = 0;
881
+ throw takeFromExternrefTable0(ret[2]);
882
+ }
883
+ deferred5_0 = ptr4;
884
+ deferred5_1 = len4;
885
+ return getStringFromWasm0(ptr4, len4);
886
+ } finally {
887
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
888
+ }
889
+ }
890
+
891
+ /**
892
+ * GraphQL query (`$ids` = `lookupIds`, `$owner`) for `confirmLookupParse`.
893
+ * @returns {string}
894
+ */
895
+ export function confirmLookupQuery() {
896
+ let deferred1_0;
897
+ let deferred1_1;
898
+ try {
899
+ const ret = wasm.confirmLookupQuery();
900
+ deferred1_0 = ret[0];
901
+ deferred1_1 = ret[1];
902
+ return getStringFromWasm0(ret[0], ret[1]);
903
+ } finally {
904
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
905
+ }
906
+ }
907
+
758
908
  /**
759
909
  * Cosine similarity between two f32 vectors.
760
910
  * @param {Float32Array} a
@@ -1298,6 +1448,25 @@ export function encodeFactProtobuf(json) {
1298
1448
  return v2;
1299
1449
  }
1300
1450
 
1451
+ /**
1452
+ * Encode a scheme-1 fact: field 5 sorted and deduplicated, field 14 `index_scheme = 1`,
1453
+ * outer version always 4 (any `version` in the JSON is ignored). Same JSON as
1454
+ * `encodeFactProtobuf`; throws unless every `blind_indices` entry is 64 lowercase hex.
1455
+ * @param {string} json
1456
+ * @returns {Uint8Array}
1457
+ */
1458
+ export function encodeFactProtobufKeyed(json) {
1459
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1460
+ const len0 = WASM_VECTOR_LEN;
1461
+ const ret = wasm.encodeFactProtobufKeyed(ptr0, len0);
1462
+ if (ret[3]) {
1463
+ throw takeFromExternrefTable0(ret[2]);
1464
+ }
1465
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1466
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1467
+ return v2;
1468
+ }
1469
+
1301
1470
  /**
1302
1471
  * Encode a single fact submission as SimpleAccount.execute() calldata.
1303
1472
  *
@@ -1362,6 +1531,23 @@ export function encodeTombstoneProtobuf(fact_id, owner, version) {
1362
1531
  return v3;
1363
1532
  }
1364
1533
 
1534
+ /**
1535
+ * Encode a scheme-1 tombstone: outer version 4 plus field 14 `index_scheme = 1`.
1536
+ * @param {string} fact_id
1537
+ * @param {string} owner
1538
+ * @returns {Uint8Array}
1539
+ */
1540
+ export function encodeTombstoneProtobufKeyed(fact_id, owner) {
1541
+ const ptr0 = passStringToWasm0(fact_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1542
+ const len0 = WASM_VECTOR_LEN;
1543
+ const ptr1 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1544
+ const len1 = WASM_VECTOR_LEN;
1545
+ const ret = wasm.encodeTombstoneProtobufKeyed(ptr0, len0, ptr1, len1);
1546
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1547
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1548
+ return v3;
1549
+ }
1550
+
1365
1551
  /**
1366
1552
  * Encrypt a UTF-8 plaintext with XChaCha20-Poly1305.
1367
1553
  *
@@ -1725,6 +1911,36 @@ export function generateContentFingerprint(plaintext, dedup_key_hex) {
1725
1911
  }
1726
1912
  }
1727
1913
 
1914
+ /**
1915
+ * Content fingerprint v2 (index scheme 1): HMAC under `fpKeyV2`, which core
1916
+ * derives from `dedupKey`. Not interchangeable with `generateContentFingerprint`.
1917
+ * @param {string} plaintext
1918
+ * @param {string} dedup_key_hex
1919
+ * @returns {string}
1920
+ */
1921
+ export function generateContentFingerprintV2(plaintext, dedup_key_hex) {
1922
+ let deferred4_0;
1923
+ let deferred4_1;
1924
+ try {
1925
+ const ptr0 = passStringToWasm0(plaintext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1926
+ const len0 = WASM_VECTOR_LEN;
1927
+ const ptr1 = passStringToWasm0(dedup_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1928
+ const len1 = WASM_VECTOR_LEN;
1929
+ const ret = wasm.generateContentFingerprintV2(ptr0, len0, ptr1, len1);
1930
+ var ptr3 = ret[0];
1931
+ var len3 = ret[1];
1932
+ if (ret[3]) {
1933
+ ptr3 = 0; len3 = 0;
1934
+ throw takeFromExternrefTable0(ret[2]);
1935
+ }
1936
+ deferred4_0 = ptr3;
1937
+ deferred4_1 = len3;
1938
+ return getStringFromWasm0(ptr3, len3);
1939
+ } finally {
1940
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1941
+ }
1942
+ }
1943
+
1728
1944
  /**
1729
1945
  * Generate trapdoors for multiple query reformulations (expansion pipeline).
1730
1946
  *
@@ -1777,6 +1993,31 @@ export function generateSearchTrapdoors(query, query_embedding, lsh_hasher) {
1777
1993
  return takeFromExternrefTable0(ret[0]);
1778
1994
  }
1779
1995
 
1996
+ /**
1997
+ * Keyed search trapdoors (index scheme 1): stem tags + one entity tag per name +
1998
+ * keyed LSH tags, sorted and deduplicated. `entity_names`: JSON array of strings.
1999
+ * Returns a JsValue (JSON array of hex strings); final, batch as is.
2000
+ * @param {string} query
2001
+ * @param {any} entity_names
2002
+ * @param {Float32Array} query_embedding
2003
+ * @param {WasmBlindIndexer} indexer
2004
+ * @param {WasmLshHasher} lsh_hasher
2005
+ * @returns {any}
2006
+ */
2007
+ export function generateSearchTrapdoorsKeyed(query, entity_names, query_embedding, indexer, lsh_hasher) {
2008
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2009
+ const len0 = WASM_VECTOR_LEN;
2010
+ const ptr1 = passArrayF32ToWasm0(query_embedding, wasm.__wbindgen_malloc);
2011
+ const len1 = WASM_VECTOR_LEN;
2012
+ _assertClass(indexer, WasmBlindIndexer);
2013
+ _assertClass(lsh_hasher, WasmLshHasher);
2014
+ const ret = wasm.generateSearchTrapdoorsKeyed(ptr0, len0, entity_names, ptr1, len1, indexer.__wbg_ptr, lsh_hasher.__wbg_ptr);
2015
+ if (ret[2]) {
2016
+ throw takeFromExternrefTable0(ret[1]);
2017
+ }
2018
+ return takeFromExternrefTable0(ret[0]);
2019
+ }
2020
+
1780
2021
  /**
1781
2022
  * Get the GraphQL query string for broadened (fallback) search.
1782
2023
  * @returns {string}
@@ -2190,6 +2431,36 @@ export function isValidMemoryType(value) {
2190
2431
  return ret !== 0;
2191
2432
  }
2192
2433
 
2434
+ /**
2435
+ * The same-fact judge prompt for one pair: JSON `{system, user}`. Line
2436
+ * breaks in either text are collapsed to spaces.
2437
+ * @param {string} existing
2438
+ * @param {string} candidate
2439
+ * @returns {string}
2440
+ */
2441
+ export function judgePrompt(existing, candidate) {
2442
+ let deferred4_0;
2443
+ let deferred4_1;
2444
+ try {
2445
+ const ptr0 = passStringToWasm0(existing, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2446
+ const len0 = WASM_VECTOR_LEN;
2447
+ const ptr1 = passStringToWasm0(candidate, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2448
+ const len1 = WASM_VECTOR_LEN;
2449
+ const ret = wasm.judgePrompt(ptr0, len0, ptr1, len1);
2450
+ var ptr3 = ret[0];
2451
+ var len3 = ret[1];
2452
+ if (ret[3]) {
2453
+ ptr3 = 0; len3 = 0;
2454
+ throw takeFromExternrefTable0(ret[2]);
2455
+ }
2456
+ deferred4_0 = ptr3;
2457
+ deferred4_1 = len3;
2458
+ return getStringFromWasm0(ptr3, len3);
2459
+ } finally {
2460
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2461
+ }
2462
+ }
2463
+
2193
2464
  /**
2194
2465
  * Return the v1 legacy-claim fallback weight (applied to candidates that
2195
2466
  * have no `source` field).
@@ -2200,6 +2471,38 @@ export function legacyClaimFallbackWeight() {
2200
2471
  return ret;
2201
2472
  }
2202
2473
 
2474
+ /**
2475
+ * On-chain `decayScore` for every LIVE fact (always `1.0`; #789).
2476
+ *
2477
+ * `0` = tombstone, `1.0` = live; carries no importance. Never use for tombstones.
2478
+ * @returns {number}
2479
+ */
2480
+ export function liveDecayScore() {
2481
+ const ret = wasm.liveDecayScore();
2482
+ return ret;
2483
+ }
2484
+
2485
+ /**
2486
+ * Ids to request for one fact on V1 or V2 (`id_in`), in precedence order.
2487
+ * Throws like `toSubgraphId`.
2488
+ * @param {string} owner
2489
+ * @param {string} id
2490
+ * @returns {string[]}
2491
+ */
2492
+ export function lookupIds(owner, id) {
2493
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2494
+ const len0 = WASM_VECTOR_LEN;
2495
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2496
+ const len1 = WASM_VECTOR_LEN;
2497
+ const ret = wasm.lookupIds(ptr0, len0, ptr1, len1);
2498
+ if (ret[3]) {
2499
+ throw takeFromExternrefTable0(ret[2]);
2500
+ }
2501
+ var v3 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2502
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2503
+ return v3;
2504
+ }
2505
+
2203
2506
  /**
2204
2507
  * Map a v1 type to its short-form category key.
2205
2508
  *
@@ -2460,6 +2763,33 @@ export function parseGemini(input) {
2460
2763
  return takeFromExternrefTable0(ret[0]);
2461
2764
  }
2462
2765
 
2766
+ /**
2767
+ * Parse a judge reply. Returns JSON: `"SAME"` (one of the seven relation
2768
+ * words, upper case) or `null`.
2769
+ * @param {string} raw
2770
+ * @returns {string}
2771
+ */
2772
+ export function parseJudgeAnswer(raw) {
2773
+ let deferred3_0;
2774
+ let deferred3_1;
2775
+ try {
2776
+ const ptr0 = passStringToWasm0(raw, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2777
+ const len0 = WASM_VECTOR_LEN;
2778
+ const ret = wasm.parseJudgeAnswer(ptr0, len0);
2779
+ var ptr2 = ret[0];
2780
+ var len2 = ret[1];
2781
+ if (ret[3]) {
2782
+ ptr2 = 0; len2 = 0;
2783
+ throw takeFromExternrefTable0(ret[2]);
2784
+ }
2785
+ deferred3_0 = ptr2;
2786
+ deferred3_1 = len2;
2787
+ return getStringFromWasm0(ptr2, len2);
2788
+ } finally {
2789
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2790
+ }
2791
+ }
2792
+
2463
2793
  /**
2464
2794
  * Case-insensitive parse of a memory source string. Unknown input returns "user-inferred".
2465
2795
  * @param {string} s
@@ -2668,6 +2998,78 @@ export function pinBoost(tier_json, now_unix, config_json) {
2668
2998
  return ret[0];
2669
2999
  }
2670
3000
 
3001
+ /**
3002
+ * Pick the forgotten entries the LLM should judge for a candidate.
3003
+ *
3004
+ * `entriesJson`: JSON array of `{id, text, embedding?}`. Returns a plan:
3005
+ * `{"kind":"decided","match":null|{...}}` or
3006
+ * `{"kind":"ask","pairs":[...],"fallback":...,"unjudged":...}`.
3007
+ * @param {string} text
3008
+ * @param {string} embedding_json
3009
+ * @param {string} entries_json
3010
+ * @returns {string}
3011
+ */
3012
+ export function planForgetJudge(text, embedding_json, entries_json) {
3013
+ let deferred5_0;
3014
+ let deferred5_1;
3015
+ try {
3016
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3017
+ const len0 = WASM_VECTOR_LEN;
3018
+ const ptr1 = passStringToWasm0(embedding_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3019
+ const len1 = WASM_VECTOR_LEN;
3020
+ const ptr2 = passStringToWasm0(entries_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3021
+ const len2 = WASM_VECTOR_LEN;
3022
+ const ret = wasm.planForgetJudge(ptr0, len0, ptr1, len1, ptr2, len2);
3023
+ var ptr4 = ret[0];
3024
+ var len4 = ret[1];
3025
+ if (ret[3]) {
3026
+ ptr4 = 0; len4 = 0;
3027
+ throw takeFromExternrefTable0(ret[2]);
3028
+ }
3029
+ deferred5_0 = ptr4;
3030
+ deferred5_1 = len4;
3031
+ return getStringFromWasm0(ptr4, len4);
3032
+ } finally {
3033
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3034
+ }
3035
+ }
3036
+
3037
+ /**
3038
+ * Pick the pairs the LLM should judge for a new fact (auto mode).
3039
+ *
3040
+ * `candidatesJson`: JSON array of `{id, text, embedding?, pinned?, pending?}`.
3041
+ * Returns a plan: `{"kind":"decided","decision":{...}}` or
3042
+ * `{"kind":"ask","pairs":[...],"fallback":{...}}`.
3043
+ * @param {string} text
3044
+ * @param {string} embedding_json
3045
+ * @param {string} candidates_json
3046
+ * @returns {string}
3047
+ */
3048
+ export function planJudgedWrite(text, embedding_json, candidates_json) {
3049
+ let deferred5_0;
3050
+ let deferred5_1;
3051
+ try {
3052
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3053
+ const len0 = WASM_VECTOR_LEN;
3054
+ const ptr1 = passStringToWasm0(embedding_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3055
+ const len1 = WASM_VECTOR_LEN;
3056
+ const ptr2 = passStringToWasm0(candidates_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3057
+ const len2 = WASM_VECTOR_LEN;
3058
+ const ret = wasm.planJudgedWrite(ptr0, len0, ptr1, len1, ptr2, len2);
3059
+ var ptr4 = ret[0];
3060
+ var len4 = ret[1];
3061
+ if (ret[3]) {
3062
+ ptr4 = 0; len4 = 0;
3063
+ throw takeFromExternrefTable0(ret[2]);
3064
+ }
3065
+ deferred5_0 = ptr4;
3066
+ deferred5_1 = len4;
3067
+ return getStringFromWasm0(ptr4, len4);
3068
+ } finally {
3069
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3070
+ }
3071
+ }
3072
+
2671
3073
  /**
2672
3074
  * Prepare a fact for on-chain storage.
2673
3075
  *
@@ -2882,6 +3284,68 @@ export function rerankWithConfig(query, query_embedding, candidates_json, top_k,
2882
3284
  return takeFromExternrefTable0(ret[0]);
2883
3285
  }
2884
3286
 
3287
+ /**
3288
+ * Map the verdicts to `null` (store) or the blocking match `{id, reason, cosine}`.
3289
+ * @param {string} plan_json
3290
+ * @param {string} verdicts_json
3291
+ * @returns {string}
3292
+ */
3293
+ export function resolveForgetJudge(plan_json, verdicts_json) {
3294
+ let deferred4_0;
3295
+ let deferred4_1;
3296
+ try {
3297
+ const ptr0 = passStringToWasm0(plan_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3298
+ const len0 = WASM_VECTOR_LEN;
3299
+ const ptr1 = passStringToWasm0(verdicts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3300
+ const len1 = WASM_VECTOR_LEN;
3301
+ const ret = wasm.resolveForgetJudge(ptr0, len0, ptr1, len1);
3302
+ var ptr3 = ret[0];
3303
+ var len3 = ret[1];
3304
+ if (ret[3]) {
3305
+ ptr3 = 0; len3 = 0;
3306
+ throw takeFromExternrefTable0(ret[2]);
3307
+ }
3308
+ deferred4_0 = ptr3;
3309
+ deferred4_1 = len3;
3310
+ return getStringFromWasm0(ptr3, len3);
3311
+ } finally {
3312
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3313
+ }
3314
+ }
3315
+
3316
+ /**
3317
+ * Map the verdicts (JSON array, one relation word or `null` per pair) to a
3318
+ * decision `{action, match, relation, judged}`.
3319
+ * @param {string} text
3320
+ * @param {string} plan_json
3321
+ * @param {string} verdicts_json
3322
+ * @returns {string}
3323
+ */
3324
+ export function resolveJudgedWrite(text, plan_json, verdicts_json) {
3325
+ let deferred5_0;
3326
+ let deferred5_1;
3327
+ try {
3328
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3329
+ const len0 = WASM_VECTOR_LEN;
3330
+ const ptr1 = passStringToWasm0(plan_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3331
+ const len1 = WASM_VECTOR_LEN;
3332
+ const ptr2 = passStringToWasm0(verdicts_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3333
+ const len2 = WASM_VECTOR_LEN;
3334
+ const ret = wasm.resolveJudgedWrite(ptr0, len0, ptr1, len1, ptr2, len2);
3335
+ var ptr4 = ret[0];
3336
+ var len4 = ret[1];
3337
+ if (ret[3]) {
3338
+ ptr4 = 0; len4 = 0;
3339
+ throw takeFromExternrefTable0(ret[2]);
3340
+ }
3341
+ deferred5_0 = ptr4;
3342
+ deferred5_1 = len4;
3343
+ return getStringFromWasm0(ptr4, len4);
3344
+ } finally {
3345
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3346
+ }
3347
+ }
3348
+
2885
3349
  /**
2886
3350
  * Run the resolution formula on two contradicting claims; returns ResolutionOutcome JSON.
2887
3351
  * @param {string} claim_a_json
@@ -3059,6 +3523,34 @@ export function segmentSessions(timestamps_json, embeddings_json, gap_seconds, s
3059
3523
  return takeFromExternrefTable0(ret[0]);
3060
3524
  }
3061
3525
 
3526
+ /**
3527
+ * JSON text of the fact's row, byte for byte, or `undefined` when the subgraph
3528
+ * answered without one. For any `facts(where: {id_in, owner})` query that
3529
+ * selects `id`, `owner` and `isActive`. Throws like `confirmLookupParse`.
3530
+ * @param {string} owner
3531
+ * @param {string} id
3532
+ * @param {string} response_json
3533
+ * @returns {string | undefined}
3534
+ */
3535
+ export function selectFactRow(owner, id, response_json) {
3536
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3537
+ const len0 = WASM_VECTOR_LEN;
3538
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3539
+ const len1 = WASM_VECTOR_LEN;
3540
+ const ptr2 = passStringToWasm0(response_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3541
+ const len2 = WASM_VECTOR_LEN;
3542
+ const ret = wasm.selectFactRow(ptr0, len0, ptr1, len1, ptr2, len2);
3543
+ if (ret[3]) {
3544
+ throw takeFromExternrefTable0(ret[2]);
3545
+ }
3546
+ let v4;
3547
+ if (ret[0] !== 0) {
3548
+ v4 = getStringFromWasm0(ret[0], ret[1]).slice();
3549
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3550
+ }
3551
+ return v4;
3552
+ }
3553
+
3062
3554
  /**
3063
3555
  * Serialize a WeightsFile JSON to pretty-printed JSON (2-space indent).
3064
3556
  * @param {string} file_json
@@ -3129,6 +3621,19 @@ export function signUserOp(hash_hex, private_key_hex) {
3129
3621
  }
3130
3622
  }
3131
3623
 
3624
+ /**
3625
+ * Sort ascending and deduplicate a list of tags (call before batching a query).
3626
+ * @param {any} tags
3627
+ * @returns {any}
3628
+ */
3629
+ export function sortDedupTags(tags) {
3630
+ const ret = wasm.sortDedupTags(tags);
3631
+ if (ret[2]) {
3632
+ throw takeFromExternrefTable0(ret[1]);
3633
+ }
3634
+ return takeFromExternrefTable0(ret[0]);
3635
+ }
3636
+
3132
3637
  /**
3133
3638
  * Return the source weight multiplier for a given source string.
3134
3639
  *
@@ -3148,6 +3653,66 @@ export function sourceWeight(source) {
3148
3653
  return ret;
3149
3654
  }
3150
3655
 
3656
+ /**
3657
+ * Payload id: `id` without the owner's own prefix. Use it for every write and
3658
+ * every stored id. Throws on a non-address owner or an empty id.
3659
+ * @param {string} owner
3660
+ * @param {string} id
3661
+ * @returns {string}
3662
+ */
3663
+ export function toPayloadId(owner, id) {
3664
+ let deferred4_0;
3665
+ let deferred4_1;
3666
+ try {
3667
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3668
+ const len0 = WASM_VECTOR_LEN;
3669
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3670
+ const len1 = WASM_VECTOR_LEN;
3671
+ const ret = wasm.toPayloadId(ptr0, len0, ptr1, len1);
3672
+ var ptr3 = ret[0];
3673
+ var len3 = ret[1];
3674
+ if (ret[3]) {
3675
+ ptr3 = 0; len3 = 0;
3676
+ throw takeFromExternrefTable0(ret[2]);
3677
+ }
3678
+ deferred4_0 = ptr3;
3679
+ deferred4_1 = len3;
3680
+ return getStringFromWasm0(ptr3, len3);
3681
+ } finally {
3682
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3683
+ }
3684
+ }
3685
+
3686
+ /**
3687
+ * V2 subgraph id `<owner>:<payload id>` from either form of a fact id.
3688
+ * Throws on a non-address owner, an empty id or another account's prefix.
3689
+ * @param {string} owner
3690
+ * @param {string} id
3691
+ * @returns {string}
3692
+ */
3693
+ export function toSubgraphId(owner, id) {
3694
+ let deferred4_0;
3695
+ let deferred4_1;
3696
+ try {
3697
+ const ptr0 = passStringToWasm0(owner, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3698
+ const len0 = WASM_VECTOR_LEN;
3699
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3700
+ const len1 = WASM_VECTOR_LEN;
3701
+ const ret = wasm.toSubgraphId(ptr0, len0, ptr1, len1);
3702
+ var ptr3 = ret[0];
3703
+ var len3 = ret[1];
3704
+ if (ret[3]) {
3705
+ ptr3 = 0; len3 = 0;
3706
+ throw takeFromExternrefTable0(ret[2]);
3707
+ }
3708
+ deferred4_0 = ptr3;
3709
+ deferred4_1 = len3;
3710
+ return getStringFromWasm0(ptr3, len3);
3711
+ } finally {
3712
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3713
+ }
3714
+ }
3715
+
3151
3716
  /**
3152
3717
  * Validate a `derived-bundle-v1` JSON string against every invariant in
3153
3718
  * derived-bundle-v1.md §4.7. Throws on any violation; resolves to nothing
@@ -3261,6 +3826,18 @@ function __wbg_get_imports() {
3261
3826
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3262
3827
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3263
3828
  },
3829
+ __wbg___wbindgen_boolean_get_a86c216575a75c30: function(arg0) {
3830
+ const v = arg0;
3831
+ const ret = typeof(v) === 'boolean' ? v : undefined;
3832
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
3833
+ },
3834
+ __wbg___wbindgen_debug_string_dd5d2d07ce9e6c57: function(arg0, arg1) {
3835
+ const ret = debugString(arg1);
3836
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3837
+ const len1 = WASM_VECTOR_LEN;
3838
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3839
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3840
+ },
3264
3841
  __wbg___wbindgen_is_function_49868bde5eb1e745: function(arg0) {
3265
3842
  const ret = typeof(arg0) === 'function';
3266
3843
  return ret;
@@ -3278,9 +3855,31 @@ function __wbg_get_imports() {
3278
3855
  const ret = arg0 === undefined;
3279
3856
  return ret;
3280
3857
  },
3858
+ __wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944: function(arg0, arg1) {
3859
+ const ret = arg0 == arg1;
3860
+ return ret;
3861
+ },
3862
+ __wbg___wbindgen_number_get_7579aab02a8a620c: function(arg0, arg1) {
3863
+ const obj = arg1;
3864
+ const ret = typeof(obj) === 'number' ? obj : undefined;
3865
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
3866
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
3867
+ },
3868
+ __wbg___wbindgen_string_get_914df97fcfa788f2: function(arg0, arg1) {
3869
+ const obj = arg1;
3870
+ const ret = typeof(obj) === 'string' ? obj : undefined;
3871
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3872
+ var len1 = WASM_VECTOR_LEN;
3873
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3874
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3875
+ },
3281
3876
  __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
3282
3877
  throw new Error(getStringFromWasm0(arg0, arg1));
3283
3878
  },
3879
+ __wbg_call_7f2987183bb62793: function() { return handleError(function (arg0, arg1) {
3880
+ const ret = arg0.call(arg1);
3881
+ return ret;
3882
+ }, arguments); },
3284
3883
  __wbg_call_d578befcc3145dee: function() { return handleError(function (arg0, arg1, arg2) {
3285
3884
  const ret = arg0.call(arg1, arg2);
3286
3885
  return ret;
@@ -3289,6 +3888,10 @@ function __wbg_get_imports() {
3289
3888
  const ret = arg0.crypto;
3290
3889
  return ret;
3291
3890
  },
3891
+ __wbg_done_547d467e97529006: function(arg0) {
3892
+ const ret = arg0.done;
3893
+ return ret;
3894
+ },
3292
3895
  __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
3293
3896
  arg0.getRandomValues(arg1);
3294
3897
  }, arguments); },
@@ -3299,10 +3902,50 @@ function __wbg_get_imports() {
3299
3902
  const ret = arg0.getTime();
3300
3903
  return ret;
3301
3904
  },
3905
+ __wbg_get_ed0642c4b9d31ddf: function() { return handleError(function (arg0, arg1) {
3906
+ const ret = Reflect.get(arg0, arg1);
3907
+ return ret;
3908
+ }, arguments); },
3909
+ __wbg_get_unchecked_7d7babe32e9e6a54: function(arg0, arg1) {
3910
+ const ret = arg0[arg1 >>> 0];
3911
+ return ret;
3912
+ },
3913
+ __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
3914
+ let result;
3915
+ try {
3916
+ result = arg0 instanceof ArrayBuffer;
3917
+ } catch (_) {
3918
+ result = false;
3919
+ }
3920
+ const ret = result;
3921
+ return ret;
3922
+ },
3923
+ __wbg_instanceof_Uint8Array_4b8da683deb25d72: function(arg0) {
3924
+ let result;
3925
+ try {
3926
+ result = arg0 instanceof Uint8Array;
3927
+ } catch (_) {
3928
+ result = false;
3929
+ }
3930
+ const ret = result;
3931
+ return ret;
3932
+ },
3933
+ __wbg_isArray_db61795ad004c139: function(arg0) {
3934
+ const ret = Array.isArray(arg0);
3935
+ return ret;
3936
+ },
3937
+ __wbg_iterator_de403ef31815a3e6: function() {
3938
+ const ret = Symbol.iterator;
3939
+ return ret;
3940
+ },
3302
3941
  __wbg_length_0c32cb8543c8e4c8: function(arg0) {
3303
3942
  const ret = arg0.length;
3304
3943
  return ret;
3305
3944
  },
3945
+ __wbg_length_6e821edde497a532: function(arg0) {
3946
+ const ret = arg0.length;
3947
+ return ret;
3948
+ },
3306
3949
  __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
3307
3950
  const ret = arg0.msCrypto;
3308
3951
  return ret;
@@ -3319,6 +3962,14 @@ function __wbg_get_imports() {
3319
3962
  const ret = new Map();
3320
3963
  return ret;
3321
3964
  },
3965
+ __wbg_new_a560378ea1240b14: function(arg0) {
3966
+ const ret = new Uint8Array(arg0);
3967
+ return ret;
3968
+ },
3969
+ __wbg_new_e3b04b4d53d1b593: function(arg0, arg1) {
3970
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
3971
+ return ret;
3972
+ },
3322
3973
  __wbg_new_f3c9df4f38f3f798: function() {
3323
3974
  const ret = new Array();
3324
3975
  return ret;
@@ -3327,6 +3978,14 @@ function __wbg_get_imports() {
3327
3978
  const ret = new Uint8Array(arg0 >>> 0);
3328
3979
  return ret;
3329
3980
  },
3981
+ __wbg_next_01132ed6134b8ef5: function(arg0) {
3982
+ const ret = arg0.next;
3983
+ return ret;
3984
+ },
3985
+ __wbg_next_b3713ec761a9dbfd: function() { return handleError(function (arg0) {
3986
+ const ret = arg0.next();
3987
+ return ret;
3988
+ }, arguments); },
3330
3989
  __wbg_node_84ea875411254db1: function(arg0) {
3331
3990
  const ret = arg0.node;
3332
3991
  return ret;
@@ -3363,6 +4022,9 @@ function __wbg_get_imports() {
3363
4022
  const ret = Reflect.set(arg0, arg1, arg2);
3364
4023
  return ret;
3365
4024
  }, arguments); },
4025
+ __wbg_set_name_ab9c98596fd7310a: function(arg0, arg1, arg2) {
4026
+ arg0.name = getStringFromWasm0(arg1, arg2);
4027
+ },
3366
4028
  __wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f: function() {
3367
4029
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
3368
4030
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -3383,6 +4045,10 @@ function __wbg_get_imports() {
3383
4045
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
3384
4046
  return ret;
3385
4047
  },
4048
+ __wbg_value_7f6052747ccf940f: function(arg0) {
4049
+ const ret = arg0.value;
4050
+ return ret;
4051
+ },
3386
4052
  __wbg_versions_276b2795b1c6a219: function(arg0) {
3387
4053
  const ret = arg0.versions;
3388
4054
  return ret;
@@ -3428,6 +4094,9 @@ function __wbg_get_imports() {
3428
4094
  };
3429
4095
  }
3430
4096
 
4097
+ const WasmBlindIndexerFinalization = (typeof FinalizationRegistry === 'undefined')
4098
+ ? { register: () => {}, unregister: () => {} }
4099
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmblindindexer_free(ptr >>> 0, 1));
3431
4100
  const WasmLshHasherFinalization = (typeof FinalizationRegistry === 'undefined')
3432
4101
  ? { register: () => {}, unregister: () => {} }
3433
4102
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmlshhasher_free(ptr >>> 0, 1));
@@ -3444,11 +4113,87 @@ function _assertClass(instance, klass) {
3444
4113
  }
3445
4114
  }
3446
4115
 
4116
+ function debugString(val) {
4117
+ // primitive types
4118
+ const type = typeof val;
4119
+ if (type == 'number' || type == 'boolean' || val == null) {
4120
+ return `${val}`;
4121
+ }
4122
+ if (type == 'string') {
4123
+ return `"${val}"`;
4124
+ }
4125
+ if (type == 'symbol') {
4126
+ const description = val.description;
4127
+ if (description == null) {
4128
+ return 'Symbol';
4129
+ } else {
4130
+ return `Symbol(${description})`;
4131
+ }
4132
+ }
4133
+ if (type == 'function') {
4134
+ const name = val.name;
4135
+ if (typeof name == 'string' && name.length > 0) {
4136
+ return `Function(${name})`;
4137
+ } else {
4138
+ return 'Function';
4139
+ }
4140
+ }
4141
+ // objects
4142
+ if (Array.isArray(val)) {
4143
+ const length = val.length;
4144
+ let debug = '[';
4145
+ if (length > 0) {
4146
+ debug += debugString(val[0]);
4147
+ }
4148
+ for(let i = 1; i < length; i++) {
4149
+ debug += ', ' + debugString(val[i]);
4150
+ }
4151
+ debug += ']';
4152
+ return debug;
4153
+ }
4154
+ // Test for built-in
4155
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
4156
+ let className;
4157
+ if (builtInMatches && builtInMatches.length > 1) {
4158
+ className = builtInMatches[1];
4159
+ } else {
4160
+ // Failed to match the standard '[object ClassName]'
4161
+ return toString.call(val);
4162
+ }
4163
+ if (className == 'Object') {
4164
+ // we're a user defined class or Object
4165
+ // JSON.stringify avoids problems with cycles, and is generally much
4166
+ // easier than looping through ownProperties of `val`.
4167
+ try {
4168
+ return 'Object(' + JSON.stringify(val) + ')';
4169
+ } catch (_) {
4170
+ return 'Object';
4171
+ }
4172
+ }
4173
+ // errors
4174
+ if (val instanceof Error) {
4175
+ return `${val.name}: ${val.message}\n${val.stack}`;
4176
+ }
4177
+ // TODO we could test for more things here, like `Set`s and `Map`s.
4178
+ return className;
4179
+ }
4180
+
3447
4181
  function getArrayF32FromWasm0(ptr, len) {
3448
4182
  ptr = ptr >>> 0;
3449
4183
  return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
3450
4184
  }
3451
4185
 
4186
+ function getArrayJsValueFromWasm0(ptr, len) {
4187
+ ptr = ptr >>> 0;
4188
+ const mem = getDataViewMemory0();
4189
+ const result = [];
4190
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
4191
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
4192
+ }
4193
+ wasm.__externref_drop_slice(ptr, len);
4194
+ return result;
4195
+ }
4196
+
3452
4197
  function getArrayU8FromWasm0(ptr, len) {
3453
4198
  ptr = ptr >>> 0;
3454
4199
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);