mnemospark 1.6.0 → 2026.4.7

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
@@ -31,6 +31,8 @@ openclaw gateway start
31
31
  > Plugin registration is done by `openclaw plugins install mnemospark`.
32
32
  > The install also bundles the `skills/mnemospark` skill package so the main agent can delegate mnemospark workflows.
33
33
 
34
+ By default the plugin uses the production mnemospark API at **https://api.mnemospark.ai**. Set **`MNEMOSPARK_BACKEND_API_BASE_URL`** only when you need a different endpoint (for example staging or a private API URL).
35
+
34
36
  ### 2) Restart gateway after updates
35
37
 
36
38
  ```bash
@@ -148,20 +150,21 @@ The blockchain transaction is the payment record.
148
150
 
149
151
  Optional unless noted. All names use the `MNEMOSPARK_` prefix.
150
152
 
151
- | Variable | Purpose |
152
- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
153
- | `MNEMOSPARK_BACKEND_API_BASE_URL` | Base URL for the mnemospark backend API (required for the local HTTP proxy to forward storage calls). Example: `https://{api-id}.execute-api.{region}.amazonaws.com/{stage}`. |
154
- | `MNEMOSPARK_PROXY_PORT` | TCP port for the mnemospark HTTP proxy (default `7120`). |
155
- | `MNEMOSPARK_DOWNLOAD_DIR` | Directory where the proxy writes downloaded objects (default `~/.openclaw/mnemospark/downloads/`). |
156
- | `MNEMOSPARK_WALLET_KEY` | Path to the wallet private key file when not using the default `~/.openclaw/mnemospark/wallet/wallet.key`. |
157
- | `MNEMOSPARK_REMOVE_BACKUP_FILE` | After a **successful** cloud upload, delete the local backup archive under `~/.openclaw/mnemospark/backup/`. **Default when unset:** remove the file. Set to `0`, `false`, `no`, or `n` to keep it; `1`, `true`, `yes`, or `y` to remove. |
158
- | `MNEMOSPARK_DISABLED` | Set to `true` or `1` to disable plugin registration. |
159
- | `MNEMOSPARK_DISABLE_SQLITE` | Set to `1` to disable local SQLite (`state.db`); cloud commands that need local state will fail. |
160
- | `MNEMOSPARK_SQLITE_STRICT` | Set to `1` so certain SQLite consistency checks (e.g. friendly-name verification after upload) throw instead of warning. |
161
- | `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). |
162
- | `MNEMOSPARK_CRON_AGENT_ID` | OpenClaw agent id used for the monthly renewal cron (default `mnemospark-renewal`). |
163
- | `MNEMOSPARK_CRON_NODE_BIN` | Absolute path to `node` for renewal cron exec (default `/usr/bin/node`). |
164
- | `MNEMOSPARK_DISABLE_OPENCLAW_PREREQ` | Set to `1` to skip automatic runbook application everywhere it runs (plugin load, CLI install/update; for advanced debugging only). |
153
+ | Variable | Purpose |
154
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
155
+ | `MNEMOSPARK_BACKEND_API_BASE_URL` | Base URL for the mnemospark backend API (required for the local HTTP proxy to forward storage calls). **Default:** `https://api.mnemospark.ai` (production). Set this variable only to override—for example staging or a custom API Gateway URL. |
156
+ | `MNEMOSPARK_PROXY_PORT` | TCP port for the mnemospark HTTP proxy (default `7120`). |
157
+ | `MNEMOSPARK_DOWNLOAD_DIR` | Directory where the proxy writes downloaded objects (default `~/.openclaw/mnemospark/downloads/`). |
158
+ | `MNEMOSPARK_WALLET_KEY` | Path to the wallet private key file when not using the default `~/.openclaw/mnemospark/wallet/wallet.key`. |
159
+ | `MNEMOSPARK_REMOVE_BACKUP_FILE` | After a **successful** cloud upload, delete the local backup archive under `~/.openclaw/mnemospark/backup/`. **Default when unset:** remove the file. Set to `0`, `false`, `no`, or `n` to keep it; `1`, `true`, `yes`, or `y` to remove. |
160
+ | `MNEMOSPARK_DISABLED` | Set to `true` or `1` to disable plugin registration. |
161
+ | `MNEMOSPARK_DISABLE_SQLITE` | Set to `1` to disable local SQLite (`state.db`); cloud commands that need local state will fail. |
162
+ | `MNEMOSPARK_SQLITE_STRICT` | Set to `1` so certain SQLite consistency checks (e.g. friendly-name verification after upload) throw instead of warning. |
163
+ | `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). |
164
+ | `MNEMOSPARK_CRON_AGENT_ID` | OpenClaw agent id used for the monthly renewal cron (default `mnemospark-renewal`). |
165
+ | `MNEMOSPARK_AGENT_ID` | OpenClaw agent id for interactive wallet/cloud CLI via the dedicated-agent runbook (default `mnemospark`). Distinct from `MNEMOSPARK_CRON_AGENT_ID`. |
166
+ | `MNEMOSPARK_CRON_NODE_BIN` | Absolute path to `node` for dedicated-agent exec allowlists and renewal cron payloads (default `/usr/bin/node`). |
167
+ | `MNEMOSPARK_DISABLE_OPENCLAW_PREREQ` | Set to `1` to skip automatic runbook application everywhere it runs (plugin load, CLI install/update; for advanced debugging only). |
165
168
 
166
169
  ---
167
170
 
@@ -177,7 +180,12 @@ Optional unless noted. All names use the `MNEMOSPARK_` prefix.
177
180
 
178
181
  ## mnemospark Exec Approvals Runbook
179
182
 
180
- 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
+ On **OpenClaw 2026.4.x**, mnemospark applies **two** dedicated-agent runbooks when you install or update (including `npx mnemospark install`, `npx mnemospark update`, `openclaw plugins install`, and when the gateway loads the plugin):
184
+
185
+ 1. **`mnemospark-renewal`** (default; override `MNEMOSPARK_CRON_AGENT_ID`) — monthly storage renewal cron: `tools.deny: ["subagents"]`, `tools.exec.ask: "off"`, and `/usr/bin/node` allowlisted for that agent in `~/.openclaw/exec-approvals.json`.
186
+ 2. **`mnemospark`** (default; override `MNEMOSPARK_AGENT_ID`) — interactive wallet and cloud CLI work: same tool policy and its **own** `/usr/bin/node` allowlist entry under that agent id.
187
+
188
+ The plugin merges both into `agents.list` via `openclaw config set` + `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) against the renewal agent id. For interactive automation, route through the general agent (see bundled skill `skills/mnemospark/references/openclaw-routing.md`). Override the node path with `MNEMOSPARK_CRON_NODE_BIN` if your system differs.
181
189
 
