mnemospark 0.8.2 → 0.9.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/README.md +3 -1
- package/dist/cli.js +32 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/mnemospark/SKILL.md +2 -2
- package/skills/mnemospark/references/commands.md +1 -1
package/README.md
CHANGED
|
@@ -59,9 +59,11 @@ Use via `/mnemospark_cloud ...` in OpenClaw chat.
|
|
|
59
59
|
### Get a storage quote
|
|
60
60
|
|
|
61
61
|
```text
|
|
62
|
-
/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <sha256> --gb <gb> --provider
|
|
62
|
+
/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <sha256> --gb <gb> --provider aws --region us-east-1
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
Use other regions by changing `--provider` and `--region` (defaults: `aws` / `us-east-1`).
|
|
66
|
+
|
|
65
67
|
### Upload using quote
|
|
66
68
|
|
|
67
69
|
```text
|
package/dist/cli.js
CHANGED
|
@@ -3374,6 +3374,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3374
3374
|
addOperationsColumn("subagent_session_id", "TEXT");
|
|
3375
3375
|
addOperationsColumn("timeout_seconds", "INTEGER");
|
|
3376
3376
|
addOperationsColumn("cancel_requested_at", "TEXT");
|
|
3377
|
+
addOperationsColumn("result_text", "TEXT");
|
|
3377
3378
|
nextDb.prepare(
|
|
3378
3379
|
`INSERT INTO schema_migrations(version, applied_at)
|
|
3379
3380
|
VALUES(?, ?)
|
|
@@ -3565,8 +3566,8 @@ async function createCloudDatastore(homeDir) {
|
|
|
3565
3566
|
const ts = nowIso();
|
|
3566
3567
|
const terminalStatuses = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
3567
3568
|
db.prepare(
|
|
3568
|
-
`INSERT INTO operations(operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, started_at, finished_at, created_at, updated_at)
|
|
3569
|
-
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
3569
|
+
`INSERT INTO operations(operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, result_text, started_at, finished_at, created_at, updated_at)
|
|
3570
|
+
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
3570
3571
|
ON CONFLICT(operation_id) DO UPDATE SET
|
|
3571
3572
|
type=excluded.type,
|
|
3572
3573
|
object_id=COALESCE(excluded.object_id, operations.object_id),
|
|
@@ -3579,6 +3580,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3579
3580
|
status=excluded.status,
|
|
3580
3581
|
error_code=excluded.error_code,
|
|
3581
3582
|
error_message=excluded.error_message,
|
|
3583
|
+
result_text=COALESCE(excluded.result_text, operations.result_text),
|
|
3582
3584
|
started_at=COALESCE(excluded.started_at, operations.started_at),
|
|
3583
3585
|
finished_at=COALESCE(excluded.finished_at, operations.finished_at),
|
|
3584
3586
|
updated_at=excluded.updated_at`
|
|
@@ -3595,6 +3597,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3595
3597
|
row.status,
|
|
3596
3598
|
row.error_code,
|
|
3597
3599
|
row.error_message,
|
|
3600
|
+
row.result_text ?? null,
|
|
3598
3601
|
row.status === "started" ? ts : null,
|
|
3599
3602
|
terminalStatuses.has(row.status) ? ts : null,
|
|
3600
3603
|
ts,
|
|
@@ -3604,7 +3607,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3604
3607
|
},
|
|
3605
3608
|
findOperationById: async (operationId) => safe(() => {
|
|
3606
3609
|
const row = db.prepare(
|
|
3607
|
-
`SELECT operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, started_at, finished_at, updated_at
|
|
3610
|
+
`SELECT operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, result_text, started_at, finished_at, updated_at
|
|
3608
3611
|
FROM operations
|
|
3609
3612
|
WHERE operation_id = ?
|
|
3610
3613
|
LIMIT 1`
|
|
@@ -3809,8 +3812,8 @@ var CLOUD_HELP_TEXT = [
|
|
|
3809
3812
|
" Purpose: create a local tar+gzip archive under ~/.openclaw/mnemospark/backup (filename from sanitized friendly name) and record metadata in SQLite for later price-storage and upload.",
|
|
3810
3813
|
" Required: " + REQUIRED_BACKUP,
|
|
3811
3814
|
"",
|
|
3812
|
-
"\u2022 `/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider
|
|
3813
|
-
" Purpose: request a storage quote before upload.",
|
|
3815
|
+
"\u2022 `/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider aws --region us-east-1`",
|
|
3816
|
+
" Purpose: request a storage quote before upload (defaults shown; override `--provider` / `--region` for other regions).",
|
|
3814
3817
|
" Required: " + REQUIRED_PRICE_STORAGE,
|
|
3815
3818
|
"",
|
|
3816
3819
|
"\u2022 `/mnemospark_cloud upload --quote-id <quote-id> --wallet-address <addr> --object-id <id> --object-id-hash <hash> [--name <friendly-name>] [--async] [--orchestrator <inline|subagent>] [--timeout-seconds <n>]`",
|
|
@@ -4553,7 +4556,7 @@ function buildStoragePaymentCronCommand(job) {
|
|
|
4553
4556
|
}
|
|
4554
4557
|
function buildOpenClawRenewalAgentMessage(openClawHome, renewalArgs) {
|
|
4555
4558
|
const cliPath = join8(openClawHome, ".openclaw/extensions/mnemospark/dist/cli.js");
|
|
4556
|
-
return `
|
|
4559
|
+
return `Execute: node ${cliPath} cloud ${renewalArgs}`;
|
|
4557
4560
|
}
|
|
4558
4561
|
function parseStoragePaymentCronCommand(command) {
|
|
4559
4562
|
const objectIdMatch = command.match(/--object-id\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\S+)/);
|
|
@@ -4879,9 +4882,11 @@ function formatPriceStorageUserMessage(quote, localArchiveHint) {
|
|
|
4879
4882
|
function quoteLookupMatchesPriceStorageResponse(lookup, quote) {
|
|
4880
4883
|
return lookup.quoteId === quote.quote_id && lookup.walletAddress.trim().toLowerCase() === quote.addr.trim().toLowerCase() && lookup.objectId === quote.object_id && lookup.objectIdHash.toLowerCase() === quote.object_id_hash.toLowerCase() && lookup.storagePrice === quote.storage_price && lookup.provider === quote.provider && lookup.location === quote.location;
|
|
4881
4884
|
}
|
|
4885
|
+
var DEFAULT_BACKUP_QUOTE_PROVIDER = "aws";
|
|
4886
|
+
var DEFAULT_BACKUP_QUOTE_REGION = "us-east-1";
|
|
4882
4887
|
function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
|
|
4883
4888
|
const hash = result.objectIdHash.replace(/\s/g, "");
|
|
4884
|
-
const priceStorageLine = `/mnemospark_cloud price-storage --wallet-address \`${walletAddress}\` --object-id \`${result.objectId}\` --object-id-hash \`${hash}\` --gb \`${result.objectSizeGb}\` --provider
|
|
4889
|
+
const priceStorageLine = `/mnemospark_cloud price-storage --wallet-address \`${walletAddress}\` --object-id \`${result.objectId}\` --object-id-hash \`${hash}\` --gb \`${result.objectSizeGb}\` --provider ${DEFAULT_BACKUP_QUOTE_PROVIDER} --region ${DEFAULT_BACKUP_QUOTE_REGION}`;
|
|
4885
4890
|
return [
|
|
4886
4891
|
`Backup archive: \`${result.archivePath}\``,
|
|
4887
4892
|
"",
|
|
@@ -4890,10 +4895,12 @@ function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
|
|
|
4890
4895
|
`object-id-hash: ${hash}`,
|
|
4891
4896
|
`object-size: ${result.objectSizeGb}`,
|
|
4892
4897
|
"",
|
|
4893
|
-
"Next, request a storage quote.
|
|
4898
|
+
"Next, request a storage quote.",
|
|
4894
4899
|
"",
|
|
4895
4900
|
priceStorageLine,
|
|
4896
4901
|
"",
|
|
4902
|
+
`The default region is ${DEFAULT_BACKUP_QUOTE_REGION}. Change the command parameters to switch regions (not required).`,
|
|
4903
|
+
"",
|
|
4897
4904
|
"Region examples (merge into the command above):",
|
|
4898
4905
|
"North America: `--provider aws --region us-east-1`",
|
|
4899
4906
|
"Europe: `--provider aws --region eu-north-1`",
|
|
@@ -5407,8 +5414,8 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5407
5414
|
const datastore = await createCloudDatastore(mnemosparkHomeDir);
|
|
5408
5415
|
const terminalOperationStatuses = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
5409
5416
|
const isTerminalOperationStatus = (status) => terminalOperationStatuses.has(status);
|
|
5410
|
-
const formatOperationStatus = (operation) =>
|
|
5411
|
-
|
|
5417
|
+
const formatOperationStatus = (operation) => {
|
|
5418
|
+
const meta = [
|
|
5412
5419
|
`operation-id: ${operation.operation_id}`,
|
|
5413
5420
|
`type: ${operation.type}`,
|
|
5414
5421
|
`status: ${operation.status}`,
|
|
@@ -5419,9 +5426,15 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5419
5426
|
operation.timeout_seconds ? `timeout-seconds: ${operation.timeout_seconds}` : null,
|
|
5420
5427
|
operation.error_code ? `error-code: ${operation.error_code}` : null,
|
|
5421
5428
|
operation.error_message ? `error-message: ${operation.error_message}` : null
|
|
5422
|
-
].filter((v) => Boolean(v)).join("\n")
|
|
5423
|
-
|
|
5424
|
-
|
|
5429
|
+
].filter((v) => Boolean(v)).join("\n");
|
|
5430
|
+
const withResult = operation.status === "succeeded" && operation.result_text?.trim() ? `${meta}
|
|
5431
|
+
|
|
5432
|
+
${operation.result_text}` : meta;
|
|
5433
|
+
return {
|
|
5434
|
+
text: withResult,
|
|
5435
|
+
isError: operation.status === "failed" || operation.status === "cancelled" || operation.status === "timed_out"
|
|
5436
|
+
};
|
|
5437
|
+
};
|
|
5425
5438
|
if (parsed.mode === "op-status") {
|
|
5426
5439
|
let operation = await datastore.findOperationById(parsed.operationId);
|
|
5427
5440
|
if (!operation) {
|
|
@@ -5758,7 +5771,7 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5758
5771
|
mnemosparkHomeDir
|
|
5759
5772
|
);
|
|
5760
5773
|
},
|
|
5761
|
-
onCompleted: async (sessionId) => {
|
|
5774
|
+
onCompleted: async (sessionId, result) => {
|
|
5762
5775
|
await datastore.upsertOperation({
|
|
5763
5776
|
operation_id: operationId,
|
|
5764
5777
|
type: opType,
|
|
@@ -5770,7 +5783,8 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5770
5783
|
timeout_seconds: timeoutSeconds,
|
|
5771
5784
|
status: "succeeded",
|
|
5772
5785
|
error_code: null,
|
|
5773
|
-
error_message: null
|
|
5786
|
+
error_message: null,
|
|
5787
|
+
result_text: result.isError ? null : result.text
|
|
5774
5788
|
});
|
|
5775
5789
|
await emitOperationEventBestEffort(
|
|
5776
5790
|
"operation.completed",
|
|
@@ -5947,7 +5961,8 @@ operation-id: ${operationId}`,
|
|
|
5947
5961
|
orchestrator: "inline",
|
|
5948
5962
|
status: result.isError ? "failed" : "succeeded",
|
|
5949
5963
|
error_code: result.isError ? "ASYNC_FAILED" : null,
|
|
5950
|
-
error_message: result.isError ? result.text : null
|
|
5964
|
+
error_message: result.isError ? result.text : null,
|
|
5965
|
+
result_text: result.isError ? null : result.text
|
|
5951
5966
|
});
|
|
5952
5967
|
await emitOperationEventBestEffort(
|
|
5953
5968
|
"operation.completed",
|
|
@@ -6027,7 +6042,7 @@ operation-id: ${operationId}`,
|
|
|
6027
6042
|
await emitCloudEventBestEffort(
|
|
6028
6043
|
"backup.completed",
|
|
6029
6044
|
{
|
|
6030
|
-
operation_id: randomUUID3(),
|
|
6045
|
+
operation_id: executionContext.forcedOperationId?.trim() || randomUUID3(),
|
|
6031
6046
|
object_id: result.objectId,
|
|
6032
6047
|
status: "succeeded",
|
|
6033
6048
|
details: {
|