@wipcomputer/memory-crystal 0.7.32 → 0.7.34-alpha.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 (155) hide show
  1. package/SKILL.md +1 -1
  2. package/cloud/wrangler.toml +30 -0
  3. package/dist/bridge.d.ts +7 -0
  4. package/dist/bridge.js +14 -0
  5. package/dist/bulk-copy.d.ts +17 -0
  6. package/dist/bulk-copy.js +90 -0
  7. package/dist/cc-hook.d.ts +8 -0
  8. package/dist/cc-hook.js +368 -0
  9. package/dist/cc-poller.d.ts +1 -0
  10. package/dist/cc-poller.js +550 -0
  11. package/dist/chunk-25LXQJ4Z.js +110 -0
  12. package/dist/chunk-2DRXIRQW.js +97 -0
  13. package/dist/chunk-2GBYLMEF.js +1385 -0
  14. package/dist/chunk-2ZNH5F6E.js +1281 -0
  15. package/dist/chunk-3G3SFYYI.js +288 -0
  16. package/dist/chunk-3RG5ZIWI.js +10 -0
  17. package/dist/chunk-3S6TI23B.js +97 -0
  18. package/dist/chunk-3VFIJYS4.js +818 -0
  19. package/dist/chunk-437F27T6.js +97 -0
  20. package/dist/chunk-52QE3YI3.js +1169 -0
  21. package/dist/chunk-57RP3DIN.js +1205 -0
  22. package/dist/chunk-5HSZ4W2P.js +62 -0
  23. package/dist/chunk-5I7GMRDN.js +146 -0
  24. package/dist/chunk-645IPXW3.js +290 -0
  25. package/dist/chunk-7A7ELD4C.js +1205 -0
  26. package/dist/chunk-7FYY4GZM.js +1205 -0
  27. package/dist/chunk-7IUE7ODU.js +254 -0
  28. package/dist/chunk-7RMLKZIS.js +108 -0
  29. package/dist/chunk-AA3OPP4Z.js +432 -0
  30. package/dist/chunk-AEWLSYPH.js +72 -0
  31. package/dist/chunk-ASSZDR6I.js +108 -0
  32. package/dist/chunk-AYRJVWUC.js +1205 -0
  33. package/dist/chunk-CCYI5O3D.js +148 -0
  34. package/dist/chunk-CGIDSAJB.js +288 -0
  35. package/dist/chunk-D3I3ZSE2.js +411 -0
  36. package/dist/chunk-D3MACYZ4.js +108 -0
  37. package/dist/chunk-DACSKLY6.js +219 -0
  38. package/dist/chunk-DFQ72B7M.js +248 -0
  39. package/dist/chunk-DW5B4BL7.js +108 -0
  40. package/dist/chunk-EKSACBTJ.js +1070 -0
  41. package/dist/chunk-EXEZZADG.js +248 -0
  42. package/dist/chunk-F3Y7EL7K.js +83 -0
  43. package/dist/chunk-FBQWSDPC.js +1328 -0
  44. package/dist/chunk-FHRZNOMW.js +1205 -0
  45. package/dist/chunk-IM7N24MT.js +129 -0
  46. package/dist/chunk-IPNYIXFK.js +1178 -0
  47. package/dist/chunk-J7MRSZIO.js +167 -0
  48. package/dist/chunk-JITKI2OI.js +106 -0
  49. package/dist/chunk-JWZXYVET.js +1068 -0
  50. package/dist/chunk-KCQUXVYT.js +108 -0
  51. package/dist/chunk-KOQ43OX6.js +1281 -0
  52. package/dist/chunk-KYVWO6ZM.js +1069 -0
  53. package/dist/chunk-L3VHARQH.js +413 -0
  54. package/dist/chunk-LBWDS6BE.js +288 -0
  55. package/dist/chunk-LOVAHSQV.js +411 -0
  56. package/dist/chunk-LQOYCAGG.js +446 -0
  57. package/dist/chunk-LWAIPJ2W.js +146 -0
  58. package/dist/chunk-M5DHKW7M.js +127 -0
  59. package/dist/chunk-MBKCIJHM.js +1328 -0
  60. package/dist/chunk-MK42FMEG.js +147 -0
  61. package/dist/chunk-MOBMYHKL.js +1205 -0
  62. package/dist/chunk-MPLTNMRG.js +67 -0
  63. package/dist/chunk-NIJCVN3O.js +147 -0
  64. package/dist/chunk-NX647OM3.js +310 -0
  65. package/dist/chunk-NZCFSZQ7.js +1205 -0
  66. package/dist/chunk-O2UITJGH.js +465 -0
  67. package/dist/chunk-OCRA44AZ.js +108 -0
  68. package/dist/chunk-P3KJR66H.js +117 -0
  69. package/dist/chunk-PEK6JH65.js +432 -0
  70. package/dist/chunk-PJ6FFKEX.js +77 -0
  71. package/dist/chunk-PLUBBZYR.js +800 -0
  72. package/dist/chunk-PNKVD2UK.js +26 -0
  73. package/dist/chunk-PSQZURHO.js +229 -0
  74. package/dist/chunk-SGL6ISBJ.js +1061 -0
  75. package/dist/chunk-SJABZZT5.js +97 -0
  76. package/dist/chunk-TD3P3K32.js +1199 -0
  77. package/dist/chunk-TMDZJJKV.js +288 -0
  78. package/dist/chunk-UNHVZB5G.js +411 -0
  79. package/dist/chunk-VAFTWSTE.js +1061 -0
  80. package/dist/chunk-VNFXFQBB.js +217 -0
  81. package/dist/chunk-X3GVFKSJ.js +1205 -0
  82. package/dist/chunk-XZ3S56RQ.js +1061 -0
  83. package/dist/chunk-Y72C7F6O.js +148 -0
  84. package/dist/chunk-YLICP577.js +1205 -0
  85. package/dist/chunk-YX6AXLVK.js +159 -0
  86. package/dist/chunk-ZCQYHTNU.js +146 -0
  87. package/dist/cli.d.ts +1 -0
  88. package/dist/cli.js +1160 -0
  89. package/dist/cloud-crystal.js +6 -0
  90. package/dist/core.d.ts +252 -0
  91. package/dist/core.js +12 -0
  92. package/dist/crypto.d.ts +20 -0
  93. package/dist/crypto.js +27 -0
  94. package/dist/crystal-capture.sh +29 -0
  95. package/dist/crystal-serve.d.ts +4 -0
  96. package/dist/crystal-serve.js +252 -0
  97. package/dist/dev-update-SZ2Z4WCQ.js +6 -0
  98. package/dist/discover.d.ts +30 -0
  99. package/dist/discover.js +177 -0
  100. package/dist/doctor.d.ts +9 -0
  101. package/dist/doctor.js +342 -0
  102. package/dist/dream-weaver.d.ts +8 -0
  103. package/dist/dream-weaver.js +56 -0
  104. package/dist/file-sync.d.ts +48 -0
  105. package/dist/file-sync.js +18 -0
  106. package/dist/installer.d.ts +61 -0
  107. package/dist/installer.js +772 -0
  108. package/dist/ldm-backup.sh +116 -0
  109. package/dist/ldm.d.ts +50 -0
  110. package/dist/ldm.js +32 -0
  111. package/dist/llm-XXLYPIOF.js +16 -0
  112. package/dist/mcp-server.d.ts +1 -0
  113. package/dist/mcp-server.js +277 -0
  114. package/dist/migrate.d.ts +1 -0
  115. package/dist/migrate.js +89 -0
  116. package/dist/mirror-sync.d.ts +1 -0
  117. package/dist/mirror-sync.js +159 -0
  118. package/dist/mlx-setup-XKU67WCT.js +289 -0
  119. package/dist/oc-backfill.d.ts +19 -0
  120. package/dist/oc-backfill.js +74 -0
  121. package/dist/openclaw.d.ts +5 -0
  122. package/dist/openclaw.js +434 -0
  123. package/dist/pair.d.ts +4 -0
  124. package/dist/pair.js +75 -0
  125. package/dist/poller.d.ts +1 -0
  126. package/dist/poller.js +634 -0
  127. package/dist/role.d.ts +24 -0
  128. package/dist/role.js +13 -0
  129. package/dist/search-pipeline-4K4OJSSS.js +255 -0
  130. package/dist/search-pipeline-4PRS6LI7.js +280 -0
  131. package/dist/search-pipeline-7UJMXPLO.js +280 -0
  132. package/dist/search-pipeline-CBV25NX7.js +99 -0
  133. package/dist/search-pipeline-DQTRLGBH.js +74 -0
  134. package/dist/search-pipeline-HNG37REH.js +282 -0
  135. package/dist/search-pipeline-IZFPLBUB.js +280 -0
  136. package/dist/search-pipeline-MID6F26Q.js +73 -0
  137. package/dist/search-pipeline-N52JZFNN.js +282 -0
  138. package/dist/search-pipeline-OPB2PRQQ.js +280 -0
  139. package/dist/search-pipeline-VXTE5HAD.js +262 -0
  140. package/dist/search-pipeline-XHFKADRG.js +73 -0
  141. package/dist/staging.d.ts +29 -0
  142. package/dist/staging.js +21 -0
  143. package/dist/summarize.d.ts +19 -0
  144. package/dist/summarize.js +10 -0
  145. package/dist/worker-demo.js +186 -0
  146. package/dist/worker-mcp.js +404 -0
  147. package/dist/worker.js +137 -0
  148. package/package.json +15 -1
  149. package/.env.example +0 -20
  150. package/.publish-skill.json +0 -1
  151. package/CHANGELOG.md +0 -1372
  152. package/README-ENTERPRISE.md +0 -226
  153. package/RELAY.md +0 -199
  154. package/wrangler-demo.toml +0 -8
  155. package/wrangler-mcp.toml +0 -24
