mnemospark 1.3.0 → 1.5.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,6 +52,20 @@ openclaw gateway restart
52
52
 
53
53
  ---
54
54
 
55
+ ## OpenClaw Install Warning
56
+
57
+ If OpenClaw shows a warning about **dangerous code patterns** when installing or updating mnemospark—often mentioning shell execution (`child_process`), environment variables, and network access—here is what is going on.
58
+
59
+ mnemospark is an **OpenClaw plugin** that talks to **your configured mnemospark backend**, runs a **local HTTP proxy** for storage workflows, and can **invoke the `openclaw` CLI** and system tools when needed (for example creating archives with `tar` or running `npm` when you use the update command). Those features use the same low-level Node.js APIs—`child_process` and `fetch`—that security tools also associate with risky software, so the installer may warn you even when the behavior is intentional and benign.
60
+
61
+ We also read **environment variables** you set on purpose (such as `MNEMOSPARK_BACKEND_API_BASE_URL`, `MNEMOSPARK_PROXY_PORT`, or wallet-related settings) so you can configure the plugin without editing code. Automated scans sometimes flag “environment access + network” as a possible credential-stealing pattern. In mnemospark, that combination exists because the plugin is **configurable and networked by design**, not because we are harvesting your unrelated secrets.
62
+
63
+ mnemospark is **open source**. If you want extra assurance, review the repository, search for `child_process`, `process.env`, and `fetch`, and run your own tests in a safe environment. The warning helps keep the ecosystem safe; for mnemospark it reflects **capabilities**, not a finding of malicious intent.
64
+
65
+ Have ChatGPT or your favorite LLM evaluate the mnemospark codebase. Here's a [starter link](https://chatgpt.com/share/69ce6119-52cc-8394-b9f9-c06528d85ea7).
66
+
67
+ ---
68
+
55
69
  ## Slash command reference
56
70
 
57
71
  **Syntax**
@@ -93,8 +107,6 @@ Use other regions by changing `provider:` and `region:` (defaults: `aws` / `us-e
93
107
  /mnemospark cloud upload quote-id:<quote-id> wallet-address:<addr> object-id:<id> object-id-hash:<sha256>
94
108
  ```
95
109
 
96
- On **OpenClaw 2026.4.x**, the first successful upload applies the **Mnemospark Renewal Agent Runbook** for you: it ensures a dedicated agent (`mnemospark-renewal` by default) with `tools.deny: ["subagents"]` and `tools.exec.ask: "off"`, updates `~/.openclaw/exec-approvals.json` so `/usr/bin/node` is allowlisted for that agent, runs `openclaw config validate`, and best-effort `openclaw gateway restart`. It then registers the monthly renewal cron with `--no-deliver`, `--agent`, and a `Command: /usr/bin/node …/dist/cli.js cloud payment-settle --renewal …` message. Override paths with `MNEMOSPARK_CRON_AGENT_ID` and `MNEMOSPARK_CRON_NODE_BIN` if your system differs.
97
-
98
110
  ### List objects
99
111
 
100
112
  ```text
@@ -156,8 +168,7 @@ Optional unless noted. All names use the `MNEMOSPARK_` prefix.
156
168
  | `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). |
157
169
  | `MNEMOSPARK_CRON_AGENT_ID` | OpenClaw agent id used for the monthly renewal cron (default `mnemospark-renewal`). |
158
170
  | `MNEMOSPARK_CRON_NODE_BIN` | Absolute path to `node` for renewal cron exec (default `/usr/bin/node`). |
159
- | `MNEMOSPARK_DISABLE_OPENCLAW_PREREQ` | Set to `1` to skip automatic runbook application (for advanced debugging only). |
160
- | `MNEMOSPARK_SKIP_GATEWAY_RESTART` | Set to `1` to skip best-effort `openclaw gateway restart` after prerequisite writes. |
171
+ | `MNEMOSPARK_DISABLE_OPENCLAW_PREREQ` | Set to `1` to skip automatic runbook application everywhere it runs (plugin load, CLI install/update; for advanced debugging only). |
161
172
 
162
173
  ---
163
174
 
@@ -171,15 +182,9 @@ Optional unless noted. All names use the `MNEMOSPARK_` prefix.
171
182
 
172
183
  ---
173
184
 
174
- ## OpenClaw Install Warning
175
-
176
- If OpenClaw shows a warning about **dangerous code patterns** when installing or updating mnemospark—often mentioning shell execution (`child_process`), environment variables, and network access—here is what is going on.
185
+ ## mnemospark Exec Approvals Runbook
177
186
 
