@agentvault/claude-bridge 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68497,6 +68497,21 @@ ${messageText}`;
68497
68497
  return;
68498
68498
  }
68499
68499
  }
68500
+ if (welcomeRoomId && this._persisted) {
68501
+ await this._registerRoomFromWelcome(
68502
+ welcomeRoomId,
68503
+ groupId,
68504
+ mgr,
68505
+ data.room_name
68506
+ );
68507
+ this._pendingMlsKpBundle = void 0;
68508
+ await releaseA2ASyncLock(this.config.dataDir, `room-kp-${groupId}`).catch(() => {
68509
+ });
68510
+ console.log(
68511
+ `[SecureChannel] Registered room ${welcomeRoomId.slice(0, 8)} from unmatched Welcome (epoch=${mgr.epoch})`
68512
+ );
68513
+ return;
68514
+ }
68500
68515
  const a2aChannelId = data.a2a_channel_id;
68501
68516
  for (const [channelId, entry] of Object.entries(this._persisted?.a2aChannels ?? {})) {
68502
68517
  if (entry.mlsGroupId === groupId || channelId === a2aChannelId) {
@@ -68553,6 +68568,33 @@ ${messageText}`;
68553
68568
  throw err;
68554
68569
  }
68555
68570
  }
68571
+ /**
68572
+ * Self-bootstrap a room entry + MLS group mapping from a Welcome whose room is
68573
+ * not yet persisted. Happens when we were added to an EXISTING room and the
68574
+ * `room_joined` that registers the room raced behind (or was lost relative to)
68575
+ * the Welcome. Without a room entry the Welcome room-match loop can't match, and
68576
+ * every subsequent room message is dropped with "No room found for MLS group".
68577
+ * Mirrors the A2A self-bootstrap fallback. The backend now also sends the new
68578
+ * device its own `room_joined` (PR #412); this is defense-in-depth for the race
68579
+ * where that delivery is missed. A later `room_joined` enriches name/members.
68580
+ */
68581
+ async _registerRoomFromWelcome(roomId, groupId, mgr, roomName) {
68582
+ if (!this._persisted) return;
68583
+ if (!this._persisted.rooms) this._persisted.rooms = {};
68584
+ const existing = this._persisted.rooms[roomId];
68585
+ this._persisted.rooms[roomId] = {
68586
+ roomId,
68587
+ name: existing?.name ?? (roomName ?? ""),
68588
+ conversationIds: existing?.conversationIds ?? [],
68589
+ members: existing?.members ?? [],
68590
+ mlsGroupId: groupId,
68591
+ lastMlsMessageTs: existing?.lastMlsMessageTs
68592
+ };
68593
+ this._mlsGroups.set(roomId, mgr);
68594
+ await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mgr.exportState()));
68595
+ await this._persistState();
68596
+ await this._applyBufferedMlsCommits(groupId, mgr);
68597
+ }
68556
68598
  /**
68557
68599
  * Pull pending MLS messages from the delivery queue and process them.
68558
68600
  * Called on WS connect, on mls_delivery ping, and every 30s heartbeat.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentvault/claude-bridge",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "AgentVault Claude Bridge — daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
6
6
  "main": "dist/index.js",