mnemospark 1.1.0 → 1.2.1

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 CHANGED
@@ -52,9 +52,32 @@ openclaw gateway restart
52
52
 
53
53
  ---
54
54
 
55
+ ## Slash command reference
56
+
57
+ **Syntax**
58
+
59
+ - **Chat / OpenClaw (primary):** use `key:value` for arguments (for example `wallet-address:0x…`, `region:us-east-1`). `key=value` is also accepted.
60
+ - **Agent-driven workflows and CLI-style usage:** prefer `--parameter value` (as in the Core Commands examples and `npx mnemospark`).
61
+
62
+ **Top-level routes** (after `/mnemospark`)
63
+
64
+ - `/mnemospark` or `/mnemospark help` — overview
65
+ - `/mnemospark cloud …` — cloud storage (see below)
66
+ - `/mnemospark wallet …` — wallet helpers
67
+
68
+ **`/mnemospark cloud`** — includes: `cloud` / `cloud help`, `backup`, `price-storage`, `upload`, `payment-settle`, `ls`, `download`, `delete`, `op-status`. Optional flags include `async:true`, `orchestrator:inline|subagent`, `timeout-seconds:<n>`. For the full cloud guide, run `/mnemospark cloud help` in chat.
69
+
70
+ **`/mnemospark wallet`**
71
+
72
+ - `/mnemospark wallet` — address, balance, and key file path
73
+ - `/mnemospark wallet help` — command list and funding link
74
+ - `/mnemospark wallet export` — export private key for backup (sensitive)
75
+
76
+ ---
77
+
55
78
  ## Core Commands
56
79
 
57
- Use via `/mnemospark cloud …` (or `/mnemospark wallet …`) in OpenClaw chat.
80
+ Use via `/mnemospark cloud …` (or `/mnemospark wallet …`) in OpenClaw chat. Prefer `key:value` in chat; use `--wallet-address` style for scripted or agent-driven flows.
58
81
 
59
82
  ### Get a storage quote
60
83
 
@@ -128,6 +151,7 @@ Optional unless noted. All names use the `MNEMOSPARK_` prefix.
128
151
  | `MNEMOSPARK_DISABLED` | Set to `true` or `1` to disable plugin registration. |
129
152
  | `MNEMOSPARK_DISABLE_SQLITE` | Set to `1` to disable local SQLite (`state.db`); cloud commands that need local state will fail. |
130
153
  | `MNEMOSPARK_SQLITE_STRICT` | Set to `1` so certain SQLite consistency checks (e.g. friendly-name verification after upload) throw instead of warning. |
154
+ | `MNEMOSPARK_PROXY_VERBOSE_404` | When `1`, `true`, or `yes`, the local HTTP proxy includes a `message` field on **404** responses describing supported paths. Default (unset) is a generic JSON body `{ "error": "Not found" }` only (reduces reconnaissance). |
131
155
 
132
156
  ---
133
157
 
package/dist/cli.js CHANGED
@@ -157,6 +157,10 @@ var PROXY_PORT = (() => {
157
157
  return DEFAULT_PORT;
158
158
  })();
159
159
  var MNEMOSPARK_BACKEND_API_BASE_URL = (process.env.MNEMOSPARK_BACKEND_API_BASE_URL ?? "").trim();
160
+ var MNEMOSPARK_PROXY_VERBOSE_404 = (() => {
161
+ const v = process.env.MNEMOSPARK_PROXY_VERBOSE_404?.trim().toLowerCase();
162
+ return v === "1" || v === "true" || v === "yes";
163
+ })();
160
164
 
161
165
  // src/mnemospark-request-sign.ts
162
166
  import { getAddress } from "viem";
@@ -1733,8 +1737,15 @@ async function readProxyJsonBody(req) {
1733
1737
  }
1734
1738
  return JSON.parse(bodyText);
1735
1739
  }
1740
+ function createJsonResponseHeaders() {
1741
+ return {
1742
+ "Content-Type": "application/json",
1743
+ "X-Content-Type-Options": "nosniff",
1744
+ "Cache-Control": "no-store"
1745
+ };
1746
+ }
1736
1747
  function sendJson(res, status, body) {
1737
- res.writeHead(status, { "Content-Type": "application/json" });
1748
+ res.writeHead(status, createJsonResponseHeaders());
1738
1749
  res.end(JSON.stringify(body));
1739
1750
  }
