@memrosetta/cli 0.3.2 → 0.4.0

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 (112) hide show
  1. package/dist/chunk-356QK7TK.js +533 -0
  2. package/dist/chunk-3LSITXZ4.js +69 -0
  3. package/dist/chunk-6IOTBMUB.js +570 -0
  4. package/dist/chunk-BGXZ3MDD.js +341 -0
  5. package/dist/chunk-EZVP3OY7.js +52 -0
  6. package/dist/chunk-FCHV2JMZ.js +347 -0
  7. package/dist/{chunk-F7ZMZ6HN.js → chunk-HXZ7MAT6.js} +2 -1
  8. package/dist/chunk-IM6H35RB.js +341 -0
  9. package/dist/chunk-JGE6RXXH.js +48 -0
  10. package/dist/chunk-JPBSMZ26.js +343 -0
  11. package/dist/chunk-KSKRPUZZ.js +43 -0
  12. package/dist/chunk-L6S3TXHR.js +326 -0
  13. package/dist/{chunk-326TFH4F.js → chunk-OCCU5YEG.js} +11 -42
  14. package/dist/chunk-PW52BB6L.js +61 -0
  15. package/dist/chunk-RABFL4EN.js +528 -0
  16. package/dist/chunk-RDUU53MG.js +343 -0
  17. package/dist/chunk-RYPYJJ2K.js +70 -0
  18. package/dist/{chunk-CATBN3ZT.js → chunk-TQOH7ZXN.js} +6 -18
  19. package/dist/chunk-Y6NH6K27.js +209 -0
  20. package/dist/{clear-MTL4CQM3.js → clear-4RQW6SYW.js} +10 -5
  21. package/dist/clear-BYRCL5ZN.js +39 -0
  22. package/dist/clear-ETQ7XFMV.js +39 -0
  23. package/dist/clear-P6H55OKZ.js +39 -0
  24. package/dist/clear-T3TWJQKL.js +39 -0
  25. package/dist/{compress-Z46R4N4M.js → compress-HDNYPXZ3.js} +10 -5
  26. package/dist/compress-S6MS4QW7.js +33 -0
  27. package/dist/compress-TVWXLW3L.js +33 -0
  28. package/dist/compress-VLYNZ5BQ.js +33 -0
  29. package/dist/compress-ZXWRRGHT.js +33 -0
  30. package/dist/{count-4TZ3C524.js → count-26AGY5XL.js} +10 -5
  31. package/dist/count-AVG5ZIRW.js +24 -0
  32. package/dist/count-CJIYYJKN.js +24 -0
  33. package/dist/count-KFFD4ML7.js +24 -0
  34. package/dist/count-UUAD3GEJ.js +24 -0
  35. package/dist/{get-B6AL75EW.js → get-75MGS4LN.js} +4 -2
  36. package/dist/ingest-A3BAI2C4.js +95 -0
  37. package/dist/ingest-E7QDD5NY.js +95 -0
  38. package/dist/ingest-IGI7RXR4.js +95 -0
  39. package/dist/ingest-JPIHSH7W.js +95 -0
  40. package/dist/ingest-QGXA4Y6C.js +95 -0
  41. package/dist/init-2PRW64KV.js +146 -0
  42. package/dist/init-C3CONL23.js +146 -0
  43. package/dist/init-DAKOWQSW.js +169 -0
  44. package/dist/init-FYPMJDRN.js +146 -0
  45. package/dist/{init-C335O4TX.js → init-GCT4XEI6.js} +2 -2
  46. package/dist/init-HBEIXY3N.js +146 -0
  47. package/dist/init-MISGIVCC.js +146 -0
  48. package/dist/init-MNM4TXXJ.js +146 -0
  49. package/dist/{init-YAGOXYWG.js → init-OQW3KXTR.js} +2 -2
  50. package/dist/init-SIEKAILM.js +113 -0
  51. package/dist/init-TM7GTHTJ.js +146 -0
  52. package/dist/init-VYWOSISP.js +146 -0
  53. package/dist/init-WCL7FZOJ.js +182 -0
  54. package/dist/init-ZLUDTJAP.js +182 -0
  55. package/dist/{invalidate-C54IVIGL.js → invalidate-D2O4VWZU.js} +4 -2
  56. package/dist/{maintain-ZPHG47YY.js → maintain-B65WIMGJ.js} +10 -5
  57. package/dist/maintain-EWOU3DGT.js +37 -0
  58. package/dist/maintain-FELKLG7O.js +37 -0
  59. package/dist/maintain-WRRDXEG3.js +37 -0
  60. package/dist/maintain-XTCSOQBU.js +37 -0
  61. package/dist/{relate-R6DQUJCQ.js → relate-2QMG5H2I.js} +5 -3
  62. package/dist/relate-C22YYJZT.js +46 -0
  63. package/dist/relate-V5RYMJJ5.js +47 -0
  64. package/dist/relate-W4BXPFJA.js +46 -0
  65. package/dist/reset-45EUG44R.js +95 -0
  66. package/dist/reset-5NDHFUC3.js +95 -0
  67. package/dist/reset-C7I3LA5M.js +95 -0
  68. package/dist/reset-F6F2R6BR.js +95 -0
  69. package/dist/reset-K3K4K5CT.js +95 -0
  70. package/dist/reset-K4WZJ4WU.js +95 -0
  71. package/dist/{reset-P63V46RN.js → reset-NNQQJN6L.js} +2 -2
  72. package/dist/{reset-GPV46GSD.js → reset-P5FXLI4E.js} +2 -2
  73. package/dist/reset-SORHIEKY.js +112 -0
  74. package/dist/reset-SVJMWYAK.js +95 -0
  75. package/dist/reset-W22RJGYZ.js +112 -0
  76. package/dist/reset-W3QVA632.js +95 -0
  77. package/dist/reset-WYEU6XJQ.js +112 -0
  78. package/dist/{search-YEYKOEXC.js → search-2SU5WQYK.js} +9 -4
  79. package/dist/search-5EE3XB2R.js +48 -0
  80. package/dist/search-L6P3XY47.js +48 -0
  81. package/dist/search-UA7Y55LQ.js +48 -0
  82. package/dist/search-ZKLRJXFT.js +48 -0
  83. package/dist/{status-PYD6U7U7.js → status-3XVXJF7M.js} +1 -42
  84. package/dist/status-4THJLSJL.js +131 -0
  85. package/dist/status-4UYY7TOE.js +131 -0
  86. package/dist/status-7G3RMR6A.js +139 -0
  87. package/dist/status-7M4TJVDH.js +170 -0
  88. package/dist/status-7MEEKEC2.js +131 -0
  89. package/dist/status-BQL4VJ6Y.js +149 -0
  90. package/dist/status-BTEVCZ5K.js +125 -0
  91. package/dist/status-F3NZGGPH.js +131 -0
  92. package/dist/status-GQMXOMRN.js +131 -0
  93. package/dist/status-HJGTMHTD.js +131 -0
  94. package/dist/{status-AMMF6QGI.js → status-IEKR6SSH.js} +35 -6
  95. package/dist/status-JJGVWESB.js +139 -0
  96. package/dist/status-LDVRVYZH.js +131 -0
  97. package/dist/{status-XNQRRFWF.js → status-TATIX3R6.js} +1 -1
  98. package/dist/{store-ZMERYHI6.js → store-6D5OJ2DX.js} +12 -7
  99. package/dist/store-I4JNJWAZ.js +91 -0
  100. package/dist/store-R4LXYE57.js +91 -0
  101. package/dist/store-UMR2NOT7.js +91 -0
  102. package/dist/store-ZDI5AH4M.js +91 -0
  103. package/dist/update-XJLMXCDZ.js +36 -0
  104. package/dist/{working-memory-2RRQFX4Q.js → working-memory-2U33JHJB.js} +10 -6
  105. package/dist/working-memory-35TMFU3P.js +53 -0
  106. package/dist/working-memory-IBWGIXLW.js +53 -0
  107. package/dist/working-memory-RZE3GYQZ.js +53 -0
  108. package/dist/working-memory-WGB5DZ3B.js +53 -0
  109. package/package.json +4 -4
  110. package/dist/chunk-MWLPPS7U.js +0 -133
  111. package/dist/ingest-ZOR3XSAE.js +0 -152
  112. package/dist/init-7VFBCA4O.js +0 -26
