@agentvault/agentvault 0.10.2 → 0.11.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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shared multi-account config resolution for AgentVault OpenClaw plugin.
3
+ *
4
+ * Supports two config shapes:
5
+ * 1. Legacy single-agent: channels.agentvault.dataDir (returns ["default"])
6
+ * 2. Multi-agent: channels.agentvault.accounts.{id}.dataDir (returns account keys)
7
+ *
8
+ * When `accounts` key is present, it takes precedence over top-level dataDir.
9
+ */
10
+ export interface ResolvedAccount {
11
+ accountId: string;
12
+ dataDir: string;
13
+ apiUrl: string;
14
+ agentName: string;
15
+ httpPort: number;
16
+ configured: boolean;
17
+ }
18
+ export declare function listAccountIds(cfg: any): string[];
19
+ export declare function resolveAccount(cfg: any, accountId?: string): ResolvedAccount;
20
+ //# sourceMappingURL=account-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-config.d.ts","sourceRoot":"","sources":["../src/account-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,CAOjD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CA0C5E"}
package/dist/cli.js CHANGED
@@ -48026,11 +48026,19 @@ ${messageText}`;
48026
48026
  }
48027
48027
  });
48028
48028
 
48029
+ // src/account-config.ts
48030
+ var init_account_config = __esm({
48031
+ "src/account-config.ts"() {
48032
+ "use strict";
48033
+ }
48034
+ });
48035
+
48029
48036
  // src/openclaw-plugin.ts
48030
48037
  var init_openclaw_plugin = __esm({
48031
48038
  async "src/openclaw-plugin.ts"() {
48032
48039
  "use strict";
48033
48040
  await init_channel();
48041
+ init_account_config();
48034
48042
  }
48035
48043
  });
48036
48044
 
@@ -48102,9 +48110,10 @@ var init_index = __esm({
48102
48110
  async "src/index.ts"() {
48103
48111
  "use strict";
48104
48112
  await init_channel();
48113
+ init_account_config();
48105
48114
  await init_openclaw_plugin();
48106
48115
  init_gateway_send();
48107
- VERSION = "0.9.0";
48116
+ VERSION = "0.11.0";
48108
48117
  }
48109
48118
  });
48110
48119
 
@@ -48126,7 +48135,8 @@ async function runSetupCommand(options) {
48126
48135
  \u2551 AgentVault \u2014 First-Time Setup \u2551
48127
48136
  \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
48128
48137
 
48129
- Agent name : ${name2}
48138
+ Agent name : ${name2}${options.accountId ? `
48139
+ Account ID : ${options.accountId}` : ""}
48130
48140
  Data dir : ${dataDir2}
48131
48141
  API : ${apiUrl2}
48132
48142
  `);
