@agentvault/agentvault 0.10.1 → 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"}
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EAWL,iBAAiB,EAClB,MAAM,oBA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,6BAA6B;IA6C3C;;;OAGG;YACW,iBAAiB;IAwD/B;;;OAGG;IACG,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IA8ChB;;;OAGG;YACW,oBAAoB;IAqClC;;;OAGG;YACW,uBAAuB;IAkCrC;;;;OAIG;YACW,mBAAmB;IAkEjC;;;OAGG;YACW,kBAAkB;IAqMhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAiBlC;;;OAGG;IACH;;;OAGG;YACW,mBAAmB;IAsHjC,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,UAAU;YAMJ,mBAAmB;IAmCjC,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,gBAAgB;YAOV,qBAAqB;IAuCnC,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,kBAAkB;IAmH1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAKpB;;;OAGG;YACW,aAAa;CAmB5B"}
package/dist/cli.js CHANGED
@@ -45755,6 +45755,7 @@ var init_channel = __esm({
45755
45755
  if (this._sessions.size === 0) {
45756
45756
  throw new Error("No active sessions");
45757
45757
  }
45758
+ const targetConvId = options?.conversationId;
45758
45759
  const topicId = options?.topicId ?? this._lastIncomingTopicId ?? this._persisted?.defaultTopicId;
45759
45760
  const messageType = options?.messageType ?? "text";
45760
45761
  const priority = options?.priority ?? "normal";
@@ -45779,51 +45780,61 @@ var init_channel = __esm({
45779
45780
  }
45780
45781
  }
45781
45782
  const messageGroupId = randomUUID();
45783
+ let sentCount = 0;
45782
45784
  for (const [convId, session] of this._sessions) {
45783
45785
  if (!session.activated) continue;
45784
45786
  if (roomConvIds.has(convId)) continue;
45785
- const encrypted = session.ratchet.encrypt(plaintext);
45786
- const transport = encryptedMessageToTransport(encrypted);
45787
- const msg = {
45788
- convId,
45789
- headerBlob: transport.header_blob,
45790
- ciphertext: transport.ciphertext,
45791
- messageGroupId,
45792
- topicId
45793
- };
45794
- if (this._state === "ready" && this._ws) {
45795
- const payload = {
45796
- conversation_id: msg.convId,
45797
- header_blob: msg.headerBlob,
45798
- ciphertext: msg.ciphertext,
45799
- message_group_id: msg.messageGroupId,
45800
- topic_id: msg.topicId,
45801
- message_type: messageType,
45802
- priority,
45803
- parent_span_id: parentSpanId,
45804
- metadata: scanStatus ? { ...envelopeMetadata ?? {}, scan_status: scanStatus } : envelopeMetadata
45787
+ if (targetConvId && convId !== targetConvId) continue;
45788
+ try {
45789
+ const encrypted = session.ratchet.encrypt(plaintext);
45790
+ const transport = encryptedMessageToTransport(encrypted);
45791
+ const msg = {
45792
+ convId,
45793
+ headerBlob: transport.header_blob,
45794
+ ciphertext: transport.ciphertext,
45795
+ messageGroupId,
45796
+ topicId
45805
45797
  };
45806
- if (this._persisted?.hubAddress) {
45807
- payload.hub_address = this._persisted.hubAddress;
45808
- }
45809
- this._ws.send(
45810
- JSON.stringify({
45811
- event: "message",
45812
- data: payload
45813
- })
45814
- );
45815
- } else {
45816
- if (!this._persisted.outboundQueue) {
45817
- this._persisted.outboundQueue = [];
45818
- }
45819
- if (this._persisted.outboundQueue.length >= 50) {
45820
- this._persisted.outboundQueue.shift();
45821
- console.warn("[SecureChannel] Outbound queue full, dropping oldest message");
45798
+ if (this._state === "ready" && this._ws) {
45799
+ const payload = {
45800
+ conversation_id: msg.convId,
45801
+ header_blob: msg.headerBlob,
45802
+ ciphertext: msg.ciphertext,
45803
+ message_group_id: msg.messageGroupId,
45804
+ topic_id: msg.topicId,
45805
+ message_type: messageType,
45806
+ priority,
45807
+ parent_span_id: parentSpanId,
45808
+ metadata: scanStatus ? { ...envelopeMetadata ?? {}, scan_status: scanStatus } : envelopeMetadata
45809
+ };
45810
+ if (this._persisted?.hubAddress) {
45811
+ payload.hub_address = this._persisted.hubAddress;
45812
+ }
45813
+ this._ws.send(
45814
+ JSON.stringify({
45815
+ event: "message",
45816
+ data: payload
45817
+ })
45818
+ );
45819
+ } else {
45820
+ if (!this._persisted.outboundQueue) {
45821
+ this._persisted.outboundQueue = [];
45822
+ }
45823
+ if (this._persisted.outboundQueue.length >= 50) {
45824
+ this._persisted.outboundQueue.shift();
45825
+ console.warn("[SecureChannel] Outbound queue full, dropping oldest message");
45826
+ }
45827
+ this._persisted.outboundQueue.push(msg);
45828
+ console.log(`[SecureChannel] Message queued (state=${this._state}, queue=${this._persisted.outboundQueue.length})`);
45822
45829
  }
45823
- this._persisted.outboundQueue.push(msg);
45824
- console.log(`[SecureChannel] Message queued (state=${this._state}, queue=${this._persisted.outboundQueue.length})`);
45830
+ sentCount++;
45831
+ } catch (err) {
45832
+ console.error(`[SecureChannel] send() failed for conv ${convId.slice(0, 8)}...:`, err);
45825
45833
  }
45826
45834
  }
45835
+ if (sentCount === 0 && this._sessions.size > 0) {
45836
+ console.warn("[SecureChannel] send() delivered to 0 sessions (all skipped or failed)");
45837
+ }
45827
45838
  await this._persistState();
45828
45839
  }
45829
45840
  /**
@@ -48015,11 +48026,19 @@ ${messageText}`;
48015
48026
  }
48016
48027
  });
48017
48028
 
48029
+ // src/account-config.ts
48030
+ var init_account_config = __esm({
48031
+ "src/account-config.ts"() {
48032
+ "use strict";
48033
+ }
48034
+ });
48035
+
48018
48036
  // src/openclaw-plugin.ts
48019
48037
  var init_openclaw_plugin = __esm({
48020
48038
  async "src/openclaw-plugin.ts"() {
48021
48039
  "use strict";
48022
48040
  await init_channel();
48041
+ init_account_config();
48023
48042
  }
48024
48043
  });
48025
48044
 
@@ -48091,9 +48110,10 @@ var init_index = __esm({
48091
48110
  async "src/index.ts"() {
48092
48111
  "use strict";
48093
48112
  await init_channel();
48113
+ init_account_config();
48094
48114
  await init_openclaw_plugin();
48095
48115
  init_gateway_send();
48096
- VERSION = "0.9.0";
48116
+ VERSION = "0.11.0";
48097
48117
  }
48098
48118
  });
48099
48119
 
@@ -48115,7 +48135,8 @@ async function runSetupCommand(options) {
48115
48135
  \u2551 AgentVault \u2014 First-Time Setup \u2551
48116
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
48117
48137
 
48118
- Agent name : ${name2}
48138
+ Agent name : ${name2}${options.accountId ? `
48139
+ Account ID : ${options.accountId}` : ""}
48119
48140
  Data dir : ${dataDir2}
48120
48141
  API : ${apiUrl2}
48121
48142
  `);
@@ -48186,7 +48207,36 @@ async function runSetupCommand(options) {
48186
48207
  const env = { ...process.env, PATH: `${extraPaths}:${process.env.PATH ?? ""}` };
48187
48208
  const pluginInstalled = installPlugin(env);
48188
48209
  if (!pluginInstalled) {
48189
- 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(`
48190
48240
  \u26A0\uFE0F Could not auto-configure OpenClaw (is 'openclaw' in your PATH?).
48191
48241
 
48192
48242
  1. Install the plugin:
@@ -48211,13 +48261,17 @@ async function runSetupCommand(options) {
48211
48261
  5. Restart the gateway:
48212
48262
  openclaw gateway restart
48213
48263
  `);
48264
+ }
48214
48265
  return;
48215
48266
  }
48216
48267
  console.log("\n Registering AgentVault channel in OpenClaw config...\n");
48268
+ const configPrefix = options.accountId ? `channels.agentvault.accounts.${options.accountId}` : "channels.agentvault";
48217
48269
  const patchCommands = [
48218
- `openclaw config set channels.agentvault.dataDir "${dataDir2}"`,
48219
- `openclaw config set channels.agentvault.apiUrl "${apiUrl2}"`,
48220
- `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}"`,
48221
48275
  `openclaw config set plugins.allow '["agentvault"]'`
48222
48276
  ];
48223
48277
  let configPatched = false;
@@ -48237,7 +48291,23 @@ async function runSetupCommand(options) {
48237
48291
  configurePm2(env);
48238
48292
  await promptAndRestart(env);
48239
48293
  } else {
48240
- 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.
48241
48311
  Add this to your OpenClaw config (openclaw.yaml or openclaw.json) manually:
48242
48312
 
48243
48313
  channels:
@@ -48249,6 +48319,7 @@ async function runSetupCommand(options) {
48249
48319
  Then restart OpenClaw:
48250
48320
  openclaw gateway restart
48251
48321
  `);
48322
+ }
48252
48323
  }
48253
48324
  }
48254
48325
  function installPlugin(env) {
@@ -48427,6 +48498,7 @@ var name = flags["name"] || process.env.AGENTVAULT_AGENT_NAME || "CLI Agent";
48427
48498
  var dataDir = flags["data-dir"] || process.env.AGENTVAULT_DATA_DIR || "./agentvault-data";
48428
48499
  var apiUrl = flags["api-url"] || process.env.AGENTVAULT_API_URL || "https://api.agentvault.chat";
48429
48500
  var webhookUrl = flags["webhook-url"] || process.env.AGENTVAULT_WEBHOOK_URL;
48501
+ var accountId = flags["account-id"] || process.env.AGENTVAULT_ACCOUNT_ID;
48430
48502
  var noNotifications = flags["no-notifications"] === "true" || process.env.AGENTVAULT_NO_NOTIFICATIONS === "1";
48431
48503
  if (subcommand === "setup") {
48432
48504
  if (!token) {
@@ -48441,6 +48513,7 @@ Options:
48441
48513
  --name=NAME Agent display name (default: "CLI Agent")
48442
48514
  --data-dir=PATH Directory for persistent state (default: ~/.openclaw/agentvault)
48443
48515
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
48516
+ --account-id=ID Multi-agent account identifier (e.g., "work", "research")
48444
48517
 
48445
48518
  This command:
48446
48519
  1. Enrolls this machine as your agent with AgentVault
@@ -48458,7 +48531,8 @@ After setup, restart OpenClaw \u2014 messages will flow automatically.
48458
48531
  token,
48459
48532
  name,
48460
48533
  apiUrl,
48461
- 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
48462
48536
  });
48463
48537
  process.exit(0);
48464
48538
  }
@@ -48524,6 +48598,7 @@ Options:
48524
48598
  --name=NAME Agent display name (default: "CLI Agent")
48525
48599
  --data-dir=PATH Directory for persistent state (default: ./agentvault-data)
48526
48600
  --api-url=URL API endpoint (default: https://api.agentvault.chat)
48601
+ --account-id=ID Multi-agent account identifier (e.g., "work", "research")
48527
48602
  --webhook-url=URL URL for HTTP webhook notifications on new messages
48528
48603
  --no-notifications Disable OS desktop notifications
48529
48604
  --port=PORT Gateway port for send/status (default: 18790)
@@ -48533,6 +48608,7 @@ Environment variables:
48533
48608
  AGENTVAULT_AGENT_NAME Same as --name
48534
48609
  AGENTVAULT_DATA_DIR Same as --data-dir
48535
48610
  AGENTVAULT_API_URL Same as --api-url
48611
+ AGENTVAULT_ACCOUNT_ID Same as --account-id
48536
48612
  AGENTVAULT_WEBHOOK_URL Same as --webhook-url
48537
48613
  AGENTVAULT_NO_NOTIFICATIONS Set to "1" to disable desktop notifications
48538
48614
  GATEWAY_SEND_PORT Same as --port for send/status