mnemospark 0.1.21 → 0.1.22

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "mnemospark",
3
3
  "name": "mnemospark",
4
- "version": "0.1.21",
4
+ "version": "0.1.22",
5
5
  "description": "mnemospark is an OpenClaw plugin that gives agentic systems instant, secure access to cloud storage, compute, and proprietary datasets paid via x402 with USDC on Base. Wallet and go.",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnemospark",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "mnemospark is an OpenClaw plugin that gives agentic systems instant, secure access to cloud storage, compute, and proprietary datasets paid via x402 with USDC on Base. Wallet and go.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "files": [
23
23
  "dist",
24
+ "skills",
24
25
  "scripts",
25
26
  "openclaw.plugin.json"
26
27
  ],
@@ -0,0 +1,38 @@
1
+ # mnemospark
2
+
3
+ ## When to use
4
+
5
+ Use this skill for mnemospark cloud backup/storage workflows, async operation tracking, and troubleshooting using SQLite + JSONL observability.
6
+
7
+ ## Inputs expected
8
+
9
+ - User intent: backup, price-storage, upload, ls, download, delete, op-status
10
+ - Wallet context (`--wallet-address`) where required
11
+ - Optional selector context (`--object-key` or `--name`, plus `--latest` / `--at`)
12
+
13
+ ## Execution rules
14
+
15
+ 1. Validate required args before execution.
16
+ 2. Prefer `--async` for long-running `upload` and `download`.
17
+ 3. Return `operation-id` immediately for async commands.
18
+ 4. Poll with `/mnemospark-cloud op-status --operation-id <id>` until terminal status.
19
+ 5. Use SQLite (`state.db`) as source of truth; use JSONL streams for correlation and audit context.
20
+ 6. On ambiguity with `--name`, require `--latest` or `--at`.
21
+ 7. On SQLite unavailability, report graceful fallback and continue with JSONL + legacy logs.
22
+
23
+ ## Command catalog
24
+
25
+ - `/mnemospark-cloud backup <file|directory> [--name <friendly-name>]`
26
+ - `/mnemospark-cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider <provider> --region <region>`
27
+ - `/mnemospark-cloud upload --quote-id <quote-id> --wallet-address <addr> --object-id <id> --object-id-hash <hash> [--name <friendly-name>] [--async]`
28
+ - `/mnemospark-cloud ls --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>]`
29
+ - `/mnemospark-cloud download --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>] [--async]`
30
+ - `/mnemospark-cloud delete --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>]`
31
+ - `/mnemospark-cloud op-status --operation-id <id>`
32
+
33
+ ## References
34
+
35
+ - `references/commands.md`
36
+ - `references/state-and-logs.md`
37
+ - `references/troubleshooting.md`
38
+ - `scripts/debug-operation.sh` (one-step operation correlation debugger)
@@ -0,0 +1,42 @@
1
+ # mnemospark Commands Reference
2
+
3
+ ## `/mnemospark-cloud`
4
+
5
+ ### Backup
6
+
7
+ `backup <file|directory> [--name <friendly-name>]`
8
+
9
+ ### Price storage quote
10
+
11
+ `price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider <provider> --region <region>`
12
+
13
+ ### Upload
14
+
15
+ `upload --quote-id <quote-id> --wallet-address <addr> --object-id <id> --object-id-hash <hash> [--name <friendly-name>] [--async]`
16
+
17
+ ### List
18
+
19
+ `ls --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>]`
20
+
21
+ ### Download
22
+
23
+ `download --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>] [--async]`
24
+
25
+ ### Delete
26
+
27
+ `delete --wallet-address <addr> [--object-key <object-key> | --name <friendly-name>] [--latest|--at <timestamp>]`
28
+
29
+ ### Operation status
30
+
31
+ `op-status --operation-id <id>`
32
+
33
+ ## Name selector rules
34
+
35
+ - `--object-key` and `--name` are mutually exclusive.
36
+ - If `--name` maps to multiple active objects, require `--latest` or `--at`.
37
+
38
+ ## One-step debug helper
39
+
40
+ ```bash
41
+ ./skills/mnemospark/scripts/debug-operation.sh <operation-id>
42
+ ```
@@ -0,0 +1,40 @@
1
+ # mnemospark State and Logs Reference
2
+
3
+ ## Primary state
4
+
5
+ - SQLite: `~/.openclaw/mnemospark/state.db`
6
+
7
+ ### Key tables
8
+
9
+ - `objects`
10
+ - `payments`
11
+ - `cron_jobs`
12
+ - `operations`
13
+ - `friendly_names`
14
+
15
+ ## Observability streams
16
+
17
+ - Client events: `~/.openclaw/mnemospark/events.jsonl`
18
+ - Friendly-name manifest: `~/.openclaw/mnemospark/manifest.jsonl`
19
+ - Proxy events: `~/.openclaw/mnemospark/proxy-events.jsonl`
20
+
21
+ ## Legacy compatibility paths
22
+
23
+ - `~/.openclaw/mnemospark/object.log`
24
+ - `~/.openclaw/mnemospark/crontab.txt`
25
+
26
+ ## Correlation fields
27
+
28
+ Cross-stream troubleshooting should correlate by:
29
+
30
+ - `operation_id`
31
+ - `trace_id`
32
+ - `quote_id`
33
+ - `object_id`
34
+ - `object_key`
35
+
36
+ ## Quick correlation command
37
+
38
+ ```bash
39
+ ./skills/mnemospark/scripts/debug-operation.sh <operation-id>
40
+ ```
@@ -0,0 +1,36 @@
1
+ # mnemospark Troubleshooting Reference
2
+
3
+ ## Async workflow checks
4
+
5
+ 1. Start with `--async` for upload/download.
6
+ 2. Capture `operation-id`.
7
+ 3. Query: `/mnemospark-cloud op-status --operation-id <id>`.
8
+ 4. Correlate with `events.jsonl` and `proxy-events.jsonl`.
9
+
10
+ ## One-step correlation debugger
11
+
12
+ From repo root:
13
+
14
+ ```bash
15
+ ./skills/mnemospark/scripts/debug-operation.sh <operation-id>
16
+ ```
17
+
18
+ If you omit `<operation-id>`, the latest operation from SQLite is used:
19
+
20
+ ```bash
21
+ ./skills/mnemospark/scripts/debug-operation.sh
22
+ ```
23
+
24
+ ## Frequent failure patterns
25
+
26
+ - `Operation not found: <id>`
27
+ - Check SQLite health or `MNEMOSPARK_DISABLE_SQLITE`.
28
+ - Name ambiguity for `--name`
29
+ - Re-run with `--latest` or `--at <timestamp>`.
30
+ - Repeated settle/upload mismatch
31
+ - Inspect `proxy-events.jsonl` `payment.settle` and `storage.call` events for matching `operation_id`.
32
+
33
+ ## Operator fallback
34
+
35
+ - Use direct `--object-key` if friendly-name resolution is uncertain.
36
+ - Re-run sync (without `--async`) for one-shot detailed failure output.
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ usage() {
5
+ cat <<'USAGE'
6
+ One-step mnemospark operation debugger
7
+
8
+ Usage:
9
+ debug-operation.sh [operation-id] [--home <home-dir>] [--tail <lines>]
10
+
11
+ Examples:
12
+ ./skills/mnemospark/scripts/debug-operation.sh 1f7b2f0d-....
13
+ ./skills/mnemospark/scripts/debug-operation.sh --tail 300
14
+
15
+ Behavior:
16
+ - If operation-id is omitted, the latest operation in SQLite is used.
17
+ - Correlates operation context across:
18
+ state.db (operations/objects/payments)
19
+ events.jsonl
20
+ proxy-events.jsonl
21
+ manifest.jsonl
22
+ USAGE
23
+ }
24
+
25
+ require_cmd() {
26
+ if ! command -v "$1" >/dev/null 2>&1; then
27
+ echo "Missing required tool: $1" >&2
28
+ exit 2
29
+ fi
30
+ }
31
+
32
+ sql_escape() {
33
+ printf "%s" "$1" | sed "s/'/''/g"
34
+ }
35
+
36
+ HOME_DIR="${HOME}"
37
+ TAIL_LINES="200"
38
+ OPERATION_ID=""
39
+
40
+ while (($#)); do
41
+ case "$1" in
42
+ -h|--help)
43
+ usage
44
+ exit 0
45
+ ;;
46
+ --home)
47
+ HOME_DIR="${2:-}"
48
+ shift 2
49
+ ;;
50
+ --tail)
51
+ TAIL_LINES="${2:-}"
52
+ shift 2
53
+ ;;
54
+ --*)
55
+ echo "Unknown flag: $1" >&2
56
+ usage
57
+ exit 1
58
+ ;;
59
+ *)
60
+ if [[ -z "${OPERATION_ID}" ]]; then
61
+ OPERATION_ID="$1"
62
+ else
63
+ echo "Unexpected extra argument: $1" >&2
64
+ usage
65
+ exit 1
66
+ fi
67
+ shift
68
+ ;;
69
+ esac
70
+ done
71
+
72
+ if ! [[ "${TAIL_LINES}" =~ ^[0-9]+$ ]]; then
73
+ echo "--tail must be a positive integer" >&2
74
+ exit 1
75
+ fi
76
+
77
+ require_cmd sqlite3
78
+ require_cmd jq
79
+ require_cmd tail
80
+
81
+ STATE_DIR="${HOME_DIR}/.openclaw/mnemospark"
82
+ DB_PATH="${STATE_DIR}/state.db"
83
+ EVENTS_PATH="${STATE_DIR}/events.jsonl"
84
+ PROXY_PATH="${STATE_DIR}/proxy-events.jsonl"
85
+ MANIFEST_PATH="${STATE_DIR}/manifest.jsonl"
86
+
87
+ if [[ ! -f "${DB_PATH}" ]]; then
88
+ echo "SQLite state not found: ${DB_PATH}" >&2
89
+ exit 1
90
+ fi
91
+
92
+ if [[ -z "${OPERATION_ID}" ]]; then
93
+ OPERATION_ID="$(sqlite3 "${DB_PATH}" "SELECT operation_id FROM operations ORDER BY updated_at DESC LIMIT 1;")"
94
+ if [[ -z "${OPERATION_ID}" ]]; then
95
+ echo "No operations found in ${DB_PATH}" >&2
96
+ exit 1
97
+ fi
98
+ fi
99
+
100
+ ESCAPED_OP_ID="$(sql_escape "${OPERATION_ID}")"
101
+ OP_JSON="$(sqlite3 -json "${DB_PATH}" "SELECT operation_id,type,status,error_code,error_message,started_at,finished_at,updated_at,object_id,quote_id FROM operations WHERE operation_id='${ESCAPED_OP_ID}' LIMIT 1;")"
102
+
103
+ if [[ "${OP_JSON}" == "[]" ]]; then
104
+ echo "Operation not found in SQLite: ${OPERATION_ID}" >&2
105
+ exit 1
106
+ fi
107
+
108
+ OBJECT_ID="$(printf "%s" "${OP_JSON}" | jq -r '.[0].object_id // empty')"
109
+ QUOTE_ID="$(printf "%s" "${OP_JSON}" | jq -r '.[0].quote_id // empty')"
110
+
111
+ OBJECT_JSON="[]"
112
+ OBJECT_KEY=""
113
+ WALLET_ADDRESS=""
114
+ if [[ -n "${OBJECT_ID}" ]]; then
115
+ ESCAPED_OBJECT_ID="$(sql_escape "${OBJECT_ID}")"
116
+ OBJECT_JSON="$(sqlite3 -json "${DB_PATH}" "SELECT object_id,object_key,wallet_address,quote_id,status,updated_at FROM objects WHERE object_id='${ESCAPED_OBJECT_ID}' ORDER BY updated_at DESC LIMIT 1;")"
117
+ OBJECT_KEY="$(printf "%s" "${OBJECT_JSON}" | jq -r '.[0].object_key // empty')"
118
+ WALLET_ADDRESS="$(printf "%s" "${OBJECT_JSON}" | jq -r '.[0].wallet_address // empty')"
119
+ if [[ -z "${QUOTE_ID}" ]]; then
120
+ QUOTE_ID="$(printf "%s" "${OBJECT_JSON}" | jq -r '.[0].quote_id // empty')"
121
+ fi
122
+ fi
123
+
124
+ PAYMENT_JSON="[]"
125
+ if [[ -n "${QUOTE_ID}" ]]; then
126
+ ESCAPED_QUOTE_ID="$(sql_escape "${QUOTE_ID}")"
127
+ PAYMENT_JSON="$(sqlite3 -json "${DB_PATH}" "SELECT quote_id,wallet_address,trans_id,amount,status,settled_at,updated_at FROM payments WHERE quote_id='${ESCAPED_QUOTE_ID}' LIMIT 1;")"
128
+ fi
129
+
130
+ echo "=== mnemospark one-step operation debug ==="
131
+ echo "home: ${HOME_DIR}"
132
+ echo "state: ${STATE_DIR}"
133
+ echo "operation-id: ${OPERATION_ID}"
134
+ echo
135
+
136
+ echo "---- operations row ----"
137
+ printf "%s\n" "${OP_JSON}" | jq .
138
+ echo
139
+
140
+ if [[ "${OBJECT_JSON}" != "[]" ]]; then
141
+ echo "---- related object row ----"
142
+ printf "%s\n" "${OBJECT_JSON}" | jq .
143
+ echo
144
+ fi
145
+
146
+ if [[ "${PAYMENT_JSON}" != "[]" ]]; then
147
+ echo "---- related payment row ----"
148
+ printf "%s\n" "${PAYMENT_JSON}" | jq .
149
+ echo
150
+ fi
151
+
152
+ print_stream_matches() {
153
+ local file_path="$1"
154
+ if [[ ! -f "${file_path}" ]]; then
155
+ return
156
+ fi
157
+ local file_name
158
+ file_name="$(basename "${file_path}")"
159
+ echo "---- ${file_name} matches (tail ${TAIL_LINES}) ----"
160
+ tail -n "${TAIL_LINES}" "${file_path}" | jq -cR \
161
+ --arg op "${OPERATION_ID}" \
162
+ --arg quote "${QUOTE_ID}" \
163
+ --arg object "${OBJECT_ID}" \
164
+ --arg key "${OBJECT_KEY}" \
165
+ --arg wallet "${WALLET_ADDRESS}" '
166
+ fromjson? as $j
167
+ | select($j != null)
168
+ | select(
169
+ (($j.operation_id // "") == $op)
170
+ or ($quote != "" and ($j.quote_id // "") == $quote)
171
+ or ($object != "" and ($j.object_id // "") == $object)
172
+ or ($key != "" and ($j.object_key // "") == $key)
173
+ or ($wallet != "" and ($j.wallet_address // "") == $wallet)
174
+ )
175
+ | $j
176
+ '
177
+ echo
178
+ }
179
+
180
+ print_stream_matches "${EVENTS_PATH}"
181
+ print_stream_matches "${PROXY_PATH}"
182
+ print_stream_matches "${MANIFEST_PATH}"
183
+
184
+ echo "Done."