@wipcomputer/memory-crystal 0.7.29 → 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 +75 -0
- package/SKILL.md +1 -1
- package/package.json +1 -1
- package/scripts/migrate-lance-to-sqlite.mjs +2 -1
- 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/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/worker.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// src/worker.ts
|
|
2
|
-
function authenticate(request, env) {
|
|
3
|
-
const auth = request.headers.get("Authorization");
|
|
4
|
-
if (!auth?.startsWith("Bearer ")) {
|
|
5
|
-
return json({ error: "Missing Authorization header" }, 401);
|
|
6
|
-
}
|
|
7
|
-
const token = auth.slice(7);
|
|
8
|
-
const tokenMap = {};
|
|
9
|
-
if (env.AUTH_TOKEN_CC_AIR) tokenMap[env.AUTH_TOKEN_CC_AIR] = "cc-air";
|
|
10
|
-
if (env.AUTH_TOKEN_CC_MINI) tokenMap[env.AUTH_TOKEN_CC_MINI] = "cc-mini";
|
|
11
|
-
if (env.AUTH_TOKEN_LESA) tokenMap[env.AUTH_TOKEN_LESA] = "lesa-mini";
|
|
12
|
-
const agentId = tokenMap[token];
|
|
13
|
-
if (!agentId) {
|
|
14
|
-
return json({ error: "Invalid token" }, 403);
|
|
15
|
-
}
|
|
16
|
-
return { agentId };
|
|
17
|
-
}
|
|
18
|
-
var VALID_CHANNELS = ["conversations", "mirror", "commands", "files", "chatgpt", "chatgpt-attachments"];
|
|
19
|
-
function isValidChannel(channel) {
|
|
20
|
-
return VALID_CHANNELS.includes(channel);
|
|
21
|
-
}
|
|
22
|
-
async function handleDrop(request, env, agentId, channel) {
|
|
23
|
-
if (!isValidChannel(channel)) {
|
|
24
|
-
return json({ error: `Invalid channel: ${channel}. Valid: ${VALID_CHANNELS.join(", ")}` }, 400);
|
|
25
|
-
}
|
|
26
|
-
const body = await request.arrayBuffer();
|
|
27
|
-
if (body.byteLength === 0) {
|
|
28
|
-
return json({ error: "Empty payload" }, 400);
|
|
29
|
-
}
|
|
30
|
-
if (body.byteLength > 100 * 1024 * 1024) {
|
|
31
|
-
return json({ error: "Payload too large (max 100MB)" }, 413);
|
|
32
|
-
}
|
|
33
|
-
const id = crypto.randomUUID();
|
|
34
|
-
const key = `${channel}/${id}`;
|
|
35
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
36
|
-
await env.RELAY.put(key, body, {
|
|
37
|
-
customMetadata: {
|
|
38
|
-
agent_id: agentId,
|
|
39
|
-
dropped_at: now,
|
|
40
|
-
size: String(body.byteLength)
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return json({ ok: true, id, channel, size: body.byteLength, dropped_at: now });
|
|
44
|
-
}
|
|
45
|
-
async function handlePickupList(env, channel) {
|
|
46
|
-
if (!isValidChannel(channel)) {
|
|
47
|
-
return json({ error: `Invalid channel: ${channel}` }, 400);
|
|
48
|
-
}
|
|
49
|
-
const listed = await env.RELAY.list({ prefix: `${channel}/` });
|
|
50
|
-
const blobs = listed.objects.map((obj) => ({
|
|
51
|
-
id: obj.key.split("/")[1],
|
|
52
|
-
size: obj.size,
|
|
53
|
-
dropped_at: obj.customMetadata?.dropped_at || obj.uploaded.toISOString(),
|
|
54
|
-
agent_id: obj.customMetadata?.agent_id || "unknown"
|
|
55
|
-
}));
|
|
56
|
-
return json({ channel, count: blobs.length, blobs });
|
|
57
|
-
}
|
|
58
|
-
async function handlePickup(env, channel, id) {
|
|
59
|
-
if (!isValidChannel(channel)) {
|
|
60
|
-
return json({ error: `Invalid channel: ${channel}` }, 400);
|
|
61
|
-
}
|
|
62
|
-
const key = `${channel}/${id}`;
|
|
63
|
-
const obj = await env.RELAY.get(key);
|
|
64
|
-
if (!obj) {
|
|
65
|
-
return json({ error: "Blob not found (already picked up or expired)" }, 404);
|
|
66
|
-
}
|
|
67
|
-
return new Response(obj.body, {
|
|
68
|
-
headers: {
|
|
69
|
-
"Content-Type": "application/octet-stream",
|
|
70
|
-
"X-Agent-Id": obj.customMetadata?.agent_id || "unknown",
|
|
71
|
-
"X-Dropped-At": obj.customMetadata?.dropped_at || ""
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
async function handleConfirm(env, channel, id) {
|
|
76
|
-
if (!isValidChannel(channel)) {
|
|
77
|
-
return json({ error: `Invalid channel: ${channel}` }, 400);
|
|
78
|
-
}
|
|
79
|
-
const key = `${channel}/${id}`;
|
|
80
|
-
const obj = await env.RELAY.head(key);
|
|
81
|
-
if (!obj) {
|
|
82
|
-
return json({ error: "Blob not found (already confirmed or expired)" }, 404);
|
|
83
|
-
}
|
|
84
|
-
await env.RELAY.delete(key);
|
|
85
|
-
return json({ ok: true, deleted: key });
|
|
86
|
-
}
|
|
87
|
-
function json(data, status = 200) {
|
|
88
|
-
return new Response(JSON.stringify(data), {
|
|
89
|
-
status,
|
|
90
|
-
headers: { "Content-Type": "application/json" }
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
var worker_default = {
|
|
94
|
-
async fetch(request, env) {
|
|
95
|
-
const url = new URL(request.url);
|
|
96
|
-
const parts = url.pathname.split("/").filter(Boolean);
|
|
97
|
-
if (parts[0] === "health" && request.method === "GET") {
|
|
98
|
-
return json({ ok: true, service: "memory-crystal-relay", mode: "ephemeral" });
|
|
99
|
-
}
|
|
100
|
-
const authResult = authenticate(request, env);
|
|
101
|
-
if (authResult instanceof Response) return authResult;
|
|
102
|
-
const { agentId } = authResult;
|
|
103
|
-
try {
|
|
104
|
-
if (parts[0] === "drop" && parts[1] && request.method === "POST") {
|
|
105
|
-
return handleDrop(request, env, agentId, parts[1]);
|
|
106
|
-
}
|
|
107
|
-
if (parts[0] === "pickup" && parts[1] && request.method === "GET") {
|
|
108
|
-
if (parts[2]) {
|
|
109
|
-
return handlePickup(env, parts[1], parts[2]);
|
|
110
|
-
}
|
|
111
|
-
return handlePickupList(env, parts[1]);
|
|
112
|
-
}
|
|
113
|
-
if (parts[0] === "confirm" && parts[1] && parts[2] && request.method === "DELETE") {
|
|
114
|
-
return handleConfirm(env, parts[1], parts[2]);
|
|
115
|
-
}
|
|
116
|
-
return json({ error: "Not found" }, 404);
|
|
117
|
-
} catch (err) {
|
|
118
|
-
return json({ error: err.message || "Internal error" }, 500);
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
// Scheduled cleanup: delete blobs older than 24h (TTL safety net)
|
|
122
|
-
async scheduled(event, env) {
|
|
123
|
-
const cutoff = Date.now() - 24 * 60 * 60 * 1e3;
|
|
124
|
-
for (const channel of VALID_CHANNELS) {
|
|
125
|
-
const listed = await env.RELAY.list({ prefix: `${channel}/` });
|
|
126
|
-
for (const obj of listed.objects) {
|
|
127
|
-
const droppedAt = obj.customMetadata?.dropped_at;
|
|
128
|
-
if (droppedAt && new Date(droppedAt).getTime() < cutoff) {
|
|
129
|
-
await env.RELAY.delete(obj.key);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
export {
|
|
136
|
-
worker_default as default
|
|
137
|
-
};
|