mnemospark 0.1.8 → 0.1.10
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 +0 -2
- package/README.md.bak +7 -1
- package/dist/cli.js +31 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.js +45 -27
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/README.md.bak
CHANGED
|
@@ -19,4 +19,10 @@ mnemospark is an OpenClaw plugin that provides access to hyper-scaler cloud oper
|
|
|
19
19
|
|
|
20
20
|
Plugin registration is handled only by `openclaw plugins install mnemospark`. The `npx mnemospark install` command sets up your wallet and helper scripts under `~/.openclaw/mnemospark/`; it does not write to `~/.openclaw/extensions/`.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
1. **Install the plugin in OpenClaw:** `openclaw plugins install mnemospark` then `openclaw gateway start`
|
|
25
|
+
2. **Optional wallet setup:** `npx mnemospark install --standard`
|
|
26
|
+
|
|
27
|
+
In OpenClaw chat, type `/` to see **mnemospark-wallet** and **mnemospark-cloud**. Use `/mnemospark-wallet` for wallet status or export, `/mnemospark-cloud help` for storage commands.
|
|
28
|
+
|
package/dist/cli.js
CHANGED
|
@@ -176,7 +176,7 @@ var MNEMOSPARK_REQUEST_TYPES = {
|
|
|
176
176
|
MnemosparkRequest: [
|
|
177
177
|
{ name: "method", type: "string" },
|
|
178
178
|
{ name: "path", type: "string" },
|
|
179
|
-
{ name: "walletAddress", type: "
|
|
179
|
+
{ name: "walletAddress", type: "address" },
|
|
180
180
|
{ name: "nonce", type: "string" },
|
|
181
181
|
{ name: "timestamp", type: "string" }
|
|
182
182
|
]
|
|
@@ -1366,7 +1366,8 @@ async function startProxy(options) {
|
|
|
1366
1366
|
const full = url.searchParams.get("full") === "true";
|
|
1367
1367
|
const response = {
|
|
1368
1368
|
status: "ok",
|
|
1369
|
-
wallet: account.address
|
|
1369
|
+
wallet: account.address,
|
|
1370
|
+
backendConfigured: MNEMOSPARK_BACKEND_API_BASE_URL.trim().length > 0
|
|
1370
1371
|
};
|
|
1371
1372
|
if (full) {
|
|
1372
1373
|
try {
|
|
@@ -1872,27 +1873,37 @@ var TAR_OVERHEAD_BYTES = 10 * 1024 * 1024;
|
|
|
1872
1873
|
var REQUIRED_PRICE_STORAGE = "--wallet-address, --object-id, --object-id-hash, --gb, --provider, --region";
|
|
1873
1874
|
var REQUIRED_UPLOAD = "--quote-id, --wallet-address, --object-id, --object-id-hash";
|
|
1874
1875
|
var REQUIRED_STORAGE_OBJECT = "--wallet-address, --object-key";
|
|
1876
|
+
function expandTilde(path) {
|
|
1877
|
+
const trimmed = path.trim();
|
|
1878
|
+
if (trimmed === "~") {
|
|
1879
|
+
return homedir2();
|
|
1880
|
+
}
|
|
1881
|
+
if (trimmed.startsWith("~/") || trimmed.startsWith("~\\")) {
|
|
1882
|
+
return join4(homedir2(), trimmed.slice(2));
|
|
1883
|
+
}
|
|
1884
|
+
return path;
|
|
1885
|
+
}
|
|
1875
1886
|
var CLOUD_HELP_TEXT = [
|
|
1876
1887
|
"\u2601\uFE0F **mnemospark Cloud Commands**",
|
|
1877
1888
|
"",
|
|
1878
|
-
"\u2022 `/mnemospark
|
|
1889
|
+
"\u2022 `/mnemospark-cloud` or `/mnemospark-cloud help` \u2014 show this message",
|
|
1879
1890
|
"",
|
|
1880
|
-
"\u2022 `/mnemospark
|
|
1891
|
+
"\u2022 `/mnemospark-cloud backup <file>` or `/mnemospark-cloud backup <directory>`",
|
|
1881
1892
|
" Required: <file> or <directory> (path to back up)",
|
|
1882
1893
|
"",
|
|
1883
|
-
"\u2022 `/mnemospark
|
|
1894
|
+
"\u2022 `/mnemospark-cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider <provider> --region <region>`",
|
|
1884
1895
|
" Required: " + REQUIRED_PRICE_STORAGE,
|
|
1885
1896
|
"",
|
|
1886
|
-
"\u2022 `/mnemospark
|
|
1897
|
+
"\u2022 `/mnemospark-cloud upload --quote-id <quote-id> --wallet-address <addr> --object-id <id> --object-id-hash <hash>`",
|
|
1887
1898
|
" Required: " + REQUIRED_UPLOAD,
|
|
1888
1899
|
"",
|
|
1889
|
-
"\u2022 `/mnemospark
|
|
1900
|
+
"\u2022 `/mnemospark-cloud ls --wallet-address <addr> --object-key <object-key>`",
|
|
1890
1901
|
" Required: " + REQUIRED_STORAGE_OBJECT,
|
|
1891
1902
|
"",
|
|
1892
|
-
"\u2022 `/mnemospark
|
|
1903
|
+
"\u2022 `/mnemospark-cloud download --wallet-address <addr> --object-key <object-key>`",
|
|
1893
1904
|
" Required: " + REQUIRED_STORAGE_OBJECT,
|
|
1894
1905
|
"",
|
|
1895
|
-
"\u2022 `/mnemospark
|
|
1906
|
+
"\u2022 `/mnemospark-cloud delete --wallet-address <addr> --object-key <object-key>`",
|
|
1896
1907
|
" Required: " + REQUIRED_STORAGE_OBJECT,
|
|
1897
1908
|
"",
|
|
1898
1909
|
"Backup creates a tar+gzip object in ~/.openclaw/mnemospark/backup and appends object metadata to ~/.openclaw/mnemospark/object.log. Upload appends storage rows and cron-tracking rows to object.log, and keeps job entries in ~/.openclaw/mnemospark/crontab.txt. All storage commands (price-storage, upload, ls, download, delete) require --wallet-address."
|
|
@@ -2127,7 +2138,7 @@ async function buildBackupObject(targetPathArg, options = {}) {
|
|
|
2127
2138
|
if (!SUPPORTED_BACKUP_PLATFORMS.has(platform)) {
|
|
2128
2139
|
throw new UnsupportedBackupPlatformError(platform);
|
|
2129
2140
|
}
|
|
2130
|
-
const targetPath = resolve2(targetPathArg);
|
|
2141
|
+
const targetPath = resolve2(expandTilde(targetPathArg));
|
|
2131
2142
|
const targetStats = await lstat(targetPath);
|
|
2132
2143
|
if (!targetStats.isFile() && !targetStats.isDirectory()) {
|
|
2133
2144
|
throw new Error("Backup target must be a file or directory");
|
|
@@ -2633,7 +2644,7 @@ function extractUploadErrorMessage(error) {
|
|
|
2633
2644
|
function formatPriceStorageUserMessage(quote) {
|
|
2634
2645
|
return [
|
|
2635
2646
|
`Your storage quote \`${quote.quote_id}\` is valid for 1 hour, the storage price is \`${quote.storage_price}\` for \`${quote.object_id}\` with file size of \`${quote.object_size_gb}\` in \`${quote.provider}\` \`${quote.location}\``,
|
|
2636
|
-
`If you accept this quote run the command /mnemospark
|
|
2647
|
+
`If you accept this quote run the command /mnemospark-cloud upload --quote-id \`${quote.quote_id}\` --wallet-address \`${quote.addr}\` --object-id \`${quote.object_id}\` --object-id-hash \`${quote.object_id_hash}\``
|
|
2637
2648
|
].join("\n");
|
|
2638
2649
|
}
|
|
2639
2650
|
function formatStorageLsUserMessage(result, requestedObjectKey) {
|
|
@@ -2654,7 +2665,7 @@ function createCloudCommand(options = {}) {
|
|
|
2654
2665
|
const requestStorageDelete = options.requestStorageDeleteFn ?? requestStorageDeleteViaProxy;
|
|
2655
2666
|
const objectLogHomeDir = options.objectLogHomeDir ?? options.backupOptions?.homeDir;
|
|
2656
2667
|
return {
|
|
2657
|
-
name: "cloud",
|
|
2668
|
+
name: "mnemospark-cloud",
|
|
2658
2669
|
description: "Manage mnemospark cloud storage workflow commands",
|
|
2659
2670
|
acceptsArgs: true,
|
|
2660
2671
|
requireAuth: true,
|
|
@@ -2700,7 +2711,11 @@ function createCloudCommand(options = {}) {
|
|
|
2700
2711
|
try {
|
|
2701
2712
|
const result = await backupBuilder(parsed.backupTarget, options.backupOptions);
|
|
2702
2713
|
return {
|
|
2703
|
-
text:
|
|
2714
|
+
text: [
|
|
2715
|
+
`object-id: ${result.objectId}`,
|
|
2716
|
+
`object-id-hash: ${result.objectIdHash.replace(/\s/g, "")}`,
|
|
2717
|
+
`object-size: ${result.objectSizeGb}`
|
|
2718
|
+
].join("\n")
|
|
2704
2719
|
};
|
|
2705
2720
|
} catch (err) {
|
|
2706
2721
|
if (err instanceof UnsupportedBackupPlatformError) {
|
|
@@ -2725,9 +2740,10 @@ function createCloudCommand(options = {}) {
|
|
|
2725
2740
|
return {
|
|
2726
2741
|
text: formatPriceStorageUserMessage(quote)
|
|
2727
2742
|
};
|
|
2728
|
-
} catch {
|
|
2743
|
+
} catch (err) {
|
|
2744
|
+
const message = err instanceof Error ? err.message : typeof err === "string" ? err : String(err);
|
|
2729
2745
|
return {
|
|
2730
|
-
text: "Cannot price storage",
|
|
2746
|
+
text: message ? `Cannot price storage: ${message}` : "Cannot price storage",
|
|
2731
2747
|
isError: true
|
|
2732
2748
|
};
|
|
2733
2749
|
}
|