@totalreclaw/core 2.2.0-rc.19 → 2.4.0-rc.1

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": "2.2.0-rc.19",
4
+ "version": "2.4.0-rc.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -409,6 +409,17 @@ export function generateBlindIndices(text: string): any;
409
409
  */
410
410
  export function generateContentFingerprint(plaintext: string, dedup_key_hex: string): string;
411
411
 
412
+ /**
413
+ * Generate trapdoors for multiple query reformulations (expansion pipeline).
414
+ *
415
+ * `queries_json`: JSON array of query strings (original + reformulations).
416
+ * `embeddings_json`: JSON array of Float32Array-compatible arrays (one per query).
417
+ * `lsh_hasher`: A `WasmLshHasher` instance.
418
+ *
419
+ * Returns a JsValue (JSON array of trapdoor-string arrays, one per query).
420
+ */
421
+ export function generateExpansionTrapdoors(queries_json: string, embeddings_json: string, lsh_hasher: WasmLshHasher): any;
422
+
412
423
  /**
413
424
  * Generate all search trapdoors for a query (word hashes + LSH bucket hashes).
414
425
  *
@@ -597,6 +608,16 @@ export function legacyClaimFallbackWeight(): number;
597
608
  */
598
609
  export function mapTypeToCategory(value: string): any;
599
610
 
611
+ /**
612
+ * Merge multiple SubgraphFact sets from parallel query reformulations via RRF.
613
+ *
614
+ * `fact_sets_json`: JSON array of SubgraphFact arrays (one array per reformulation).
615
+ * `rrf_k`: RRF k-parameter (use 60.0 for default behaviour).
616
+ *
617
+ * Returns a JsValue (merged, deduplicated SubgraphFact array sorted by RRF score).
618
+ */
619
+ export function mergeExpansionResults(fact_sets_json: string, rrf_k: number): any;
620
+
600
621
  /**
601
622
  * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
602
623
  */
@@ -789,8 +810,8 @@ export function signUserOp(hash_hex: string, private_key_hex: string): string;
789
810
  * Accepted values: "user" | "user-inferred" | "assistant" | "external" | "derived".
790
811
  *
791
812
  * Unknown input is routed through `MemorySource::from_str_lossy` which
792
- * falls back to `user-inferred` (weight 0.90). Callers who need the
793
- * "no source field at all" fallback (weight 0.85) should call
813
+ * falls back to `user-inferred` (v2-lenient weight 0.95). Callers who need
814
+ * the "no source field at all" fallback (weight 0.85) should call
794
815
  * `legacyClaimFallbackWeight()` instead.
795
816
  */
796
817
  export function sourceWeight(source: string): number;
@@ -804,3 +825,26 @@ export function sourceWeight(source: string): number;
804
825
  * See `docs/specs/totalreclaw/memory-taxonomy-v1.md`.
805
826
  */
806
827
  export function validateMemoryClaimV1(claim_json: string): string;
828
+
829
+ /**
830
+ * Default polling interval (ms) — exposed so host adapters share the same
831
+ * default without re-declaring the constant.
832
+ */
833
+ export function wasmConfirmIndexedDefaultPollMs(): number;
834
+
835
+ /**
836
+ * Default total timeout (ms) — exposed so host adapters share the same default.
837
+ */
838
+ export function wasmConfirmIndexedDefaultTimeoutMs(): number;
839
+
840
+ /**
841
+ * Parse a subgraph response JSON and return whether the fact is indexed +
842
+ * active. Returns `true` when the read-after-write loop can stop.
843
+ */
844
+ export function wasmConfirmIndexedParse(response_json: string): boolean;
845
+
846
+ /**
847
+ * GraphQL query string used to confirm a fact id has been indexed.
848
+ * Pair with `wasmConfirmIndexedParse` in a host-side polling loop.
849
+ */
850
+ export function wasmConfirmIndexedQuery(): string;
@@ -1393,6 +1393,33 @@ function generateContentFingerprint(plaintext, dedup_key_hex) {
1393
1393
  }
1394
1394
  exports.generateContentFingerprint = generateContentFingerprint;
1395
1395
 
