@wipcomputer/memory-crystal 0.7.29 → 0.7.32

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 (146) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/SKILL.md +1 -1
  3. package/package.json +1 -1
  4. package/scripts/migrate-lance-to-sqlite.mjs +2 -1
  5. package/_trash/RELEASE-NOTES-v0-7-23.md +0 -48
  6. package/_trash/RELEASE-NOTES-v0-7-25.md +0 -24
  7. package/_trash/RELEASE-NOTES-v0-7-26.md +0 -7
  8. package/_trash/RELEASE-NOTES-v0-7-28.md +0 -31
  9. package/_trash/RELEASE-NOTES-v0-7-29.md +0 -28
  10. package/_trash/RELEASE-NOTES-v0-7-4.md +0 -64
  11. package/_trash/RELEASE-NOTES-v0-7-5.md +0 -19
  12. package/dist/bridge.d.ts +0 -7
  13. package/dist/bridge.js +0 -14
  14. package/dist/bulk-copy.d.ts +0 -17
  15. package/dist/bulk-copy.js +0 -90
  16. package/dist/cc-hook.d.ts +0 -8
  17. package/dist/cc-hook.js +0 -368
  18. package/dist/cc-poller.d.ts +0 -1
  19. package/dist/cc-poller.js +0 -550
  20. package/dist/chunk-25LXQJ4Z.js +0 -110
  21. package/dist/chunk-2DRXIRQW.js +0 -97
  22. package/dist/chunk-2ZNH5F6E.js +0 -1281
  23. package/dist/chunk-3G3SFYYI.js +0 -288
  24. package/dist/chunk-3RG5ZIWI.js +0 -10
  25. package/dist/chunk-3S6TI23B.js +0 -97
  26. package/dist/chunk-3VFIJYS4.js +0 -818
  27. package/dist/chunk-52QE3YI3.js +0 -1169
  28. package/dist/chunk-57RP3DIN.js +0 -1205
  29. package/dist/chunk-5HSZ4W2P.js +0 -62
  30. package/dist/chunk-645IPXW3.js +0 -290
  31. package/dist/chunk-7A7ELD4C.js +0 -1205
  32. package/dist/chunk-7FYY4GZM.js +0 -1205
  33. package/dist/chunk-7IUE7ODU.js +0 -254
  34. package/dist/chunk-7RMLKZIS.js +0 -108
  35. package/dist/chunk-AA3OPP4Z.js +0 -432
  36. package/dist/chunk-AEWLSYPH.js +0 -72
  37. package/dist/chunk-ASSZDR6I.js +0 -108
  38. package/dist/chunk-AYRJVWUC.js +0 -1205
  39. package/dist/chunk-CCYI5O3D.js +0 -148
  40. package/dist/chunk-D3I3ZSE2.js +0 -411
  41. package/dist/chunk-DACSKLY6.js +0 -219
  42. package/dist/chunk-DW5B4BL7.js +0 -108
  43. package/dist/chunk-EKSACBTJ.js +0 -1070
  44. package/dist/chunk-EXEZZADG.js +0 -248
  45. package/dist/chunk-F3Y7EL7K.js +0 -83
  46. package/dist/chunk-FBQWSDPC.js +0 -1328
  47. package/dist/chunk-FHRZNOMW.js +0 -1205
  48. package/dist/chunk-IM7N24MT.js +0 -129
  49. package/dist/chunk-IPNYIXFK.js +0 -1178
  50. package/dist/chunk-J7MRSZIO.js +0 -167
  51. package/dist/chunk-JITKI2OI.js +0 -106
  52. package/dist/chunk-JWZXYVET.js +0 -1068
  53. package/dist/chunk-KCQUXVYT.js +0 -108
  54. package/dist/chunk-KOQ43OX6.js +0 -1281
  55. package/dist/chunk-KYVWO6ZM.js +0 -1069
  56. package/dist/chunk-L3VHARQH.js +0 -413
  57. package/dist/chunk-LBWDS6BE.js +0 -288
  58. package/dist/chunk-LOVAHSQV.js +0 -411
  59. package/dist/chunk-LQOYCAGG.js +0 -446
  60. package/dist/chunk-LWAIPJ2W.js +0 -146
  61. package/dist/chunk-M5DHKW7M.js +0 -127
  62. package/dist/chunk-MBKCIJHM.js +0 -1328
  63. package/dist/chunk-MK42FMEG.js +0 -147
  64. package/dist/chunk-MOBMYHKL.js +0 -1205
  65. package/dist/chunk-MPLTNMRG.js +0 -67
  66. package/dist/chunk-NIJCVN3O.js +0 -147
  67. package/dist/chunk-NZCFSZQ7.js +0 -1205
  68. package/dist/chunk-O2UITJGH.js +0 -465
  69. package/dist/chunk-OCRA44AZ.js +0 -108
  70. package/dist/chunk-P3KJR66H.js +0 -117
  71. package/dist/chunk-PEK6JH65.js +0 -432
  72. package/dist/chunk-PJ6FFKEX.js +0 -77
  73. package/dist/chunk-PLUBBZYR.js +0 -800
  74. package/dist/chunk-PNKVD2UK.js +0 -26
  75. package/dist/chunk-PSQZURHO.js +0 -229
  76. package/dist/chunk-SGL6ISBJ.js +0 -1061
  77. package/dist/chunk-SJABZZT5.js +0 -97
  78. package/dist/chunk-TD3P3K32.js +0 -1199
  79. package/dist/chunk-TMDZJJKV.js +0 -288
  80. package/dist/chunk-UNHVZB5G.js +0 -411
  81. package/dist/chunk-VAFTWSTE.js +0 -1061
  82. package/dist/chunk-VNFXFQBB.js +0 -217
  83. package/dist/chunk-X3GVFKSJ.js +0 -1205
  84. package/dist/chunk-XZ3S56RQ.js +0 -1061
  85. package/dist/chunk-Y72C7F6O.js +0 -148
  86. package/dist/chunk-YLICP577.js +0 -1205
  87. package/dist/chunk-YX6AXLVK.js +0 -159
  88. package/dist/chunk-ZCQYHTNU.js +0 -146
  89. package/dist/cli.d.ts +0 -1
  90. package/dist/cli.js +0 -1105
  91. package/dist/cloud-crystal.js +0 -6
  92. package/dist/core.d.ts +0 -232
  93. package/dist/core.js +0 -12
  94. package/dist/crypto.d.ts +0 -20
  95. package/dist/crypto.js +0 -27
  96. package/dist/crystal-capture.sh +0 -29
  97. package/dist/crystal-serve.d.ts +0 -4
  98. package/dist/crystal-serve.js +0 -252
  99. package/dist/dev-update-SZ2Z4WCQ.js +0 -6
  100. package/dist/discover.d.ts +0 -30
  101. package/dist/discover.js +0 -177
  102. package/dist/doctor.d.ts +0 -9
  103. package/dist/doctor.js +0 -334
  104. package/dist/dream-weaver.d.ts +0 -8
  105. package/dist/dream-weaver.js +0 -56
  106. package/dist/file-sync.d.ts +0 -48
  107. package/dist/file-sync.js +0 -18
  108. package/dist/installer.d.ts +0 -61
  109. package/dist/installer.js +0 -676
  110. package/dist/ldm-backup.sh +0 -116
  111. package/dist/ldm.d.ts +0 -50
  112. package/dist/ldm.js +0 -32
  113. package/dist/mcp-server.d.ts +0 -1
  114. package/dist/mcp-server.js +0 -265
  115. package/dist/migrate.d.ts +0 -1
  116. package/dist/migrate.js +0 -89
  117. package/dist/mirror-sync.d.ts +0 -1
  118. package/dist/mirror-sync.js +0 -159
  119. package/dist/oc-backfill.d.ts +0 -19
  120. package/dist/oc-backfill.js +0 -74
  121. package/dist/openclaw.d.ts +0 -5
  122. package/dist/openclaw.js +0 -423
  123. package/dist/pair.d.ts +0 -4
  124. package/dist/pair.js +0 -75
  125. package/dist/poller.d.ts +0 -1
  126. package/dist/poller.js +0 -634
  127. package/dist/role.d.ts +0 -24
  128. package/dist/role.js +0 -13
  129. package/dist/search-pipeline-4K4OJSSS.js +0 -255
  130. package/dist/search-pipeline-4PRS6LI7.js +0 -280
  131. package/dist/search-pipeline-7UJMXPLO.js +0 -280
  132. package/dist/search-pipeline-DQTRLGBH.js +0 -74
  133. package/dist/search-pipeline-HNG37REH.js +0 -282
  134. package/dist/search-pipeline-IZFPLBUB.js +0 -280
  135. package/dist/search-pipeline-MID6F26Q.js +0 -73
  136. package/dist/search-pipeline-N52JZFNN.js +0 -282
  137. package/dist/search-pipeline-OPB2PRQQ.js +0 -280
  138. package/dist/search-pipeline-VXTE5HAD.js +0 -262
  139. package/dist/search-pipeline-XHFKADRG.js +0 -73
  140. package/dist/staging.d.ts +0 -29
  141. package/dist/staging.js +0 -21
  142. package/dist/summarize.d.ts +0 -19
  143. package/dist/summarize.js +0 -10
  144. package/dist/worker-demo.js +0 -186
  145. package/dist/worker-mcp.js +0 -404
  146. package/dist/worker.js +0 -137
