@agentvault/agentvault 0.13.10 → 0.13.12

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
@@ -47312,8 +47312,28 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
47312
47312
  const session = this._sessions.get(convId);
47313
47313
  if (!session) {
47314
47314
  console.warn(
47315
- `[SecureChannel] No session for conversation ${convId}, skipping`
47315
+ `[SecureChannel] No session for conversation ${convId}, requesting resync`
47316
47316
  );
47317
+ const RESYNC_COOLDOWN_MS = 5 * 60 * 1e3;
47318
+ const lastResync = this._lastResyncRequest.get(convId) ?? 0;
47319
+ if (Date.now() - lastResync > RESYNC_COOLDOWN_MS && this._ws && this._persisted) {
47320
+ this._lastResyncRequest.set(convId, Date.now());
47321
+ this._ws.send(
47322
+ JSON.stringify({
47323
+ event: "resync_request",
47324
+ data: {
47325
+ conversation_id: convId,
47326
+ reason: "no_session",
47327
+ identity_public_key: this._persisted.identityKeypair.publicKey,
47328
+ ephemeral_public_key: this._persisted.ephemeralKeypair.publicKey
47329
+ }
47330
+ })
47331
+ );
47332
+ this.emit("resync_requested", {
47333
+ conversationId: convId,
47334
+ reason: "no_session"
47335
+ });
47336
+ }
47317
47337
  return;
47318
47338
  }
47319
47339
  const encrypted = transportToEncryptedMessage({