Skip to content

Turn meetings into live agent loops. Record, transcribe, and analyze meetings with real-time AI intelligence — before, during, and after calls.

feat: calendar and new UI flow

Om Gate350c452a2a91
diff --git a/resources/google_oauth.json b/resources/google_oauth.json
new file mode 100644
index 0000000..a766458
--- /dev/null
+++ b/resources/google_oauth.json
@@ -0,0 +1,7 @@
+{
+ "clientId": "32974858587-0k8lom40i5bns4inf9smkbbvh2lb0so9.apps.googleusercontent.com",
+ "scopes": ["https://www.googleapis.com/auth/calendar.readonly"],
+ "tokenUri": "https://oauth2.googleapis.com/token",
+ "authUri": "https://accounts.google.com/o/oauth2/v2/auth",
+ "clientSecret": "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"
+}
diff --git a/src/main/db/index.ts b/src/main/db/index.ts
index 43625d9..aec3270 100644
--- a/src/main/db/index.ts
+++ b/src/main/db/index.ts
@@ -168,6 +168,7 @@ export function initDatabase(): ReturnType<typeof drizzle<typeof schema>> {
CREATE TABLE IF NOT EXISTS mcp_servers (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
+ description TEXT,
transport TEXT NOT NULL CHECK(transport IN ('stdio', 'http')),
command TEXT,
args TEXT,
@@ -198,6 +199,18 @@ export function initDatabase(): ReturnType<typeof drizzle<typeof schema>> {
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
+ CREATE TABLE IF NOT EXISTS mcp_oauth_tokens (
+ server_id TEXT PRIMARY KEY,
+ access_token TEXT NOT NULL,
+ refresh_token TEXT,
+ token_type TEXT NOT NULL DEFAULT 'Bearer',
+ scope TEXT,
+ expires_at TEXT,
+ auth_server_url TEXT,
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
+ );
+
-- Indexes
CREATE INDEX IF NOT EXISTS idx_users_access_token ON users(access_token);
CREATE INDEX IF NOT EXISTS idx_recordings_session_id ON recordings(session_id);
@@ -212,10 +225,20 @@ export function initDatabase(): ReturnType<typeof drizzle<typeof schema>> {
CREATE INDEX IF NOT EXISTS idx_nudges_history_recording ON nudges_history(recording_id);
CREATE INDEX IF NOT EXISTS idx_mcp_tool_calls_server ON mcp_tool_calls(server_id);
CREATE INDEX IF NOT EXISTS idx_mcp_tool_calls_recording ON mcp_tool_calls(recording_id);
+
+ -- Calendar Preferences table
+ CREATE TABLE IF NOT EXISTS calendar_preferences (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ notify_minutes_before INTEGER NOT NULL DEFAULT 2,
+ recording_behavior TEXT NOT NULL DEFAULT 'always_ask' CHECK(recording_behavior IN ('always_ask', 'default_record', 'no_notification')),
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
+ );
`);
ensureRecordingColumns();
ensureNudgesHistorySchema();
+ ensureMCPServerColumns();
seedDefaultCueCards();
@@ -297,6 +320,21 @@ function ensureNudgesHistorySchema(): void {
logger.info('nudges_history table rebuilt with updated enum values');
}
+function ensureMCPServerColumns(): void {
+ if (!sqlite) return;
+
+ const columns = sqlite
+ .prepare("PRAGMA table_info(mcp_servers)")
+ .all() as { name: string }[];
+
+ const columnNames = columns.map((c) => c.name);
+
+ if (!columnNames.includes('description')) {
+ sqlite.exec("ALTER TABLE mcp_servers ADD COLUMN description TEXT");
+ logger.info('Added description column to mcp_servers table');
+ }
+}
+
export function getDatabase(): ReturnType<typeof drizzle<typeof schema>> {
if (!db) {
throw new Error('Database not initialized. Call initDatabase() first.');
@@ -1515,4 +1553,92 @@ export function updateMCPToolCall(id: string, data: Partial<schema.MCPToolCall>)
.get();
}
+// MCP OAuth Token CRUD Operations
+
+export function getMCPOauthToken(serverId: string) {
+ const database = getDatabase();
+ return database
+ .select()
+ .from(schema.mcpOauthTokens)
+ .where(eq(schema.mcpOauthTokens.serverId, serverId))
+ .get();
+}
+
+export function upsertMCPOauthToken(data: schema.NewMCPOauthToken) {
+ const database = getDatabase();
+ const existing = database
+ .select()
+ .from(schema.mcpOauthTokens)
+ .where(eq(schema.mcpOauthTokens.serverId, data.serverId))
+ .get();
+
+ if (existing) {
+ return database
+ .update(schema.mcpOauthTokens)
+ .set({ ...data, updatedAt: new Date().toISOString() })
+ .where(eq(schema.mcpOauthTokens.serverId, data.serverId))
+ .returning()
+ .get();
+ }
+ return database.insert(schema.mcpOauthTokens).values(data).returning().get();
+}
+
+export function deleteMCPOauthToken(serverId: string) {
+ const database = getDatabase();
+ return database
+ .delete(schema.mcpOauthTokens)
+ .where(eq(schema.mcpOauthTokens.serverId, serverId));
+}
+
+// Calendar Preferences CRUD Operations
+
+export function getCalendarPreferences() {
+ const database = getDatabase();
+ // Get the first (and only) preferences row, or return defaults
+ const prefs = database
+ .select()
+ .from(schema.calendarPreferences)
+ .get();
+
+ if (!prefs) {
+ return {
+ id: 0,
+ notifyMinutesBefore: 2,
+ recordingBehavior: 'always_ask' as const,
+ createdAt: new Date().toISOString(),
+ updatedAt: new Date().toISOString(),
+ };
+ }
+ return prefs;
+}
+
+export function upsertCalendarPreferences(data: {
+ notifyMinutesBefore?: number;
+ recordingBehavior?: 'always_ask' | 'default_record' | 'no_notification';
+}) {
+ const database = getDatabase();
+ const existing = database
+ .select()
+ .from(schema.calendarPreferences)
+ .get();
+
+ if (existing) {
+ return database
+ .update(schema.calendarPreferences)
+ .set({ ...data, updatedAt: new Date().toISOString() })
+ .where(eq(schema.calendarPreferences.id, existing.id))
+ .returning()
+ .get();
+ }
+
+ return database
+ .insert(schema.calendarPreferences)
+ .values({
+ notifyMinutesBefore: data.notifyMinutesBefore ?? 2,
+ recordingBehavior: data.recordingBehavior ?? 'always_ask',
+ })
+ .returning()
+ .get();
+}
+
export { schema };
diff --git a/src/main/db/schema.ts b/src/main/db/schema.ts
index 757012e..d367ffe 100644
--- a/src/main/db/schema.ts
+++ b/src/main/db/schema.ts
@@ -257,6 +257,7 @@ export type NewCopilotSetting = typeof copilotSettings.$inferInsert;
export const mcpServers = sqliteTable('mcp_servers', {
id: text('id').primaryKey(),
name: text('name').notNull(),
+ description: text('description'), // Optional description for display
transport: text('transport', { enum: ['stdio', 'http'] }).notNull(),
command: text('command'), // For stdio transport
args: text('args'), // JSON array of arguments
@@ -301,3 +302,40 @@ export type NewMCPServer = typeof mcpServers.$inferInsert;
export type MCPToolCall = typeof mcpToolCalls.$inferSelect;
export type NewMCPToolCall = typeof mcpToolCalls.$inferInsert;
+
+/**
+ * MCP OAuth Tokens
+ * Stores OAuth tokens for MCP servers that require authentication
+ */
+export const mcpOauthTokens = sqliteTable('mcp_oauth_tokens', {
+ serverId: text('server_id').primaryKey(),
+ accessToken: text('access_token').notNull(), // Encrypted
+ refreshToken: text('refresh_token'), // Encrypted
+ tokenType: text('token_type').notNull().default('Bearer'),
+ scope: text('scope'),
+ expiresAt: text('expires_at'), // ISO timestamp
+ authServerUrl: text('auth_server_url'), // OAuth server URL for refresh
+ createdAt: text('created_at').notNull().default(sql`(datetime('now'))`),
+ updatedAt: text('updated_at').notNull().default(sql`(datetime('now'))`),
+});
+
+export type MCPOauthToken = typeof mcpOauthTokens.$inferSelect;
+export type NewMCPOauthToken = typeof mcpOauthTokens.$inferInsert;
+
+/**
+ * Calendar Preferences
+ * User preferences for meeting notifications and recording behavior
+ */
+export const calendarPreferences = sqliteTable('calendar_preferences', {
+ id: integer('id').primaryKey({ autoIncrement: true }),
+ notifyMinutesBefore: integer('notify_minutes_before').notNull().default(2),
+ recordingBehavior: text('recording_behavior', {
+ enum: ['always_ask', 'default_record', 'no_notification']
+ }).notNull().default('always_ask'),
+ createdAt: text('created_at').notNull().default(sql`(datetime('now'))`),
+ updatedAt: text('updated_at').notNull().default(sql`(datetime('now'))`),
+});
+
+export type CalendarPreferences = typeof calendarPreferences.$inferSelect;
+export type NewCalendarPreferences = typeof calendarPreferences.$inferInsert;
+export type RecordingBehavior = 'always_ask' | 'default_record' | 'no_notification';
diff --git a/src/main/index.ts b/src/main/index.ts
index c08c02b..3231ca8 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -9,12 +9,17 @@ import {
setMainWindow,
setCopilotMainWindow,
setMCPMainWindow,
+ setCalendarMainWindow,
sendToRenderer,
shutdownCaptureClient,
} from './ipc';
+import { getTrayService, resetTrayService } from './services/tray.service';
+import { getCalendarPoller, resetCalendarPoller } from './services/calendar-poller.service';
+import { hasTokens } from './services/google-auth.service';
import {
getConnectionOrchestrator,
resetConnectionOrchestrator,
+ getMCPAuthService,
} from './services/mcp';
import {
loadAppConfig,
@@ -30,6 +35,68 @@ import { createSessionRecoveryService } from './services/session-recovery.servic
let mainWindow: BrowserWindow | null = null;
const isDev = !app.isPackaged;
+const PROTOCOL_NAME = 'meetingcopilot';
+
+// Track if app is quitting (for hide-to-tray behavior)
+let isAppQuitting = false;
+
+export function setAppQuitting(value: boolean): void {
+ isAppQuitting = value;
+}
+
+export function getAppQuitting(): boolean {
+ return isAppQuitting;
+}
+
+/**
+ * Register custom protocol handler for OAuth callbacks
+ * This allows OAuth providers to redirect back to the app via meetingcopilot://oauth/callback
+ */
+function setupProtocolHandler(): void {
+ // Register as default protocol handler (only works in packaged app)
+ if (app.isPackaged) {
+ const isRegistered = app.isDefaultProtocolClient(PROTOCOL_NAME);
+ if (!isRegistered) {
+ app.setAsDefaultProtocolClient(PROTOCOL_NAME);
+ logger.info({ protocol: PROTOCOL_NAME }, 'Registered as default protocol client');
+ }
+ }
+
+ // Handle protocol URL on macOS (when app is already running)
+ app.on('open-url', (event, url) => {
+ event.preventDefault();
+ handleProtocolUrl(url);
+ });
+}
+
+/**
+ * Handle incoming protocol URL
+ */
+function handleProtocolUrl(url: string): void {
+ logger.info({ url }, 'Received protocol URL');
+
+ try {
+ const parsedUrl = new URL(url);
+
+ // Handle OAuth callback
+ if (parsedUrl.hostname === 'oauth' && parsedUrl.pathname === '/callback') {
+ const authService = getMCPAuthService();
+ authService.handleCallback(url).catch((error) => {
+ logger.error({ error, url }, 'Failed to handle OAuth callback');
+ });
+
+ // Focus the main window
+ if (mainWindow && !mainWindow.isDestroyed()) {
+ if (mainWindow.isMinimized()) mainWindow.restore();
+ mainWindow.focus();
+ }
+ } else {
+ logger.warn({ url }, 'Unknown protocol URL path');
+ }
+ } catch (error) {
+ logger.error({ error, url }, 'Failed to parse protocol URL');
+ }
+}
/**
* Clean up stale recorder lock files so the recorder can start after crashes.
@@ -74,6 +141,7 @@ async function createWindow(): Promise<void> {
setMainWindow(mainWindow);
setCopilotMainWindow(mainWindow);
setMCPMainWindow(mainWindow);
+ setCalendarMainWindow(mainWindow);
if (isDev) {
const VITE_DEV_PORT = 51730;
@@ -82,6 +150,18 @@ async function createWindow(): Promise<void> {
await mainWindow.loadFile(path.join(__dirname, '..', 'renderer', 'index.html'));
}
+ // Hide to tray instead of closing (unless app is quitting)
+ mainWindow.on('close', (event) => {
+ if (!isAppQuitting) {
+ event.preventDefault();
+ mainWindow?.hide();
+ // On macOS, hide the dock icon when minimized to tray
+ if (process.platform === 'darwin') {
+ app.dock?.hide();
+ }
+ }
+ });
+
mainWindow.on('closed', () => {
mainWindow = null;
});
@@ -272,6 +352,14 @@ async function stopServices(): Promise<void> {
}
isShuttingDown = true;
+ // Stop calendar polling
+ logger.info('Stopping calendar poller...');
+ resetCalendarPoller();
+
+ // Destroy tray
+ logger.info('Destroying system tray...');
+ resetTrayService();
+
await shutdownCaptureClient();
// Shutdown MCP orchestrator
@@ -292,9 +380,39 @@ async function stopServices(): Promise<void> {
removeIpcHandlers();
}
+// Handle protocol URL from app launch (Windows/Linux cold start)
+const gotTheLock = app.requestSingleInstanceLock();
+if (!gotTheLock) {
+ app.quit();
+} else {
+ app.on('second-instance', (_event, commandLine) => {
+ // Handle protocol URL from second instance (Windows/Linux)
+ const url = commandLine.find((arg) => arg.startsWith(`${PROTOCOL_NAME}://`));
+ if (url) {
+ handleProtocolUrl(url);
+ }
+
+ // Focus the main window
+ if (mainWindow && !mainWindow.isDestroyed()) {
+ if (mainWindow.isMinimized()) mainWindow.restore();
+ mainWindow.focus();
+ }
+ });
+}
+
app.whenReady().then(async () => {
logger.info('App starting');
+ // Setup protocol handler for OAuth callbacks
+ setupProtocolHandler();
+
+ // Handle protocol URL from initial launch (macOS)
+ const launchUrl = process.argv.find((arg) => arg.startsWith(`${PROTOCOL_NAME}://`));
+ if (launchUrl) {
+ // Defer handling until services are ready
+ setTimeout(() => handleProtocolUrl(launchUrl), 1000);
+ }
+
// Only packaged apps need VideoDB binary path and DYLD_LIBRARY_PATH patches.
if (app.isPackaged) {
try {
@@ -317,8 +435,23 @@ app.whenReady().then(async () => {
await createWindow();
+ // Create system tray
+ if (mainWindow) {
+ getTrayService().create(mainWindow);
+ logger.info('System tray created');
+ }
+
await autoRegister();
+ // Start calendar polling if already authenticated
+ if (hasTokens()) {
+ logger.info('Google tokens found, starting calendar polling');
+ const calendarPoller = getCalendarPoller();
+ calendarPoller.startPolling().catch((err) => {
+ logger.warn({ error: err.message }, 'Failed to start calendar polling on startup');
+ });
+ }
+
// Recover any sessions that exported while app was closed (fire and forget)
recoverPendingSessions().catch(() => {
// Error already logged in recoverPendingSessions
@@ -331,10 +464,11 @@ app.whenReady().then(async () => {
}
});
+// Don't quit when window closes - tray keeps it alive
app.on('window-all-closed', () => {
- if (process.platform !== 'darwin') {
- app.quit();
- }
+ // On non-macOS platforms, if we want the app to stay in tray,
+ // we just do nothing here. The tray keeps the app alive.
+ // Only quit if explicitly requested via tray menu.
});
app.on('activate', async () => {
@@ -344,6 +478,7 @@ app.on('activate', async () => {
});
app.on('before-quit', async (event) => {
+ isAppQuitting = true;
if (!isShuttingDown) {
event.preventDefault();
logger.info('App shutting down');
diff --git a/src/main/ipc/calendar.ts b/src/main/ipc/calendar.ts
new file mode 100644
index 0000000..2a2d28e
--- /dev/null
+++ b/src/main/ipc/calendar.ts
@@ -0,0 +1,132 @@
+/**
+ * Calendar IPC Handlers
+ *
+ * Handles IPC communication for Google Calendar integration.
+ */
+
+import { ipcMain, BrowserWindow } from 'electron';
+import { createChildLogger } from '../lib/logger';
+import {
+ startAuthFlow,
+ signOut,
+ isAuthenticated,
+ hasTokens,
+} from '../services/google-auth.service';
+import { fetchUpcomingEvents } from '../services/google-calendar.service';
+import { getCalendarPoller } from '../services/calendar-poller.service';
+import type {
+ CalendarSignInResult,
+ CalendarEventsResult,
+ CalendarAuthStatusResult,
+} from '../../shared/types/calendar.types';
+
+const logger = createChildLogger('ipc-calendar');
+
+let mainWindow: BrowserWindow | null = null;
+
+export function setCalendarMainWindow(window: BrowserWindow): void {
+ mainWindow = window;
+ getCalendarPoller().setMainWindow(window);
+}
+
+function sendToRenderer(channel: string, data: unknown): void {
+ if (mainWindow && !mainWindow.isDestroyed()) {
+ mainWindow.webContents.send(channel, data);
+ }
+}
+
+export function setupCalendarHandlers(): void {
+ logger.info('Setting up calendar IPC handlers');
+
+ // Sign in with Google
+ ipcMain.handle('calendar:sign-in', async (): Promise<CalendarSignInResult> => {
+ try {
+ logger.info('Starting Google sign-in flow');
+ await startAuthFlow();
+
+ // Start polling after successful sign-in
+ const poller = getCalendarPoller();
+ await poller.startPolling();
+
+ logger.info('Google sign-in successful');
+ return { success: true };
+ } catch (error) {
+ const err = error as Error;
+ logger.error({ error: err.message }, 'Google sign-in failed');
+ return { success: false, error: err.message };
+ }
+ });
+
+ // Sign out
+ ipcMain.handle('calendar:sign-out', async (): Promise<{ success: boolean; error?: string }> => {
+ try {
+ logger.info('Signing out of Google');
+
+ // Stop polling first
+ const poller = getCalendarPoller();
+ poller.stopPolling();
+
+ // Clear tokens
+ signOut();
+
+ return { success: true };
+ } catch (error) {
+ const err = error as Error;
+ logger.error({ error: err.message }, 'Google sign-out failed');
+ return { success: false, error: err.message };
+ }
+ });
+
+ // Check if signed in
+ ipcMain.handle('calendar:is-signed-in', async (): Promise<CalendarAuthStatusResult> => {
+ try {
+ // Quick check first
+ if (!hasTokens()) {
+ return { success: true, isSignedIn: false };
+ }
+
+ // Verify tokens are still valid
+ const authenticated = await isAuthenticated();
+ return { success: true, isSignedIn: authenticated };
+ } catch (error) {
+ const err = error as Error;
+ logger.error({ error: err.message }, 'Failed to check auth status');
+ return { success: false, isSignedIn: false, error: err.message };
+ }
+ });
+
+ // Get upcoming events
+ ipcMain.handle('calendar:get-events', async (_event, hours?: number): Promise<CalendarEventsResult> => {
+ try {
+ const events = await fetchUpcomingEvents(hours || 24);
+ return { success: true, events };
+ } catch (error) {
+ const err = error as Error;
+ logger.error({ error: err.message }, 'Failed to fetch calendar events');
+ return { success: false, error: err.message };
+ }
+ });
+
+ // Set up event forwarding from poller
+ const poller = getCalendarPoller();
+
+ poller.on('auth-required', () => {
+ logger.warn('Calendar auth required - forwarding to renderer');
+ sendToRenderer('calendar:auth-required', {});
+ });
+
+ poller.on('events-updated', (events) => {
+ sendToRenderer('calendar:events-updated', events);
+ });
+
+ logger.info('Calendar IPC handlers registered');
+}
+
+export function removeCalendarHandlers(): void {
+ ipcMain.removeHandler('calendar:sign-in');
+ ipcMain.removeHandler('calendar:sign-out');
+ ipcMain.removeHandler('calendar:is-signed-in');
+ ipcMain.removeHandler('calendar:get-events');
+
+ logger.info('Calendar IPC handlers removed');
+}
diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts
index a9d6ed5..048915a 100644
--- a/src/main/ipc/index.ts
+++ b/src/main/ipc/index.ts
@@ -4,6 +4,7 @@ import { setupPermissionHandlers } from './permissions';
import { setupAppHandlers } from './app';
import { setupCopilotHandlers, removeCopilotHandlers, setCopilotMainWindow } from './copilot';
import { setupMCPHandlers, removeMCPHandlers, setMCPMainWindow } from './mcp';
+import { setupCalendarHandlers, removeCalendarHandlers, setCalendarMainWindow } from './calendar';
import { createChildLogger } from '../lib/logger';
const logger = createChildLogger('ipc');
@@ -16,6 +17,7 @@ export function setupIpcHandlers(): void {
setupAppHandlers();
setupCopilotHandlers();
setupMCPHandlers();
+ setupCalendarHandlers();
logger.info('IPC handlers registered');
}
@@ -51,9 +53,13 @@ export function removeIpcHandlers(): void {
// MCP handlers
removeMCPHandlers();
+ // Calendar handlers
+ removeCalendarHandlers();
+
logger.info('IPC handlers removed');
}
export { sendToRenderer, getMainWindow, setMainWindow, shutdownCaptureClient, isCaptureActive } from './capture';
export { setCopilotMainWindow } from './copilot';
export { setMCPMainWindow } from './mcp';
+export { setCalendarMainWindow } from './calendar';
diff --git a/src/main/ipc/mcp.ts b/src/main/ipc/mcp.ts
index 9055bdc..f248581 100644
--- a/src/main/ipc/mcp.ts
+++ b/src/main/ipc/mcp.ts
@@ -20,6 +20,7 @@ import type {
CreateMCPServerRequest,
UpdateMCPServerRequest,
MCPDisplayResult,
+ MCPOAuthConfig,
} from '../../shared/types/mcp.types';
import { v4 as uuid } from 'uuid';
@@ -94,6 +95,19 @@ export function setupMCPHandlers(): void {
sendToRenderer('mcp:server-error', data);
});
+ // Forward OAuth events to renderer
+ orchestrator.on('auth-required', (data) => {
+ sendToRenderer('mcp:auth-required', data);
+ });
+
+ orchestrator.on('auth-success', (data) => {
+ sendToRenderer('mcp:auth-success', data);
+ });
+
+ orchestrator.on('auth-error', (data) => {
+ sendToRenderer('mcp:auth-error', data);
+ });
+
// Server Management Handlers
/**
@@ -388,6 +402,73 @@ export function setupMCPHandlers(): void {
}
});
+ // OAuth Handlers
+
+ /**
+ * Start OAuth flow for a server
+ */
+ ipcMain.handle('mcp:start-oauth', async (_event, serverId: string, oauthConfig: MCPOAuthConfig) => {
+ try {
+ await orchestrator.startOAuthFlow(serverId, oauthConfig);
+ return { success: true };
+ } catch (error) {
+ logger.error({ error, serverId }, 'Failed to start OAuth flow');
+ return { success: false, error: (error as Error).message };
+ }
+ });
+
+ /**
+ * Connect with OAuth (checks for existing tokens first)
+ */
+ ipcMain.handle('mcp:connect-with-auth', async (_event, serverId: string, oauthConfig?: MCPOAuthConfig) => {
+ try {
+ const tools = await orchestrator.connectWithAuth(serverId, oauthConfig);
+ return { success: true, tools };
+ } catch (error) {
+ logger.error({ error, serverId }, 'Failed to connect with auth');
+ return { success: false, error: (error as Error).message };
+ }
+ });
+
+ /**
+ * Check if server requires OAuth
+ */
+ ipcMain.handle('mcp:requires-auth', async (_event, serverId: string) => {
+ try {
+ const requiresAuth = orchestrator.serverRequiresAuth(serverId);
+ return { success: true, requiresAuth };
+ } catch (error) {
+ logger.error({ error, serverId }, 'Failed to check auth requirement');
+ return { success: false, error: (error as Error).message };
+ }
+ });
+
+ /**
+ * Check if server has valid OAuth tokens
+ */
+ ipcMain.handle('mcp:has-valid-tokens', async (_event, serverId: string) => {
+ try {
+ const hasTokens = orchestrator.hasValidTokens(serverId);
+ return { success: true, hasTokens };
+ } catch (error) {
+ logger.error({ error, serverId }, 'Failed to check tokens');
+ return { success: false, error: (error as Error).message };
+ }
+ });
+
+ /**
+ * Delete OAuth tokens for a server
+ */
+ ipcMain.handle('mcp:delete-tokens', async (_event, serverId: string) => {
+ try {
+ orchestrator.deleteTokens(serverId);
+ return { success: true };
+ } catch (error) {
+ logger.error({ error, serverId }, 'Failed to delete tokens');
+ return { success: false, error: (error as Error).message };
+ }
+ });
+
logger.info('MCP IPC handlers registered');
}
@@ -412,6 +493,12 @@ export function removeMCPHandlers(): void {
ipcMain.removeHandler('mcp:pin-result');
ipcMain.removeHandler('mcp:get-trigger-keywords');
ipcMain.removeHandler('mcp:set-trigger-keywords');
+ // OAuth handlers
+ ipcMain.removeHandler('mcp:start-oauth');
+ ipcMain.removeHandler('mcp:connect-with-auth');
+ ipcMain.removeHandler('mcp:requires-auth');
+ ipcMain.removeHandler('mcp:has-valid-tokens');
+ ipcMain.removeHandler('mcp:delete-tokens');
logger.info('MCP IPC handlers removed');
}
diff --git a/src/main/lib/config.ts b/src/main/lib/config.ts
index fda1856..8e78d7b 100644
--- a/src/main/lib/config.ts
+++ b/src/main/lib/config.ts
@@ -1,12 +1,16 @@
-import { app } from 'electron';
+import { app, safeStorage } from 'electron';
import path from 'path';
import fs from 'fs';
import type { AppConfig, RuntimeConfig } from '../../shared/schemas/config.schema';
+import type { GoogleTokens, GoogleOAuthConfig } from '../../shared/types/calendar.types';
import { logger } from './logger';
const CONFIG_FILENAME = 'config.json';
const RUNTIME_FILENAME = 'runtime.json';
const AUTH_CONFIG_FILENAME = 'auth_config.json';
+const GOOGLE_OAUTH_FILENAME = 'google_oauth.json';
+const GOOGLE_TOKENS_FILENAME = 'google_tokens.enc';
+const GOOGLE_TOKENS_FALLBACK_FILENAME = 'google_tokens.json';
export function getConfigPath(): string {
return path.join(app.getPath('userData'), CONFIG_FILENAME);
@@ -110,3 +114,114 @@ export function clearAppConfig(): void {
logger.error({ error, configPath }, 'Failed to clear app config');
}
}
+
+// ============================================================================
+// Google OAuth Configuration
+// ============================================================================
+
+export function getGoogleOAuthConfigPath(): string {
+ // Google OAuth config is bundled with the app in resources/
+ if (app.isPackaged) {
+ return path.join(process.resourcesPath, 'resources', GOOGLE_OAUTH_FILENAME);
+ }
+ return path.join(app.getAppPath(), 'resources', GOOGLE_OAUTH_FILENAME);
+}
+
+export function loadGoogleOAuthConfig(): GoogleOAuthConfig | null {
+ const configPath = getGoogleOAuthConfigPath();
+ try {
+ if (fs.existsSync(configPath)) {
+ const data = fs.readFileSync(configPath, 'utf-8');
+ return JSON.parse(data) as GoogleOAuthConfig;
+ }
+ logger.warn({ configPath }, 'Google OAuth config not found');
+ } catch (error) {
+ logger.error({ error, configPath }, 'Failed to load Google OAuth config');
+ }
+ return null;
+}
+
+// ============================================================================
+// Google Token Storage (using safeStorage for encryption)
+// ============================================================================
+
+function getGoogleTokensPath(): string {
+ return path.join(app.getPath('userData'), GOOGLE_TOKENS_FILENAME);
+}
+
+function getGoogleTokensFallbackPath(): string {
+ return path.join(app.getPath('userData'), GOOGLE_TOKENS_FALLBACK_FILENAME);
+}
+
+export function saveGoogleTokens(tokens: GoogleTokens): void {
+ const tokenPath = getGoogleTokensPath();
+ const fallbackPath = getGoogleTokensFallbackPath();
+
+ try {
+ const json = JSON.stringify(tokens);
+
+ if (safeStorage.isEncryptionAvailable()) {
+ const encrypted = safeStorage.encryptString(json);
+ fs.writeFileSync(tokenPath, encrypted);
+ // Clean up fallback if it exists
+ if (fs.existsSync(fallbackPath)) {
+ fs.unlinkSync(fallbackPath);
+ }
+ logger.info('Google tokens saved (encrypted)');
+ } else {
+ // Fallback to plain JSON (Linux without keyring)
+ fs.writeFileSync(fallbackPath, json, 'utf-8');
+ logger.warn('Google tokens saved (unencrypted - no keyring available)');
+ }
+ } catch (error) {
+ logger.error({ error }, 'Failed to save Google tokens');
+ throw error;
+ }
+}
+
+export function loadGoogleTokens(): GoogleTokens | null {
+ const tokenPath = getGoogleTokensPath();
+ const fallbackPath = getGoogleTokensFallbackPath();
+
+ try {
+ // Try encrypted storage first
+ if (safeStorage.isEncryptionAvailable() && fs.existsSync(tokenPath)) {
+ const encrypted = fs.readFileSync(tokenPath);
+ const json = safeStorage.decryptString(encrypted);
+ return JSON.parse(json) as GoogleTokens;
+ }
+
+ // Fallback to plain JSON
+ if (fs.existsSync(fallbackPath)) {
+ const json = fs.readFileSync(fallbackPath, 'utf-8');
+ return JSON.parse(json) as GoogleTokens;
+ }
+ } catch (error) {
+ logger.error({ error }, 'Failed to load Google tokens');
+ }
+
+ return null;
+}
+
+export function clearGoogleTokens(): void {
+ const tokenPath = getGoogleTokensPath();
+ const fallbackPath = getGoogleTokensFallbackPath();
+
+ try {
+ if (fs.existsSync(tokenPath)) {
+ fs.unlinkSync(tokenPath);
+ }
+ if (fs.existsSync(fallbackPath)) {
+ fs.unlinkSync(fallbackPath);
+ }
+ logger.info('Google tokens cleared');
+ } catch (error) {
+ logger.error({ error }, 'Failed to clear Google tokens');
+ }
+}
+
+export function hasGoogleTokens(): boolean {
+ const tokenPath = getGoogleTokensPath();
+ const fallbackPath = getGoogleTokensFallbackPath();
+ return fs.existsSync(tokenPath) || fs.existsSync(fallbackPath);
+}
diff --git a/src/main/server/trpc/procedures/settings.ts b/src/main/server/trpc/procedures/settings.ts
index cf3dfb8..3d908aa 100644
--- a/src/main/server/trpc/procedures/settings.ts
+++ b/src/main/server/trpc/procedures/settings.ts
@@ -22,6 +22,8 @@ import {
getSettingsByCategory,
getSetting,
upsertSetting,
+ getCalendarPreferences,
+ upsertCalendarPreferences,
} from '../../../db';
import { v4 as uuid } from 'uuid';
@@ -273,4 +275,21 @@ export const settingsRouter = router({
}
return results;
}),
+
+ // -------------------------------------------------------------------------
+ // Calendar Preferences
+ // -------------------------------------------------------------------------
+
+ getCalendarPreferences: protectedProcedure.query(async () => {
+ return getCalendarPreferences();
+ }),
+
+ updateCalendarPreferences: protectedProcedure
+ .input(z.object({
+ notifyMinutesBefore: z.number().min(1).max(30).optional(),
+ recordingBehavior: z.enum(['always_ask', 'default_record', 'no_notification']).optional(),
+ }))
+ .mutation(async ({ input }) => {
+ return upsertCalendarPreferences(input);
+ }),
});
diff --git a/src/main/services/calendar-poller.service.ts b/src/main/services/calendar-poller.service.ts
new file mode 100644
index 0000000..8d9b64e
--- /dev/null
+++ b/src/main/services/calendar-poller.service.ts
@@ -0,0 +1,285 @@
+/**
+ * Calendar Poller Service
+ *
+ * Polls Google Calendar every 60 seconds and shows native notifications
+ * for meetings starting within 2 minutes.
+ */
+
+import { Notification, BrowserWindow } from 'electron';
+import { EventEmitter } from 'events';
+import path from 'path';
+import { logger } from '../lib/logger';
+import { fetchUpcomingEvents, CalendarAuthError } from './google-calendar.service';
+import { isAuthenticated } from './google-auth.service';
+import { getCalendarPreferences } from '../db';
+import type { UpcomingMeeting } from '../../shared/types/calendar.types';
+import type { RecordingBehavior } from '../db/schema';
+
+const log = logger.child({ module: 'calendar-poller' });
+
+// Polling configuration
+const POLL_INTERVAL_MS = 20_000; // 20 seconds
+const DEFAULT_NOTIFY_MINUTES_BEFORE = 2; // Default: notify 2 minutes before meeting
+const UPCOMING_HOURS = 2; // Fetch events within next 2 hours
+
+class CalendarPollerService extends EventEmitter {
+ private pollInterval: NodeJS.Timeout | null = null;
+ private notifiedEventIds: Set<string> = new Set();
+ private cachedEvents: UpcomingMeeting[] = [];
+ private mainWindow: BrowserWindow | null = null;
+ private isPolling: boolean = false;
+
+ /**
+ * Set the main window reference for showing on notification click
+ */
+ setMainWindow(window: BrowserWindow): void {
+ this.mainWindow = window;
+ }
+
+ /**
+ * Start polling for calendar events
+ */
+ async startPolling(): Promise<void> {
+ if (this.pollInterval) {
+ log.debug('Polling already started');
+ return;
+ }
+
+ // Check if authenticated before starting
+ const authenticated = await isAuthenticated();
+ if (!authenticated) {
+ log.warn('Cannot start polling - not authenticated');
+ return;
+ }
+
+ // Log notification support
+ log.info({ notificationSupported: Notification.isSupported() }, 'Notification support check');
+
+ this.isPolling = true;
+ log.info('Starting calendar polling');
+
+ // Poll immediately, then every interval
+ await this.pollAndNotify();
+
+ this.pollInterval = setInterval(async () => {
+ await this.pollAndNotify();
+ }, POLL_INTERVAL_MS);
+ }
+
+ /**
+ * Stop polling
+ */
+ stopPolling(): void {
+ if (this.pollInterval) {
+ clearInterval(this.pollInterval);
+ this.pollInterval = null;
+ }
+ this.isPolling = false;
+ this.cachedEvents = [];
+ log.info('Stopped calendar polling');
+ }
+
+ /**
+ * Check if currently polling
+ */
+ getIsPolling(): boolean {
+ return this.isPolling;
+ }
+
+ /**
+ * Get cached events
+ */
+ getCachedEvents(): UpcomingMeeting[] {
+ return this.cachedEvents;
+ }
+
+ /**
+ * Poll for events and send notifications
+ */
+ private async pollAndNotify(): Promise<void> {
+ try {
+ log.debug('Polling calendar events');
+
+ // Get user preferences from DB
+ const prefs = getCalendarPreferences();
+ const notifyMinutes = prefs?.notifyMinutesBefore ?? DEFAULT_NOTIFY_MINUTES_BEFORE;
+ const recordingBehavior = prefs?.recordingBehavior ?? 'always_ask';
+
+ // If user chose "no_notification", skip notifications entirely
+ if (recordingBehavior === 'no_notification') {
+ log.debug('Recording behavior is no_notification - skipping notifications');
+ // Still fetch events for other purposes (e.g., tray display)
+ this.cachedEvents = await fetchUpcomingEvents(UPCOMING_HOURS);
+ this.emit('events-updated', this.cachedEvents);
+ return;
+ }
+
+ // Fetch upcoming events
+ this.cachedEvents = await fetchUpcomingEvents(UPCOMING_HOURS);
+
+ // Prune old notification IDs (events that have passed)
+ this.pruneOldNotifications();
+
+ // Check for events starting soon
+ const toNotify = this.checkForUpcomingNotifications(notifyMinutes, recordingBehavior);
+
+ // Send notifications
+ for (const event of toNotify) {
+ this.sendEventNotification(event, recordingBehavior);
+ }
+
+ // Emit events updated for tray/UI
+ this.emit('events-updated', this.cachedEvents);
+
+ log.debug({ eventCount: this.cachedEvents.length, notifyCount: toNotify.length }, 'Poll complete');
+ } catch (error) {
+ const err = error as Error;
+ log.error({ error: err.message }, 'Calendar poll failed');
+
+ // Check if it's an auth error
+ if (error instanceof CalendarAuthError) {
+ log.warn('Auth error during polling - stopping and emitting auth-required');
+ this.stopPolling();
+ this.emit('auth-required');
+ }
+ }
+ }
+
+ /**
+ * Check for events that should trigger a notification
+ */
+ private checkForUpcomingNotifications(notifyMinutes: number, recordingBehavior: RecordingBehavior): UpcomingMeeting[] {
+ const toNotify: UpcomingMeeting[] = [];
+ const thresholdMs = notifyMinutes * 60 * 1000;
+
+ for (const event of this.cachedEvents) {
+ // Skip all-day events
+ if (event.isAllDay) continue;
+
+ const msUntil = event.startTime.getTime() - Date.now();
+
+ // Event is starting within threshold and we haven't notified yet
+ if (msUntil > 0 && msUntil <= thresholdMs && !this.notifiedEventIds.has(event.id)) {
+ this.notifiedEventIds.add(event.id);
+ toNotify.push(event);
+ }
+ }
+
+ return toNotify;
+ }
+
+ /**
+ * Prune notification IDs for events that have passed
+ */
+ private pruneOldNotifications(): void {
+ const currentIds = new Set(this.cachedEvents.map(e => e.id));
+
+ for (const id of this.notifiedEventIds) {
+ if (!currentIds.has(id)) {
+ this.notifiedEventIds.delete(id);
+ }
+ }
+ }
+
+ /**
+ * Send a native notification for an upcoming event
+ */
+ private sendEventNotification(event: UpcomingMeeting, recordingBehavior: RecordingBehavior): void {
+ const minutes = event.minutesUntil;
+ let body = minutes <= 1 ? 'Starting now' : `Starts in ${minutes} minute${minutes === 1 ? '' : 's'}`;
+
+ // Add recording hint based on behavior
+ if (recordingBehavior === 'default_record') {
+ body += ' - Will auto-record';
+ } else if (recordingBehavior === 'always_ask') {
+ body += ' - Click to record';
+ }
+
+ // Check if notifications are supported
+ if (!Notification.isSupported()) {
+ log.warn('Notifications are not supported on this system');
+ return;
+ }
+
+ log.info({
+ eventId: event.id,
+ summary: event.summary,
+ minutesUntil: minutes,
+ recordingBehavior,
+ notificationSupported: Notification.isSupported(),
+ }, 'Sending notification');
+
+ const notification = new Notification({
+ title: event.summary,
+ body,
+ urgency: 'critical',
+ });
+
+ notification.on('click', () => {
+ log.info({ eventId: event.id }, 'Notification clicked');
+ this.showMainWindow();
+ });
+
+ notification.on('show', () => {
+ log.info({ eventId: event.id }, 'Notification shown');
+ });
+
+ notification.on('failed', (error) => {
+ log.error({ eventId: event.id, error }, 'Notification failed');
+ });
+
+ notification.on('close', () => {
+ log.debug({ eventId: event.id }, 'Notification closed');
+ });
+
+ notification.show();
+ log.debug({ eventId: event.id }, 'notification.show() called');
+ }
+
+ /**
+ * Show and focus the main window
+ */
+ private showMainWindow(): void {
+ if (!this.mainWindow || this.mainWindow.isDestroyed()) {
+ log.warn('Main window not available');
+ return;
+ }
+
+ this.mainWindow.show();
+ this.mainWindow.focus();
+
+ // On macOS, also show the dock icon
+ if (process.platform === 'darwin') {
+ const { app } = require('electron');
+ app.dock?.show();
+ }
+ }
+
+ /**
+ * Clear all cached state
+ */
+ reset(): void {
+ this.notifiedEventIds.clear();
+ this.cachedEvents = [];
+ }
+}
+
+// Singleton instance
+let instance: CalendarPollerService | null = null;
+
+export function getCalendarPoller(): CalendarPollerService {
+ if (!instance) {
+ instance = new CalendarPollerService();
+ }
+ return instance;
+}
+
+export function resetCalendarPoller(): void {
+ if (instance) {
+ instance.stopPolling();
+ instance.reset();
+ instance = null;
+ }
+}
+
+export { CalendarPollerService };
diff --git a/src/main/services/google-auth.service.ts b/src/main/services/google-auth.service.ts
new file mode 100644
index 0000000..0bc4fa9
--- /dev/null
+++ b/src/main/services/google-auth.service.ts
@@ -0,0 +1,440 @@
+/**
+ * Google Auth Service
+ *
+ * Handles OAuth 2.0 PKCE flow for Google Calendar integration.
+ * Uses a temporary HTTP server to receive the OAuth callback.
+ */
+
+import { BrowserWindow } from 'electron';
+import crypto from 'crypto';
+import net from 'net';
+import http from 'http';
+import { URL } from 'url';
+import { logger } from '../lib/logger';
+import {
+ loadGoogleOAuthConfig,
+ saveGoogleTokens,
+ loadGoogleTokens,
+ clearGoogleTokens,
+ hasGoogleTokens,
+} from '../lib/config';
+import type { GoogleTokens } from '../../shared/types/calendar.types';
+
+const log = logger.child({ module: 'google-auth' });
+
+// Port range for OAuth callback server
+const OAUTH_PORT_START = 51751;
+const OAUTH_PORT_END = 51799;
+
+// Token refresh mutex to prevent concurrent refreshes
+let refreshPromise: Promise<GoogleTokens> | null = null;
+
+/**
+ * Find a free port in the specified range
+ */
+async function findFreePort(): Promise<number> {
+ // Try preferred range first
+ for (let port = OAUTH_PORT_START; port <= OAUTH_PORT_END; port++) {
+ if (await isPortFree(port)) {
+ return port;
+ }
+ }
+
+ // Fallback: let OS assign a free port
+ return new Promise((resolve, reject) => {
+ const server = net.createServer();
+ server.listen(0, () => {
+ const address = server.address();
+ if (address && typeof address === 'object') {
+ const port = address.port;
+ server.close(() => resolve(port));
+ } else {
+ server.close(() => reject(new Error('Could not get port from server')));
+ }
+ });
+ server.on('error', reject);
+ });
+}
+
+/**
+ * Check if a port is free
+ */
+function isPortFree(port: number): Promise<boolean> {
+ return new Promise((resolve) => {
+ const server = net.createServer();
+ server.once('error', () => resolve(false));
+ server.once('listening', () => {
+ server.close(() => resolve(true));
+ });
+ server.listen(port);
+ });
+}
+
+/**
+ * Generate PKCE code verifier (43-128 characters)
+ */
+function generateCodeVerifier(): string {
+ return crypto.randomBytes(32).toString('base64url');
+}
+
+/**
+ * Generate PKCE code challenge from verifier
+ */
+function generateCodeChallenge(verifier: string): string {
+ return crypto.createHash('sha256').update(verifier).digest('base64url');
+}
+
+/**
+ * Build Google OAuth authorization URL
+ */
+function buildAuthUrl(clientId: string, redirectUri: string, codeChallenge: string, scopes: string[]): string {
+ const url = new URL('https://accounts.google.com/o/oauth2/v2/auth');
+ url.searchParams.set('client_id', clientId);
+ url.searchParams.set('redirect_uri', redirectUri);
+ url.searchParams.set('response_type', 'code');
+ url.searchParams.set('scope', scopes.join(' '));
+ url.searchParams.set('code_challenge', codeChallenge);
+ url.searchParams.set('code_challenge_method', 'S256');
+ url.searchParams.set('access_type', 'offline');
+ url.searchParams.set('prompt', 'consent'); // Force consent to get refresh token
+ return url.toString();
+}
+
+/**
+ * Exchange authorization code for tokens
+ */
+async function exchangeCodeForTokens(
+ code: string,
+ codeVerifier: string,
+ clientId: string,
+ clientSecret: string,
+ redirectUri: string,
+ tokenUri: string
+): Promise<GoogleTokens> {
+ const response = await fetch(tokenUri, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ body: new URLSearchParams({
+ client_id: clientId,
+ client_secret: clientSecret,
+ code,
+ code_verifier: codeVerifier,
+ grant_type: 'authorization_code',
+ redirect_uri: redirectUri,
+ }),
+ });
+
+ if (!response.ok) {
+ const errorText = await response.text();
+ log.error({ status: response.status, error: errorText }, 'Token exchange failed');
+ throw new Error(`Token exchange failed: ${response.status}`);
+ }
+
+ const data = await response.json() as {
+ access_token: string;
+ refresh_token?: string;
+ expires_in: number;
+ };
+
+ if (!data.refresh_token) {
+ log.warn('No refresh token received - user may need to revoke and re-authorize');
+ }
+
+ const tokens: GoogleTokens = {
+ accessToken: data.access_token,
+ refreshToken: data.refresh_token || '',
+ expiresAt: Date.now() + data.expires_in * 1000,
+ };
+
+ saveGoogleTokens(tokens);
+ log.info('Tokens exchanged and saved successfully');
+
+ return tokens;
+}
+
+/**
+ * Start the OAuth PKCE flow
+ * Opens a BrowserWindow for user consent and waits for callback
+ */
+export async function startAuthFlow(): Promise<GoogleTokens> {
+ const config = loadGoogleOAuthConfig();
+ if (!config) {
+ throw new Error('Google OAuth config not found');
+ }
+
+ const port = await findFreePort();
+ const redirectUri = `http://localhost:${port}`;
+ const codeVerifier = generateCodeVerifier();
+ const codeChallenge = generateCodeChallenge(codeVerifier);
+
+ log.info({ port }, 'Starting OAuth flow');
+
+ return new Promise((resolve, reject) => {
+ let authWindow: BrowserWindow | null = null;
+ let server: http.Server | null = null;
+ let handled = false;
+
+ const cleanup = () => {
+ if (server) {
+ server.close();
+ server = null;
+ }
+ if (authWindow && !authWindow.isDestroyed()) {
+ authWindow.close();
+ authWindow = null;
+ }
+ };
+
+ // Create temporary HTTP server to receive callback
+ server = http.createServer(async (req, res) => {
+ if (handled) {
+ res.writeHead(200);
+ res.end('Already handled');
+ return;
+ }
+
+ const url = new URL(req.url || '/', `http://localhost:${port}`);
+
+ // Check for OAuth callback
+ if (url.pathname === '/' || url.pathname === '/callback') {
+ const code = url.searchParams.get('code');
+ const error = url.searchParams.get('error');
+
+ handled = true;
+
+ if (error) {
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(`
+ <html>
+ <body style="font-family: system-ui; padding: 40px; text-align: center;">
+ <h2>Authorization Failed</h2>
+ <p>Error: ${error}</p>
+ <p>You can close this window.</p>
+ </body>
+ </html>
+ `);
+ cleanup();
+ reject(new Error(`OAuth denied: ${error}`));
+ return;
+ }
+
+ if (!code) {
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(`
+ <html>
+ <body style="font-family: system-ui; padding: 40px; text-align: center;">
+ <h2>Authorization Failed</h2>
+ <p>No authorization code received.</p>
+ <p>You can close this window.</p>
+ </body>
+ </html>
+ `);
+ cleanup();
+ reject(new Error('No authorization code received'));
+ return;
+ }
+
+ // Show success message
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(`
+ <html>
+ <body style="font-family: system-ui; padding: 40px; text-align: center;">
+ <h2>Authorization Successful!</h2>
+ <p>You can close this window and return to Meeting Copilot.</p>
+ <script>setTimeout(() => window.close(), 2000);</script>
+ </body>
+ </html>
+ `);
+
+ // Exchange code for tokens
+ try {
+ const tokens = await exchangeCodeForTokens(
+ code,
+ codeVerifier,
+ config.clientId,
+ config.clientSecret,
+ redirectUri,
+ config.tokenUri
+ );
+ cleanup();
+ resolve(tokens);
+ } catch (err) {
+ cleanup();
+ reject(err);
+ }
+ }
+ });
+
+ server.listen(port, () => {
+ log.info({ port }, 'OAuth callback server listening');
+
+ // Open auth window
+ const authUrl = buildAuthUrl(config.clientId, redirectUri, codeChallenge, config.scopes);
+
+ authWindow = new BrowserWindow({
+ width: 500,
+ height: 720,
+ autoHideMenuBar: true,
+ webPreferences: {
+ nodeIntegration: false,
+ contextIsolation: true,
+ },
+ });
+
+ authWindow.loadURL(authUrl);
+
+ authWindow.on('closed', () => {
+ authWindow = null;
+ if (!handled) {
+ cleanup();
+ reject(new Error('Auth window closed by user'));
+ }
+ });
+ });
+
+ server.on('error', (err) => {
+ log.error({ error: err }, 'OAuth callback server error');
+ cleanup();
+ reject(err);
+ });
+
+ // Timeout after 5 minutes
+ setTimeout(() => {
+ if (!handled) {
+ cleanup();
+ reject(new Error('OAuth flow timed out'));
+ }
+ }, 5 * 60 * 1000);
+ });
+}
+
+/**
+ * Refresh the access token using the refresh token
+ * Uses a mutex to prevent concurrent refresh attempts
+ */
+async function doRefreshToken(): Promise<GoogleTokens> {
+ const tokens = loadGoogleTokens();
+ if (!tokens?.refreshToken) {
+ throw new Error('NO_REFRESH_TOKEN');
+ }
+
+ const config = loadGoogleOAuthConfig();
+ if (!config) {
+ throw new Error('Google OAuth config not found');
+ }
+
+ log.info('Refreshing access token');
+
+ const response = await fetch(config.tokenUri, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ body: new URLSearchParams({
+ client_id: config.clientId,
+ client_secret: config.clientSecret,
+ grant_type: 'refresh_token',
+ refresh_token: tokens.refreshToken,
+ }),
+ });
+
+ if (!response.ok) {
+ const status = response.status;
+ // 400/401 means refresh token is invalid/revoked
+ if (status === 400 || status === 401) {
+ log.error({ status }, 'Refresh token expired or revoked');
+ throw new Error('REFRESH_TOKEN_EXPIRED');
+ }
+ throw new Error(`Token refresh failed: ${status}`);
+ }
+
+ const data = await response.json() as {
+ access_token: string;
+ expires_in: number;
+ };
+
+ const updated: GoogleTokens = {
+ accessToken: data.access_token,
+ refreshToken: tokens.refreshToken, // Keep existing refresh token
+ expiresAt: Date.now() + data.expires_in * 1000,
+ };
+
+ saveGoogleTokens(updated);
+ log.info('Access token refreshed successfully');
+
+ return updated;
+}
+
+/**
+ * Refresh access token with mutex to prevent concurrent refreshes
+ */
+export async function refreshAccessToken(): Promise<GoogleTokens> {
+ if (refreshPromise) {
+ log.debug('Token refresh already in progress, waiting...');
+ return refreshPromise;
+ }
+
+ refreshPromise = doRefreshToken().finally(() => {
+ refreshPromise = null;
+ });
+
+ return refreshPromise;
+}
+
+/**
+ * Get a valid access token, refreshing if necessary
+ * Returns null if not authenticated
+ */
+export async function getValidAccessToken(): Promise<string | null> {
+ const tokens = loadGoogleTokens();
+ if (!tokens) {
+ return null;
+ }
+
+ // Refresh if expiring within 60 seconds
+ if (Date.now() >= tokens.expiresAt - 60_000) {
+ try {
+ const refreshed = await refreshAccessToken();
+ return refreshed.accessToken;
+ } catch (error) {
+ const err = error as Error;
+ log.error({ error: err.message }, 'Failed to refresh token');
+ // If refresh fails, return null to indicate re-auth needed
+ if (err.message === 'NO_REFRESH_TOKEN' || err.message === 'REFRESH_TOKEN_EXPIRED') {
+ return null;
+ }
+ throw error;
+ }
+ }
+
+ return tokens.accessToken;
+}
+
+/**
+ * Sign out - clear stored tokens
+ */
+export function signOut(): void {
+ clearGoogleTokens();
+ log.info('Signed out of Google');
+}
+
+/**
+ * Check if user has stored tokens
+ */
+export function hasTokens(): boolean {
+ return hasGoogleTokens();
+}
+
+/**
+ * Check if user is authenticated (has valid tokens)
+ */
+export async function isAuthenticated(): Promise<boolean> {
+ if (!hasTokens()) {
+ return false;
+ }
+
+ try {
+ const token = await getValidAccessToken();
+ return token !== null;
+ } catch {
+ return false;
+ }
+}
diff --git a/src/main/services/google-calendar.service.ts b/src/main/services/google-calendar.service.ts
new file mode 100644
index 0000000..1f7a141
--- /dev/null
+++ b/src/main/services/google-calendar.service.ts
@@ -0,0 +1,190 @@
+/**
+ * Google Calendar Service
+ *
+ * Fetches calendar events from Google Calendar API.
+ */
+
+import { logger } from '../lib/logger';
+import { getValidAccessToken } from './google-auth.service';
+import type { CalendarEvent, UpcomingMeeting } from '../../shared/types/calendar.types';
+
+const log = logger.child({ module: 'google-calendar' });
+
+const CALENDAR_API_BASE = 'https://www.googleapis.com/calendar/v3';
+
+// Error types for callers to handle
+export class CalendarAuthError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'CalendarAuthError';
+ }
+}
+
+export class CalendarApiError extends Error {
+ constructor(message: string, public status: number) {
+ super(message);
+ this.name = 'CalendarApiError';
+ }
+}
+
+/**
+ * Make an authenticated request to Google Calendar API
+ */
+async function calendarFetch(endpoint: string): Promise<Response> {
+ const token = await getValidAccessToken();
+ if (!token) {
+ throw new CalendarAuthError('NOT_AUTHENTICATED');
+ }
+
+ const url = `${CALENDAR_API_BASE}${endpoint}`;
+ const response = await fetch(url, {
+ headers: { Authorization: `Bearer ${token}` },
+ });
+
+ if (response.status === 401) {
+ throw new CalendarAuthError('UNAUTHORIZED');
+ }
+
+ if (!response.ok) {
+ const errorBody = await response.text();
+ log.error({ status: response.status, errorBody }, 'Calendar API request failed');
+ throw new CalendarApiError(`Calendar API error: ${response.status} - ${errorBody}`, response.status);
+ }
+
+ return response;
+}
+
+/**
+ * Fetch events from a calendar
+ */
+async function fetchEvents(options: {
+ calendarId?: string;
+ timeMin?: string;
+ timeMax?: string;
+ maxResults?: number;
+}): Promise<CalendarEvent[]> {
+ const {
+ calendarId = 'primary',
+ timeMin,
+ timeMax,
+ maxResults = 50,
+ } = options;
+
+ const params = new URLSearchParams({
+ singleEvents: 'true',
+ orderBy: 'startTime',
+ maxResults: String(maxResults),
+ });
+
+ if (timeMin) params.set('timeMin', timeMin);
+ if (timeMax) params.set('timeMax', timeMax);
+
+ const endpoint = `/calendars/${encodeURIComponent(calendarId)}/events?${params}`;
+ const response = await calendarFetch(endpoint);
+ const data = await response.json() as { items?: CalendarEvent[] };
+
+ return data.items || [];
+}
+
+/**
+ * Convert CalendarEvent to UpcomingMeeting
+ */
+function toUpcomingMeeting(event: CalendarEvent): UpcomingMeeting | null {
+ const isAllDay = !event.start.dateTime;
+
+ let startTime: Date;
+ let endTime: Date;
+
+ if (event.start.dateTime) {
+ startTime = new Date(event.start.dateTime);
+ endTime = new Date(event.end.dateTime || event.start.dateTime);
+ } else if (event.start.date) {
+ // All-day event
+ startTime = new Date(event.start.date);
+ endTime = new Date(event.end.date || event.start.date);
+ } else {
+ return null;
+ }
+
+ const now = Date.now();
+ const minutesUntil = Math.ceil((startTime.getTime() - now) / 60_000);
+
+ // Extract meet link from various sources
+ let meetLink = event.hangoutLink;
+ if (!meetLink && event.conferenceData?.entryPoints) {
+ const videoEntry = event.conferenceData.entryPoints.find(e => e.entryPointType === 'video');
+ meetLink = videoEntry?.uri;
+ }
+
+ return {
+ id: event.id,
+ summary: event.summary || 'No title',
+ startTime,
+ endTime,
+ minutesUntil,
+ meetLink,
+ location: event.location,
+ htmlLink: event.htmlLink,
+ isAllDay,
+ };
+}
+
+/**
+ * Fetch upcoming events within the specified time window
+ */
+export async function fetchUpcomingEvents(hoursAhead: number = 24): Promise<UpcomingMeeting[]> {
+ const now = new Date();
+ const later = new Date(now.getTime() + hoursAhead * 60 * 60 * 1000);
+
+ log.debug({ hoursAhead }, 'Fetching upcoming events');
+
+ const events = await fetchEvents({
+ timeMin: now.toISOString(),
+ timeMax: later.toISOString(),
+ });
+
+ const meetings = events
+ .map(toUpcomingMeeting)
+ .filter((m): m is UpcomingMeeting => m !== null)
+ // Filter out cancelled events
+ .filter(m => {
+ const originalEvent = events.find(e => e.id === m.id);
+ return originalEvent?.status !== 'cancelled';
+ });
+
+ log.debug({ count: meetings.length }, 'Fetched upcoming meetings');
+
+ return meetings;
+}
+
+/**
+ * Fetch today's events
+ */
+export async function fetchTodayEvents(): Promise<UpcomingMeeting[]> {
+ const start = new Date();
+ start.setHours(0, 0, 0, 0);
+
+ const end = new Date();
+ end.setHours(23, 59, 59, 999);
+
+ const events = await fetchEvents({
+ timeMin: start.toISOString(),
+ timeMax: end.toISOString(),
+ });
+
+ return events
+ .map(toUpcomingMeeting)
+ .filter((m): m is UpcomingMeeting => m !== null);
+}
+
+/**
+ * Get list of calendars the user has access to
+ */
+export async function fetchCalendarList(): Promise<Array<{ id: string; summary: string; primary?: boolean }>> {
+ const response = await calendarFetch('/users/me/calendarList');
+ const data = await response.json() as {
+ items?: Array<{ id: string; summary: string; primary?: boolean }>;
+ };
+
+ return data.items || [];
+}
diff --git a/src/main/services/tray.service.ts b/src/main/services/tray.service.ts
new file mode 100644
index 0000000..8dbc590
--- /dev/null
+++ b/src/main/services/tray.service.ts
@@ -0,0 +1,209 @@
+/**
+ * Tray Service
+ *
+ * Creates and manages the system tray icon with context menu
+ * showing upcoming meetings.
+ */
+
+import { Tray, Menu, nativeImage, app, BrowserWindow } from 'electron';
+import path from 'path';
+import { logger } from '../lib/logger';
+import { getCalendarPoller } from './calendar-poller.service';
+import { setAppQuitting } from '../index';
+import type { UpcomingMeeting } from '../../shared/types/calendar.types';
+
+const log = logger.child({ module: 'tray' });
+
+class TrayService {
+ private tray: Tray | null = null;
+ private mainWindow: BrowserWindow | null = null;
+ private cachedEvents: UpcomingMeeting[] = [];
+
+ /**
+ * Create the system tray
+ */
+ create(mainWindow: BrowserWindow): Tray {
+ this.mainWindow = mainWindow;
+
+ // Create tray icon
+ const iconPath = this.getIconPath();
+ let icon: Electron.NativeImage;
+
+ try {
+ icon = nativeImage.createFromPath(iconPath);
+ // Resize for tray (16x16 on most platforms, template on macOS)
+ icon = icon.resize({ width: 16, height: 16 });
+ if (process.platform === 'darwin') {
+ icon.setTemplateImage(true);
+ }
+ } catch (error) {
+ log.warn({ error }, 'Failed to load tray icon, using empty');
+ icon = nativeImage.createEmpty();
+ }
+
+ this.tray = new Tray(icon);
+ this.tray.setToolTip('Meeting Copilot');
+
+ // On macOS, clicking tray icon should show context menu (default behavior)
+ // On Windows/Linux, double-click opens the app
+ if (process.platform !== 'darwin') {
+ this.tray.on('double-click', () => {
+ this.showMainWindow();
+ });
+ }
+
+ // Initial menu
+ this.updateMenu([]);
+
+ // Listen for calendar events updates
+ const poller = getCalendarPoller();
+ poller.on('events-updated', (events: UpcomingMeeting[]) => {
+ this.cachedEvents = events;
+ this.updateMenu(events);
+ });
+
+ poller.on('auth-required', () => {
+ this.tray?.setToolTip('Meeting Copilot - Reconnect needed');
+ });
+
+ log.info('Tray created');
+
+ return this.tray;
+ }
+
+ /**
+ * Get the path to the tray icon
+ */
+ private getIconPath(): string {
+ // In packaged app, icons are in resources/
+ if (app.isPackaged) {
+ return path.join(process.resourcesPath, 'resources', 'logo.jpeg');
+ }
+ // In development, look in resources/
+ return path.join(app.getAppPath(), 'resources', 'logo.jpeg');
+ }
+
+ /**
+ * Update the tray context menu with upcoming events
+ */
+ updateMenu(events: UpcomingMeeting[]): void {
+ if (!this.tray) return;
+
+ const menuItems: Electron.MenuItemConstructorOptions[] = [];
+
+ // Add upcoming events (max 8)
+ if (events.length > 0) {
+ const displayEvents = events.slice(0, 8);
+
+ for (const event of displayEvents) {
+ const time = event.isAllDay
+ ? 'All day'
+ : event.startTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
+
+ const label = `${time} ${event.summary}`;
+
+ menuItems.push({
+ label,
+ click: () => {
+ this.showMainWindow();
+ },
+ });
+ }
+ } else {
+ menuItems.push({
+ label: 'No upcoming meetings',
+ enabled: false,
+ });
+ }
+
+ menuItems.push({ type: 'separator' });
+
+ menuItems.push({
+ label: 'Open Meeting Copilot',
+ click: () => {
+ this.showMainWindow();
+ },
+ });
+
+ menuItems.push({ type: 'separator' });
+
+ menuItems.push({
+ label: 'Quit',
+ click: () => {
+ setAppQuitting(true);
+ app.quit();
+ },
+ });
+
+ const contextMenu = Menu.buildFromTemplate(menuItems);
+ this.tray.setContextMenu(contextMenu);
+
+ // Update tooltip with next meeting info
+ if (events.length > 0 && !events[0].isAllDay) {
+ const next = events[0];
+ const mins = next.minutesUntil;
+ if (mins <= 60) {
+ this.tray.setToolTip(`Meeting Copilot - "${next.summary}" in ${mins}m`);
+ } else {
+ this.tray.setToolTip('Meeting Copilot');
+ }
+ } else {
+ this.tray.setToolTip('Meeting Copilot');
+ }
+ }
+
+ /**
+ * Show and focus the main window
+ */
+ showMainWindow(): void {
+ if (!this.mainWindow || this.mainWindow.isDestroyed()) {
+ log.warn('Main window not available');
+ return;
+ }
+
+ this.mainWindow.show();
+ this.mainWindow.focus();
+
+ // On macOS, also show the dock icon
+ if (process.platform === 'darwin') {
+ app.dock?.show();
+ }
+ }
+
+ /**
+ * Destroy the tray
+ */
+ destroy(): void {
+ if (this.tray) {
+ this.tray.destroy();
+ this.tray = null;
+ }
+ log.info('Tray destroyed');
+ }
+
+ /**
+ * Get the tray instance
+ */
+ getTray(): Tray | null {
+ return this.tray;
+ }
+}
+
+// Singleton instance
+let instance: TrayService | null = null;
+
+export function getTrayService(): TrayService {
+ if (!instance) {
+ instance = new TrayService();
+ }
+ return instance;
+}
+
+export function resetTrayService(): void {
+ if (instance) {
+ instance.destroy();
+ instance = null;
+ }
+}
+
+export { TrayService };
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d5d342e..ee6fe7f 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -1,6 +1,14 @@
import { contextBridge, ipcRenderer } from 'electron';
import type { IpcApi, RecorderEvent, PermissionStatus, StartRecordingParams } from '../shared/types/ipc.types';
import type { Channel } from '../shared/schemas/capture.schema';
+import type {
+ CalendarApi,
+ CalendarEvents,
+ CalendarSignInResult,
+ CalendarEventsResult,
+ CalendarAuthStatusResult,
+ UpcomingMeeting,
+} from '../shared/types/calendar.types';
// Copilot event types
export interface CopilotTranscriptSegment {
@@ -142,6 +150,7 @@ export interface CopilotEvents {
export interface MCPServerConfig {
id: string;
name: string;
+ description?: string;
transport: 'stdio' | 'http';
command?: string;
args?: string[];
@@ -199,6 +208,17 @@ export interface MCPServerTemplate {
setupInstructions?: string;
}
+export interface MCPOAuthConfig {
+ serverId: string;
+ serverName: string;
+ authorizationUrl: string;
+ tokenUrl: string;
+ clientId: string;
+ clientSecret?: string;
+ scopes?: string[];
+ redirectUri?: string;
+}
+
export interface MCPApi {
// Server management
getServers: () => Promise<{ success: boolean; servers?: MCPServerConfig[]; connectionStates?: Record<string, { status: string; error?: string }>; error?: string }>;
@@ -250,6 +270,13 @@ export interface MCPApi {
// Trigger Keywords
getTriggerKeywords: () => Promise<{ success: boolean; keywords: string[]; error?: string }>;
setTriggerKeywords: (keywords: string[]) => Promise<{ success: boolean; error?: string }>;
+
+ // OAuth
+ startOAuth: (serverId: string, oauthConfig: MCPOAuthConfig) => Promise<{ success: boolean; error?: string }>;
+ connectWithAuth: (serverId: string, oauthConfig?: MCPOAuthConfig) => Promise<{ success: boolean; tools?: MCPTool[]; error?: string }>;
+ requiresAuth: (serverId: string) => Promise<{ success: boolean; requiresAuth?: boolean; error?: string }>;
+ hasValidTokens: (serverId: string) => Promise<{ success: boolean; hasTokens?: boolean; error?: string }>;
+ deleteTokens: (serverId: string) => Promise<{ success: boolean; error?: string }>;
}
export interface MCPEvents {
@@ -258,6 +285,10 @@ export interface MCPEvents {
onServerConnected: (callback: (data: { serverId: string; tools: MCPTool[] }) => void) => () => void;
onServerDisconnected: (callback: (data: { serverId: string; reason: string }) => void) => () => void;
onServerError: (callback: (data: { serverId: string; error: string }) => void) => () => void;
+ // OAuth events
+ onAuthRequired: (callback: (data: { serverId: string; serverName: string }) => void) => () => void;
+ onAuthSuccess: (callback: (data: { serverId: string }) => void) => () => void;
+ onAuthError: (callback: (data: { serverId: string; error: string }) => void) => () => void;
}
const api: IpcApi = {
@@ -411,6 +442,15 @@ const api: IpcApi = {
// Trigger Keywords
getTriggerKeywords: () => ipcRenderer.invoke('mcp:get-trigger-keywords'),
setTriggerKeywords: (keywords: string[]) => ipcRenderer.invoke('mcp:set-trigger-keywords', keywords),
+
+ // OAuth
+ startOAuth: (serverId: string, oauthConfig: MCPOAuthConfig) =>
+ ipcRenderer.invoke('mcp:start-oauth', serverId, oauthConfig),
+ connectWithAuth: (serverId: string, oauthConfig?: MCPOAuthConfig) =>
+ ipcRenderer.invoke('mcp:connect-with-auth', serverId, oauthConfig),
+ requiresAuth: (serverId: string) => ipcRenderer.invoke('mcp:requires-auth', serverId),
+ hasValidTokens: (serverId: string) => ipcRenderer.invoke('mcp:has-valid-tokens', serverId),
+ deleteTokens: (serverId: string) => ipcRenderer.invoke('mcp:delete-tokens', serverId),
} as MCPApi,
// MCP event listeners
@@ -440,7 +480,46 @@ const api: IpcApi = {
ipcRenderer.on('mcp:server-error', listener);
return () => ipcRenderer.removeListener('mcp:server-error', listener);
},
+ // OAuth events
+ onAuthRequired: (callback: (data: { serverId: string; serverName: string }) => void) => {
+ const listener = (_event: Electron.IpcRendererEvent, data: any) => callback(data);
+ ipcRenderer.on('mcp:auth-required', listener);
+ return () => ipcRenderer.removeListener('mcp:auth-required', listener);
+ },
+ onAuthSuccess: (callback: (data: { serverId: string }) => void) => {
+ const listener = (_event: Electron.IpcRendererEvent, data: any) => callback(data);
+ ipcRenderer.on('mcp:auth-success', listener);
+ return () => ipcRenderer.removeListener('mcp:auth-success', listener);
+ },
+ onAuthError: (callback: (data: { serverId: string; error: string }) => void) => {
+ const listener = (_event: Electron.IpcRendererEvent, data: any) => callback(data);
+ ipcRenderer.on('mcp:auth-error', listener);
+ return () => ipcRenderer.removeListener('mcp:auth-error', listener);
+ },
} as MCPEvents,
+
+ // Google Calendar API
+ calendar: {
+ signIn: (): Promise<CalendarSignInResult> => ipcRenderer.invoke('calendar:sign-in'),
+ signOut: (): Promise<{ success: boolean; error?: string }> => ipcRenderer.invoke('calendar:sign-out'),
+ isSignedIn: (): Promise<CalendarAuthStatusResult> => ipcRenderer.invoke('calendar:is-signed-in'),
+ getUpcomingEvents: (hours?: number): Promise<CalendarEventsResult> =>
+ ipcRenderer.invoke('calendar:get-events', hours),
+ } as CalendarApi,
+
+ // Calendar event listeners
+ calendarOn: {
+ onAuthRequired: (callback: () => void) => {
+ const listener = () => callback();
+ ipcRenderer.on('calendar:auth-required', listener);
+ return () => ipcRenderer.removeListener('calendar:auth-required', listener);
+ },
+ onEventsUpdated: (callback: (events: UpcomingMeeting[]) => void) => {
+ const listener = (_event: Electron.IpcRendererEvent, data: UpcomingMeeting[]) => callback(data);
+ ipcRenderer.on('calendar:events-updated', listener);
+ return () => ipcRenderer.removeListener('calendar:events-updated', listener);
+ },
+ } as CalendarEvents,
};
contextBridge.exposeInMainWorld('electronAPI', api);
@@ -453,6 +532,8 @@ declare global {
copilotOn: CopilotEvents;
mcp: MCPApi;
mcpOn: MCPEvents;
+ calendar: CalendarApi;
+ calendarOn: CalendarEvents;
};
}
}
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index 2e5a8cd..a2fb52a 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -1,9 +1,10 @@
import { useState } from 'react';
-import { Sidebar } from './components/layout/Sidebar';
+import { NewSidebar } from './components/layout/NewSidebar';
import { AuthView } from './components/auth/AuthView';
import { TopStatusBar } from './components/recording/TopStatusBar';
import { TranscriptionPanel } from './components/transcription/TranscriptionPanel';
import { HistoryView } from './components/history/HistoryView';
+import { HomeView } from './components/home/HomeView';
import { useConfigStore } from './stores/config.store';
import { useSession } from './hooks/useSession';
import { useSessionStore } from './stores/session.store';
@@ -13,7 +14,7 @@ import { useCopilot } from './hooks/useCopilot';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from './components/ui/card';
import { Button } from './components/ui/button';
import { ErrorToast } from './components/ui/error-toast';
-import { AlertCircle, Shield, Loader2 } from 'lucide-react';
+import { AlertCircle, Loader2 } from 'lucide-react';
import {
NudgeToast,
CallSummaryView,
@@ -21,70 +22,165 @@ import {
import { useCopilotStore } from './stores/copilot.store';
import { useMeetingSetupStore } from './stores/meeting-setup.store';
import { MCPServersPanel } from './components/settings/MCPServersPanel';
+import { CalendarPanel } from './components/settings/CalendarPanel';
+import { CalendarAuthBanner } from './components/calendar';
import { MeetingSetupFlow, MeetingInfoPanel } from './components/meeting-setup';
+import { StepIndicators } from './components/auth/AuthView';
+import { CalendarSetupView } from './components/auth/CalendarSetupView';
+import { RecordingPreferencesView } from './components/auth/RecordingPreferencesView';
-type Tab = 'recording' | 'history' | 'settings';
+type Tab = 'home' | 'history' | 'settings';
+
+// Shield icon for permissions
+function ShieldIcon() {
+ return (
+ <svg
+ width="50"
+ height="50"
+ viewBox="0 0 50 50"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <rect width="50" height="50" rx="12" fill="#EC5B16" />
+ <path
+ d="M25 14L15 18V26C15 31.52 19.16 36.74 25 38C30.84 36.74 35 31.52 35 26V18L25 14Z"
+ stroke="white"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ fill="none"
+ />
+ <path
+ d="M21 25L24 28L29 22"
+ stroke="white"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
function PermissionsView() {
const { status, requestMicPermission, openSettings } = usePermissions();
return (
- <div className="max-w-md mx-auto mt-20">
- <Card>
- <CardHeader>
- <div className="flex items-center gap-2">
- <Shield className="h-5 w-5 text-primary" />
- <CardTitle>Permissions Required</CardTitle>
+ <div className="h-full w-full bg-[#f8f8fa] flex flex-col items-center justify-center relative overflow-hidden">
+ {/* Orange gradient glow */}
+ <div
+ className="absolute top-[-30%] left-1/2 -translate-x-1/2 w-[600px] h-[567px] rounded-[300px] pointer-events-none"
+ style={{
+ background:
+ 'radial-gradient(circle at center, rgba(236,91,22,0.08) 0%, rgba(236,91,22,0) 70%)',
+ }}
+ />
+
+ {/* Step indicators */}
+ <div className="absolute top-[32px]">
+ <StepIndicators currentStep={1} />
+ </div>
+
+ {/* Main content */}
+ <div className="flex flex-col items-center w-full max-w-[380px] px-6 relative z-10">
+ {/* Icon and heading */}
+ <div className="flex flex-col items-center gap-[16px] mb-[32px]">
+ <ShieldIcon />
+ <div className="flex flex-col items-center gap-[8px]">
+ <h1 className="text-[22px] font-semibold text-black text-center tracking-[-0.44px] leading-[33px]">
+ Permissions Required
+ </h1>
+ <p className="text-[14px] font-normal text-[#464646] text-center leading-[21px]">
+ Meeting Copilot needs access to record your screen and microphone.
+ </p>
</div>
- <CardDescription>
- Meeting Copilot needs access to record your screen and microphone.
- </CardDescription>
- </CardHeader>
- <CardContent className="space-y-4">
- <div className="flex items-center justify-between p-3 rounded-lg border">
- <div>
- <p className="font-medium text-sm">Microphone</p>
- <p className="text-xs text-muted-foreground">Required for voice recording</p>
+ </div>
+
+ {/* Permission items */}
+ <div className="w-full flex flex-col gap-[12px]">
+ {/* Microphone permission */}
+ <div className="flex items-center justify-between p-[16px] bg-white border border-[#e0e0e8] rounded-[12px]">
+ <div className="flex items-center gap-[12px]">
+ <div className="w-[40px] h-[40px] bg-[#f8f8fa] rounded-[10px] flex items-center justify-center">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#464646" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />
+ <line x1="12" x2="12" y1="19" y2="22" />
+ </svg>
+ </div>
+ <div>
+ <p className="text-[14px] font-medium text-black">Microphone</p>
+ <p className="text-[12px] text-[#969696]">Required for voice recording</p>
+ </div>
</div>
{status.microphone ? (
- <span className="text-xs text-green-600 font-medium">Granted</span>
+ <div className="flex items-center gap-[6px] px-[12px] py-[6px] bg-[#e8f5e9] rounded-[8px]">
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#22c55e" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M20 6L9 17l-5-5" />
+ </svg>
+ <span className="text-[13px] font-medium text-[#22c55e]">Granted</span>
+ </div>
) : (
- <Button size="sm" onClick={requestMicPermission}>
+ <button
+ onClick={requestMicPermission}
+ className="px-[16px] py-[8px] bg-[#ff4000] hover:bg-[#e63900] text-white text-[13px] font-medium rounded-[8px] transition-colors"
+ >
Grant
- </Button>
+ </button>
)}
</div>
- <div className="flex items-center justify-between p-3 rounded-lg border">
- <div>
- <p className="font-medium text-sm">Screen Recording</p>
- <p className="text-xs text-muted-foreground">Required for screen capture</p>
+ {/* Screen Recording permission */}
+ <div className="flex items-center justify-between p-[16px] bg-white border border-[#e0e0e8] rounded-[12px]">
+ <div className="flex items-center gap-[12px]">
+ <div className="w-[40px] h-[40px] bg-[#f8f8fa] rounded-[10px] flex items-center justify-center">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#464646" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
+ <rect x="2" y="3" width="20" height="14" rx="2" />
+ <line x1="8" x2="16" y1="21" y2="21" />
+ <line x1="12" x2="12" y1="17" y2="21" />
+ </svg>
+ </div>
+ <div>
+ <p className="text-[14px] font-medium text-black">Screen Recording</p>
+ <p className="text-[12px] text-[#969696]">Required for screen capture</p>
+ </div>
</div>
{status.screen ? (
- <span className="text-xs text-green-600 font-medium">Granted</span>
+ <div className="flex items-center gap-[6px] px-[12px] py-[6px] bg-[#e8f5e9] rounded-[8px]">
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#22c55e" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
+ <path d="M20 6L9 17l-5-5" />
+ </svg>
+ <span className="text-[13px] font-medium text-[#22c55e]">Granted</span>
+ </div>
) : (
- <Button size="sm" onClick={() => openSettings('screen')}>
+ <button
+ onClick={() => openSettings('screen')}
+ className="px-[16px] py-[8px] bg-[#ff4000] hover:bg-[#e63900] text-white text-[13px] font-medium rounded-[8px] transition-colors"
+ >
Open Settings
- </Button>
+ </button>
)}
</div>
+ </div>
- {!status.screen && (
- <div className="flex items-start gap-2 p-3 bg-muted rounded-lg">
- <AlertCircle className="h-4 w-4 text-muted-foreground flex-shrink-0 mt-0.5" />
- <p className="text-xs text-muted-foreground">
- Screen Recording permission must be granted in System Preferences. Click "Open
- Settings" and enable Meeting Copilot in the list.
- </p>
- </div>
- )}
- </CardContent>
- </Card>
+ {/* Info message */}
+ {!status.screen && (
+ <div className="mt-[20px] p-[16px] bg-[#fff8f5] border border-[#ffe4d9] rounded-[12px] flex items-start gap-[12px]">
+ <AlertCircle className="h-5 w-5 text-[#ec5b16] flex-shrink-0 mt-0.5" />
+ <p className="text-[13px] text-[#464646] leading-[20px]">
+ Screen Recording permission must be granted in System Preferences. Click "Open Settings" and enable Meeting Copilot in the list.
+ </p>
+ </div>
+ )}
+ </div>
</div>
);
}
-function RecordingView() {
+interface RecordingViewProps {
+ onBack?: () => void;
+}
+
+function RecordingView({ onBack }: RecordingViewProps) {
const { isCallActive, callSummary } = useCopilotStore();
const { status } = useSession();
const meetingSetupStore = useMeetingSetupStore();
@@ -101,6 +197,13 @@ function RecordingView() {
meetingSetupStore.reset();
};
+ // Go back to home
+ const handleGoBack = () => {
+ useCopilotStore.getState().reset();
+ meetingSetupStore.reset();
+ onBack?.();
+ };
+
// Show call summary view if call ended and summary available
if (callSummary && !isCallActive) {
return (
@@ -110,9 +213,14 @@ function RecordingView() {
<div className="max-w-4xl mx-auto h-full flex flex-col">
<div className="flex items-center justify-between mb-4 shrink-0">
<h2 className="text-lg font-semibold">Call Complete</h2>
- <Button variant="outline" size="sm" onClick={handleStartNewCall}>
- Start New Call
- </Button>
+ <div className="flex gap-2">
+ <Button variant="outline" size="sm" onClick={handleGoBack}>
+ Back to Home
+ </Button>
+ <Button variant="outline" size="sm" onClick={handleStartNewCall}>
+ Start New Call
+ </Button>
+ </div>
</div>
<div className="flex-1 min-h-0 overflow-auto">
<CallSummaryView />
@@ -145,16 +253,12 @@ function RecordingView() {
);
}
- // Show meeting setup flow when idle (not recording)
+ // If idle, go back to home (user shouldn't see RecordingView when idle)
if (isIdle) {
- return (
- <div className="flex flex-col h-full bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900">
- <TopStatusBar />
- <div className="flex-1 flex items-center justify-center overflow-auto py-8">
- <MeetingSetupFlow />
- </div>
- </div>
- );
+ // This shouldn't happen often since App.tsx checks isActivelyRecording
+ // but if we end up here, just go back
+ onBack?.();
+ return null;
}
// Show recording view with transcription and meeting info
@@ -183,12 +287,13 @@ function RecordingView() {
function SettingsView() {
const [activeSettingsTab, setActiveSettingsTab] = useState<
- 'account' | 'mcpServers'
+ 'account' | 'calendar' | 'mcpServers'
>('account');
const configStore = useConfigStore();
const settingsTabs = [
{ id: 'account' as const, label: 'Account' },
+ { id: 'calendar' as const, label: 'Calendar' },
{ id: 'mcpServers' as const, label: 'MCP Servers' },
];
@@ -247,6 +352,8 @@ function SettingsView() {
</div>
)}
+ {activeSettingsTab === 'calendar' && <CalendarPanel />}
+
{activeSettingsTab === 'mcpServers' && <MCPServersPanel />}
</div>
</div>
@@ -254,10 +361,12 @@ function SettingsView() {
}
export function App() {
- const [activeTab, setActiveTab] = useState<Tab>('recording');
+ const [activeTab, setActiveTab] = useState<Tab>('home');
+ const [showRecordingPrefs, setShowRecordingPrefs] = useState(false);
const configStore = useConfigStore();
const sessionStore = useSessionStore();
+ const { status: sessionStatus } = useSession();
const { allGranted, loading: permissionsLoading } = usePermissions();
// Global listener for recorder events - persists during navigation
@@ -270,26 +379,84 @@ export function App() {
sessionStore.setError(null);
};
+ // Check if we need to show calendar setup (onboarding not complete)
+ const needsCalendarSetup = isAuthenticated && allGranted && !configStore.onboardingComplete;
+
+ // Check if actively recording or processing
+ const isActivelyRecording = sessionStatus === 'recording' || sessionStatus === 'processing' || sessionStatus === 'stopping' || sessionStatus === 'starting';
+
+ // Handle returning from recording mode
+ const handleExitRecordingMode = () => {
+ sessionStore.reset();
+ };
+
const renderContent = () => {
+ // Step 0: Auth
if (!isAuthenticated) {
return <AuthView />;
}
+ // Step 1: Permissions (loading state)
if (permissionsLoading) {
return (
- <div className="flex items-center justify-center h-full">
- <p className="text-muted-foreground">Checking permissions...</p>
+ <div className="h-full w-full bg-[#f8f8fa] flex flex-col items-center justify-center relative overflow-hidden">
+ {/* Orange gradient glow */}
+ <div
+ className="absolute top-[-30%] left-1/2 -translate-x-1/2 w-[600px] h-[567px] rounded-[300px] pointer-events-none"
+ style={{
+ background:
+ 'radial-gradient(circle at center, rgba(236,91,22,0.08) 0%, rgba(236,91,22,0) 70%)',
+ }}
+ />
+ <div className="flex flex-col items-center gap-4">
+ <Loader2 className="w-8 h-8 text-[#ec5b16] animate-spin" />
+ <p className="text-[14px] text-[#464646]">Checking permissions...</p>
+ </div>
</div>
);
}
- if (!allGranted && activeTab === 'recording') {
+ // Step 1: Permissions
+ if (!allGranted && activeTab === 'home') {
return <PermissionsView />;
}
+ // Step 2: Calendar setup (only on home tab and during onboarding)
+ if (needsCalendarSetup && activeTab === 'home' && !showRecordingPrefs) {
+ return (
+ <CalendarSetupView
+ onConnected={() => setShowRecordingPrefs(true)}
+ onSkip={() => {}}
+ />
+ );
+ }
+
+ // Step 3: Recording preferences (after calendar connected)
+ if (showRecordingPrefs && activeTab === 'home') {
+ return (
+ <RecordingPreferencesView
+ onComplete={() => {
+ setShowRecordingPrefs(false);
+ configStore.completeOnboarding();
+ }}
+ />
+ );
+ }
+
+ // If actively recording, show RecordingView
+ if (isActivelyRecording && activeTab === 'home') {
+ return <RecordingView onBack={handleExitRecordingMode} />;
+ }
+
+ // Main app
switch (activeTab) {
- case 'recording':
- return <RecordingView />;
+ case 'home':
+ return (
+ <HomeView
+ onNavigateToHistory={() => setActiveTab('history')}
+ onNavigateToSettings={() => setActiveTab('settings')}
+ />
+ );
case 'history':
return <HistoryView />;
case 'settings':
@@ -297,18 +464,32 @@ export function App() {
}
};
+ // Determine if we're in the setup flow (auth, permissions, calendar setup, or recording prefs)
+ const isSetupFlow = !isAuthenticated ||
+ (activeTab === 'home' && (permissionsLoading || !allGranted || needsCalendarSetup || showRecordingPrefs));
+
return (
- <div className="flex flex-col h-screen bg-background">
- {/* Shared titlebar for macOS traffic lights */}
- <div className="h-12 flex items-center justify-center border-b bg-background/80 backdrop-blur-lg shrink-0 drag-region relative">
- {/* Space for traffic lights (absolute so title can center) */}
+ <div className="flex flex-col h-screen bg-white">
+ {/* Title bar - minimal for setup flow, hidden in main app (new design has no title bar) */}
+ <div
+ className={`flex items-center shrink-0 drag-region relative ${
+ isSetupFlow
+ ? 'h-[50px] bg-[#f8f8fa] border-b border-black/10'
+ : 'h-[50px] bg-white border-b border-black/10'
+ }`}
+ >
+ {/* Space for traffic lights */}
<div className="absolute left-0 w-20 shrink-0" />
- <span className="text-sm font-medium text-muted-foreground">Meeting Copilot</span>
</div>
+ {/* Calendar Auth Banner (shows when calendar needs reconnection) */}
+ {isAuthenticated && !isSetupFlow && <CalendarAuthBanner />}
+
{/* Main layout below titlebar */}
<div className="flex flex-1 overflow-hidden">
- {isAuthenticated && <Sidebar activeTab={activeTab} onTabChange={setActiveTab} />}
+ {isAuthenticated && !isSetupFlow && (
+ <NewSidebar activeTab={activeTab} onTabChange={setActiveTab} />
+ )}
<div className="flex-1 overflow-hidden">{renderContent()}</div>
</div>
diff --git a/src/renderer/components/auth/AuthView.tsx b/src/renderer/components/auth/AuthView.tsx
index f00bf62..8ea780d 100644
--- a/src/renderer/components/auth/AuthView.tsx
+++ b/src/renderer/components/auth/AuthView.tsx
@@ -1,17 +1,52 @@
/**
* AuthView Component
*
- * Inline authentication view (not a modal) for initial setup.
- * Displays as a centered card similar to PermissionsView.
+ * Welcome screen for initial setup matching the Figma design.
+ * Full-screen centered layout with step indicators.
*/
import React, { useState } from 'react';
-import { Key, User } from 'lucide-react';
-import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../ui/card';
-import { Button } from '../ui/button';
-import { Input } from '../ui/input';
+import { Loader2, ChevronRight } from 'lucide-react';
import { useConfigStore } from '../../stores/config.store';
import { trpc } from '../../api/trpc';
+import { getElectronAPI } from '../../api/ipc';
+
+// Logo SVG component
+function LogoIcon() {
+ return (
+ <svg
+ width="50"
+ height="50"
+ viewBox="0 0 50 50"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <rect width="50" height="50" rx="12" fill="#EC5B16" />
+ </svg>
+ );
+}
+
+// Step indicators component - exported for use in other setup views
+export function StepIndicators({ currentStep, totalSteps = 3 }: { currentStep: number; totalSteps?: number }) {
+ return (
+ <div className="flex gap-[6px] items-center justify-center">
+ {Array.from({ length: totalSteps }).map((_, step) => {
+ let className = 'rounded-[3px] ';
+ if (step === currentStep) {
+ // Current step - active (wide orange bar)
+ className += 'w-[24px] h-[6px] bg-[#ec5b16]';
+ } else if (step < currentStep) {
+ // Completed step - dimmed orange dot
+ className += 'w-[6px] h-[6px] bg-[#ec5b16]/40';
+ } else {
+ // Future step - gray dot
+ className += 'w-[6px] h-[6px] bg-[#e0e0e8]';
+ }
+ return <div key={step} className={className} />;
+ })}
+ </div>
+ );
+}
export function AuthView() {
const [name, setName] = useState('');
@@ -48,76 +83,120 @@ export function AuthView() {
}
};
+ const handleGetApiKey = () => {
+ const api = getElectronAPI();
+ if (api) {
+ api.app.openExternalLink('https://console.videodb.io');
+ }
+ };
+
+ const isSubmitting = registerMutation.isPending;
+ const canSubmit = name.trim().length > 0 && apiKey.trim().length > 0 && !isSubmitting;
+
return (
- <div className="max-w-md mx-auto mt-20">
- <Card>
- <CardHeader>
- <div className="flex items-center gap-2">
- <Key className="h-5 w-5 text-primary" />
- <CardTitle>Welcome to Meeting Copilot</CardTitle>
+ <div className="h-full w-full bg-[#f8f8fa] flex flex-col items-center justify-center relative overflow-hidden">
+ {/* Orange gradient glow */}
+ <div
+ className="absolute top-[-30%] left-1/2 -translate-x-1/2 w-[600px] h-[567px] rounded-[300px] pointer-events-none"
+ style={{
+ background:
+ 'radial-gradient(circle at center, rgba(236,91,22,0.08) 0%, rgba(236,91,22,0) 70%)',
+ }}
+ />
+
+ {/* Step indicators */}
+ <div className="absolute top-[32px]">
+ <StepIndicators currentStep={0} />
+ </div>
+
+ {/* Main content */}
+ <div className="flex flex-col items-center w-full max-w-[380px] px-6 relative z-10">
+ {/* Logo and heading */}
+ <div className="flex flex-col items-center gap-[16px] mb-[32px]">
+ <LogoIcon />
+ <div className="flex flex-col items-center gap-[8px]">
+ <h1 className="text-[22px] font-semibold text-black text-center tracking-[-0.44px] leading-[33px]">
+ Welcome to Meeting Copilot
+ </h1>
+ <p className="text-[14px] font-normal text-[#464646] text-center leading-[21px]">
+ Record, transcribe, and get AI insights from every meeting.
+ </p>
</div>
- <CardDescription>
- Enter your details to get started. You can get a VideoDB API key at{' '}
- <a
- href="https://console.videodb.io"
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary hover:underline"
- >
- console.videodb.io
- </a>
- </CardDescription>
- </CardHeader>
- <CardContent>
- <form onSubmit={handleSubmit} className="space-y-4">
- <div className="space-y-2">
- <label htmlFor="name" className="text-sm font-medium flex items-center gap-2">
- <User className="h-4 w-4 text-muted-foreground" />
- Your Name
- </label>
- <Input
- id="name"
- type="text"
- placeholder="John Doe"
- value={name}
- onChange={(e) => setName(e.target.value)}
- autoFocus
- />
- </div>
+ </div>
- <div className="space-y-2">
- <label htmlFor="apiKey" className="text-sm font-medium flex items-center gap-2">
- <Key className="h-4 w-4 text-muted-foreground" />
- VideoDB API Key
- </label>
- <Input
- id="apiKey"
- type="password"
- placeholder="sk-..."
- value={apiKey}
- onChange={(e) => setApiKey(e.target.value)}
- />
- <p className="text-xs text-muted-foreground">
- Your API key is stored locally and never shared.
- </p>
- </div>
+ {/* Form */}
+ <form onSubmit={handleSubmit} className="w-full flex flex-col gap-[16px]">
+ {/* Name field */}
+ <div className="flex flex-col gap-[6px]">
+ <label className="text-[13px] font-medium text-[#464646] tracking-[0.26px] leading-[19.5px]">
+ Your name
+ </label>
+ <input
+ type="text"
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ placeholder="Enter your name"
+ className="w-full bg-[#efefef] border border-[#e0e0e8] rounded-[10px] px-[15px] py-[14px] text-[14px] text-black placeholder:text-[#969696] tracking-[0.14px] outline-none focus:border-[#c0c0c0] transition-colors"
+ autoFocus
+ />
+ </div>
- {error && (
- <div className="p-3 bg-destructive/10 border border-destructive/20 rounded-lg">
- <p className="text-sm text-destructive">{error}</p>
- </div>
- )}
+ {/* API Key field */}
+ <div className="flex flex-col gap-[6px]">
+ <label className="text-[13px] font-medium text-[#464646] tracking-[0.26px] leading-[19.5px]">
+ VideoDB API Key
+ </label>
+ <input
+ type="password"
+ value={apiKey}
+ onChange={(e) => setApiKey(e.target.value)}
+ placeholder="sk-xxxxxxxxxxxxxxxx"
+ className="w-full bg-[#efefef] border border-[#e0e0e8] rounded-[10px] px-[15px] py-[14px] text-[14px] text-black placeholder:text-[#969696] tracking-[0.14px] outline-none focus:border-[#c0c0c0] transition-colors font-mono"
+ />
+ </div>
+
+ {/* Error message */}
+ {error && (
+ <div className="p-3 bg-red-50 border border-red-200 rounded-[10px]">
+ <p className="text-[13px] text-red-600">{error}</p>
+ </div>
+ )}
- <Button
+ {/* Buttons */}
+ <div className="flex flex-col gap-[10px] mt-[16px]">
+ {/* Continue button */}
+ <button
type="submit"
- className="w-full"
- disabled={registerMutation.isPending || !name.trim() || !apiKey.trim()}
+ disabled={!canSubmit}
+ className="w-full bg-[#ff4000] hover:bg-[#e63900] disabled:bg-[#ffb399] disabled:cursor-not-allowed rounded-[12px] px-[24px] py-[12px] text-[14px] font-medium text-white text-center tracking-[0.14px] leading-[21px] transition-colors flex items-center justify-center"
>
- {registerMutation.isPending ? 'Connecting...' : 'Get Started'}
- </Button>
- </form>
- </CardContent>
- </Card>
+ {isSubmitting ? (
+ <>
+ <Loader2 className="w-4 h-4 mr-2 animate-spin" />
+ Connecting...
+ </>
+ ) : (
+ 'Continue'
+ )}
+ </button>
+
+ {/* Get API key link */}
+ <button
+ type="button"
+ onClick={handleGetApiKey}
+ className="w-full flex items-center justify-center gap-[4px] px-[16px] py-[12px] rounded-[10px] hover:bg-black/5 transition-colors"
+ >
+ <span className="text-[13px] font-medium text-[#464646] tracking-[0.13px] leading-[19.5px]">
+ Don't have an API key?
+ </span>
+ <span className="text-[13px] font-medium text-[#ec5b16] tracking-[0.13px] leading-[19.5px]">
+ Get one
+ </span>
+ <ChevronRight className="w-[14px] h-[14px] text-[#ec5b16]" />
+ </button>
+ </div>
+ </form>
+ </div>
</div>
);
}
diff --git a/src/renderer/components/auth/CalendarSetupView.tsx b/src/renderer/components/auth/CalendarSetupView.tsx
new file mode 100644
index 0000000..972a3df
--- /dev/null
+++ b/src/renderer/components/auth/CalendarSetupView.tsx
@@ -0,0 +1,219 @@
+/**
+ * CalendarSetupView Component
+ *
+ * Step 3 of onboarding - connect Google Calendar.
+ * Matches the Figma design with feature list and connect button.
+ */
+
+import React, { useState } from 'react';
+import { Loader2, Check } from 'lucide-react';
+import { StepIndicators } from './AuthView';
+import { useConfigStore } from '../../stores/config.store';
+
+// Calendar icon component
+function CalendarIcon() {
+ return (
+ <div className="w-[72px] h-[72px] rounded-[20px] bg-[rgba(255,64,0,0.1)] border border-[rgba(236,91,22,0.13)] flex items-center justify-center">
+ <svg
+ width="36"
+ height="36"
+ viewBox="0 0 36 36"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <rect x="4" y="8" width="28" height="24" rx="4" stroke="#EC5B16" strokeWidth="2" />
+ <path d="M4 14H32" stroke="#EC5B16" strokeWidth="2" />
+ <path d="M12 4V10" stroke="#EC5B16" strokeWidth="2" strokeLinecap="round" />
+ <path d="M24 4V10" stroke="#EC5B16" strokeWidth="2" strokeLinecap="round" />
+ <rect x="10" y="18" width="4" height="4" rx="1" fill="#EC5B16" />
+ <rect x="16" y="18" width="4" height="4" rx="1" fill="#EC5B16" />
+ <rect x="22" y="18" width="4" height="4" rx="1" fill="#EC5B16" />
+ <rect x="10" y="24" width="4" height="4" rx="1" fill="#EC5B16" />
+ <rect x="16" y="24" width="4" height="4" rx="1" fill="#EC5B16" />
+ </svg>
+ </div>
+ );
+}
+
+// Google logo component
+function GoogleLogo() {
+ return (
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M17.64 9.20454C17.64 8.56636 17.5827 7.95272 17.4764 7.36363H9V10.845H13.8436C13.635 11.97 13.0009 12.9232 12.0477 13.5614V15.8195H14.9564C16.6582 14.2527 17.64 11.9454 17.64 9.20454Z"
+ fill="#4285F4"
+ />
+ <path
+ d="M9 18C11.43 18 13.4673 17.1941 14.9564 15.8195L12.0477 13.5614C11.2418 14.1014 10.2109 14.4204 9 14.4204C6.65591 14.4204 4.67182 12.8373 3.96409 10.71H0.957275V13.0418C2.43818 15.9832 5.48182 18 9 18Z"
+ fill="#34A853"
+ />
+ <path
+ d="M3.96409 10.71C3.78409 10.17 3.68182 9.59318 3.68182 9C3.68182 8.40682 3.78409 7.83 3.96409 7.29V4.95818H0.957275C0.347727 6.17318 0 7.54773 0 9C0 10.4523 0.347727 11.8268 0.957275 13.0418L3.96409 10.71Z"
+ fill="#FBBC05"
+ />
+ <path
+ d="M9 3.57955C10.3214 3.57955 11.5077 4.03364 12.4405 4.92545L15.0218 2.34409C13.4632 0.891818 11.4259 0 9 0C5.48182 0 2.43818 2.01682 0.957275 4.95818L3.96409 7.29C4.67182 5.16273 6.65591 3.57955 9 3.57955Z"
+ fill="#EA4335"
+ />
+ </svg>
+ );
+}
+
+// Checkmark icon
+function CheckIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M13.3337 4L6.00033 11.3333L2.66699 8"
+ stroke="#22C55E"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+interface CalendarSetupViewProps {
+ onConnected: () => void;
+ onSkip: () => void;
+}
+
+export function CalendarSetupView({ onConnected, onSkip }: CalendarSetupViewProps) {
+ const [isConnecting, setIsConnecting] = useState(false);
+ const [isConnected, setIsConnected] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const configStore = useConfigStore();
+
+ const handleConnect = async () => {
+ setIsConnecting(true);
+ setError(null);
+
+ try {
+ const result = await window.electronAPI.calendar.signIn();
+ if (result.success) {
+ setIsConnected(true);
+ // Small delay to show success state before moving on
+ setTimeout(() => {
+ onConnected();
+ }, 1000);
+ } else {
+ setError(result.error || 'Failed to connect');
+ setIsConnecting(false);
+ }
+ } catch (err) {
+ setError('Connection failed. Please try again.');
+ setIsConnecting(false);
+ }
+ };
+
+ const handleSkip = () => {
+ configStore.completeOnboarding();
+ onSkip();
+ };
+
+ const features = [
+ 'Auto-detect meetings from your calendar',
+ 'Get notified before each meeting starts',
+ 'Choose which meetings to record',
+ ];
+
+ return (
+ <div className="h-full w-full bg-[#f8f8fa] flex flex-col items-center justify-center relative overflow-hidden">
+ {/* Orange gradient glow */}
+ <div
+ className="absolute top-[-30%] left-1/2 -translate-x-1/2 w-[600px] h-[567px] rounded-[300px] pointer-events-none"
+ style={{
+ background:
+ 'radial-gradient(circle at center, rgba(236,91,22,0.08) 0%, rgba(236,91,22,0) 70%)',
+ }}
+ />
+
+ {/* Step indicators */}
+ <div className="absolute top-[32px]">
+ <StepIndicators currentStep={2} />
+ </div>
+
+ {/* Main content */}
+ <div className="flex flex-col items-center w-full max-w-[380px] px-6 relative z-10">
+ {/* Icon and heading */}
+ <div className="flex flex-col items-center gap-[20px] mb-[32px]">
+ <CalendarIcon />
+ <div className="flex flex-col items-center gap-[9px] max-w-[320px]">
+ <h1 className="text-[22px] font-semibold text-black text-center tracking-[-0.44px] leading-[33px]">
+ Connect your calendar
+ </h1>
+ <p className="text-[14px] font-normal text-[#464646] text-center leading-[22.4px]">
+ Meeting Copilot uses your Google Calendar to detect upcoming meetings and ask if you'd like to record them.
+ </p>
+ </div>
+ </div>
+
+ {/* Features card */}
+ <div className="w-full bg-white border border-[#e0e0e8] rounded-[12px] shadow-[0px_1px_4px_0px_rgba(0,0,0,0.04)] px-[21px] py-[17px] mb-[32px]">
+ <div className="flex flex-col gap-[12px]">
+ {features.map((feature, index) => (
+ <div key={index} className="flex items-center gap-[10px]">
+ <CheckIcon />
+ <span className="text-[13px] text-[#464646] leading-[19.5px]">{feature}</span>
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Error message */}
+ {error && (
+ <div className="w-full p-3 bg-red-50 border border-red-200 rounded-[10px] mb-[16px]">
+ <p className="text-[13px] text-red-600">{error}</p>
+ </div>
+ )}
+
+ {/* Buttons */}
+ <div className="w-full flex flex-col gap-[10px]">
+ {/* Connect button */}
+ <button
+ onClick={handleConnect}
+ disabled={isConnecting || isConnected}
+ className="w-full bg-white border border-[#d0d0d8] hover:bg-gray-50 disabled:opacity-60 disabled:cursor-not-allowed rounded-[12px] px-[25px] py-[13px] shadow-[0px_1px_3px_0px_rgba(0,0,0,0.06)] flex items-center justify-center gap-[8px] transition-colors"
+ >
+ {isConnecting ? (
+ <>
+ <Loader2 className="w-[18px] h-[18px] text-[#464646] animate-spin" />
+ <span className="text-[14px] font-medium text-black tracking-[0.14px] leading-[21px]">
+ Connecting...
+ </span>
+ </>
+ ) : isConnected ? (
+ <>
+ <Check className="w-[18px] h-[18px] text-green-500" />
+ <span className="text-[14px] font-medium text-green-600 tracking-[0.14px] leading-[21px]">
+ Connected!
+ </span>
+ </>
+ ) : (
+ <>
+ <GoogleLogo />
+ <span className="text-[14px] font-medium text-black tracking-[0.14px] leading-[21px]">
+ Connect Google Calendar
+ </span>
+ </>
+ )}
+ </button>
+
+ {/* Skip button */}
+ <button
+ onClick={handleSkip}
+ disabled={isConnecting || isConnected}
+ className="w-full flex items-center justify-center px-[16px] py-[12px] rounded-[10px] hover:bg-black/5 transition-colors disabled:opacity-50"
+ >
+ <span className="text-[13px] font-medium text-[#464646] tracking-[0.13px] leading-[19.5px]">
+ I'll do it later
+ </span>
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export default CalendarSetupView;
diff --git a/src/renderer/components/auth/RecordingPreferencesView.tsx b/src/renderer/components/auth/RecordingPreferencesView.tsx
new file mode 100644
index 0000000..eb50437
--- /dev/null
+++ b/src/renderer/components/auth/RecordingPreferencesView.tsx
@@ -0,0 +1,213 @@
+/**
+ * RecordingPreferencesView Component
+ *
+ * Step 3 of onboarding - configure recording preferences.
+ * Allows users to set notification timing and default recording behavior.
+ */
+
+import React, { useState } from 'react';
+import { Loader2 } from 'lucide-react';
+import { StepIndicators } from './AuthView';
+import { trpc } from '../../api/trpc';
+
+type RecordingBehavior = 'always_ask' | 'default_record' | 'no_notification';
+
+// Bell/notification icon
+function NotifyIcon() {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M15 6.667a5 5 0 10-10 0c0 5.833-2.5 7.5-2.5 7.5h15s-2.5-1.667-2.5-7.5z"
+ stroke="#464646"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path
+ d="M11.442 17.5a1.667 1.667 0 01-2.884 0"
+ stroke="#464646"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+// Recording/radio icon
+function RecordIcon() {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="10" cy="10" r="7.5" stroke="#ec5b16" strokeWidth="1.5" />
+ <circle cx="10" cy="10" r="3" fill="#ec5b16" />
+ </svg>
+ );
+}
+
+interface RecordingPreferencesViewProps {
+ onComplete: () => void;
+}
+
+export function RecordingPreferencesView({ onComplete }: RecordingPreferencesViewProps) {
+ const [notifyMinutes, setNotifyMinutes] = useState<number>(2);
+ const [recordingBehavior, setRecordingBehavior] = useState<RecordingBehavior>('always_ask');
+ const [isSaving, setIsSaving] = useState(false);
+
+ const updatePreferences = trpc.settings.updateCalendarPreferences.useMutation();
+
+ const handleContinue = async () => {
+ setIsSaving(true);
+ try {
+ await updatePreferences.mutateAsync({
+ notifyMinutesBefore: notifyMinutes,
+ recordingBehavior,
+ });
+ onComplete();
+ } catch (err) {
+ console.error('Failed to save preferences:', err);
+ // Still proceed even if save fails - user can change in settings later
+ onComplete();
+ }
+ };
+
+ const notifyOptions = [
+ { value: 1, label: '1 min' },
+ { value: 2, label: '2 mins' },
+ { value: 5, label: '5 mins' },
+ ];
+
+ const behaviorOptions: { value: RecordingBehavior; title: string; description: string }[] = [
+ {
+ value: 'always_ask',
+ title: 'Ask me every time',
+ description: "You'll get a notification to confirm before each meeting",
+ },
+ {
+ value: 'default_record',
+ title: 'Record all meetings',
+ description: 'Automatically join and record every calendar event',
+ },
+ {
+ value: 'no_notification',
+ title: "Don't record unless I say so",
+ description: 'Only records when you manually start a session',
+ },
+ ];
+
+ return (
+ <div className="h-full w-full bg-[#f8f8fa] flex flex-col items-center justify-center relative overflow-hidden">
+ {/* Orange gradient glow */}
+ <div
+ className="absolute top-[-30%] left-1/2 -translate-x-1/2 w-[600px] h-[567px] rounded-[300px] pointer-events-none"
+ style={{
+ background:
+ 'radial-gradient(circle at center, rgba(236,91,22,0.08) 0%, rgba(236,91,22,0) 70%)',
+ }}
+ />
+
+ {/* Step indicators */}
+ <div className="absolute top-[32px]">
+ <StepIndicators currentStep={2} />
+ </div>
+
+ {/* Main content */}
+ <div className="flex flex-col items-center w-full max-w-[400px] px-6 relative z-10">
+ {/* Heading */}
+ <div className="flex flex-col items-center gap-[8px] mb-[28px] max-w-[405px]">
+ <h1 className="text-[22px] font-semibold text-black text-center tracking-[-0.44px] leading-[33px]">
+ Recording preferences
+ </h1>
+ <p className="text-[14px] font-normal text-[#464646] text-center leading-[21px]">
+ Set how you'd like to be notified and when to record. You can change these later in Settings.
+ </p>
+ </div>
+
+ {/* Notify before meetings section */}
+ <div className="w-full flex flex-col gap-[10px] mb-[28px]">
+ <div className="flex items-center gap-[8px]">
+ <NotifyIcon />
+ <span className="text-[14px] font-medium text-black leading-[21px]">
+ Notify me before meetings
+ </span>
+ </div>
+ <div className="flex gap-[8px] w-full">
+ {notifyOptions.map((option) => (
+ <button
+ key={option.value}
+ onClick={() => setNotifyMinutes(option.value)}
+ className={`flex-1 py-[11px] rounded-[8px] text-[13px] font-medium leading-[19.5px] transition-colors ${
+ notifyMinutes === option.value
+ ? 'bg-[rgba(236,91,22,0.05)] border border-[#ec5b16] text-[#ec5b16]'
+ : 'border border-[rgba(150,150,150,0.3)] text-[#464646] hover:bg-gray-50'
+ }`}
+ >
+ {option.label}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* Default recording behavior section */}
+ <div className="w-full flex flex-col gap-[10px] mb-[28px]">
+ <div className="flex items-center gap-[8px]">
+ <RecordIcon />
+ <span className="text-[14px] font-medium text-[#1a1a24] leading-[21px]">
+ Default recording behavior
+ </span>
+ </div>
+ <div className="flex flex-col gap-[8px]">
+ {behaviorOptions.map((option) => (
+ <button
+ key={option.value}
+ onClick={() => setRecordingBehavior(option.value)}
+ className={`w-full flex items-center gap-[12px] px-[17px] py-[15px] rounded-[10px] text-left transition-colors ${
+ recordingBehavior === option.value
+ ? 'bg-[rgba(236,91,22,0.05)] border border-[#ec5b16]'
+ : 'border border-[#e0e0e8] hover:bg-gray-50'
+ }`}
+ >
+ <div className="flex-1 flex flex-col gap-[2px]">
+ <span className="text-[14px] font-medium text-black leading-[21px]">
+ {option.title}
+ </span>
+ <span className="text-[12px] font-normal text-[#464646] leading-[18px]">
+ {option.description}
+ </span>
+ </div>
+ {/* Radio indicator */}
+ <div
+ className={`w-[18px] h-[18px] rounded-[9px] border-2 flex items-center justify-center ${
+ recordingBehavior === option.value
+ ? 'border-[#ec5b16]'
+ : 'border-[#e0e0e8]'
+ }`}
+ >
+ {recordingBehavior === option.value && (
+ <div className="w-[8px] h-[8px] rounded-[4px] bg-[#ec5b16]" />
+ )}
+ </div>
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* Continue button */}
+ <button
+ onClick={handleContinue}
+ disabled={isSaving}
+ className="w-full bg-[#ff4000] hover:bg-[#e63900] disabled:opacity-60 disabled:cursor-not-allowed rounded-[12px] px-[24px] py-[12px] flex items-center justify-center transition-colors"
+ >
+ {isSaving ? (
+ <Loader2 className="w-[20px] h-[20px] text-white animate-spin" />
+ ) : (
+ <span className="text-[14px] font-medium text-white tracking-[0.14px] leading-[21px]">
+ Continue
+ </span>
+ )}
+ </button>
+ </div>
+ </div>
+ );
+}
+
+export default RecordingPreferencesView;
diff --git a/src/renderer/components/calendar/CalendarAuthBanner.tsx b/src/renderer/components/calendar/CalendarAuthBanner.tsx
new file mode 100644
index 0000000..6d67c40
--- /dev/null
+++ b/src/renderer/components/calendar/CalendarAuthBanner.tsx
@@ -0,0 +1,86 @@
+/**
+ * Calendar Auth Banner Component
+ *
+ * Shows a banner when Google Calendar authentication is required.
+ */
+
+import React, { useState, useEffect } from 'react';
+import { Button } from '../ui/button';
+import { AlertCircle, X, RefreshCw, Loader2 } from 'lucide-react';
+
+export function CalendarAuthBanner() {
+ const [isVisible, setIsVisible] = useState(false);
+ const [isReconnecting, setIsReconnecting] = useState(false);
+
+ useEffect(() => {
+ // Listen for auth required events
+ const unsubscribe = window.electronAPI.calendarOn.onAuthRequired(() => {
+ setIsVisible(true);
+ });
+
+ return () => {
+ unsubscribe();
+ };
+ }, []);
+
+ const handleReconnect = async () => {
+ setIsReconnecting(true);
+ try {
+ const result = await window.electronAPI.calendar.signIn();
+ if (result.success) {
+ setIsVisible(false);
+ }
+ } catch (err) {
+ // Keep banner visible on error
+ } finally {
+ setIsReconnecting(false);
+ }
+ };
+
+ const handleDismiss = () => {
+ setIsVisible(false);
+ };
+
+ if (!isVisible) {
+ return null;
+ }
+
+ return (
+ <div className="bg-amber-50 dark:bg-amber-950/50 border-b border-amber-200 dark:border-amber-800 px-4 py-2">
+ <div className="flex items-center justify-between max-w-screen-xl mx-auto">
+ <div className="flex items-center gap-3">
+ <AlertCircle className="h-4 w-4 text-amber-600 dark:text-amber-400 shrink-0" />
+ <p className="text-sm text-amber-800 dark:text-amber-200">
+ Google Calendar disconnected. Reconnect to continue receiving meeting notifications.
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleReconnect}
+ disabled={isReconnecting}
+ className="bg-white dark:bg-slate-800 border-amber-300 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/50"
+ >
+ {isReconnecting ? (
+ <Loader2 className="h-3 w-3 mr-1 animate-spin" />
+ ) : (
+ <RefreshCw className="h-3 w-3 mr-1" />
+ )}
+ Reconnect
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={handleDismiss}
+ className="h-7 w-7 hover:bg-amber-100 dark:hover:bg-amber-900/50"
+ >
+ <X className="h-4 w-4 text-amber-600 dark:text-amber-400" />
+ </Button>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export default CalendarAuthBanner;
diff --git a/src/renderer/components/calendar/index.ts b/src/renderer/components/calendar/index.ts
new file mode 100644
index 0000000..d502463
--- /dev/null
+++ b/src/renderer/components/calendar/index.ts
@@ -0,0 +1 @@
+export { CalendarAuthBanner } from './CalendarAuthBanner';
diff --git a/src/renderer/components/home/HomeView.tsx b/src/renderer/components/home/HomeView.tsx
new file mode 100644
index 0000000..62b0599
--- /dev/null
+++ b/src/renderer/components/home/HomeView.tsx
@@ -0,0 +1,680 @@
+/**
+ * HomeView Component
+ *
+ * New home page design with:
+ * - App permissions section with toggles
+ * - Start Recording button
+ * - Recent meetings
+ * - Today's calendar events
+ * - Connected MCP servers
+ */
+
+import React, { useState, useEffect, useMemo } from 'react';
+import { Calendar, Clock, Loader2, ChevronRight } from 'lucide-react';
+import { trpc } from '../../api/trpc';
+import { usePermissions } from '../../hooks/usePermissions';
+import { useMCP } from '../../hooks/useMCP';
+import { useSession } from '../../hooks/useSession';
+import { useSessionStore } from '../../stores/session.store';
+import { RecordingCard } from '../history/RecordingCard';
+import { RecordingDetailPage } from '../history/RecordingDetailPage';
+import type { UpcomingMeeting } from '../../../shared/types/calendar.types';
+import type { MCPServerConfig } from '../../../preload/index';
+
+// Icons
+function SpeakerIcon({ enabled }: { enabled: boolean }) {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M10 3.333L5.833 6.667H2.5v6.666h3.333L10 16.667V3.333z"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ fill={enabled ? 'rgba(236,91,22,0.2)' : 'none'}
+ />
+ <path
+ d="M14.167 7.5a4.167 4.167 0 010 5M16.667 5a7.5 7.5 0 010 10"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+function MicIcon({ enabled }: { enabled: boolean }) {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect
+ x="7.5"
+ y="2.5"
+ width="5"
+ height="10"
+ rx="2.5"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ fill={enabled ? 'rgba(236,91,22,0.2)' : 'none'}
+ />
+ <path
+ d="M15 8.333v1.667a5 5 0 01-10 0V8.333M10 15v2.5M7.5 17.5h5"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+function ScreenIcon({ enabled }: { enabled: boolean }) {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect
+ x="2.5"
+ y="3.333"
+ width="15"
+ height="10"
+ rx="1.5"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ fill={enabled ? 'rgba(236,91,22,0.2)' : 'none'}
+ />
+ <path
+ d="M6.667 16.667h6.666"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ />
+ <path
+ d="M10 13.333v3.334"
+ stroke={enabled ? '#ec5b16' : '#464646'}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ />
+ </svg>
+ );
+}
+
+function CalendarIcon() {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect x="2.5" y="4.167" width="15" height="13.333" rx="2" stroke="black" strokeWidth="1.5" />
+ <path d="M2.5 8.333h15" stroke="black" strokeWidth="1.5" />
+ <path d="M6.667 2.5v3.333M13.333 2.5v3.333" stroke="black" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function ClockIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="8" cy="8" r="6" stroke="#969696" strokeWidth="1.25" />
+ <path d="M8 4.5v4l2.5 1.5" stroke="#969696" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round" />
+ </svg>
+ );
+}
+
+function MCPIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="8" cy="8" r="3" stroke="black" strokeWidth="1.25" />
+ <path d="M8 2v2M8 12v2M2 8h2M12 8h2" stroke="black" strokeWidth="1.25" strokeLinecap="round" />
+ <path d="M3.76 3.76l1.41 1.41M10.83 10.83l1.41 1.41M3.76 12.24l1.41-1.41M10.83 5.17l1.41-1.41" stroke="black" strokeWidth="1.25" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function RecordingIcon() {
+ return (
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="10" cy="10" r="4" fill="white" />
+ <circle cx="10" cy="10" r="7" stroke="white" strokeWidth="1.5" />
+ </svg>
+ );
+}
+
+function EmptyRecordingsIcon() {
+ return (
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect x="4" y="6" width="24" height="20" rx="2" stroke="#969696" strokeWidth="1.5" />
+ <path d="M4 12h24" stroke="#969696" strokeWidth="1.5" />
+ <rect x="8" y="16" width="6" height="6" rx="1" stroke="#969696" strokeWidth="1.5" />
+ <path d="M18 17h6M18 21h4" stroke="#969696" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function EmptyCalendarIcon() {
+ return (
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect x="4" y="6.5" width="24" height="21" rx="2" stroke="#969696" strokeWidth="1.5" />
+ <path d="M4 12.5h24" stroke="#969696" strokeWidth="1.5" />
+ <path d="M10 3.5v5M22 3.5v5" stroke="#969696" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function EmptyMCPIcon() {
+ return (
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="16" cy="16" r="5" stroke="#969696" strokeWidth="1.5" />
+ <path d="M16 4v4M16 24v4M4 16h4M24 16h4" stroke="#969696" strokeWidth="1.5" strokeLinecap="round" />
+ <path d="M7.5 7.5l2.83 2.83M21.67 21.67l2.83 2.83M7.5 24.5l2.83-2.83M21.67 10.33l2.83-2.83" stroke="#969696" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
+
+function GoogleIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M15.68 8.182c0-.567-.05-1.113-.145-1.636H8v3.094h4.305a3.68 3.68 0 01-1.597 2.415v2.007h2.585c1.513-1.393 2.387-3.444 2.387-5.88z" fill="#4285F4" />
+ <path d="M8 16c2.16 0 3.97-.716 5.293-1.938l-2.585-2.007c-.716.48-1.632.763-2.708.763-2.083 0-3.848-1.407-4.479-3.297H.855v2.073A7.997 7.997 0 008 16z" fill="#34A853" />
+ <path d="M3.521 9.521A4.813 4.813 0 013.27 8c0-.528.091-1.04.252-1.521V4.406H.855A7.997 7.997 0 000 8c0 1.29.309 2.512.855 3.594l2.666-2.073z" fill="#FBBC05" />
+ <path d="M8 3.182c1.174 0 2.229.404 3.058.1197l2.292-2.292C11.967.794 10.157 0 8 0 4.872 0 2.167 1.793.855 4.406l2.666 2.073C4.152 4.589 5.917 3.182 8 3.182z" fill="#EA4335" />
+ </svg>
+ );
+}
+
+// Toggle Component
+function Toggle({
+ enabled,
+ onChange,
+ size = 'default',
+}: {
+ enabled: boolean;
+ onChange: (enabled: boolean) => void;
+ size?: 'default' | 'small';
+}) {
+ const width = size === 'small' ? 'w-[32px]' : 'w-[38px]';
+ const height = size === 'small' ? 'h-[18px]' : 'h-[22px]';
+ const knobSize = size === 'small' ? 'size-[14px]' : 'size-[18px]';
+ const knobOffset = size === 'small' ? (enabled ? 'left-[16px]' : 'left-[2px]') : (enabled ? 'left-[18px]' : 'left-[2px]');
+
+ return (
+ <button
+ onClick={() => onChange(!enabled)}
+ className={`${width} ${height} rounded-full relative transition-colors ${
+ enabled ? 'bg-[#ec5b16]' : 'bg-[#e4e4ec]'
+ }`}
+ >
+ <div
+ className={`absolute ${knobSize} bg-white rounded-full top-[2px] shadow-[0px_1px_3px_0px_rgba(0,0,0,0.15)] transition-all ${knobOffset}`}
+ />
+ </button>
+ );
+}
+
+// Permission Item Component
+function PermissionItem({
+ icon,
+ title,
+ description,
+ enabled,
+ onChange,
+ isFirst,
+ isLast,
+}: {
+ icon: React.ReactNode;
+ title: string;
+ description: string;
+ enabled: boolean;
+ onChange: (enabled: boolean) => void;
+ isFirst?: boolean;
+ isLast?: boolean;
+}) {
+ const bgColor = enabled ? 'bg-[#fff5ec]' : 'bg-[#f7f7f7]';
+ const borderRadius = isFirst
+ ? 'rounded-t-[10px]'
+ : isLast
+ ? 'rounded-b-[10px]'
+ : '';
+
+ return (
+ <div className={`flex items-center gap-[14px] px-[16px] py-[13px] ${bgColor} ${borderRadius}`}>
+ <div
+ className={`w-[36px] h-[36px] rounded-[10px] flex items-center justify-center ${
+ enabled
+ ? 'bg-[rgba(236,91,22,0.1)] border border-[rgba(236,91,22,0.13)]'
+ : 'bg-white border border-[#ededf3]'
+ }`}
+ >
+ {icon}
+ </div>
+ <div className="flex-1">
+ <p className="text-[14px] font-medium text-[#141420] leading-[20px]">{title}</p>
+ <p className="text-[13px] text-[rgba(70,70,70,0.6)] leading-[18px]">{description}</p>
+ </div>
+ <Toggle enabled={enabled} onChange={onChange} />
+ </div>
+ );
+}
+
+// Calendar Event Item Component
+function CalendarEventItem({
+ event,
+ notifyEnabled,
+ onToggleNotify,
+}: {
+ event: UpcomingMeeting;
+ notifyEnabled: boolean;
+ onToggleNotify: (enabled: boolean) => void;
+}) {
+ const formatTime = (date: Date | string) => {
+ const d = typeof date === 'string' ? new Date(date) : date;
+ return d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit', hour12: true }).toUpperCase();
+ };
+
+ return (
+ <div className="bg-white border border-[#ededf3] rounded-[10px] px-[15px] py-[13px]">
+ <div className="flex items-start">
+ <div className="flex-1 flex flex-col gap-[10px]">
+ <p className="text-[14px] font-medium text-black tracking-[0.07px] line-clamp-1">
+ {event.summary}
+ </p>
+ <div className="flex items-center gap-[12px]">
+ <div className="flex items-center gap-[4px] flex-1">
+ <ClockIcon />
+ <span className="text-[14px] text-[#464646] tracking-[0.07px]">
+ {formatTime(event.startTime)} - {formatTime(event.endTime)}
+ </span>
+ </div>
+ <Toggle enabled={notifyEnabled} onChange={onToggleNotify} size="small" />
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+// MCP Server Item Component
+function MCPServerItem({
+ server,
+}: {
+ server: MCPServerConfig;
+}) {
+ return (
+ <div className="bg-white border border-[#ededf3] rounded-[10px] px-[15px] py-[13px]">
+ <div className="flex items-center gap-[12px]">
+ <div className="w-[20px] h-[20px] flex items-center justify-center">
+ <MCPIcon />
+ </div>
+ <div className="flex-1 flex flex-col gap-[6px]">
+ <p className="text-[14px] font-medium text-black tracking-[0.07px]">{server.name}</p>
+ <p className="text-[13px] text-[#464646] tracking-[0.065px]">
+ {server.description || 'Sync meeting notes & summaries'}
+ </p>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+interface HomeViewProps {
+ onNavigateToHistory: () => void;
+ onNavigateToSettings: () => void;
+}
+
+export function HomeView({ onNavigateToHistory, onNavigateToSettings }: HomeViewProps) {
+ const [selectedRecordingId, setSelectedRecordingId] = useState<number | null>(null);
+ const [calendarStatus, setCalendarStatus] = useState<'disconnected' | 'connected' | 'loading'>('loading');
+ const [upcomingEvents, setUpcomingEvents] = useState<UpcomingMeeting[]>([]);
+ const [eventNotifications, setEventNotifications] = useState<Record<string, boolean>>({});
+ const [isStarting, setIsStarting] = useState(false);
+
+ // Session and recording state
+ const { startRecording } = useSession();
+ const sessionStore = useSessionStore();
+ const { streams, setStreams } = sessionStore;
+
+ const { servers, connectionStates } = useMCP();
+ const connectedServers = servers.filter(
+ (s) => s.isEnabled && connectionStates[s.id]?.status === 'connected'
+ );
+
+ // Handle start recording
+ const handleStartRecording = async () => {
+ if (isStarting) return;
+ setIsStarting(true);
+ try {
+ await startRecording();
+ } catch (error) {
+ console.error('Failed to start recording:', error);
+ } finally {
+ setIsStarting(false);
+ }
+ };
+
+ // Fetch recordings
+ const { data: recordings, isLoading: recordingsLoading } = trpc.recordings.list.useQuery(undefined, {
+ refetchInterval: 10000,
+ });
+
+ // Get recent recordings (latest 2)
+ const recentRecordings = useMemo(() => {
+ if (!recordings) return [];
+ return [...recordings]
+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
+ .slice(0, 2);
+ }, [recordings]);
+
+ // Check calendar status
+ useEffect(() => {
+ const checkCalendar = async () => {
+ try {
+ const result = await window.electronAPI.calendar.isSignedIn();
+ if (result.success && result.isSignedIn) {
+ setCalendarStatus('connected');
+ // Fetch today's events
+ const eventsResult = await window.electronAPI.calendar.getUpcomingEvents(24);
+ if (eventsResult.success && eventsResult.events) {
+ // Filter to only today's events
+ const today = new Date();
+ const todayEvents = eventsResult.events.filter((e) => {
+ const eventDate = new Date(e.startTime);
+ return (
+ eventDate.getDate() === today.getDate() &&
+ eventDate.getMonth() === today.getMonth() &&
+ eventDate.getFullYear() === today.getFullYear()
+ );
+ });
+ setUpcomingEvents(todayEvents);
+ // Initialize notifications as enabled for all events
+ const notifs: Record<string, boolean> = {};
+ todayEvents.forEach((e) => {
+ notifs[e.id] = true;
+ });
+ setEventNotifications(notifs);
+ }
+ } else {
+ setCalendarStatus('disconnected');
+ }
+ } catch {
+ setCalendarStatus('disconnected');
+ }
+ };
+ checkCalendar();
+
+ // Listen for event updates
+ const unsubscribe = window.electronAPI.calendarOn.onEventsUpdated((events) => {
+ const today = new Date();
+ const todayEvents = events.filter((e) => {
+ const eventDate = new Date(e.startTime);
+ return (
+ eventDate.getDate() === today.getDate() &&
+ eventDate.getMonth() === today.getMonth() &&
+ eventDate.getFullYear() === today.getFullYear()
+ );
+ });
+ setUpcomingEvents(todayEvents);
+ });
+
+ return () => unsubscribe();
+ }, []);
+
+ const handleConnectCalendar = async () => {
+ try {
+ const result = await window.electronAPI.calendar.signIn();
+ if (result.success) {
+ setCalendarStatus('connected');
+ const eventsResult = await window.electronAPI.calendar.getUpcomingEvents(24);
+ if (eventsResult.success && eventsResult.events) {
+ setUpcomingEvents(eventsResult.events);
+ }
+ }
+ } catch {
+ // Ignore errors
+ }
+ };
+
+ const handleDisconnectCalendar = async () => {
+ try {
+ await window.electronAPI.calendar.signOut();
+ setCalendarStatus('disconnected');
+ setUpcomingEvents([]);
+ } catch {
+ // Ignore errors
+ }
+ };
+
+ // If viewing a recording detail
+ if (selectedRecordingId !== null) {
+ return (
+ <RecordingDetailPage
+ recordingId={selectedRecordingId}
+ onBack={() => setSelectedRecordingId(null)}
+ />
+ );
+ }
+
+ return (
+ <div className="flex gap-[24px] h-full p-[24px] bg-white overflow-hidden">
+ {/* Left Column */}
+ <div className="flex-1 flex flex-col gap-[60px] overflow-y-auto">
+ {/* App Permissions Section */}
+ <div className="flex flex-col gap-[24px]">
+ {/* Header with Start Recording button */}
+ <div className="flex items-center justify-between">
+ <div className="flex flex-col gap-[4px]">
+ <h2 className="text-[18px] font-semibold text-[#141420] tracking-[-0.17px] leading-[25.5px]">
+ App permissions
+ </h2>
+ <p className="text-[13px] text-[#242424] leading-[18.75px]">
+ Grant access so the copilot can capture your meetings.
+ </p>
+ </div>
+ <button
+ onClick={handleStartRecording}
+ disabled={isStarting || (!streams.systemAudio && !streams.microphone)}
+ className="flex items-center gap-[4px] bg-[#ff4000] hover:bg-[#e63900] disabled:opacity-50 disabled:cursor-not-allowed px-[20px] py-[12px] rounded-[12px] shadow-[0px_1.272px_15.267px_0px_rgba(0,0,0,0.05)] transition-colors"
+ >
+ {isStarting ? (
+ <Loader2 className="w-[20px] h-[20px] text-white animate-spin" />
+ ) : (
+ <RecordingIcon />
+ )}
+ <span className="text-[14px] font-semibold text-white tracking-[-0.28px]">
+ {isStarting ? 'Starting...' : 'Start Recording'}
+ </span>
+ </button>
+ </div>
+
+ {/* Permission Toggles */}
+ <div className="flex flex-col rounded-[12px] overflow-hidden">
+ <PermissionItem
+ icon={<SpeakerIcon enabled={streams.systemAudio} />}
+ title="System audio"
+ description="Capture audio from meeting apps and browser tabs"
+ enabled={streams.systemAudio}
+ onChange={(enabled) => setStreams({ systemAudio: enabled })}
+ isFirst
+ />
+ <div className="h-[1px] bg-[#ededf3]" />
+ <PermissionItem
+ icon={<MicIcon enabled={streams.microphone} />}
+ title="Microphone"
+ description="Record your voice during meetings and calls"
+ enabled={streams.microphone}
+ onChange={(enabled) => setStreams({ microphone: enabled })}
+ />
+ <div className="h-[1px] bg-[#ededf3]" />
+ <PermissionItem
+ icon={<ScreenIcon enabled={streams.screen} />}
+ title="Screen capture"
+ description="Record your screen to capture visual context"
+ enabled={streams.screen}
+ onChange={(enabled) => setStreams({ screen: enabled })}
+ isLast
+ />
+ </div>
+ </div>
+
+ {/* Recent Meetings Section */}
+ <div className="flex flex-col gap-[14px]">
+ {/* Header */}
+ <div className="flex items-center justify-between">
+ <h2 className="text-[18px] font-semibold text-[#141420] tracking-[-0.17px] leading-[25.5px]">
+ Recent meetings
+ </h2>
+ {recordings && recordings.length > 0 && (
+ <button
+ onClick={onNavigateToHistory}
+ className="flex items-center gap-[4px] text-[14px] font-semibold text-[#ec5b16] hover:opacity-80 transition-opacity"
+ >
+ View All Recordings
+ <ChevronRight className="w-[12px] h-[12px]" />
+ </button>
+ )}
+ </div>
+
+ {/* Content */}
+ {recordingsLoading ? (
+ <div className="flex items-center justify-center py-[40px] bg-[#f7f7f7] border border-[rgba(0,0,0,0.1)] rounded-[16px]">
+ <Loader2 className="w-6 h-6 animate-spin text-[#969696]" />
+ </div>
+ ) : recentRecordings.length === 0 ? (
+ <div className="flex items-center justify-center py-[40px] bg-[#f7f7f7] border border-[rgba(0,0,0,0.1)] rounded-[16px]">
+ <div className="flex flex-col items-center gap-[10px] px-[8px] py-[14px]">
+ <EmptyRecordingsIcon />
+ <p className="text-[14px] text-[#141420] leading-[19.5px]">No recordings yet</p>
+ <p className="text-[12px] text-[#969696] text-center max-w-[264px] leading-normal">
+ Your recorded meetings will appear here with AI summaries, transcripts, and action items.
+ </p>
+ </div>
+ </div>
+ ) : (
+ <div className="flex gap-[20px]">
+ {recentRecordings.map((recording) => (
+ <div key={recording.id} className="flex-1">
+ <RecordingCard
+ recording={recording}
+ onClick={() => setSelectedRecordingId(recording.id)}
+ />
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+
+ {/* Right Panel */}
+ <div className="w-[460px] shrink-0 bg-[#f7f7f7] border border-[#efefef] rounded-[16px] p-[16px] flex flex-col gap-[16px] overflow-y-auto">
+ {/* Today Section */}
+ <div className="bg-white border border-[#efefef] rounded-[16px] p-[16px] flex flex-col gap-[20px]">
+ {/* Header */}
+ <div className="flex items-center gap-[4px]">
+ <CalendarIcon />
+ <span className="flex-1 text-[18px] font-medium text-black">Today</span>
+ {calendarStatus === 'connected' && (
+ <button
+ onClick={handleDisconnectCalendar}
+ className="flex items-center gap-[4px] text-[14px] font-medium text-[#ec5b16] hover:opacity-80"
+ >
+ <span className="text-[14px]">-</span>
+ Disconnect
+ </button>
+ )}
+ </div>
+
+ {/* Content */}
+ {calendarStatus === 'loading' ? (
+ <div className="flex items-center justify-center py-[32px]">
+ <Loader2 className="w-6 h-6 animate-spin text-[#969696]" />
+ </div>
+ ) : calendarStatus === 'disconnected' ? (
+ <div className="flex flex-col items-center gap-[16px] px-[8px] py-[16px]">
+ <EmptyCalendarIcon />
+ <div className="flex flex-col items-center gap-[8px]">
+ <p className="text-[16px] font-medium text-black text-center leading-[20px]">
+ Connect your calendar
+ </p>
+ <p className="text-[13px] text-[#969696] text-center leading-[19px]">
+ See upcoming meetings and choose which ones to record.
+ </p>
+ </div>
+ <button
+ onClick={handleConnectCalendar}
+ className="flex items-center gap-[6px] bg-white border border-[#e4e4ec] px-[16px] py-[12px] rounded-[12px] shadow-[0px_1.272px_15.267px_0px_rgba(0,0,0,0.05)] hover:bg-gray-50 transition-colors"
+ >
+ <GoogleIcon />
+ <span className="text-[14px] font-medium text-black">Connect Google Calendar</span>
+ </button>
+ </div>
+ ) : upcomingEvents.length === 0 ? (
+ <div className="flex flex-col items-center gap-[16px] px-[8px] py-[16px]">
+ <EmptyCalendarIcon />
+ <div className="flex flex-col items-center gap-[8px]">
+ <p className="text-[16px] font-medium text-black text-center leading-[20px]">
+ No meeting today
+ </p>
+ <p className="text-[13px] text-[#969696] text-center leading-[19px]">
+ Enjoy your free day — or start an ad-hoc recording.
+ </p>
+ </div>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-[10px]">
+ {upcomingEvents.map((event) => (
+ <CalendarEventItem
+ key={event.id}
+ event={event}
+ notifyEnabled={eventNotifications[event.id] ?? true}
+ onToggleNotify={(enabled) =>
+ setEventNotifications((prev) => ({ ...prev, [event.id]: enabled }))
+ }
+ />
+ ))}
+ </div>
+ )}
+ </div>
+
+ {/* MCPs Section */}
+ <div className="bg-white border border-[#efefef] rounded-[16px] p-[16px] flex flex-col gap-[20px]">
+ {/* Header */}
+ <div className="flex items-center gap-[4px]">
+ <MCPIcon />
+ <span className="flex-1 text-[18px] font-medium text-black">MCPs</span>
+ <button
+ onClick={onNavigateToSettings}
+ className="flex items-center gap-[4px] text-[14px] font-medium text-[#ec5b16] hover:opacity-80"
+ >
+ <span className="text-[14px]">+</span>
+ Add
+ </button>
+ </div>
+
+ {/* Content */}
+ {connectedServers.length === 0 ? (
+ <div className="flex flex-col items-center gap-[16px] px-[8px] py-[16px]">
+ <EmptyMCPIcon />
+ <div className="flex flex-col items-center gap-[8px]">
+ <p className="text-[16px] font-medium text-black text-center leading-[20px]">
+ Connect your tools
+ </p>
+ <p className="text-[13px] text-[#969696] text-center leading-[19px]">
+ Sync meeting notes and action items to Notion, HubSpot, Coda, and more.
+ </p>
+ </div>
+ <button
+ onClick={onNavigateToSettings}
+ className="flex items-center gap-[4px] bg-white border border-[#e4e4ec] px-[16px] py-[12px] rounded-[12px] shadow-[0px_1.272px_15.267px_0px_rgba(0,0,0,0.05)] hover:bg-gray-50 transition-colors"
+ >
+ <span className="text-[14px]">+</span>
+ <span className="text-[14px] font-medium text-black">Add integration</span>
+ </button>
+ </div>
+ ) : (
+ <div className="flex flex-col gap-[12px]">
+ {connectedServers.map((server) => (
+ <MCPServerItem key={server.id} server={server} />
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+export default HomeView;
diff --git a/src/renderer/components/layout/NewSidebar.tsx b/src/renderer/components/layout/NewSidebar.tsx
new file mode 100644
index 0000000..d4f5ffe
--- /dev/null
+++ b/src/renderer/components/layout/NewSidebar.tsx
@@ -0,0 +1,173 @@
+/**
+ * NewSidebar Component
+ *
+ * New sidebar design matching the Figma mockup.
+ * - Company logo placeholder
+ * - Home icon (active state with orange background)
+ * - Record icon
+ * - Settings icon
+ * - Logout at bottom
+ */
+
+import React from 'react';
+import { LogOut } from 'lucide-react';
+import { useConfigStore } from '../../stores/config.store';
+import { getElectronAPI } from '../../api/ipc';
+
+type Tab = 'home' | 'history' | 'settings';
+
+interface NewSidebarProps {
+ activeTab: Tab;
+ onTabChange: (tab: Tab) => void;
+}
+
+// Home Icon
+function HomeIcon({ active }: { active: boolean }) {
+ const color = active ? '#ec5b16' : '#464646';
+ return (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"
+ stroke={color}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ fill={active ? 'rgba(236,91,22,0.15)' : 'none'}
+ />
+ <path
+ d="M9 22V12h6v10"
+ stroke={color}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+// Record/History Icon
+function RecordIcon({ active }: { active: boolean }) {
+ const color = active ? '#ec5b16' : '#464646';
+ return (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <rect
+ x="3"
+ y="6"
+ width="14"
+ height="12"
+ rx="2"
+ stroke={color}
+ strokeWidth="1.5"
+ fill={active ? 'rgba(236,91,22,0.15)' : 'none'}
+ />
+ <path
+ d="M17 9.5l4-2.5v10l-4-2.5"
+ stroke={color}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+// Settings Icon
+function SettingsIcon({ active }: { active: boolean }) {
+ const color = active ? '#ec5b16' : '#464646';
+ return (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle
+ cx="12"
+ cy="12"
+ r="3"
+ stroke={color}
+ strokeWidth="1.5"
+ fill={active ? 'rgba(236,91,22,0.15)' : 'none'}
+ />
+ <path
+ d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"
+ stroke={color}
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+// Logout Icon
+function LogoutIcon() {
+ return (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"
+ stroke="#464646"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path
+ d="M16 17l5-5-5-5M21 12H9"
+ stroke="#464646"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+export function NewSidebar({ activeTab, onTabChange }: NewSidebarProps) {
+ const configStore = useConfigStore();
+
+ const handleLogout = async () => {
+ const api = getElectronAPI();
+ if (api) {
+ await api.app.logout();
+ }
+ configStore.clearAuth();
+ };
+
+ const tabs: { id: Tab; icon: (active: boolean) => React.ReactNode; label: string }[] = [
+ { id: 'home', icon: (a) => <HomeIcon active={a} />, label: 'Home' },
+ { id: 'history', icon: (a) => <RecordIcon active={a} />, label: 'Recordings' },
+ { id: 'settings', icon: (a) => <SettingsIcon active={a} />, label: 'Settings' },
+ ];
+
+ return (
+ <div className="flex flex-col h-full bg-white border-r border-[rgba(0,0,0,0.1)]">
+ {/* Top section with logo and nav */}
+ <div className="flex-1 flex flex-col items-center gap-[20px] p-[20px]">
+ {/* Logo placeholder */}
+ <div className="w-[40px] h-[40px] rounded-[9px] bg-[#efefef]" />
+
+ {/* Navigation items */}
+ {tabs.map(({ id, icon, label }) => (
+ <button
+ key={id}
+ onClick={() => onTabChange(id)}
+ className={`p-[4px] rounded-[6px] transition-colors ${
+ activeTab === id ? 'bg-[#ffe9d3]' : 'hover:bg-[#f5f5f5]'
+ }`}
+ title={label}
+ >
+ {icon(activeTab === id)}
+ </button>
+ ))}
+ </div>
+
+ {/* Bottom section with logout */}
+ <div className="flex flex-col items-center pb-[20px]">
+ <button
+ onClick={handleLogout}
+ className="p-[4px] rounded-[6px] hover:bg-[#f5f5f5] transition-colors"
+ title="Logout"
+ >
+ <LogoutIcon />
+ </button>
+ </div>
+ </div>
+ );
+}
+
+export default NewSidebar;
diff --git a/src/renderer/components/settings/CalendarPanel.tsx b/src/renderer/components/settings/CalendarPanel.tsx
new file mode 100644
index 0000000..6a41b6e
--- /dev/null
+++ b/src/renderer/components/settings/CalendarPanel.tsx
@@ -0,0 +1,333 @@
+/**
+ * Calendar Panel Component
+ *
+ * Settings panel for connecting/disconnecting Google Calendar.
+ */
+
+import React, { useState, useEffect } from 'react';
+import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../ui/card';
+import { Button } from '../ui/button';
+import { Badge } from '../ui/badge';
+import {
+ Calendar,
+ Check,
+ Loader2,
+ LogOut,
+ RefreshCw,
+ AlertCircle,
+} from 'lucide-react';
+import type { UpcomingMeeting } from '../../../shared/types/calendar.types';
+
+type CalendarStatus = 'disconnected' | 'connecting' | 'connected' | 'error';
+
+export function CalendarPanel() {
+ const [status, setStatus] = useState<CalendarStatus>('disconnected');
+ const [isLoading, setIsLoading] = useState(true);
+ const [error, setError] = useState<string | null>(null);
+ const [upcomingEvents, setUpcomingEvents] = useState<UpcomingMeeting[]>([]);
+
+ // Check auth status on mount
+ useEffect(() => {
+ checkAuthStatus();
+
+ // Listen for events updates
+ const unsubscribe = window.electronAPI.calendarOn.onEventsUpdated((events) => {
+ setUpcomingEvents(events);
+ });
+
+ // Listen for auth required
+ const unsubAuthRequired = window.electronAPI.calendarOn.onAuthRequired(() => {
+ setStatus('error');
+ setError('Calendar session expired. Please reconnect.');
+ });
+
+ return () => {
+ unsubscribe();
+ unsubAuthRequired();
+ };
+ }, []);
+
+ const checkAuthStatus = async () => {
+ setIsLoading(true);
+ try {
+ const result = await window.electronAPI.calendar.isSignedIn();
+ if (result.success && result.isSignedIn) {
+ setStatus('connected');
+ // Fetch initial events
+ const eventsResult = await window.electronAPI.calendar.getUpcomingEvents(24);
+ if (eventsResult.success && eventsResult.events) {
+ setUpcomingEvents(eventsResult.events);
+ }
+ } else {
+ setStatus('disconnected');
+ }
+ setError(null);
+ } catch (err) {
+ setStatus('error');
+ setError('Failed to check calendar status');
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ const handleConnect = async () => {
+ setStatus('connecting');
+ setError(null);
+ try {
+ const result = await window.electronAPI.calendar.signIn();
+ if (result.success) {
+ setStatus('connected');
+ // Fetch events after connecting
+ const eventsResult = await window.electronAPI.calendar.getUpcomingEvents(24);
+ if (eventsResult.success && eventsResult.events) {
+ setUpcomingEvents(eventsResult.events);
+ }
+ } else {
+ setStatus('error');
+ setError(result.error || 'Failed to connect');
+ }
+ } catch (err) {
+ setStatus('error');
+ setError('Connection failed');
+ }
+ };
+
+ const handleDisconnect = async () => {
+ setIsLoading(true);
+ try {
+ await window.electronAPI.calendar.signOut();
+ setStatus('disconnected');
+ setUpcomingEvents([]);
+ setError(null);
+ } catch (err) {
+ setError('Failed to disconnect');
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ const getStatusBadge = () => {
+ switch (status) {
+ case 'connected':
+ return (
+ <Badge className="bg-green-500 text-white">
+ <Check className="h-3 w-3 mr-1" />
+ Connected
+ </Badge>
+ );
+ case 'connecting':
+ return (
+ <Badge variant="secondary" className="animate-pulse">
+ <Loader2 className="h-3 w-3 mr-1 animate-spin" />
+ Connecting...
+ </Badge>
+ );
+ case 'error':
+ return (
+ <Badge variant="destructive">
+ <AlertCircle className="h-3 w-3 mr-1" />
+ Error
+ </Badge>
+ );
+ default:
+ return (
+ <Badge variant="outline">
+ Not Connected
+ </Badge>
+ );
+ }
+ };
+
+ const formatEventTime = (event: UpcomingMeeting) => {
+ if (event.isAllDay) return 'All day';
+ return event.startTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
+ };
+
+ return (
+ <div className="space-y-6">
+ {/* Header */}
+ <div className="flex items-center justify-between">
+ <div>
+ <h2 className="text-lg font-semibold flex items-center gap-2">
+ <Calendar className="h-5 w-5" />
+ Google Calendar
+ </h2>
+ <p className="text-sm text-slate-500 dark:text-slate-400">
+ Get notified before your meetings start
+ </p>
+ </div>
+ <div className="flex items-center gap-2">
+ {getStatusBadge()}
+ {status === 'connected' && (
+ <Button variant="outline" size="icon" onClick={checkAuthStatus} disabled={isLoading}>
+ <RefreshCw className={`h-4 w-4 ${isLoading ? 'animate-spin' : ''}`} />
+ </Button>
+ )}
+ </div>
+ </div>
+
+ {/* Connection Card */}
+ <Card>
+ <CardHeader>
+ <CardTitle className="text-base">Calendar Connection</CardTitle>
+ <CardDescription>
+ Connect your Google Calendar to receive notifications 2 minutes before meetings start.
+ The app will run in your system tray to monitor upcoming events.
+ </CardDescription>
+ </CardHeader>
+ <CardContent className="space-y-4">
+ {error && (
+ <div className="p-3 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-800 rounded-lg">
+ <p className="text-sm text-red-600 dark:text-red-400 flex items-center gap-2">
+ <AlertCircle className="h-4 w-4" />
+ {error}
+ </p>
+ </div>
+ )}
+
+ {status === 'disconnected' && (
+ <div className="flex flex-col items-center py-6">
+ <Calendar className="h-12 w-12 text-slate-300 dark:text-slate-600 mb-4" />
+ <p className="text-sm text-slate-500 dark:text-slate-400 text-center mb-4">
+ Connect your Google Calendar to get started
+ </p>
+ <Button onClick={handleConnect}>
+ <Calendar className="h-4 w-4 mr-2" />
+ Connect Google Calendar
+ </Button>
+ </div>
+ )}
+
+ {status === 'connecting' && (
+ <div className="flex flex-col items-center py-6">
+ <Loader2 className="h-12 w-12 text-blue-500 mb-4 animate-spin" />
+ <p className="text-sm text-slate-500 dark:text-slate-400 text-center">
+ Connecting to Google Calendar...
+ </p>
+ <p className="text-xs text-slate-400 dark:text-slate-500 text-center mt-2">
+ A browser window will open for authorization
+ </p>
+ </div>
+ )}
+
+ {status === 'connected' && (
+ <div className="space-y-4">
+ <div className="flex items-center justify-between p-3 bg-green-50 dark:bg-green-950/30 rounded-lg">
+ <div className="flex items-center gap-2">
+ <Check className="h-5 w-5 text-green-500" />
+ <span className="text-sm font-medium text-green-700 dark:text-green-300">
+ Calendar connected
+ </span>
+ </div>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleDisconnect}
+ disabled={isLoading}
+ >
+ <LogOut className="h-4 w-4 mr-2" />
+ Disconnect
+ </Button>
+ </div>
+
+ {/* Upcoming Events Preview */}
+ {upcomingEvents.length > 0 && (
+ <div className="space-y-2">
+ <h4 className="text-sm font-medium text-slate-700 dark:text-slate-300">
+ Upcoming Meetings (next 24h)
+ </h4>
+ <div className="space-y-2 max-h-48 overflow-y-auto">
+ {upcomingEvents.slice(0, 5).map((event) => (
+ <div
+ key={event.id}
+ className="flex items-center justify-between p-2 bg-slate-50 dark:bg-slate-800/50 rounded"
+ >
+ <div className="flex-1 min-w-0">
+ <p className="text-sm font-medium truncate">{event.summary}</p>
+ <p className="text-xs text-slate-500 dark:text-slate-400">
+ {formatEventTime(event)}
+ {event.minutesUntil > 0 && event.minutesUntil <= 60 && (
+ <span className="ml-2 text-amber-600 dark:text-amber-400">
+ in {event.minutesUntil}m
+ </span>
+ )}
+ </p>
+ </div>
+ {event.meetLink && (
+ <Badge variant="outline" className="text-xs ml-2">
+ Meet
+ </Badge>
+ )}
+ </div>
+ ))}
+ </div>
+ {upcomingEvents.length > 5 && (
+ <p className="text-xs text-slate-500 dark:text-slate-400 text-center">
+ +{upcomingEvents.length - 5} more events
+ </p>
+ )}
+ </div>
+ )}
+
+ {upcomingEvents.length === 0 && (
+ <p className="text-sm text-slate-500 dark:text-slate-400 text-center py-4">
+ No upcoming meetings in the next 24 hours
+ </p>
+ )}
+ </div>
+ )}
+
+ {status === 'error' && (
+ <div className="flex flex-col items-center py-6">
+ <AlertCircle className="h-12 w-12 text-red-400 mb-4" />
+ <p className="text-sm text-slate-500 dark:text-slate-400 text-center mb-4">
+ {error || 'Something went wrong'}
+ </p>
+ <Button onClick={handleConnect}>
+ <RefreshCw className="h-4 w-4 mr-2" />
+ Try Again
+ </Button>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+
+ {/* Info Card */}
+ <Card>
+ <CardContent className="pt-6">
+ <div className="space-y-3 text-sm text-slate-600 dark:text-slate-400">
+ <div className="flex items-start gap-3">
+ <div className="w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center shrink-0">
+ <span className="text-xs font-medium text-blue-600 dark:text-blue-400">1</span>
+ </div>
+ <p>
+ <strong>System Tray:</strong> When you close the app, it continues running in your
+ system tray to monitor your calendar.
+ </p>
+ </div>
+ <div className="flex items-start gap-3">
+ <div className="w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center shrink-0">
+ <span className="text-xs font-medium text-blue-600 dark:text-blue-400">2</span>
+ </div>
+ <p>
+ <strong>Notifications:</strong> You'll receive a notification 2 minutes before each
+ meeting starts.
+ </p>
+ </div>
+ <div className="flex items-start gap-3">
+ <div className="w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center shrink-0">
+ <span className="text-xs font-medium text-blue-600 dark:text-blue-400">3</span>
+ </div>
+ <p>
+ <strong>Privacy:</strong> Your calendar data stays on your device. We only read
+ event titles and times to send notifications.
+ </p>
+ </div>
+ </div>
+ </CardContent>
+ </Card>
+ </div>
+ );
+}
+
+export default CalendarPanel;
diff --git a/src/renderer/stores/config.store.ts b/src/renderer/stores/config.store.ts
index 1bcf359..6dd690a 100644
--- a/src/renderer/stores/config.store.ts
+++ b/src/renderer/stores/config.store.ts
@@ -6,11 +6,13 @@ interface ConfigState {
userName: string | null;
apiKey: string | null;
apiUrl: string | null;
+ onboardingComplete: boolean;
setAuth: (accessToken: string, userName: string, apiKey: string) => void;
setConfig: (config: Partial<ConfigState>) => void;
clearAuth: () => void;
isAuthenticated: () => boolean;
+ completeOnboarding: () => void;
}
export const useConfigStore = create<ConfigState>()(
@@ -20,6 +22,7 @@ export const useConfigStore = create<ConfigState>()(
userName: null,
apiKey: null,
apiUrl: null,
+ onboardingComplete: false,
setAuth: (accessToken, userName, apiKey) => {
set({ accessToken, userName, apiKey });
@@ -34,12 +37,17 @@ export const useConfigStore = create<ConfigState>()(
accessToken: null,
userName: null,
apiKey: null,
+ onboardingComplete: false,
});
},
isAuthenticated: () => {
return !!get().accessToken;
},
+
+ completeOnboarding: () => {
+ set({ onboardingComplete: true });
+ },
}),
{
name: 'meeting-copilot-config',
@@ -47,6 +55,7 @@ export const useConfigStore = create<ConfigState>()(
accessToken: state.accessToken,
userName: state.userName,
apiKey: state.apiKey,
+ onboardingComplete: state.onboardingComplete,
}),
}
)
diff --git a/src/shared/types/calendar.types.ts b/src/shared/types/calendar.types.ts
new file mode 100644
index 0000000..4289858
--- /dev/null
+++ b/src/shared/types/calendar.types.ts
@@ -0,0 +1,117 @@
+/**
+ * Google Calendar Integration Types
+ */
+
+// Google OAuth Tokens
+export interface GoogleTokens {
+ accessToken: string;
+ refreshToken: string;
+ expiresAt: number; // Unix timestamp in ms
+}
+
+// Google OAuth Config (loaded from resources/google_oauth.json)
+export interface GoogleOAuthConfig {
+ clientId: string;
+ clientSecret: string;
+ scopes: string[];
+ tokenUri: string;
+ authUri: string;
+}
+
+// Calendar Event from Google Calendar API
+export interface CalendarEvent {
+ id: string;
+ summary: string;
+ description?: string;
+ start: {
+ dateTime?: string; // ISO string for timed events
+ date?: string; // YYYY-MM-DD for all-day events
+ timeZone?: string;
+ };
+ end: {
+ dateTime?: string;
+ date?: string;
+ timeZone?: string;
+ };
+ location?: string;
+ hangoutLink?: string; // Google Meet link
+ htmlLink?: string; // Link to event in Google Calendar
+ status?: 'confirmed' | 'tentative' | 'cancelled';
+ attendees?: Array<{
+ email: string;
+ displayName?: string;
+ responseStatus?: 'needsAction' | 'declined' | 'tentative' | 'accepted';
+ self?: boolean;
+ }>;
+ organizer?: {
+ email: string;
+ displayName?: string;
+ self?: boolean;
+ };
+ conferenceData?: {
+ entryPoints?: Array<{
+ entryPointType: 'video' | 'phone' | 'sip' | 'more';
+ uri: string;
+ label?: string;
+ }>;
+ };
+}
+
+// Simplified event for notifications and UI
+export interface UpcomingMeeting {
+ id: string;
+ summary: string;
+ startTime: Date;
+ endTime: Date;
+ minutesUntil: number;
+ meetLink?: string;
+ location?: string;
+ htmlLink?: string;
+ isAllDay: boolean;
+}
+
+// Calendar Auth State
+export type CalendarAuthState =
+ | { status: 'disconnected' }
+ | { status: 'connecting' }
+ | { status: 'connected'; email?: string }
+ | { status: 'error'; error: string };
+
+// Poller State
+export interface CalendarPollerState {
+ isPolling: boolean;
+ lastPollAt?: number;
+ upcomingEvents: UpcomingMeeting[];
+ error?: string;
+}
+
+// IPC Response types
+export interface CalendarSignInResult {
+ success: boolean;
+ error?: string;
+}
+
+export interface CalendarEventsResult {
+ success: boolean;
+ events?: UpcomingMeeting[];
+ error?: string;
+}
+
+export interface CalendarAuthStatusResult {
+ success: boolean;
+ isSignedIn: boolean;
+ error?: string;
+}
+
+// Calendar API for preload
+export interface CalendarApi {
+ signIn: () => Promise<CalendarSignInResult>;
+ signOut: () => Promise<{ success: boolean; error?: string }>;
+ isSignedIn: () => Promise<CalendarAuthStatusResult>;
+ getUpcomingEvents: (hours?: number) => Promise<CalendarEventsResult>;
+}
+
+export interface CalendarEvents {
+ onAuthRequired: (callback: () => void) => () => void;
+ onEventsUpdated: (callback: (events: UpcomingMeeting[]) => void) => () => void;
+}
diff --git a/src/shared/types/ipc.types.ts b/src/shared/types/ipc.types.ts
index 05f3e11..3df54cf 100644
--- a/src/shared/types/ipc.types.ts
+++ b/src/shared/types/ipc.types.ts
@@ -1,4 +1,9 @@
import type { CaptureConfig, Channel } from '../schemas/capture.schema';
+import type {
+ CalendarApi,
+ CalendarEvents,
+ UpcomingMeeting,
+} from './calendar.types';
export interface StartRecordingParams {
config: CaptureConfig;
@@ -224,6 +229,8 @@ export interface IpcApi {
onServerDisconnected: (callback: (data: { serverId: string; reason: string }) => void) => () => void;
onServerError: (callback: (data: { serverId: string; error: string }) => void) => () => void;
};
+ calendar: CalendarApi;
+ calendarOn: CalendarEvents;
}
export type IpcChannel =
diff --git a/src/shared/types/mcp.types.ts b/src/shared/types/mcp.types.ts
index 502f8c2..41acdf2 100644
--- a/src/shared/types/mcp.types.ts
+++ b/src/shared/types/mcp.types.ts
@@ -207,6 +207,10 @@ export interface MCPEvents {
'tool-call-completed': MCPToolResult;
'tool-call-error': { callId: string; serverId: string; toolName: string; error: string };
'intent-detected': MCPIntentDetection;
+ // OAuth events
+ 'auth-required': { serverId: string; serverName: string };
+ 'auth-success': { serverId: string };
+ 'auth-error': { serverId: string; error: string };
}
/**
@@ -277,3 +281,26 @@ export interface MCPTestConnectionResult {
error?: string;
latencyMs?: number;
}
+
+/**
+ * OAuth Configuration for MCP servers
+ */
+export interface MCPOAuthConfig {
+ serverId: string;
+ serverName: string;
+ authorizationUrl: string;
+ tokenUrl: string;
+ clientId: string;
+ clientSecret?: string;
+ scopes?: string[];
+ redirectUri?: string;
+}
+
+/**
+ * OAuth status for a server
+ */
+export interface MCPOAuthStatus {
+ hasTokens: boolean;
+ requiresAuth: boolean;
+ expiresAt?: string;
+}