@agentvault/agentvault 0.20.2 → 0.20.3

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
@@ -67194,6 +67194,63 @@ ${messageText}`;
67194
67194
  } catch {
67195
67195
  }
67196
67196
  }
67197
+ for (const [chId, chState] of Object.entries(this._persisted?.a2aChannels ?? {})) {
67198
+ if (!chState.mlsGroupId) continue;
67199
+ const mlsGroup = this._mlsGroups.get(`a2a:${chId}`);
67200
+ if (!mlsGroup?.isInitialized) continue;
67201
+ try {
67202
+ const pendingRes = await fetch(
67203
+ `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/pending-welcomes`,
67204
+ { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
67205
+ );
67206
+ if (!pendingRes.ok) continue;
67207
+ const pending = await pendingRes.json();
67208
+ if (pending.length === 0) continue;
67209
+ console.log(`[SecureChannel] ${pending.length} pending A2A Welcome requests for channel ${chId.slice(0, 8)}`);
67210
+ for (const req of pending) {
67211
+ try {
67212
+ const kpRes = await fetch(
67213
+ `${this.config.apiUrl}/api/v1/mls/key-packages/batch?device_ids=${req.requesting_device_id}`,
67214
+ { headers: { Authorization: `Bearer ${this._deviceJwt}` } }
67215
+ );
67216
+ if (!kpRes.ok) continue;
67217
+ const kpArr = await kpRes.json();
67218
+ if (kpArr.length === 0) continue;
67219
+ const kpBytes = new Uint8Array(Buffer.from(kpArr[0].key_package, "hex"));
67220
+ const memberKp = MLSGroupManager.deserializeKeyPackage(kpBytes);
67221
+ const { commit, welcome } = await mlsGroup.addMembers([memberKp]);
67222
+ if (welcome && this._ws) {
67223
+ this._ws.send(JSON.stringify({
67224
+ event: "mls_commit",
67225
+ data: { group_id: chState.mlsGroupId, epoch: Number(mlsGroup.epoch), payload: Buffer.from(commit).toString("hex") }
67226
+ }));
67227
+ this._ws.send(JSON.stringify({
67228
+ event: "mls_welcome",
67229
+ data: {
67230
+ target_device_id: req.requesting_device_id,
67231
+ group_id: chState.mlsGroupId,
67232
+ a2a_channel_id: chId,
67233
+ payload: Buffer.from(welcome).toString("hex")
67234
+ }
67235
+ }));
67236
+ }
67237
+ await fetch(
67238
+ `${this.config.apiUrl}/api/v1/mls/groups/${chState.mlsGroupId}/fulfill-welcome`,
67239
+ {
67240
+ method: "POST",
67241
+ headers: { Authorization: `Bearer ${this._deviceJwt}`, "Content-Type": "application/json" },
67242
+ body: JSON.stringify({ request_id: req.id })
67243
+ }
67244
+ );
67245
+ await saveMlsState(this.config.dataDir, chState.mlsGroupId, JSON.stringify(mlsGroup.exportState()));
67246
+ console.log(`[SecureChannel] Fulfilled A2A Welcome for ${req.requesting_device_id.slice(0, 8)} in channel ${chId.slice(0, 8)}`);
67247
+ } catch (fulfillErr) {
67248
+ console.warn(`[SecureChannel] A2A Welcome fulfill failed:`, fulfillErr);
67249
+ }
67250
+ }
67251
+ } catch {
67252
+ }
67253
+ }
67197
67254
  } catch (err) {
67198
67255
  console.warn("[SecureChannel] Delivery pull error:", err);
67199
67256
  } finally {
@@ -94431,7 +94488,7 @@ var init_index = __esm({
94431
94488
  init_skill_invoker();
94432
94489
  await init_skill_telemetry();
94433
94490
  await init_policy_enforcer();
94434
- VERSION = true ? "0.20.2" : "0.0.0-dev";
94491
+ VERSION = true ? "0.20.3" : "0.0.0-dev";
94435
94492
  }
94436
94493
  });
94437
94494
  await init_index();