@agentvault/agentvault 0.20.22 → 0.20.24

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
@@ -62726,6 +62726,27 @@ function mlsFileName(groupId) {
62726
62726
  const safe = groupId.replace(/[^a-zA-Z0-9_-]/g, "_");
62727
62727
  return `mls-${safe}.json`;
62728
62728
  }
62729
+ async function hasPendingWelcome(dataDir, groupId) {
62730
+ try {
62731
+ const filePath = join(dataDir, `mls-kp-pending-${groupId.replace(/[^a-zA-Z0-9_-]/g, "_")}.lock`);
62732
+ await readFile(filePath);
62733
+ return true;
62734
+ } catch {
62735
+ return false;
62736
+ }
62737
+ }
62738
+ async function setPendingWelcome(dataDir, groupId) {
62739
+ await mkdir(dataDir, { recursive: true, mode: DIR_MODE });
62740
+ const filePath = join(dataDir, `mls-kp-pending-${groupId.replace(/[^a-zA-Z0-9_-]/g, "_")}.lock`);
62741
+ await writeFile(filePath, (/* @__PURE__ */ new Date()).toISOString(), { encoding: "utf-8", mode: FILE_MODE });
62742
+ }
62743
+ async function clearPendingWelcome(dataDir, groupId) {
62744
+ try {
62745
+ const filePath = join(dataDir, `mls-kp-pending-${groupId.replace(/[^a-zA-Z0-9_-]/g, "_")}.lock`);
62746
+ await rm(filePath);
62747
+ } catch {
62748
+ }
62749
+ }
62729
62750
  async function saveMlsState(dataDir, groupId, state) {
62730
62751
  await mkdir(dataDir, { recursive: true, mode: DIR_MODE });
62731
62752
  const filePath = join(dataDir, mlsFileName(groupId));
@@ -65233,6 +65254,11 @@ var init_channel = __esm({
65233
65254
  if (memberIds.includes(this._persisted.deviceId)) {
65234
65255
  console.log(`[SecureChannel] A2A ${chId.slice(0, 8)} member in server membership but no local MLS state \u2014 requesting Welcome`);
65235
65256
  }
65257
+ if (await hasPendingWelcome(this.config.dataDir, groupId)) {
65258
+ console.log(`[SecureChannel] A2A ${chId.slice(0, 8)} sync fallback: skipping \u2014 Welcome already pending for group=${groupId.slice(0, 8)}`);
65259
+ continue;
65260
+ }
65261
+ await setPendingWelcome(this.config.dataDir, groupId);
65236
65262
  const mgr = new MLSGroupManager();
65237
65263
  const identity = new TextEncoder().encode(this._persisted.deviceId);
65238
65264
  const kp = await mgr.generateKeyPackage(identity);
@@ -67142,6 +67168,9 @@ ${messageText}`;
67142
67168
  this._mlsGroups.set(`a2a:${channelId}`, mgr);
67143
67169
  await saveMlsState(this.config.dataDir, groupId, JSON.stringify(mgr.exportState()));
67144
67170
  await this._persistState();
67171
+ await clearPendingWelcome(this.config.dataDir, groupId).catch(() => {
67172
+ });
67173
+ this._pendingMlsKpBundle = void 0;
67145
67174
  console.log(`[SecureChannel] Joined MLS group for A2A ${channelId.slice(0, 8)} via Welcome (epoch=${mgr.epoch})`);
67146
67175
  if (this.config.onA2AChannelReady && entry.conversationId) {
67147
67176
  const firstPeer = entry.participants?.find((p2) => p2.status === "active" || p2.status === "invited");
@@ -94807,7 +94836,7 @@ var init_index = __esm({
94807
94836
  init_skill_invoker();
94808
94837
  await init_skill_telemetry();
94809
94838
  await init_policy_enforcer();
94810
- VERSION = true ? "0.20.22" : "0.0.0-dev";
94839
+ VERSION = true ? "0.20.24" : "0.0.0-dev";
94811
94840
  }
94812
94841
  });
94813
94842
  await init_index();