@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,159 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- pullFileSync
4
- } from "./chunk-3G3SFYYI.js";
5
- import {
6
- Crystal,
7
- resolveConfig
8
- } from "./chunk-FBQWSDPC.js";
9
- import {
10
- decryptJSON,
11
- loadRelayKey
12
- } from "./chunk-KCQUXVYT.js";
13
- import {
14
- ldmPaths,
15
- resolveStatePath,
16
- stateWritePath
17
- } from "./chunk-EXEZZADG.js";
18
-
19
- // src/mirror-sync.ts
20
- import { readFileSync, writeFileSync, existsSync } from "fs";
21
- var RELAY_URL = process.env.CRYSTAL_RELAY_URL || "";
22
- var RELAY_TOKEN = process.env.CRYSTAL_RELAY_TOKEN || "";
23
- var _ldmPaths = ldmPaths();
24
- var MIRROR_STATE_PATH = resolveStatePath("mirror-sync-state.json");
25
- function loadState() {
26
- try {
27
- if (existsSync(MIRROR_STATE_PATH)) {
28
- const state = JSON.parse(readFileSync(MIRROR_STATE_PATH, "utf-8"));
29
- return {
30
- lastSync: state.lastSync || null,
31
- lastHash: state.lastHash || null,
32
- lastSize: state.lastSize || null,
33
- lastDeltaChunkId: state.lastDeltaChunkId || 0,
34
- totalImported: state.totalImported || 0
35
- };
36
- }
37
- } catch {
38
- }
39
- return { lastSync: null, lastHash: null, lastSize: null, lastDeltaChunkId: 0, totalImported: 0 };
40
- }
41
- function saveState(state) {
42
- const writePath = stateWritePath("mirror-sync-state.json");
43
- writeFileSync(writePath, JSON.stringify(state, null, 2));
44
- }
45
- async function pullDelta(force2) {
46
- if (!RELAY_URL || !RELAY_TOKEN) {
47
- throw new Error("CRYSTAL_RELAY_URL and CRYSTAL_RELAY_TOKEN must be set");
48
- }
49
- const relayKey = loadRelayKey();
50
- const listResp = await fetch(`${RELAY_URL}/pickup/mirror`, {
51
- headers: { "Authorization": `Bearer ${RELAY_TOKEN}` }
52
- });
53
- if (!listResp.ok) {
54
- throw new Error(`Relay list failed: ${listResp.status} ${await listResp.text()}`);
55
- }
56
- const listData = await listResp.json();
57
- if (listData.count === 0) {
58
- process.stderr.write("[mirror-sync] no delta available\n");
59
- return false;
60
- }
61
- const config = resolveConfig();
62
- const crystal = new Crystal(config);
63
- await crystal.init();
64
- const state = loadState();
65
- let totalImported = 0;
66
- for (const blob of listData.blobs) {
67
- try {
68
- const blobResp = await fetch(`${RELAY_URL}/pickup/mirror/${blob.id}`, {
69
- headers: { "Authorization": `Bearer ${RELAY_TOKEN}` }
70
- });
71
- if (!blobResp.ok) {
72
- process.stderr.write(`[mirror-sync] failed to fetch blob ${blob.id}: ${blobResp.status}
73
- `);
74
- continue;
75
- }
76
- const encryptedText = await blobResp.text();
77
- const encrypted = JSON.parse(encryptedText);
78
- let delta;
79
- try {
80
- delta = decryptJSON(encrypted, relayKey);
81
- } catch (err) {
82
- process.stderr.write(`[mirror-sync] blob ${blob.id} failed verification: ${err.message} \u2014 DISCARDED
83
- `);
84
- await fetch(`${RELAY_URL}/confirm/mirror/${blob.id}`, {
85
- method: "DELETE",
86
- headers: { "Authorization": `Bearer ${RELAY_TOKEN}` }
87
- });
88
- continue;
89
- }
90
- if (!force2 && delta.maxId <= state.lastDeltaChunkId) {
91
- process.stderr.write(`[mirror-sync] blob ${blob.id} already applied (maxId ${delta.maxId} <= watermark ${state.lastDeltaChunkId})
92
- `);
93
- await fetch(`${RELAY_URL}/confirm/mirror/${blob.id}`, {
94
- method: "DELETE",
95
- headers: { "Authorization": `Bearer ${RELAY_TOKEN}` }
96
- });
97
- continue;
98
- }
99
- const imported = crystal.importChunks(delta.chunks);
100
- totalImported += imported;
101
- if (delta.maxId > state.lastDeltaChunkId) {
102
- state.lastDeltaChunkId = delta.maxId;
103
- }
104
- process.stderr.write(
105
- `[mirror-sync] blob ${blob.id}: ${imported}/${delta.chunkCount} chunks imported (ID ${delta.sinceId + 1}..${delta.maxId}), pushed=${delta.pushedAt}
106
- `
107
- );
108
- await fetch(`${RELAY_URL}/confirm/mirror/${blob.id}`, {
109
- method: "DELETE",
110
- headers: { "Authorization": `Bearer ${RELAY_TOKEN}` }
111
- });
112
- } catch (err) {
113
- process.stderr.write(`[mirror-sync] error processing blob ${blob.id}: ${err.message}
114
- `);
115
- }
116
- }
117
- state.lastSync = (/* @__PURE__ */ new Date()).toISOString();
118
- state.totalImported += totalImported;
119
- saveState(state);
120
- if (totalImported > 0) {
121
- process.stderr.write(`[mirror-sync] done: ${totalImported} chunks imported, watermark=${state.lastDeltaChunkId}
122
- `);
123
- }
124
- return totalImported > 0;
125
- }
126
- var args = process.argv.slice(2);
127
- if (args.includes("--status")) {
128
- const state = loadState();
129
- const paths = ldmPaths();
130
- const hasDb = existsSync(paths.crystalDb);
131
- console.log("Mirror sync status:");
132
- console.log(` Relay URL: ${RELAY_URL || "(not set)"}`);
133
- console.log(` Local crystal: ${hasDb ? paths.crystalDb : "(none)"}`);
134
- console.log(` Last sync: ${state.lastSync || "never"}`);
135
- console.log(` Delta watermark: chunk ID ${state.lastDeltaChunkId}`);
136
- console.log(` Total imported: ${state.totalImported}`);
137
- process.exit(0);
138
- }
139
- var force = args.includes("--force");
140
- pullDelta(force).then(async (updated) => {
141
- try {
142
- const { imported, deleted } = await pullFileSync();
143
- if (imported > 0 || deleted > 0) {
144
- process.stderr.write(`[mirror-sync] file sync: ${imported} imported, ${deleted} deleted
145
- `);
146
- }
147
- } catch (err) {
148
- process.stderr.write(`[mirror-sync] file sync failed (non-fatal): ${err.message}
149
- `);
150
- }
151
- if (updated) {
152
- process.stderr.write("[mirror-sync] done\n");
153
- }
154
- process.exit(0);
155
- }).catch((err) => {
156
- process.stderr.write(`[mirror-sync] error: ${err.message}
157
- `);
158
- process.exit(1);
159
- });
@@ -1,19 +0,0 @@
1
- interface ExtractedMessage {
2
- role: string;
3
- text: string;
4
- timestamp: string;
5
- sessionId: string;
6
- }
7
- /** Extract messages from an OpenClaw session JSONL file.
8
- * Reads from lastByteOffset for incremental processing.
9
- * Returns extracted messages and new byte offset. */
10
- declare function extractOpenClawMessages(filePath: string, lastByteOffset?: number): {
11
- messages: ExtractedMessage[];
12
- newByteOffset: number;
13
- };
14
- /** Detect whether a JSONL file is OpenClaw format.
15
- * Checks the first line for type:"session" with version field
16
- * (OpenClaw uses this header; Claude Code does not). */
17
- declare function isOpenClawJsonl(filePath: string): boolean;
18
-
19
- export { type ExtractedMessage, extractOpenClawMessages, isOpenClawJsonl };
@@ -1,74 +0,0 @@
1
- // src/oc-backfill.ts
2
- import { existsSync, statSync, openSync, readSync, closeSync } from "fs";
3
- function extractOpenClawMessages(filePath, lastByteOffset = 0) {
4
- if (!existsSync(filePath)) {
5
- return { messages: [], newByteOffset: 0 };
6
- }
7
- const fileSize = statSync(filePath).size;
8
- if (lastByteOffset >= fileSize) {
9
- return { messages: [], newByteOffset: fileSize };
10
- }
11
- const fd = openSync(filePath, "r");
12
- const bufSize = fileSize - lastByteOffset;
13
- const buf = Buffer.alloc(bufSize);
14
- readSync(fd, buf, 0, bufSize, lastByteOffset);
15
- closeSync(fd);
16
- const lines = buf.toString("utf-8").split("\n").filter(Boolean);
17
- const messages = [];
18
- let sessionId = "unknown";
19
- for (const line of lines) {
20
- try {
21
- const obj = JSON.parse(line);
22
- if (obj.type === "session" && obj.id) {
23
- sessionId = obj.id;
24
- continue;
25
- }
26
- if (obj.type !== "message") continue;
27
- const msg = obj.message;
28
- if (!msg || !msg.role) continue;
29
- if (msg.role === "system" || msg.role === "tool") continue;
30
- let text = "";
31
- if (typeof msg.content === "string") {
32
- text = msg.content;
33
- } else if (Array.isArray(msg.content)) {
34
- const parts = [];
35
- for (const block of msg.content) {
36
- if (block.type === "text" && block.text) {
37
- parts.push(block.text);
38
- }
39
- if (block.type === "thinking" && block.thinking) {
40
- parts.push(`[thinking] ${block.thinking}`);
41
- }
42
- }
43
- text = parts.join("\n\n");
44
- }
45
- if (text.length < 20) continue;
46
- messages.push({
47
- role: msg.role,
48
- text,
49
- timestamp: obj.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
50
- sessionId: obj.id || sessionId
51
- });
52
- } catch {
53
- }
54
- }
55
- return { messages, newByteOffset: fileSize };
56
- }
57
- function isOpenClawJsonl(filePath) {
58
- try {
59
- const fd = openSync(filePath, "r");
60
- const buf = Buffer.alloc(Math.min(1024, statSync(filePath).size));
61
- const bytesRead = readSync(fd, buf, 0, buf.length, 0);
62
- closeSync(fd);
63
- const firstLine = buf.toString("utf-8", 0, bytesRead).split("\n")[0];
64
- if (!firstLine) return false;
65
- const obj = JSON.parse(firstLine);
66
- return obj.type === "session" && typeof obj.version === "number";
67
- } catch {
68
- return false;
69
- }
70
- }
71
- export {
72
- extractOpenClawMessages,
73
- isOpenClawJsonl
74
- };
@@ -1,5 +0,0 @@
1
- declare const _default: {
2
- register(api: any): void;
3
- };
4
-
5
- export { _default as default };
package/dist/openclaw.js DELETED
@@ -1,423 +0,0 @@
1
- import {
2
- Crystal,
3
- resolveConfig
4
- } from "./chunk-FBQWSDPC.js";
5
- import {
6
- ensureLdm,
7
- resolveStatePath,
8
- stateWritePath
9
- } from "./chunk-EXEZZADG.js";
10
-
11
- // src/dev-update.ts
12
- import { execSync } from "child_process";
13
- import { existsSync, mkdirSync, writeFileSync, readFileSync } from "fs";
14
- import { join, basename } from "path";
15
- var HOME = process.env.HOME || "";
16
- var STAFF_DIR = join(HOME, "Documents", "wipcomputer--mac-mini-01", "staff");
17
- var CC_REPOS = join(STAFF_DIR, "Parker", "Claude Code - Mini", "repos");
18
- var LESA_REPOS = join(STAFF_DIR, "L\u0113sa", "repos");
19
- var DEV_UPDATES_DIR = join(CC_REPOS, "wip-dev-updates");
20
- var LAST_RUN_PATH = resolveStatePath("dev-update-last-run.json");
21
- function loadLastRun() {
22
- try {
23
- if (existsSync(LAST_RUN_PATH)) {
24
- return JSON.parse(readFileSync(LAST_RUN_PATH, "utf-8"));
25
- }
26
- } catch {
27
- }
28
- return null;
29
- }
30
- function saveLastRun(run) {
31
- const writePath = stateWritePath("dev-update-last-run.json");
32
- writeFileSync(writePath, JSON.stringify(run, null, 2));
33
- }
34
- function git(repoPath, cmd) {
35
- try {
36
- return execSync(`git -C "${repoPath}" ${cmd}`, {
37
- encoding: "utf-8",
38
- timeout: 1e4,
39
- stdio: ["pipe", "pipe", "pipe"]
40
- }).trim();
41
- } catch {
42
- return "";
43
- }
44
- }
45
- function scanRepo(repoPath, since) {
46
- if (!existsSync(join(repoPath, ".git"))) return null;
47
- const name = basename(repoPath);
48
- if (name === "_third-party-repos" || name === "wip-dev-updates") return null;
49
- const recentCommits = git(repoPath, `log --oneline --since="${since}"`);
50
- const uncommitted = git(repoPath, "status --porcelain");
51
- if (!recentCommits && !uncommitted) return null;
52
- const lines = [];
53
- lines.push(`# ${name}`);
54
- lines.push("");
55
- if (recentCommits) {
56
- lines.push("## Recent Commits");
57
- lines.push("");
58
- lines.push("```");
59
- lines.push(...recentCommits.split("\n").slice(0, 10));
60
- lines.push("```");
61
- lines.push("");
62
- }
63
- if (uncommitted) {
64
- lines.push("## Uncommitted Changes");
65
- lines.push("");
66
- lines.push("```");
67
- lines.push(...uncommitted.split("\n").slice(0, 20));
68
- lines.push("```");
69
- lines.push("");
70
- }
71
- if (recentCommits) {
72
- const diffStat = git(repoPath, `diff --stat "HEAD@{${since}}" HEAD`);
73
- if (diffStat) {
74
- lines.push("## Files Changed");
75
- lines.push("");
76
- lines.push("```");
77
- lines.push(...diffStat.split("\n").slice(-15));
78
- lines.push("```");
79
- lines.push("");
80
- }
81
- }
82
- const branch = git(repoPath, "branch --show-current") || "unknown";
83
- lines.push(`**Branch:** ${branch}`);
84
- lines.push("");
85
- return lines.join("\n");
86
- }
87
- function runDevUpdate(author) {
88
- const lastRun = loadLastRun();
89
- if (lastRun) {
90
- const elapsed = Date.now() - new Date(lastRun.timestamp).getTime();
91
- if (elapsed < 60 * 60 * 1e3) {
92
- return { reposUpdated: 0, files: [] };
93
- }
94
- }
95
- let since = "6 hours ago";
96
- if (lastRun?.timestamp) {
97
- const lastDate = new Date(lastRun.timestamp);
98
- const hoursAgo = Math.ceil((Date.now() - lastDate.getTime()) / (1e3 * 60 * 60));
99
- since = `${Math.max(hoursAgo, 1)} hours ago`;
100
- }
101
- const now = /* @__PURE__ */ new Date();
102
- const ts = [
103
- String(now.getMonth() + 1).padStart(2, "0"),
104
- String(now.getDate()).padStart(2, "0"),
105
- String(now.getFullYear())
106
- ].join("-") + "--" + [
107
- String(now.getHours()).padStart(2, "0"),
108
- String(now.getMinutes()).padStart(2, "0"),
109
- String(now.getSeconds()).padStart(2, "0")
110
- ].join("-");
111
- const files = [];
112
- const repoDirs = [CC_REPOS, LESA_REPOS];
113
- for (const parentDir of repoDirs) {
114
- if (!existsSync(parentDir)) continue;
115
- let entries;
116
- try {
117
- entries = execSync(`ls "${parentDir}"`, { encoding: "utf-8" }).trim().split("\n");
118
- } catch {
119
- continue;
120
- }
121
- for (const entry of entries) {
122
- const repoPath = join(parentDir, entry);
123
- const content = scanRepo(repoPath, since);
124
- if (!content) continue;
125
- const repoName = basename(repoPath);
126
- const outDir = join(repoPath, "ai");
127
- const outFile = join(outDir, `${now.toISOString().slice(0, 10)}--${now.toISOString().slice(11, 19).replace(/:/g, "-")}--${author}--dev-update-${repoName}.md`);
128
- mkdirSync(outDir, { recursive: true });
129
- const header = `*Auto-generated dev update by ${author} at ${now.toISOString().slice(0, 16).replace("T", " ")}*
130
-
131
- `;
132
- writeFileSync(outFile, content.replace(/^# .+\n/, `$&
133
- ${header}`));
134
- files.push(`${repoName}/ai/${basename(outFile)}`);
135
- }
136
- }
137
- if (false) {
138
- try {
139
- execSync(
140
- `cd "${DEV_UPDATES_DIR}" && git add -A && git commit -m "${author} auto-dev-update ${ts}: ${files.length} repo(s)" --no-verify && git push --quiet`,
141
- { encoding: "utf-8", timeout: 3e4, stdio: "pipe" }
142
- );
143
- } catch {
144
- }
145
- }
146
- saveLastRun({
147
- timestamp: now.toISOString(),
148
- author,
149
- reposUpdated: files.length
150
- });
151
- return { reposUpdated: files.length, files };
152
- }
153
-
154
- // src/openclaw.ts
155
- import {
156
- existsSync as existsSync2,
157
- readFileSync as readFileSync2,
158
- readdirSync,
159
- copyFileSync,
160
- statSync,
161
- mkdirSync as mkdirSync2
162
- } from "fs";
163
- import { join as join2 } from "path";
164
- var PRIVATE_MODE_PATH = resolveStatePath("memory-capture-state.json");
165
- function isPrivateMode() {
166
- try {
167
- if (existsSync2(PRIVATE_MODE_PATH)) {
168
- const state = JSON.parse(readFileSync2(PRIVATE_MODE_PATH, "utf-8"));
169
- return state.enabled === false;
170
- }
171
- } catch {
172
- }
173
- return false;
174
- }
175
- var OC_AGENT_ID = "oc-lesa-mini";
176
- function syncRawDataToLdm(logger) {
177
- try {
178
- const paths = ensureLdm(OC_AGENT_ID);
179
- const HOME2 = process.env.HOME || "";
180
- const ocDir = join2(HOME2, ".openclaw");
181
- const sessionsDir = join2(ocDir, "agents", "main", "sessions");
182
- if (existsSync2(sessionsDir)) {
183
- let copied = 0;
184
- for (const file of readdirSync(sessionsDir)) {
185
- if (!file.endsWith(".jsonl")) continue;
186
- const src = join2(sessionsDir, file);
187
- const dest = join2(paths.transcripts, file);
188
- if (idempotentCopy(src, dest)) copied++;
189
- }
190
- if (copied > 0) logger.info(`memory-crystal: synced ${copied} session files to LDM`);
191
- }
192
- const workspaceDir = join2(ocDir, "workspace");
193
- if (existsSync2(workspaceDir)) {
194
- syncDirRecursive(workspaceDir, paths.workspace, ".md");
195
- }
196
- const dailyDir = join2(ocDir, "workspace", "memory");
197
- if (existsSync2(dailyDir)) {
198
- for (const file of readdirSync(dailyDir)) {
199
- if (!file.endsWith(".md")) continue;
200
- if (/^\d{4}-\d{2}-\d{2}\.md$/.test(file)) {
201
- const src = join2(dailyDir, file);
202
- const dest = join2(paths.daily, file);
203
- idempotentCopy(src, dest);
204
- }
205
- }
206
- }
207
- } catch (err) {
208
- logger.warn(`memory-crystal: raw data sync failed (non-fatal): ${err.message}`);
209
- }
210
- }
211
- function idempotentCopy(src, dest) {
212
- try {
213
- if (existsSync2(dest)) {
214
- const srcStat = statSync(src);
215
- const destStat = statSync(dest);
216
- if (srcStat.size === destStat.size && srcStat.mtimeMs <= destStat.mtimeMs) return false;
217
- }
218
- const destDir = join2(dest, "..");
219
- if (!existsSync2(destDir)) mkdirSync2(destDir, { recursive: true });
220
- copyFileSync(src, dest);
221
- return true;
222
- } catch {
223
- return false;
224
- }
225
- }
226
- function syncDirRecursive(srcDir, destDir, ext) {
227
- if (!existsSync2(destDir)) mkdirSync2(destDir, { recursive: true });
228
- for (const entry of readdirSync(srcDir, { withFileTypes: true })) {
229
- const srcPath = join2(srcDir, entry.name);
230
- const destPath = join2(destDir, entry.name);
231
- if (entry.isDirectory()) {
232
- syncDirRecursive(srcPath, destPath, ext);
233
- } else if (entry.name.endsWith(ext)) {
234
- idempotentCopy(srcPath, destPath);
235
- }
236
- }
237
- }
238
- var openclaw_default = {
239
- register(api) {
240
- const crystal = new Crystal(resolveConfig());
241
- let initialized = false;
242
- async function ensureInit() {
243
- if (!initialized) {
244
- await crystal.init();
245
- initialized = true;
246
- }
247
- }
248
- api.on("agent_end", async (event, ctx) => {
249
- if (isPrivateMode()) return;
250
- await ensureInit();
251
- const messages = event.messages;
252
- if (!messages || messages.length === 0) return;
253
- const agentId = ctx.agentId || OC_AGENT_ID;
254
- const sessionKey = ctx.sessionKey || "unknown";
255
- const state = crystal.getCaptureState(agentId, sessionKey);
256
- const storedCount = state.lastMessageCount;
257
- let startIndex = storedCount;
258
- if (messages.length < storedCount) {
259
- api.logger.info(`memory-crystal: compaction detected (${storedCount} \u2192 ${messages.length} messages), resetting capture position`);
260
- startIndex = 0;
261
- }
262
- if (messages.length <= startIndex) return;
263
- const newTurns = [];
264
- for (let i = startIndex; i < messages.length; i++) {
265
- const msg = messages[i];
266
- if (!msg.content) continue;
267
- const role = msg.role;
268
- if (role !== "user" && role !== "assistant") continue;
269
- let text = "";
270
- if (typeof msg.content === "string") {
271
- text = msg.content;
272
- } else if (Array.isArray(msg.content)) {
273
- text = msg.content.filter((b) => b.type === "text").map((b) => b.text).join("\n");
274
- }
275
- if (!text || text.length < 50) continue;
276
- const maxSingleChunkChars = 2e3 * 4;
277
- if (text.length <= maxSingleChunkChars) {
278
- newTurns.push({
279
- text,
280
- role,
281
- source_type: "conversation",
282
- source_id: sessionKey,
283
- agent_id: agentId,
284
- token_count: Math.ceil(text.length / 4),
285
- created_at: (/* @__PURE__ */ new Date()).toISOString()
286
- });
287
- } else {
288
- const chunks = crystal.chunkText(text);
289
- for (const chunkText of chunks) {
290
- newTurns.push({
291
- text: chunkText,
292
- role,
293
- source_type: "conversation",
294
- source_id: sessionKey,
295
- agent_id: agentId,
296
- token_count: Math.ceil(chunkText.length / 4),
297
- created_at: (/* @__PURE__ */ new Date()).toISOString()
298
- });
299
- }
300
- }
301
- }
302
- const totalTokens = newTurns.reduce((sum, c) => sum + c.token_count, 0);
303
- if (totalTokens < 500) return;
304
- try {
305
- const count = await crystal.ingest(newTurns);
306
- crystal.setCaptureState(agentId, sessionKey, messages.length, state.captureCount + 1);
307
- api.logger.info(`memory-crystal: ingested ${count} chunks from ${sessionKey} (cycle ${state.captureCount + 1})`);
308
- } catch (err) {
309
- api.logger.error(`memory-crystal: ingest error: ${err.message}`);
310
- }
311
- syncRawDataToLdm(api.logger);
312
- });
313
- function toolResult(text, isError = false) {
314
- return {
315
- content: [{ type: "text", text }],
316
- ...isError ? { isError: true } : {}
317
- };
318
- }
319
- api.registerTool(
320
- {
321
- name: "crystal_search",
322
- label: "Search Memory Crystal",
323
- description: "Search memory crystal \u2014 semantic search across all conversations and stored memories.",
324
- parameters: {
325
- type: "object",
326
- properties: {
327
- query: { type: "string", description: "What to search for" },
328
- limit: { type: "number", description: "Max results (default: 5)" },
329
- agent_id: { type: "string", description: "Filter by agent" }
330
- },
331
- required: ["query"]
332
- },
333
- async execute(_id, params) {
334
- try {
335
- await ensureInit();
336
- const results = await crystal.search(
337
- params.query,
338
- params.limit || 5,
339
- params.agent_id ? { agent_id: params.agent_id } : void 0
340
- );
341
- if (results.length === 0) return toolResult("No results found.");
342
- const formatted = results.map((r, i) => {
343
- const score = (r.score * 100).toFixed(1);
344
- const date = r.created_at?.slice(0, 10) || "unknown";
345
- return `[${i + 1}] (${score}%, ${r.agent_id}, ${date}, ${r.role})
346
- ${r.text}`;
347
- }).join("\n\n---\n\n");
348
- return toolResult(formatted);
349
- } catch (err) {
350
- return toolResult(`crystal_search error: ${err.message}`, true);
351
- }
352
- }
353
- },
354
- { optional: true }
355
- );
356
- api.registerTool(
357
- {
358
- name: "crystal_remember",
359
- label: "Remember in Crystal",
360
- description: "Store a fact, preference, or observation in memory crystal.",
361
- parameters: {
362
- type: "object",
363
- properties: {
364
- text: { type: "string", description: "The fact to remember" },
365
- category: { type: "string", enum: ["fact", "preference", "event", "opinion", "skill"] }
366
- },
367
- required: ["text"]
368
- },
369
- async execute(_id, params) {
370
- if (isPrivateMode()) {
371
- return toolResult("Private mode is on. No memories are being stored. Use /private-mode off to resume.");
372
- }
373
- try {
374
- await ensureInit();
375
- const id = await crystal.remember(params.text, params.category || "fact");
376
- return toolResult(`Remembered (id: ${id}): ${params.text}`);
377
- } catch (err) {
378
- return toolResult(`crystal_remember error: ${err.message}`, true);
379
- }
380
- }
381
- },
382
- { optional: true }
383
- );
384
- api.registerTool(
385
- {
386
- name: "crystal_forget",
387
- label: "Forget Memory",
388
- description: "Deprecate a memory by ID.",
389
- parameters: {
390
- type: "object",
391
- properties: {
392
- id: { type: "number", description: "Memory ID to deprecate" }
393
- },
394
- required: ["id"]
395
- },
396
- async execute(_id, params) {
397
- try {
398
- await ensureInit();
399
- const ok = crystal.forget(params.id);
400
- return toolResult(ok ? `Forgot memory ${params.id}` : `Memory ${params.id} not found`);
401
- } catch (err) {
402
- return toolResult(`crystal_forget error: ${err.message}`, true);
403
- }
404
- }
405
- },
406
- { optional: true }
407
- );
408
- api.on("before_compaction", (_event, _ctx) => {
409
- try {
410
- const result = runDevUpdate("lesa");
411
- if (result.reposUpdated > 0) {
412
- api.logger.info(`memory-crystal: auto-dev-update wrote ${result.reposUpdated} updates before compaction`);
413
- }
414
- } catch (err) {
415
- api.logger.warn(`memory-crystal: auto-dev-update failed: ${err.message}`);
416
- }
417
- });
418
- api.logger.info("memory-crystal plugin registered");
419
- }
420
- };
421
- export {
422
- openclaw_default as default
423
- };
package/dist/pair.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare function pairShow(): Promise<void>;
2
- declare function pairReceive(code: string): void;
3
-
4
- export { pairReceive, pairShow };