@agentvault/agentvault 0.20.2 → 0.20.4

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