@agentvault/agentvault 0.20.19 → 0.20.21

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/dist/index.js CHANGED
@@ -67062,10 +67062,38 @@ ${messageText}`;
67062
67062
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
67063
67063
  console.log(`[SecureChannel] MLS commit processed for room ${roomId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
67064
67064
  } catch (err) {
67065
- console.error(`[SecureChannel] MLS commit failed for room ${roomId.slice(0, 8)}:`, err);
67065
+ const isOldEpoch = err?.message?.includes("epoch") || err?.message?.includes("old") || err?.message?.includes("Validation");
67066
+ if (isOldEpoch) {
67067
+ console.log(`[SecureChannel] Discarding old-epoch commit for room ${roomId.slice(0, 8)}`);
67068
+ } else {
67069
+ console.error(`[SecureChannel] MLS commit failed for room ${roomId.slice(0, 8)}:`, err);
67070
+ throw err;
67071
+ }
67066
67072
  }
67067
67073
  }
67068
- break;
67074
+ return;
67075
+ }
67076
+ }
67077
+ for (const [chId, chState] of Object.entries(this._persisted?.a2aChannels ?? {})) {
67078
+ if (chState.mlsGroupId === groupId) {
67079
+ const mlsGroup = this._mlsGroups.get(`a2a:${chId}`);
67080
+ if (mlsGroup?.isInitialized) {
67081
+ try {
67082
+ const commitBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
67083
+ await mlsGroup.processCommit(commitBytes);
67084
+ await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mlsGroup.exportState()));
67085
+ console.log(`[SecureChannel] MLS commit processed for A2A ${chId.slice(0, 8)} (epoch=${mlsGroup.epoch})`);
67086
+ } catch (err) {
67087
+ const isOldEpoch = err?.message?.includes("epoch") || err?.message?.includes("old") || err?.message?.includes("Validation");
67088
+ if (isOldEpoch) {
67089
+ console.log(`[SecureChannel] Discarding old-epoch commit for A2A ${chId.slice(0, 8)}`);
67090
+ } else {
67091
+ console.error(`[SecureChannel] MLS commit failed for A2A ${chId.slice(0, 8)}:`, err);
67092
+ throw err;
67093
+ }
67094
+ }
67095
+ }
67096
+ return;
67069
67097
  }
67070
67098
  }
67071
67099
  }
@@ -67561,7 +67589,24 @@ ${messageText}`;
67561
67589
  console.warn(`[SecureChannel] No A2A channel for MLS group ${groupId?.slice(0, 8)}`);
67562
67590
  return;
67563
67591
  }
67564
- const mlsGroup = this._mlsGroups.get(`a2a:${a2aChannelId}`);
67592
+ let mlsGroup = this._mlsGroups.get(`a2a:${a2aChannelId}`);
67593
+ if (!mlsGroup?.isInitialized) {
67594
+ const entry = this._persisted?.a2aChannels?.[a2aChannelId];
67595
+ const mlsGroupId = entry?.mlsGroupId || groupId;
67596
+ if (mlsGroupId) {
67597
+ try {
67598
+ const savedState = await loadMlsState(this.config.dataDir, mlsGroupId);
67599
+ if (savedState) {
67600
+ const mgr = new MLSGroupManager();
67601
+ mgr.importState(JSON.parse(savedState));
67602
+ this._mlsGroups.set(`a2a:${a2aChannelId}`, mgr);
67603
+ mlsGroup = mgr;
67604
+ console.log(`[SecureChannel] Restored A2A MLS state for ${a2aChannelId.slice(0, 8)} on message receive (epoch=${mgr.epoch})`);
67605
+ }
67606
+ } catch {
67607
+ }
67608
+ }
67609
+ }
67565
67610
  if (!mlsGroup?.isInitialized) {
67566
67611
  console.warn(`[SecureChannel] MLS group not loaded for A2A ${a2aChannelId.slice(0, 8)}`);
67567
67612
  return;
@@ -94759,7 +94804,7 @@ var init_index = __esm({
94759
94804
  init_skill_invoker();
94760
94805
  await init_skill_telemetry();
94761
94806
  await init_policy_enforcer();
94762
- VERSION = true ? "0.20.19" : "0.0.0-dev";
94807
+ VERSION = true ? "0.20.21" : "0.0.0-dev";
94763
94808
  }
94764
94809
  });
94765
94810
  await init_index();