@@ -1,17 +1,22 @@
1
1
  import {
2
2
  hasFlag,
3
- requireOption
4
- } from "./chunk-F7ZMZ6HN.js";
3
+ optionalOption
4
+ } from "./chunk-HXZ7MAT6.js";
5
+ import {
6
+ getDefaultUserId
7
+ } from "./chunk-JGE6RXXH.js";
8
+ import {
9
+ getEngine
10
+ } from "./chunk-2ZBEEETG.js";
5
11
  import {
6
- getEngine,
7
12
  output,
8
13
  outputError
9
- } from "./chunk-MWLPPS7U.js";
14
+ } from "./chunk-ET6TNQOJ.js";
10
15
 
11
16
  // src/commands/clear.ts
12
17
  async function run(options) {
13
18
  const { args, format, db, noEmbeddings } = options;
14
- const userId = requireOption(args, "--user", "user");
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
15
20
  const confirm = hasFlag(args, "--confirm");
16
21
  if (!confirm) {
17
22
  outputError(
@@ -0,0 +1,39 @@
1
+ import {
2
+ hasFlag,
3
+ optionalOption
4
+ } from "./chunk-TGGGIJC4.js";
5
+ import {
6
+ getEngine
7
+ } from "./chunk-POK32V2J.js";
8
+ import {
9
+ output,
10
+ outputError
11
+ } from "./chunk-ET6TNQOJ.js";
12
+ import {
13
+ getDefaultUserId
14
+ } from "./chunk-TU5EHSDE.js";
15
+
16
+ // src/commands/clear.ts
17
+ async function run(options) {
18
+ const { args, format, db, noEmbeddings } = options;
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
20
+ const confirm = hasFlag(args, "--confirm");
21
+ if (!confirm) {
22
+ outputError(
23
+ "This will delete all memories for the user. Use --confirm to proceed.",
24
+ format
25
+ );
26
+ process.exitCode = 1;
27
+ return;
28
+ }
29
+ const engine = await getEngine({ db, noEmbeddings });
30
+ const countBefore = await engine.count(userId);
31
+ await engine.clear(userId);
32
+ output(
33
+ { userId, cleared: countBefore, message: `Cleared ${countBefore} memories` },
34
+ format
35
+ );
36
+ }
37
+ export {
38
+ run
39
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ hasFlag,
3
+ optionalOption
4
+ } from "./chunk-PW52BB6L.js";
5
+ import {
6
+ getDefaultUserId
7
+ } from "./chunk-TU5EHSDE.js";
8
+ import {
9
+ getEngine
10
+ } from "./chunk-2ZBEEETG.js";
11
+ import {
12
+ output,
13
+ outputError
14
+ } from "./chunk-ET6TNQOJ.js";
15
+
16
+ // src/commands/clear.ts
17
+ async function run(options) {
18
+ const { args, format, db, noEmbeddings } = options;
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
20
+ const confirm = hasFlag(args, "--confirm");
21
+ if (!confirm) {
22
+ outputError(
23
+ "This will delete all memories for the user. Use --confirm to proceed.",
24
+ format
25
+ );
26
+ process.exitCode = 1;
27
+ return;
28
+ }
29
+ const engine = await getEngine({ db, noEmbeddings });
30
+ const countBefore = await engine.count(userId);
31
+ await engine.clear(userId);
32
+ output(
33
+ { userId, cleared: countBefore, message: `Cleared ${countBefore} memories` },
34
+ format
35
+ );
36
+ }
37
+ export {
38
+ run
39
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ hasFlag,
3
+ optionalOption
4
+ } from "./chunk-HXZ7MAT6.js";
5
+ import {
6
+ getDefaultUserId
7
+ } from "./chunk-TU5EHSDE.js";
8
+ import {
9
+ getEngine
10
+ } from "./chunk-2ZBEEETG.js";
11
+ import {
12
+ output,
13
+ outputError
14
+ } from "./chunk-ET6TNQOJ.js";
15
+
16
+ // src/commands/clear.ts
17
+ async function run(options) {
18
+ const { args, format, db, noEmbeddings } = options;
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
20
+ const confirm = hasFlag(args, "--confirm");
21
+ if (!confirm) {
22
+ outputError(
23
+ "This will delete all memories for the user. Use --confirm to proceed.",
24
+ format
25
+ );
26
+ process.exitCode = 1;
27
+ return;
28
+ }
29
+ const engine = await getEngine({ db, noEmbeddings });
30
+ const countBefore = await engine.count(userId);
31
+ await engine.clear(userId);
32
+ output(
33
+ { userId, cleared: countBefore, message: `Cleared ${countBefore} memories` },
34
+ format
35
+ );
36
+ }
37
+ export {
38
+ run
39
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ hasFlag,
3
+ optionalOption
4
+ } from "./chunk-HXZ7MAT6.js";
5
+ import {
6
+ getDefaultUserId
7
+ } from "./chunk-KSKRPUZZ.js";
8
+ import {
9
+ getEngine
10
+ } from "./chunk-EZVP3OY7.js";
11
+ import {
12
+ output,
13
+ outputError
14
+ } from "./chunk-ET6TNQOJ.js";
15
+
16
+ // src/commands/clear.ts
17
+ async function run(options) {
18
+ const { args, format, db, noEmbeddings } = options;
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
20
+ const confirm = hasFlag(args, "--confirm");
21
+ if (!confirm) {
22
+ outputError(
23
+ "This will delete all memories for the user. Use --confirm to proceed.",
24
+ format
25
+ );
26
+ process.exitCode = 1;
27
+ return;
28
+ }
29
+ const engine = await getEngine({ db, noEmbeddings });
30
+ const countBefore = await engine.count(userId);
31
+ await engine.clear(userId);
32
+ output(
33
+ { userId, cleared: countBefore, message: `Cleared ${countBefore} memories` },
34
+ format
35
+ );
36
+ }
37
+ export {
38
+ run
39
+ };
@@ -1,15 +1,20 @@
1
1
  import {
2
- requireOption
3
- } from "./chunk-F7ZMZ6HN.js";
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-JGE6RXXH.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
4
10
  import {
5
- getEngine,
6
11
  output
7
- } from "./chunk-MWLPPS7U.js";
12
+ } from "./chunk-ET6TNQOJ.js";
8
13
 
9
14
  // src/commands/compress.ts
10
15
  async function run(options) {
11
16
  const { args, format, db, noEmbeddings } = options;
12
- const userId = requireOption(args, "--user", "user");
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
13
18
  const engine = await getEngine({ db, noEmbeddings });
14
19
  const result = await engine.compress(userId);
15
20
  if (format === "text") {
@@ -0,0 +1,33 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-KSKRPUZZ.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-EZVP3OY7.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/compress.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const result = await engine.compress(userId);
20
+ if (format === "text") {
21
+ process.stdout.write(`Compression completed for user: ${userId}
22
+ `);
23
+ process.stdout.write(` Groups compressed: ${result.compressed}
24
+ `);
25
+ process.stdout.write(` Memories archived: ${result.removed}
26
+ `);
27
+ return;
28
+ }
29
+ output({ userId, ...result }, format);
30
+ }
31
+ export {
32
+ run
33
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-TGGGIJC4.js";
4
+ import {
5
+ getEngine
6
+ } from "./chunk-POK32V2J.js";
7
+ import {
8
+ output
9
+ } from "./chunk-ET6TNQOJ.js";
10
+ import {
11
+ getDefaultUserId
12
+ } from "./chunk-TU5EHSDE.js";
13
+
14
+ // src/commands/compress.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const result = await engine.compress(userId);
20
+ if (format === "text") {
21
+ process.stdout.write(`Compression completed for user: ${userId}
22
+ `);
23
+ process.stdout.write(` Groups compressed: ${result.compressed}
24
+ `);
25
+ process.stdout.write(` Memories archived: ${result.removed}
26
+ `);
27
+ return;
28
+ }
29
+ output({ userId, ...result }, format);
30
+ }
31
+ export {
32
+ run
33
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-TU5EHSDE.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/compress.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const result = await engine.compress(userId);
20
+ if (format === "text") {
21
+ process.stdout.write(`Compression completed for user: ${userId}
22
+ `);
23
+ process.stdout.write(` Groups compressed: ${result.compressed}
24
+ `);
25
+ process.stdout.write(` Memories archived: ${result.removed}
26
+ `);
27
+ return;
28
+ }
29
+ output({ userId, ...result }, format);
30
+ }
31
+ export {
32
+ run
33
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-PW52BB6L.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-TU5EHSDE.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/compress.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const result = await engine.compress(userId);
20
+ if (format === "text") {
21
+ process.stdout.write(`Compression completed for user: ${userId}
22
+ `);
23
+ process.stdout.write(` Groups compressed: ${result.compressed}
24
+ `);
25
+ process.stdout.write(` Memories archived: ${result.removed}
26
+ `);
27
+ return;
28
+ }
29
+ output({ userId, ...result }, format);
30
+ }
31
+ export {
32
+ run
33
+ };
@@ -1,15 +1,20 @@
1
1
  import {
2
- requireOption
3
- } from "./chunk-F7ZMZ6HN.js";
2
+ optionalOption
3
+ } from "./chunk-PW52BB6L.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-TU5EHSDE.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
4
10
  import {
5
- getEngine,
6
11
  output
7
- } from "./chunk-MWLPPS7U.js";
12
+ } from "./chunk-ET6TNQOJ.js";
8
13
 
9
14
  // src/commands/count.ts
10
15
  async function run(options) {
11
16
  const { args, format, db, noEmbeddings } = options;
12
- const userId = requireOption(args, "--user", "user");
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
13
18
  const engine = await getEngine({ db, noEmbeddings });
14
19
  const count = await engine.count(userId);
15
20
  output({ userId, count }, format);
@@ -0,0 +1,24 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-TGGGIJC4.js";
4
+ import {
5
+ getEngine
6
+ } from "./chunk-POK32V2J.js";
7
+ import {
8
+ output
9
+ } from "./chunk-ET6TNQOJ.js";
10
+ import {
11
+ getDefaultUserId
12
+ } from "./chunk-TU5EHSDE.js";
13
+
14
+ // src/commands/count.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const count = await engine.count(userId);
20
+ output({ userId, count }, format);
21
+ }
22
+ export {
23
+ run
24
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-JGE6RXXH.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/count.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const count = await engine.count(userId);
20
+ output({ userId, count }, format);
21
+ }
22
+ export {
23
+ run
24
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-TU5EHSDE.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-2ZBEEETG.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/count.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const count = await engine.count(userId);
20
+ output({ userId, count }, format);
21
+ }
22
+ export {
23
+ run
24
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ optionalOption
3
+ } from "./chunk-HXZ7MAT6.js";
4
+ import {
5
+ getDefaultUserId
6
+ } from "./chunk-KSKRPUZZ.js";
7
+ import {
8
+ getEngine
9
+ } from "./chunk-EZVP3OY7.js";
10
+ import {
11
+ output
12
+ } from "./chunk-ET6TNQOJ.js";
13
+
14
+ // src/commands/count.ts
15
+ async function run(options) {
16
+ const { args, format, db, noEmbeddings } = options;
17
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
18
+ const engine = await getEngine({ db, noEmbeddings });
19
+ const count = await engine.count(userId);
20
+ output({ userId, count }, format);
21
+ }
22
+ export {
23
+ run
24
+ };
@@ -1,8 +1,10 @@
1
1
  import {
2
- getEngine,
2
+ getEngine
3
+ } from "./chunk-EZVP3OY7.js";
4
+ import {
3
5
  output,
4
6
  outputError
5
- } from "./chunk-MWLPPS7U.js";
7
+ } from "./chunk-ET6TNQOJ.js";
6
8
 