@@ -48197,7 +48207,36 @@ async function runSetupCommand(options) {
48197
48207
  const env = { ...process.env, PATH: `${extraPaths}:${process.env.PATH ?? ""}` };
48198
48208
  const pluginInstalled = installPlugin(env);
48199
48209
  if (!pluginInstalled) {
48200
- console.log(`
48210
+ if (options.accountId) {
48211
+ console.log(`
48212
+ \u26A0\uFE0F Could not auto-configure OpenClaw (is 'openclaw' in your PATH?).
48213
+
48214
+ 1. Install the plugin:
48215
+ openclaw plugins install @agentvault/agentvault
48216
+
48217
+ 2. Register the plugin in the allow list:
48218
+ openclaw config set plugins.allow '["agentvault"]'
48219
+
48220
+ 3. Add this to your OpenClaw config (openclaw.yaml or openclaw.json):
48221
+ channels:
48222
+ agentvault:
48223
+ apiUrl: "${apiUrl2}"
48224
+ accounts:
48225
+ ${options.accountId}:
48226
+ dataDir: "${dataDir2}"
48227
+ agentName: "${name2}"
48228
+
48229
+ 4. (Recommended) Install pm2 for auto-restart and crash recovery:
48230
+ npm install -g pm2
48231
+ pm2 start "openclaw gateway start" --name openclaw-gateway
48232
+ pm2 startup
48233
+ pm2 save
48234
+
48235
+ 5. Restart the gateway:
48236
+ openclaw gateway restart
48237
+ `);
48238
+ } else {
48239
+ console.log(`
48201
48240
  \u26A0\uFE0F Could not auto-configure OpenClaw (is 'openclaw' in your PATH?).
48202
48241
 
48203
48242
  1. Install the plugin:
@@ -48222,13 +48261,17 @@ async function runSetupCommand(options) {
48222
48261
  5. Restart the gateway:
48223
48262
  openclaw gateway restart
48224
48263
  `);
48264
+ }
48225
48265
  return;
48226
48266
  }
48227
48267
  console.log("\n Registering AgentVault channel in OpenClaw config...\n");
48268
+ const configPrefix = options.accountId ? `channels.agentvault.accounts.${options.accountId}` : "channels.agentvault";
48228
48269
  const patchCommands = [
48229
- `openclaw config set channels.agentvault.dataDir "${dataDir2}"`,
48230
- `openclaw config set channels.agentvault.apiUrl "${apiUrl2}"`,
48231
- `openclaw config set channels.agentvault.agentName "${name2}"`,
48270
+ // When using multi-agent, set shared apiUrl at top level too
48271
+ ...options.accountId ? [`openclaw config set channels.agentvault.apiUrl "${apiUrl2}"`] : [],
48272
+ `openclaw config set ${configPrefix}.dataDir "${dataDir2}"`,
48273
+ `openclaw config set ${configPrefix}.apiUrl "${apiUrl2}"`,
48274
+ `openclaw config set ${configPrefix}.agentName "${name2}"`,
48232
48275
  `openclaw config set plugins.allow '["agentvault"]'`
48233
48276
  ];
48234
48277
  let configPatched = false;
@@ -48248,7 +48291,23 @@ async function runSetupCommand(options) {
48248
48291
  configurePm2(env);
48249
48292
  await promptAndRestart(env);
48250
48293
  } else {
48251
- console.log(` \u26A0\uFE0F Could not auto-configure OpenClaw channel.
48294
+ if (options.accountId) {
48295
+ console.log(` \u26A0\uFE0F Could not auto-configure OpenClaw channel.
48296
+ Add this to your OpenClaw config (openclaw.yaml or openclaw.json) manually:
48297
+
48298
+ channels:
48299
+ agentvault:
48300
+ apiUrl: "${apiUrl2}"
48301
+ accounts:
48302
+ ${options.accountId}:
48303
+ dataDir: "${dataDir2}"
48304
+ agentName: "${name2}"
48305
+
48306
+ Then restart OpenClaw:
48307
+ openclaw gateway restart
48308
+ `);
48309
+ } else {
48310
+ console.log(` \u26A0\uFE0F Could not auto-configure OpenClaw channel.
48252
48311
  Add this to your OpenClaw config (openclaw.yaml or openclaw.json) manually:
48253
48312
 
48254
48313
  channels:
@@ -48260,6 +48319,7 @@ async function runSetupCommand(options) {
48260
48319
  Then restart OpenClaw:
48261
48320
  openclaw gateway restart
48262
48321
  `);
48322
+ }
48263
48323
  }
48264
48324
  }
48265
48325
  function installPlugin(env) {
@@ -48438,6 +48498,7 @@ var name = flags["name"] || process.env.AGENTVAULT_AGENT_NAME || "CLI Agent";
48438
48498
  var dataDir = flags["data-dir"] || process.env.AGENTVAULT_DATA_DIR || "./agentvault-data";
48439
48499
  var apiUrl = flags["api-url"] || process.env.AGENTVAULT_API_URL || "https://api.agentvault.chat";
48440
48500
  var webhookUrl = flags["webhook-url"] || process.env.AGENTVAULT_WEBHOOK_URL;
48501
+ var accountId = flags["account-id"] || process.env.AGENTVAULT_ACCOUNT_ID;
48441
48502
  var noNotifications = flags["no-notifications"] === "true" || process.env.AGENTVAULT_NO_NOTIFICATIONS === "1";
48442
48503
  if (subcommand === "setup") {
48443
48504
  if (!token) {
@@ -48452,6 +48513,7 @@ Options:
48452
48513
  --name=NAME Agent display name (default: "CLI Agent")
48453
48514
  --data-dir=PATH Directory for persistent state (default: ~/.openclaw/agentvault)
48454
48515
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
48516
+ --account-id=ID Multi-agent account identifier (e.g., "work", "research")
48455
48517
 
48456
48518
  This command:
48457
48519
  1. Enrolls this machine as your agent with AgentVault
@@ -48469,7 +48531,8 @@ After setup, restart OpenClaw \u2014 messages will flow automatically.
48469
48531
  token,
48470
48532
  name,
48471
48533
  apiUrl,
48472
- dataDir: flags["data-dir"] || process.env.AGENTVAULT_DATA_DIR || "~/.openclaw/agentvault"
48534
+ dataDir: flags["data-dir"] || process.env.AGENTVAULT_DATA_DIR || (accountId ? `~/.openclaw/agents/${accountId}/agentvault` : "~/.openclaw/agentvault"),
48535
+ accountId
48473
48536
  });
48474
48537
  process.exit(0);
48475
48538
  }
@@ -48535,6 +48598,7 @@ Options:
48535
48598
  --name=NAME Agent display name (default: "CLI Agent")
48536
48599
  --data-dir=PATH Directory for persistent state (default: ./agentvault-data)
48537
48600
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
48601
+ --account-id=ID Multi-agent account identifier (e.g., "work", "research")
48538
48602
  --webhook-url=URL URL for HTTP webhook notifications on new messages
48539
48603
  --no-notifications Disable OS desktop notifications
48540
48604
  --port=PORT Gateway port for send/status (default: 18790)
@@ -48544,6 +48608,7 @@ Environment variables:
48544
48608
  AGENTVAULT_AGENT_NAME Same as --name
48545
48609
  AGENTVAULT_DATA_DIR Same as --data-dir
48546
48610
  AGENTVAULT_API_URL Same as --api-url
48611
+ AGENTVAULT_ACCOUNT_ID Same as --account-id
48547
48612
  AGENTVAULT_WEBHOOK_URL Same as --webhook-url
48548
48613
  AGENTVAULT_NO_NOTIFICATIONS Set to "1" to disable desktop notifications
48549
48614
  GATEWAY_SEND_PORT Same as --port for send/status