@wipcomputer/memory-crystal 0.7.34-alpha.2 → 0.7.34-alpha.4

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 (120) hide show
  1. package/LICENSE +1 -1
  2. package/dist/bridge.js +64 -7
  3. package/dist/bulk-copy.js +67 -16
  4. package/dist/cc-hook.js +2163 -62
  5. package/dist/cc-poller.js +1967 -70
  6. package/dist/cli.js +4538 -139
  7. package/dist/core.js +1789 -6
  8. package/dist/crypto.js +153 -14
  9. package/dist/crystal-serve.js +64 -12
  10. package/dist/doctor.js +517 -52
  11. package/dist/dream-weaver.js +1755 -7
  12. package/dist/file-sync.js +407 -9
  13. package/dist/installer.js +840 -145
  14. package/dist/ldm.js +231 -16
  15. package/dist/mcp-server.js +1882 -17
  16. package/dist/migrate.js +1707 -11
  17. package/dist/mirror-sync.js +2052 -34
  18. package/dist/openclaw.js +1895 -84
  19. package/dist/pair.js +112 -16
  20. package/dist/poller.js +2275 -80
  21. package/dist/role.js +159 -7
  22. package/dist/staging.js +235 -10
  23. package/dist/summarize.js +142 -5
  24. package/package.json +7 -4
  25. package/dist/chunk-25LXQJ4Z.js +0 -110
  26. package/dist/chunk-2DRXIRQW.js +0 -97
  27. package/dist/chunk-2GBYLMEF.js +0 -1385
  28. package/dist/chunk-2ZNH5F6E.js +0 -1281
  29. package/dist/chunk-3G3SFYYI.js +0 -288
  30. package/dist/chunk-3RG5ZIWI.js +0 -10
  31. package/dist/chunk-3S6TI23B.js +0 -97
  32. package/dist/chunk-3VFIJYS4.js +0 -818
  33. package/dist/chunk-437F27T6.js +0 -97
  34. package/dist/chunk-52QE3YI3.js +0 -1169
  35. package/dist/chunk-57RP3DIN.js +0 -1205
  36. package/dist/chunk-5HSZ4W2P.js +0 -62
  37. package/dist/chunk-5I7GMRDN.js +0 -146
  38. package/dist/chunk-645IPXW3.js +0 -290
  39. package/dist/chunk-7A7ELD4C.js +0 -1205
  40. package/dist/chunk-7FYY4GZM.js +0 -1205
  41. package/dist/chunk-7IUE7ODU.js +0 -254
  42. package/dist/chunk-7RMLKZIS.js +0 -108
  43. package/dist/chunk-AA3OPP4Z.js +0 -432
  44. package/dist/chunk-AEWLSYPH.js +0 -72
  45. package/dist/chunk-ASSZDR6I.js +0 -108
  46. package/dist/chunk-AYRJVWUC.js +0 -1205
  47. package/dist/chunk-CCYI5O3D.js +0 -148
  48. package/dist/chunk-CGIDSAJB.js +0 -288
  49. package/dist/chunk-D3I3ZSE2.js +0 -411
  50. package/dist/chunk-D3MACYZ4.js +0 -108
  51. package/dist/chunk-DACSKLY6.js +0 -219
  52. package/dist/chunk-DFQ72B7M.js +0 -248
  53. package/dist/chunk-DW5B4BL7.js +0 -108
  54. package/dist/chunk-EKSACBTJ.js +0 -1070
  55. package/dist/chunk-EXEZZADG.js +0 -248
  56. package/dist/chunk-F3Y7EL7K.js +0 -83
  57. package/dist/chunk-FBQWSDPC.js +0 -1328
  58. package/dist/chunk-FHRZNOMW.js +0 -1205
  59. package/dist/chunk-IM7N24MT.js +0 -129
  60. package/dist/chunk-IPNYIXFK.js +0 -1178
  61. package/dist/chunk-J7MRSZIO.js +0 -167
  62. package/dist/chunk-JITKI2OI.js +0 -106
  63. package/dist/chunk-JWZXYVET.js +0 -1068
  64. package/dist/chunk-KCQUXVYT.js +0 -108
  65. package/dist/chunk-KOQ43OX6.js +0 -1281
  66. package/dist/chunk-KYVWO6ZM.js +0 -1069
  67. package/dist/chunk-L3VHARQH.js +0 -413
  68. package/dist/chunk-LBWDS6BE.js +0 -288
  69. package/dist/chunk-LOVAHSQV.js +0 -411
  70. package/dist/chunk-LQOYCAGG.js +0 -446
  71. package/dist/chunk-LWAIPJ2W.js +0 -146
  72. package/dist/chunk-M5DHKW7M.js +0 -127
  73. package/dist/chunk-MBKCIJHM.js +0 -1328
  74. package/dist/chunk-MK42FMEG.js +0 -147
  75. package/dist/chunk-MOBMYHKL.js +0 -1205
  76. package/dist/chunk-MPLTNMRG.js +0 -67
  77. package/dist/chunk-NIJCVN3O.js +0 -147
  78. package/dist/chunk-NX647OM3.js +0 -310
  79. package/dist/chunk-NZCFSZQ7.js +0 -1205
  80. package/dist/chunk-O2UITJGH.js +0 -465
  81. package/dist/chunk-OCRA44AZ.js +0 -108
  82. package/dist/chunk-P3KJR66H.js +0 -117
  83. package/dist/chunk-PEK6JH65.js +0 -432
  84. package/dist/chunk-PJ6FFKEX.js +0 -77
  85. package/dist/chunk-PLUBBZYR.js +0 -800
  86. package/dist/chunk-PNKVD2UK.js +0 -26
  87. package/dist/chunk-PSQZURHO.js +0 -229
  88. package/dist/chunk-SGL6ISBJ.js +0 -1061
  89. package/dist/chunk-SJABZZT5.js +0 -97
  90. package/dist/chunk-TD3P3K32.js +0 -1199
  91. package/dist/chunk-TMDZJJKV.js +0 -288
  92. package/dist/chunk-UNHVZB5G.js +0 -411
  93. package/dist/chunk-VAFTWSTE.js +0 -1061
  94. package/dist/chunk-VNFXFQBB.js +0 -217
  95. package/dist/chunk-X3GVFKSJ.js +0 -1205
  96. package/dist/chunk-XZ3S56RQ.js +0 -1061
  97. package/dist/chunk-Y72C7F6O.js +0 -148
  98. package/dist/chunk-YLICP577.js +0 -1205
  99. package/dist/chunk-YX6AXLVK.js +0 -159
  100. package/dist/chunk-ZCQYHTNU.js +0 -146
  101. package/dist/cloud-crystal.js +0 -6
  102. package/dist/dev-update-SZ2Z4WCQ.js +0 -6
  103. package/dist/llm-XXLYPIOF.js +0 -16
  104. package/dist/mlx-setup-XKU67WCT.js +0 -289
  105. package/dist/search-pipeline-4K4OJSSS.js +0 -255
  106. package/dist/search-pipeline-4PRS6LI7.js +0 -280
  107. package/dist/search-pipeline-7UJMXPLO.js +0 -280
  108. package/dist/search-pipeline-CBV25NX7.js +0 -99
  109. package/dist/search-pipeline-DQTRLGBH.js +0 -74
  110. package/dist/search-pipeline-HNG37REH.js +0 -282
  111. package/dist/search-pipeline-IZFPLBUB.js +0 -280
  112. package/dist/search-pipeline-MID6F26Q.js +0 -73
  113. package/dist/search-pipeline-N52JZFNN.js +0 -282
  114. package/dist/search-pipeline-OPB2PRQQ.js +0 -280
  115. package/dist/search-pipeline-VXTE5HAD.js +0 -262
  116. package/dist/search-pipeline-XHFKADRG.js +0 -73
  117. package/dist/worker-demo.js +0 -186
  118. package/dist/worker-mcp.js +0 -404
  119. package/scripts/crystal-capture 2.sh +0 -29
  120. package/scripts/deploy-cloud 2.sh +0 -153
