@agentvault/agentvault 0.20.12 → 0.20.13

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
@@ -67260,44 +67260,58 @@ ${messageText}`;
67260
67260
  if (!kpHex) continue;
67261
67261
  const kpBytes = new Uint8Array(Buffer.from(kpHex, "hex"));
67262
67262
  const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
67263
+ console.log(`[SecureChannel] A2A addMembers for ${req.requesting_device_id.slice(0, 8)} group=${chState.mlsGroupId.slice(0, 8)} epoch=${mlsGroup.epoch}`);
67263
67264
  const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
67264
- if (welcome) {
67265
- const commitHex = Buffer.from(commit).toString("hex");
67266
- const welcomeHex = Buffer.from(welcome).toString("hex");
67267
- try {
67268
- await fetch(
67269
- `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/distribute`,
67270
- {
67271
- method: "POST",
67272
- headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
67273
- body: JSON.stringify({
67274
- device_id: this._deviceId,
67275
- commit: commitHex,
67276
- commit_epoch: Number(mlsGroup.epoch),
67277
- welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
67278
- member_device_ids: [this._deviceId, req.requesting_device_id]
67279
- })
67280
- }
67281
- );
67282
- } catch (distErr) {
67283
- if (this._ws) {
67284
- this._ws.send(JSON.stringify({
67285
- event: "mls_commit",
67286
- data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
67287
- }));
67288
- this._ws.send(JSON.stringify({
67289
- event: "mls_welcome",
67290
- data: {
67291
- target_device_id: req.requesting_device_id,
67292
- group_id: chState.mlsGroupId,
67293
- a2a_channel_id: chId,
67294
- payload: welcomeHex
67295
- }
67296
- }));
67297
- } else {
67298
- console.warn(`[SecureChannel] Cannot deliver Welcome \u2014 HTTP distribute and WS both unavailable`);
67265
+ if (!welcome) {
67266
+ console.warn(`[SecureChannel] A2A addMembers produced no Welcome for ${req.requesting_device_id.slice(0, 8)}`);
67267
+ continue;
67268
+ }
67269
+ const commitHex = Buffer.from(commit).toString("hex");
67270
+ const welcomeHex = Buffer.from(welcome).toString("hex");
67271
+ let distributed = false;
67272
+ try {
67273
+ const distResp = await fetch(
67274
+ `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/distribute`,
67275
+ {
67276
+ method: "POST",
67277
+ headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
67278
+ body: JSON.stringify({
67279
+ device_id: this._deviceId,
67280
+ commit: commitHex,
67281
+ commit_epoch: Number(mlsGroup.epoch),
67282
+ welcomes: [{ target_device_id: req.requesting_device_id, payload: welcomeHex }],
67283
+ member_device_ids: [this._deviceId, req.requesting_device_id]
67284
+ })
67299
67285
  }
67286
+ );
67287
+ if (distResp.ok) {
67288
+ distributed = true;
67289
+ } else {
67290
+ const detail = await distResp.text().catch(() => "");
67291
+ console.warn(`[SecureChannel] A2A distribute failed (${distResp.status}): ${detail}`);
67300
67292
  }
67293
+ } catch (distErr) {
67294
+ console.warn(`[SecureChannel] A2A distribute network error:`, distErr);
67295
+ }
67296
+ if (!distributed && this._ws) {
67297
+ this._ws.send(JSON.stringify({
67298
+ event: "mls_commit",
67299
+ data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: commitHex }
67300
+ }));
67301
+ this._ws.send(JSON.stringify({
67302
+ event: "mls_welcome",
67303
+ data: {
67304
+ target_device_id: req.requesting_device_id,
67305
+ group_id: chState.mlsGroupId,
67306
+ a2a_channel_id: chId,
67307
+ payload: welcomeHex
67308
+ }
67309
+ }));
67310
+ distributed = true;
67311
+ }
67312
+ if (!distributed) {
67313
+ console.warn(`[SecureChannel] Cannot deliver Welcome \u2014 HTTP distribute and WS both unavailable`);
67314
+ continue;
67301
67315
  }
67302
67316
  await fetch(
67303
67317
  `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/fulfill-welcome`,
@@ -94553,7 +94567,7 @@ var init_index = __esm({
94553
94567
  init_skill_invoker();
94554
94568
  await init_skill_telemetry();
94555
94569
  await init_policy_enforcer();
94556
- VERSION = true ? "0.20.12" : "0.0.0-dev";
94570
+ VERSION = true ? "0.20.13" : "0.0.0-dev";
94557
94571
  }
94558
94572
  });
94559
94573
  await init_index();