package/dist/discover.js DELETED
@@ -1,177 +0,0 @@
1
- // src/discover.ts
2
- import { existsSync, readdirSync, statSync } from "fs";
3
- import { join } from "path";
4
- var HOME = process.env.HOME || "";
5
- function discoverHarnesses() {
6
- const found = [];
7
- const ccProjectsDir = join(HOME, ".claude", "projects");
8
- if (existsSync(ccProjectsDir)) {
9
- let hasJsonl = false;
10
- try {
11
- for (const entry of readdirSync(ccProjectsDir)) {
12
- const dirPath = join(ccProjectsDir, entry);
13
- try {
14
- if (!statSync(dirPath).isDirectory()) continue;
15
- for (const file of readdirSync(dirPath)) {
16
- if (file.endsWith(".jsonl") && !file.startsWith(".")) {
17
- hasJsonl = true;
18
- break;
19
- }
20
- }
21
- if (hasJsonl) break;
22
- } catch {
23
- continue;
24
- }
25
- }
26
- } catch {
27
- }
28
- if (hasJsonl) {
29
- found.push({
30
- platform: "claude-code",
31
- sessionDir: ccProjectsDir,
32
- filePattern: "*.jsonl",
33
- agentIdDefault: "cc-mini"
34
- });
35
- }
36
- }
37
- const ocAgentsDir = join(HOME, ".openclaw", "agents");
38
- if (existsSync(ocAgentsDir)) {
39
- try {
40
- for (const agentDir of readdirSync(ocAgentsDir)) {
41
- const sessionsDir = join(ocAgentsDir, agentDir, "sessions");
42
- if (!existsSync(sessionsDir)) continue;
43
- let hasJsonl = false;
44
- try {
45
- for (const file of readdirSync(sessionsDir)) {
46
- if (file.endsWith(".jsonl") && !file.startsWith(".")) {
47
- hasJsonl = true;
48
- break;
49
- }
50
- }
51
- } catch {
52
- continue;
53
- }
54
- if (hasJsonl) {
55
- const workspaceDir = join(HOME, ".openclaw", "workspace");
56
- found.push({
57
- platform: "openclaw",
58
- sessionDir: sessionsDir,
59
- workspaceDir: existsSync(workspaceDir) ? workspaceDir : void 0,
60
- filePattern: "*.jsonl",
61
- agentIdDefault: `oc-lesa-mini`
62
- });
63
- }
64
- }
65
- } catch {
66
- }
67
- }
68
- return found;
69
- }
70
- function discoverSessionFiles(harness) {
71
- const files = [];
72
- if (harness.platform === "claude-code") {
73
- if (!existsSync(harness.sessionDir)) return files;
74
- try {
75
- for (const projectDir of readdirSync(harness.sessionDir)) {
76
- const projectPath = join(harness.sessionDir, projectDir);
77
- try {
78
- if (!statSync(projectPath).isDirectory()) continue;
79
- } catch {
80
- continue;
81
- }
82
- try {
83
- for (const file of readdirSync(projectPath)) {
84
- if (file.endsWith(".jsonl") && !file.startsWith(".")) {
85
- files.push(join(projectPath, file));
86
- }
87
- }
88
- } catch {
89
- continue;
90
- }
91
- }
92
- } catch {
93
- }
94
- } else if (harness.platform === "openclaw") {
95
- if (!existsSync(harness.sessionDir)) return files;
96
- try {
97
- for (const file of readdirSync(harness.sessionDir)) {
98
- if (file.endsWith(".jsonl") && !file.startsWith(".")) {
99
- files.push(join(harness.sessionDir, file));
100
- }
101
- }
102
- } catch {
103
- }
104
- }
105
- return files;
106
- }
107
- function discoverWorkspaceFiles(harness) {
108
- if (!harness.workspaceDir || !existsSync(harness.workspaceDir)) return [];
109
- const files = [];
110
- walkMdFiles(harness.workspaceDir, files);
111
- return files;
112
- }
113
- function walkMdFiles(dir, results) {
114
- try {
115
- for (const entry of readdirSync(dir)) {
116
- if (entry.startsWith(".")) continue;
117
- const fullPath = join(dir, entry);
118
- try {
119
- const stat = statSync(fullPath);
120
- if (stat.isDirectory()) {
121
- walkMdFiles(fullPath, results);
122
- } else if (entry.endsWith(".md")) {
123
- results.push(fullPath);
124
- }
125
- } catch {
126
- continue;
127
- }
128
- }
129
- } catch {
130
- }
131
- }
132
- function discoverAll() {
133
- const harnesses = discoverHarnesses();
134
- const breakdown = [];
135
- let totalFiles = 0;
136
- let totalSizeBytes = 0;
137
- for (const harness of harnesses) {
138
- const sessionPaths = discoverSessionFiles(harness);
139
- let sizeBytes = 0;
140
- for (const filePath of sessionPaths) {
141
- try {
142
- sizeBytes += statSync(filePath).size;
143
- } catch {
144
- }
145
- }
146
- const workspacePaths = discoverWorkspaceFiles(harness);
147
- for (const filePath of workspacePaths) {
148
- try {
149
- sizeBytes += statSync(filePath).size;
150
- } catch {
151
- }
152
- }
153
- const allPaths = [...sessionPaths, ...workspacePaths];
154
- breakdown.push({
155
- platform: harness.platform,
156
- files: allPaths.length,
157
- sizeBytes,
158
- sessionPaths: allPaths
159
- });
160
- totalFiles += allPaths.length;
161
- totalSizeBytes += sizeBytes;
162
- }
163
- return { harnesses, totalFiles, totalSizeBytes, breakdown };
164
- }
165
- function formatBytes(bytes) {
166
- if (bytes < 1024) return `${bytes}B`;
167
- if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)}KB`;
168
- if (bytes < 1073741824) return `${(bytes / 1048576).toFixed(1)}MB`;
169
- return `${(bytes / 1073741824).toFixed(1)}GB`;
170
- }
171
- export {
172
- discoverAll,
173
- discoverHarnesses,
174
- discoverSessionFiles,
175
- discoverWorkspaceFiles,
176
- formatBytes
177
- };
package/dist/doctor.d.ts DELETED
@@ -1,9 +0,0 @@
1
- interface DoctorCheck {
2
- name: string;
3
- status: 'ok' | 'warn' | 'fail';
4
- detail: string;
5
- fix?: string;
6
- }
7
- declare function runDoctor(): Promise<DoctorCheck[]>;
8
-
9
- export { type DoctorCheck, runDoctor };
package/dist/doctor.js DELETED
@@ -1,334 +0,0 @@
1
- import {
2
- detectRole
3
- } from "./chunk-3S6TI23B.js";
4
- import {
5
- isBridgeInstalled,
6
- isBridgeRegistered
7
- } from "./chunk-AEWLSYPH.js";
8
- import {
9
- ldmPaths,
10
- resolveStatePath
11
- } from "./chunk-EXEZZADG.js";
12
-
13
- // src/doctor.ts
14
- import { existsSync, readFileSync, readdirSync } from "fs";
15
- import { execSync } from "child_process";
16
- import { join } from "path";
17
- var HOME = process.env.HOME || "";
18
- async function runDoctor() {
19
- const checks = [];
20
- const role = detectRole();
21
- const paths = ldmPaths();
22
- checks.push(checkVersion());
23
- checks.push({
24
- name: "Role",
25
- status: "ok",
26
- detail: `${role.role} (${role.source})`
27
- });
28
- checks.push(await checkDatabase(paths.crystalDb));
29
- checks.push(checkEmbeddingProvider(role.role));
30
- checks.push(checkCaptureCron());
31
- checks.push(checkCCHook());
32
- checks.push(checkRelayConfig(role));
33
- checks.push(checkMcpServer());
34
- checks.push(checkBackup());
35
- checks.push(checkBridge());
36
- checks.push(checkLdmDirectory(paths));
37
- checks.push(checkPrivateMode());
38
- return checks;
39
- }
40
- function checkOpEmbeddings() {
41
- const saTokenLdm = join(HOME, ".ldm", "secrets", "op-sa-token");
42
- const saTokenOc = join(HOME, ".openclaw", "secrets", "op-sa-token");
43
- if (!existsSync(saTokenLdm) && !existsSync(saTokenOc)) return null;
44
- const saTokenPath = existsSync(saTokenLdm) ? saTokenLdm : saTokenOc;
45
- try {
46
- const saToken = readFileSync(saTokenPath, "utf-8").trim();
47
- const result = execSync('op read "op://Agent Secrets/OpenAI API/api key" 2>/dev/null', {
48
- encoding: "utf-8",
49
- env: { ...process.env, OP_SERVICE_ACCOUNT_TOKEN: saToken },
50
- timeout: 1e4
51
- }).trim();
52
- if (result) {
53
- return { name: "Embeddings", status: "ok", detail: "openai (via 1Password)" };
54
- }
55
- } catch {
56
- return {
57
- name: "Embeddings",
58
- status: "warn",
59
- detail: "1Password SA token found but op read failed",
60
- fix: "Check that op CLI is installed and SA token is valid"
61
- };
62
- }
63
- return null;
64
- }
65
- function checkVersion() {
66
- const ldmExtPkg = join(HOME, ".ldm", "extensions", "memory-crystal", "package.json");
67
- const ocExtPkg = join(HOME, ".openclaw", "extensions", "memory-crystal", "package.json");
68
- let installedVersion = null;
69
- try {
70
- if (existsSync(ldmExtPkg)) {
71
- const pkg = JSON.parse(readFileSync(ldmExtPkg, "utf-8"));
72
- installedVersion = pkg.version;
73
- }
74
- } catch {
75
- }
76
- if (!installedVersion) {
77
- return {
78
- name: "Version",
79
- status: "warn",
80
- detail: "not deployed to ~/.ldm/extensions/memory-crystal/",
81
- fix: "crystal init"
82
- };
83
- }
84
- let ocVersion = null;
85
- try {
86
- if (existsSync(ocExtPkg)) {
87
- const pkg = JSON.parse(readFileSync(ocExtPkg, "utf-8"));
88
- ocVersion = pkg.version;
89
- }
90
- } catch {
91
- }
92
- const locations = [`LDM v${installedVersion}`];
93
- if (ocVersion) locations.push(`OC v${ocVersion}`);
94
- if (ocVersion && ocVersion !== installedVersion) {
95
- return {
96
- name: "Version",
97
- status: "warn",
98
- detail: `${locations.join(", ")} (version mismatch)`,
99
- fix: "crystal update"
100
- };
101
- }
102
- return {
103
- name: "Version",
104
- status: "ok",
105
- detail: locations.join(", ")
106
- };
107
- }
108
- function checkCCHook() {
109
- const settingsPath = join(HOME, ".claude", "settings.json");
110
- try {
111
- if (existsSync(settingsPath)) {
112
- const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
113
- const stopHooks = settings?.hooks?.Stop;
114
- if (Array.isArray(stopHooks)) {
115
- const found = stopHooks.some((entry) => {
116
- const hooks = entry?.hooks;
117
- if (!Array.isArray(hooks)) return false;
118
- return hooks.some((h) => h?.command?.includes("memory-crystal") && h?.command?.includes("cc-hook"));
119
- });
120
- if (found) {
121
- return { name: "CC Hook", status: "ok", detail: "Stop hook configured" };
122
- }
123
- }
124
- }
125
- } catch {
126
- }
127
- return {
128
- name: "CC Hook",
129
- status: "warn",
130
- detail: "Stop hook not configured in ~/.claude/settings.json",
131
- fix: "crystal init"
132
- };
133
- }
134
- async function checkDatabase(dbPath) {
135
- if (!existsSync(dbPath)) {
136
- return {
137
- name: "Database",
138
- status: "fail",
139
- detail: "crystal.db not found",
140
- fix: "crystal init"
141
- };
142
- }
143
- try {
144
- const { default: Database } = await import("better-sqlite3");
145
- const db = new Database(dbPath, { readonly: true });
146
- const row = db.prepare("SELECT COUNT(*) as count FROM chunks").get();
147
- db.close();
148
- return {
149
- name: "Database",
150
- status: "ok",
151
- detail: `${row.count.toLocaleString()} chunks`
152
- };
153
- } catch (err) {
154
- return {
155
- name: "Database",
156
- status: "warn",
157
- detail: `exists but could not read: ${err.message}`
158
- };
159
- }
160
- }
161
- function checkEmbeddingProvider(role) {
162
- const hasOpenAI = !!process.env.OPENAI_API_KEY;
163
- const hasGoogle = !!process.env.GOOGLE_API_KEY && process.env.CRYSTAL_EMBEDDING_PROVIDER === "google";
164
- const hasOllama = process.env.CRYSTAL_EMBEDDING_PROVIDER === "ollama";
165
- if (hasOpenAI || hasGoogle || hasOllama) {
166
- const provider = hasOllama ? "ollama" : hasGoogle ? "google" : "openai";
167
- return {
168
- name: "Embeddings",
169
- status: "ok",
170
- detail: provider
171
- };
172
- }
173
- const opResult = checkOpEmbeddings();
174
- if (opResult) return opResult;
175
- if (role === "node") {
176
- return {
177
- name: "Embeddings",
178
- status: "ok",
179
- detail: "not needed (node mode, Core handles embeddings)"
180
- };
181
- }
182
- return {
183
- name: "Embeddings",
184
- status: "fail",
185
- detail: "no embedding provider configured",
186
- fix: "Set OPENAI_API_KEY, or CRYSTAL_EMBEDDING_PROVIDER=ollama"
187
- };
188
- }
189
- function checkCaptureCron() {
190
- try {
191
- const crontab = execSync("crontab -l 2>/dev/null", { encoding: "utf-8" });
192
- if (crontab.includes("crystal-capture")) {
193
- return { name: "Capture", status: "ok", detail: "cron installed" };
194
- }
195
- } catch {
196
- }
197
- return {
198
- name: "Capture",
199
- status: "warn",
200
- detail: "cron not found",
201
- fix: "crystal init"
202
- };
203
- }
204
- function checkRelayConfig(role) {
205
- if (role.role === "standalone") {
206
- return { name: "Relay", status: "ok", detail: "not needed (standalone)" };
207
- }
208
- if (role.role === "node") {
209
- if (!role.relayUrl) {
210
- return { name: "Relay", status: "fail", detail: "node mode but CRYSTAL_RELAY_URL not set", fix: "Set CRYSTAL_RELAY_URL in shell profile" };
211
- }
212
- if (!role.relayToken) {
213
- return { name: "Relay", status: "fail", detail: "node mode but CRYSTAL_RELAY_TOKEN not set", fix: "Set CRYSTAL_RELAY_TOKEN in shell profile" };
214
- }
215
- if (!role.relayKeyExists) {
216
- return { name: "Relay", status: "fail", detail: "encryption key not found", fix: "crystal pair --code <string from Core>" };
217
- }
218
- return { name: "Relay", status: "ok", detail: `node -> ${role.relayUrl}` };
219
- }
220
- if (!role.relayKeyExists) {
221
- return { name: "Relay", status: "warn", detail: "Core mode but no relay key (no nodes can sync)", fix: "crystal pair" };
222
- }
223
- return { name: "Relay", status: "ok", detail: "Core with relay key" };
224
- }
225
- function checkMcpServer() {
226
- const candidates = [
227
- join(HOME, ".claude", ".mcp.json"),
228
- // user-level (legacy)
229
- join(HOME, ".openclaw", ".mcp.json"),
230
- // OpenClaw project-level
231
- join(process.cwd(), ".mcp.json")
232
- // current project
233
- ];
234
- for (const mcpPath of candidates) {
235
- try {
236
- if (existsSync(mcpPath)) {
237
- const config = JSON.parse(readFileSync(mcpPath, "utf-8"));
238
- if (config.mcpServers && config.mcpServers["memory-crystal"]) {
239
- return { name: "MCP Server", status: "ok", detail: `memory-crystal registered (${mcpPath.replace(HOME, "~")})` };
240
- }
241
- }
242
- } catch {
243
- }
244
- }
245
- try {
246
- const result = execSync("claude mcp get memory-crystal 2>&1", { encoding: "utf-8", timeout: 5e3 });
247
- if (!result.includes("not found") && !result.includes("error")) {
248
- return { name: "MCP Server", status: "ok", detail: "memory-crystal registered (user scope)" };
249
- }
250
- } catch {
251
- }
252
- return {
253
- name: "MCP Server",
254
- status: "warn",
255
- detail: "memory-crystal not registered with Claude Code",
256
- fix: "claude mcp add --scope user memory-crystal -- node ~/.ldm/extensions/memory-crystal/dist/mcp-server.js"
257
- };
258
- }
259
- function checkBackup() {
260
- const plistPath = join(HOME, "Library", "LaunchAgents", "ai.openclaw.ldm-backup.plist");
261
- if (existsSync(plistPath)) {
262
- return { name: "Backup", status: "ok", detail: "LaunchAgent installed" };
263
- }
264
- try {
265
- const crontab = execSync("crontab -l 2>/dev/null", { encoding: "utf-8" });
266
- if (crontab.includes("ldm-backup") || crontab.includes("LDMDevTools") && crontab.includes("backup")) {
267
- return { name: "Backup", status: "ok", detail: "cron installed" };
268
- }
269
- } catch {
270
- }
271
- const backupsDir = join(HOME, ".ldm", "backups");
272
- if (existsSync(backupsDir)) {
273
- try {
274
- const entries = readdirSync(backupsDir).filter((e) => !e.startsWith("."));
275
- if (entries.length > 0) return { name: "Backup", status: "ok", detail: `${entries.length} backup(s) in ~/.ldm/backups/` };
276
- } catch {
277
- }
278
- }
279
- return {
280
- name: "Backup",
281
- status: "warn",
282
- detail: "not configured",
283
- fix: "crystal backup setup"
284
- };
285
- }
286
- function checkBridge() {
287
- const installed = isBridgeInstalled();
288
- const registered = isBridgeRegistered();
289
- if (installed && registered) {
290
- return { name: "Bridge", status: "ok", detail: "installed and registered" };
291
- }
292
- if (installed && !registered) {
293
- return { name: "Bridge", status: "warn", detail: "installed but not registered", fix: "crystal bridge setup" };
294
- }
295
- return {
296
- name: "Bridge",
297
- status: "warn",
298
- detail: "not installed",
299
- fix: "npm install -g lesa-bridge && crystal bridge setup"
300
- };
301
- }
302
- function checkLdmDirectory(paths) {
303
- const missing = [];
304
- if (!existsSync(paths.root)) missing.push("~/.ldm");
305
- if (!existsSync(join(paths.root, "memory"))) missing.push("memory/");
306
- if (!existsSync(paths.state)) missing.push("state/");
307
- if (!existsSync(paths.bin)) missing.push("bin/");
308
- if (!existsSync(paths.transcripts)) missing.push("transcripts/");
309
- if (missing.length === 0) {
310
- return { name: "LDM Directory", status: "ok", detail: "intact" };
311
- }
312
- return {
313
- name: "LDM Directory",
314
- status: "fail",
315
- detail: `missing: ${missing.join(", ")}`,
316
- fix: "crystal init"
317
- };
318
- }
319
- function checkPrivateMode() {
320
- const statePath = resolveStatePath("memory-capture-state.json");
321
- try {
322
- if (existsSync(statePath)) {
323
- const state = JSON.parse(readFileSync(statePath, "utf-8"));
324
- if (state.enabled === false) {
325
- return { name: "Private Mode", status: "warn", detail: "capture disabled (private mode ON)" };
326
- }
327
- }
328
- } catch {
329
- }
330
- return { name: "Private Mode", status: "ok", detail: "capture enabled" };
331
- }
332
- export {
333
- runDoctor
334
- };
@@ -1,8 +0,0 @@
1
- import { DreamWeaverOptions, DreamWeaverResult } from 'dream-weaver-protocol';
2
- export { DreamWeaverOptions, DreamWeaverResult } from 'dream-weaver-protocol';
3
-
4
- /** Run Dream Weaver with Memory Crystal integration.
5
- * Wraps the protocol engine with crystal.db embedding and crystal_remember hooks. */
6
- declare function runDreamWeaver(options: DreamWeaverOptions): Promise<DreamWeaverResult>;
7
-
8
- export { runDreamWeaver };
@@ -1,56 +0,0 @@
1
- import {
2
- Crystal,
3
- resolveConfig
4
- } from "./chunk-FBQWSDPC.js";
5
- import {
6
- ldmPaths
7
- } from "./chunk-EXEZZADG.js";
8
-
9
- // src/dream-weaver.ts
10
- import {
11
- runDreamWeaver as runProtocol
12
- } from "dream-weaver-protocol";
13
- async function runDreamWeaver(options) {
14
- const paths = ldmPaths(options.agentId);
15
- const stateDir = paths.state;
16
- const resolvedOptions = {
17
- ...options,
18
- transcriptsDir: options.transcriptsDir || paths.transcripts,
19
- outputDir: options.outputDir || paths.agentRoot
20
- };
21
- const hooks = {
22
- async onJournalWritten(journalPath, journalText, agentId) {
23
- try {
24
- const config = resolveConfig();
25
- const crystal = new Crystal(config);
26
- await crystal.init();
27
- const chunks = [{
28
- text: journalText,
29
- role: "assistant",
30
- source_type: "journal",
31
- source_id: `dream-weaver:${agentId}:${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`,
32
- agent_id: agentId,
33
- token_count: Math.ceil(journalText.length / 4),
34
- created_at: (/* @__PURE__ */ new Date()).toISOString()
35
- }];
36
- await crystal.ingest(chunks);
37
- if ("close" in crystal) crystal.close();
38
- } catch {
39
- }
40
- },
41
- async onMemoryExtracted(text, category) {
42
- try {
43
- const config = resolveConfig();
44
- const crystal = new Crystal(config);
45
- await crystal.init();
46
- await crystal.remember(text, category);
47
- if ("close" in crystal) crystal.close();
48
- } catch {
49
- }
50
- }
51
- };
52
- return runProtocol(resolvedOptions, hooks, stateDir);
53
- }
54
- export {
55
- runDreamWeaver
56
- };
@@ -1,48 +0,0 @@
1
- interface FileManifestEntry {
2
- /** Relative path from ~/.ldm/ (e.g. "agents/cc-mini/memory/daily/2026-03-05.md") */
3
- path: string;
4
- /** SHA-256 hex hash of file contents */
5
- sha256: string;
6
- /** File size in bytes */
7
- size: number;
8
- }
9
- interface FileManifest {
10
- version: number;
11
- generatedAt: string;
12
- /** Total number of files */
13
- fileCount: number;
14
- entries: FileManifestEntry[];
15
- }
16
- interface FileDelta {
17
- /** Files to create or update on the node */
18
- upsert: Array<{
19
- path: string;
20
- sha256: string;
21
- }>;
22
- /** Files to delete on the node */
23
- delete: string[];
24
- }
25
- interface FileSyncState {
26
- lastSync: string | null;
27
- lastManifestHash: string | null;
28
- filesTransferred: number;
29
- filesDeleted: number;
30
- }
31
- /** Generate a manifest of all files under ~/.ldm/. */
32
- declare function generateManifest(): FileManifest;
33
- /** Compare Core manifest against local files. Returns what needs to change. */
34
- declare function compareManifest(coreManifest: FileManifest): FileDelta;
35
- declare function loadFileSyncState(): FileSyncState;
36
- declare function saveFileSyncState(state: FileSyncState): void;
37
- /** Core pushes manifest + changed files to relay "files" channel. */
38
- declare function pushFileSync(): Promise<{
39
- manifest: number;
40
- files: number;
41
- }>;
42
- /** Node pulls files from relay and applies changes. */
43
- declare function pullFileSync(): Promise<{
44
- imported: number;
45
- deleted: number;
46
- }>;
47
-
48
- export { type FileDelta, type FileManifest, type FileManifestEntry, type FileSyncState, compareManifest, generateManifest, loadFileSyncState, pullFileSync, pushFileSync, saveFileSyncState };
package/dist/file-sync.js DELETED
@@ -1,18 +0,0 @@
1
- import {
2
- compareManifest,
3
- generateManifest,
4
- loadFileSyncState,
5
- pullFileSync,
6
- pushFileSync,
7
- saveFileSyncState
8
- } from "./chunk-3G3SFYYI.js";
9
- import "./chunk-KCQUXVYT.js";
10
- import "./chunk-EXEZZADG.js";
11
- export {
12
- compareManifest,
13
- generateManifest,
14
- loadFileSyncState,
15
- pullFileSync,
16
- pushFileSync,
17
- saveFileSyncState
18
- };