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