/** * Google Calendar connector — implements CalendarConnector via external MCP subprocess. * * SECURITY NOTICES: * - Requires calendar.egress.cloudCalendar: true (fail-closed; default false). * - Requires a provisioned 0600 token sidecar (.bober/calendar/google-token.json). * - ONLY finding.calendarSafeTitle (or the generic "Focus block") leaves the device. * NEVER use PlanItem.title — it falls back to the full Finding.title (see slotter.ts:209). * - Errors are sanitized: KEY=VALUE env assignments are redacted before throw. * * UNATTENDED / CRON WARNING: * Hosted OAuth is UNFIT for unattended or cron-scheduled runs because tokens expire * and interactive re-authorization is required. For scheduled use, choose the local * .ics fallback: `bober calendar plan --export-ics` (Sprint 2, zero-egress). * * The GoogleCalendarToolAdapter interface is the injection surface — ExternalMcpServer * satisfies it structurally in production; tests inject a stub (no live OAuth/network in CI). */ import type { Finding } from "./types.js"; import type { CalendarConnector } from "./connector.js"; import type { CalendarEgressGuard } from "./calendar-egress.js"; import type { ToolDescriptor } from "../mcp/external-client.js"; /** * Minimal adapter interface the Google connector requires. * ExternalMcpServer satisfies this structurally; tests inject a hand-rolled stub. */ export interface GoogleCalendarToolAdapter { listTools(): Promise; callTool(name: string, args: unknown): Promise; } /** * Strip KEY=VALUE env assignments so tokens never surface in error messages. * Replicated inline — do NOT import from src/hub (calendar avoids cross-spec coupling; * see types.ts:7-11). Matches src/mcp/external-client.ts:69 exactly. */ export declare function sanitizeCalendarError(msg: string): string; export interface GoogleConnectorOptions { /** Injected MCP adapter — stub in tests, ExternalMcpServer in production. */ adapter: GoogleCalendarToolAdapter; /** Egress guard constructed from BoberConfig. */ egress: CalendarEgressGuard; /** * OAuth token read from the 0600 sidecar. * When undefined the connector refuses with a clear message + .ics suggestion. */ token: string | undefined; /** * Source findings — the ONLY source of truth for calendarSafeTitle. * NEVER use PlanItem.title for cloud event summaries. */ findings: Finding[]; /** Override the free/busy tool name (default: google_calendar_get_free_busy). */ freeBusyTool?: string; /** Override the write-event tool name (default: google_calendar_create_event). */ writeEventTool?: string; } /** * Create a Google Calendar connector implementing CalendarConnector. * * The returned object is structurally interchangeable with createIcsConnector * (both satisfy CalendarConnector) so callers can swap connectors behind the * same interface (DoD sc-3-2). */ export declare function createGoogleConnector(opts: GoogleConnectorOptions): CalendarConnector; //# sourceMappingURL=google-connector.d.ts.map