mnemospark 0.8.2 → 0.9.0
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 +3 -1
- package/dist/cli.js +32 -17
- package/dist/cli.js.map +1 -1
- package/dist/index.js +32 -17
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/mnemospark/SKILL.md +2 -2
- package/skills/mnemospark/references/commands.md +1 -1
package/dist/index.js
CHANGED
|
@@ -3425,6 +3425,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3425
3425
|
addOperationsColumn("subagent_session_id", "TEXT");
|
|
3426
3426
|
addOperationsColumn("timeout_seconds", "INTEGER");
|
|
3427
3427
|
addOperationsColumn("cancel_requested_at", "TEXT");
|
|
3428
|
+
addOperationsColumn("result_text", "TEXT");
|
|
3428
3429
|
nextDb.prepare(
|
|
3429
3430
|
`INSERT INTO schema_migrations(version, applied_at)
|
|
3430
3431
|
VALUES(?, ?)
|
|
@@ -3616,8 +3617,8 @@ async function createCloudDatastore(homeDir) {
|
|
|
3616
3617
|
const ts = nowIso();
|
|
3617
3618
|
const terminalStatuses = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
3618
3619
|
db.prepare(
|
|
3619
|
-
`INSERT INTO operations(operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, started_at, finished_at, created_at, updated_at)
|
|
3620
|
-
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
3620
|
+
`INSERT INTO operations(operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, result_text, started_at, finished_at, created_at, updated_at)
|
|
3621
|
+
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
3621
3622
|
ON CONFLICT(operation_id) DO UPDATE SET
|
|
3622
3623
|
type=excluded.type,
|
|
3623
3624
|
object_id=COALESCE(excluded.object_id, operations.object_id),
|
|
@@ -3630,6 +3631,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3630
3631
|
status=excluded.status,
|
|
3631
3632
|
error_code=excluded.error_code,
|
|
3632
3633
|
error_message=excluded.error_message,
|
|
3634
|
+
result_text=COALESCE(excluded.result_text, operations.result_text),
|
|
3633
3635
|
started_at=COALESCE(excluded.started_at, operations.started_at),
|
|
3634
3636
|
finished_at=COALESCE(excluded.finished_at, operations.finished_at),
|
|
3635
3637
|
updated_at=excluded.updated_at`
|
|
@@ -3646,6 +3648,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3646
3648
|
row.status,
|
|
3647
3649
|
row.error_code,
|
|
3648
3650
|
row.error_message,
|
|
3651
|
+
row.result_text ?? null,
|
|
3649
3652
|
row.status === "started" ? ts : null,
|
|
3650
3653
|
terminalStatuses.has(row.status) ? ts : null,
|
|
3651
3654
|
ts,
|
|
@@ -3655,7 +3658,7 @@ async function createCloudDatastore(homeDir) {
|
|
|
3655
3658
|
},
|
|
3656
3659
|
findOperationById: async (operationId) => safe(() => {
|
|
3657
3660
|
const row = db.prepare(
|
|
3658
|
-
`SELECT operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, started_at, finished_at, updated_at
|
|
3661
|
+
`SELECT operation_id, type, object_id, quote_id, trace_id, orchestrator, subagent_session_id, timeout_seconds, cancel_requested_at, status, error_code, error_message, result_text, started_at, finished_at, updated_at
|
|
3659
3662
|
FROM operations
|
|
3660
3663
|
WHERE operation_id = ?
|
|
3661
3664
|
LIMIT 1`
|
|
@@ -3860,8 +3863,8 @@ var CLOUD_HELP_TEXT = [
|
|
|
3860
3863
|
" Purpose: create a local tar+gzip archive under ~/.openclaw/mnemospark/backup (filename from sanitized friendly name) and record metadata in SQLite for later price-storage and upload.",
|
|
3861
3864
|
" Required: " + REQUIRED_BACKUP,
|
|
3862
3865
|
"",
|
|
3863
|
-
"\u2022 `/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider
|
|
3864
|
-
" Purpose: request a storage quote before upload.",
|
|
3866
|
+
"\u2022 `/mnemospark_cloud price-storage --wallet-address <addr> --object-id <id> --object-id-hash <hash> --gb <gb> --provider aws --region us-east-1`",
|
|
3867
|
+
" Purpose: request a storage quote before upload (defaults shown; override `--provider` / `--region` for other regions).",
|
|
3865
3868
|
" Required: " + REQUIRED_PRICE_STORAGE,
|
|
3866
3869
|
"",
|
|
3867
3870
|
"\u2022 `/mnemospark_cloud upload --quote-id <quote-id> --wallet-address <addr> --object-id <id> --object-id-hash <hash> [--name <friendly-name>] [--async] [--orchestrator <inline|subagent>] [--timeout-seconds <n>]`",
|
|
@@ -4604,7 +4607,7 @@ function buildStoragePaymentCronCommand(job) {
|
|
|
4604
4607
|
}
|
|
4605
4608
|
function buildOpenClawRenewalAgentMessage(openClawHome, renewalArgs) {
|
|
4606
4609
|
const cliPath = join8(openClawHome, ".openclaw/extensions/mnemospark/dist/cli.js");
|
|
4607
|
-
return `
|
|
4610
|
+
return `Execute: node ${cliPath} cloud ${renewalArgs}`;
|
|
4608
4611
|
}
|
|
4609
4612
|
function parseStoragePaymentCronCommand(command) {
|
|
4610
4613
|
const objectIdMatch = command.match(/--object-id\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\S+)/);
|
|
@@ -4930,9 +4933,11 @@ function formatPriceStorageUserMessage(quote, localArchiveHint) {
|
|
|
4930
4933
|
function quoteLookupMatchesPriceStorageResponse(lookup, quote) {
|
|
4931
4934
|
return lookup.quoteId === quote.quote_id && lookup.walletAddress.trim().toLowerCase() === quote.addr.trim().toLowerCase() && lookup.objectId === quote.object_id && lookup.objectIdHash.toLowerCase() === quote.object_id_hash.toLowerCase() && lookup.storagePrice === quote.storage_price && lookup.provider === quote.provider && lookup.location === quote.location;
|
|
4932
4935
|
}
|
|
4936
|
+
var DEFAULT_BACKUP_QUOTE_PROVIDER = "aws";
|
|
4937
|
+
var DEFAULT_BACKUP_QUOTE_REGION = "us-east-1";
|
|
4933
4938
|
function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
|
|
4934
4939
|
const hash = result.objectIdHash.replace(/\s/g, "");
|
|
4935
|
-
const priceStorageLine = `/mnemospark_cloud price-storage --wallet-address \`${walletAddress}\` --object-id \`${result.objectId}\` --object-id-hash \`${hash}\` --gb \`${result.objectSizeGb}\` --provider
|
|
4940
|
+
const priceStorageLine = `/mnemospark_cloud price-storage --wallet-address \`${walletAddress}\` --object-id \`${result.objectId}\` --object-id-hash \`${hash}\` --gb \`${result.objectSizeGb}\` --provider ${DEFAULT_BACKUP_QUOTE_PROVIDER} --region ${DEFAULT_BACKUP_QUOTE_REGION}`;
|
|
4936
4941
|
return [
|
|
4937
4942
|
`Backup archive: \`${result.archivePath}\``,
|
|
4938
4943
|
"",
|
|
@@ -4941,10 +4946,12 @@ function formatBackupSuccessUserMessage(result, walletAddress, friendlyName) {
|
|
|
4941
4946
|
`object-id-hash: ${hash}`,
|
|
4942
4947
|
`object-size: ${result.objectSizeGb}`,
|
|
4943
4948
|
"",
|
|
4944
|
-
"Next, request a storage quote.
|
|
4949
|
+
"Next, request a storage quote.",
|
|
4945
4950
|
"",
|
|
4946
4951
|
priceStorageLine,
|
|
4947
4952
|
"",
|
|
4953
|
+
`The default region is ${DEFAULT_BACKUP_QUOTE_REGION}. Change the command parameters to switch regions (not required).`,
|
|
4954
|
+
"",
|
|
4948
4955
|
"Region examples (merge into the command above):",
|
|
4949
4956
|
"North America: `--provider aws --region us-east-1`",
|
|
4950
4957
|
"Europe: `--provider aws --region eu-north-1`",
|
|
@@ -5458,8 +5465,8 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5458
5465
|
const datastore = await createCloudDatastore(mnemosparkHomeDir);
|
|
5459
5466
|
const terminalOperationStatuses = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
5460
5467
|
const isTerminalOperationStatus = (status) => terminalOperationStatuses.has(status);
|
|
5461
|
-
const formatOperationStatus = (operation) =>
|
|
5462
|
-
|
|
5468
|
+
const formatOperationStatus = (operation) => {
|
|
5469
|
+
const meta = [
|
|
5463
5470
|
`operation-id: ${operation.operation_id}`,
|
|
5464
5471
|
`type: ${operation.type}`,
|
|
5465
5472
|
`status: ${operation.status}`,
|
|
@@ -5470,9 +5477,15 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5470
5477
|
operation.timeout_seconds ? `timeout-seconds: ${operation.timeout_seconds}` : null,
|
|
5471
5478
|
operation.error_code ? `error-code: ${operation.error_code}` : null,
|
|
5472
5479
|
operation.error_message ? `error-message: ${operation.error_message}` : null
|
|
5473
|
-
].filter((v) => Boolean(v)).join("\n")
|
|
5474
|
-
|
|
5475
|
-
|
|
5480
|
+
].filter((v) => Boolean(v)).join("\n");
|
|
5481
|
+
const withResult = operation.status === "succeeded" && operation.result_text?.trim() ? `${meta}
|
|
5482
|
+
|
|
5483
|
+
${operation.result_text}` : meta;
|
|
5484
|
+
return {
|
|
5485
|
+
text: withResult,
|
|
5486
|
+
isError: operation.status === "failed" || operation.status === "cancelled" || operation.status === "timed_out"
|
|
5487
|
+
};
|
|
5488
|
+
};
|
|
5476
5489
|
if (parsed.mode === "op-status") {
|
|
5477
5490
|
let operation = await datastore.findOperationById(parsed.operationId);
|
|
5478
5491
|
if (!operation) {
|
|
@@ -5809,7 +5822,7 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5809
5822
|
mnemosparkHomeDir
|
|
5810
5823
|
);
|
|
5811
5824
|
},
|
|
5812
|
-
onCompleted: async (sessionId) => {
|
|
5825
|
+
onCompleted: async (sessionId, result) => {
|
|
5813
5826
|
await datastore.upsertOperation({
|
|
5814
5827
|
operation_id: operationId,
|
|
5815
5828
|
type: opType,
|
|
@@ -5821,7 +5834,8 @@ async function runCloudCommandHandler(ctx, options, executionContext = {}) {
|
|
|
5821
5834
|
timeout_seconds: timeoutSeconds,
|
|
5822
5835
|
status: "succeeded",
|
|
5823
5836
|
error_code: null,
|
|
5824
|
-
error_message: null
|
|
5837
|
+
error_message: null,
|
|
5838
|
+
result_text: result.isError ? null : result.text
|
|
5825
5839
|
});
|
|
5826
5840
|
await emitOperationEventBestEffort(
|
|
5827
5841
|
"operation.completed",
|
|
@@ -5998,7 +6012,8 @@ operation-id: ${operationId}`,
|
|
|
5998
6012
|
orchestrator: "inline",
|
|
5999
6013
|
status: result.isError ? "failed" : "succeeded",
|
|
6000
6014
|
error_code: result.isError ? "ASYNC_FAILED" : null,
|
|
6001
|
-
error_message: result.isError ? result.text : null
|
|
6015
|
+
error_message: result.isError ? result.text : null,
|
|
6016
|
+
result_text: result.isError ? null : result.text
|
|
6002
6017
|
});
|
|
6003
6018
|
await emitOperationEventBestEffort(
|
|
6004
6019
|
"operation.completed",
|
|
@@ -6078,7 +6093,7 @@ operation-id: ${operationId}`,
|
|
|
6078
6093
|
await emitCloudEventBestEffort(
|
|
6079
6094
|
"backup.completed",
|
|
6080
6095
|
{
|
|
6081
|
-
operation_id: randomUUID3(),
|
|
6096
|
+
operation_id: executionContext.forcedOperationId?.trim() || randomUUID3(),
|
|
6082
6097
|
object_id: result.objectId,
|
|
6083
6098
|
status: "succeeded",
|
|
6084
6099
|
details: {
|