package/LICENSE CHANGED
@@ -49,4 +49,4 @@ You should have received a copy of the GNU Affero General Public License
49
49
  along with this program. If not, see <https://www.gnu.org/licenses/>.
50
50
 
51
51
 
52
- AGPLv3 for personal use is free. Commercial licenses available.
52
+ AGPLv3 for personal use is free. Commercial licenses available.
package/dist/bridge.js CHANGED
@@ -1,10 +1,67 @@
1
- import {
2
- isBridgeDesktopRegistered,
3
- isBridgeInstalled,
4
- isBridgeRegistered,
5
- registerBridgeDesktop,
6
- registerBridgeMcp
7
- } from "./chunk-AEWLSYPH.js";
1
+ // src/bridge.ts
2
+ import { existsSync, readFileSync, writeFileSync } from "fs";
3
+ import { execSync } from "child_process";
4
+ import { join } from "path";
5
+ var HOME = process.env.HOME || "";
6
+ function _checkLocalBridge() {
7
+ if (existsSync(join(HOME, ".openclaw", "extensions", "lesa-bridge", "dist", "index.js"))) return true;
8
+ if (existsSync(join(HOME, ".ldm", "extensions", "lesa-bridge", "dist", "index.js"))) return true;
9
+ return false;
10
+ }
11
+ function isBridgeInstalled() {
12
+ try {
13
+ execSync("which lesa 2>/dev/null", { encoding: "utf-8" });
14
+ return true;
15
+ } catch {
16
+ return _checkLocalBridge();
17
+ }
18
+ }
19
+ function isBridgeRegistered() {
20
+ const mcpPath = join(HOME, ".claude", ".mcp.json");
21
+ try {
22
+ if (existsSync(mcpPath)) {
23
+ const config = JSON.parse(readFileSync(mcpPath, "utf-8"));
24
+ if (config.mcpServers && config.mcpServers["lesa-bridge"]) return true;
25
+ }
26
+ } catch {
27
+ }
28
+ try {
29
+ const r = execSync("claude mcp get lesa-bridge 2>&1", { encoding: "utf-8", timeout: 5e3 });
30
+ if (!r.includes("not found") && !r.includes("error")) return true;
31
+ } catch {
32
+ }
33
+ return false;
34
+ }
35
+ function isBridgeDesktopRegistered() {
36
+ const desktopConfig = join(HOME, "Library", "Application Support", "Claude", "claude_desktop_config.json");
37
+ try {
38
+ if (existsSync(desktopConfig)) {
39
+ const config = JSON.parse(readFileSync(desktopConfig, "utf-8"));
40
+ if (config.mcpServers && config.mcpServers["lesa-bridge"]) return true;
41
+ }
42
+ } catch {
43
+ }
44
+ return false;
45
+ }
46
+ function registerBridgeMcp() {
47
+ execSync("claude mcp add --scope user lesa-bridge -- lesa", {
48
+ encoding: "utf-8",
49
+ stdio: "pipe"
50
+ });
51
+ }
52
+ function registerBridgeDesktop() {
53
+ const desktopConfig = join(HOME, "Library", "Application Support", "Claude", "claude_desktop_config.json");
54
+ if (!existsSync(desktopConfig)) return false;
55
+ try {
56
+ const config = JSON.parse(readFileSync(desktopConfig, "utf-8"));
57
+ if (!config.mcpServers) config.mcpServers = {};
58
+ config.mcpServers["lesa-bridge"] = { command: "lesa" };
59
+ writeFileSync(desktopConfig, JSON.stringify(config, null, 2) + "\n");
60
+ return true;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
8
65
  export {
9
66
  isBridgeDesktopRegistered,
10
67
  isBridgeInstalled,
package/dist/bulk-copy.js CHANGED
@@ -1,20 +1,71 @@
1
- import {
2
- ldmPaths
3
- } from "./chunk-DFQ72B7M.js";
1
+ // src/bulk-copy.ts
2
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, copyFileSync as copyFileSync2, statSync, readdirSync as readdirSync2 } from "fs";
3
+ import { join as join2, basename } from "path";
4
+
5
+ // src/ldm.ts
6
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, chmodSync, readdirSync } from "fs";
7
+ import { join, dirname } from "path";
8
+ import { execSync } from "child_process";
9
+ import { fileURLToPath } from "url";
10
+ var HOME = process.env.HOME || "";
11
+ var LDM_ROOT = join(HOME, ".ldm");
12
+ function loadAgentConfig(id) {
13
+ const cfgPath = join(LDM_ROOT, "agents", id, "config.json");
14
+ try {
15
+ if (existsSync(cfgPath)) return JSON.parse(readFileSync(cfgPath, "utf-8"));
16
+ } catch {
17
+ }
18
+ return null;
19
+ }
20
+ function getAgentId(harnessHint) {
21
+ if (process.env.CRYSTAL_AGENT_ID) return process.env.CRYSTAL_AGENT_ID;
22
+ const agentsDir = join(LDM_ROOT, "agents");
23
+ if (existsSync(agentsDir)) {
24
+ try {
25
+ for (const d of readdirSync(agentsDir)) {
26
+ const cfg = loadAgentConfig(d);
27
+ if (!cfg || !cfg.agentId) continue;
28
+ if (!harnessHint) return cfg.agentId;
29
+ if (harnessHint === "claude-code" && cfg.harness === "claude-code-cli") return cfg.agentId;
30
+ if (harnessHint === "openclaw" && cfg.harness === "openclaw") return cfg.agentId;
31
+ }
32
+ } catch {
33
+ }
34
+ }
35
+ return harnessHint === "openclaw" ? "oc-lesa-mini" : "cc-mini";
36
+ }
37
+ function ldmPaths(agentId) {
38
+ const id = agentId || getAgentId();
39
+ const agentRoot = join(LDM_ROOT, "agents", id);
40
+ return {
41
+ root: LDM_ROOT,
42
+ bin: join(LDM_ROOT, "bin"),
43
+ secrets: join(LDM_ROOT, "secrets"),
44
+ state: join(LDM_ROOT, "state"),
45
+ config: join(LDM_ROOT, "config.json"),
46
+ crystalDb: join(LDM_ROOT, "memory", "crystal.db"),
47
+ crystalLance: join(LDM_ROOT, "memory", "lance"),
48
+ agentRoot,
49
+ transcripts: join(agentRoot, "memory", "transcripts"),
50
+ sessions: join(agentRoot, "memory", "sessions"),
51
+ daily: join(agentRoot, "memory", "daily"),
52
+ journals: join(agentRoot, "memory", "journals"),
53
+ workspace: join(agentRoot, "memory", "workspace")
54
+ };
55
+ }
56
+ var LEGACY_OC_DIR = join(HOME, ".openclaw");
4
57
 
5
58
  // src/bulk-copy.ts
6
- import { existsSync, mkdirSync, copyFileSync, statSync, readdirSync } from "fs";
7
- import { join, basename } from "path";
8
59
  function bulkCopyToLdm(sessionPaths, agentId, options) {
9
60
  const start = Date.now();
10
61
  const paths = ldmPaths(agentId);
11
62
  let filesCopied = 0;
12
63
  let filesSkipped = 0;
13
64
  let bytesWritten = 0;
14
- mkdirSync(paths.transcripts, { recursive: true });
65
+ mkdirSync2(paths.transcripts, { recursive: true });
15
66
  for (const srcPath of sessionPaths) {
16
- const destPath = join(paths.transcripts, basename(srcPath));
17
- if (existsSync(destPath)) {
67
+ const destPath = join2(paths.transcripts, basename(srcPath));
68
+ if (existsSync2(destPath)) {
18
69
  try {
19
70
  const srcSize = statSync(srcPath).size;
20
71
  const destSize = statSync(destPath).size;
@@ -26,14 +77,14 @@ function bulkCopyToLdm(sessionPaths, agentId, options) {
26
77
  }
27
78
  }
28
79
  try {
29
- copyFileSync(srcPath, destPath);
80
+ copyFileSync2(srcPath, destPath);
30
81
  bytesWritten += statSync(destPath).size;
31
82
  filesCopied++;
32
83
  } catch {
33
84
  }
34
85
  }
35
86
  if (options?.workspace && options.workspaceSrc) {
36
- mkdirSync(paths.workspace, { recursive: true });
87
+ mkdirSync2(paths.workspace, { recursive: true });
37
88
  const wsResult = copyWorkspaceRecursive(options.workspaceSrc, paths.workspace);
38
89
  filesCopied += wsResult.copied;
39
90
  filesSkipped += wsResult.skipped;
@@ -51,20 +102,20 @@ function copyWorkspaceRecursive(srcDir, destDir) {
51
102
  let skipped = 0;
52
103
  let bytes = 0;
53
104
  try {
54
- for (const entry of readdirSync(srcDir)) {
105
+ for (const entry of readdirSync2(srcDir)) {
55
106
  if (entry.startsWith(".")) continue;
56
- const srcPath = join(srcDir, entry);
57
- const destPath = join(destDir, entry);
107
+ const srcPath = join2(srcDir, entry);
108
+ const destPath = join2(destDir, entry);
58
109
  try {
59
110
  const stat = statSync(srcPath);
60
111
  if (stat.isDirectory()) {
61
- mkdirSync(destPath, { recursive: true });
112
+ mkdirSync2(destPath, { recursive: true });
62
113
  const sub = copyWorkspaceRecursive(srcPath, destPath);
63
114
  copied += sub.copied;
64
115
  skipped += sub.skipped;
65
116
  bytes += sub.bytes;
66
117
  } else if (entry.endsWith(".md")) {
67
- if (existsSync(destPath)) {
118
+ if (existsSync2(destPath)) {
68
119
  try {
69
120
  if (stat.size === statSync(destPath).size) {
70
121
  skipped++;
@@ -73,7 +124,7 @@ function copyWorkspaceRecursive(srcDir, destDir) {
73
124
  } catch {
74
125
  }
75
126
  }
76
- copyFileSync(srcPath, destPath);
127
+ copyFileSync2(srcPath, destPath);
77
128
  bytes += stat.size;
78
129
  copied++;
79
130
  }