@bobfrankston/mailx-imap 0.1.60 → 0.1.62

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.
Files changed (2) hide show
  1. package/index.js +38 -2
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -744,6 +744,20 @@ export class ImapManager extends EventEmitter {
744
744
  tokenDirectory: tokenDir,
745
745
  credentialsKey: "installed",
746
746
  loginHint: account.imap.user,
747
+ // Route info/error to the daemon log. oauthsupport's
748
+ // default logFn drops info silently — that masked "full
749
+ // reauth keeps firing" with no log trail (Bob 2026-05-25
750
+ // "the log should be showing the auth request"). With
751
+ // this, "Forcing consent prompt", "No valid token found,
752
+ // starting OAuth authentication", "Token refresh failed"
753
+ // all land in rmfmail-*.log under [oauth] prefix.
754
+ logFn: (type, message) => {
755
+ const prefix = ` [oauth ${account.id}]`;
756
+ if (type === "error")
757
+ console.error(`${prefix} ${message}`);
758
+ else
759
+ console.log(`${prefix} ${message}`);
760
+ },
747
761
  });
748
762
  const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`OAuth token fetch timeout (${TOKEN_FETCH_TIMEOUT_MS / 1000}s)`)), TOKEN_FETCH_TIMEOUT_MS));
749
763
  const result = await Promise.race([authPromise, timeoutPromise]);
@@ -4449,7 +4463,19 @@ export class ImapManager extends EventEmitter {
4449
4463
  return;
4450
4464
  let reconciled = 0;
4451
4465
  let appended = 0;
4452
- await this.withConnection(accountId, async (client) => {
4466
+ // Use a DEDICATED IMAP client for sent-sweep — do NOT share the
4467
+ // slow-lane ops client. The priority-INBOX sync grabs the slow-lane
4468
+ // client via getOpsClient() (no lane queueing) and runs SEARCH→FETCH
4469
+ // as a logical transaction; if sent-sweep's searchByHeader (SELECT
4470
+ // Sent → SEARCH → CLOSE) interleaves on the same wire between the
4471
+ // sync's SEARCH and FETCH, the FETCH lands with no mailbox selected
4472
+ // and Dovecot returns "BAD No mailbox selected" — new mail never
4473
+ // lands locally (Bob 2026-05-25: "not seeing recent mail").
4474
+ // iflow-direct serializes per-command, not per-task, so reusing the
4475
+ // shared client is unsafe across logical transactions. A dedicated
4476
+ // client is the smallest surgical fix.
4477
+ const client = await this.createClientWithLimit(accountId);
4478
+ try {
4453
4479
  for (const row of rows) {
4454
4480
  const msgId = row.message_id;
4455
4481
  if (!msgId)
@@ -4493,7 +4519,17 @@ export class ImapManager extends EventEmitter {
4493
4519
  }
4494
4520
  }
4495
4521
  }
4496
- }, { slow: true, timeoutMs: 120_000 });
4522
+ }
4523
+ finally {
4524
+ try {
4525
+ await (client._realLogout || client.logout)();
4526
+ }
4527
+ catch { /* */ }
4528
+ try {
4529
+ client.destroy?.();
4530
+ }
4531
+ catch { /* */ }
4532
+ }
4497
4533
  if (reconciled + appended > 0) {
4498
4534
  this.emit("folderCountsChanged", accountId, {});
4499
4535
  console.log(` [sent-sweep] ${accountId}: ${reconciled} rebound, ${appended} re-appended`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@bobfrankston/mailx-types": "^0.1.18",
13
13
  "@bobfrankston/mailx-settings": "^0.1.22",
14
- "@bobfrankston/mailx-store": "^0.1.36",
14
+ "@bobfrankston/mailx-store": "^0.1.37",
15
15
  "@bobfrankston/iflow-direct": "^0.1.50",
16
16
  "@bobfrankston/tcp-transport": "^0.1.6",
17
17
  "@bobfrankston/smtp-direct": "^0.1.8",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@bobfrankston/mailx-types": "^0.1.18",
41
41
  "@bobfrankston/mailx-settings": "^0.1.22",
42
- "@bobfrankston/mailx-store": "^0.1.36",
42
+ "@bobfrankston/mailx-store": "^0.1.37",
43
43
  "@bobfrankston/iflow-direct": "^0.1.50",
44
44
  "@bobfrankston/tcp-transport": "^0.1.6",
45
45
  "@bobfrankston/smtp-direct": "^0.1.8",