@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,19 +0,0 @@
1
- # Release Notes: Memory Crystal v0.7.5
2
-
3
- ## LDM OS Integration
4
-
5
- Memory Crystal now works with LDM OS when it's available.
6
-
7
- ### crystal init delegates to ldm install
8
-
9
- When the `ldm` CLI exists on PATH, `crystal init` delegates generic deployment to it. LDM OS handles the scaffold, interface detection, and extension deployment. Memory Crystal keeps its own setup: database backup, role configuration, pairing, cron jobs.
10
-
11
- When `ldm` isn't available, `crystal init` works standalone like it always has. No new dependencies. No breaking changes.
12
-
13
- ### LDM OS tip
14
-
15
- After install completes, Memory Crystal prints a tip: "Run `ldm install` to see more skills you can add." Helps users discover the rest of the ecosystem.
16
-
17
- ### Part of LDM OS
18
-
19
- README now includes a "Part of LDM OS" section linking back to the LDM OS repo. Memory Crystal installs into LDM OS, the local runtime for AI agents.
@@ -1,29 +0,0 @@
1
- # Release Notes: memory-crystal v0.7.30
2
-
3
- **Date:** 2026-03-30
4
-
5
- ## What changed
6
-
7
- ### Hardcoded path removal
8
-
9
- Two files had `/Users/lesa` hardcoded as a fallback path. Both now use portable alternatives.
10
-
11
- **migrate-lance-to-sqlite.mjs** had a fallback that resolved the OpenClaw workspace to `/Users/lesa/.openclaw`. The migration script now calls `os.homedir()` to build the path dynamically, so it works on any machine without assuming a specific username. This was the last remaining hardcoded path in the migration pipeline (#99).
12
-
13
- **dev-update.ts** (the ai/dev-updates scanner) had an iCloud path baked in for reading team documents. It now calls `resolveWorkspace()` to read the workspace root from LDM config (`~/.ldm/config.json`), making it portable across machines and user accounts (#98).
14
-
15
- ## Why
16
-
17
- These paths broke on any machine where the username is not `lesa`. Part of a broader audit across all LDM OS repos to eliminate hardcoded user paths and make everything portable.
18
-
19
- ## Issues closed
20
-
21
- - #98
22
- - #99
23
-
24
- ## How to verify
25
-
26
- ```bash
27
- grep -r "/Users/lesa" src/ scripts/ --include="*.ts" --include="*.mjs"
28
- # Should return zero results
29
- ```
package/dist/bridge.d.ts DELETED
@@ -1,7 +0,0 @@
1
- declare function isBridgeInstalled(): boolean;
2
- declare function isBridgeRegistered(): boolean;
3
- declare function isBridgeDesktopRegistered(): boolean;
4
- declare function registerBridgeMcp(): void;
5
- declare function registerBridgeDesktop(): boolean;
6
-
7
- export { isBridgeDesktopRegistered, isBridgeInstalled, isBridgeRegistered, registerBridgeDesktop, registerBridgeMcp };
package/dist/bridge.js DELETED
@@ -1,14 +0,0 @@
1
- import {
2
- isBridgeDesktopRegistered,
3
- isBridgeInstalled,
4
- isBridgeRegistered,
5
- registerBridgeDesktop,
6
- registerBridgeMcp
7
- } from "./chunk-AEWLSYPH.js";
8
- export {
9
- isBridgeDesktopRegistered,
10
- isBridgeInstalled,
11
- isBridgeRegistered,
12
- registerBridgeDesktop,
13
- registerBridgeMcp
14
- };
@@ -1,17 +0,0 @@
1
- interface BulkCopyResult {
2
- filesCopied: number;
3
- filesSkipped: number;
4
- bytesWritten: number;
5
- durationMs: number;
6
- }
7
- interface BulkCopyOptions {
8
- workspace?: boolean;
9
- workspaceSrc?: string;
10
- }
11
- /** Copy session JSONL files from source locations to LDM transcripts.
12
- * sessionPaths: array of absolute paths to JSONL files.
13
- * agentId: target agent in ~/.ldm/agents/{agentId}/.
14
- * Returns copy stats. */
15
- declare function bulkCopyToLdm(sessionPaths: string[], agentId: string, options?: BulkCopyOptions): BulkCopyResult;
16
-
17
- export { type BulkCopyOptions, type BulkCopyResult, bulkCopyToLdm };
package/dist/bulk-copy.js DELETED
@@ -1,90 +0,0 @@
1
- import {
2
- ldmPaths
3
- } from "./chunk-EXEZZADG.js";
4
-
5
- // src/bulk-copy.ts
6
- import { existsSync, mkdirSync, copyFileSync, statSync, readdirSync } from "fs";
7
- import { join, basename } from "path";
8
- function bulkCopyToLdm(sessionPaths, agentId, options) {
9
- const start = Date.now();
10
- const paths = ldmPaths(agentId);
11
- let filesCopied = 0;
12
- let filesSkipped = 0;
13
- let bytesWritten = 0;
14
- mkdirSync(paths.transcripts, { recursive: true });
15
- for (const srcPath of sessionPaths) {
16
- const destPath = join(paths.transcripts, basename(srcPath));
17
- if (existsSync(destPath)) {
18
- try {
19
- const srcSize = statSync(srcPath).size;
20
- const destSize = statSync(destPath).size;
21
- if (srcSize === destSize) {
22
- filesSkipped++;
23
- continue;
24
- }
25
- } catch {
26
- }
27
- }
28
- try {
29
- copyFileSync(srcPath, destPath);
30
- bytesWritten += statSync(destPath).size;
31
- filesCopied++;
32
- } catch {
33
- }
34
- }
35
- if (options?.workspace && options.workspaceSrc) {
36
- mkdirSync(paths.workspace, { recursive: true });
37
- const wsResult = copyWorkspaceRecursive(options.workspaceSrc, paths.workspace);
38
- filesCopied += wsResult.copied;
39
- filesSkipped += wsResult.skipped;
40
- bytesWritten += wsResult.bytes;
41
- }
42
- return {
43
- filesCopied,
44
- filesSkipped,
45
- bytesWritten,
46
- durationMs: Date.now() - start
47
- };
48
- }
49
- function copyWorkspaceRecursive(srcDir, destDir) {
50
- let copied = 0;
51
- let skipped = 0;
52
- let bytes = 0;
53
- try {
54
- for (const entry of readdirSync(srcDir)) {
55
- if (entry.startsWith(".")) continue;
56
- const srcPath = join(srcDir, entry);
57
- const destPath = join(destDir, entry);
58
- try {
59
- const stat = statSync(srcPath);
60
- if (stat.isDirectory()) {
61
- mkdirSync(destPath, { recursive: true });
62
- const sub = copyWorkspaceRecursive(srcPath, destPath);
63
- copied += sub.copied;
64
- skipped += sub.skipped;
65
- bytes += sub.bytes;
66
- } else if (entry.endsWith(".md")) {
67
- if (existsSync(destPath)) {
68
- try {
69
- if (stat.size === statSync(destPath).size) {
70
- skipped++;
71
- continue;
72
- }
73
- } catch {
74
- }
75
- }
76
- copyFileSync(srcPath, destPath);
77
- bytes += stat.size;
78
- copied++;
79
- }
80
- } catch {
81
- continue;
82
- }
83
- }
84
- } catch {
85
- }
86
- return { copied, skipped, bytes };
87
- }
88
- export {
89
- bulkCopyToLdm
90
- };
package/dist/cc-hook.d.ts DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- declare function sendCommand(command: {
3
- action: string;
4
- agent_id?: string;
5
- mode?: string;
6
- }): Promise<void>;
7
-
8
- export { sendCommand };
package/dist/cc-hook.js DELETED
@@ -1,368 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- createCrystal,
4
- resolveConfig
5
- } from "./chunk-FBQWSDPC.js";
6
- import {
7
- encryptJSON,
8
- loadRelayKey
9
- } from "./chunk-KCQUXVYT.js";
10
- import {
11
- ensureLdm,
12
- getAgentId,
13
- ldmPaths,
14
- resolveStatePath,
15
- stateWritePath
16
- } from "./chunk-EXEZZADG.js";
17
-
18
- // src/cc-hook.ts
19
- import {
20
- readFileSync,
21
- writeFileSync,
22
- appendFileSync,
23
- existsSync,
24
- mkdirSync,
25
- statSync,
26
- openSync,
27
- readSync,
28
- closeSync,
29
- copyFileSync
30
- } from "fs";
31
- import { join, basename } from "path";
32
- var CC_AGENT_ID = getAgentId("claude-code");
33
- var RELAY_URL = process.env.CRYSTAL_RELAY_URL || "";
34
- var RELAY_TOKEN = process.env.CRYSTAL_RELAY_TOKEN || "";
35
- var PRIVATE_MODE_PATH = resolveStatePath("memory-capture-state.json");
36
- var WATERMARK_PATH = resolveStatePath("cc-capture-watermark.json");
37
- var CC_ENABLED_PATH = resolveStatePath("cc-capture-enabled.json");
38
- function getCaptureMode() {
39
- if (RELAY_URL && RELAY_TOKEN) return "relay";
40
- return "local";
41
- }
42
- function isPrivateMode() {
43
- try {
44
- if (existsSync(PRIVATE_MODE_PATH)) {
45
- const state = JSON.parse(readFileSync(PRIVATE_MODE_PATH, "utf-8"));
46
- return state.enabled === false;
47
- }
48
- } catch {
49
- }
50
- return false;
51
- }
52
- function isCaptureEnabled() {
53
- try {
54
- if (existsSync(CC_ENABLED_PATH)) {
55
- const state = JSON.parse(readFileSync(CC_ENABLED_PATH, "utf-8"));
56
- return state.enabled !== false;
57
- }
58
- } catch {
59
- }
60
- return true;
61
- }
62
- function setCaptureEnabled(enabled) {
63
- const writePath = stateWritePath("cc-capture-enabled.json");
64
- writeFileSync(writePath, JSON.stringify({
65
- enabled,
66
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
67
- }, null, 2));
68
- }
69
- function loadWatermark() {
70
- try {
71
- if (existsSync(WATERMARK_PATH)) {
72
- return JSON.parse(readFileSync(WATERMARK_PATH, "utf-8"));
73
- }
74
- } catch {
75
- }
76
- return { files: {}, lastRun: null };
77
- }
78
- function saveWatermark(wm) {
79
- const writePath = stateWritePath("cc-capture-watermark.json");
80
- wm.lastRun = (/* @__PURE__ */ new Date()).toISOString();
81
- writeFileSync(writePath, JSON.stringify(wm, null, 2));
82
- }
83
- function extractMessages(filePath, lastByteOffset) {
84
- const fileSize = statSync(filePath).size;
85
- if (lastByteOffset >= fileSize) {
86
- return { messages: [], newByteOffset: fileSize };
87
- }
88
- const fd = openSync(filePath, "r");
89
- const bufSize = fileSize - lastByteOffset;
90
- const buf = Buffer.alloc(bufSize);
91
- readSync(fd, buf, 0, bufSize, lastByteOffset);
92
- closeSync(fd);
93
- const lines = buf.toString("utf-8").split("\n").filter(Boolean);
94
- const messages = [];
95
- for (const line of lines) {
96
- try {
97
- const obj = JSON.parse(line);
98
- if (obj.type !== "user" && obj.type !== "assistant") continue;
99
- const msg = obj.message;
100
- if (!msg) continue;
101
- let text = "";
102
- if (typeof msg.content === "string") {
103
- text = msg.content;
104
- } else if (Array.isArray(msg.content)) {
105
- const parts = [];
106
- for (const block of msg.content) {
107
- if (block.type === "text" && block.text) parts.push(block.text);
108
- if (block.type === "thinking" && block.thinking) parts.push(`[thinking] ${block.thinking}`);
109
- }
110
- text = parts.join("\n\n");
111
- }
112
- if (text.length < 20) continue;
113
- messages.push({
114
- role: msg.role || obj.type,
115
- text,
116
- timestamp: obj.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
117
- sessionId: obj.sessionId || "unknown"
118
- });
119
- } catch {
120
- }
121
- }
122
- return { messages, newByteOffset: fileSize };
123
- }
124
- function archiveTranscript(transcriptPath, agentId) {
125
- try {
126
- if (isPrivateMode()) return;
127
- const paths = ensureLdm(agentId);
128
- const dest = join(paths.transcripts, basename(transcriptPath));
129
- if (existsSync(dest)) {
130
- const srcMtime = statSync(transcriptPath).mtimeMs;
131
- const dstMtime = statSync(dest).mtimeMs;
132
- if (srcMtime <= dstMtime) return;
133
- }
134
- copyFileSync(transcriptPath, dest);
135
- } catch {
136
- }
137
- }
138
- function appendDailyLog(messages, agentId) {
139
- try {
140
- const paths = ldmPaths(agentId);
141
- if (!existsSync(paths.root)) return;
142
- if (!existsSync(paths.daily)) mkdirSync(paths.daily, { recursive: true });
143
- const now = /* @__PURE__ */ new Date();
144
- const dateStr = now.toISOString().slice(0, 10);
145
- const timeStr = now.toLocaleTimeString("en-US", {
146
- hour: "2-digit",
147
- minute: "2-digit",
148
- hour12: false,
149
- timeZone: "America/Los_Angeles"
150
- });
151
- const logPath = join(paths.daily, `${dateStr}.md`);
152
- const userMsg = messages.find((m) => m.role === "user");
153
- if (!userMsg) return;
154
- const snippet = userMsg.text.slice(0, 120).replace(/\n/g, " ").trim();
155
- const line = `- **${timeStr}** ${snippet}${userMsg.text.length > 120 ? "..." : ""}
156
- `;
157
- if (!existsSync(logPath)) {
158
- writeFileSync(logPath, `# ${dateStr} - CC Daily Log
159
-
160
- `);
161
- }
162
- appendFileSync(logPath, line);
163
- } catch {
164
- }
165
- }
166
- async function dropAtRelay(messages) {
167
- const relayKey = loadRelayKey();
168
- const payload = {
169
- agent_id: CC_AGENT_ID,
170
- dropped_at: (/* @__PURE__ */ new Date()).toISOString(),
171
- messages: messages.map((m) => ({
172
- text: m.text,
173
- role: m.role,
174
- timestamp: m.timestamp,
175
- sessionId: m.sessionId
176
- }))
177
- };
178
- const encrypted = encryptJSON(payload, relayKey);
179
- const body = JSON.stringify(encrypted);
180
- let retries = 0;
181
- while (retries < 4) {
182
- try {
183
- const resp = await fetch(`${RELAY_URL}/drop/conversations`, {
184
- method: "POST",
185
- headers: {
186
- "Authorization": `Bearer ${RELAY_TOKEN}`,
187
- "Content-Type": "application/octet-stream"
188
- },
189
- body
190
- });
191
- if (!resp.ok) {
192
- const err = await resp.text();
193
- throw new Error(`Relay drop failed: ${resp.status} ${err}`);
194
- }
195
- const result = await resp.json();
196
- return messages.length;
197
- } catch (err) {
198
- retries++;
199
- if (retries >= 4) throw err;
200
- const delay = Math.min(1e3 * 2 ** retries, 3e4);
201
- process.stderr.write(` [relay retry ${retries}] ${err.message}, waiting ${delay}ms
202
- `);
203
- await new Promise((r) => setTimeout(r, delay));
204
- }
205
- }
206
- return 0;
207
- }
208
- async function sendCommand(command) {
209
- if (!RELAY_URL || !RELAY_TOKEN) {
210
- throw new Error("Relay not configured. Set CRYSTAL_RELAY_URL and CRYSTAL_RELAY_TOKEN.");
211
- }
212
- const relayKey = loadRelayKey();
213
- const payload = {
214
- ...command,
215
- from_agent: CC_AGENT_ID,
216
- sent_at: (/* @__PURE__ */ new Date()).toISOString()
217
- };
218
- const encrypted = encryptJSON(payload, relayKey);
219
- const body = JSON.stringify(encrypted);
220
- const resp = await fetch(`${RELAY_URL}/drop/commands`, {
221
- method: "POST",
222
- headers: {
223
- "Authorization": `Bearer ${RELAY_TOKEN}`,
224
- "Content-Type": "application/octet-stream"
225
- },
226
- body
227
- });
228
- if (!resp.ok) {
229
- throw new Error(`Command relay failed: ${resp.status} ${await resp.text()}`);
230
- }
231
- }
232
- var BATCH_SIZE = 200;
233
- async function ingestLocal(messages) {
234
- const config = resolveConfig();
235
- const crystal = createCrystal(config);
236
- await crystal.init();
237
- const maxSingleChunkChars = 2e3 * 4;
238
- const chunks = [];
239
- for (const msg of messages) {
240
- if (msg.text.length <= maxSingleChunkChars) {
241
- chunks.push({
242
- text: msg.text,
243
- role: msg.role,
244
- source_type: "conversation",
245
- source_id: `cc:${msg.sessionId}`,
246
- agent_id: CC_AGENT_ID,
247
- token_count: Math.ceil(msg.text.length / 4),
248
- created_at: msg.timestamp
249
- });
250
- } else {
251
- for (const ct of crystal.chunkText(msg.text)) {
252
- chunks.push({
253
- text: ct,
254
- role: msg.role,
255
- source_type: "conversation",
256
- source_id: `cc:${msg.sessionId}`,
257
- agent_id: CC_AGENT_ID,
258
- token_count: Math.ceil(ct.length / 4),
259
- created_at: msg.timestamp
260
- });
261
- }
262
- }
263
- }
264
- let total = 0;
265
- for (let i = 0; i < chunks.length; i += BATCH_SIZE) {
266
- const batch = chunks.slice(i, i + BATCH_SIZE);
267
- let retries = 0;
268
- while (retries < 4) {
269
- try {
270
- total += await crystal.ingest(batch);
271
- break;
272
- } catch (err) {
273
- retries++;
274
- if (retries >= 4) throw err;
275
- const delay = Math.min(1e3 * 2 ** retries, 3e4);
276
- process.stderr.write(` [retry ${retries}] ${err.message}, waiting ${delay}ms
277
- `);
278
- await new Promise((r) => setTimeout(r, delay));
279
- }
280
- }
281
- }
282
- return total;
283
- }
284
- var args = process.argv.slice(2);
285
- if (args.includes("--on")) {
286
- setCaptureEnabled(true);
287
- console.log("(*) Claude Code memory capture ON");
288
- process.exit(0);
289
- }
290
- if (args.includes("--off")) {
291
- setCaptureEnabled(false);
292
- console.log("( ) Claude Code memory capture OFF");
293
- process.exit(0);
294
- }
295
- if (args.includes("--status")) {
296
- const mode = getCaptureMode();
297
- console.log(isCaptureEnabled() ? "(*) CC capture: ON" : "( ) CC capture: OFF");
298
- console.log(isPrivateMode() ? "( ) Private mode: ON (blocks all capture)" : "(*) Private mode: OFF");
299
- console.log(` Mode: ${mode}${mode === "relay" ? ` (${RELAY_URL})` : ""}`);
300
- console.log(` Agent ID: ${CC_AGENT_ID}`);
301
- process.exit(0);
302
- }
303
- async function main() {
304
- let input = "";
305
- for await (const chunk of process.stdin) {
306
- input += chunk;
307
- }
308
- let hookData;
309
- try {
310
- hookData = JSON.parse(input);
311
- } catch {
312
- process.exit(0);
313
- }
314
- const transcriptPath = hookData.transcript_path;
315
- if (!transcriptPath || !existsSync(transcriptPath)) process.exit(0);
316
- if (isPrivateMode() || !isCaptureEnabled()) process.exit(0);
317
- archiveTranscript(transcriptPath);
318
- const wm = loadWatermark();
319
- const fileKey = transcriptPath;
320
- if (!wm.files[fileKey]) {
321
- wm.files[fileKey] = { lastByteOffset: 0, lastTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
322
- }
323
- const lastOffset = wm.files[fileKey].lastByteOffset || 0;
324
- const { messages, newByteOffset } = extractMessages(transcriptPath, lastOffset);
325
- if (messages.length === 0) {
326
- wm.files[fileKey] = { lastByteOffset: newByteOffset, lastTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
327
- saveWatermark(wm);
328
- process.exit(0);
329
- }
330
- const totalTokens = messages.reduce((sum, m) => sum + Math.ceil(m.text.length / 4), 0);
331
- if (totalTokens < 100) {
332
- wm.files[fileKey] = { lastByteOffset: newByteOffset, lastTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
333
- saveWatermark(wm);
334
- process.exit(0);
335
- }
336
- const mode = getCaptureMode();
337
- try {
338
- if (mode === "relay") {
339
- const count = await dropAtRelay(messages);
340
- process.stderr.write(`[cc-memory-capture] relayed ${count} messages (${totalTokens} tokens) from ${basename(transcriptPath)}
341
- `);
342
- } else {
343
- const count = await ingestLocal(messages);
344
- process.stderr.write(`[cc-memory-capture] ${count} chunks (${totalTokens} tokens) from ${basename(transcriptPath)}
345
- `);
346
- }
347
- wm.files[fileKey] = { lastByteOffset: newByteOffset, lastTimestamp: (/* @__PURE__ */ new Date()).toISOString() };
348
- saveWatermark(wm);
349
- appendDailyLog(messages);
350
- try {
351
- const { generateSessionSummary, writeSummaryFile } = await import("./summarize.js");
352
- const paths = ldmPaths();
353
- const summaryMsgs = messages.map((m) => ({ role: m.role, text: m.text, timestamp: m.timestamp, sessionId: m.sessionId }));
354
- const summary = await generateSessionSummary(summaryMsgs);
355
- const sessionId = messages[0]?.sessionId || "unknown";
356
- writeSummaryFile(paths.sessions, summary, CC_AGENT_ID, sessionId);
357
- } catch {
358
- }
359
- } catch (err) {
360
- process.stderr.write(`[cc-memory-capture] error: ${err.message}
361
- `);
362
- process.exit(1);
363
- }
364
- }
365
- main();
366
- export {
367
- sendCommand
368
- };
@@ -1 +0,0 @@
1
- #!/usr/bin/env node