mnemospark 1.0.0 → 1.1.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/cli.js CHANGED
@@ -4197,12 +4197,12 @@ var TAR_OVERHEAD_BYTES = 10 * 1024 * 1024;
4197
4197
  var QUOTE_VALIDITY_USER_NOTE = "Quotes are valid for one hour. Please run price-storage again if you need a new quote.";
4198
4198
  var MNEMOSPARK_SUPPORT_EMAIL = "pluggedin@mnemospark.ai";
4199
4199
  var CLOUD_HELP_FOOTER_STATE = "Local state: mnemospark records quotes, objects, payments, cron jobs, friendly names, and operation metadata in ~/.openclaw/mnemospark/state.db (SQLite). For troubleshooting and correlation, commands and the HTTP proxy append structured JSON lines to ~/.openclaw/mnemospark/events.jsonl. Monthly storage billing jobs are listed in ~/.openclaw/cron/jobs.json for OpenClaw scheduling.";
4200
- var REQUIRED_PRICE_STORAGE = "--wallet-address, --object-id, --object-id-hash, --gb, --provider, --region";
4201
- var REQUIRED_UPLOAD = "--quote-id, --wallet-address, --object-id, --object-id-hash";
4202
- var REQUIRED_BACKUP = "<file|directory> and --name <friendly-name>";
4203
- var REQUIRED_PAYMENT_SETTLE = "--wallet-address and (--quote-id | --renewal with --object-key)";
4204
- var REQUIRED_STORAGE_OBJECT = "--wallet-address and one of (--object-key | --name [--latest|--at])";
4205
- var REQUIRED_LS = "--wallet-address (for one object add --object-key or --name [--latest|--at]; omit both to list the bucket)";
4200
+ var REQUIRED_PRICE_STORAGE = "wallet-address:, object-id:, object-id-hash:, gb:, provider:, region:";
4201
+ var REQUIRED_UPLOAD = "quote-id:, wallet-address:, object-id:, object-id-hash:";
4202
+ var REQUIRED_BACKUP = "<file|directory> and name:<friendly-name>";
4203
+ var REQUIRED_PAYMENT_SETTLE = "wallet-address: and (quote-id: | renewal:true with object-key:)";
4204
+ var REQUIRED_STORAGE_OBJECT = "wallet-address: and one of (object-key: | name: [latest:true|at:<timestamp>])";
4205
+ var REQUIRED_LS = "wallet-address: (for one object add object-key: or name: [latest:true|at:<timestamp>]; omit both to list the bucket)";
4206
4206
  var ORCHESTRATOR_MODES = /* @__PURE__ */ new Set(["inline", "subagent"]);
