@agentvault/agentvault 0.20.20 → 0.20.22

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,17 +67062,46 @@ ${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
  }
67072
67100
  async _handleMlsWelcome(data) {
67073
67101
  const groupId = data.group_id;
67074
67102
  const conversationId = data.conversation_id;
67075
- console.log(`[SecureChannel] Received MLS welcome for group ${groupId?.slice(0, 8)}${conversationId ? ` conv=${conversationId.slice(0, 8)}` : ""}`);
67103
+ const kpSource = this._pendingMlsKpBundle ? "pending" : this._mlsKeyPackage ? "connect" : "generated";
67104
+ console.log(`[SecureChannel] Received MLS welcome for group ${groupId?.slice(0, 8)}${conversationId ? ` conv=${conversationId.slice(0, 8)}` : ""} kpSource=${kpSource}`);
67076
67105
  try {
67077
67106
  const welcomeBytes = new Uint8Array(Buffer.from(data.payload, "hex"));
67078
67107
  const mgr = new MLSGroupManager();
@@ -67080,6 +67109,7 @@ ${messageText}`;
67080
67109
  const identity = new TextEncoder().encode(this._deviceId);
67081
67110
  return mgr.generateKeyPackage(identity);
67082
67111
  })();
67112
+ console.log(`[SecureChannel] Welcome joinFromWelcome: group=${groupId?.slice(0, 8)} kpSource=${kpSource} welcomeLen=${welcomeBytes.length}`);
67083
67113
  await mgr.joinFromWelcome(welcomeBytes, kp);
67084
67114
  if (conversationId) {
67085
67115
  const key = `conv:${conversationId}`;
@@ -67146,7 +67176,8 @@ ${messageText}`;
67146
67176
  }
67147
67177
  console.warn(`[SecureChannel] MLS welcome for unmatched group ${groupId?.slice(0, 8)} (no room/A2A/conv match)`);
67148
67178
  } catch (err) {
67149
- console.error(`[SecureChannel] MLS welcome processing failed:`, err);
67179
+ console.error(`[SecureChannel] MLS welcome processing failed (kpSource=${kpSource}):`, err);
67180
+ throw err;
67150
67181
  }
67151
67182
  }
67152
67183
  /**
@@ -94776,7 +94807,7 @@ var init_index = __esm({
94776
94807
  init_skill_invoker();
94777
94808
  await init_skill_telemetry();
94778
94809
  await init_policy_enforcer();
94779
- VERSION = true ? "0.20.20" : "0.0.0-dev";
94810
+ VERSION = true ? "0.20.22" : "0.0.0-dev";
94780
94811
  }
94781
94812
  });
94782
94813
  await init_index();