@bobfrankston/rmfmail 1.0.601 → 1.0.607

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.
@@ -1264,12 +1264,49 @@ ${csp}
1264
1264
  document.addEventListener("touchcancel", function () {
1265
1265
  lastTouchTarget = null; touchMoved = false;
1266
1266
  }, { passive: true, capture: true });
1267
- // Link hover popover removed 2026-04-24 user feedback: it persisted
1268
- // over the message body when the dismissers (mousedown/scroll/blur)
1269
- // didn't fire from inside the iframe, leaving a multi-line URL hanging
1270
- // in the middle of the reading pane. Right-click (desktop) and long-
1271
- // press (touch) on a link still open the existing C29 menu with Open /
1272
- // Save-as / Copy URL / Copy link-text.
1267
+ // Link hover preview posts the link URL to the parent on hover so
1268
+ // the parent can show a tooltip after a 500 ms dwell. Earlier removal
1269
+ // (2026-04-24) was because dismissers in the parent (mousedown / scroll
1270
+ // / blur) don't fire while the mouse is inside the iframe, leaving the
1271
+ // popover stuck. Restored 2026-05-09 with the proper fix: the iframe
1272
+ // explicitly posts an empty-URL message on link mouseout AND on body
1273
+ // mousemove-away, so the parent reliably hides regardless of which
1274
+ // dismissers it sees. The parent's debounced 500 ms show-timer still
1275
+ // suppresses flicker.
1276
+ var lastHoveredHref = "";
1277
+ function postLinkHover(href, rect) {
1278
+ // Only post on transitions to avoid spamming the parent on every
1279
+ // mousemove inside a link.
1280
+ if (href === lastHoveredHref) return;
1281
+ lastHoveredHref = href;
1282
+ window.parent.postMessage({
1283
+ type: "linkHover",
1284
+ url: href,
1285
+ rect: rect ? { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom } : null,
1286
+ }, "*");
1287
+ }
1288
+ document.addEventListener("mouseover", function (e) {
1289
+ var a = e.target && e.target.closest ? e.target.closest("a[href]") : null;
1290
+ if (!a) return;
1291
+ var href = a.getAttribute("href") || "";
1292
+ if (!href || href.charAt(0) === "#" || href.indexOf("javascript:") === 0) return;
1293
+ var r = a.getBoundingClientRect();
1294
+ postLinkHover(a.href || href, r);
1295
+ }, true);
1296
+ document.addEventListener("mouseout", function (e) {
1297
+ var a = e.target && e.target.closest ? e.target.closest("a[href]") : null;
1298
+ if (!a) return;
1299
+ // Only fire when leaving the link entirely (not into a child element).
1300
+ var to = e.relatedTarget;
1301
+ if (to && to.closest && to.closest("a[href]") === a) return;
1302
+ postLinkHover("", null);
1303
+ }, true);
1304
+ // Mouseleave on body covers the case where the cursor exits the
1305
+ // iframe entirely without firing mouseout on the link (Edge / older
1306
+ // WebView2 builds). Belt-and-suspenders dismissal.
1307
+ document.addEventListener("mouseleave", function () {
1308
+ if (lastHoveredHref) postLinkHover("", null);
1309
+ }, true);
1273
1310
  // Double-click on body → toggle preview fullscreen via parent.