4207
4207
  function expandTilde(path) {
4208
4208
  const trimmed = path.trim();
@@ -4217,66 +4217,66 @@ function expandTilde(path) {
4217
4217
  var CLOUD_HELP_TEXT = [
4218
4218
  "\u2601\uFE0F **mnemospark - Wallet and go.** \u{1F499}",
4219
4219
  "",
4220
- "**Syntax:** use `/mnemospark cloud \u2026`. Arguments may use `key:value`, `key=value`, or `--key value`. Optional verbose markers: `cloud:true`, `price-storage:true`, etc. Aliases: `wallet:` \u2192 wallet-address, `object:` \u2192 object-id, `quote:` \u2192 quote-id, `hash:` \u2192 object-id-hash.",
4220
+ "**Syntax:** use `/mnemospark cloud \u2026`. Prefer `key:value` for arguments; `key=value` and `--key value` are also accepted. Optional verbose markers: `cloud:true`, `price-storage:true`, etc. Aliases: `wallet:` \u2192 wallet-address, `object:` \u2192 object-id, `quote:` \u2192 quote-id, `hash:` \u2192 object-id-hash.",
4221
4221
  "",
4222
4222
  "**Cloud Commands**",
4223
4223
  "",
4224
4224
  "\u2022 `/mnemospark cloud` or `/mnemospark cloud help` \u2014 show this message (equivalent: `/mnemospark cloud:true help:true`)",
4225
4225
  "",
4226
- "\u2022 `/mnemospark cloud backup <file|directory> --name <friendly-name> [--async] [--orchestrator <inline|subagent>] [--timeout-seconds <n>]`",
4226
+ "\u2022 `/mnemospark cloud backup <file|directory> name:<friendly-name> [async:true] [orchestrator:<inline|subagent>] [timeout-seconds:<n>]`",
4227
4227
  " 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.",
4228
4228
  " Required: " + REQUIRED_BACKUP,
4229
4229
  "",
4230
- "\u2022 `/mnemospark cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider aws --region us-east-1`",
4231
- " Purpose: request a storage quote before upload (defaults shown; override `--provider` / `--region` for other regions).",
4230
+ "\u2022 `/mnemospark cloud price-storage wallet-address:<addr> object-id:<id> object-id-hash:<hash> gb:<gb> provider:aws region:us-east-1`",
4231
+ " Purpose: request a storage quote before upload (defaults shown; override `provider:` / `region:` for other regions).",
4232
4232
  " Required: " + REQUIRED_PRICE_STORAGE,
4233
4233
  " Shorter: `wallet:\u2026 object:\u2026 hash:\u2026 gb:\u2026 provider:\u2026 region:\u2026`",
4234
4234
  "",
4235
- "\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>]`",
4235
+ "\u2022 `/mnemospark cloud upload quote-id:<quote-id> wallet-address:<addr> object-id:<id> object-id-hash:<hash> [name:<friendly-name>] [async:true] [orchestrator:<inline|subagent>] [timeout-seconds:<n>]`",
4236
4236
  " Purpose: upload an encrypted object using a valid quote-id.",
4237
4237
  " Required: " + REQUIRED_UPLOAD,
4238
4238
  "",
4239
- "\u2022 `/mnemospark cloud payment-settle (--quote-id <quote-id> | --renewal --object-key <key>) --wallet-address <addr> [--object-id <id>] [--storage-price <n>]`",
4239
+ "\u2022 `/mnemospark cloud payment-settle (quote-id:<quote-id> | renewal:true object-key:<key>) wallet-address:<addr> [object-id:<id>] [storage-price:<n>]`",
4240
4240
  " Purpose: settle storage payment before upload (quote) or on the monthly cron (renewal, no new quote). Uses the same proxy + x402 path as upload pre-settlement.",
4241
4241
  " Required: " + REQUIRED_PAYMENT_SETTLE + " (wallet private key must match the address).",
4242
4242
  "",
4243
- "\u2022 `/mnemospark cloud ls --wallet-address <addr> [--object-key <key> | --name <friendly-name> | omit both to list bucket] [--latest|--at <timestamp>]`",
4243
+ "\u2022 `/mnemospark cloud ls wallet-address:<addr> [object-key:<key> | name:<friendly-name> | omit both to list bucket] [latest:true|at:<timestamp>]`",
4244
4244
  " Purpose: stat one object or list all keys in the wallet bucket (S3).",
4245
4245
  " Required: " + REQUIRED_LS,
4246
4246
  "",
4247
- "\u2022 `/mnemospark cloud download --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>] [--async] [--orchestrator <inline|subagent>] [--timeout-seconds <n>]`",
4247
+ "\u2022 `/mnemospark cloud download wallet-address:<addr> [object-key:<object-key> | name:<friendly-name>] [latest:true|at:<timestamp>] [async:true] [orchestrator:<inline|subagent>] [timeout-seconds:<n>]`",
4248
4248
  " Purpose: fetch an object to local disk.",
4249
4249
  " Required: " + REQUIRED_STORAGE_OBJECT,
4250
4250
  "",
4251
- "\u2022 `/mnemospark cloud delete --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>]`",
4251
+ "\u2022 `/mnemospark cloud delete wallet-address:<addr> [object-key:<object-key> | name:<friendly-name>] [latest:true|at:<timestamp>]`",
4252
4252
  " Purpose: remove a remote object and local cron tracking when present.",
4253
4253
  " Required: " + REQUIRED_STORAGE_OBJECT,
4254
4254
  "",
4255
- "\u2022 `/mnemospark cloud op-status --operation-id <id> [--cancel]`",
4255
+ "\u2022 `/mnemospark cloud op-status operation-id:<id> [cancel:true]`",
4256
4256
  " Purpose: inspect async operation status, or request cancellation for subagent runs.",
4257
- " Required: --operation-id",
4257
+ " Required: operation-id:<id>",
4258
4258
  "",
4259
4259
  "Async orchestration flags (`backup`, `upload`, `download` only):",
4260
- "\u2022 `--async`",
4260
+ "\u2022 `async:true`",
4261
4261
  " Start operation in background and return quickly with operation-id.",
4262
- "\u2022 `--orchestrator <inline|subagent>`",
4262
+ "\u2022 `orchestrator:<inline|subagent>`",
4263
4263
  " Choose async engine. Default when omitted is `inline`.",
4264
4264
  " Use `subagent` for explicit subagent session tracking and cancellation.",
4265
- "\u2022 `--timeout-seconds <n>`",
4266
- " Optional per-operation timeout. Valid only with `--async --orchestrator subagent`.",
4265
+ "\u2022 `timeout-seconds:<n>`",
4266
+ " Optional per-operation timeout. Valid only with `async:true` and `orchestrator:subagent`.",
4267
4267
  " `n` must be a positive integer (seconds).",
4268
- "\u2022 `op-status --cancel`",
4268
+ "\u2022 `op-status` with `cancel:true`",
4269
4269
  " Cancel a subagent-orchestrated operation by operation-id (idempotent).",
4270
4270
  "",
4271
4271
  "Examples:",
4272
- "\u2022 `/mnemospark cloud upload ... --async --orchestrator subagent`",
4273
- "\u2022 `/mnemospark cloud download ... --async --orchestrator subagent --timeout-seconds 900`",
4274
- "\u2022 `/mnemospark cloud op-status --operation-id <id>`",
4275
- "\u2022 `/mnemospark cloud op-status --operation-id <id> --cancel`",
4272
+ "\u2022 `/mnemospark cloud upload ... async:true orchestrator:subagent`",
4273
+ "\u2022 `/mnemospark cloud download ... async:true orchestrator:subagent timeout-seconds:900`",
4274
+ "\u2022 `/mnemospark cloud op-status operation-id:<id>`",
4275
+ "\u2022 `/mnemospark cloud op-status operation-id:<id> cancel:true`",
4276
4276
  "",
4277
4277
  CLOUD_HELP_FOOTER_STATE,
4278
4278
  "",
4279
- "Backup uses your configured mnemospark wallet key (no `--wallet-address` flag). Commands price-storage, upload, ls, download, delete, and payment-settle require `--wallet-address` on the command line (must match that wallet)."
4279
+ "Backup uses your configured mnemospark wallet key (no `wallet-address:` argument). Commands price-storage, upload, ls, download, delete, and payment-settle require `wallet-address:<addr>` (or `wallet:<addr>`) on the command line (must match that wallet)."
4280
4280
  ].join("\n");
4281
4281
  var UnsupportedBackupPlatformError = class extends Error {
4282
4282
  constructor(platform) {
@@ -4397,7 +4397,7 @@ function parseAsyncOperationArgs(flags) {
4397
4397
  timeoutSeconds: parsedTimeoutSeconds === void 0 ? void 0 : parsedTimeoutSeconds
4398
4398
  };
4399
4399
  }
4400
- var INVALID_ASYNC_FLAGS_MESSAGE = "invalid async flags. `--orchestrator`/`--timeout-seconds` require `--async`, and `--timeout-seconds` is only valid with `--orchestrator subagent`.";
4400
+ var INVALID_ASYNC_FLAGS_MESSAGE = "invalid async flags. `orchestrator:` and `timeout-seconds:` require `async:true`, and `timeout-seconds:` is only valid with `orchestrator:subagent`.";
4401
4401
  function stripAsyncControlFlags(args) {
4402
4402
  const tokens = tokenizeArgsRaw(args ?? "");
4403
4403
  const filtered = [];
@@ -4793,7 +4793,7 @@ async function resolveLocalUploadArchivePath(backupDir, objectId, friendlyName)
4793
4793
  } catch {
4794
4794
  return {
4795
4795
  ok: false,
4796
- message: `Cannot upload storage object: local archive not found. Run /mnemospark cloud backup with --name (canonical layout) or restore the legacy file at ${legacyPath}.`
4796
+ message: `Cannot upload storage object: local archive not found. Run /mnemospark cloud backup with name:<friendly-name> (canonical layout) or restore the legacy file at ${legacyPath}.`
4797
4797
  };
4798
4798
  }
4799
4799
  }
@@ -5353,8 +5353,11 @@ async function maybeCleanupLocalBackupArchive(archivePath) {
5353
5353
  } catch {
5354
5354
  }
5355
5355
  }
5356
+ function formatMnemosparkCommandCopyBlock(commandLine) {
5357
+ return ["```", commandLine, "```"].join("\n");
5358
+ }
5356
5359
  function formatStorageUploadUserMessage(upload, cronJobId) {
5357
- const lsLine = `/mnemospark cloud ls --wallet-address \`${upload.addr}\``;
5360
+ const lsCommand = `/mnemospark cloud ls wallet-address:${upload.addr}`;
5358
5361
  return [
5359
5362
  `Your file \`${upload.object_id}\` with key \`${upload.object_key}\` has been stored using \`${upload.provider}\` in folder \`${upload.bucket_name}\` in region \`${upload.location}\``,
5360
5363
  "",
@@ -5362,7 +5365,7 @@ function formatStorageUploadUserMessage(upload, cronJobId) {
5362
5365
  "",
5363
5366
  "To view your cloud storage run the command:",
5364
5367
  "",
5365
- lsLine,
5368
+ formatMnemosparkCommandCopyBlock(lsCommand),
5366
5369
  "",
5367
5370
  "Thank you for using mnemospark!",
5368
5371
  `Reach out if you need anything: ${MNEMOSPARK_SUPPORT_EMAIL}`
@@ -5412,13 +5415,13 @@ function extractLsErrorMessage(error) {
5412
5415
  return null;
5413
5416
  }
5414
5417
  function formatPriceStorageUserMessage(quote, localArchiveHint) {
5415
- const uploadLine = `/mnemospark cloud upload --quote-id \`${quote.quote_id}\` --wallet-address \`${quote.addr}\` --object-id \`${quote.object_id}\` --object-id-hash \`${quote.object_id_hash}\``;
5418
+ const uploadCommand = `/mnemospark cloud upload quote-id:${quote.quote_id} wallet-address:${quote.addr} object-id:${quote.object_id} object-id-hash:${quote.object_id_hash}`;
5416
5419
  const lines = [
5417
5420
  `Your storage quote \`${quote.quote_id}\`: storage price \`$${quote.storage_price}\` for file \`${quote.object_id}\` with file size \`${quote.object_size_gb}\` in \`${quote.provider}\` \`${quote.location}\`.`,
5418
5421
  "",
5419
5422
  "If you accept this quote, run:",
5420
5423
  "",
5421
- uploadLine,
5424
+ formatMnemosparkCommandCopyBlock(uploadCommand),
5422
5425
  ""
5423
5426
  ];
5424
5427
  if (localArchiveHint?.trim()) {
@@ -5437,7 +5440,7 @@ var DEFAULT_BACKUP_QUOTE_PROVIDER = "aws";
5437
5440
  var DEFAULT_BACKUP_QUOTE_REGION = "us-east-1";
5438
5441
  function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
5439
5442
  const hash = result.objectIdHash.replace(/\s/g, "");
5440
- 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}`;
5443
+ const priceStorageCommand = `/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}`;
5441
5444
  return [
5442
5445
  `Backup archive: \`${result.archivePath}\``,
5443
5446
  "",
@@ -5448,15 +5451,15 @@ function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
5448
5451
  "",
5449
5452
  "Next, request a storage quote.",
5450
5453
  "",
5451
- priceStorageLine,
5454
+ formatMnemosparkCommandCopyBlock(priceStorageCommand),
5452
5455
  "",
5453
5456
  `The default region is ${DEFAULT_BACKUP_QUOTE_REGION}. Change the command parameters to switch regions (not required).`,
5454
5457
  "",
5455
5458
  "Region examples (merge into the command above):",
5456
- "North America: `--provider aws --region us-east-1`",
5457
- "Europe: `--provider aws --region eu-north-1`",
5458
- "South America: `--provider aws --region sa-east-1`",
5459
- "Asia Pacific: `--provider aws --region ap-northeast-1`"
5459
+ "North America: `provider:aws region:us-east-1`",
5460
+ "Europe: `provider:aws region:eu-north-1`",
5461
+ "South America: `provider:aws region:sa-east-1`",
5462
+ "Asia Pacific: `provider:aws region:ap-northeast-1`"
5460
5463
  ].join("\n");
5461
5464
  }
5462
5465
  function createInProcessSubagentOrchestrator() {
@@ -5937,7 +5940,7 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
5937
5940
  }
5938
5941
  if (parsed.mode === "payment-settle-invalid") {
5939
5942
  return {
5940
- text: `Cannot settle payment: required arguments are ${REQUIRED_PAYMENT_SETTLE}. Optional: --object-id, --storage-price.`,
5943
+ text: `Cannot settle payment: required arguments are ${REQUIRED_PAYMENT_SETTLE}. Optional: object-id:, storage-price:.`,
5941
5944
  isError: true
5942
5945
  };
5943
5946
  }
@@ -5967,7 +5970,7 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
5967
5970
  }
5968
5971
  if (parsed.mode === "op-status-invalid") {
5969
5972
  return {
5970
- text: "Cannot get operation status: required arguments are --operation-id.",
5973
+ text: "Cannot get operation status: required arguments are operation-id:<id>.",
5971
5974
  isError: true
5972
5975
  };
5973
5976
  }
@@ -6103,7 +6106,7 @@ ${operation.result_text}` : meta;
6103
6106
  const walletAccount = privateKeyToAccount5(walletKey);
6104
6107
  if (walletAccount.address.toLowerCase() !== req.wallet_address.toLowerCase()) {
6105
6108
  return {
6106
- text: `Cannot settle payment: wallet key address ${walletAccount.address} does not match --wallet-address ${req.wallet_address}.`,
6109
+ text: `Cannot settle payment: wallet key address ${walletAccount.address} does not match wallet-address: ${req.wallet_address}.`,
6107
6110
  isError: true
6108
6111
  };
6109
6112
  }
@@ -6197,7 +6200,7 @@ ${operation.result_text}` : meta;
6197
6200
  });
