@totalreclaw/core 2.7.0 → 2.8.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 +0 -1
- package/nodejs/totalreclaw_core.d.ts +111 -0
- package/nodejs/totalreclaw_core.js +581 -0
- package/nodejs/totalreclaw_core_bg.wasm +0 -0
- package/nodejs/totalreclaw_core_bg.wasm.d.ts +104 -86
- package/package.json +1 -1
- package/web/totalreclaw_core.d.ts +215 -86
- package/web/totalreclaw_core.js +568 -0
- package/web/totalreclaw_core_bg.wasm +0 -0
- package/web/totalreclaw_core_bg.wasm.d.ts +104 -86
package/README.md
CHANGED
|
@@ -13,7 +13,6 @@ Probably not directly. If you want encrypted memory for an AI agent, install the
|
|
|
13
13
|
| OpenClaw | [`@totalreclaw/totalreclaw`](https://www.npmjs.com/package/@totalreclaw/totalreclaw) | [OpenClaw setup](https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/openclaw-setup.md) |
|
|
14
14
|
| Claude Code, Claude Desktop, Cursor, other MCP hosts | [`@totalreclaw/mcp-server`](https://www.npmjs.com/package/@totalreclaw/mcp-server) | [Claude Code setup](https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/claude-code-setup.md) |
|
|
15
15
|
| Hermes | [`totalreclaw`](https://pypi.org/project/totalreclaw/) on PyPI | [Hermes setup](https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/hermes-setup.md) |
|
|
16
|
-
| NanoClaw | [`@totalreclaw/skill-nanoclaw`](https://www.npmjs.com/package/@totalreclaw/skill-nanoclaw) | [NanoClaw guide](https://github.com/graphprotocol/totalreclaw/blob/main/docs/guides/nanoclaw-getting-started.md) |
|
|
17
16
|
|
|
18
17
|
Install `@totalreclaw/core` yourself only if you are building a TotalReclaw client or tool and need the same primitives.
|
|
19
18
|
|
|
@@ -16,6 +16,32 @@ export function DECISION_LOG_MAX_LINES(): number;
|
|
|
16
16
|
*/
|
|
17
17
|
export function TIE_ZONE_SCORE_TOLERANCE(): number;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Keyed blind-tag generator (index scheme 1). Construct from the vault's
|
|
21
|
+
* `encryptionKey`; `indexKey` is derived inside core and never exposed (no
|
|
22
|
+
* key getter, no string conversion).
|
|
23
|
+
*/
|
|
24
|
+
export class WasmBlindIndexer {
|
|
25
|
+
free(): void;
|
|
26
|
+
[Symbol.dispose](): void;
|
|
27
|
+
/**
|
|
28
|
+
* Tag of the digest-fact marker.
|
|
29
|
+
*/
|
|
30
|
+
digestMarkerTag(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Tag of an entity name (normalised in core).
|
|
33
|
+
*/
|
|
34
|
+
entityTag(name: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* `encryption_key_hex`: 64-char hex string (32 bytes).
|
|
37
|
+
*/
|
|
38
|
+
constructor(encryption_key_hex: string);
|
|
39
|
+
/**
|
|
40
|
+
* Stem tags of a text, sorted and deduplicated. JSON array of hex strings.
|
|
41
|
+
*/
|
|
42
|
+
stemTags(text: string): any;
|
|
43
|
+
}
|
|
44
|
+
|
|
19
45
|
/**
|
|
20
46
|
* Random Hyperplane LSH hasher (WASM wrapper).
|
|
21
47
|
*
|
|
@@ -32,6 +58,13 @@ export class WasmLshHasher {
|
|
|
32
58
|
* Returns a JSON array of hex strings (one per table).
|
|
33
59
|
*/
|
|
34
60
|
hash(embedding: Float64Array): any;
|
|
61
|
+
/**
|
|
62
|
+
* Hash an embedding vector to KEYED bucket tags (index scheme 1).
|
|
63
|
+
*
|
|
64
|
+
* Returns a JSON array of hex strings (one per table). `lshBucketKey` is
|
|
65
|
+
* derived from the seed inside core and never exposed.
|
|
66
|
+
*/
|
|
67
|
+
hashKeyed(embedding: Float64Array): any;
|
|
35
68
|
/**
|
|
36
69
|
* Create a new LSH hasher with default parameters (20 tables, 32 bits).
|
|
37
70
|
*
|
|
@@ -402,6 +435,13 @@ export function encodeEmbeddingCanonical(embedding: Float32Array): string;
|
|
|
402
435
|
*/
|
|
403
436
|
export function encodeFactProtobuf(json: string): Uint8Array;
|
|
404
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Encode a scheme-1 fact: field 5 sorted and deduplicated, field 14 `index_scheme = 1`,
|
|
440
|
+
* outer version always 4 (any `version` in the JSON is ignored). Same JSON as
|
|
441
|
+
* `encodeFactProtobuf`; throws unless every `blind_indices` entry is 64 lowercase hex.
|
|
442
|
+
*/
|
|
443
|
+
export function encodeFactProtobufKeyed(json: string): Uint8Array;
|
|
444
|
+
|
|
405
445
|
/**
|
|
406
446
|
* Encode a single fact submission as SimpleAccount.execute() calldata.
|
|
407
447
|
*
|
|
@@ -429,6 +469,11 @@ export function encodeSingleCallTo(protobuf_payload: Uint8Array, data_edge_addre
|
|
|
429
469
|
*/
|
|
430
470
|
export function encodeTombstoneProtobuf(fact_id: string, owner: string, version?: number | null): Uint8Array;
|
|
431
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Encode a scheme-1 tombstone: outer version 4 plus field 14 `index_scheme = 1`.
|
|
474
|
+
*/
|
|
475
|
+
export function encodeTombstoneProtobufKeyed(fact_id: string, owner: string): Uint8Array;
|
|
476
|
+
|
|
432
477
|
/**
|
|
433
478
|
* Encrypt a UTF-8 plaintext with XChaCha20-Poly1305.
|
|
434
479
|
*
|
|
@@ -542,6 +587,12 @@ export function generateBlindIndices(text: string): any;
|
|
|
542
587
|
*/
|
|
543
588
|
export function generateContentFingerprint(plaintext: string, dedup_key_hex: string): string;
|
|
544
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Content fingerprint v2 (index scheme 1): HMAC under `fpKeyV2`, which core
|
|
592
|
+
* derives from `dedupKey`. Not interchangeable with `generateContentFingerprint`.
|
|
593
|
+
*/
|
|
594
|
+
export function generateContentFingerprintV2(plaintext: string, dedup_key_hex: string): string;
|
|
595
|
+
|
|
545
596
|
/**
|
|
546
597
|
* Generate trapdoors for multiple query reformulations (expansion pipeline).
|
|
547
598
|
*
|
|
@@ -564,6 +615,13 @@ export function generateExpansionTrapdoors(queries_json: string, embeddings_json
|
|
|
564
615
|
*/
|
|
565
616
|
export function generateSearchTrapdoors(query: string, query_embedding: Float32Array, lsh_hasher: WasmLshHasher): any;
|
|
566
617
|
|
|
618
|
+
/**
|
|
619
|
+
* Keyed search trapdoors (index scheme 1): stem tags + one entity tag per name +
|
|
620
|
+
* keyed LSH tags, sorted and deduplicated. `entity_names`: JSON array of strings.
|
|
621
|
+
* Returns a JsValue (JSON array of hex strings); final, batch as is.
|
|
622
|
+
*/
|
|
623
|
+
export function generateSearchTrapdoorsKeyed(query: string, entity_names: any, query_embedding: Float32Array, indexer: WasmBlindIndexer, lsh_hasher: WasmLshHasher): any;
|
|
624
|
+
|
|
567
625
|
/**
|
|
568
626
|
* Get the GraphQL query string for broadened (fallback) search.
|
|
569
627
|
*/
|
|
@@ -734,12 +792,25 @@ export function isPinnedClaimJson(claim_json: string): boolean;
|
|
|
734
792
|
*/
|
|
735
793
|
export function isValidMemoryType(value: string): boolean;
|
|
736
794
|
|
|
795
|
+
/**
|
|
796
|
+
* The same-fact judge prompt for one pair: JSON `{system, user}`. Line
|
|
797
|
+
* breaks in either text are collapsed to spaces.
|
|
798
|
+
*/
|
|
799
|
+
export function judgePrompt(existing: string, candidate: string): string;
|
|
800
|
+
|
|
737
801
|
/**
|
|
738
802
|
* Return the v1 legacy-claim fallback weight (applied to candidates that
|
|
739
803
|
* have no `source` field).
|
|
740
804
|
*/
|
|
741
805
|
export function legacyClaimFallbackWeight(): number;
|
|
742
806
|
|
|
807
|
+
/**
|
|
808
|
+
* On-chain `decayScore` for every LIVE fact (always `1.0`; #789).
|
|
809
|
+
*
|
|
810
|
+
* `0` = tombstone, `1.0` = live; carries no importance. Never use for tombstones.
|
|
811
|
+
*/
|
|
812
|
+
export function liveDecayScore(): number;
|
|
813
|
+
|
|
743
814
|
/**
|
|
744
815
|
* Map a v1 type to its short-form category key.
|
|
745
816
|
*
|
|
@@ -828,6 +899,12 @@ export function parseDigestResponse(raw: string): string;
|
|
|
828
899
|
*/
|
|
829
900
|
export function parseGemini(input: string): any;
|
|
830
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Parse a judge reply. Returns JSON: `"SAME"` (one of the seven relation
|
|
904
|
+
* words, upper case) or `null`.
|
|
905
|
+
*/
|
|
906
|
+
export function parseJudgeAnswer(raw: string): string;
|
|
907
|
+
|
|
831
908
|
/**
|
|
832
909
|
* Case-insensitive parse of a memory source string. Unknown input returns "user-inferred".
|
|
833
910
|
*/
|
|
@@ -901,6 +978,24 @@ export function piiFilter(text: string): string;
|
|
|
901
978
|
*/
|
|
902
979
|
export function pinBoost(tier_json: string, now_unix: bigint, config_json: string): number;
|
|
903
980
|
|
|
981
|
+
/**
|
|
982
|
+
* Pick the forgotten entries the LLM should judge for a candidate.
|
|
983
|
+
*
|
|
984
|
+
* `entriesJson`: JSON array of `{id, text, embedding?}`. Returns a plan:
|
|
985
|
+
* `{"kind":"decided","match":null|{...}}` or
|
|
986
|
+
* `{"kind":"ask","pairs":[...],"fallback":...,"unjudged":...}`.
|
|
987
|
+
*/
|
|
988
|
+
export function planForgetJudge(text: string, embedding_json: string, entries_json: string): string;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Pick the pairs the LLM should judge for a new fact (auto mode).
|
|
992
|
+
*
|
|
993
|
+
* `candidatesJson`: JSON array of `{id, text, embedding?, pinned?, pending?}`.
|
|
994
|
+
* Returns a plan: `{"kind":"decided","decision":{...}}` or
|
|
995
|
+
* `{"kind":"ask","pairs":[...],"fallback":{...}}`.
|
|
996
|
+
*/
|
|
997
|
+
export function planJudgedWrite(text: string, embedding_json: string, candidates_json: string): string;
|
|
998
|
+
|
|
904
999
|
/**
|
|
905
1000
|
* Prepare a fact for on-chain storage.
|
|
906
1001
|
*
|
|
@@ -971,6 +1066,17 @@ export function rerank(query: string, query_embedding: Float32Array, candidates_
|
|
|
971
1066
|
*/
|
|
972
1067
|
export function rerankWithConfig(query: string, query_embedding: Float32Array, candidates_json: string, top_k: number, apply_source_weights: boolean, pin_boost?: number | null): any;
|
|
973
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* Map the verdicts to `null` (store) or the blocking match `{id, reason, cosine}`.
|
|
1071
|
+
*/
|
|
1072
|
+
export function resolveForgetJudge(plan_json: string, verdicts_json: string): string;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Map the verdicts (JSON array, one relation word or `null` per pair) to a
|
|
1076
|
+
* decision `{action, match, relation, judged}`.
|
|
1077
|
+
*/
|
|
1078
|
+
export function resolveJudgedWrite(text: string, plan_json: string, verdicts_json: string): string;
|
|
1079
|
+
|
|
974
1080
|
/**
|
|
975
1081
|
* Run the resolution formula on two contradicting claims; returns ResolutionOutcome JSON.
|
|
976
1082
|
*/
|
|
@@ -1032,6 +1138,11 @@ export function shouldSupersede(new_importance: number, existing_importance: num
|
|
|
1032
1138
|
*/
|
|
1033
1139
|
export function signUserOp(hash_hex: string, private_key_hex: string): string;
|
|
1034
1140
|
|
|
1141
|
+
/**
|
|
1142
|
+
* Sort ascending and deduplicate a list of tags (call before batching a query).
|
|
1143
|
+
*/
|
|
1144
|
+
export function sortDedupTags(tags: any): any;
|
|
1145
|
+
|
|
1035
1146
|
/**
|
|
1036
1147
|
* Return the source weight multiplier for a given source string.
|
|
1037
1148
|
*
|