@agentvault/agentvault 0.20.13 → 0.20.15

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/cli.js CHANGED
@@ -67262,7 +67262,49 @@ ${messageText}`;
67262
67262
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
67263
67263
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
67264
67264
  console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
67265
- const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
67265
+ let commit;
67266
+ let welcome;
67267
+ try {
67268
+ const result = await mlsGroup.addMembers([memberKp]);
67269
+ commit = result.commit;
67270
+ welcome = result.welcome;
67271
+ } catch (addErr) {
67272
+ const errMsg = addErr instanceof Error ? addErr.message : String(addErr);
67273
+ if (errMsg.includes("already in the group")) {
67274
+ console.log(`[SecureChannel] A2A member already in group \u2014 removing and re-adding ${req.requesting_device_id.slice(0, 8)}`);
67275
+ try {
67276
+ const identityBytes = new TextEncoder().encode(req.requesting_device_id);
67277
+ await mlsGroup.removeMember(identityBytes);
67278
+ const kpRes2 = await fetch(
67279
+ `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${req.requesting_device_id}`,
67280
+ { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
67281
+ );
67282
+ if (kpRes2.ok) {
67283
+ const kpData2 = await kpRes2.json();
67284
+ const kpHex2 = kpData2[req.requesting_device_id];
67285
+ if (kpHex2) {
67286
+ const kpBytes2 = new Uint8Array(Buffer.from(kpHex2, "hex"));
67287
+ const memberKp2 = MLSGroupManager.deserializeKeyPackage(kpBytes2);
67288
+ const result2 = await mlsGroup.addMembers([memberKp2]);
67289
+ commit = result2.commit;
67290
+ welcome = result2.welcome;
67291
+ } else {
67292
+ console.log(`[SecureChannel] A2A re-add: no fresh KeyPackage for ${req.requesting_device_id.slice(0, 8)}`);
67293
+ continue;
67294
+ }
67295
+ } else {
67296
+ console.log(`[SecureChannel] A2A re-add: KeyPackage fetch failed (${kpRes2.status})`);
67297
+ continue;
67298
+ }
67299
+ } catch (readdErr) {
67300
+ console.log(`[SecureChannel] A2A remove+re-add FAILED: ${readdErr instanceof Error ? readdErr.message : String(readdErr)}`);
67301
+ continue;
67302
+ }
67303
+ } else {
67304
+ console.log(`[SecureChannel] A2A addMembers FAILED: ${errMsg}`);
67305
+ continue;
67306
+ }
67307
+ }
67266
67308
  if (!welcome) {
67267
67309
  console.warn(`[SecureChannel] A2A addMembers produced no Welcome for ${req.requesting_device_id.slice(0, 8)}`);
67268
67310
  continue;
@@ -67325,7 +67367,7 @@ ${messageText}`;
67325
67367
  await saveMlsState(this.config.dataDir, chState.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
67326
67368
  console.log(`[SecureChannel] Fulfilled A2A Welcome for ${req.requesting_device_id.slice(0, 8)} in channel ${chId.slice(0, 8)}`);
67327
67369
  } catch (fulfillErr) {
67328
- console.warn(`[SecureChannel] A2A Welcome fulfill failed:`, fulfillErr);
67370
+ console.log(`[SecureChannel] A2A Welcome fulfill failed: ${fulfillErr instanceof Error ? fulfillErr.message : String(fulfillErr)}`);
67329
67371
  }
67330
67372
  }
67331
67373
  } catch {
@@ -88675,7 +88717,7 @@ var init_index = __esm({
88675
88717
  init_skill_invoker();
88676
88718
  await init_skill_telemetry();
88677
88719
  await init_policy_enforcer();
88678
- VERSION = true ? "0.20.13" : "0.0.0-dev";
88720
+ VERSION = true ? "0.20.15" : "0.0.0-dev";
88679
88721
  }
88680
88722
  });
88681
88723