@totalreclaw/core 2.0.0 → 2.1.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/README.md +40 -0
- package/package.json +10 -2
- package/totalreclaw_core.d.ts +34 -0
- package/totalreclaw_core.js +66 -0
- package/totalreclaw_core_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# totalreclaw-core
|
|
2
|
+
|
|
3
|
+
Shared core library powering every TotalReclaw client — a single source of truth for crypto, search, reranking, wallet derivation, UserOp construction, and store pipelines.
|
|
4
|
+
|
|
5
|
+
Used natively by [`totalreclaw-memory`](https://crates.io/crates/totalreclaw-memory) (Rust / ZeroClaw), and exposed via WASM (`@totalreclaw/core` on npm) and PyO3 (`totalreclaw-core` on PyPI) bindings for TypeScript and Python clients.
|
|
6
|
+
|
|
7
|
+
## What's in the box
|
|
8
|
+
|
|
9
|
+
- **Crypto** — XChaCha20-Poly1305 envelope encryption, HKDF key derivation, BIP-39 mnemonic + BIP-44 wallet derivation, Keccak256.
|
|
10
|
+
- **Reranker** — BM25 + cosine + RRF with intent-weighted scoring.
|
|
11
|
+
- **Store / Search pipelines** — canonical claim construction, LSH blind indexing, fingerprinting.
|
|
12
|
+
- **Dedup & KG** — best-match near-duplicate detection, cluster facts, contradiction detection orchestration, pin semantics, decision log.
|
|
13
|
+
- **ERC-4337** — UserOp construction (feature-gated via `managed`), signing verified byte-for-byte against viem.
|
|
14
|
+
- **Hot cache + consolidation + debrief + stemmer**.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- `managed` (default) — ERC-4337 UserOp support via `alloy-primitives` / `alloy-sol-types`.
|
|
19
|
+
- `wasm` — WASM bindings via `wasm-bindgen` (consumed by `@totalreclaw/core` npm package).
|
|
20
|
+
- `python` / `python-extension` — PyO3 bindings (consumed by `totalreclaw-core` PyPI package).
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```toml
|
|
25
|
+
[dependencies]
|
|
26
|
+
totalreclaw-core = "2.0"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Most Rust users should depend on [`totalreclaw-memory`](https://crates.io/crates/totalreclaw-memory), which bundles core into a high-level `Memory` trait.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
- Homepage: <https://totalreclaw.xyz>
|
|
38
|
+
- Repository: <https://github.com/p-diogo/totalreclaw>
|
|
39
|
+
- npm (WASM): [`@totalreclaw/core`](https://www.npmjs.com/package/@totalreclaw/core)
|
|
40
|
+
- PyPI (PyO3): [`totalreclaw-core`](https://pypi.org/project/totalreclaw-core/)
|
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.0.
|
|
4
|
+
"version": "2.1.0-rc.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -13,5 +13,13 @@
|
|
|
13
13
|
"totalreclaw_core.d.ts"
|
|
14
14
|
],
|
|
15
15
|
"main": "totalreclaw_core.js",
|
|
16
|
-
"
|
|
16
|
+
"homepage": "https://totalreclaw.xyz",
|
|
17
|
+
"types": "totalreclaw_core.d.ts",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"e2ee",
|
|
20
|
+
"memory",
|
|
21
|
+
"crypto",
|
|
22
|
+
"erc4337",
|
|
23
|
+
"ai"
|
|
24
|
+
]
|
|
17
25
|
}
|
package/totalreclaw_core.d.ts
CHANGED
|
@@ -507,6 +507,28 @@ export function getStoreDedupMaxCandidates(): number;
|
|
|
507
507
|
*/
|
|
508
508
|
export function getTrapdoorBatchSize(): number;
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Get the v1 type → short-form category mapping.
|
|
512
|
+
*
|
|
513
|
+
* Returns a plain JS object `{ claim: "claim", preference: "pref",
|
|
514
|
+
* directive: "rule", commitment: "goal", episode: "epi",
|
|
515
|
+
* summary: "sum" }`.
|
|
516
|
+
*
|
|
517
|
+
* Uses `js_sys::Object.set` directly so the result is a plain JS
|
|
518
|
+
* object (not a `Map`) regardless of serde-wasm-bindgen defaults,
|
|
519
|
+
* matching how TypeScript clients consume the mapping via bracket
|
|
520
|
+
* access (`map[type]`).
|
|
521
|
+
*/
|
|
522
|
+
export function getTypeToCategory(): any;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Get the canonical list of v1 memory types.
|
|
526
|
+
*
|
|
527
|
+
* Returns a JS array of six strings: `["claim", "preference",
|
|
528
|
+
* "directive", "commitment", "episode", "summary"]`.
|
|
529
|
+
*/
|
|
530
|
+
export function getValidMemoryTypes(): any;
|
|
531
|
+
|
|
510
532
|
/**
|
|
511
533
|
* Compute the ERC-4337 v0.7 UserOp hash for signing.
|
|
512
534
|
*
|
|
@@ -530,12 +552,24 @@ export function hexBlobToBase64(hex_blob: string): string | undefined;
|
|
|
530
552
|
*/
|
|
531
553
|
export function isPinnedClaim(claim_json: string): boolean;
|
|
532
554
|
|
|
555
|
+
/**
|
|
556
|
+
* Runtime guard: is `value` a valid v1 memory type?
|
|
557
|
+
*/
|
|
558
|
+
export function isValidMemoryType(value: string): boolean;
|
|
559
|
+
|
|
533
560
|
/**
|
|
534
561
|
* Return the v1 legacy-claim fallback weight (applied to candidates that
|
|
535
562
|
* have no `source` field).
|
|
536
563
|
*/
|
|
537
564
|
export function legacyClaimFallbackWeight(): number;
|
|
538
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Map a v1 type to its short-form category key.
|
|
568
|
+
*
|
|
569
|
+
* Returns `null` if `value` is not one of the six v1 types.
|
|
570
|
+
*/
|
|
571
|
+
export function mapTypeToCategory(value: string): any;
|
|
572
|
+
|
|
539
573
|
/**
|
|
540
574
|
* Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
|
|
541
575
|
*/
|
package/totalreclaw_core.js
CHANGED
|
@@ -1664,6 +1664,44 @@ function getTrapdoorBatchSize() {
|
|
|
1664
1664
|
}
|
|
1665
1665
|
exports.getTrapdoorBatchSize = getTrapdoorBatchSize;
|
|
1666
1666
|
|
|
1667
|
+
/**
|
|
1668
|
+
* Get the v1 type → short-form category mapping.
|
|
1669
|
+
*
|
|
1670
|
+
* Returns a plain JS object `{ claim: "claim", preference: "pref",
|
|
1671
|
+
* directive: "rule", commitment: "goal", episode: "epi",
|
|
1672
|
+
* summary: "sum" }`.
|
|
1673
|
+
*
|
|
1674
|
+
* Uses `js_sys::Object.set` directly so the result is a plain JS
|
|
1675
|
+
* object (not a `Map`) regardless of serde-wasm-bindgen defaults,
|
|
1676
|
+
* matching how TypeScript clients consume the mapping via bracket
|
|
1677
|
+
* access (`map[type]`).
|
|
1678
|
+
* @returns {any}
|
|
1679
|
+
*/
|
|
1680
|
+
function getTypeToCategory() {
|
|
1681
|
+
const ret = wasm.getTypeToCategory();
|
|
1682
|
+
if (ret[2]) {
|
|
1683
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1684
|
+
}
|
|
1685
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1686
|
+
}
|
|
1687
|
+
exports.getTypeToCategory = getTypeToCategory;
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Get the canonical list of v1 memory types.
|
|
1691
|
+
*
|
|
1692
|
+
* Returns a JS array of six strings: `["claim", "preference",
|
|
1693
|
+
* "directive", "commitment", "episode", "summary"]`.
|
|
1694
|
+
* @returns {any}
|
|
1695
|
+
*/
|
|
1696
|
+
function getValidMemoryTypes() {
|
|
1697
|
+
const ret = wasm.getValidMemoryTypes();
|
|
1698
|
+
if (ret[2]) {
|
|
1699
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1700
|
+
}
|
|
1701
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1702
|
+
}
|
|
1703
|
+
exports.getValidMemoryTypes = getValidMemoryTypes;
|
|
1704
|
+
|
|
1667
1705
|
/**
|
|
1668
1706
|
* Compute the ERC-4337 v0.7 UserOp hash for signing.
|
|
1669
1707
|
*
|
|
@@ -1734,6 +1772,19 @@ function isPinnedClaim(claim_json) {
|
|
|
1734
1772
|
}
|
|
1735
1773
|
exports.isPinnedClaim = isPinnedClaim;
|
|
1736
1774
|
|
|
1775
|
+
/**
|
|
1776
|
+
* Runtime guard: is `value` a valid v1 memory type?
|
|
1777
|
+
* @param {string} value
|
|
1778
|
+
* @returns {boolean}
|
|
1779
|
+
*/
|
|
1780
|
+
function isValidMemoryType(value) {
|
|
1781
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1782
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1783
|
+
const ret = wasm.isValidMemoryType(ptr0, len0);
|
|
1784
|
+
return ret !== 0;
|
|
1785
|
+
}
|
|
1786
|
+
exports.isValidMemoryType = isValidMemoryType;
|
|
1787
|
+
|
|
1737
1788
|
/**
|
|
1738
1789
|
* Return the v1 legacy-claim fallback weight (applied to candidates that
|
|
1739
1790
|
* have no `source` field).
|
|
@@ -1745,6 +1796,21 @@ function legacyClaimFallbackWeight() {
|
|
|
1745
1796
|
}
|
|
1746
1797
|
exports.legacyClaimFallbackWeight = legacyClaimFallbackWeight;
|
|
1747
1798
|
|
|
1799
|
+
/**
|
|
1800
|
+
* Map a v1 type to its short-form category key.
|
|
1801
|
+
*
|
|
1802
|
+
* Returns `null` if `value` is not one of the six v1 types.
|
|
1803
|
+
* @param {string} value
|
|
1804
|
+
* @returns {any}
|
|
1805
|
+
*/
|
|
1806
|
+
function mapTypeToCategory(value) {
|
|
1807
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1808
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1809
|
+
const ret = wasm.mapTypeToCategory(ptr0, len0);
|
|
1810
|
+
return ret;
|
|
1811
|
+
}
|
|
1812
|
+
exports.mapTypeToCategory = mapTypeToCategory;
|
|
1813
|
+
|
|
1748
1814
|
/**
|
|
1749
1815
|
* Normalize an entity name (NFC, lowercase, trim, collapse whitespace).
|
|
1750
1816
|
* @param {string} name
|
package/totalreclaw_core_bg.wasm
CHANGED
|
Binary file
|