@kbzowski/mcp-inbox 0.3.2 → 0.4.0

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.
@@ -32,7 +32,14 @@ export interface ListEmailsOptions {
32
32
  * provider returns envelope-only rows without dates.
33
33
  */
34
34
  export declare function listEmailsByFolder(db: CacheDb, folder: string, opts?: ListEmailsOptions): Email[];
35
- export declare function countEmailsInFolder(db: CacheDb, folder: string): number;
35
+ export declare function countEmailsInFolder(db: CacheDb, folder: string, opts?: ListEmailsOptions): number;
36
+ /**
37
+ * Return every cached UID for a folder. Used by the sync reconciliation
38
+ * path to detect ghost entries (UIDs we have locally that are gone on
39
+ * the server - e.g. messages deleted by another client while IDLE was
40
+ * disconnected).
41
+ */
42
+ export declare function listCachedUidsForFolder(db: CacheDb, folder: string): number[];
36
43
  /**
37
44
  * Replace the flag set on a cached email. Used for write-through
38
45
  * invalidation after mark-read/mark-unread, and when IDLE delivers
@@ -1,5 +1,6 @@
1
- import type { ImapFlow, MessageStructureObject } from 'imapflow';
1
+ import type { FetchMessageObject, ImapFlow, MessageStructureObject } from 'imapflow';
2
2
  import type { CacheDb } from './db';
3
+ import type { EmailInsert } from './schema';
3
4
  export interface SyncContext {
4
5
  db: CacheDb;
5
6
  imap: ImapFlow;
@@ -26,6 +27,12 @@ export interface SyncResult {
26
27
  * 5. Persist the new folder sync state.
27
28
  */
28
29
  export declare function syncFolder(ctx: SyncContext, folderPath: string): Promise<SyncResult>;
30
+ /**
31
+ * Map an ImapFlow message into the EmailInsert shape. Exported so tools
32
+ * that fetch envelopes outside the main sync path (e.g. search auto-fill)
33
+ * can reuse exactly the same projection.
34
+ */
35
+ export declare function messageToInsert(folderPath: string, msg: FetchMessageObject, cachedAt: number): EmailInsert | null;
29
36
  /**
30
37
  * Walk an IMAP body structure tree, returning true if any part looks like
31
38
  * a real attachment. A part counts when:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbzowski/mcp-inbox",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server exposing IMAP/SMTP email over a fast local cache. Read, search, compose, and manage email from any IMAP provider with near-instant response times via background sync and IDLE push.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -59,6 +59,7 @@
59
59
  "format": "prettier --write .",
60
60
  "format:check": "prettier --check .",
61
61
  "db:generate": "drizzle-kit generate",
62
+ "prepare": "lefthook install",
62
63
  "prepublishOnly": "npm run typecheck && npm run lint && npm run test && npm run build",
63
64
  "release": "changeset publish"
64
65
  },
@@ -79,6 +80,7 @@
79
80
  "esbuild": "^0.28.0",
80
81
  "eslint": "^10.0.0",
81
82
  "eslint-config-prettier": "^10.0.0",
83
+ "lefthook": "^2.1.6",
82
84
  "prettier": "^3.4.0",
83
85
  "testcontainers": "^11.14.0",
84
86
  "tsx": "^4.19.0",