182
190
  ---
183
191
 
@@ -187,7 +195,8 @@ On **OpenClaw 2026.4.x**, the **Mnemospark Renewal Agent Runbook** is applied wh
187
195
  - **402 payment required**: expected in challenge flow; ensure client retries with payment authorization.
188
196
  - **Upload/storage backend errors**: verify cloud permissions (e.g. bucket access + IAM role rights).
189
197
  - **Command not recognized**: confirm plugin installed and gateway restarted.
190
- - **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.
198
+ - **Renewal cron / exec failures after upload**: ensure mnemospark was installed or updated through the normal path so both dedicated-agent runbooks ran (gateway load, `npx mnemospark install`, or `openclaw plugins install`). If the gateway never loaded the plugin, run install again or restart the gateway.
199
+ - **Interactive Mnemospark exec denied on main**: use a dedicated `mnemospark` agent and route with `openclaw agent --agent mnemospark …` (see skill reference `openclaw-routing.md`); renewal-only setup does not cover general plugin usage.
191
200
  - **One-step operation correlation**: run `./skills/mnemospark/scripts/debug-operation.sh <operation-id>` (or omit ID to use latest).
192
201
 
193
202
  ---
package/dist/cli.js CHANGED
@@ -146,6 +146,7 @@ var BalanceMonitor = class {
146
146
 
147
147
  // src/config.ts
148
148
  var DEFAULT_PORT = 7120;
149
+ var DEFAULT_BACKEND_API_BASE_URL = "https://api.mnemospark.ai";
149
150
  var PROXY_PORT = (() => {
150
151
  const envPort = process.env.MNEMOSPARK_PROXY_PORT;
151
152
  if (envPort) {
@@ -156,7 +157,7 @@ var PROXY_PORT = (() => {
156
157
  }
157
158
  return DEFAULT_PORT;
158
159
  })();
159
- var MNEMOSPARK_BACKEND_API_BASE_URL = (process.env.MNEMOSPARK_BACKEND_API_BASE_URL ?? "").trim();
160
+ var MNEMOSPARK_BACKEND_API_BASE_URL = (process.env.MNEMOSPARK_BACKEND_API_BASE_URL || DEFAULT_BACKEND_API_BASE_URL).trim();
160
161
  var MNEMOSPARK_PROXY_VERBOSE_404 = (() => {
161
162
  const v = process.env.MNEMOSPARK_PROXY_VERBOSE_404?.trim().toLowerCase();
162
163
  return v === "1" || v === "true" || v === "yes";
@@ -4351,16 +4352,21 @@ import { homedir as homedir6 } from "os";
4351
4352
  import { dirname as dirname5, join as join9 } from "path";
4352
4353
  import { randomUUID as randomUUID3 } from "crypto";
4353
4354
  var DEFAULT_RENEWAL_AGENT_ID = "mnemospark-renewal";
4355
+ var DEFAULT_MNEMOSPARK_AGENT_ID = "mnemospark";
4354
4356
  var RENEWAL_NODE_ALLOWLIST_ID = "node-usr-bin-node";
4355
4357
  function getRenewalAgentId() {
4356
4358
  const fromEnv = process.env.MNEMOSPARK_CRON_AGENT_ID?.trim();
4357
4359
  return fromEnv && fromEnv.length > 0 ? fromEnv : DEFAULT_RENEWAL_AGENT_ID;
4358
4360
  }
4361
+ function getMnemosparkAgentId() {
4362
+ const fromEnv = process.env.MNEMOSPARK_AGENT_ID?.trim();
4363
+ return fromEnv && fromEnv.length > 0 ? fromEnv : DEFAULT_MNEMOSPARK_AGENT_ID;
4364
+ }
4359
4365
  function getRenewalNodeBinary() {
4360
4366
  const fromEnv = process.env.MNEMOSPARK_CRON_NODE_BIN?.trim();
4361
4367
  return fromEnv && fromEnv.length > 0 ? fromEnv : "/usr/bin/node";
4362
4368
  }
4363
- function runbookRenewalAgentEntry(agentId = getRenewalAgentId()) {
4369
+ function runbookDedicatedAgentEntry(agentId) {
4364
4370
  return {
4365
4371
  id: agentId,
4366
4372
  tools: {
@@ -4369,10 +4375,13 @@ function runbookRenewalAgentEntry(agentId = getRenewalAgentId()) {
4369
4375
  }
4370
4376
  };
4371
4377
  }
4378
+ function runbookRenewalAgentEntry(agentId = getRenewalAgentId()) {
4379
+ return runbookDedicatedAgentEntry(agentId);
4380
+ }
4372
4381
  function isRecord(value) {
4373
4382
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4374
4383
  }
4375
- function renewalAgentEntrySatisfied(existing, desired) {
4384
+ function dedicatedAgentEntrySatisfied(existing, desired) {
4376
4385
  if (!isRecord(existing)) {
4377
4386
  return false;
4378
4387
  }
@@ -4399,7 +4408,7 @@ function mergeRenewalAgentIntoAgentsList(list, desired) {
4399
4408
  if (idx === -1) {
4400
4409
  return { list: [...arr, desired], changed: true };
4401
4410
  }
4402
- if (renewalAgentEntrySatisfied(arr[idx], desired)) {
4411
+ if (dedicatedAgentEntrySatisfied(arr[idx], desired)) {
4403
4412
  return { list: arr, changed: false };
4404
4413
  }
4405
4414
  const next = [...arr];
@@ -4444,8 +4453,10 @@ async function ensureOpenClawRenewalPrerequisites(options = {}) {
4444
4453
  return;
4445
4454
  }
4446
4455
  const homeDir = options.homeDir ?? homedir6();
4447
- const agentId = getRenewalAgentId();
4448
- const desired = runbookRenewalAgentEntry(agentId);
4456
+ const renewalId = getRenewalAgentId();
4457
+ const pluginAgentId = getMnemosparkAgentId();
4458
+ const desiredRenewal = runbookRenewalAgentEntry(renewalId);
4459
+ const desiredPlugin = runbookDedicatedAgentEntry(pluginAgentId);
4449
4460
  const nodeBinary = getRenewalNodeBinary();
4450
4461
  const configPath = await resolveOpenClawConfigFilePath(homeDir);
4451
4462
  let configRaw = "{}";
@@ -4461,14 +4472,18 @@ async function ensureOpenClawRenewalPrerequisites(options = {}) {
4461
4472
  parsed = JSON.parse(configRaw);
4462
4473
  } catch {
4463
4474
  throw new Error(
4464
- `openclaw.json at ${configPath} is not valid JSON; fix or remove it before applying renewal prerequisites.`
4475
+ `openclaw.json at ${configPath} is not valid JSON; fix or remove it before applying mnemospark OpenClaw prerequisites.`
4465
4476
  );
4466
4477
  }
4467
4478
  const agents = isRecord(parsed.agents) ? parsed.agents : {};
4468
- const { list: mergedList, changed: agentChanged } = mergeRenewalAgentIntoAgentsList(
4469
- agents.list,
4470
- desired
4471
- );
4479
+ let mergedList = [];
4480
+ let agentChanged = false;
4481
+ const afterRenewal = mergeRenewalAgentIntoAgentsList(agents.list, desiredRenewal);
4482
+ mergedList = afterRenewal.list;
4483
+ agentChanged = afterRenewal.changed;
4484
+ const afterPlugin = mergeRenewalAgentIntoAgentsList(mergedList, desiredPlugin);
4485
+ mergedList = afterPlugin.list;
4486
+ agentChanged = agentChanged || afterPlugin.changed;
4472
4487
  if (agentChanged) {
4473
4488
  const listJson = JSON.stringify(mergedList);
4474
4489
  await runOpenClawCli(["config", "set", "agents.list", listJson, "--strict-json"], homeDir);
@@ -4484,11 +4499,13 @@ async function ensureOpenClawRenewalPrerequisites(options = {}) {
4484
4499
  throw err;
4485
4500
  }
4486
4501
  }
4487
- const { doc: mergedExec, changed: execChanged } = mergeExecApprovalsAllowlist(
4488
- execDoc,
4489
- agentId,
4490
- nodeBinary
4491
- );
4502
+ let mergedExec = execDoc;
4503
+ let execChanged = false;
4504
+ for (const id of [renewalId, pluginAgentId]) {
4505
+ const { doc, changed } = mergeExecApprovalsAllowlist(mergedExec, id, nodeBinary);
4506
+ mergedExec = doc;
4507
+ execChanged = execChanged || changed;
4508
+ }
4492
4509
  if (execChanged) {
4493
4510
  await writeFileAtomic(execPath, `${JSON.stringify(mergedExec, null, 2)}
4494
4511
  `);
@@ -8035,7 +8052,7 @@ async function promptOrRunOpenClawPluginInstall() {
8035
8052
  await ensureOpenClawRenewalPrerequisites();
8036
8053
  } catch (err) {
8037
8054
  console.warn(
8038
- "[mnemospark] Renewal prerequisites:",
8055
+ "[mnemospark] OpenClaw prerequisites:",
8039
8056
  err instanceof Error ? err.message : String(err)
8040
8057
  );
8041
8058
  }
@@ -8142,7 +8159,7 @@ async function runUpdate() {
8142
8159
  await ensureOpenClawRenewalPrerequisites();
8143
8160
  } catch (err) {
8144
8161
  console.warn(
8145
- "[mnemospark] Renewal prerequisites:",
8162
+ "[mnemospark] OpenClaw prerequisites:",
8146
8163
  err instanceof Error ? err.message : String(err)
8147
8164
  );
8148
8165
  }