7
9
  // src/commands/get.ts
8
10
  async function run(options) {
@@ -0,0 +1,95 @@
1
+ import {
2
+ classifyTurn,
3
+ parseTranscriptContent
4
+ } from "./chunk-KR63XYFW.js";
5
+ import {
6
+ optionalOption
7
+ } from "./chunk-HXZ7MAT6.js";
8
+ import {
9
+ getDefaultUserId
10
+ } from "./chunk-TU5EHSDE.js";
11
+ import {
12
+ getEngine
13
+ } from "./chunk-2ZBEEETG.js";
14
+ import {
15
+ output,
16
+ outputError
17
+ } from "./chunk-ET6TNQOJ.js";
18
+
19
+ // src/commands/ingest.ts
20
+ import { readFileSync } from "fs";
21
+ function turnsToMemories(turns, userId, namespace, sessionShort) {
22
+ const now = (/* @__PURE__ */ new Date()).toISOString();
23
+ const memories = [];
24
+ for (let i = 0; i < turns.length; i++) {
25
+ const turn = turns[i];
26
+ if (turn.content.length < 20) continue;
27
+ const content = turn.content.length > 500 ? turn.content.slice(0, 497) + "..." : turn.content;
28
+ memories.push({
29
+ userId,
30
+ namespace: namespace ?? `session-${sessionShort}`,
31
+ memoryType: classifyTurn(turn),
32
+ content,
33
+ documentDate: now,
34
+ sourceId: `cc-${sessionShort}-${i}`,
35
+ confidence: turn.role === "user" ? 0.9 : 0.8
36
+ });
37
+ }
38
+ return memories;
39
+ }
40
+ async function readStdin() {
41
+ const chunks = [];
42
+ for await (const chunk of process.stdin) {
43
+ chunks.push(chunk);
44
+ }
45
+ return Buffer.concat(chunks).toString("utf-8").trim();
46
+ }
47
+ async function run(options) {
48
+ const { args, format, db, noEmbeddings } = options;
49
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
50
+ const file = optionalOption(args, "--file");
51
+ const namespace = optionalOption(args, "--namespace");
52
+ let content;
53
+ if (file) {
54
+ try {
55
+ content = readFileSync(file, "utf-8");
56
+ } catch (err) {
57
+ const msg = err instanceof Error ? err.message : String(err);
58
+ outputError(`Failed to read file: ${msg}`, format);
59
+ process.exitCode = 1;
60
+ return;
61
+ }
62
+ } else {
63
+ content = await readStdin();
64
+ }
65
+ if (!content) {
66
+ outputError("No transcript content provided", format);
67
+ process.exitCode = 1;
68
+ return;
69
+ }
70
+ const parsed = parseTranscriptContent(content);
71
+ const sessionShort = parsed.sessionId ? parsed.sessionId.slice(0, 8) : "unknown";
72
+ const memories = turnsToMemories(
73
+ parsed.turns,
74
+ userId,
75
+ namespace,
76
+ sessionShort
77
+ );
78
+ if (memories.length === 0) {
79
+ output({ stored: 0, message: "No memories extracted from transcript" }, format);
80
+ return;
81
+ }
82
+ const engine = await getEngine({ db, noEmbeddings });
83
+ const stored = await engine.storeBatch(memories);
84
+ output(
85
+ {
86
+ stored: stored.length,
87
+ sessionId: parsed.sessionId || void 0,
88
+ namespace: namespace ?? `session-${sessionShort}`
89
+ },
90
+ format
91
+ );
92
+ }
93
+ export {
94
+ run
95
+ };
@@ -0,0 +1,95 @@
1
+ import {
2
+ classifyTurn,
3
+ parseTranscriptContent
4
+ } from "./chunk-KR63XYFW.js";
5
+ import {
6
+ optionalOption
7
+ } from "./chunk-PW52BB6L.js";
8
+ import {
9
+ getDefaultUserId
10
+ } from "./chunk-TU5EHSDE.js";
11
+ import {
12
+ getEngine
13
+ } from "./chunk-2ZBEEETG.js";
14
+ import {
15
+ output,
16
+ outputError
17
+ } from "./chunk-ET6TNQOJ.js";
18
+
19
+ // src/commands/ingest.ts
20
+ import { readFileSync } from "fs";
21
+ function turnsToMemories(turns, userId, namespace, sessionShort) {
22
+ const now = (/* @__PURE__ */ new Date()).toISOString();
23
+ const memories = [];
24
+ for (let i = 0; i < turns.length; i++) {
25
+ const turn = turns[i];
26
+ if (turn.content.length < 20) continue;
27
+ const content = turn.content.length > 500 ? turn.content.slice(0, 497) + "..." : turn.content;
28
+ memories.push({
29
+ userId,
30
+ namespace: namespace ?? `session-${sessionShort}`,
31
+ memoryType: classifyTurn(turn),
32
+ content,
33
+ documentDate: now,
34
+ sourceId: `cc-${sessionShort}-${i}`,
35
+ confidence: turn.role === "user" ? 0.9 : 0.8
36
+ });
37
+ }
38
+ return memories;
39
+ }
40
+ async function readStdin() {
41
+ const chunks = [];
42
+ for await (const chunk of process.stdin) {
43
+ chunks.push(chunk);
44
+ }
45
+ return Buffer.concat(chunks).toString("utf-8").trim();
46
+ }
47
+ async function run(options) {
48
+ const { args, format, db, noEmbeddings } = options;
49
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
50
+ const file = optionalOption(args, "--file");
51
+ const namespace = optionalOption(args, "--namespace");
52
+ let content;
53
+ if (file) {
54
+ try {
55
+ content = readFileSync(file, "utf-8");
56
+ } catch (err) {
57
+ const msg = err instanceof Error ? err.message : String(err);
58
+ outputError(`Failed to read file: ${msg}`, format);
59
+ process.exitCode = 1;
60
+ return;
61
+ }
62
+ } else {
63
+ content = await readStdin();
64
+ }
65
+ if (!content) {
66
+ outputError("No transcript content provided", format);
67
+ process.exitCode = 1;
68
+ return;
69
+ }
70
+ const parsed = parseTranscriptContent(content);
71
+ const sessionShort = parsed.sessionId ? parsed.sessionId.slice(0, 8) : "unknown";
72
+ const memories = turnsToMemories(
73
+ parsed.turns,
74
+ userId,
75
+ namespace,
76
+ sessionShort
77
+ );
78
+ if (memories.length === 0) {
79
+ output({ stored: 0, message: "No memories extracted from transcript" }, format);
80
+ return;
81
+ }
82
+ const engine = await getEngine({ db, noEmbeddings });
83
+ const stored = await engine.storeBatch(memories);
84
+ output(
85
+ {
86
+ stored: stored.length,
87
+ sessionId: parsed.sessionId || void 0,
88
+ namespace: namespace ?? `session-${sessionShort}`
89
+ },
90
+ format
91
+ );
92
+ }
93
+ export {
94
+ run
95
+ };