1740
1751
  function logProxyEvent(level, event, fields = {}) {
@@ -1794,7 +1805,9 @@ function isAlreadySettledConflict(status, bodyText) {
1794
1805
  }
1795
1806
  function createBackendForwardHeaders(response) {
1796
1807
  const responseHeaders = {
1797
- "Content-Type": response.contentType
1808
+ "Content-Type": response.contentType,
1809
+ "X-Content-Type-Options": "nosniff",
1810
+ "Cache-Control": "no-store"
1798
1811
  };
1799
1812
  if (response.paymentRequired) {
1800
1813
  responseHeaders["PAYMENT-REQUIRED"] = response.paymentRequired;
@@ -1832,6 +1845,10 @@ function createWalletRequiredBody() {
1832
1845
  message: "wallet required for storage endpoints"
1833
1846
  });
1834
1847
  }
1848
+ function sendWalletRequired(res) {
1849
+ res.writeHead(400, createJsonResponseHeaders());
1850
+ res.end(createWalletRequiredBody());
1851
+ }
1835
1852
  function getProxyPort() {
1836
1853
  return PROXY_PORT;
1837
1854
  }
@@ -1931,6 +1948,18 @@ async function startProxy(options) {
1931
1948
  }
1932
1949
  correlation.wallet_address = requestPayload.wallet_address;
1933
1950
  correlation.object_id = requestPayload.object_id;
1951
+ if (requestPayload.wallet_address.toLowerCase() !== proxyWalletAddressLower) {
1952
+ logProxyEvent("warn", "proxy_price_storage_wallet_mismatch", {
1953
+ request_wallet: requestPayload.wallet_address,
1954
+ proxy_wallet: account.address
1955
+ });
1956
+ emitProxyTerminalFromStatus(correlation, 403, { reason: "wallet_mismatch" });
1957
+ sendJson(res, 403, {
1958
+ error: "wallet_proof_invalid",
1959
+ message: "wallet proof invalid"
1960
+ });
1961
+ return;
1962
+ }
1934
1963
  emitProxyEvent("storage.call", "start", correlation, { target: "price-storage" });
1935
1964
  const walletSignature = await createBackendWalletSignature(
1936
1965
  "POST",
@@ -1939,8 +1968,7 @@ async function startProxy(options) {
1939
1968
  );
1940
1969
  if (!walletSignature) {
1941
1970
  logProxyEvent("warn", "proxy_price_storage_wallet_signature_missing");
1942
- res.writeHead(400, { "Content-Type": "application/json" });
1943
- res.end(createWalletRequiredBody());
1971
+ sendWalletRequired(res);
1944
1972
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
1945
1973
  return;
1946
1974
  }
@@ -2089,8 +2117,7 @@ async function startProxy(options) {
2089
2117
  );
2090
2118
  if (!walletSignature) {
2091
2119
  logProxyEvent("warn", "proxy_payment_settle_wallet_signature_missing");
2092
- res.writeHead(400, { "Content-Type": "application/json" });
2093
- res.end(createWalletRequiredBody());
2120
+ sendWalletRequired(res);
2094
2121
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2095
2122
  return;
2096
2123
  }
@@ -2198,8 +2225,7 @@ async function startProxy(options) {
2198
2225
  );
2199
2226
  if (!walletSignature) {
2200
2227
  logProxyEvent("warn", "proxy_upload_wallet_signature_missing");
2201
- res.writeHead(400, { "Content-Type": "application/json" });
2202
- res.end(createWalletRequiredBody());
2228
+ sendWalletRequired(res);
2203
2229
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2204
2230
  return;
2205
2231
  }
@@ -2246,8 +2272,7 @@ async function startProxy(options) {
2246
2272
  );
2247
2273
  if (!settleWalletSignature) {
2248
2274
  logProxyEvent("warn", "proxy_upload_settle_signature_missing");
2249
- res.writeHead(400, { "Content-Type": "application/json" });
2250
- res.end(createWalletRequiredBody());
2275
+ sendWalletRequired(res);
2251
2276
  emitProxyTerminalFromStatus(correlation, 400, { reason: "settle_signature_missing" });
2252
2277
  return;
2253
2278
  }
@@ -2387,8 +2412,7 @@ async function startProxy(options) {
2387
2412
  );
2388
2413
  if (!walletSignature) {
2389
2414
  logProxyEvent("warn", "proxy_upload_confirm_wallet_signature_missing");
2390
- res.writeHead(400, { "Content-Type": "application/json" });
2391
- res.end(createWalletRequiredBody());
2415
+ sendWalletRequired(res);
2392
2416
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2393
2417
  return;
2394
2418
  }
@@ -2482,8 +2506,7 @@ async function startProxy(options) {
2482
2506
  );
2483
2507
  if (!walletSignature) {
2484
2508
  logProxyEvent("warn", "proxy_ls_wallet_signature_missing");
2485
- res.writeHead(400, { "Content-Type": "application/json" });
2486
- res.end(createWalletRequiredBody());
2509
+ sendWalletRequired(res);
2487
2510
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2488
2511
  return;
2489
2512
  }
@@ -2577,8 +2600,7 @@ async function startProxy(options) {
2577
2600
  );
2578
2601
  if (!walletSignature) {
2579
2602
  logProxyEvent("warn", "proxy_download_wallet_signature_missing");
2580
- res.writeHead(400, { "Content-Type": "application/json" });
2581
- res.end(createWalletRequiredBody());
2603
+ sendWalletRequired(res);
2582
2604
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2583
2605
  return;
2584
2606
  }
@@ -2694,8 +2716,7 @@ async function startProxy(options) {
2694
2716
  );
2695
2717
  if (!walletSignature) {
2696
2718
  logProxyEvent("warn", "proxy_delete_wallet_signature_missing");
2697
- res.writeHead(400, { "Content-Type": "application/json" });
2698
- res.end(createWalletRequiredBody());
2719
+ sendWalletRequired(res);
2699
2720
  emitProxyTerminalFromStatus(correlation, 400, { reason: "wallet_signature_missing" });
2700
2721
  return;
2701
2722
  }
@@ -2765,10 +2786,14 @@ async function startProxy(options) {
2765
2786
  sendJson(res, 200, response);
2766
2787
  return;
2767
2788
  }
2768
- sendJson(res, 404, {
2769
- error: "Not found",
2770
- message: "Supported paths: /health and /mnemospark/* storage endpoints"
2771
- });
2789
+ if (MNEMOSPARK_PROXY_VERBOSE_404) {
2790
+ sendJson(res, 404, {
2791
+ error: "Not found",
2792
+ message: "Supported paths: /health and /mnemospark/* storage endpoints"
2793
+ });
2794
+ } else {
2795
+ sendJson(res, 404, { error: "Not found" });
2796
+ }
2772
2797
  });
