@storacha/clawracha 0.0.10 → 0.0.11-rc.0
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/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +39 -17
- package/package.json +2 -2
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,qBAAqB,CAAC;AAyC7B;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,GAAG,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,qBAAqB,CAAC;AAyC7B;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,GAAG,EAAE,iBAAiB,QA4hBpD"}
|
package/dist/plugin.js
CHANGED
|
@@ -225,10 +225,14 @@ export default function plugin(api) {
|
|
|
225
225
|
return { text: "No workspace configured." };
|
|
226
226
|
const config = await loadDeviceConfig(workspace);
|
|
227
227
|
if (!config?.agentKey) {
|
|
228
|
-
return {
|
|
228
|
+
return {
|
|
229
|
+
text: "Run `/storacha-init` first to generate an agent identity.",
|
|
230
|
+
};
|
|
229
231
|
}
|
|
230
232
|
if (config.setupComplete) {
|
|
231
|
-
return {
|
|
233
|
+
return {
|
|
234
|
+
text: "Setup already complete. Use `/storacha-status` to check sync state.",
|
|
235
|
+
};
|
|
232
236
|
}
|
|
233
237
|
const b64 = _ctx.args?.trim();
|
|
234
238
|
if (!b64) {
|
|
@@ -240,31 +244,43 @@ export default function plugin(api) {
|
|
|
240
244
|
].join("\n"),
|
|
241
245
|
};
|
|
242
246
|
}
|
|
247
|
+
return {
|
|
248
|
+
text: [
|
|
249
|
+
"You ran '/storacha-setup' without the following command argument:",
|
|
250
|
+
"",
|
|
251
|
+
b64,
|
|
252
|
+
].join("\n"),
|
|
253
|
+
};
|
|
254
|
+
/*
|
|
243
255
|
// Validate delegation
|
|
244
256
|
const bytes = decodeDelegation(b64);
|
|
245
257
|
const { ok: delegation, error } = await extractDelegation(bytes);
|
|
246
258
|
if (!delegation) {
|
|
247
|
-
|
|
259
|
+
return { text: `Invalid delegation: ${error}` };
|
|
248
260
|
}
|
|
261
|
+
|
|
249
262
|
const spaceDID = delegation.capabilities[0]?.with;
|
|
263
|
+
|
|
250
264
|
config.uploadDelegation = b64;
|
|
251
265
|
config.spaceDID = spaceDID ?? undefined;
|
|
252
266
|
config.setupComplete = true;
|
|
253
267
|
await saveDeviceConfig(workspace, config);
|
|
268
|
+
|
|
254
269
|
const { Agent } = await import("@storacha/ucn/pail");
|
|
255
270
|
const agent = Agent.parse(config.agentKey);
|
|
271
|
+
|
|
256
272
|
return {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
273
|
+
text: [
|
|
274
|
+
"\u{1f525} Storacha workspace ready!",
|
|
275
|
+
`Agent DID: \`${agent.did()}\``,
|
|
276
|
+
`Space: \`${spaceDID ?? "unknown"}\``,
|
|
277
|
+
"",
|
|
278
|
+
"Restart the gateway to start syncing.",
|
|
279
|
+
"",
|
|
280
|
+
"To add another device, run `/storacha-grant <their-agent-DID>` here,",
|
|
281
|
+
"then `/storacha-join <upload-b64> <name-b64>` on the other device.",
|
|
282
|
+
].join("\n"),
|
|
283
|
+
};*/
|
|
268
284
|
}
|
|
269
285
|
catch (err) {
|
|
270
286
|
return {
|
|
@@ -320,10 +336,14 @@ export default function plugin(api) {
|
|
|
320
336
|
}
|
|
321
337
|
const config = await loadDeviceConfig(workspace);
|
|
322
338
|
if (!config?.agentKey) {
|
|
323
|
-
return {
|
|
339
|
+
return {
|
|
340
|
+
text: "Run `/storacha-init` first to generate an agent identity.",
|
|
341
|
+
};
|
|
324
342
|
}
|
|
325
343
|
if (config.setupComplete) {
|
|
326
|
-
return {
|
|
344
|
+
return {
|
|
345
|
+
text: "Setup already complete. Use `/storacha-status` to check sync state.",
|
|
346
|
+
};
|
|
327
347
|
}
|
|
328
348
|
const { Agent } = await import("@storacha/ucn/pail");
|
|
329
349
|
const agent = Agent.parse(config.agentKey);
|
|
@@ -498,7 +518,9 @@ export default function plugin(api) {
|
|
|
498
518
|
];
|
|
499
519
|
if (syncEngine) {
|
|
500
520
|
const status = await syncEngine.status();
|
|
501
|
-
lines.push(`Running: ${status.running}`, `Last Sync: ${status.lastSync
|
|
521
|
+
lines.push(`Running: ${status.running}`, `Last Sync: ${status.lastSync
|
|
522
|
+
? new Date(status.lastSync).toISOString()
|
|
523
|
+
: "never"}`, `Entries: ${status.entryCount}`, `Pending: ${status.pendingChanges}`);
|
|
502
524
|
}
|
|
503
525
|
return { text: lines.join("\n") };
|
|
504
526
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storacha/clawracha",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11-rc.0",
|
|
4
4
|
"description": "OpenClaw plugin for Storacha workspace sync via UCN Pail",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@web3-storage/pail": "0.6.3-rc.3",
|
|
37
37
|
"carstream": "^2.3.0",
|
|
38
38
|
"chokidar": "^3.6.0",
|
|
39
|
-
"multiformats": "^13.
|
|
39
|
+
"multiformats": "^13.3.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ipld/unixfs": "^3.0.0",
|