Turn meetings into live agent loops. Record, transcribe, and analyze meetings with real-time AI intelligence — before, during, and after calls.
feat: meeting widget
Om Gatee0e519119815
diff --git a/package-lock.json b/package-lock.jsonindex 1233e65..a073b9f 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "call-md",- "version": "1.0.1",+ "version": "1.0.2","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "call-md",- "version": "1.0.1",+ "version": "1.0.2","hasInstallScript": true,"license": "MIT","dependencies": {diff --git a/package.json b/package.jsonindex a64b0cc..86c30b3 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "call-md",- "version": "1.0.1",+ "version": "1.0.2","type": "commonjs","description": "Call.md - Record meetings with real-time transcription and AI-powered insights","author": {diff --git a/src/main/index.ts b/src/main/index.tsindex cc5aa20..99c1bbc 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -15,6 +15,7 @@ import {setMCPMainWindow,setCalendarMainWindow,setLiveAssistWindow,+ setWidgetMainWindow,sendToRenderer,shutdownCaptureClient,} from './ipc';@@ -148,6 +149,7 @@ async function createWindow(): Promise<void> {setMCPMainWindow(mainWindow);setCalendarMainWindow(mainWindow);setLiveAssistWindow(mainWindow);+ setWidgetMainWindow(mainWindow);if (isDev) {const VITE_DEV_PORT = 51730;diff --git a/src/main/ipc/capture.ts b/src/main/ipc/capture.tsindex 1d7972e..49e4d73 100644--- a/src/main/ipc/capture.ts+++ b/src/main/ipc/capture.ts@@ -10,6 +10,16 @@ import { createChildLogger } from '../lib/logger';import { applyVideoDBPatches } from '../lib/videodb-patch';import { loadAppConfig, loadRuntimeConfig } from '../lib/config';import { getUserByAccessToken } from '../db';+import {+ showWidgetWindow,+ closeWidgetWindow,+} from '../windows/widget.window';+import {+ setWidgetRecordingControls,+ updateWidgetSessionState,+ updateWidgetVisualAnalysis,+ clearWidgetState,+} from './widget';const logger = createChildLogger('ipc-capture');@@ -227,6 +237,9 @@ async function listenForVisualIndexMessages(ws: WebSocketConnection): Promise<voevent: 'visual_index',data: visualIndexEvent,});++ // Also send to floating widget+ updateWidgetVisualAnalysis(text);}}} catch (err) {@@ -340,7 +353,123 @@ function removeCaptureEventListeners(): void {});}+// Function to stop recording (used by widget and IPC handler)+async function stopRecordingInternal(): Promise<{ success: boolean; error?: string }> {+ logger.info('Stopping recording (internal)');++ // Capture session info before cleanup+ const sessionIdForPoller = currentSessionId;+ const apiKeyForPoller = currentApiKey;+ const accessTokenForPoller = currentAccessToken;+ const apiUrlForPoller = currentApiUrl;++ try {+ if (captureClient) {+ removeCaptureEventListeners();++ await captureClient.stopSession();+ logger.info('Capture session stopped');++ await captureClient.shutdown();+ logger.info('CaptureClient shutdown complete');+ captureClient = null;++ // Manually emit recording:stopped immediately+ sendRecorderEvent({+ event: 'recording:stopped',+ data: {},+ });++ // Manually emit upload:complete+ sendRecorderEvent({+ event: 'upload:complete',+ data: {},+ });++ // Close the floating widget window+ clearWidgetState();+ closeWidgetWindow();+ } else {+ logger.warn('No active capture client to stop');+ }++ await cleanupTranscriptWebSockets();+ await cleanupVisualIndexWebSocket();+ await cleanupSessionWebSocket();++ // Start export poller to detect when video is ready+ if (sessionIdForPoller && apiKeyForPoller && accessTokenForPoller) {+ logger.info({ sessionId: sessionIdForPoller }, 'Starting export poller');+ startExportPoller(+ sessionIdForPoller,+ apiKeyForPoller,+ accessTokenForPoller,+ apiUrlForPoller+ );+ } else {+ logger.warn('Missing session info for export poller');+ }++ // Clear stored session info+ currentSessionId = null;+ currentApiKey = null;+ currentAccessToken = null;+ currentApiUrl = undefined;++ return { success: true };+ } catch (error) {+ logger.error({ error }, 'Failed to stop recording');+ await cleanupTranscriptWebSockets();+ await cleanupVisualIndexWebSocket();+ await cleanupSessionWebSocket();+ cleanupCapture();++ // Clear stored session info on error too+ currentSessionId = null;+ currentApiKey = null;+ currentAccessToken = null;+ currentApiUrl = undefined;++ return {+ success: false,+ error: error instanceof Error ? error.message : 'Unknown error',+ };+ }+}+export function setupCaptureHandlers(): void {+ // Register widget recording controls+ setWidgetRecordingControls(+ // pause+ async () => {+ if (captureClient) {+ await captureClient.pauseTracks(['mic', 'system_audio', 'screen'] as ('mic' | 'system_audio' | 'screen')[]);+ }+ },+ // resume+ async () => {+ if (captureClient) {+ await captureClient.resumeTracks(['mic', 'system_audio', 'screen'] as ('mic' | 'system_audio' | 'screen')[]);+ }+ },+ // stop+ async () => {+ await stopRecordingInternal();+ },+ // muteMic+ async () => {+ if (captureClient) {+ await captureClient.pauseTracks(['mic'] as ('mic' | 'system_audio' | 'screen')[]);+ }+ },+ // unmuteMic+ async () => {+ if (captureClient) {+ await captureClient.resumeTracks(['mic'] as ('mic' | 'system_audio' | 'screen')[]);+ }+ }+ );+ipcMain.handle('recorder-start-recording',async (@@ -486,6 +615,14 @@ export function setupCaptureHandlers(): void {});logger.info({ sessionId: config.sessionId }, 'recording:started event emitted');+ // Show the floating widget window and update its state+ updateWidgetSessionState({+ isRecording: true,+ isPaused: false,+ startTime: Date.now(),+ });+ showWidgetWindow();+// Store session info for export polling when recording stopscurrentSessionId = config.sessionId;currentAccessToken = accessToken;@@ -521,84 +658,8 @@ export function setupCaptureHandlers(): void {ipcMain.handle('recorder-stop-recording',async (): Promise<{ success: boolean; error?: string }> => {- logger.info('Stopping recording');-- // Capture session info before cleanup- const sessionIdForPoller = currentSessionId;- const apiKeyForPoller = currentApiKey;- const accessTokenForPoller = currentAccessToken;- const apiUrlForPoller = currentApiUrl;-- try {- if (captureClient) {- removeCaptureEventListeners();-- await captureClient.stopSession();- logger.info('Capture session stopped');-- await captureClient.shutdown();- logger.info('CaptureClient shutdown complete');- captureClient = null;-- // Manually emit recording:stopped immediately (ensures UI updates without waiting for SDK events)- sendRecorderEvent({- event: 'recording:stopped',- data: {},- });-- // Manually emit upload:complete since we've already shutdown the client- // (the SDK event listener was removed before upload could complete)- sendRecorderEvent({- event: 'upload:complete',- data: {},- });- } else {- logger.warn('No active capture client to stop');- }-- await cleanupTranscriptWebSockets();- await cleanupVisualIndexWebSocket();- await cleanupSessionWebSocket();-- // Start export poller to detect when video is ready- // This replaces the unreliable WebSocket-based approach- if (sessionIdForPoller && apiKeyForPoller && accessTokenForPoller) {- logger.info({ sessionId: sessionIdForPoller }, 'Starting export poller');- startExportPoller(- sessionIdForPoller,- apiKeyForPoller,- accessTokenForPoller,- apiUrlForPoller- );- } else {- logger.warn('Missing session info for export poller');- }-- // Clear stored session info- currentSessionId = null;- currentApiKey = null;- currentAccessToken = null;- currentApiUrl = undefined;-- return { success: true };- } catch (error) {- logger.error({ error }, 'Failed to stop recording');- await cleanupTranscriptWebSockets();- await cleanupVisualIndexWebSocket();- await cleanupSessionWebSocket();- cleanupCapture();-- // Clear stored session info on error too- currentSessionId = null;- currentApiKey = null;- currentAccessToken = null;- currentApiUrl = undefined;-- return {- success: false,- error: error instanceof Error ? error.message : 'Unknown error',- };- }+ logger.info('Stopping recording via IPC');+ return stopRecordingInternal();});diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.tsindex d8df9ff..e0f3b05 100644--- a/src/main/ipc/index.ts+++ b/src/main/ipc/index.ts@@ -8,6 +8,7 @@ import { setupCalendarHandlers, removeCalendarHandlers, setCalendarMainWindow }import { setupLiveAssistHandlers, setLiveAssistWindow, cleanupLiveAssist } from './live-assist';import { setupWorkflowHandlers, removeWorkflowHandlers, setWorkflowsMainWindow } from './workflows';import { setupVisualIndexIPC } from './visual-index';+import { setupWidgetIpcHandlers, removeWidgetIpcHandlers } from './widget';import { createChildLogger } from '../lib/logger';const logger = createChildLogger('ipc');@@ -24,6 +25,7 @@ export function setupIpcHandlers(): void {setupLiveAssistHandlers();setupWorkflowHandlers();setupVisualIndexIPC();+ setupWidgetIpcHandlers();logger.info('IPC handlers registered');}@@ -72,6 +74,9 @@ export function removeIpcHandlers(): void {// Workflow handlersremoveWorkflowHandlers();+ // Widget handlers+ removeWidgetIpcHandlers();+logger.info('IPC handlers removed');}@@ -81,3 +86,12 @@ export { setMCPMainWindow } from './mcp';export { setCalendarMainWindow } from './calendar';export { setLiveAssistWindow } from './live-assist';export { setWorkflowsMainWindow } from './workflows';+export {+ setWidgetRecordingControls,+ setWidgetMainWindow,+ updateWidgetSessionState,+ updateWidgetLiveAssist,+ updateWidgetVisualAnalysis,+ updateWidgetNudge,+ clearWidgetState,+} from './widget';diff --git a/src/main/ipc/live-assist.ts b/src/main/ipc/live-assist.tsindex 635ae25..acec9cf 100644--- a/src/main/ipc/live-assist.ts+++ b/src/main/ipc/live-assist.ts@@ -9,6 +9,7 @@ import { ipcMain, BrowserWindow } from 'electron';import { getLiveAssistService, resetLiveAssistService } from '../services/live-assist.service';import { getMCPInferenceService, resetMCPInferenceService } from '../services/mcp-inference.service';import { createChildLogger } from '../lib/logger';+import { updateWidgetLiveAssist } from './widget';import type { LiveInsightsEvent } from '../../shared/types/live-assist.types';import type { MCPDisplayResult } from '../../shared/types/mcp.types';@@ -37,6 +38,11 @@ export function setupLiveAssistHandlers(): void {liveAssistService.on('insights', (event: LiveInsightsEvent) => {logger.info({ sayCount: event.insights.say_this.length, askCount: event.insights.ask_this.length }, 'Sending insights to renderer');sendToRenderer('live-assist:update', event);+ // Also send to floating widget+ updateWidgetLiveAssist({+ sayThis: event.insights.say_this,+ askThis: event.insights.ask_this,+ });});liveAssistService.start();diff --git a/src/main/ipc/widget.ts b/src/main/ipc/widget.tsnew file mode 100644index 0000000..fe63454--- /dev/null+++ b/src/main/ipc/widget.ts@@ -0,0 +1,206 @@+import { ipcMain, BrowserWindow, app } from 'electron';+import { createChildLogger } from '../lib/logger';++const logger = createChildLogger('ipc-widget');+import { getWidgetWindow, sendToWidget, closeWidgetWindow } from '../windows/widget.window';++let mainWindowRef: BrowserWindow | null = null;++export function setWidgetMainWindow(window: BrowserWindow): void {+ mainWindowRef = window;+}++let widgetSessionState = {+ isRecording: false,+ isPaused: false,+ isMicMuted: false,+ startTime: null as number | null,+};++let widgetLiveAssist = {+ sayThis: [] as Array<{ id: string; text: string; timestamp: number }>,+ askThis: [] as Array<{ id: string; text: string; timestamp: number }>,+};++let widgetVisualAnalysis = {+ description: '',+};++let widgetNudge: { id: string; message: string; type: 'info' | 'warning' | 'action'; timestamp: number } | null = null;++let pauseRecordingFn: (() => Promise<void>) | null = null;+let resumeRecordingFn: (() => Promise<void>) | null = null;+let stopRecordingFn: (() => Promise<void>) | null = null;+let muteMicFn: (() => Promise<void>) | null = null;+let unmuteMicFn: (() => Promise<void>) | null = null;++export function setWidgetRecordingControls(+ pause: () => Promise<void>,+ resume: () => Promise<void>,+ stop: () => Promise<void>,+ muteMic: () => Promise<void>,+ unmuteMic: () => Promise<void>+): void {+ pauseRecordingFn = pause;+ resumeRecordingFn = resume;+ stopRecordingFn = stop;+ muteMicFn = muteMic;+ unmuteMicFn = unmuteMic;+}++export function setupWidgetIpcHandlers(): void {+ ipcMain.handle('widget:pause', async () => {+ if (pauseRecordingFn) {+ await pauseRecordingFn();+ updateWidgetSessionState({ isPaused: true });+ }+ });++ ipcMain.handle('widget:resume', async () => {+ if (resumeRecordingFn) {+ await resumeRecordingFn();+ // If mic was muted before pause, re-mute it after resuming all tracks+ if (widgetSessionState.isMicMuted && muteMicFn) {+ await muteMicFn();+ }+ updateWidgetSessionState({ isPaused: false });+ }+ });++ ipcMain.handle('widget:stop', async () => {+ if (stopRecordingFn) {+ await stopRecordingFn();+ closeWidgetWindow();+ }+ });++ ipcMain.handle('widget:mute-mic', async () => {+ if (muteMicFn) {+ await muteMicFn();+ updateWidgetSessionState({ isMicMuted: true });+ }+ });++ ipcMain.handle('widget:unmute-mic', async () => {+ if (unmuteMicFn) {+ await unmuteMicFn();+ updateWidgetSessionState({ isMicMuted: false });+ }+ });++ ipcMain.handle('widget:dismiss-card', async (_event, type: 'sayThis' | 'askThis', id: string) => {+ if (type === 'sayThis') {+ widgetLiveAssist.sayThis = widgetLiveAssist.sayThis.filter(card => card.id !== id);+ } else {+ widgetLiveAssist.askThis = widgetLiveAssist.askThis.filter(card => card.id !== id);+ }+ sendToWidget('widget:live-assist', widgetLiveAssist);+ logger.debug({ type, id }, 'Widget card dismissed');+ });++ ipcMain.handle('widget:dismiss-nudge', async (_event, id: string) => {+ if (widgetNudge?.id === id) {+ widgetNudge = null;+ sendToWidget('widget:nudge', null);+ }+ logger.debug({ id }, 'Widget nudge dismissed');+ });++ ipcMain.handle('widget:request-initial-state', async () => {+ const window = getWidgetWindow();+ if (window) {+ sendToWidget('widget:session-state', widgetSessionState);+ sendToWidget('widget:live-assist', widgetLiveAssist);+ sendToWidget('widget:visual-analysis', widgetVisualAnalysis);+ sendToWidget('widget:nudge', widgetNudge);+ }+ });++ ipcMain.handle('widget:show-main-window', async () => {+ if (mainWindowRef && !mainWindowRef.isDestroyed()) {+ mainWindowRef.show();+ mainWindowRef.focus();+ if (process.platform === 'darwin') {+ app.dock?.show();+ }+ }+ });++ ipcMain.handle('widget:hide', async () => {+ const window = getWidgetWindow();+ if (window && !window.isDestroyed()) {+ window.hide();+ }+ });+}++export function removeWidgetIpcHandlers(): void {+ ipcMain.removeHandler('widget:pause');+ ipcMain.removeHandler('widget:resume');+ ipcMain.removeHandler('widget:stop');+ ipcMain.removeHandler('widget:mute-mic');+ ipcMain.removeHandler('widget:unmute-mic');+ ipcMain.removeHandler('widget:dismiss-card');+ ipcMain.removeHandler('widget:dismiss-nudge');+ ipcMain.removeHandler('widget:request-initial-state');+ ipcMain.removeHandler('widget:show-main-window');+ ipcMain.removeHandler('widget:hide');+}++export function updateWidgetSessionState(state: Partial<typeof widgetSessionState>): void {+ widgetSessionState = { ...widgetSessionState, ...state };+ sendToWidget('widget:session-state', widgetSessionState);+}++export function updateWidgetLiveAssist(data: { sayThis?: string[]; askThis?: string[] }): void {+ const timestamp = Date.now();++ logger.info({ sayCount: data.sayThis?.length || 0, askCount: data.askThis?.length || 0 }, 'Updating widget live assist');++ if (data.sayThis) {+ const newCards = data.sayThis.map((text, i) => ({+ id: `say-${timestamp}-${i}`,+ text,+ timestamp,+ }));+ widgetLiveAssist.sayThis = [...newCards, ...widgetLiveAssist.sayThis].slice(0, 5);+ }++ if (data.askThis) {+ const newCards = data.askThis.map((text, i) => ({+ id: `ask-${timestamp}-${i}`,+ text,+ timestamp,+ }));+ widgetLiveAssist.askThis = [...newCards, ...widgetLiveAssist.askThis].slice(0, 5);+ }++ logger.info({ totalSay: widgetLiveAssist.sayThis.length, totalAsk: widgetLiveAssist.askThis.length }, 'Sending live assist to widget');+ sendToWidget('widget:live-assist', widgetLiveAssist);+}++export function updateWidgetVisualAnalysis(description: string): void {+ widgetVisualAnalysis = { description };+ sendToWidget('widget:visual-analysis', widgetVisualAnalysis);+}++export function updateWidgetNudge(nudge: { id: string; message: string; type: 'info' | 'warning' | 'action' } | null): void {+ if (nudge) {+ widgetNudge = { ...nudge, timestamp: Date.now() };+ } else {+ widgetNudge = null;+ }+ sendToWidget('widget:nudge', widgetNudge);+}++export function clearWidgetState(): void {+ widgetSessionState = {+ isRecording: false,+ isPaused: false,+ isMicMuted: false,+ startTime: null,+ };+ widgetLiveAssist = { sayThis: [], askThis: [] };+ widgetVisualAnalysis = { description: '' };+ widgetNudge = null;+}diff --git a/src/main/windows/widget.window.ts b/src/main/windows/widget.window.tsnew file mode 100644index 0000000..3f57fe1--- /dev/null+++ b/src/main/windows/widget.window.ts@@ -0,0 +1,165 @@+import { BrowserWindow, screen } from 'electron';+import path from 'path';+import { createChildLogger } from '../lib/logger';+import { loadAppConfig, saveAppConfig } from '../lib/config';++const logger = createChildLogger('widget-window');++let widgetWindow: BrowserWindow | null = null;+const isDev = process.env.NODE_ENV !== 'production' && !require('electron').app.isPackaged;++const WIDGET_WIDTH = 378;+const WIDGET_DEFAULT_HEIGHT = 500;+const WIDGET_MIN_HEIGHT = 200;+const WIDGET_MARGIN = 20;++interface WidgetPosition {+ x: number;+ y: number;+}++function loadWidgetPosition(): WidgetPosition | null {+ const config = loadAppConfig();+ return config.widgetPosition || null;+}++function saveWidgetPosition(position: WidgetPosition): void {+ const config = loadAppConfig();+ saveAppConfig({ ...config, widgetPosition: position });+}++function getDefaultPosition(): WidgetPosition {+ const primaryDisplay = screen.getPrimaryDisplay();+ const { width, height } = primaryDisplay.workAreaSize;+ return {+ x: width - WIDGET_WIDTH - WIDGET_MARGIN,+ y: height - WIDGET_DEFAULT_HEIGHT - WIDGET_MARGIN,+ };+}++function validatePosition(position: WidgetPosition): WidgetPosition {+ const displays = screen.getAllDisplays();+ let isValid = false;++ for (const display of displays) {+ const { x, y, width, height } = display.bounds;+ if (+ position.x >= x &&+ position.x < x + width &&+ position.y >= y &&+ position.y < y + height+ ) {+ isValid = true;+ break;+ }+ }++ return isValid ? position : getDefaultPosition();+}++export function createWidgetWindow(): BrowserWindow {+ logger.info('Creating widget window');++ if (widgetWindow && !widgetWindow.isDestroyed()) {+ logger.info('Widget window already exists, showing');+ widgetWindow.show();+ return widgetWindow;+ }++ const savedPosition = loadWidgetPosition();+ const position = savedPosition ? validatePosition(savedPosition) : getDefaultPosition();++ widgetWindow = new BrowserWindow({+ width: WIDGET_WIDTH,+ height: WIDGET_DEFAULT_HEIGHT,+ minWidth: WIDGET_WIDTH,+ maxWidth: WIDGET_WIDTH,+ minHeight: WIDGET_MIN_HEIGHT,+ x: position.x,+ y: position.y,+ frame: false,+ transparent: true,+ alwaysOnTop: true,+ skipTaskbar: true,+ resizable: true,+ hasShadow: false,+ show: false,+ webPreferences: {+ // __dirname is dist/main/windows, preload is at dist/preload+ preload: path.join(__dirname, '..', '..', 'preload', 'widget.js'),+ nodeIntegration: false,+ contextIsolation: true,+ sandbox: false,+ },+ });++ // Critical: Visible on fullscreen apps (macOS)+ widgetWindow.setVisibleOnAllWorkspaces(true, {+ visibleOnFullScreen: true,+ });++ // Set window level above everything+ widgetWindow.setAlwaysOnTop(true, 'floating', 1);++ // Load the widget HTML+ if (isDev) {+ const VITE_DEV_PORT = 51730;+ widgetWindow.loadURL(`http://localhost:${VITE_DEV_PORT}/widget.html`);+ } else {+ // __dirname is dist/main/windows, renderer is at dist/renderer+ widgetWindow.loadFile(path.join(__dirname, '..', '..', 'renderer', 'widget.html'));+ }++ // Save position on move+ widgetWindow.on('moved', () => {+ if (widgetWindow && !widgetWindow.isDestroyed()) {+ const [x, y] = widgetWindow.getPosition();+ saveWidgetPosition({ x, y });+ }+ });++ widgetWindow.on('closed', () => {+ widgetWindow = null;+ });++ widgetWindow.once('ready-to-show', () => {+ widgetWindow?.show();+ });++ return widgetWindow;+}++export function showWidgetWindow(): void {+ logger.info('showWidgetWindow called');+ if (!widgetWindow || widgetWindow.isDestroyed()) {+ createWidgetWindow();+ } else {+ widgetWindow.show();+ }+}++export function hideWidgetWindow(): void {+ if (widgetWindow && !widgetWindow.isDestroyed()) {+ widgetWindow.hide();+ }+}++export function closeWidgetWindow(): void {+ if (widgetWindow && !widgetWindow.isDestroyed()) {+ widgetWindow.close();+ widgetWindow = null;+ }+}++export function getWidgetWindow(): BrowserWindow | null {+ return widgetWindow && !widgetWindow.isDestroyed() ? widgetWindow : null;+}++export function sendToWidget(channel: string, data: unknown): void {+ if (widgetWindow && !widgetWindow.isDestroyed()) {+ logger.debug({ channel }, 'Sending to widget');+ widgetWindow.webContents.send(channel, data);+ } else {+ logger.warn({ channel }, 'Widget window not available, cannot send');+ }+}diff --git a/src/preload/widget.ts b/src/preload/widget.tsnew file mode 100644index 0000000..d51a423--- /dev/null+++ b/src/preload/widget.ts@@ -0,0 +1,92 @@+import { contextBridge, ipcRenderer } from 'electron';++export interface WidgetSessionState {+ isRecording: boolean;+ isPaused: boolean;+ isMicMuted: boolean;+ startTime: number | null;+}++export interface InsightCard {+ id: string;+ text: string;+ timestamp: number;+}++export interface WidgetLiveAssistData {+ sayThis: InsightCard[];+ askThis: InsightCard[];+}++export interface WidgetNudge {+ id: string;+ message: string;+ type: 'info' | 'warning' | 'action';+ timestamp: number;+}++export interface WidgetApi {+ // Actions+ pause: () => Promise<void>;+ resume: () => Promise<void>;+ stop: () => Promise<void>;+ hide: () => Promise<void>;+ muteMic: () => Promise<void>;+ unmuteMic: () => Promise<void>;+ dismissCard: (type: 'sayThis' | 'askThis', id: string) => Promise<void>;+ dismissNudge: (id: string) => Promise<void>;+ showMainWindow: () => Promise<void>;++ // Events+ onSessionState: (callback: (state: WidgetSessionState) => void) => () => void;+ onLiveAssist: (callback: (data: WidgetLiveAssistData) => void) => () => void;+ onVisualAnalysis: (callback: (data: { description: string }) => void) => () => void;+ onNudge: (callback: (nudge: WidgetNudge | null) => void) => () => void;++ // Initial state request+ requestInitialState: () => Promise<void>;+}++const widgetApi: WidgetApi = {+ // Actions+ pause: () => ipcRenderer.invoke('widget:pause'),+ resume: () => ipcRenderer.invoke('widget:resume'),+ stop: () => ipcRenderer.invoke('widget:stop'),+ hide: () => ipcRenderer.invoke('widget:hide'),+ muteMic: () => ipcRenderer.invoke('widget:mute-mic'),+ unmuteMic: () => ipcRenderer.invoke('widget:unmute-mic'),+ dismissCard: (type: 'sayThis' | 'askThis', id: string) =>+ ipcRenderer.invoke('widget:dismiss-card', type, id),+ dismissNudge: (id: string) => ipcRenderer.invoke('widget:dismiss-nudge', id),+ showMainWindow: () => ipcRenderer.invoke('widget:show-main-window'),++ // Events+ onSessionState: (callback: (state: WidgetSessionState) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, state: WidgetSessionState) => callback(state);+ ipcRenderer.on('widget:session-state', listener);+ return () => ipcRenderer.removeListener('widget:session-state', listener);+ },++ onLiveAssist: (callback: (data: WidgetLiveAssistData) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, data: WidgetLiveAssistData) => callback(data);+ ipcRenderer.on('widget:live-assist', listener);+ return () => ipcRenderer.removeListener('widget:live-assist', listener);+ },++ onVisualAnalysis: (callback: (data: { description: string }) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, data: { description: string }) => callback(data);+ ipcRenderer.on('widget:visual-analysis', listener);+ return () => ipcRenderer.removeListener('widget:visual-analysis', listener);+ },++ onNudge: (callback: (nudge: WidgetNudge | null) => void) => {+ const listener = (_event: Electron.IpcRendererEvent, nudge: WidgetNudge | null) => callback(nudge);+ ipcRenderer.on('widget:nudge', listener);+ return () => ipcRenderer.removeListener('widget:nudge', listener);+ },++ // Initial state request+ requestInitialState: () => ipcRenderer.invoke('widget:request-initial-state'),+};++contextBridge.exposeInMainWorld('widgetAPI', widgetApi);diff --git a/src/renderer/widget.html b/src/renderer/widget.htmlnew file mode 100644index 0000000..b83599f--- /dev/null+++ b/src/renderer/widget.html@@ -0,0 +1,35 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Live Assist</title>+ <link rel="preconnect" href="https://fonts.googleapis.com">+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">+ <style>+ * {+ box-sizing: border-box;+ margin: 0;+ padding: 0;+ }++ html, body {+ width: 100%;+ height: 100%;+ background: transparent;+ overflow: hidden;+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ }++ #root {+ width: 100%;+ height: 100%;+ }+ </style>+</head>+<body>+ <div id="root"></div>+ <script type="module" src="/widget/index.tsx"></script>+</body>+</html>diff --git a/src/renderer/widget/App.tsx b/src/renderer/widget/App.tsxnew file mode 100644index 0000000..7222c3f--- /dev/null+++ b/src/renderer/widget/App.tsx@@ -0,0 +1,125 @@+import React, { useEffect, useState, useCallback } from 'react';+import { WidgetContainer } from './components/WidgetContainer';+import { WidgetHeader } from './components/WidgetHeader';+import { WidgetContent } from './components/WidgetContent';+import { WidgetFooter } from './components/WidgetFooter';+import type {+ InsightCard,+ WidgetSessionState as SessionState,+ WidgetNudge as Nudge,+ WidgetLiveAssistData,+} from '../../types/widget';++export function WidgetApp() {+ const [sessionState, setSessionState] = useState<SessionState>({+ isRecording: true,+ isPaused: false,+ isMicMuted: false,+ startTime: Date.now(),+ });+ const [sayThis, setSayThis] = useState<InsightCard[]>([]);+ const [askThis, setAskThis] = useState<InsightCard[]>([]);+ const [visualDescription, setVisualDescription] = useState<string>('');+ const [nudge, setNudge] = useState<Nudge | null>(null);++ useEffect(() => {+ const api = window.widgetAPI;+ if (!api) return;++ // Request initial state+ api.requestInitialState();++ // Set up listeners+ const unsubSession = api.onSessionState((state) => {+ setSessionState(state);+ });++ const unsubLiveAssist = api.onLiveAssist((data) => {+ setSayThis(data.sayThis);+ setAskThis(data.askThis);+ });++ const unsubVisual = api.onVisualAnalysis((data) => {+ setVisualDescription(data.description);+ });++ const unsubNudge = api.onNudge((n) => {+ setNudge(n);+ });++ return () => {+ unsubSession();+ unsubLiveAssist();+ unsubVisual();+ unsubNudge();+ };+ }, []);++ // Auto-dismiss nudge after 5 seconds+ useEffect(() => {+ if (!nudge) return;+ const timer = setTimeout(() => {+ setNudge(null);+ }, 5000);+ return () => clearTimeout(timer);+ }, [nudge]);++ const handlePause = useCallback(async () => {+ await window.widgetAPI?.pause();+ }, []);++ const handleResume = useCallback(async () => {+ await window.widgetAPI?.resume();+ }, []);++ const handleStop = useCallback(async () => {+ await window.widgetAPI?.stop();+ }, []);++ const handleMuteMic = useCallback(async () => {+ await window.widgetAPI?.muteMic();+ }, []);++ const handleUnmuteMic = useCallback(async () => {+ await window.widgetAPI?.unmuteMic();+ }, []);++ const handleDismissCard = useCallback(async (type: 'sayThis' | 'askThis', id: string) => {+ await window.widgetAPI?.dismissCard(type, id);+ if (type === 'sayThis') {+ setSayThis((prev) => prev.filter((c) => c.id !== id));+ } else {+ setAskThis((prev) => prev.filter((c) => c.id !== id));+ }+ }, []);++ const handleDismissNudge = useCallback(async () => {+ if (nudge) {+ await window.widgetAPI?.dismissNudge(nudge.id);+ setNudge(null);+ }+ }, [nudge]);++ return (+ <WidgetContainer>+ <WidgetHeader />+ <WidgetContent+ sayThis={sayThis}+ askThis={askThis}+ visualDescription={visualDescription}+ nudge={nudge}+ onDismissCard={handleDismissCard}+ onDismissNudge={handleDismissNudge}+ />+ <WidgetFooter+ onStop={handleStop}+ isPaused={sessionState.isPaused}+ onPause={handlePause}+ onResume={handleResume}+ isMicMuted={sessionState.isMicMuted}+ onMuteMic={handleMuteMic}+ onUnmuteMic={handleUnmuteMic}+ />+ </WidgetContainer>+ );+}diff --git a/src/renderer/widget/components/AskThisCard.tsx b/src/renderer/widget/components/AskThisCard.tsxnew file mode 100644index 0000000..d05bf80--- /dev/null+++ b/src/renderer/widget/components/AskThisCard.tsx@@ -0,0 +1,97 @@+import React, { useState } from 'react';++function QuestionIcon() {+ 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="#3B82F6" strokeWidth="1.5" />+ <path+ d="M7.5 7.5C7.5 6.11929 8.61929 5 10 5C11.3807 5 12.5 6.11929 12.5 7.5C12.5 8.88071 11.3807 10 10 10V11.25"+ stroke="#3B82F6"+ strokeWidth="1.5"+ strokeLinecap="round"+ />+ <circle cx="10" cy="14" r="0.75" fill="#3B82F6" />+ </svg>+ );+}++function CheckboxEmpty() {+ return (+ <div+ style={{+ width: '16px',+ height: '16px',+ borderRadius: '4px',+ border: '1px solid #969696',+ background: 'white',+ }}+ />+ );+}++function CheckboxChecked() {+ return (+ <div+ style={{+ width: '16px',+ height: '16px',+ borderRadius: '4px',+ border: '1px solid #3B82F6',+ background: '#3B82F6',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ }}+ >+ <svg width="10" height="8" viewBox="0 0 10 8" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M1 4L3.5 6.5L9 1" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />+ </svg>+ </div>+ );+}++interface AskThisCardProps {+ text: string;+ onDismiss: () => void;+}++export function AskThisCard({ text, onDismiss }: AskThisCardProps) {+ const [isHovered, setIsHovered] = useState(false);+ const [isChecked, setIsChecked] = useState(false);++ const handleCheck = () => {+ setIsChecked(true);+ setTimeout(onDismiss, 200);+ };++ return (+ <div+ className="w-full flex items-start"+ style={{+ background: 'rgba(59, 130, 246, 0.2)',+ border: '1px solid rgba(59, 130, 246, 0.3)',+ borderRadius: '16px',+ boxShadow: '0px 1px 15px 0px rgba(0,0,0,0.05)',+ padding: '8px 12px',+ gap: '8px',+ }}+ onMouseEnter={() => setIsHovered(true)}+ onMouseLeave={() => setIsHovered(false)}+ >+ <div+ className="shrink-0 flex items-center justify-center cursor-pointer"+ style={{ width: '19px', height: '33px', paddingTop: '6px' }}+ onClick={handleCheck}+ >+ {isHovered || isChecked ? (+ isChecked ? <CheckboxChecked /> : <CheckboxEmpty />+ ) : (+ <QuestionIcon />+ )}+ </div>+ <p className="flex-1 text-black" style={{ fontSize: '14px', lineHeight: '22px' }}>+ {text}+ </p>+ </div>+ );+}diff --git a/src/renderer/widget/components/EmptyState.tsx b/src/renderer/widget/components/EmptyState.tsxnew file mode 100644index 0000000..b40ea4d--- /dev/null+++ b/src/renderer/widget/components/EmptyState.tsx@@ -0,0 +1,52 @@+import React from 'react';++// Lightbulb icon matching Figma design+function LightbulbIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M10 2.5C6.54822 2.5 3.75 5.29822 3.75 8.75C3.75 10.9196 4.86607 12.8304 6.5625 13.9062V15.625C6.5625 16.3154 7.12214 16.875 7.8125 16.875H12.1875C12.8779 16.875 13.4375 16.3154 13.4375 15.625V13.9062C15.1339 12.8304 16.25 10.9196 16.25 8.75C16.25 5.29822 13.4518 2.5 10 2.5Z"+ stroke="#EC5B16"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path d="M7.5 17.5H12.5" stroke="#EC5B16" strokeWidth="1.5" strokeLinecap="round" />+ </svg>+ );+}++export function EmptyState() {+ return (+ <div+ className="w-full flex flex-col"+ style={{+ background: '#F5F5F8',+ border: '1px solid rgba(0, 0, 0, 0.1)',+ borderRadius: '16px',+ padding: '12px',+ }}+ >+ <div className="flex flex-col items-center gap-2 w-full">+ <LightbulbIcon />+ <span+ className="font-medium text-black whitespace-nowrap"+ style={{ fontSize: '13px', lineHeight: '16px' }}+ >+ Conversation is flowing well+ </span>+ </div>+ <p+ className="text-center w-full"+ style={{+ fontSize: '13px',+ lineHeight: '22px',+ color: '#969696',+ marginTop: '2px',+ }}+ >+ cards will appear when key moments are detected.+ </p>+ </div>+ );+}diff --git a/src/renderer/widget/components/NudgeAlert.tsx b/src/renderer/widget/components/NudgeAlert.tsxnew file mode 100644index 0000000..7bbdf85--- /dev/null+++ b/src/renderer/widget/components/NudgeAlert.tsx@@ -0,0 +1,100 @@+import React from 'react';++// Warning/Alert icon matching Figma design+function AlertIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M8.57465 3.21665L1.51632 14.1667C1.37079 14.4187 1.29379 14.7044 1.29298 14.9954C1.29216 15.2864 1.36756 15.5726 1.51167 15.8254C1.65579 16.0783 1.86359 16.289 2.11441 16.4366C2.36523 16.5843 2.65032 16.6637 2.94132 16.6667H17.058C17.349 16.6637 17.6341 16.5843 17.8849 16.4366C18.1357 16.289 18.3435 16.0783 18.4876 15.8254C18.6317 15.5726 18.7071 15.2864 18.7063 14.9954C18.7055 14.7044 18.6285 14.4187 18.483 14.1667L11.4247 3.21665C11.2761 2.97174 11.0664 2.76925 10.8163 2.62913C10.5663 2.48901 10.2843 2.41553 9.99799 2.41553C9.71164 2.41553 9.42969 2.48901 9.17966 2.62913C8.92962 2.76925 8.71991 2.97174 8.57132 3.21665H8.57465Z"+ stroke="#CA8700"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M10 7.5V10.8333"+ stroke="#CA8700"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M10 14.1667H10.0083"+ stroke="#CA8700"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++// Close icon (X)+function CloseIcon() {+ return (+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M12 4L4 12"+ stroke="#CA8700"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M4 4L12 12"+ stroke="#CA8700"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++interface NudgeAlertProps {+ message: string;+ onDismiss: () => void;+}++export function NudgeAlert({ message, onDismiss }: NudgeAlertProps) {+ return (+ <div+ className="w-full flex items-center"+ style={{+ height: '61px',+ padding: '8px 12px',+ background: '#FFF8EF',+ border: '1px solid #F5D7AB',+ borderRadius: '12px',+ boxShadow: '0px 1.272px 15.267px 0px rgba(0,0,0,0.05)',+ gap: '10px',+ }}+ >+ <div className="shrink-0">+ <AlertIcon />+ </div>+ <p+ className="flex-1"+ style={{+ fontSize: '13px',+ lineHeight: '1.5',+ color: '#CA8700',+ }}+ >+ {message}+ </p>+ <button+ onClick={onDismiss}+ className="shrink-0 flex items-center justify-center hover:opacity-70 transition-opacity"+ style={{+ background: 'none',+ border: 'none',+ cursor: 'pointer',+ padding: 0,+ }}+ >+ <CloseIcon />+ </button>+ </div>+ );+}diff --git a/src/renderer/widget/components/SayThisCard.tsx b/src/renderer/widget/components/SayThisCard.tsxnew file mode 100644index 0000000..542401e--- /dev/null+++ b/src/renderer/widget/components/SayThisCard.tsx@@ -0,0 +1,118 @@+import React, { useState } from 'react';++function SpeechBubbleIcon() {+ return (+ <svg width="18" height="14" viewBox="0 0 18 14" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M17 7C17 3.68629 13.4183 1 9 1C4.58172 1 1 3.68629 1 7C1 8.59135 1.7932 10.0348 3.10493 11.1115C3.03179 11.9877 2.77749 12.8443 2.3619 13.6286C2.2619 13.8166 2.41279 14.0418 2.62152 14.0058C4.34295 13.7099 5.88965 13.0271 6.98166 12.1626C7.63138 12.3815 8.32547 12.5 9.04348 12.5C13.4183 12.5 17 10.3137 17 7Z"+ stroke="#EC5B16"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++function CheckboxEmpty() {+ return (+ <div+ style={{+ width: '16px',+ height: '16px',+ borderRadius: '4px',+ border: '1px solid #969696',+ background: 'white',+ }}+ />+ );+}++function CheckboxChecked() {+ return (+ <div+ style={{+ width: '16px',+ height: '16px',+ borderRadius: '4px',+ border: '1px solid #EC5B16',+ background: '#EC5B16',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ }}+ >+ <svg width="10" height="8" viewBox="0 0 10 8" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M1 4L3.5 6.5L9 1"+ stroke="white"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ </div>+ );+}++interface SayThisCardProps {+ text: string;+ onDismiss: () => void;+}++export function SayThisCard({ text, onDismiss }: SayThisCardProps) {+ const [isHovered, setIsHovered] = useState(false);+ const [isChecked, setIsChecked] = useState(false);++ const handleCheck = () => {+ setIsChecked(true);+ setTimeout(onDismiss, 200);+ };++ return (+ <div+ className="w-full flex items-start"+ style={{+ background: 'rgba(236, 91, 22, 0.2)',+ border: '1px solid rgba(236, 91, 22, 0.3)',+ borderRadius: '16px',+ boxShadow: '0px 1px 15px 0px rgba(0,0,0,0.05)',+ padding: '8px 12px',+ gap: '8px',+ }}+ onMouseEnter={() => setIsHovered(true)}+ onMouseLeave={() => setIsHovered(false)}+ >+ {/* Checkbox area */}+ <div+ className="shrink-0 flex items-center justify-center cursor-pointer"+ style={{+ width: '19px',+ height: '33px',+ paddingTop: '6px',+ }}+ onClick={handleCheck}+ >+ {isHovered || isChecked ? (+ isChecked ? (+ <CheckboxChecked />+ ) : (+ <CheckboxEmpty />+ )+ ) : (+ <SpeechBubbleIcon />+ )}+ </div>+ {/* Content */}+ <p+ className="flex-1 text-black"+ style={{+ fontSize: '14px',+ lineHeight: '22px',+ }}+ >+ {text}+ </p>+ </div>+ );+}diff --git a/src/renderer/widget/components/VisualAnalysisCard.tsx b/src/renderer/widget/components/VisualAnalysisCard.tsxnew file mode 100644index 0000000..ab7ecfb--- /dev/null+++ b/src/renderer/widget/components/VisualAnalysisCard.tsx@@ -0,0 +1,73 @@+import React from 'react';++function DisplayIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M16.6667 3.33334H3.33333C2.41286 3.33334 1.66666 4.07954 1.66666 5V12.5C1.66666 13.4205 2.41286 14.1667 3.33333 14.1667H16.6667C17.5871 14.1667 18.3333 13.4205 18.3333 12.5V5C18.3333 4.07954 17.5871 3.33334 16.6667 3.33334Z"+ stroke="black"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M10 14.1667V17.5"+ stroke="black"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M6.66666 17.5H13.3333"+ stroke="black"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++interface VisualAnalysisCardProps {+ description: string;+}++export function VisualAnalysisCard({ description }: VisualAnalysisCardProps) {+ return (+ <div+ className="w-full flex flex-col"+ style={{+ position: 'sticky',+ top: 0,+ zIndex: 10,+ background: 'rgba(247, 247, 247, 0.95)',+ border: '1px solid rgba(0, 0, 0, 0.1)',+ borderRadius: '15px',+ boxShadow: '0px 1px 15px 0px rgba(0,0,0,0.05)',+ padding: '8px 12px',+ gap: '10px',+ }}+ >+ {/* Header */}+ <div className="flex items-center gap-2 w-full">+ <DisplayIcon />+ <span+ className="font-medium text-black whitespace-nowrap"+ style={{ fontSize: '13px', lineHeight: '16px' }}+ >+ Visual Analysis+ </span>+ </div>+ {/* Description */}+ <p+ className="w-full text-black"+ style={{+ fontSize: '14px',+ lineHeight: '22px',+ }}+ >+ {description}+ </p>+ </div>+ );+}diff --git a/src/renderer/widget/components/WidgetContainer.tsx b/src/renderer/widget/components/WidgetContainer.tsxnew file mode 100644index 0000000..a94d174--- /dev/null+++ b/src/renderer/widget/components/WidgetContainer.tsx@@ -0,0 +1,25 @@+import React from 'react';++interface WidgetContainerProps {+ children: React.ReactNode;+}++export function WidgetContainer({ children }: WidgetContainerProps) {+ return (+ <div+ className="w-full h-full flex flex-col overflow-hidden"+ style={{+ borderRadius: '20.484px',+ border: '1px solid rgba(150, 150, 150, 0.3)',+ boxShadow: `-197px 225px 84px 0px rgba(0,0,0,0),+ -126px 144px 77px 0px rgba(0,0,0,0.01),+ -71px 81px 65px 0px rgba(0,0,0,0.05),+ -32px 36px 48px 0px rgba(0,0,0,0.09),+ -8px 9px 26px 0px rgba(0,0,0,0.1)`,+ background: '#ffffff',+ }}+ >+ {children}+ </div>+ );+}diff --git a/src/renderer/widget/components/WidgetContent.tsx b/src/renderer/widget/components/WidgetContent.tsxnew file mode 100644index 0000000..1ed8361--- /dev/null+++ b/src/renderer/widget/components/WidgetContent.tsx@@ -0,0 +1,104 @@+import React from 'react';+import { VisualAnalysisCard } from './VisualAnalysisCard';+import { SayThisCard } from './SayThisCard';+import { AskThisCard } from './AskThisCard';+import { EmptyState } from './EmptyState';+import { NudgeAlert } from './NudgeAlert';++interface InsightCard {+ id: string;+ text: string;+ timestamp: number;+}++interface Nudge {+ id: string;+ message: string;+ type: 'info' | 'warning' | 'action';+ timestamp: number;+}++interface WidgetContentProps {+ sayThis: InsightCard[];+ askThis: InsightCard[];+ visualDescription: string;+ nudge?: Nudge | null;+ onDismissCard: (type: 'sayThis' | 'askThis', id: string) => void;+ onDismissNudge?: () => void;+}++// Combine and sort cards by timestamp, interleaving Say This and Ask This+function getInterleavedCards(+ sayThis: InsightCard[],+ askThis: InsightCard[]+): Array<{ type: 'sayThis' | 'askThis'; card: InsightCard }> {+ const allCards: Array<{ type: 'sayThis' | 'askThis'; card: InsightCard }> = [+ ...sayThis.map((card) => ({ type: 'sayThis' as const, card })),+ ...askThis.map((card) => ({ type: 'askThis' as const, card })),+ ];++ // Sort by timestamp, newest first+ allCards.sort((a, b) => b.card.timestamp - a.card.timestamp);++ return allCards;+}++export function WidgetContent({+ sayThis,+ askThis,+ visualDescription,+ nudge,+ onDismissCard,+ onDismissNudge,+}: WidgetContentProps) {+ const hasCards = sayThis.length > 0 || askThis.length > 0;+ const isEmpty = !hasCards && !visualDescription;++ const interleavedCards = getInterleavedCards(sayThis, askThis);++ return (+ <div+ className="flex-1 min-h-0 flex flex-col overflow-y-auto"+ style={{+ padding: '20px 16px',+ gap: '16px',+ background: 'rgba(247, 247, 247, 0.9)',+ border: '1px solid #EFEFEF',+ borderTop: 'none',+ }}+ >+ {/* Nudge Alert - shown at top when present */}+ {nudge && onDismissNudge && (+ <NudgeAlert message={nudge.message} onDismiss={onDismissNudge} />+ )}++ {isEmpty ? (+ <EmptyState />+ ) : (+ <>+ {/* Visual Analysis - sticky at top */}+ {visualDescription && (+ <VisualAnalysisCard description={visualDescription} />+ )}++ {/* Interleaved Say This / Ask This cards */}+ {interleavedCards.map(({ type, card }) =>+ type === 'sayThis' ? (+ <SayThisCard+ key={card.id}+ text={card.text}+ onDismiss={() => onDismissCard('sayThis', card.id)}+ />+ ) : (+ <AskThisCard+ key={card.id}+ text={card.text}+ onDismiss={() => onDismissCard('askThis', card.id)}+ />+ )+ )}+ </>+ )}+ </div>+ );+}diff --git a/src/renderer/widget/components/WidgetFooter.tsx b/src/renderer/widget/components/WidgetFooter.tsxnew file mode 100644index 0000000..b194577--- /dev/null+++ b/src/renderer/widget/components/WidgetFooter.tsx@@ -0,0 +1,192 @@+import React from 'react';++function MicIcon({ muted = false }: { muted?: boolean }) {+ const strokeColor = muted ? '#EF4444' : '#2D2D2D';+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M10 1.66666C9.11594 1.66666 8.26809 2.01785 7.643 2.643C7.0179 3.26809 6.66671 4.11594 6.66671 5V10C6.66671 10.8841 7.0179 11.7319 7.643 12.357C8.26809 12.9821 9.11594 13.3333 10 13.3333C10.8841 13.3333 11.732 12.9821 12.357 12.357C12.9822 11.7319 13.3334 10.8841 13.3334 10V5C13.3334 4.11594 12.9822 3.26809 12.357 2.643C11.732 2.01785 10.8841 1.66666 10 1.66666Z"+ stroke={strokeColor}+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M16.6667 8.33334V10C16.6667 11.7681 15.9643 13.4638 14.714 14.714C13.4638 15.9643 11.7681 16.6667 10 16.6667C8.23189 16.6667 6.53619 15.9643 5.28595 14.714C4.03571 13.4638 3.33333 11.7681 3.33333 10V8.33334"+ stroke={strokeColor}+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M10 16.6667V18.3333"+ stroke={strokeColor}+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ {muted && (+ <path+ d="M3 3L17 17"+ stroke={strokeColor}+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ )}+ </svg>+ );+}++function PauseIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <rect x="5" y="3.5" width="3.75" height="13" rx="1" fill="#2D2D2D" />+ <rect x="11.25" y="3.5" width="3.75" height="13" rx="1" fill="#2D2D2D" />+ </svg>+ );+}++function PlayIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M6 4.5V15.5L16 10L6 4.5Z"+ fill="#2D2D2D"+ stroke="#2D2D2D"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++function StopIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <rect x="4" y="4" width="12" height="12" rx="2" fill="white" />+ </svg>+ );+}++interface WidgetFooterProps {+ onStop: () => void;+ isPaused?: boolean;+ onPause?: () => void;+ onResume?: () => void;+ isMicMuted?: boolean;+ onMuteMic?: () => void;+ onUnmuteMic?: () => void;+}++export function WidgetFooter({+ onStop,+ isPaused = false,+ onPause,+ onResume,+ isMicMuted = false,+ onMuteMic,+ onUnmuteMic,+}: WidgetFooterProps) {+ const handlePauseResume = () => {+ if (isPaused) {+ onResume?.();+ } else {+ onPause?.();+ }+ };++ const handleMicToggle = () => {+ if (isMicMuted) {+ onUnmuteMic?.();+ } else {+ onMuteMic?.();+ }+ };++ return (+ <div+ className="flex items-center justify-center bg-white"+ style={{+ height: '72px',+ padding: '12px 16px',+ gap: '8px',+ borderTop: '1px solid #EFEFEF',+ }}+ >+ {/* Mic Button */}+ <button+ onClick={handleMicToggle}+ className="flex items-center justify-center shrink-0 hover:bg-gray-100 transition-colors"+ style={{+ width: '40px',+ height: '40px',+ borderRadius: '50%',+ border: isMicMuted ? '1px solid #EF4444' : '1px solid rgba(150, 150, 150, 0.2)',+ background: isMicMuted ? 'rgba(239, 68, 68, 0.1)' : 'white',+ cursor: 'pointer',+ padding: '10px',+ }}+ title={isMicMuted ? 'Unmute microphone' : 'Mute microphone'}+ >+ <MicIcon muted={isMicMuted} />+ </button>++ {/* Pause/Resume Recording Button */}+ <button+ onClick={handlePauseResume}+ className="flex-1 flex items-center justify-center gap-1.5 hover:bg-gray-50 transition-colors"+ style={{+ height: '40px',+ borderRadius: '12px',+ border: '1px solid rgba(150, 150, 150, 0.2)',+ background: 'white',+ boxShadow: '0px 1px 15px 0px rgba(0,0,0,0.05)',+ cursor: 'pointer',+ paddingLeft: '12px',+ paddingRight: '16px',+ }}+ >+ {isPaused ? <PlayIcon /> : <PauseIcon />}+ <span+ className="font-semibold whitespace-nowrap"+ style={{+ fontSize: '14px',+ lineHeight: '1.4',+ color: '#2D2D2D',+ letterSpacing: '-0.28px',+ }}+ >+ {isPaused ? 'Resume Recording' : 'Pause Recording'}+ </span>+ </button>++ {/* Stop Button */}+ <button+ onClick={onStop}+ className="flex items-center justify-center gap-1 shrink-0 transition-all hover:bg-red-600"+ style={{+ background: '#EF4444',+ borderRadius: '12px',+ padding: '10px 30px 10px 24px',+ boxShadow: '0px 1px 15px 0px rgba(0,0,0,0.05)',+ border: 'none',+ cursor: 'pointer',+ }}+ >+ <StopIcon />+ <span+ className="font-semibold text-white whitespace-nowrap"+ style={{+ fontSize: '14px',+ lineHeight: '1.4',+ letterSpacing: '-0.28px',+ }}+ >+ Stop+ </span>+ </button>+ </div>+ );+}diff --git a/src/renderer/widget/components/WidgetHeader.tsx b/src/renderer/widget/components/WidgetHeader.tsxnew file mode 100644index 0000000..803fe91--- /dev/null+++ b/src/renderer/widget/components/WidgetHeader.tsx@@ -0,0 +1,129 @@+import React from 'react';++function SparkleIcon() {+ return (+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M10 2L11.5 7L16.5 8.5L11.5 10L10 15L8.5 10L3.5 8.5L8.5 7L10 2Z"+ stroke="#EC5B16"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M15 12L15.75 14.25L18 15L15.75 15.75L15 18L14.25 15.75L12 15L14.25 14.25L15 12Z"+ stroke="#EC5B16"+ strokeWidth="1.2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++function PopOutIcon() {+ return (+ <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path+ d="M9 3H5C3.89543 3 3 3.89543 3 5V17C3 18.1046 3.89543 19 5 19H17C18.1046 19 19 18.1046 19 17V13"+ stroke="#969696"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M13 3H19V9"+ stroke="#969696"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M19 3L10 12"+ stroke="#969696"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++function CloseIcon() {+ return (+ <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">+ <circle cx="11" cy="11" r="8" stroke="#969696" strokeWidth="1.5" />+ <path+ d="M8 8L14 14"+ stroke="#969696"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M14 8L8 14"+ stroke="#969696"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++export function WidgetHeader() {+ const handlePopOut = () => {+ window.widgetAPI?.showMainWindow();+ };++ const handleClose = () => {+ window.widgetAPI?.hide();+ };++ return (+ <div+ className="flex items-center justify-between bg-white"+ style={{+ height: '51px',+ padding: '12px 16px',+ gap: '12px',+ borderBottom: '1px solid #EFEFEF',+ WebkitAppRegion: 'drag',+ } as React.CSSProperties}+ >+ {/* Left: Sparkle icon + Title */}+ <div className="flex items-center gap-2 flex-1">+ <SparkleIcon />+ <span+ className="font-medium text-black whitespace-nowrap"+ style={{ fontSize: '15px', lineHeight: 'normal' }}+ >+ Live Assist+ </span>+ </div>++ {/* Right: Icons */}+ <div+ className="flex items-center"+ style={{ gap: '14px', WebkitAppRegion: 'no-drag' } as React.CSSProperties}+ >+ <button+ onClick={handlePopOut}+ className="flex items-center justify-center hover:opacity-70 transition-opacity"+ style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}+ title="Open main window"+ >+ <PopOutIcon />+ </button>+ <button+ onClick={handleClose}+ className="flex items-center justify-center hover:opacity-70 transition-opacity"+ style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}+ title="Hide widget"+ >+ <CloseIcon />+ </button>+ </div>+ </div>+ );+}diff --git a/src/renderer/widget/index.tsx b/src/renderer/widget/index.tsxnew file mode 100644index 0000000..dc28c1f--- /dev/null+++ b/src/renderer/widget/index.tsx@@ -0,0 +1,14 @@+import React from 'react';+import { createRoot } from 'react-dom/client';+import { WidgetApp } from './App';+import '../styles/globals.css';++const container = document.getElementById('root');+if (container) {+ const root = createRoot(container);+ root.render(+ <React.StrictMode>+ <WidgetApp />+ </React.StrictMode>+ );+}diff --git a/src/shared/schemas/config.schema.ts b/src/shared/schemas/config.schema.tsindex 1d15dab..1ea935f 100644--- a/src/shared/schemas/config.schema.ts+++ b/src/shared/schemas/config.schema.ts@@ -1,11 +1,19 @@import { z } from 'zod';+export const WidgetPositionSchema = z.object({+ x: z.number(),+ y: z.number(),+});+export const AppConfigSchema = z.object({accessToken: z.string().optional(),userName: z.string().optional(),apiKey: z.string().optional(),+ widgetPosition: WidgetPositionSchema.optional(),});+export type WidgetPosition = z.infer<typeof WidgetPositionSchema>;+export const RuntimeConfigSchema = z.object({apiUrl: z.string().optional(),apiPort: z.number().default(51731),diff --git a/src/types/assets.d.ts b/src/types/assets.d.tsnew file mode 100644index 0000000..2c451b4--- /dev/null+++ b/src/types/assets.d.ts@@ -0,0 +1,40 @@+// Asset module declarations for TypeScript+declare module '*.png' {+ const src: string;+ export default src;+}++declare module '*.jpg' {+ const src: string;+ export default src;+}++declare module '*.jpeg' {+ const src: string;+ export default src;+}++declare module '*.svg' {+ const src: string;+ export default src;+}++declare module '*.gif' {+ const src: string;+ export default src;+}++declare module '*.mp4' {+ const src: string;+ export default src;+}++declare module '*.webm' {+ const src: string;+ export default src;+}++declare module '*.webp' {+ const src: string;+ export default src;+}diff --git a/src/types/widget.d.ts b/src/types/widget.d.tsnew file mode 100644index 0000000..419a537--- /dev/null+++ b/src/types/widget.d.ts@@ -0,0 +1,51 @@+export interface WidgetSessionState {+ isRecording: boolean;+ isPaused: boolean;+ isMicMuted: boolean;+ startTime: number | null;+}++export interface InsightCard {+ id: string;+ text: string;+ timestamp: number;+}++export interface WidgetLiveAssistData {+ sayThis: InsightCard[];+ askThis: InsightCard[];+}++export interface WidgetNudge {+ id: string;+ message: string;+ type: 'info' | 'warning' | 'action';+ timestamp: number;+}++export interface WidgetApi {+ pause: () => Promise<void>;+ resume: () => Promise<void>;+ stop: () => Promise<void>;+ hide: () => Promise<void>;+ muteMic: () => Promise<void>;+ unmuteMic: () => Promise<void>;+ dismissCard: (type: 'sayThis' | 'askThis', id: string) => Promise<void>;+ dismissNudge: (id: string) => Promise<void>;+ showMainWindow: () => Promise<void>;+ onSessionState: (callback: (state: WidgetSessionState) => void) => () => void;+ onLiveAssist: (callback: (data: WidgetLiveAssistData) => void) => () => void;+ onVisualAnalysis: (callback: (data: { description: string }) => void) => () => void;+ onNudge: (callback: (nudge: WidgetNudge | null) => void) => () => void;+ requestInitialState: () => Promise<void>;+}++// Extend the Window interface+declare global {+ interface Window {+ widgetAPI?: WidgetApi;+ }+}++// This export is needed to make this a module+export {};diff --git a/vite.config.ts b/vite.config.tsindex 71a1e83..5ad89f1 100644--- a/vite.config.ts+++ b/vite.config.ts@@ -10,6 +10,12 @@ export default defineConfig({outDir: '../../dist/renderer',emptyOutDir: true,sourcemap: true,+ rollupOptions: {+ input: {+ main: path.resolve(__dirname, 'src/renderer/index.html'),+ widget: path.resolve(__dirname, 'src/renderer/widget.html'),+ },+ },},resolve: {alias: {@@ -20,5 +26,11 @@ export default defineConfig({server: {port: 51730,strictPort: false, // Will find next available port if busy+ // Ensure all HTML files are accessible+ fs: {+ allow: ['..'],+ },},+ // Ensure widget.html is accessible in dev mode+ appType: 'mpa',});