@wipcomputer/memory-crystal 0.7.30 → 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 (211) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/SKILL.md +1 -1
  3. package/package.json +1 -1
  4. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/.env.example +0 -20
  5. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/.publish-skill.json +0 -1
  6. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/CHANGELOG.md +0 -1297
  7. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/CLA.md +0 -19
  8. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/LICENSE +0 -52
  9. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/README-ENTERPRISE.md +0 -226
  10. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/README.md +0 -151
  11. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/RELAY.md +0 -199
  12. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/SKILL.md +0 -462
  13. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/TECHNICAL.md +0 -656
  14. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-23.md +0 -48
  15. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-25.md +0 -24
  16. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-26.md +0 -7
  17. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-28.md +0 -31
  18. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-29.md +0 -28
  19. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-4.md +0 -64
  20. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/_trash/RELEASE-NOTES-v0-7-5.md +0 -19
  21. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/cloud/README.md +0 -116
  22. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/cloud/docs/gpt-system-instructions.md +0 -69
  23. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/cloud/migrations/0001_init.sql +0 -52
  24. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/migrations/0001_init.sql +0 -51
  25. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/migrations/0002_cloud_storage.sql +0 -49
  26. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/openclaw.plugin.json +0 -11
  27. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/package-lock.json +0 -4169
  28. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/package.json +0 -61
  29. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/scripts/crystal-capture.sh +0 -29
  30. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/scripts/deploy-cloud.sh +0 -153
  31. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/scripts/ldm-backup.sh +0 -116
  32. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/scripts/migrate-lance-to-sqlite.mjs +0 -218
  33. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/skills/memory/SKILL.md +0 -438
  34. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/wrangler-demo.toml +0 -8
  35. package/.worktrees/memory-crystal-private--cc-mini-fix-home-fallback/wrangler-mcp.toml +0 -24
  36. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/.env.example +0 -20
  37. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/.publish-skill.json +0 -1
  38. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/CHANGELOG.md +0 -1297
  39. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/CLA.md +0 -19
  40. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/LICENSE +0 -52
  41. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/README-ENTERPRISE.md +0 -226
  42. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/README.md +0 -151
  43. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/RELAY.md +0 -199
  44. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/RELEASE-NOTES-v0.7.30.md +0 -29
  45. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/SKILL.md +0 -462
  46. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/TECHNICAL.md +0 -656
  47. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-23.md +0 -48
  48. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-25.md +0 -24
  49. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-26.md +0 -7
  50. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-28.md +0 -31
  51. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-29.md +0 -28
  52. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-4.md +0 -64
  53. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/_trash/RELEASE-NOTES-v0-7-5.md +0 -19
  54. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/cloud/README.md +0 -116
  55. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/cloud/docs/gpt-system-instructions.md +0 -69
  56. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/cloud/migrations/0001_init.sql +0 -52
  57. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/migrations/0001_init.sql +0 -51
  58. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/migrations/0002_cloud_storage.sql +0 -49
  59. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/openclaw.plugin.json +0 -11
  60. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/package-lock.json +0 -4169
  61. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/package.json +0 -61
  62. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/scripts/crystal-capture.sh +0 -29
  63. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/scripts/deploy-cloud.sh +0 -153
  64. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/scripts/ldm-backup.sh +0 -116
  65. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/scripts/migrate-lance-to-sqlite.mjs +0 -218
  66. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/skills/memory/SKILL.md +0 -438
  67. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/wrangler-demo.toml +0 -8
  68. package/.worktrees/memory-crystal-private--cc-mini-release-notes-v0.7.30/wrangler-mcp.toml +0 -24
  69. package/_trash/RELEASE-NOTES-v0-7-23.md +0 -48
  70. package/_trash/RELEASE-NOTES-v0-7-25.md +0 -24
  71. package/_trash/RELEASE-NOTES-v0-7-26.md +0 -7
  72. package/_trash/RELEASE-NOTES-v0-7-28.md +0 -31
  73. package/_trash/RELEASE-NOTES-v0-7-29.md +0 -28
  74. package/_trash/RELEASE-NOTES-v0-7-4.md +0 -64
  75. package/_trash/RELEASE-NOTES-v0-7-5.md +0 -19
  76. package/_trash/RELEASE-NOTES-v0.7.30.md +0 -29
  77. package/dist/bridge.d.ts +0 -7
  78. package/dist/bridge.js +0 -14
  79. package/dist/bulk-copy.d.ts +0 -17
  80. package/dist/bulk-copy.js +0 -90
  81. package/dist/cc-hook.d.ts +0 -8
  82. package/dist/cc-hook.js +0 -368
  83. package/dist/cc-poller.d.ts +0 -1
  84. package/dist/cc-poller.js +0 -550
  85. package/dist/chunk-25LXQJ4Z.js +0 -110
  86. package/dist/chunk-2DRXIRQW.js +0 -97
  87. package/dist/chunk-2ZNH5F6E.js +0 -1281
  88. package/dist/chunk-3G3SFYYI.js +0 -288
  89. package/dist/chunk-3RG5ZIWI.js +0 -10
  90. package/dist/chunk-3S6TI23B.js +0 -97
  91. package/dist/chunk-3VFIJYS4.js +0 -818
  92. package/dist/chunk-52QE3YI3.js +0 -1169
  93. package/dist/chunk-57RP3DIN.js +0 -1205
  94. package/dist/chunk-5HSZ4W2P.js +0 -62
  95. package/dist/chunk-645IPXW3.js +0 -290
  96. package/dist/chunk-7A7ELD4C.js +0 -1205
  97. package/dist/chunk-7FYY4GZM.js +0 -1205
  98. package/dist/chunk-7IUE7ODU.js +0 -254
  99. package/dist/chunk-7RMLKZIS.js +0 -108
  100. package/dist/chunk-AA3OPP4Z.js +0 -432
  101. package/dist/chunk-AEWLSYPH.js +0 -72
  102. package/dist/chunk-ASSZDR6I.js +0 -108
  103. package/dist/chunk-AYRJVWUC.js +0 -1205
  104. package/dist/chunk-CCYI5O3D.js +0 -148
  105. package/dist/chunk-D3I3ZSE2.js +0 -411
  106. package/dist/chunk-DACSKLY6.js +0 -219
  107. package/dist/chunk-DW5B4BL7.js +0 -108
  108. package/dist/chunk-EKSACBTJ.js +0 -1070
  109. package/dist/chunk-EXEZZADG.js +0 -248
  110. package/dist/chunk-F3Y7EL7K.js +0 -83
  111. package/dist/chunk-FBQWSDPC.js +0 -1328
  112. package/dist/chunk-FHRZNOMW.js +0 -1205
  113. package/dist/chunk-IM7N24MT.js +0 -129
  114. package/dist/chunk-IPNYIXFK.js +0 -1178
  115. package/dist/chunk-J7MRSZIO.js +0 -167
  116. package/dist/chunk-JITKI2OI.js +0 -106
  117. package/dist/chunk-JWZXYVET.js +0 -1068
  118. package/dist/chunk-KCQUXVYT.js +0 -108
  119. package/dist/chunk-KOQ43OX6.js +0 -1281
  120. package/dist/chunk-KYVWO6ZM.js +0 -1069
  121. package/dist/chunk-L3VHARQH.js +0 -413
  122. package/dist/chunk-LBWDS6BE.js +0 -288
  123. package/dist/chunk-LOVAHSQV.js +0 -411
  124. package/dist/chunk-LQOYCAGG.js +0 -446
  125. package/dist/chunk-LWAIPJ2W.js +0 -146
  126. package/dist/chunk-M5DHKW7M.js +0 -127
  127. package/dist/chunk-MBKCIJHM.js +0 -1328
  128. package/dist/chunk-MK42FMEG.js +0 -147
  129. package/dist/chunk-MOBMYHKL.js +0 -1205
  130. package/dist/chunk-MPLTNMRG.js +0 -67
  131. package/dist/chunk-NIJCVN3O.js +0 -147
  132. package/dist/chunk-NZCFSZQ7.js +0 -1205
  133. package/dist/chunk-O2UITJGH.js +0 -465
  134. package/dist/chunk-OCRA44AZ.js +0 -108
  135. package/dist/chunk-P3KJR66H.js +0 -117
  136. package/dist/chunk-PEK6JH65.js +0 -432
  137. package/dist/chunk-PJ6FFKEX.js +0 -77
  138. package/dist/chunk-PLUBBZYR.js +0 -800
  139. package/dist/chunk-PNKVD2UK.js +0 -26
  140. package/dist/chunk-PSQZURHO.js +0 -229
  141. package/dist/chunk-SGL6ISBJ.js +0 -1061
  142. package/dist/chunk-SJABZZT5.js +0 -97
  143. package/dist/chunk-TD3P3K32.js +0 -1199
  144. package/dist/chunk-TMDZJJKV.js +0 -288
  145. package/dist/chunk-UNHVZB5G.js +0 -411
  146. package/dist/chunk-VAFTWSTE.js +0 -1061
  147. package/dist/chunk-VNFXFQBB.js +0 -217
  148. package/dist/chunk-X3GVFKSJ.js +0 -1205
  149. package/dist/chunk-XZ3S56RQ.js +0 -1061
  150. package/dist/chunk-Y72C7F6O.js +0 -148
  151. package/dist/chunk-YLICP577.js +0 -1205
  152. package/dist/chunk-YX6AXLVK.js +0 -159
  153. package/dist/chunk-ZCQYHTNU.js +0 -146
  154. package/dist/cli.d.ts +0 -1
  155. package/dist/cli.js +0 -1105
  156. package/dist/cloud-crystal.js +0 -6
  157. package/dist/core.d.ts +0 -232
  158. package/dist/core.js +0 -12
  159. package/dist/crypto.d.ts +0 -20
  160. package/dist/crypto.js +0 -27
  161. package/dist/crystal-capture.sh +0 -29
  162. package/dist/crystal-serve.d.ts +0 -4
  163. package/dist/crystal-serve.js +0 -252
  164. package/dist/dev-update-SZ2Z4WCQ.js +0 -6
  165. package/dist/discover.d.ts +0 -30
  166. package/dist/discover.js +0 -177
  167. package/dist/doctor.d.ts +0 -9
  168. package/dist/doctor.js +0 -334
  169. package/dist/dream-weaver.d.ts +0 -8
  170. package/dist/dream-weaver.js +0 -56
  171. package/dist/file-sync.d.ts +0 -48
  172. package/dist/file-sync.js +0 -18
  173. package/dist/installer.d.ts +0 -61
  174. package/dist/installer.js +0 -676
  175. package/dist/ldm-backup.sh +0 -116
  176. package/dist/ldm.d.ts +0 -50
  177. package/dist/ldm.js +0 -32
  178. package/dist/mcp-server.d.ts +0 -1
  179. package/dist/mcp-server.js +0 -265
  180. package/dist/migrate.d.ts +0 -1
  181. package/dist/migrate.js +0 -89
  182. package/dist/mirror-sync.d.ts +0 -1
  183. package/dist/mirror-sync.js +0 -159
  184. package/dist/oc-backfill.d.ts +0 -19
  185. package/dist/oc-backfill.js +0 -74
  186. package/dist/openclaw.d.ts +0 -5
  187. package/dist/openclaw.js +0 -423
  188. package/dist/pair.d.ts +0 -4
  189. package/dist/pair.js +0 -75
  190. package/dist/poller.d.ts +0 -1
  191. package/dist/poller.js +0 -634
  192. package/dist/role.d.ts +0 -24
  193. package/dist/role.js +0 -13
  194. package/dist/search-pipeline-4K4OJSSS.js +0 -255
  195. package/dist/search-pipeline-4PRS6LI7.js +0 -280
  196. package/dist/search-pipeline-7UJMXPLO.js +0 -280
  197. package/dist/search-pipeline-DQTRLGBH.js +0 -74
  198. package/dist/search-pipeline-HNG37REH.js +0 -282
  199. package/dist/search-pipeline-IZFPLBUB.js +0 -280
  200. package/dist/search-pipeline-MID6F26Q.js +0 -73
  201. package/dist/search-pipeline-N52JZFNN.js +0 -282
  202. package/dist/search-pipeline-OPB2PRQQ.js +0 -280
  203. package/dist/search-pipeline-VXTE5HAD.js +0 -262
  204. package/dist/search-pipeline-XHFKADRG.js +0 -73
  205. package/dist/staging.d.ts +0 -29
  206. package/dist/staging.js +0 -21
  207. package/dist/summarize.d.ts +0 -19
  208. package/dist/summarize.js +0 -10
  209. package/dist/worker-demo.js +0 -186
  210. package/dist/worker-mcp.js +0 -404
  211. package/dist/worker.js +0 -137