@@ -0,0 +1,127 @@
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
+ config: join(LDM_ROOT, "config.json"),
18
+ crystalDb: join(LDM_ROOT, "memory", "crystal.db"),
19
+ crystalLance: join(LDM_ROOT, "memory", "lance"),
20
+ agentRoot,
21
+ transcripts: join(agentRoot, "memory", "transcripts"),
22
+ sessions: join(agentRoot, "memory", "sessions"),
23
+ daily: join(agentRoot, "memory", "daily"),
24
+ journals: join(agentRoot, "memory", "journals")
25
+ };
26
+ }
27
+ function loadConfig() {
28
+ const configPath = join(LDM_ROOT, "config.json");
29
+ try {
30
+ if (existsSync(configPath)) {
31
+ return JSON.parse(readFileSync(configPath, "utf-8"));
32
+ }
33
+ } catch {
34
+ }
35
+ return null;
36
+ }
37
+ function saveConfig(config) {
38
+ const configPath = join(LDM_ROOT, "config.json");
39
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
40
+ }
41
+ function scaffoldLdm(agentId) {
42
+ const paths = ldmPaths(agentId);
43
+ mkdirSync(join(paths.root, "memory"), { recursive: true });
44
+ mkdirSync(paths.crystalLance, { recursive: true });
45
+ mkdirSync(paths.bin, { recursive: true });
46
+ mkdirSync(paths.transcripts, { recursive: true });
47
+ mkdirSync(paths.sessions, { recursive: true });
48
+ mkdirSync(paths.daily, { recursive: true });
49
+ mkdirSync(paths.journals, { recursive: true });
50
+ const id = agentId || getAgentId();
51
+ let config = loadConfig();
52
+ if (!config) {
53
+ config = {
54
+ version: "1.0.0",
55
+ agents: [id],
56
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
57
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
58
+ };
59
+ } else {
60
+ if (!config.agents.includes(id)) {
61
+ config.agents.push(id);
62
+ }
63
+ config.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
64
+ }
65
+ saveConfig(config);
66
+ return paths;
67
+ }
68
+ function deployCaptureScript() {
69
+ const paths = ldmPaths();
70
+ mkdirSync(paths.bin, { recursive: true });
71
+ const thisDir = dirname(fileURLToPath(import.meta.url));
72
+ let scriptSrc = join(thisDir, "crystal-capture.sh");
73
+ if (!existsSync(scriptSrc)) {
74
+ scriptSrc = join(thisDir, "..", "scripts", "crystal-capture.sh");
75
+ }
76
+ const scriptDest = join(paths.bin, "crystal-capture.sh");
77
+ if (!existsSync(scriptSrc)) {
78
+ throw new Error(`crystal-capture.sh not found at ${scriptSrc}`);
79
+ }
80
+ copyFileSync(scriptSrc, scriptDest);
81
+ chmodSync(scriptDest, 493);
82
+ return scriptDest;
83
+ }
84
+ var CRON_TAG = "# crystal-capture";
85
+ var CRON_ENTRY = "* * * * * ~/.ldm/bin/crystal-capture.sh >> /tmp/ldm-dev-tools/crystal-capture.log 2>&1";
86
+ function installCron() {
87
+ let existing = "";
88
+ try {
89
+ existing = execSync("crontab -l 2>/dev/null", { encoding: "utf8" });
90
+ } catch {
91
+ }
92
+ const lines = existing.split("\n").filter(
93
+ (line) => !line.includes("crystal-capture") || line.includes("# Daily") || line.includes("# Branch") || line.includes("# Verify")
94
+ );
95
+ lines.push(CRON_TAG);
96
+ lines.push(CRON_ENTRY);
97
+ const newCrontab = lines.filter((l, i, arr) => !(l === "" && i === arr.length - 1)).join("\n") + "\n";
98
+ execSync("crontab -", { input: newCrontab, encoding: "utf8" });
99
+ }
100
+ function removeCron() {
101
+ let existing = "";
102
+ try {
103
+ existing = execSync("crontab -l 2>/dev/null", { encoding: "utf8" });
104
+ } catch {
105
+ return;
106
+ }
107
+ const lines = existing.split("\n").filter((line) => !line.includes("crystal-capture"));
108
+ const newCrontab = lines.join("\n");
109
+ execSync("crontab -", { input: newCrontab, encoding: "utf8" });
110
+ }
111
+ function ensureLdm(agentId) {
112
+ const paths = ldmPaths(agentId);
113
+ if (existsSync(paths.transcripts) && existsSync(paths.config)) {
114
+ return paths;
115
+ }
116
+ return scaffoldLdm(agentId);
117
+ }
118
+
119
+ export {
120
+ getAgentId,
121
+ ldmPaths,
122
+ scaffoldLdm,
123
+ deployCaptureScript,
124
+ installCron,
125
+ removeCron,
126
+ ensureLdm
127
+ };