178
- mnemospark is an **OpenClaw plugin** that talks to **your configured mnemospark backend**, runs a **local HTTP proxy** for storage workflows, and can **invoke the `openclaw` CLI** and system tools when needed (for example creating archives with `tar` or running `npm` when you use the update command). Those features use the same low-level Node.js APIs—`child_process` and `fetch`—that security tools also associate with risky software, so the installer may warn you even when the behavior is intentional and benign.
179
-
180
- We also read **environment variables** you set on purpose (such as `MNEMOSPARK_BACKEND_API_BASE_URL`, `MNEMOSPARK_PROXY_PORT`, or wallet-related settings) so you can configure the plugin without editing code. Automated scans sometimes flag “environment access + network” as a possible credential-stealing pattern. In mnemospark, that combination exists because the plugin is **configurable and networked by design**, not because we are harvesting your unrelated secrets.
181
-
182
- mnemospark is **open source**. If you want extra assurance, review the repository, search for `child_process`, `process.env`, and `fetch`, and run your own tests in a safe environment. The warning helps keep the ecosystem safe; for mnemospark it reflects **capabilities**, not a finding of malicious intent.
187
+ On **OpenClaw 2026.4.x**, the **Mnemospark Renewal Agent Runbook** is applied when you install or update mnemospark (including `npx mnemospark install`, `npx mnemospark update`, `openclaw plugins install`, and when the gateway loads the plugin): it ensures a dedicated agent (`mnemospark-renewal` by default) with `tools.deny: ["subagents"]` and `tools.exec.ask: "off"`, updates `~/.openclaw/exec-approvals.json` so `/usr/bin/node` is allowlisted for that agent, and runs `openclaw config validate`. OpenClaw restarts the gateway when a plugin is installed or updated; mnemospark does not call `openclaw gateway restart` itself. After a **successful upload**, mnemospark registers the monthly renewal cron only (`--no-deliver`, `--agent`, and a `Command: /usr/bin/node …/dist/cli.js cloud payment-settle --renewal …` message). Override paths with `MNEMOSPARK_CRON_AGENT_ID` and `MNEMOSPARK_CRON_NODE_BIN` if your system differs.
183
188
 
184
189
  ---
185
190
 
@@ -189,6 +194,7 @@ mnemospark is **open source**. If you want extra assurance, review the repositor
189
194
  - **402 payment required**: expected in challenge flow; ensure client retries with payment authorization.
190
195
  - **Upload/storage backend errors**: verify cloud permissions (e.g. bucket access + IAM role rights).
191
196
  - **Command not recognized**: confirm plugin installed and gateway restarted.
197
+ - **Renewal cron / exec failures after upload**: ensure mnemospark was installed or updated through the normal path so the runbook ran (gateway load, `npx mnemospark install`, or `openclaw plugins install`). If the gateway never loaded the plugin, run install again or restart the gateway.
192
198
  - **One-step operation correlation**: run `./skills/mnemospark/scripts/debug-operation.sh <operation-id>` (or omit ID to use latest).
193
199
 
194
200
  ---
package/dist/cli.js CHANGED
@@ -3211,6 +3211,20 @@ function renderHeader(w) {
3211
3211
  HDR_FILE_OR_KEY
3212
3212
  ].join(" ");
3213
3213
  }
