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