1396
+ /**
1397
+ * Generate trapdoors for multiple query reformulations (expansion pipeline).
1398
+ *
1399
+ * `queries_json`: JSON array of query strings (original + reformulations).
1400
+ * `embeddings_json`: JSON array of Float32Array-compatible arrays (one per query).
1401
+ * `lsh_hasher`: A `WasmLshHasher` instance.
1402
+ *
1403
+ * Returns a JsValue (JSON array of trapdoor-string arrays, one per query).
1404
+ * @param {string} queries_json
1405
+ * @param {string} embeddings_json
1406
+ * @param {WasmLshHasher} lsh_hasher
1407
+ * @returns {any}
1408
+ */
1409
+ function generateExpansionTrapdoors(queries_json, embeddings_json, lsh_hasher) {
1410
+ const ptr0 = passStringToWasm0(queries_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1411
+ const len0 = WASM_VECTOR_LEN;
1412
+ const ptr1 = passStringToWasm0(embeddings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1413
+ const len1 = WASM_VECTOR_LEN;
1414
+ _assertClass(lsh_hasher, WasmLshHasher);
1415
+ const ret = wasm.generateExpansionTrapdoors(ptr0, len0, ptr1, len1, lsh_hasher.__wbg_ptr);
1416
+ if (ret[2]) {
1417
+ throw takeFromExternrefTable0(ret[1]);
1418
+ }
1419
+ return takeFromExternrefTable0(ret[0]);
1420
+ }
1421
+ exports.generateExpansionTrapdoors = generateExpansionTrapdoors;
1422
+
1396
1423
  /**
1397
1424
  * Generate all search trapdoors for a query (word hashes + LSH bucket hashes).
1398
1425
  *
@@ -1872,6 +1899,28 @@ function mapTypeToCategory(value) {
1872
1899
  }
1873
1900
  exports.mapTypeToCategory = mapTypeToCategory;
1874
1901
 
1902
+ /**
1903
+ * Merge multiple SubgraphFact sets from parallel query reformulations via RRF.
1904
+ *
1905
+ * `fact_sets_json`: JSON array of SubgraphFact arrays (one array per reformulation).
1906
+ * `rrf_k`: RRF k-parameter (use 60.0 for default behaviour).
1907
+ *
1908
+ * Returns a JsValue (merged, deduplicated SubgraphFact array sorted by RRF score).
1909
+ * @param {string} fact_sets_json
1910
+ * @param {number} rrf_k
1911
+ * @returns {any}
1912
+ */
1913
+ function mergeExpansionResults(fact_sets_json, rrf_k) {
1914
+ const ptr0 = passStringToWasm0(fact_sets_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1915
+ const len0 = WASM_VECTOR_LEN;
1916
+ const ret = wasm.mergeExpansionResults(ptr0, len0, rrf_k);
1917
+ if (ret[2]) {
1918
+ throw takeFromExternrefTable0(ret[1]);
1919
+ }
1920
+ return takeFromExternrefTable0(ret[0]);
1921
+ }
1922
+ exports.mergeExpansionResults = mergeExpansionResults;
1923
+
1875
1924
  /**
1876
1925
  * Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
1877
1926
  * @param {string} name
@@ -2590,8 +2639,8 @@ exports.signUserOp = signUserOp;
2590
2639
  * Accepted values: "user" | "user-inferred" | "assistant" | "external" | "derived".
2591
2640
  *
2592
2641
  * Unknown input is routed through `MemorySource::from_str_lossy` which
2593
- * falls back to `user-inferred` (weight 0.90). Callers who need the
2594
- * "no source field at all" fallback (weight 0.85) should call
2642
+ * falls back to `user-inferred` (v2-lenient weight 0.95). Callers who need
2643
+ * the "no source field at all" fallback (weight 0.85) should call
2595
2644
  * `legacyClaimFallbackWeight()` instead.
2596
2645
  * @param {string} source
2597
2646
  * @returns {number}
@@ -2636,6 +2685,63 @@ function validateMemoryClaimV1(claim_json) {
2636
2685
  }
2637
2686
  exports.validateMemoryClaimV1 = validateMemoryClaimV1;
2638
2687
 
2688
+ /**
2689
+ * Default polling interval (ms) — exposed so host adapters share the same
2690
+ * default without re-declaring the constant.
2691
+ * @returns {number}
2692
+ */
2693
+ function wasmConfirmIndexedDefaultPollMs() {
2694
+ const ret = wasm.wasmConfirmIndexedDefaultPollMs();
2695
+ return ret >>> 0;
2696
+ }
2697
+ exports.wasmConfirmIndexedDefaultPollMs = wasmConfirmIndexedDefaultPollMs;
2698
+
2699
+ /**
2700
+ * Default total timeout (ms) — exposed so host adapters share the same default.
2701
+ * @returns {number}
2702
+ */
2703
+ function wasmConfirmIndexedDefaultTimeoutMs() {
2704
+ const ret = wasm.wasmConfirmIndexedDefaultTimeoutMs();
2705
+ return ret >>> 0;
2706
+ }
2707
+ exports.wasmConfirmIndexedDefaultTimeoutMs = wasmConfirmIndexedDefaultTimeoutMs;
2708
+
2709
+ /**
2710
+ * Parse a subgraph response JSON and return whether the fact is indexed +
2711
+ * active. Returns `true` when the read-after-write loop can stop.
2712
+ * @param {string} response_json
2713
+ * @returns {boolean}
2714
+ */
2715
+ function wasmConfirmIndexedParse(response_json) {
2716
+ const ptr0 = passStringToWasm0(response_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2717
+ const len0 = WASM_VECTOR_LEN;
2718
+ const ret = wasm.wasmConfirmIndexedParse(ptr0, len0);
2719
+ if (ret[2]) {
2720
+ throw takeFromExternrefTable0(ret[1]);
2721
+ }
2722
+ return ret[0] !== 0;
2723
+ }
2724
+ exports.wasmConfirmIndexedParse = wasmConfirmIndexedParse;
2725
+
2726
+ /**
2727
+ * GraphQL query string used to confirm a fact id has been indexed.
2728
+ * Pair with `wasmConfirmIndexedParse` in a host-side polling loop.
2729
+ * @returns {string}
2730
+ */
2731
+ function wasmConfirmIndexedQuery() {
2732
+ let deferred1_0;
2733
+ let deferred1_1;
2734
+ try {
2735
+ const ret = wasm.wasmConfirmIndexedQuery();
2736
+ deferred1_0 = ret[0];
2737
+ deferred1_1 = ret[1];
2738
+ return getStringFromWasm0(ret[0], ret[1]);
2739
+ } finally {
2740
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2741
+ }
2742
+ }
2743
+ exports.wasmConfirmIndexedQuery = wasmConfirmIndexedQuery;
2744
+
2639
2745
  function __wbg_get_imports() {
2640
2746
  const import0 = {
2641
2747
  __proto__: null,
Binary file