6198
6201
  const label = req.renewal ? `object ${req.object_key}` : `quote ${req.quote_id}`;
6199
6202
  return {
6200
- text: transId ? `Payment settled for ${label} (trans_id: ${transId}).` : `Payment settled for ${label}.`
6203
+ text: transId ? `Payment settled for ${label} (trans-id: ${transId}).` : `Payment settled for ${label}.`
6201
6204
  };
6202
6205
  }
6203
6206
  await datastore.upsertPayment({
@@ -6453,14 +6456,20 @@ ${operation.result_text}` : meta;
6453
6456
  error_message: operationAfterDispatch?.error_message ?? null
6454
6457
  });
6455
6458
  }
6459
+ const subagentMetaLines = [
6460
+ `Operation started in background. operation-id: ${operationId}`,
6461
+ `orchestrator: subagent`,
6462
+ `subagent-session-id: ${dispatchResult.sessionId}`,
6463
+ timeoutSeconds ? `timeout-seconds: ${timeoutSeconds}` : null
6464
+ ].filter((line) => Boolean(line));
6456
6465
  return {
6457
6466
  text: [
6458
- `Operation started in background. operation-id: ${operationId}`,
6459
- `orchestrator: subagent`,
6460
- `subagent-session-id: ${dispatchResult.sessionId}`,
6461
- timeoutSeconds ? `timeout-seconds: ${timeoutSeconds}` : null,
6462
- `Use /mnemospark cloud op-status --operation-id ${operationId}`
6463
- ].filter((line) => Boolean(line)).join("\n")
6467
+ ...subagentMetaLines,
6468
+ "",
6469
+ formatMnemosparkCommandCopyBlock(
6470
+ `/mnemospark cloud op-status operation-id:${operationId}`
6471
+ )
6472
+ ].join("\n")
6464
6473
  };
6465
6474
  } catch (dispatchError) {
6466
6475
  const dispatchMessage = dispatchError instanceof Error ? dispatchError.message : String(dispatchError);
@@ -6562,7 +6571,8 @@ operation-id: ${operationId}`,
6562
6571
  text: [
6563
6572
  `Operation started in background. operation-id: ${operationId}`,
6564
6573
  `orchestrator: inline`,
6565
- `Use /mnemospark cloud op-status --operation-id ${operationId}`
6574
+ "",
6575
+ formatMnemosparkCommandCopyBlock(`/mnemospark cloud op-status operation-id:${operationId}`)
6566
6576
  ].join("\n")
6567
6577
  };
6568
6578
  }
@@ -6795,7 +6805,7 @@ operation-id: ${operationId}`,
6795
6805
  const walletAccount = privateKeyToAccount5(walletKey);
6796
6806
  if (walletAccount.address.toLowerCase() !== parsed.uploadRequest.wallet_address.toLowerCase()) {
6797
6807
  return {
6798
- text: `Cannot upload storage object: wallet key address ${walletAccount.address} does not match --wallet-address ${parsed.uploadRequest.wallet_address}.`,
6808
+ text: `Cannot upload storage object: wallet key address ${walletAccount.address} does not match wallet-address: ${parsed.uploadRequest.wallet_address}.`,
6799
6809
  isError: true
6800
6810
  };
6801
6811
  }