@totalreclaw/core 2.5.1 → 2.5.3
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 +1 -1
- package/totalreclaw_core.d.ts +31 -0
- package/totalreclaw_core.js +76 -0
- package/totalreclaw_core_bg.wasm +0 -0
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.5.
|
|
4
|
+
"version": "2.5.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
package/totalreclaw_core.d.ts
CHANGED
|
@@ -423,6 +423,28 @@ export function findLoserClaimInDecisionLog(fact_id: string, log_content: string
|
|
|
423
423
|
*/
|
|
424
424
|
export function findNearDuplicate(new_embedding: Float32Array, existing_json: string, threshold: number): any;
|
|
425
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Unix seconds → `"YYYY-MM-DD"` (UTC). Returns `""` for `0` or negative.
|
|
428
|
+
*
|
|
429
|
+
* Maps directly to [`crate::recall_context::format_memory_date`].
|
|
430
|
+
*/
|
|
431
|
+
export function formatMemoryDate(created_at_unix: bigint): string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Build the full recall-context block: header + one line per memory item.
|
|
435
|
+
*
|
|
436
|
+
* `items_json`: JSON array of `{ category, text, created_at }`. Any field
|
|
437
|
+
* may be absent (defaults to empty string / 0). Bad or empty JSON → header
|
|
438
|
+
* only (no panic).
|
|
439
|
+
*
|
|
440
|
+
* Output line format:
|
|
441
|
+
* - With date: `"- [category] (YYYY-MM-DD) text"`
|
|
442
|
+
* - Without date: `"- [category] text"`
|
|
443
|
+
*
|
|
444
|
+
* `now_unix`: current time as Unix seconds (used in the header date).
|
|
445
|
+
*/
|
|
446
|
+
export function formatRecallContext(items_json: string, now_unix: bigint): string;
|
|
447
|
+
|
|
426
448
|
/**
|
|
427
449
|
* Generate blind indices (SHA-256 token hashes) for a text string.
|
|
428
450
|
*
|
|
@@ -788,6 +810,15 @@ export function prepareTombstone(fact_id: string, owner: string): Uint8Array;
|
|
|
788
810
|
*/
|
|
789
811
|
export function readFeedbackJsonl(content: string): string;
|
|
790
812
|
|
|
813
|
+
/**
|
|
814
|
+
* Build the recall-context header string (current-date + temporal-reasoning nudge).
|
|
815
|
+
*
|
|
816
|
+
* `now_unix`: current time as Unix seconds.
|
|
817
|
+
* Returns the header with a trailing newline, e.g.:
|
|
818
|
+
* `"## Relevant memories from TotalReclaw\nThe current date is 2024-01-15. ..."`
|
|
819
|
+
*/
|
|
820
|
+
export function recallContextHeader(now_unix: bigint): string;
|
|
821
|
+
|
|
791
822
|
/**
|
|
792
823
|
* Rerank candidates using BM25 + Cosine + RRF fusion.
|
|
793
824
|
*
|
package/totalreclaw_core.js
CHANGED
|
@@ -1444,6 +1444,59 @@ function findNearDuplicate(new_embedding, existing_json, threshold) {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
exports.findNearDuplicate = findNearDuplicate;
|
|
1446
1446
|
|
|
1447
|
+
/**
|
|
1448
|
+
* Unix seconds → `"YYYY-MM-DD"` (UTC). Returns `""` for `0` or negative.
|
|
1449
|
+
*
|
|
1450
|
+
* Maps directly to [`crate::recall_context::format_memory_date`].
|
|
1451
|
+
* @param {bigint} created_at_unix
|
|
1452
|
+
* @returns {string}
|
|
1453
|
+
*/
|
|
1454
|
+
function formatMemoryDate(created_at_unix) {
|
|
1455
|
+
let deferred1_0;
|
|
1456
|
+
let deferred1_1;
|
|
1457
|
+
try {
|
|
1458
|
+
const ret = wasm.formatMemoryDate(created_at_unix);
|
|
1459
|
+
deferred1_0 = ret[0];
|
|
1460
|
+
deferred1_1 = ret[1];
|
|
1461
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1462
|
+
} finally {
|
|
1463
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
exports.formatMemoryDate = formatMemoryDate;
|
|
1467
|
+
|
|
1468
|
+
/**
|
|
1469
|
+
* Build the full recall-context block: header + one line per memory item.
|
|
1470
|
+
*
|
|
1471
|
+
* `items_json`: JSON array of `{ category, text, created_at }`. Any field
|
|
1472
|
+
* may be absent (defaults to empty string / 0). Bad or empty JSON → header
|
|
1473
|
+
* only (no panic).
|
|
1474
|
+
*
|
|
1475
|
+
* Output line format:
|
|
1476
|
+
* - With date: `"- [category] (YYYY-MM-DD) text"`
|
|
1477
|
+
* - Without date: `"- [category] text"`
|
|
1478
|
+
*
|
|
1479
|
+
* `now_unix`: current time as Unix seconds (used in the header date).
|
|
1480
|
+
* @param {string} items_json
|
|
1481
|
+
* @param {bigint} now_unix
|
|
1482
|
+
* @returns {string}
|
|
1483
|
+
*/
|
|
1484
|
+
function formatRecallContext(items_json, now_unix) {
|
|
1485
|
+
let deferred2_0;
|
|
1486
|
+
let deferred2_1;
|
|
1487
|
+
try {
|
|
1488
|
+
const ptr0 = passStringToWasm0(items_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1489
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1490
|
+
const ret = wasm.formatRecallContext(ptr0, len0, now_unix);
|
|
1491
|
+
deferred2_0 = ret[0];
|
|
1492
|
+
deferred2_1 = ret[1];
|
|
1493
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1494
|
+
} finally {
|
|
1495
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
exports.formatRecallContext = formatRecallContext;
|
|
1499
|
+
|
|
1447
1500
|
/**
|
|
1448
1501
|
* Generate blind indices (SHA-256 token hashes) for a text string.
|
|
1449
1502
|
*
|
|
@@ -2501,6 +2554,29 @@ function readFeedbackJsonl(content) {
|
|
|
2501
2554
|
}
|
|
2502
2555
|
exports.readFeedbackJsonl = readFeedbackJsonl;
|
|
2503
2556
|
|
|
2557
|
+
/**
|
|
2558
|
+
* Build the recall-context header string (current-date + temporal-reasoning nudge).
|
|
2559
|
+
*
|
|
2560
|
+
* `now_unix`: current time as Unix seconds.
|
|
2561
|
+
* Returns the header with a trailing newline, e.g.:
|
|
2562
|
+
* `"## Relevant memories from TotalReclaw\nThe current date is 2024-01-15. ..."`
|
|
2563
|
+
* @param {bigint} now_unix
|
|
2564
|
+
* @returns {string}
|
|
2565
|
+
*/
|
|
2566
|
+
function recallContextHeader(now_unix) {
|
|
2567
|
+
let deferred1_0;
|
|
2568
|
+
let deferred1_1;
|
|
2569
|
+
try {
|
|
2570
|
+
const ret = wasm.recallContextHeader(now_unix);
|
|
2571
|
+
deferred1_0 = ret[0];
|
|
2572
|
+
deferred1_1 = ret[1];
|
|
2573
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2574
|
+
} finally {
|
|
2575
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
exports.recallContextHeader = recallContextHeader;
|
|
2579
|
+
|
|
2504
2580
|
/**
|
|
2505
2581
|
* Rerank candidates using BM25 + Cosine + RRF fusion.
|
|
2506
2582
|
*
|
package/totalreclaw_core_bg.wasm
CHANGED
|
Binary file
|