2773
2798
  const tryListen = (attempt) => {
2774
2799
  return new Promise((resolveAttempt, rejectAttempt) => {
@@ -2969,6 +2994,15 @@ var USER_AGENT = `mnemospark/${VERSION}`;
2969
2994
  import { existsSync, readFileSync } from "fs";
2970
2995
  import { privateKeyToAccount as privateKeyToAccount6 } from "viem/accounts";
2971
2996
 
2997
+ // src/cloud-help-onboarding.ts
2998
+ var CLOUD_ONBOARDING_BLOCK_LINES = [
2999
+ "",
3000
+ "Start here to securely upload a file and we'll guide you along the way. Copy the line below and replace <file|directory> with the file or directory you'd like to save to the cloud and replace <friendly-name> with an easy to remember name.",
3001
+ "",
3002
+ "`/mnemospark cloud backup <file|directory> name:<friendly-name> async:true`",
3003
+ ""
3004
+ ];
3005
+
2972
3006
  // src/cloud-command.ts
2973
3007
  import { spawn } from "child_process";
2974
3008
  import {
@@ -4216,7 +4250,7 @@ function expandTilde(path) {
4216
4250
  }
4217
4251
  var CLOUD_HELP_TEXT = [
4218
4252
  "\u2601\uFE0F **mnemospark - Wallet and go.** \u{1F499}",
4219
- "",
4253
+ ...CLOUD_ONBOARDING_BLOCK_LINES,
4220
4254
  "**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
4255
  "",
4222
4256
  "**Cloud Commands**",
@@ -7314,17 +7348,21 @@ operation-id: ${operationId}`,
7314
7348
  // src/mnemospark-handler.ts
7315
7349
  var MNEMOSPARK_ROOT_HELP_TEXT = [
7316
7350
  "\u2601\uFE0F **mnemospark - Wallet and go.** \u{1F499}",
7351
+ ...CLOUD_ONBOARDING_BLOCK_LINES,
7352
+ "To view the full help menu use these commands:",
7317
7353
  "",
7318
- "**Syntax:** `/mnemospark cloud \u2026` or `/mnemospark wallet \u2026`",
7319
- "Arguments may use `key:value`, `key=value`, or `--key value`. Optional verbose markers: `cloud:true`, `price-storage:true`, etc. (same as bare words).",
7320
- "Aliases include `wallet:` \u2192 wallet-address, `object:` \u2192 object-id, `quote:` \u2192 quote-id (see `/mnemospark cloud help`).",
7321
- "",
7322
- "**Cloud storage** \u2014 full reference:",
7354
+ "**Cloud storage**",
7323
7355
  "\u2022 `/mnemospark cloud help`",
7324
7356
  "",
7325
- "**Wallet** \u2014 status:",
7357
+ "**Wallet status and funding link:**",
7326
7358
  "\u2022 `/mnemospark wallet`",
7327
- "\u2022 `/mnemospark wallet help` \u2014 commands and funding link"
7359
+ "\u2022 `/mnemospark wallet help`",
7360
+ "",
7361
+ "**Let your agent run mnemospark for you:**",
7362
+ "",
7363
+ "mnemospark installs as an OpenClaw extension under `~/.openclaw/extensions/mnemospark/`. Point your agent at the bundled skill:",
7364
+ "",
7365
+ "Install the mnemospark skill available at `~/.openclaw/extensions/mnemospark/skills/mnemospark/SKILL.md`"
7328
7366
  ].join("\n");
7329
7367
  var MNEMOSPARK_WALLET_HELP_TEXT = (address) => [
7330
7368
  "\u2601\uFE0F **mnemospark Wallet**",