/** * Gmail-to-task bridge — egress-gated. * * Provides: * - parseGmailThread (PURE — no clock, no network) * - sanitizeConnectorError (replicates external-client.ts:69 regex) * - fromGmailTask (DI: egressAllowed + injected MCP + store + now) * * Egress guarantee: when egressAllowed=false, fromGmailTask throws BEFORE * calling mcp.start() or mcp.callTool() — the stub callTool stays uncalled. * * Write path: captureTask (from task-inbox.ts) is the ONLY write path. * This module never calls writeFinding/ingestFinding directly. */ import type { Finding } from "./finding.js"; import type { FactStore } from "../state/facts.js"; /** * Minimal MCP surface fromGmailTask needs. ExternalMcpServer matches it * structurally; tests inject a fake whose callTool is a vi.fn() spy. */ export interface GmailMcpLike { start(): Promise; callTool(name: string, args: unknown): Promise; stop(): Promise; } /** Default MCP tool name to read one Gmail thread. Override per connector. */ export declare const DEFAULT_GMAIL_READ_TOOL = "gmail_read_thread"; /** The clock-independent, id-independent subset of a Finding a thread yields. */ export interface ParsedGmailThread { title: string; kind: "action"; status: "open"; tags: string[]; } /** * Parse a raw Gmail thread payload into a Finding-shaped record. * PURE: never calls the network, never reads the clock. */ export declare function parseGmailThread(payload: unknown): ParsedGmailThread; /** * Strip KEY=VALUE env assignments so connector tokens never surface in * error messages. Matches UPPERCASE_KEY=anything-without-whitespace. * Replicates the inline regex from src/mcp/external-client.ts:69 — * there is no exported sanitizer to import. */ export declare function sanitizeConnectorError(msg: string): string; /** * Fetch a Gmail thread via the injected MCP connector, parse it locally, * and capture it as an open action Finding through captureTask. * * sc-6-2 contract: when egressAllowed is false, this function throws BEFORE * calling mcp.start() or mcp.callTool() — zero network, zero MCP construction. * * @param args.egressAllowed - resolved from config.taskInbox?.gmailEgress * @param args.mcp - injected MCP connector (stubbed in tests) * @param args.threadRef - opaque thread reference passed to the connector * @param args.store - open FactStore for persistence * @param args.now - ISO timestamp injected at the CLI boundary (never internal) * @param args.toolName - override tool name (defaults to DEFAULT_GMAIL_READ_TOOL) */ export declare function fromGmailTask(args: { egressAllowed: boolean; mcp: GmailMcpLike; threadRef: string; store: FactStore; now: string; toolName?: string; }): Promise; //# sourceMappingURL=gmail-to-task.d.ts.map