@@ -1,217 +0,0 @@
1
- // src/ldm.ts
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, chmodSync } from "fs";
3
- import { join, dirname } from "path";
4
- import { execSync } from "child_process";
5
- import { fileURLToPath } from "url";
6
- var HOME = process.env.HOME || "";
7
- var LDM_ROOT = join(HOME, ".ldm");
8
- function getAgentId() {
9
- return process.env.CRYSTAL_AGENT_ID || "cc-mini";
10
- }
11
- function ldmPaths(agentId) {
12
- const id = agentId || getAgentId();
13
- const agentRoot = join(LDM_ROOT, "agents", id);
14
- return {
15
- root: LDM_ROOT,
16
- bin: join(LDM_ROOT, "bin"),
17
- secrets: join(LDM_ROOT, "secrets"),
18
- state: join(LDM_ROOT, "state"),
19
- config: join(LDM_ROOT, "config.json"),
20
- crystalDb: join(LDM_ROOT, "memory", "crystal.db"),
21
- crystalLance: join(LDM_ROOT, "memory", "lance"),
22
- agentRoot,
23
- transcripts: join(agentRoot, "memory", "transcripts"),
24
- sessions: join(agentRoot, "memory", "sessions"),
25
- daily: join(agentRoot, "memory", "daily"),
26
- journals: join(agentRoot, "memory", "journals")
27
- };
28
- }
29
- function loadConfig() {
30
- const configPath = join(LDM_ROOT, "config.json");
31
- try {
32
- if (existsSync(configPath)) {
33
- return JSON.parse(readFileSync(configPath, "utf-8"));
34
- }
35
- } catch {
36
- }
37
- return null;
38
- }
39
- function saveConfig(config) {
40
- const configPath = join(LDM_ROOT, "config.json");
41
- writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
42
- }
43
- function scaffoldLdm(agentId) {
44
- const paths = ldmPaths(agentId);
45
- mkdirSync(join(paths.root, "memory"), { recursive: true });
46
- mkdirSync(paths.crystalLance, { recursive: true });
47
- mkdirSync(paths.bin, { recursive: true });
48
- mkdirSync(paths.secrets, { recursive: true, mode: 448 });
49
- mkdirSync(paths.state, { recursive: true });
50
- mkdirSync(paths.transcripts, { recursive: true });
51
- mkdirSync(paths.sessions, { recursive: true });
52
- mkdirSync(paths.daily, { recursive: true });
53
- mkdirSync(paths.journals, { recursive: true });
54
- const id = agentId || getAgentId();
55
- let config = loadConfig();
56
- if (!config) {
57
- config = {
58
- version: "1.0.0",
59
- agents: [id],
60
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
61
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
62
- };
63
- } else {
64
- if (!config.agents.includes(id)) {
65
- config.agents.push(id);
66
- }
67
- config.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
68
- }
69
- saveConfig(config);
70
- return paths;
71
- }
72
- function deployCaptureScript() {
73
- const paths = ldmPaths();
74
- mkdirSync(paths.bin, { recursive: true });
75
- const thisDir = dirname(fileURLToPath(import.meta.url));
76
- let scriptSrc = join(thisDir, "crystal-capture.sh");
77
- if (!existsSync(scriptSrc)) {
78
- scriptSrc = join(thisDir, "..", "scripts", "crystal-capture.sh");
79
- }
80
- const scriptDest = join(paths.bin, "crystal-capture.sh");
81
- if (!existsSync(scriptSrc)) {
82
- throw new Error(`crystal-capture.sh not found at ${scriptSrc}`);
83
- }
84
- copyFileSync(scriptSrc, scriptDest);
85
- chmodSync(scriptDest, 493);
86
- return scriptDest;
87
- }
88
- var CRON_TAG = "# crystal-capture";
89
- var CRON_ENTRY = "* * * * * ~/.ldm/bin/crystal-capture.sh >> /tmp/ldm-dev-tools/crystal-capture.log 2>&1";
90
- function isCrystalCaptureLine(line) {
91
- return line === CRON_TAG || line.includes("crystal-capture.sh") && line.startsWith("*");
92
- }
93
- function installCron() {
94
- mkdirSync("/tmp/ldm-dev-tools", { recursive: true });
95
- let existing = "";
96
- try {
97
- existing = execSync("crontab -l 2>/dev/null", { encoding: "utf8" });
98
- } catch {
99
- }
100
- const lines = existing.split("\n").filter((line) => !isCrystalCaptureLine(line));
101
- lines.push(CRON_TAG);
102
- lines.push(CRON_ENTRY);
103
- const newCrontab = lines.filter((l, i, arr) => !(l === "" && i === arr.length - 1)).join("\n") + "\n";
104
- execSync("crontab -", { input: newCrontab, encoding: "utf8" });
105
- }
106
- function removeCron() {
107
- let existing = "";
108
- try {
109
- existing = execSync("crontab -l 2>/dev/null", { encoding: "utf8" });
110
- } catch {
111
- return;
112
- }
113
- const lines = existing.split("\n").filter((line) => !isCrystalCaptureLine(line));
114
- const newCrontab = lines.join("\n");
115
- execSync("crontab -", { input: newCrontab, encoding: "utf8" });
116
- }
117
- function deployBackupScript() {
118
- const paths = ldmPaths();
119
- mkdirSync(paths.bin, { recursive: true });
120
- const thisDir = dirname(fileURLToPath(import.meta.url));
121
- let scriptSrc = join(thisDir, "ldm-backup.sh");
122
- if (!existsSync(scriptSrc)) {
123
- scriptSrc = join(thisDir, "..", "scripts", "ldm-backup.sh");
124
- }
125
- const scriptDest = join(paths.bin, "ldm-backup.sh");
126
- if (!existsSync(scriptSrc)) {
127
- throw new Error(`ldm-backup.sh not found at ${scriptSrc}`);
128
- }
129
- copyFileSync(scriptSrc, scriptDest);
130
- chmodSync(scriptDest, 493);
131
- return scriptDest;
132
- }
133
- function installBackupLaunchAgent() {
134
- const scriptPath = join(ldmPaths().bin, "ldm-backup.sh");
135
- if (!existsSync(scriptPath)) {
136
- throw new Error(`Backup script not found. Run crystal init first.`);
137
- }
138
- const launchAgentsDir = join(HOME, "Library", "LaunchAgents");
139
- mkdirSync(launchAgentsDir, { recursive: true });
140
- const plistPath = join(launchAgentsDir, "ai.openclaw.ldm-backup.plist");
141
- const plist = `<?xml version="1.0" encoding="UTF-8"?>
142
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
143
- <plist version="1.0">
144
- <dict>
145
- <key>Label</key>
146
- <string>ai.openclaw.ldm-backup</string>
147
- <key>ProgramArguments</key>
148
- <array>
149
- <string>bash</string>
150
- <string>${scriptPath}</string>
151
- </array>
152
- <key>StartCalendarInterval</key>
153
- <dict>
154
- <key>Hour</key>
155
- <integer>3</integer>
156
- <key>Minute</key>
157
- <integer>0</integer>
158
- </dict>
159
- <key>StandardOutPath</key>
160
- <string>/tmp/ldm-dev-tools/ldm-backup.log</string>
161
- <key>StandardErrorPath</key>
162
- <string>/tmp/ldm-dev-tools/ldm-backup.log</string>
163
- </dict>
164
- </plist>`;
165
- writeFileSync(plistPath, plist);
166
- try {
167
- execSync(`launchctl unload ${plistPath} 2>/dev/null`);
168
- } catch {
169
- }
170
- execSync(`launchctl load ${plistPath}`);
171
- return plistPath;
172
- }
173
- var LEGACY_OC_DIR = join(HOME, ".openclaw");
174
- function resolveStatePath(filename) {
175
- const paths = ldmPaths();
176
- const ldmPath = join(paths.state, filename);
177
- if (existsSync(ldmPath)) return ldmPath;
178
- const legacyPath = join(LEGACY_OC_DIR, "memory", filename);
179
- if (existsSync(legacyPath)) return legacyPath;
180
- return ldmPath;
181
- }
182
- function stateWritePath(filename) {
183
- const paths = ldmPaths();
184
- const dir = paths.state;
185
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
186
- return join(dir, filename);
187
- }
188
- function resolveSecretPath(filename) {
189
- const paths = ldmPaths();
190
- const ldmPath = join(paths.secrets, filename);
191
- if (existsSync(ldmPath)) return ldmPath;
192
- const legacyPath = join(LEGACY_OC_DIR, "secrets", filename);
193
- if (existsSync(legacyPath)) return legacyPath;
194
- return ldmPath;
195
- }
196
- function ensureLdm(agentId) {
197
- const paths = ldmPaths(agentId);
198
- if (existsSync(paths.transcripts) && existsSync(paths.config)) {
199
- return paths;
200
- }
201
- return scaffoldLdm(agentId);
202
- }
203
-
204
- export {
205
- getAgentId,
206
- ldmPaths,
207
- scaffoldLdm,
208
- deployCaptureScript,
209
- installCron,
210
- removeCron,
211
- deployBackupScript,
212
- installBackupLaunchAgent,
213
- resolveStatePath,
214
- stateWritePath,
215
- resolveSecretPath,
216
- ensureLdm
217
- };