@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.
Files changed (38) hide show
  1. package/dist/chunk-72IW6TAV.js +59 -0
  2. package/dist/chunk-MISLIVUL.js +70 -0
  3. package/dist/chunk-NU5ZJJXP.js +63 -0
  4. package/dist/chunk-SEPYQK3J.js +60 -0
  5. package/dist/clear-47OFIDME.js +39 -0
  6. package/dist/clear-5SZVGYBX.js +39 -0
  7. package/dist/compress-SEFTKZMU.js +33 -0
  8. package/dist/compress-YNY6YNFU.js +33 -0
  9. package/dist/count-AMSEVDWR.js +24 -0
  10. package/dist/count-Z67KBEMV.js +24 -0
  11. package/dist/feedback-QDOWDWHM.js +40 -0
  12. package/dist/feedback-XGBKFQXC.js +40 -0
  13. package/dist/get-NY5H3MUA.js +30 -0
  14. package/dist/hooks/on-prompt.js +2 -2
  15. package/dist/hooks/on-stop.js +2 -2
  16. package/dist/index.js +35 -18
  17. package/dist/ingest-GSJMWDV5.js +95 -0
  18. package/dist/ingest-TZEVA25F.js +95 -0
  19. package/dist/init-GRVRJ6RO.js +205 -0
  20. package/dist/init-LK4UQISR.js +205 -0
  21. package/dist/invalidate-BY5VNFSE.js +25 -0
  22. package/dist/maintain-SGM56XKE.js +37 -0
  23. package/dist/maintain-VX2VWB2L.js +37 -0
  24. package/dist/relate-L5464WV5.js +47 -0
  25. package/dist/relate-SGZLG7JU.js +47 -0
  26. package/dist/reset-CYY4KYAB.js +129 -0
  27. package/dist/search-BJ2YV5IS.js +48 -0
  28. package/dist/search-PT4POELX.js +48 -0
  29. package/dist/status-TVY32MZD.js +218 -0
  30. package/dist/store-2USP33HQ.js +91 -0
  31. package/dist/store-XCFYGYBE.js +91 -0
  32. package/dist/sync-643GTA5X.js +319 -0
  33. package/dist/sync-BPVMHW34.js +319 -0
  34. package/dist/sync-OZQLBYT2.js +317 -0
  35. package/dist/sync-WURX2HJZ.js +321 -0
  36. package/dist/working-memory-UYVEJJYW.js +53 -0
  37. package/dist/working-memory-VP6L2QV6.js +53 -0
  38. 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.0",
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/types": "0.4.0",
20
- "@memrosetta/embeddings": "0.3.0"
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",