1274
1311
  document.addEventListener("dblclick", function (e) {
1275
1312
  var t = e.target;
@@ -0,0 +1,141 @@
1
+ # Push Relay (C127, optional)
2
+
3
+ Status: design only — not yet built. Relevant when polling latency feels too slow OR when battery / quota matters more than now.
4
+
5
+ ## Problem
6
+
7
+ mailx polls Google Calendar / Gmail / Outlook for changes. Polling is cheap, simple, and works on every network — the right default. But it has two costs:
8
+
9
+ 1. **Latency floor.** Even at a 5 s syncToken cadence, "the user just rescheduled this on their phone" takes ~5 s to surface in mailx. For most workflows that's invisible; for "alarm fires for an event that was moved an hour ago" it isn't.
10
+ 2. **Battery / quota on mobile.** The Android shell polls the same way the desktop does; on a phone that's measurable wakeups.
11
+
12
+ Push notifications (Google's `events.watch`, Microsoft Graph webhook subscriptions, Gmail's `users.watch`) fix both, but only deliver to a public HTTPS URL. The desktop client doesn't have one. So we need a relay.
13
+
14
+ ## Shape
15
+
16
+ A standalone Node service in `MailApps/relayer/`, deployed wherever the operator runs other small services (alerter-style: tiny Express app, one config file, one long-running process). One relay process serves multiple users; per-user state is keyed by user-issued tokens.
17
+
18
+ ```
19
+ ┌──────────────┐ watch ┌─────────┐ webhook ┌───────────┐ WS/SSE ┌────────┐
20
+ │ Google / MS │ ──register── │ relayer │ ◀──────── │ relayer │ ◀────────│ rmfmail│
21
+ │ Calendar API │ │ /sub │ │ /hook/:id │ │ client │
22
+ └──────────────┘ └─────────┘ └───────────┘ └────────┘
23
+ ▲ │ ▲
24
+ │ events.watch( │ per-subscription state: │
25
+ │ address: relayer/hook │ upstream channel id, expiry, owner-token, │
26
+ │ token: per-sub secret │ fan-out endpoints │
27
+ │ ) │ │
28
+ └──── done by relayer on │ │
29
+ client request, with │ │
30
+ client-supplied OAuth │ │
31
+ access token (kept │ │
32
+ short-lived; client │ │
33
+ re-presents on │ │
34
+ renewal) │ │
35
+
36
+ ```
37
+
38
+ Three roles, separable:
39
+ - **Subscriber API** — clients POST to register what they want watched.
40
+ - **Hook receiver** — public endpoint(s) the upstream services post to.
41
+ - **Fan-out** — per-subscription WS or SSE that holds open client connections and pushes payloads.
42
+
43
+ ## API (relayer side)
44
+
45
+ Generic relay shape — caller specifies upstream service + the params that service needs to register a watch. The relay knows enough about each supported upstream to issue the watch-registration call and decode the inbound webhook envelope; it doesn't introspect payload content.
46
+
47
+ ```
48
+ POST /subscribe
49
+ body: {
50
+ upstream: "google-calendar" | "google-gmail" | "ms-graph-events" | …
51
+ params: { …upstream-specific watch args, e.g. calendarId, accessToken, expiry preference }
52
+ deliver: "sse" | "ws"
53
+ }
54
+ → 200 {
55
+ subscriptionId: "<uuid>",
56
+ deliverUrl: "/sub/<uuid>", // open SSE / WS here
57
+ authToken: "<random-secret>", // present on connect
58
+ expiresAt: <ms> // when relay's upstream channel needs renewal
59
+ }
60
+
61
+ POST /subscribe/<id>/renew
62
+ body: { params: { accessToken: "<fresh OAuth>" } }
63
+ → 200 { expiresAt: <ms> }
64
+
65
+ DELETE /subscribe/<id>
66
+ → 204 (also calls upstream stop-watch)
67
+
68
+ GET /subscribe/<id>/status
69
+ → 200 { upstream, expiresAt, lastEventAt, queueDepth }
70
+
71
+ GET /sub/<id> (SSE) — emits `data: {payload}\n\n` per upstream event
72
+ (or WS upgrade) — same payload shape as text frames
73
+ ```
74
+
75
+ Auth: `Authorization: Bearer <authToken>` on every call after `/subscribe`. The token issued at subscribe time scopes the subscription; one client manages one or more subscriptions, each with its own token.
76
+
77
+ ## API (client side)
78
+
79
+ Two settings the user fills in:
80
+ - `pushRelayUrl` — e.g. `https://mail1.example.com:NNNN`
81
+ - `pushRelayCredentials` — issued by the operator at first contact (one-time, opaque blob; relay verifies)
82
+
83
+ When `pushRelayUrl` is non-empty, the client at startup:
84
+ 1. Reads its previous subscription IDs from local config.
85
+ 2. For each, opens the SSE / WS connection.
86
+ 3. If the connection refuses with "unknown subscription" (relay restart, expiry), re-subscribes from scratch with the current OAuth token and stores the new id.
87
+ 4. Hooks the inbound event stream into the same `mailxapi.onEvent` channel the daemon already uses, so the alarm subsystem / message-list / folder-tree all consume push events the same way they consume the daemon's IDLE / sync events.
88
+
89
+ The client owns OAuth tokens; the relay receives short-lived access tokens at register / renew time, doesn't store refresh tokens.
90
+
91
+ ## Reliability
92
+
93
+ - **Replay queue per subscription** — last N events (in-memory ring, e.g. N=100) so a brief disconnect doesn't lose events. Client passes `Last-Event-ID` (SSE) or a sequence cursor (WS) on reconnect.
94
+ - **Channel renewal** — relay tracks each upstream channel's expiry, schedules renewal at 80% of TTL, calls back to the client (via the WS/SSE itself) for a fresh OAuth token if needed.
95
+ - **Fail-open** — if the relay is unreachable, the client's existing syncToken polling continues. Push is "freshness boost," never load-bearing for correctness.
96
+
97
+ ## Generic relay vs per-upstream code
98
+
99
+ The relay needs per-upstream code for:
100
+ - How to register a watch (the API call shape varies).
101
+ - How to decode the inbound webhook envelope (Google sends headers in `X-Goog-*`, Graph sends a JSON body, etc.).
102
+ - How to renew or stop a watch.
103
+
104
+ Per-upstream is a small adapter (~50–100 lines each). Adding "Outlook Tasks" or "iCloud Calendar" later is a new file in `relayer/upstreams/`. The fan-out, subscription store, WS/SSE plumbing, replay buffer — all generic, written once.
105
+
106
+ ## Operator footprint
107
+
108
+ - One Node process, one port, one HTTPS cert (or behind a reverse proxy that handles TLS).
109
+ - Storage: SQLite or JSON for the subscription map (small — one row per active subscription).
110
+ - Logs to a file the operator already tails.
111
+ - No queue infrastructure, no message broker, no DB cluster.
112
+
113
+ This is the same operational shape as alerter — drop into `MailApps/`, deploy alongside other small services, treat as one more daemon.
114
+
115
+ ## When to build this
116
+
117
+ Only when polling demonstrably isn't fast enough, OR when mobile battery becomes a real concern (push lets the Android shell wake on event instead of polling on a timer). Polling at 5–10 s syncToken cadence is functionally instant for the "user rescheduled an event" case and quota-cheap. Push is a freshness optimization, not a correctness fix.
118
+
119
+ ## Alternatives considered
120
+
121
+ - **Cloudflare Workers + Durable Objects** — cleaner per-user-isolation story but requires each user to deploy their own Worker (or one shared operator-run Worker, with a different trust shape). Higher onboarding friction; users without a CF account can't use it. Pro: free tier, edge latency. Con: vendor lock-in, two-click onboarding minimum (account + token).
122
+ - **Cloudflare Tunnel / ngrok to the local daemon** — no relay needed, the daemon exposes its own webhook receiver. Catch: only works while the daemon is running; events while offline are lost (recovered by the next syncToken poll, which already exists). Per-instance tunnel.
123
+ - **Status quo (poll only)** — what mailx does today. Right default; this doc is for when "default isn't enough."
124
+
125
+ ## Files (when built)
126
+
127
+ ```
128
+ MailApps/relayer/
129
+ package.json
130
+ tsconfig.json
131
+ index.ts — Express server + WS upgrade + SSE
132
+ upstreams/
133
+ google-calendar.ts
134
+ google-gmail.ts
135
+ ms-graph-events.ts
136
+ subs.ts — subscription store (SQLite)
137
+ fanout.ts — per-sub connection pool + replay buffer
138
+ readme.md — operator doc (deploy + config)
139
+ ```
140
+
141
+ Client side: extend `mailx-service` with a `pushRelayClient.ts` that opens / re-opens / re-subscribes; surface its status in the existing sync-status banner.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.0.601",
3
+ "version": "1.0.607",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -29,13 +29,13 @@
29
29
  "start:prod": "node packages/mailx-server/index.js",
30
30
  "release": "npmglobalize",
31
31
  "test": "node --experimental-strip-types --test tests/*.test.ts tests/dom/*.test.ts",
32
- "test:fast": "node --experimental-strip-types --test tests/dedup.test.ts tests/dedup-newest.test.ts tests/dupcount.test.ts tests/search.test.ts tests/sync-coalesce.test.ts tests/dom/_smoke.test.ts tests/dom/viewer-scroll.test.ts tests/dom/viewer-rerender-guard.test.ts",
32
+ "test:fast": "node --experimental-strip-types --test tests/dedup.test.ts tests/dedup-newest.test.ts tests/dupcount.test.ts tests/search.test.ts tests/sync-coalesce.test.ts tests/undelete.test.ts tests/dom/_smoke.test.ts tests/dom/viewer-scroll.test.ts tests/dom/viewer-rerender-guard.test.ts",
33
33
  "postinstall": "node bin/postinstall.js"
34
34
  },
35
35
  "dependencies": {
36
36
  "@bobfrankston/iflow-direct": "^0.1.39",
37
37
  "@bobfrankston/mailx-host": "^0.1.11",
38
- "@bobfrankston/mailx-imap": "^0.1.32",
38
+ "@bobfrankston/mailx-imap": "^0.1.33",
39
39
  "@bobfrankston/mailx-sync": "^0.1.16",
40
40
  "@bobfrankston/miscinfo": "^1.0.10",
41
41
  "@bobfrankston/msger": "^0.1.378",
@@ -104,7 +104,7 @@
104
104
  "dependencies": {
105
105
  "@bobfrankston/iflow-direct": "^0.1.39",
106
106
  "@bobfrankston/mailx-host": "^0.1.11",
107
- "@bobfrankston/mailx-imap": "^0.1.32",
107
+ "@bobfrankston/mailx-imap": "^0.1.33",
108
108
  "@bobfrankston/mailx-sync": "^0.1.16",
109
109
  "@bobfrankston/miscinfo": "^1.0.10",
110
110
  "@bobfrankston/msger": "^0.1.378",
@@ -398,7 +398,18 @@ export declare class ImapManager extends EventEmitter {
398
398
  moveMessage(accountId: string, uid: number, fromFolderId: number, toFolderId: number): Promise<void>;
399
399
  /** Move message across accounts using iflow's moveMessageToServer */
400
400
  moveMessageCrossAccount(fromAccountId: string, uid: number, fromFolderId: number, toAccountId: string, toFolderId: number): Promise<void>;
401
- /** Undelete — move from Trash back to original folder */
401
+ /** Undelete — move from Trash back to original folder. Local-first:
402
+ * the row was moved (not deleted) on trash, so we just move it back
403
+ * in the local DB and reconcile the IMAP queue. Two cases:
404
+ * (a) the to-trash MOVE is still pending — cancel it; the server
405
+ * never saw the delete, so no counter-action is needed.
406
+ * (b) the to-trash MOVE drained — the message is now in Trash on
407
+ * the server with a new uid. Queue a counter-move from
408
+ * trash → original. The IMAP processor's fetchByUid in trash
409
+ * will use the local membership uid (which the reconciler
410
+ * rebound to the server's new trash uid via Message-ID match).
411
+ * If reconcile hasn't run yet (unlikely race), action retries
412
+ * until it does. */
402
413
  undeleteMessage(accountId: string, uid: number, originalFolderId: number): Promise<void>;
403
414
  /** Update flags — local-first, queues IMAP sync */
404
415
  updateFlagsLocal(accountId: string, uid: number, folderId: number, flags: string[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAgB,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsF3C,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACrF,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,SAAS,EAAE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E5B;;;qEAGiE;IAC3D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwIrD,8EAA8E;IAC9E,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,kBAAkB,CAA6B;IAEvD,iBAAiB,IAAI,IAAI;IAgDzB,yBAAyB;IACzB,gBAAgB,IAAI,IAAI;IASxB,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,eAAe,CAAwC;IAE/D;;+DAE2D;IAC3D,gBAAgB,IAAI,IAAI;IAwGxB,oCAAoC;IACpC,kBAAkB,IAAI,IAAI;IAa1B;2EACuE;IACvE,OAAO,CAAC,eAAe,CAAsC;IAE7D;yEACqE;YACvD,gBAAgB;IAK9B;;;;;;iDAM6C;IACvC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAU9C,sBAAsB;IAsGpC,2CAA2C;IACrC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAStC,wCAAwC;IAClC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAelC"}
@@ -2696,12 +2696,24 @@ export class ImapManager extends EventEmitter {
2696
2696
  if (messages.length === 0)
2697
2697
  return;
2698
2698
  const trash = this.findFolder(accountId, "trash");
2699
- // Local first — remove all from DB immediately
2699
+ // Local first — move to trash folder locally so the row stays
2700
+ // visible in Trash and Ctrl+Z can restore it. Body file stays in
2701
+ // its original folder dir; the next sync rebinds path on
2702
+ // membership uid change. Old behavior was `db.deleteMessage` +
2703
+ // `unlinkBodyFile` which made undelete impossible (no row to
2704
+ // restore, no body to read). For folders that ARE the trash
2705
+ // already, fall through to hard delete (the action will EXPUNGE
2706
+ // and reconciliation cleans up).
2700
2707
  for (const msg of messages) {
2701
- this.unlinkBodyFile(accountId, msg.uid, msg.folderId).catch(() => { });
2702
- this.db.deleteMessage(accountId, msg.uid, "user-initiated delete (bulk)", "mailx-imap deleteMessages");
2708
+ if (trash && trash.id !== msg.folderId) {
2709
+ this.db.moveMessageLocal(accountId, msg.uid, msg.folderId, trash.id);
2710
+ }
2711
+ else {
2712
+ this.unlinkBodyFile(accountId, msg.uid, msg.folderId).catch(() => { });
2713
+ this.db.deleteMessage(accountId, msg.uid, "user-initiated trash (already in trash → expunge)", "mailx-imap trashMessages");
2714
+ }
2703
2715
  }
2704
- console.log(` Deleted ${messages.length} messages locally`);
2716
+ console.log(` Trashed ${messages.length} messages locally (moved to trash folder, body files retained)`);
2705
2717
  // Queue IMAP actions
2706
2718
  for (const msg of messages) {
2707
2719
  if (trash && trash.id !== msg.folderId) {
@@ -2750,9 +2762,17 @@ export class ImapManager extends EventEmitter {
2750
2762
  /** Move a message to Trash (delete) — local-first, queues IMAP sync */
2751
2763
  async trashMessage(accountId, folderId, uid) {
2752
2764
  const trash = this.findFolder(accountId, "trash");
2753
- // Local first — remove from DB immediately
2754
- this.unlinkBodyFile(accountId, uid, folderId).catch(() => { });
2755
- this.db.deleteMessage(accountId, uid, "user-initiated trash", "mailx-imap trashMessage");
2765
+ // Local first — move to trash folder so the row stays visible in
2766
+ // Trash and Ctrl+Z can restore. Body file retained for undelete.
2767
+ // If we're already in trash (or no trash configured), fall through
2768
+ // to hard delete + EXPUNGE.
2769
+ if (trash && trash.id !== folderId) {
2770
+ this.db.moveMessageLocal(accountId, uid, folderId, trash.id);
2771
+ }
2772
+ else {
2773
+ this.unlinkBodyFile(accountId, uid, folderId).catch(() => { });
2774
+ this.db.deleteMessage(accountId, uid, "user-initiated trash (already in trash → expunge)", "mailx-imap trashMessage");
2775
+ }
2756
2776
  // Queue IMAP action + log the resolution so "I deleted a message and
2757
2777
  // now it's in neither trash nor deleted" is diagnosable from the log.
2758
2778
  if (trash && trash.id !== folderId) {
@@ -2764,6 +2784,12 @@ export class ImapManager extends EventEmitter {
2764
2784
  this.db.queueSyncAction(accountId, "delete", uid, folderId);
2765
2785
  console.log(` [trash] ${accountId} UID ${uid}: queued EXPUNGE in folder ${folderId} (already in trash or no trash configured)`);
2766
2786
  }
2787
+ // Folder counts moved — refresh both source and trash so the
2788
+ // tree badges update immediately, not at the next sync.
2789
+ this.db.recalcFolderCounts(folderId);
2790
+ if (trash && trash.id !== folderId)
2791
+ this.db.recalcFolderCounts(trash.id);
2792
+ this.emit("folderCountsChanged", accountId, {});
2767
2793
  // Debounced sync — batches multiple deletes into one IMAP session
2768
2794
  this.debounceSyncActions(accountId);
2769
2795
  }
@@ -2799,12 +2825,40 @@ export class ImapManager extends EventEmitter {
2799
2825
  });
2800
2826
  });
2801
2827
  }
2802
- /** Undelete — move from Trash back to original folder */
2828
+ /** Undelete — move from Trash back to original folder. Local-first:
2829
+ * the row was moved (not deleted) on trash, so we just move it back
2830
+ * in the local DB and reconcile the IMAP queue. Two cases:
2831
+ * (a) the to-trash MOVE is still pending — cancel it; the server
2832
+ * never saw the delete, so no counter-action is needed.
2833
+ * (b) the to-trash MOVE drained — the message is now in Trash on
2834
+ * the server with a new uid. Queue a counter-move from
2835
+ * trash → original. The IMAP processor's fetchByUid in trash
2836
+ * will use the local membership uid (which the reconciler
2837
+ * rebound to the server's new trash uid via Message-ID match).
2838
+ * If reconcile hasn't run yet (unlikely race), action retries
2839
+ * until it does. */
2803
2840
  async undeleteMessage(accountId, uid, originalFolderId) {
2804
2841
  const trash = this.findFolder(accountId, "trash");
2805
2842
  if (!trash)
2806
2843
  throw new Error("No Trash folder found");
2807
- await this.moveMessage(accountId, uid, trash.id, originalFolderId);
2844
+ // Move locally back to the original folder.
2845
+ const moved = this.db.moveMessageLocal(accountId, uid, trash.id, originalFolderId);
2846
+ if (!moved) {
2847
+ console.log(` [undelete] ${accountId} UID ${uid}: no row in trash — nothing to restore locally (sync may have already pruned)`);
2848
+ }
2849
+ // (a) cancel still-pending to-trash action.
2850
+ const pending = this.db.findPendingSyncAction(accountId, "move", uid, originalFolderId, trash.id);
2851
+ if (pending) {
2852
+ this.db.completeSyncAction(pending.id);
2853
+ console.log(` [undelete] ${accountId} UID ${uid}: cancelled pending MOVE to trash (server never saw delete)`);
2854
+ this.emit("folderCountsChanged", accountId, {});
2855
+ return;
2856
+ }
2857
+ // (b) queue counter-move from trash → original.
2858
+ this.db.queueSyncAction(accountId, "move", uid, trash.id, { targetFolderId: originalFolderId });
2859
+ console.log(` [undelete] ${accountId} UID ${uid}: queued counter-MOVE trash → folder ${originalFolderId}`);
2860
+ this.debounceSyncActions(accountId);
2861
+ this.emit("folderCountsChanged", accountId, {});
2808
2862
  }
2809
2863
  /** Update flags — local-first, queues IMAP sync */
2810
2864
  async updateFlagsLocal(accountId, uid, folderId, flags) {