@agentvault/agentvault 0.13.10 → 0.13.11

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({
@@ -47948,8 +47968,28 @@ ${messageText}`;
47948
47968
  const session = this._sessions.get(msg.conversation_id);
47949
47969
  if (!session) {
47950
47970
  console.warn(
47951
- `[SecureChannel] No session for conversation ${msg.conversation_id} during sync, skipping`
47971
+ `[SecureChannel] No session for conversation ${msg.conversation_id} during sync, requesting resync`
47952
47972
  );
47973
+ const RESYNC_COOLDOWN_MS = 5 * 60 * 1e3;
47974
+ const lastResync = this._lastResyncRequest.get(msg.conversation_id) ?? 0;
47975
+ if (Date.now() - lastResync > RESYNC_COOLDOWN_MS && this._ws && this._persisted) {
47976
+ this._lastResyncRequest.set(msg.conversation_id, Date.now());
47977
+ this._ws.send(
47978
+ JSON.stringify({
47979
+ event: "resync_request",
47980
+ data: {
47981
+ conversation_id: msg.conversation_id,
47982
+ reason: "no_session",
47983
+ identity_public_key: this._persisted.identityKeypair.publicKey,
47984
+ ephemeral_public_key: this._persisted.ephemeralKeypair.publicKey
47985
+ }
47986
+ })
47987
+ );
47988
+ this.emit("resync_requested", {
47989
+ conversationId: msg.conversation_id,
47990
+ reason: "no_session"
47991
+ });
47992
+ }
47953
47993
  continue;
47954
47994
  }
47955
47995
  try {