@memrosetta/cli 0.4.0 → 0.4.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/dist/chunk-72IW6TAV.js +59 -0
- package/dist/chunk-MISLIVUL.js +70 -0
- package/dist/chunk-NU5ZJJXP.js +63 -0
- package/dist/chunk-SEPYQK3J.js +60 -0
- package/dist/clear-47OFIDME.js +39 -0
- package/dist/clear-5SZVGYBX.js +39 -0
- package/dist/compress-SEFTKZMU.js +33 -0
- package/dist/compress-YNY6YNFU.js +33 -0
- package/dist/count-AMSEVDWR.js +24 -0
- package/dist/count-Z67KBEMV.js +24 -0
- package/dist/feedback-QDOWDWHM.js +40 -0
- package/dist/feedback-XGBKFQXC.js +40 -0
- package/dist/get-NY5H3MUA.js +30 -0
- package/dist/hooks/on-prompt.js +2 -2
- package/dist/hooks/on-stop.js +2 -2
- package/dist/index.js +35 -18
- package/dist/ingest-GSJMWDV5.js +95 -0
- package/dist/ingest-TZEVA25F.js +95 -0
- package/dist/init-GRVRJ6RO.js +205 -0
- package/dist/init-LK4UQISR.js +205 -0
- package/dist/invalidate-BY5VNFSE.js +25 -0
- package/dist/maintain-SGM56XKE.js +37 -0
- package/dist/maintain-VX2VWB2L.js +37 -0
- package/dist/relate-L5464WV5.js +47 -0
- package/dist/relate-SGZLG7JU.js +47 -0
- package/dist/reset-CYY4KYAB.js +129 -0
- package/dist/search-BJ2YV5IS.js +48 -0
- package/dist/search-PT4POELX.js +48 -0
- package/dist/status-TVY32MZD.js +218 -0
- package/dist/store-2USP33HQ.js +91 -0
- package/dist/store-XCFYGYBE.js +91 -0
- package/dist/sync-643GTA5X.js +319 -0
- package/dist/sync-BPVMHW34.js +319 -0
- package/dist/sync-OZQLBYT2.js +317 -0
- package/dist/sync-WURX2HJZ.js +321 -0
- package/dist/working-memory-UYVEJJYW.js +53 -0
- package/dist/working-memory-VP6L2QV6.js +53 -0
- package/package.json +5 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption
|
|
3
|
+
} from "./chunk-VZQURGWB.js";
|
|
4
|
+
import {
|
|
5
|
+
getEngine
|
|
6
|
+
} from "./chunk-72IW6TAV.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
10
|
+
import {
|
|
11
|
+
getDefaultUserId
|
|
12
|
+
} from "./chunk-SEPYQK3J.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/working-memory.ts
|
|
15
|
+
async function run(options) {
|
|
16
|
+
const { args, format, db, noEmbeddings } = options;
|
|
17
|
+
const userId = optionalOption(args, "--user") ?? getDefaultUserId();
|
|
18
|
+
const maxTokensStr = optionalOption(args, "--max-tokens");
|
|
19
|
+
const maxTokens = maxTokensStr ? parseInt(maxTokensStr, 10) : void 0;
|
|
20
|
+
if (maxTokens !== void 0 && (isNaN(maxTokens) || maxTokens <= 0)) {
|
|
21
|
+
throw new Error("--max-tokens must be a positive integer");
|
|
22
|
+
}
|
|
23
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
24
|
+
const memories = await engine.workingMemory(userId, maxTokens);
|
|
25
|
+
if (format === "text") {
|
|
26
|
+
if (memories.length === 0) {
|
|
27
|
+
process.stdout.write("No working memory found.\n");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const totalTokens = memories.reduce(
|
|
31
|
+
(sum, m) => sum + Math.ceil(m.content.length / 4),
|
|
32
|
+
0
|
|
33
|
+
);
|
|
34
|
+
for (const memory of memories) {
|
|
35
|
+
const tier = memory.tier.toUpperCase();
|
|
36
|
+
const score = memory.activationScore.toFixed(2);
|
|
37
|
+
process.stdout.write(
|
|
38
|
+
`[${tier}|${score}] ${memory.content} (${memory.memoryType})
|
|
39
|
+
`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
process.stdout.write(
|
|
43
|
+
`
|
|
44
|
+
${memories.length} memories, ~${totalTokens} tokens
|
|
45
|
+
`
|
|
46
|
+
);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
output({ userId, maxTokens: maxTokens ?? 3e3, memories }, format);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
run
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memrosetta/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"better-sqlite3": "^11.0.0",
|
|
18
18
|
"@memrosetta/core": "0.4.0",
|
|
19
|
-
"@memrosetta/
|
|
20
|
-
"@memrosetta/
|
|
19
|
+
"@memrosetta/embeddings": "0.3.0",
|
|
20
|
+
"@memrosetta/sync-client": "0.1.1",
|
|
21
|
+
"@memrosetta/types": "0.4.0"
|
|
21
22
|
},
|
|
22
23
|
"optionalDependencies": {
|
|
23
24
|
"@memrosetta/llm": "0.3.0"
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"vitest": "^2.0.0"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
|
-
"build": "tsup src/index.ts src/hooks/on-stop.ts src/hooks/on-prompt.ts --format esm --external better-sqlite3 --external @memrosetta/core --external @memrosetta/embeddings --external @memrosetta/types --external @memrosetta/llm --external @huggingface/transformers --external sqlite-vec --external onnxruntime-node",
|
|
33
|
+
"build": "tsup src/index.ts src/hooks/on-stop.ts src/hooks/on-prompt.ts --format esm --external better-sqlite3 --external @memrosetta/core --external @memrosetta/embeddings --external @memrosetta/sync-client --external @memrosetta/types --external @memrosetta/llm --external @huggingface/transformers --external sqlite-vec --external onnxruntime-node",
|
|
33
34
|
"start": "node dist/index.js",
|
|
34
35
|
"test": "vitest run",
|
|
35
36
|
"test:watch": "vitest",
|