3214
+ function formatLsCommandCopyBlock(commandLine) {
3215
+ return ["```", commandLine, "```"].join("\n");
3216
+ }
3217
+ function formatLsWhatsNextFooter(walletAddress) {
3218
+ const downloadLine = `/mnemospark cloud download wallet-address:${walletAddress} [object-key:<object-key> | name:<friendly-name>] [latest:true|at:<timestamp>] [async:true] [orchestrator:<inline|subagent>] [timeout-seconds:<n>]`;
3219
+ const deleteLine = `/mnemospark cloud delete wallet-address:${walletAddress} [object-key:<object-key> | name:<friendly-name>] [latest:true|at:<timestamp>]`;
3220
+ return [
3221
+ "What's next? Would you like to download or delete a file:",
3222
+ "",
3223
+ formatLsCommandCopyBlock(downloadLine),
3224
+ "",
3225
+ formatLsCommandCopyBlock(deleteLine)
3226
+ ].join("\n");
3227
+ }
3214
3228
  async function buildMnemosparkLsMessage(result, ctx) {
3215
3229
  const now = ctx.now ?? /* @__PURE__ */ new Date();
3216
3230
  if (isStorageLsListResponse(result)) {
@@ -3227,7 +3241,9 @@ async function buildMnemosparkLsMessage(result, ctx) {
3227
3241
  const fence2 = ["```", [header2, ...bodyLines].join("\n"), "```"].join("\n");
3228
3242
  return `${prose2}
3229
3243
 
3230
- ${fence2}`;
3244
+ ${fence2}
3245
+
3246
+ ${formatLsWhatsNextFooter(ctx.walletAddress)}`;
3231
3247
  }
3232
3248
  const friendly = await ctx.datastore.findLatestFriendlyNameForObjectKey(
3233
3249
  ctx.walletAddress,
@@ -3264,7 +3280,9 @@ ${fence2}`;
3264
3280
  const fence = ["```", [header, line].join("\n"), "```"].join("\n");
3265
3281
  return `${prose}
3266
3282
 
3267
- ${fence}`;
3283
+ ${fence}
3284
+
3285
+ ${formatLsWhatsNextFooter(ctx.walletAddress)}`;
3268
3286
  }
3269
3287
 
3270
3288
  // src/cloud-datastore.ts
@@ -4392,7 +4410,7 @@ async function ensureOpenClawRenewalPrerequisites(options = {}) {
4392
4410
  parsed = JSON.parse(configRaw);
4393
4411
  } catch {
4394
4412
  throw new Error(
4395
- `openclaw.json at ${configPath} is not valid JSON; fix or remove it before upload.`
4413
+ `openclaw.json at ${configPath} is not valid JSON; fix or remove it before applying renewal prerequisites.`
4396
4414
  );
4397
4415
  }
4398
4416
  const agents = isRecord(parsed.agents) ? parsed.agents : {};
@@ -4424,13 +4442,6 @@ async function ensureOpenClawRenewalPrerequisites(options = {}) {
4424
4442
  await writeFileAtomic(execPath, `${JSON.stringify(mergedExec, null, 2)}
4425
4443
  `);
4426
4444
  }
4427
- const skipRestart = options.skipGatewayRestart ?? process.env.MNEMOSPARK_SKIP_GATEWAY_RESTART === "1";
4428
- if (!skipRestart && (agentChanged || execChanged)) {
4429
- try {
4430
- await runOpenClawCli(["gateway", "restart", "--json"], homeDir);
4431
- } catch {
4432
- }
4433
- }
4434
4445
  }
4435
4446
 
4436
4447
  // src/cloud-command.ts
@@ -5335,7 +5346,6 @@ async function removeStoragePaymentCronJob(cronId, adapter) {
5335
5346
  return adapter.remove(cronId);
5336
5347
  }
5337
5348
  async function createStoragePaymentCronJob(upload, storagePrice, openClawCronAdapter, openClawHomeDir, nowDateFn = () => /* @__PURE__ */ new Date()) {
5338
- await ensureOpenClawRenewalPrerequisites({ homeDir: openClawHomeDir });
5339
5349
  const renewalFields = {
5340
5350
  walletAddress: upload.addr,
5341
5351
  objectId: upload.object_id,
@@ -7950,6 +7960,14 @@ async function promptOrRunOpenClawPluginInstall() {
7950
7960
  });
7951
7961
  if (exitCode === 0) {
7952
7962
  await ensureMnemosparkInPluginsAllow();
7963
+ try {
7964
+ await ensureOpenClawRenewalPrerequisites();
7965
+ } catch (err) {
7966
+ console.warn(
7967
+ "[mnemospark] Renewal prerequisites:",
7968
+ err instanceof Error ? err.message : String(err)
7969
+ );
7970
+ }
7953
7971
  } else {
7954
7972
  console.log(
7955
7973
  "\n[mnemospark] OpenClaw plugin install did not succeed. Run manually: openclaw plugins install mnemospark"
@@ -8049,6 +8067,14 @@ async function runUpdate() {
8049
8067
  try {
8050
8068
  execSync(`npm install mnemospark@${latest}`, { stdio: "inherit" });
8051
8069
  console.log(`[mnemospark] Updated to ${latest}.`);
8070
+ try {
8071
+ await ensureOpenClawRenewalPrerequisites();
8072
+ } catch (err) {
8073
+ console.warn(
8074
+ "[mnemospark] Renewal prerequisites:",
8075
+ err instanceof Error ? err.message : String(err)
8076
+ );
8077
+ }
8052
8078
  } catch {
8053
8079
  console.log(
8054
8080
  "[mnemospark] npm install failed. You can update manually: npm install mnemospark@latest"