Turn meetings into live agent loops. Record, transcribe, and analyze meetings with real-time AI intelligence — before, during, and after calls.
fix: features cleanup
Om Gate79277371d233
diff --git a/src/main/ipc/copilot.ts b/src/main/ipc/copilot.tsindex b9dbea4..7ef0d97 100644--- a/src/main/ipc/copilot.ts+++ b/src/main/ipc/copilot.ts@@ -11,15 +11,9 @@ import {getMeetingCopilot,type CopilotConfig,type ConversationMetrics,- type SentimentTrend,type Nudge,- type CueCardTriggerData,- type PlaybookItem,- type PlaybookSnapshot,type CallSummary,} from '../services/copilot';-import { getAllPlaybooks, getAllCueCards, getBookmarksByRecording, createBookmark } from '../db';-import { v4 as uuid } from 'uuid';const logger = createChildLogger('copilot-ipc');@@ -58,25 +52,12 @@ export function setupCopilotHandlers(): void {sendToRenderer('copilot:metrics', data);});- copilot.on('sentiment-update', (data: { sentiment: SentimentTrend }) => {- sendToRenderer('copilot:sentiment', data);- });-copilot.on('nudge', (data: { nudge: Nudge }) => {sendToRenderer('copilot:nudge', data);});- copilot.on('cue-card', (data: { cueCard: CueCardTriggerData }) => {- sendToRenderer('copilot:cue-card', data);- });-- copilot.on('playbook-update', (data: { item: PlaybookItem; snapshot: PlaybookSnapshot }) => {- sendToRenderer('copilot:playbook', data);- });-copilot.on('call-ended', (data: {summary: CallSummary;- playbook?: PlaybookSnapshot;metrics: ConversationMetrics;duration: number;}) => {@@ -166,16 +147,12 @@ export function setupCopilotHandlers(): void {try {const state = copilot.getCallState();const metrics = copilot.getCurrentMetrics();- const sentiment = copilot.getCurrentSentiment();- const playbook = copilot.getPlaybookSnapshot();return {success: true,data: {state,metrics,- sentiment,- playbook,isActive: copilot.isCallActive(),},};@@ -185,45 +162,6 @@ export function setupCopilotHandlers(): void {}});- /**- * Dismiss a cue card- */- ipcMain.handle('copilot:dismiss-cue-card', async (_event, triggerId: string) => {- try {- copilot.dismissCueCard(triggerId);- return { success: true };- } catch (error) {- logger.error({ error }, 'Failed to dismiss cue card');- return { success: false, error: (error as Error).message };- }- });-- /**- * Pin a cue card- */- ipcMain.handle('copilot:pin-cue-card', async (_event, triggerId: string) => {- try {- copilot.pinCueCard(triggerId);- return { success: true };- } catch (error) {- logger.error({ error }, 'Failed to pin cue card');- return { success: false, error: (error as Error).message };- }- });-- /**- * Submit cue card feedback- */- ipcMain.handle('copilot:cue-card-feedback', async (_event, triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant') => {- try {- copilot.submitCueCardFeedback(triggerId, feedback);- return { success: true };- } catch (error) {- logger.error({ error }, 'Failed to submit feedback');- return { success: false, error: (error as Error).message };- }- });-/*** Dismiss a nudge*/@@ -237,94 +175,6 @@ export function setupCopilotHandlers(): void {}});- /**- * Get all playbooks- */- ipcMain.handle('copilot:get-playbooks', async () => {- try {- const playbooks = getAllPlaybooks();- return {- success: true,- playbooks: playbooks.map(p => ({- id: p.id,- name: p.name,- type: p.type,- description: p.description,- isDefault: p.isDefault,- items: JSON.parse(p.items),- })),- };- } catch (error) {- logger.error({ error }, 'Failed to get playbooks');- return { success: false, error: (error as Error).message };- }- });-- /**- * Get all cue cards- */- ipcMain.handle('copilot:get-cue-cards', async () => {- try {- const cards = getAllCueCards();- return {- success: true,- cueCards: cards.map(c => ({- id: c.id,- objectionType: c.objectionType,- title: c.title,- talkTracks: JSON.parse(c.talkTracks),- followUpQuestions: JSON.parse(c.followUpQuestions),- proofPoints: c.proofPoints ? JSON.parse(c.proofPoints) : undefined,- avoidSaying: c.avoidSaying ? JSON.parse(c.avoidSaying) : undefined,- sourceDoc: c.sourceDoc,- isDefault: c.isDefault,- })),- };- } catch (error) {- logger.error({ error }, 'Failed to get cue cards');- return { success: false, error: (error as Error).message };- }- });-- /**- * Create a bookmark- */- ipcMain.handle('copilot:create-bookmark', async (_event, data: {- recordingId: number;- segmentId?: string;- timestamp: number;- category: string;- note?: string;- }) => {- try {- const bookmark = createBookmark({- id: uuid(),- recordingId: data.recordingId,- segmentId: data.segmentId || null,- timestamp: data.timestamp,- category: data.category as any,- note: data.note || null,- });- return { success: true, bookmark };- } catch (error) {- logger.error({ error }, 'Failed to create bookmark');- return { success: false, error: (error as Error).message };- }- });-- /**- * Get bookmarks for a recording- */- ipcMain.handle('copilot:get-bookmarks', async (_event, recordingId: number) => {- try {- const bookmarks = getBookmarksByRecording(recordingId);- return { success: true, bookmarks };- } catch (error) {- logger.error({ error }, 'Failed to get bookmarks');- return { success: false, error: (error as Error).message };- }- });-logger.info('Meeting Co-Pilot IPC handlers registered');}@@ -338,14 +188,7 @@ export function removeCopilotHandlers(): void {ipcMain.removeHandler('copilot:transcript');ipcMain.removeHandler('copilot:update-config');ipcMain.removeHandler('copilot:get-state');- ipcMain.removeHandler('copilot:dismiss-cue-card');- ipcMain.removeHandler('copilot:pin-cue-card');- ipcMain.removeHandler('copilot:cue-card-feedback');ipcMain.removeHandler('copilot:dismiss-nudge');- ipcMain.removeHandler('copilot:get-playbooks');- ipcMain.removeHandler('copilot:get-cue-cards');- ipcMain.removeHandler('copilot:create-bookmark');- ipcMain.removeHandler('copilot:get-bookmarks');logger.info('Meeting Co-Pilot IPC handlers removed');}diff --git a/src/main/services/copilot/conversation-metrics.service.ts b/src/main/services/copilot/conversation-metrics.service.tsindex 98dba5d..5beb6b8 100644--- a/src/main/services/copilot/conversation-metrics.service.ts+++ b/src/main/services/copilot/conversation-metrics.service.ts@@ -165,39 +165,38 @@ export class ConversationMetricsService {/*** Calculate words per minute- * Falls back to call duration if segment durations are not available+ * Uses the time span from first to last segment for accurate calculation*/private calculatePace(segments: TranscriptSegmentData[], callDurationSeconds?: number): number {if (segments.length === 0) return 0;const totalWords = this.countWords(segments);-- // First try to use actual speaking duration from segments- const speakingDuration = this.calculateDuration(segments);-- // If we have valid speaking duration, use it- if (speakingDuration > 0) {- const speakingMinutes = speakingDuration / 60;- return speakingMinutes > 0 ? Math.round(totalWords / speakingMinutes) : 0;- }-- // Fallback: estimate based on call duration (assume ~40% speaking time)- if (callDurationSeconds && callDurationSeconds > 0 && totalWords > 0) {- // Estimate speaking time as 40% of call duration for "me" channel- const estimatedSpeakingMinutes = (callDurationSeconds * 0.4) / 60;- if (estimatedSpeakingMinutes > 0) {- return Math.round(totalWords / estimatedSpeakingMinutes);- }+ if (totalWords === 0) return 0;++ // Calculate the time span from first to last segment+ // This represents the period over which the user was speaking+ const firstSegment = segments[0];+ const lastSegment = segments[segments.length - 1];+ const timeSpanSeconds = lastSegment.endTime - firstSegment.startTime;++ // Use the time span if it's reasonable (> 5 seconds)+ if (timeSpanSeconds > 5) {+ const timeSpanMinutes = timeSpanSeconds / 60;+ const rawWpm = Math.round(totalWords / timeSpanMinutes);++ // Clamp to realistic range (50-250 WPM)+ // Normal speech is 120-150 WPM, fast is 150-180, very fast is 180++ return Math.min(250, Math.max(50, rawWpm));}- // Last fallback: if we have words but no duration info, estimate based on average WPM- // Average speaking rate is ~130 WPM, so we can reverse-estimate- if (totalWords > 0 && segments.length > 0) {- // Assume each segment represents ~3 seconds of speech on average- const estimatedMinutes = (segments.length * 3) / 60;- return estimatedMinutes > 0 ? Math.round(totalWords / estimatedMinutes) : 130; // Default to average+ // Fallback: use call duration if available+ if (callDurationSeconds && callDurationSeconds > 10) {+ const callMinutes = callDurationSeconds / 60;+ const rawWpm = Math.round(totalWords / callMinutes);+ return Math.min(250, Math.max(0, rawWpm));}+ // For very short calls, return 0 (not enough data)return 0;}diff --git a/src/main/services/copilot/cue-card-engine.service.ts b/src/main/services/copilot/cue-card-engine.service.tsdeleted file mode 100644index 1fa21b7..0000000--- a/src/main/services/copilot/cue-card-engine.service.ts+++ /dev/null@@ -1,503 +0,0 @@-/**- * Cue Card Engine Service- *- * Detects objections in participant statements using keyword patterns and LLM- * classification. Retrieves relevant cue card content with talk tracks- * and follow-up questions.- */--import { v4 as uuid } from 'uuid';-import { logger } from '../../lib/logger';-import { getLLMService } from '../llm.service';-import {- getCueCardsByType,- createCueCardTrigger,- updateCueCardTrigger,-} from '../../db';-import type { TranscriptSegmentData } from './transcript-buffer.service';--const log = logger.child({ module: 'cue-card-engine' });--// Types--export type ObjectionType =- | 'pricing'- | 'timing'- | 'competitor'- | 'authority'- | 'security'- | 'integration'- | 'not_interested'- | 'send_info';--export interface CueCardContent {- id: string;- objectionType: ObjectionType;- title: string;- talkTracks: string[];- followUpQuestions: string[];- proofPoints?: string[];- avoidSaying?: string[];- sourceDoc?: string;- confidence: number;-}--export interface CueCardTriggerData extends CueCardContent {- triggerId: string;- triggerText: string;- segmentId: string;- timestamp: number;- status: 'active' | 'pinned' | 'dismissed';-}--export interface ObjectionDetectionResult {- detected: boolean;- objectionType?: ObjectionType;- confidence: number;- triggerText?: string;-}--// Detection Patterns--const DETECTION_PATTERNS: Record<ObjectionType, RegExp[]> = {- pricing: [- /\b(too expensive|budget|cost|price|cheaper|affordable|expensive)\b/i,- /\b(out of our budget|can't afford|cost.*concern|pricing.*issue)\b/i,- /\b(how much|what.*price|what.*cost)\b/i,- ],- timing: [- /\b(not ready|later|next quarter|timing|busy|bandwidth)\b/i,- /\b(not the right time|maybe.*later|revisit.*later)\b/i,- /\b(too busy|lot going on|other priorities)\b/i,- ],- competitor: [- /\b(already using|current solution|competitor|alternative)\b/i,- /\b(salesforce|hubspot|zendesk|other.*tool|similar.*product)\b/i,- /\b(comparing|evaluate|looking at.*options)\b/i,- ],- authority: [- /\b(need to ask|check with|decision maker|not my decision)\b/i,- /\b(run.*by|get approval|boss|manager|team)\b/i,- /\b(can't decide|not authorized|need.*sign off)\b/i,- ],- security: [- /\b(security|compliance|GDPR|SOC2|data privacy|secure)\b/i,- /\b(where.*data.*stored|encryption|audit)\b/i,- /\b(privacy.*concern|data.*protection)\b/i,- ],- integration: [- /\b(integrate|integration|API|compatible|works with)\b/i,- /\b(connect.*with|sync.*with|work.*with.*existing)\b/i,- /\b(technical.*requirements|implementation)\b/i,- ],- not_interested: [- /\b(not interested|don't need|not for us|pass)\b/i,- /\b(happy with|satisfied|don't see.*need)\b/i,- /\b(not.*priority|not looking)\b/i,- ],- send_info: [- /\b(send.*info|send.*details|email.*information)\b/i,- /\b(follow up|get back|more.*information)\b/i,- /\b(think about|consider)\b/i,- ],-};--// Cue Card Engine Service--export class CueCardEngineService {- private recentTriggers: Map<string, number> = new Map(); // objectionType -> timestamp- private readonly TRIGGER_COOLDOWN = 60000; // 1 minute between same type-- constructor() {}-- /**- * Detect objection in a segment (fast, pattern-based)- */- detectObjectionFast(segment: TranscriptSegmentData): ObjectionDetectionResult {- // Only check other participant ("them") statements- if (segment.channel !== 'them') {- return { detected: false, confidence: 0 };- }-- const text = segment.text.toLowerCase();-- for (const [type, patterns] of Object.entries(DETECTION_PATTERNS)) {- for (const pattern of patterns) {- if (pattern.test(text)) {- // Check cooldown- const lastTrigger = this.recentTriggers.get(type);- if (lastTrigger && Date.now() - lastTrigger < this.TRIGGER_COOLDOWN) {- continue;- }-- return {- detected: true,- objectionType: type as ObjectionType,- confidence: 0.7,- triggerText: segment.text,- };- }- }- }-- return { detected: false, confidence: 0 };- }-- /**- * Detect objection using LLM for ambiguous cases- */- async detectObjectionWithLLM(- segment: TranscriptSegmentData,- context: string- ): Promise<ObjectionDetectionResult> {- if (segment.channel !== 'them') {- return { detected: false, confidence: 0 };- }-- const llm = getLLMService();-- const prompt = `Analyze this participant statement in a meeting for objections.--Context (recent conversation):-${context}--Current statement: "${segment.text}"--Objection categories:-- pricing: concerns about cost, budget, affordability-- timing: not ready now, wants to wait-- competitor: mentions other solutions, already using something-- authority: not the decision maker, needs approval-- security: data privacy, compliance concerns-- integration: technical compatibility questions-- not_interested: explicitly not interested-- send_info: wants information sent instead of continuing--Respond with JSON:-{- "detected": true/false,- "objection_type": "pricing" | "timing" | "competitor" | "authority" | "security" | "integration" | "not_interested" | "send_info" | null,- "confidence": 0.0-1.0,- "reasoning": "brief explanation"-}`;-- try {- const response = await llm.completeJSON<{- detected: boolean;- objection_type: ObjectionType | null;- confidence: number;- reasoning: string;- }>(prompt, 'You are an objection detection expert. Return valid JSON only.');-- if (response.success && response.data) {- if (response.data.detected && response.data.objection_type && response.data.confidence > 0.6) {- return {- detected: true,- objectionType: response.data.objection_type,- confidence: response.data.confidence,- triggerText: segment.text,- };- }- }- } catch (error) {- log.warn({ error }, 'LLM objection detection failed');- }-- return { detected: false, confidence: 0 };- }-- /**- * Retrieve cue card for an objection type- */- async getCueCard(- objectionType: ObjectionType,- triggerText: string,- context: string- ): Promise<CueCardContent | null> {- // Get cue cards from database- const cards = getCueCardsByType(objectionType);-- if (cards.length === 0) {- // Generate a cue card using LLM- return this.generateCueCard(objectionType, triggerText, context);- }-- // If multiple cards, use LLM to pick the best one- if (cards.length > 1) {- return this.selectBestCueCard(cards, triggerText, context);- }-- // Single card - parse and return- const card = cards[0];- return {- id: card.id,- objectionType: card.objectionType as ObjectionType,- title: card.title,- talkTracks: JSON.parse(card.talkTracks),- followUpQuestions: JSON.parse(card.followUpQuestions),- proofPoints: card.proofPoints ? JSON.parse(card.proofPoints) : undefined,- avoidSaying: card.avoidSaying ? JSON.parse(card.avoidSaying) : undefined,- sourceDoc: card.sourceDoc || undefined,- confidence: 0.9,- };- }-- /**- * Process a segment and potentially return a cue card trigger- */- async processSegment(- segment: TranscriptSegmentData,- context: string,- recordingId: number,- useLLM: boolean = false- ): Promise<CueCardTriggerData | null> {- // Fast detection first- let detection = this.detectObjectionFast(segment);-- // If not detected and LLM is enabled, try LLM- if (!detection.detected && useLLM) {- detection = await this.detectObjectionWithLLM(segment, context);- }-- if (!detection.detected || !detection.objectionType) {- return null;- }-- // Update cooldown- this.recentTriggers.set(detection.objectionType, Date.now());-- // Get cue card- const cueCard = await this.getCueCard(- detection.objectionType,- detection.triggerText || segment.text,- context- );-- if (!cueCard) {- return null;- }-- // Create trigger record- const triggerId = uuid();- try {- createCueCardTrigger({- id: triggerId,- recordingId,- segmentId: segment.id,- cueCardId: cueCard.id,- objectionType: detection.objectionType,- triggerText: segment.text,- confidence: cueCard.confidence,- status: 'active',- timestamp: segment.startTime,- });- } catch (error) {- log.error({ error }, 'Failed to save cue card trigger');- }-- return {- ...cueCard,- triggerId,- triggerText: segment.text,- segmentId: segment.id,- timestamp: segment.startTime,- status: 'active',- };- }-- /**- * Generate a cue card using LLM- */- private async generateCueCard(- objectionType: ObjectionType,- triggerText: string,- context: string- ): Promise<CueCardContent> {- const llm = getLLMService();-- const prompt = `Generate a cue card to help handle this objection.--Objection type: ${objectionType}-Participant said: "${triggerText}"--Context:-${context}--Respond with JSON:-{- "title": "Brief title for this objection",- "talk_tracks": ["3-5 response suggestions"],- "follow_up_questions": ["2-4 clarifying questions to ask"],- "proof_points": ["1-2 supporting facts if relevant"],- "avoid_saying": ["1-2 things NOT to say"]-}`;-- try {- const response = await llm.completeJSON<{- title: string;- talk_tracks: string[];- follow_up_questions: string[];- proof_points?: string[];- avoid_saying?: string[];- }>(prompt, 'You are a meeting enablement expert. Return valid JSON only.');-- if (response.success && response.data) {- return {- id: `generated-${uuid()}`,- objectionType,- title: response.data.title || `Handling ${objectionType} objection`,- talkTracks: response.data.talk_tracks || [],- followUpQuestions: response.data.follow_up_questions || [],- proofPoints: response.data.proof_points,- avoidSaying: response.data.avoid_saying,- confidence: 0.6,- };- }- } catch (error) {- log.warn({ error }, 'Failed to generate cue card');- }-- // Fallback- return {- id: `fallback-${uuid()}`,- objectionType,- title: `Handling ${objectionType} objection`,- talkTracks: ['Address the concern directly', 'Ask for more details about their situation'],- followUpQuestions: ['Can you tell me more about that?', 'What would help address this concern?'],- confidence: 0.3,- };- }-- /**- * Select the best cue card from multiple options- */- private async selectBestCueCard(- cards: Array<{- id: string;- objectionType: string;- title: string;- talkTracks: string;- followUpQuestions: string;- proofPoints: string | null;- avoidSaying: string | null;- sourceDoc: string | null;- }>,- triggerText: string,- context: string- ): Promise<CueCardContent> {- const llm = getLLMService();-- const cardsContext = cards.map((card, idx) => {- const tracks = JSON.parse(card.talkTracks);- return `Card ${idx + 1} (${card.id}):\nTitle: ${card.title}\nTalk tracks: ${tracks.slice(0, 2).join('; ')}`;- }).join('\n\n');-- const prompt = `Select the most relevant cue card for this objection.--Objection: "${triggerText}"--Context:-${context}--Available cue cards:-${cardsContext}--Respond with JSON:-{- "selected_index": 0-${cards.length - 1},- "confidence": 0.0-1.0,- "reasoning": "why this card is best"-}`;-- try {- const response = await llm.completeJSON<{- selected_index: number;- confidence: number;- reasoning: string;- }>(prompt, 'You are a meeting enablement expert. Return valid JSON only.');-- if (response.success && response.data) {- const selectedIndex = Math.max(0, Math.min(response.data.selected_index, cards.length - 1));- const selected = cards[selectedIndex];-- return {- id: selected.id,- objectionType: selected.objectionType as ObjectionType,- title: selected.title,- talkTracks: JSON.parse(selected.talkTracks),- followUpQuestions: JSON.parse(selected.followUpQuestions),- proofPoints: selected.proofPoints ? JSON.parse(selected.proofPoints) : undefined,- avoidSaying: selected.avoidSaying ? JSON.parse(selected.avoidSaying) : undefined,- sourceDoc: selected.sourceDoc || undefined,- confidence: response.data.confidence,- };- }- } catch (error) {- log.warn({ error }, 'Failed to select best cue card');- }-- // Fallback to first card- const card = cards[0];- return {- id: card.id,- objectionType: card.objectionType as ObjectionType,- title: card.title,- talkTracks: JSON.parse(card.talkTracks),- followUpQuestions: JSON.parse(card.followUpQuestions),- proofPoints: card.proofPoints ? JSON.parse(card.proofPoints) : undefined,- avoidSaying: card.avoidSaying ? JSON.parse(card.avoidSaying) : undefined,- sourceDoc: card.sourceDoc || undefined,- confidence: 0.7,- };- }-- /**- * Update cue card trigger status- */- updateTriggerStatus(triggerId: string, status: 'active' | 'pinned' | 'dismissed'): void {- try {- updateCueCardTrigger(triggerId, { status });- } catch (error) {- log.error({ error, triggerId, status }, 'Failed to update trigger status');- }- }-- /**- * Submit feedback for a cue card trigger- */- submitFeedback(triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant'): void {- try {- updateCueCardTrigger(triggerId, { feedback });- log.info({ triggerId, feedback }, 'Cue card feedback submitted');- } catch (error) {- log.error({ error, triggerId, feedback }, 'Failed to submit feedback');- }- }-- /**- * Reset cooldowns- */- reset(): void {- this.recentTriggers.clear();- }-}--// Singleton Instance--let instance: CueCardEngineService | null = null;--export function getCueCardEngine(): CueCardEngineService {- if (!instance) {- instance = new CueCardEngineService();- }- return instance;-}--export function resetCueCardEngine(): void {- if (instance) {- instance.reset();- }- instance = null;-}--export default CueCardEngineService;diff --git a/src/main/services/copilot/index.ts b/src/main/services/copilot/index.tsindex 5317013..d07fc06 100644--- a/src/main/services/copilot/index.ts+++ b/src/main/services/copilot/index.ts@@ -43,16 +43,6 @@ export {type MetricsTrend,} from './conversation-metrics.service';-// Sentiment analysis-export {- SentimentAnalyzerService,- getSentimentAnalyzer,- resetSentimentAnalyzer,- type Sentiment,- type SentimentResult,- type SentimentTrend,-} from './sentiment-analyzer.service';-// Nudge engineexport {NudgeEngineService,@@ -64,37 +54,6 @@ export {type NudgeConfig,} from './nudge-engine.service';-// Smart card engine (formerly cue card engine)-export {- SmartCardEngineService,- getSmartCardEngine,- resetSmartCardEngine,- type TriggerCategory,- type SmartCardContent,- type SmartCardTriggerData,- type TriggerDetectionResult,- // Backwards compatibility aliases- CueCardEngineService,- getCueCardEngine,- resetCueCardEngine,- type ObjectionType,- type CueCardContent,- type CueCardTriggerData,- type ObjectionDetectionResult,-} from './smart-card-engine.service';--// Playbook tracker-export {- PlaybookTrackerService,- getPlaybookTracker,- resetPlaybookTracker,- type Playbook,- type PlaybookItem,- type PlaybookItemStatus,- type PlaybookItemEvidence,- type PlaybookSnapshot,-} from './playbook-tracker.service';-// Summary generatorexport {SummaryGeneratorService,diff --git a/src/main/services/copilot/nudge-engine.service.ts b/src/main/services/copilot/nudge-engine.service.tsindex 9e2a7d3..b3f532e 100644--- a/src/main/services/copilot/nudge-engine.service.ts+++ b/src/main/services/copilot/nudge-engine.service.ts@@ -2,13 +2,12 @@* Live Nudge Engine Service** Generates gentle, rate-limited coaching nudges based on conversation- * metrics and sentiment. Maximum 1 nudge per 2 minutes to avoid distraction.+ * metrics. Maximum 1 nudge per 2 minutes to avoid distraction.*/import { v4 as uuid } from 'uuid';import { logger } from '../../lib/logger';import type { ConversationMetrics } from './conversation-metrics.service';-import type { SentimentTrend } from './sentiment-analyzer.service';const log = logger.child({ module: 'nudge-engine' });@@ -16,11 +15,8 @@ const log = logger.child({ module: 'nudge-engine' });export type NudgeType =| 'monologue'- | 'sentiment'| 'talk_ratio'| 'next_steps'- | 'pricing'- | 'playbook'| 'questions'| 'pace';@@ -59,27 +55,14 @@ const NUDGE_TEMPLATES: Record<NudgeType, Array<{actionType: 'ask_question',},{- message: 'Consider pausing to let the customer respond',+ message: 'Consider pausing to let the other person respond',severity: 'low',actionType: 'pause',},],- sentiment: [- {- message: 'Customer sentiment seems to be dipping — consider clarifying',- severity: 'high',- actionLabel: 'Address concern',- actionType: 'clarify',- },- {- message: 'The customer may have concerns — check in with them',- severity: 'medium',- actionType: 'clarify',- },- ],talk_ratio: [{- message: 'Talk ratio is high — let the customer speak more',+ message: 'Talk ratio is high — let the other person speak more',severity: 'low',},{@@ -101,18 +84,6 @@ const NUDGE_TEMPLATES: Record<NudgeType, Array<{actionType: 'confirm',},],- pricing: [- {- message: 'Pricing came up — make sure to address value before discussing cost',- severity: 'medium',- },- ],- playbook: [- {- message: 'Some playbook items haven\'t been covered yet',- severity: 'low',- },- ],questions: [{message: 'You haven\'t asked many questions — discovery is key',@@ -150,9 +121,7 @@ export class NudgeEngineService {*/evaluate(metrics: ConversationMetrics,- sentiment: SentimentTrend,- callDuration: number,- playbookCoverage?: number // 0-100+ callDuration: number): Nudge | null {if (!this.config.enabled) return null;@@ -165,12 +134,10 @@ export class NudgeEngineService {// Priority-ordered checksconst nudge =this.checkMonologue(metrics) ||- this.checkSentimentDip(sentiment) ||this.checkTalkRatio(metrics) ||this.checkQuestions(metrics, callDuration) ||this.checkPace(metrics) ||- this.checkNextSteps(callDuration) ||- this.checkPlaybook(playbookCoverage, callDuration);+ this.checkNextSteps(callDuration);if (nudge && !this.config.suppressedTypes.includes(nudge.type)) {this.lastNudgeTime = now;@@ -193,24 +160,6 @@ export class NudgeEngineService {return null;}- /**- * Check for sentiment dip- */- private checkSentimentDip(sentiment: SentimentTrend): Nudge | null {- if (- sentiment.trend === 'declining' &&- sentiment.current === 'negative'- ) {- return this.createNudge('sentiment', 0); // High severity- }-- if (sentiment.trend === 'declining' && sentiment.averageScore < -0.2) {- return this.createNudge('sentiment', 1); // Medium severity- }-- return null;- }-/*** Check talk ratio*/@@ -273,20 +222,6 @@ export class NudgeEngineService {return null;}- /**- * Check playbook coverage- */- private checkPlaybook(coverage?: number, callDuration?: number): Nudge | null {- if (coverage === undefined || callDuration === undefined) return null;-- // After 15 minutes, if coverage is low- if (callDuration > 900 && coverage < 30) {- return this.createNudge('playbook');- }-- return null;- }-/*** Create a nudge from template*/diff --git a/src/main/services/copilot/playbook-tracker.service.ts b/src/main/services/copilot/playbook-tracker.service.tsdeleted file mode 100644index 7f6e7fe..0000000--- a/src/main/services/copilot/playbook-tracker.service.ts+++ /dev/null@@ -1,417 +0,0 @@-/**- * Playbook Tracker Service- *- * Tracks coverage of meeting methodology items (MEDDIC, Challenger, etc.)- * by matching transcript content to required topics. Uses LLM to verify- * if playbook items were genuinely covered with evidence linking.- */--import { v4 as uuid } from 'uuid';-import { logger } from '../../lib/logger';-import { getLLMService } from '../llm.service';-import {- getPlaybookById,- getDefaultPlaybook,- createPlaybookSession,- updatePlaybookSession,-} from '../../db';-import type { TranscriptSegmentData } from './transcript-buffer.service';--const log = logger.child({ module: 'playbook-tracker' });--// Types--export type PlaybookItemStatus = 'missing' | 'partial' | 'covered';--export interface PlaybookItemEvidence {- segmentId: string;- timestamp: number;- excerpt: string;- confidence: number;-}--export interface PlaybookItem {- id: string;- label: string;- description: string;- keywords: string[];- suggestedQuestions: string[];- detectionPrompt: string;- status: PlaybookItemStatus;- evidence: PlaybookItemEvidence[];-}--export interface Playbook {- id: string;- name: string;- type: 'MEDDIC' | 'Challenger' | 'SPIN' | 'Custom';- description?: string;- items: PlaybookItem[];-}--export interface PlaybookSnapshot {- playbookId: string;- playbookName: string;- covered: number;- partial: number;- missing: number;- total: number;- coveragePercentage: number;- items: PlaybookItem[];- recommendations: string[];-}--// Playbook Tracker Service--export class PlaybookTrackerService {- private activePlaybook: Playbook | null = null;- private sessionId: string | null = null;- private recordingId: number | null = null;-- constructor() {}-- /**- * Initialize tracker with a playbook- */- async initialize(- playbookId: string | null,- recordingId: number- ): Promise<Playbook | null> {- this.recordingId = recordingId;-- // Get playbook from database- let dbPlaybook;- if (playbookId) {- dbPlaybook = getPlaybookById(playbookId);- } else {- dbPlaybook = getDefaultPlaybook();- }-- if (!dbPlaybook) {- log.warn('No playbook found');- return null;- }-- // Parse playbook items- const items: PlaybookItem[] = JSON.parse(dbPlaybook.items).map((item: any) => ({- ...item,- status: 'missing' as PlaybookItemStatus,- evidence: [],- }));-- this.activePlaybook = {- id: dbPlaybook.id,- name: dbPlaybook.name,- type: dbPlaybook.type as Playbook['type'],- description: dbPlaybook.description || undefined,- items,- };-- // Create session record- this.sessionId = uuid();- try {- createPlaybookSession({- id: this.sessionId,- recordingId,- playbookId: dbPlaybook.id,- itemsCoverage: JSON.stringify(- items.map(i => ({ id: i.id, status: i.status, evidence: [] }))- ),- });- } catch (error) {- log.error({ error }, 'Failed to create playbook session');- }-- log.info({ playbookId: dbPlaybook.id, playbookName: dbPlaybook.name }, 'Playbook tracker initialized');- return this.activePlaybook;- }-- /**- * Get the active playbook- */- getPlaybook(): Playbook | null {- return this.activePlaybook;- }-- /**- * Check if a segment covers any playbook items (fast, keyword-based)- */- checkCoverageFast(segment: TranscriptSegmentData): PlaybookItem | null {- if (!this.activePlaybook) return null;-- const text = segment.text.toLowerCase();-- for (const item of this.activePlaybook.items) {- // Skip if already covered- if (item.status === 'covered') continue;-- // Check keywords- const hasKeywords = item.keywords.some(kw =>- text.includes(kw.toLowerCase())- );-- if (hasKeywords) {- // Mark as partial if first match- if (item.status === 'missing') {- item.status = 'partial';- item.evidence.push({- segmentId: segment.id,- timestamp: segment.startTime,- excerpt: segment.text.substring(0, 150),- confidence: 0.5,- });- this.saveSession();- return item;- }- }- }-- return null;- }-- /**- * Check coverage with LLM verification- */- async checkCoverageWithLLM(- segment: TranscriptSegmentData,- context: string- ): Promise<PlaybookItem | null> {- if (!this.activePlaybook) return null;-- // First do fast check- const fastResult = this.checkCoverageFast(segment);-- // For items that are partially covered, verify with LLM- for (const item of this.activePlaybook.items) {- if (item.status === 'covered') continue;-- // Check if this segment might cover the item- const hasKeywords = item.keywords.some(kw =>- segment.text.toLowerCase().includes(kw.toLowerCase())- );-- if (!hasKeywords && item.status !== 'partial') continue;-- // Verify with LLM- const verification = await this.verifyCoverage(item, segment, context);-- if (verification.isCovered) {- item.status = 'covered';- item.evidence.push({- segmentId: segment.id,- timestamp: segment.startTime,- excerpt: segment.text.substring(0, 150),- confidence: verification.confidence,- });- this.saveSession();-- log.info({ itemId: item.id, itemLabel: item.label }, 'Playbook item covered');- return item;- } else if (verification.isPartial && item.status === 'missing') {- item.status = 'partial';- item.evidence.push({- segmentId: segment.id,- timestamp: segment.startTime,- excerpt: segment.text.substring(0, 150),- confidence: verification.confidence,- });- this.saveSession();- return item;- }- }-- return fastResult;- }-- /**- * Verify coverage using LLM- */- private async verifyCoverage(- item: PlaybookItem,- segment: TranscriptSegmentData,- context: string- ): Promise<{ isCovered: boolean; isPartial: boolean; confidence: number }> {- const llm = getLLMService();-- const prompt = `Analyze this meeting conversation to determine if a playbook item has been covered.--Playbook Item: ${item.label}-Description: ${item.description}-Detection Question: ${item.detectionPrompt}--Recent conversation context:-${context}--Current statement: "${segment.text}"--Determine if this playbook item has been adequately covered in the conversation.--Respond with JSON:-{- "covered": true/false,- "partial": true/false,- "confidence": 0.0-1.0,- "reasoning": "brief explanation"-}`;-- try {- const response = await llm.completeJSON<{- covered: boolean;- partial: boolean;- confidence: number;- reasoning: string;- }>(prompt, 'You are a meeting methodology expert. Return valid JSON only.');-- if (response.success && response.data) {- return {- isCovered: response.data.covered && response.data.confidence > 0.7,- isPartial: response.data.partial || (response.data.confidence > 0.4 && response.data.confidence <= 0.7),- confidence: response.data.confidence,- };- }- } catch (error) {- log.warn({ error, itemId: item.id }, 'LLM verification failed');- }-- return { isCovered: false, isPartial: false, confidence: 0 };- }-- /**- * Get current coverage snapshot- */- getSnapshot(): PlaybookSnapshot | null {- if (!this.activePlaybook) return null;-- const covered = this.activePlaybook.items.filter(i => i.status === 'covered').length;- const partial = this.activePlaybook.items.filter(i => i.status === 'partial').length;- const missing = this.activePlaybook.items.filter(i => i.status === 'missing').length;- const total = this.activePlaybook.items.length;-- // Weight: covered = 1, partial = 0.5, missing = 0- const coveragePercentage = total > 0- ? Math.round(((covered + partial * 0.5) / total) * 100)- : 0;-- // Generate recommendations- const recommendations: string[] = [];- for (const item of this.activePlaybook.items) {- if (item.status === 'missing') {- recommendations.push(`Consider covering: ${item.label}`);- if (item.suggestedQuestions.length > 0) {- recommendations.push(` Try asking: "${item.suggestedQuestions[0]}"`);- }- }- }-- return {- playbookId: this.activePlaybook.id,- playbookName: this.activePlaybook.name,- covered,- partial,- missing,- total,- coveragePercentage,- items: this.activePlaybook.items,- recommendations: recommendations.slice(0, 4), // Limit to 4- };- }-- /**- * Get missing items with suggested questions- */- getMissingItems(): Array<{ item: PlaybookItem; suggestedQuestion: string }> {- if (!this.activePlaybook) return [];-- return this.activePlaybook.items- .filter(i => i.status === 'missing')- .map(item => ({- item,- suggestedQuestion: item.suggestedQuestions[0] || '',- }));- }-- /**- * Manually mark an item as covered- */- markAsCovered(itemId: string, evidence?: PlaybookItemEvidence): void {- if (!this.activePlaybook) return;-- const item = this.activePlaybook.items.find(i => i.id === itemId);- if (item) {- item.status = 'covered';- if (evidence) {- item.evidence.push(evidence);- }- this.saveSession();- }- }-- /**- * Save session to database- */- private saveSession(): void {- if (!this.sessionId || !this.activePlaybook) return;-- try {- const itemsCoverage = this.activePlaybook.items.map(i => ({- id: i.id,- status: i.status,- evidence: i.evidence,- }));-- updatePlaybookSession(this.sessionId, {- itemsCoverage: JSON.stringify(itemsCoverage),- });- } catch (error) {- log.error({ error }, 'Failed to save playbook session');- }- }-- /**- * Finalize and save completion snapshot- */- async finalize(): Promise<PlaybookSnapshot | null> {- const snapshot = this.getSnapshot();- if (!snapshot || !this.sessionId) return snapshot;-- try {- updatePlaybookSession(this.sessionId, {- completionSnapshot: JSON.stringify(snapshot),- });- log.info({ coverage: snapshot.coveragePercentage }, 'Playbook session finalized');- } catch (error) {- log.error({ error }, 'Failed to finalize playbook session');- }-- return snapshot;- }-- /**- * Reset tracker- */- reset(): void {- this.activePlaybook = null;- this.sessionId = null;- this.recordingId = null;- }-}--// Singleton Instance--let instance: PlaybookTrackerService | null = null;--export function getPlaybookTracker(): PlaybookTrackerService {- if (!instance) {- instance = new PlaybookTrackerService();- }- return instance;-}--export function resetPlaybookTracker(): void {- if (instance) {- instance.reset();- }- instance = null;-}--export default PlaybookTrackerService;diff --git a/src/main/services/copilot/sales-copilot.service.ts b/src/main/services/copilot/sales-copilot.service.tsindex 445c35a..7847f3a 100644--- a/src/main/services/copilot/sales-copilot.service.ts+++ b/src/main/services/copilot/sales-copilot.service.ts@@ -2,7 +2,7 @@* Meeting Co-Pilot Agent Orchestrator** Central coordinator that receives transcript segments, manages context,- * and triggers all agent processing pipelines. Emits events for UI updates.+ * and triggers agent processing pipelines. Emits events for UI updates.*/import { EventEmitter } from 'events';@@ -33,31 +33,12 @@ import {type ConversationMetrics,} from './conversation-metrics.service';-import {- SentimentAnalyzerService,- getSentimentAnalyzer,- type SentimentTrend,-} from './sentiment-analyzer.service';-import {NudgeEngineService,getNudgeEngine,type Nudge,} from './nudge-engine.service';-import {- CueCardEngineService,- getCueCardEngine,- type CueCardTriggerData,-} from './cue-card-engine.service';--import {- PlaybookTrackerService,- getPlaybookTracker,- type PlaybookSnapshot,- type PlaybookItem,-} from './playbook-tracker.service';-import {SummaryGeneratorService,getSummaryGenerator,@@ -83,12 +64,7 @@ const log = logger.child({ module: 'meeting-copilot' });export interface CopilotConfig {enableTranscription: boolean;enableMetrics: boolean;- enableSentiment: boolean;enableNudges: boolean;- enableCueCards: boolean;- enablePlaybook: boolean;- playbookId?: string;- useLLMForDetection: boolean;metricsUpdateInterval: number; // mscompressionInterval: number; // ms// MCP Configuration@@ -100,13 +76,9 @@ export interface CopilotEvents {'call-started': { recordingId: number; sessionId: string };'transcript-segment': TranscriptSegmentData;'metrics-update': { metrics: ConversationMetrics; health: number };- 'sentiment-update': { sentiment: SentimentTrend };'nudge': { nudge: Nudge };- 'cue-card': { cueCard: CueCardTriggerData };- 'playbook-update': { item: PlaybookItem; snapshot: PlaybookSnapshot };'call-ended': {summary: CallSummary;- playbook?: PlaybookSnapshot;metrics: ConversationMetrics;duration: number;};@@ -129,10 +101,7 @@ export class MeetingCopilotService extends EventEmitter {private transcriptBuffer: TranscriptBufferService;private contextManager: ContextManagerService;private metricsService: ConversationMetricsService;- private sentimentAnalyzer: SentimentAnalyzerService;private nudgeEngine: NudgeEngineService;- private cueCardEngine: CueCardEngineService;- private playbookTracker: PlaybookTrackerService;private summaryGenerator: SummaryGeneratorService;private config: CopilotConfig;@@ -145,11 +114,7 @@ export class MeetingCopilotService extends EventEmitter {private readonly DEFAULT_CONFIG: CopilotConfig = {enableTranscription: true,enableMetrics: true,- enableSentiment: true,enableNudges: true,- enableCueCards: true,- enablePlaybook: true,- useLLMForDetection: false, // Start with fast detectionmetricsUpdateInterval: 10000, // 10 secondscompressionInterval: 300000, // 5 minutes// MCP defaults@@ -165,10 +130,7 @@ export class MeetingCopilotService extends EventEmitter {this.transcriptBuffer = getTranscriptBuffer();this.contextManager = getContextManager();this.metricsService = getMetricsService();- this.sentimentAnalyzer = getSentimentAnalyzer();this.nudgeEngine = getNudgeEngine();- this.cueCardEngine = getCueCardEngine();- this.playbookTracker = getPlaybookTracker();this.summaryGenerator = getSummaryGenerator();// Listen for transcript segments ready for processing@@ -202,15 +164,8 @@ export class MeetingCopilotService extends EventEmitter {// Initialize servicesthis.transcriptBuffer.startCall(sessionId, recordingId);this.nudgeEngine.reset();- this.cueCardEngine.reset();- this.sentimentAnalyzer.clear();this.metricsService.clear(sessionId);- // Initialize playbook if enabled- if (this.config.enablePlaybook) {- await this.playbookTracker.initialize(this.config.playbookId || null, recordingId);- }-// Reset MCP Agent conversation for the new callgetMCPAgent().resetConversation();@@ -304,21 +259,6 @@ export class MeetingCopilotService extends EventEmitter {// Run processing in parallel where possibleconst promises: Promise<void>[] = [];- // Cue card detection (only for customer statements)- if (this.config.enableCueCards && segment.channel === 'them') {- promises.push(this.processCueCards(segment, context));- }-- // Playbook tracking- if (this.config.enablePlaybook) {- promises.push(this.processPlaybook(segment, context));- }-- // Sentiment update (only for customer statements)- if (this.config.enableSentiment && segment.channel === 'them') {- this.processSentiment();- }-// MCP intent detection (for both channels - user may ask for info too)if (this.config.enableMCP && this.config.mcpAutoTrigger) {log.debug({@@ -341,57 +281,6 @@ export class MeetingCopilotService extends EventEmitter {this.transcriptBuffer.markProcessed(segment.id, this.callState.sessionId);}- /**- * Process cue card detection- */- private async processCueCards(segment: TranscriptSegmentData, context: string): Promise<void> {- if (!this.callState) return;-- const cueCard = await this.cueCardEngine.processSegment(- segment,- context,- this.callState.recordingId,- this.config.useLLMForDetection- );-- if (cueCard) {- this.emit('cue-card', { cueCard });- }- }-- /**- * Process playbook tracking- */- private async processPlaybook(segment: TranscriptSegmentData, context: string): Promise<void> {- let updatedItem: PlaybookItem | null = null;-- if (this.config.useLLMForDetection) {- updatedItem = await this.playbookTracker.checkCoverageWithLLM(segment, context);- } else {- updatedItem = this.playbookTracker.checkCoverageFast(segment);- }-- if (updatedItem) {- const snapshot = this.playbookTracker.getSnapshot();- if (snapshot) {- this.emit('playbook-update', { item: updatedItem, snapshot });- }- }- }-- /**- * Process sentiment update (LLM-driven)- */- private async processSentiment(): Promise<void> {- if (!this.callState) return;-- const recentSegments = this.transcriptBuffer.getFinalSegments(this.callState.sessionId);- const sentiment = await this.sentimentAnalyzer.getSentimentTrend(recentSegments);--- this.emit('sentiment-update', { sentiment });- }-/*** Process MCP intents - use agentic loop to detect and execute tool calls*/@@ -538,8 +427,6 @@ export class MeetingCopilotService extends EventEmitter {const callDuration = (Date.now() - this.callState.startTime) / 1000;const metrics = this.metricsService.calculate(segments, callDuration);const health = this.metricsService.getConversationHealthScore(metrics);- const sentiment = await this.sentimentAnalyzer.getSentimentTrend(segments);- const playbookSnapshot = this.playbookTracker.getSnapshot();// Emit metrics updatethis.emit('metrics-update', { metrics, health });@@ -548,9 +435,7 @@ export class MeetingCopilotService extends EventEmitter {if (this.config.enableNudges) {const nudge = this.nudgeEngine.evaluate(metrics,- sentiment,- callDuration,- playbookSnapshot?.coveragePercentage+ callDuration);if (nudge) {@@ -584,7 +469,6 @@ export class MeetingCopilotService extends EventEmitter {paceWpm: metrics.pace,questionsAsked: metrics.questionsAsked,monologueDetected: metrics.monologueDetected,- sentimentTrend: sentiment.trend,});} catch (error) {log.error({ error }, 'Failed to save metrics snapshot');@@ -653,9 +537,6 @@ export class MeetingCopilotService extends EventEmitter {// Calculate final metricsconst metrics = this.metricsService.calculate(segments, duration);- // Finalize playbook- const playbookSnapshot = await this.playbookTracker.finalize();-// Generate summarylet summary: CallSummary;try {@@ -682,7 +563,6 @@ export class MeetingCopilotService extends EventEmitter {log.info({ recordingId, hasSummary: summary.summary.length > 0 }, 'Saving call data to database');updateRecording(recordingId, {callSummary: JSON.stringify(summary),- playbookSnapshot: playbookSnapshot ? JSON.stringify(playbookSnapshot) : undefined,metricsSnapshot: JSON.stringify(metrics),duration: Math.round(duration),});@@ -696,7 +576,6 @@ export class MeetingCopilotService extends EventEmitter {log.info({ recordingId, hasSummary: summary.summary.length > 0 }, 'Emitting call-ended event');this.emit('call-ended', {summary,- playbook: playbookSnapshot || undefined,metrics,duration,});@@ -704,7 +583,6 @@ export class MeetingCopilotService extends EventEmitter {// Cleanupthis.transcriptBuffer.clear(sessionId);this.contextManager.clear(sessionId);- this.playbookTracker.reset();this.callState = null;return summary;@@ -745,44 +623,6 @@ export class MeetingCopilotService extends EventEmitter {return this.metricsService.calculate(segments, callDuration);}- /**- * Get current playbook snapshot- */- getPlaybookSnapshot(): PlaybookSnapshot | null {- return this.playbookTracker.getSnapshot();- }-- /**- * Get current sentiment- */- async getCurrentSentiment(): Promise<SentimentTrend | null> {- if (!this.callState?.isActive) return null;-- const segments = this.transcriptBuffer.getFinalSegments(this.callState.sessionId);- return this.sentimentAnalyzer.getSentimentTrend(segments);- }-- /**- * Dismiss a cue card- */- dismissCueCard(triggerId: string): void {- this.cueCardEngine.updateTriggerStatus(triggerId, 'dismissed');- }-- /**- * Pin a cue card- */- pinCueCard(triggerId: string): void {- this.cueCardEngine.updateTriggerStatus(triggerId, 'pinned');- }-- /**- * Submit cue card feedback- */- submitCueCardFeedback(triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant'): void {- this.cueCardEngine.submitFeedback(triggerId, feedback);- }-/*** Dismiss a nudge*/diff --git a/src/main/services/copilot/sentiment-analyzer.service.ts b/src/main/services/copilot/sentiment-analyzer.service.tsdeleted file mode 100644index 7c1101b..0000000--- a/src/main/services/copilot/sentiment-analyzer.service.ts+++ /dev/null@@ -1,414 +0,0 @@-/**- * Sentiment Analyzer Service- *- * Analyzes sentiment of participant ("them") statements to track mood trends.- * Uses pattern-based detection for speed with optional LLM fallback.- */--import { logger } from '../../lib/logger';-import { getLLMService } from '../llm.service';-import type { TranscriptSegmentData } from './transcript-buffer.service';--const log = logger.child({ module: 'sentiment-analyzer' });--// Types--export type Sentiment = 'positive' | 'neutral' | 'negative';--export interface SentimentResult {- sentiment: Sentiment;- confidence: number;- signals: string[]; // Words/phrases that triggered the sentiment-}--export interface SentimentTrend {- current: Sentiment;- trend: 'improving' | 'stable' | 'declining';- history: Array<{- time: number;- sentiment: Sentiment;- text: string;- }>;- averageScore: number; // -1 to 1-}--// Sentiment Patterns--const POSITIVE_PATTERNS = [- // Strong positive- /\b(love|excellent|perfect|amazing|fantastic|wonderful|great|awesome|outstanding)\b/i,- // Agreement- /\b(yes|agree|absolutely|definitely|certainly|exactly|right|correct)\b/i,- // Interest- /\b(interested|exciting|impressive|sounds good|makes sense|like that|appreciate)\b/i,- // Progress indicators- /\b(moving forward|next step|let's do|ready to|looking forward)\b/i,-];--const NEGATIVE_PATTERNS = [- // Strong negative- /\b(hate|terrible|awful|horrible|worst|disappointed|frustrated|annoyed)\b/i,- // Concerns- /\b(concern|worried|issue|problem|difficult|complicated|expensive|costly)\b/i,- // Disagreement- /\b(no|disagree|don't think|not sure|doubt|skeptical|hesitant)\b/i,- // Objections- /\b(but|however|although|unfortunately|can't|won't|impossible)\b/i,- // Delays- /\b(not now|later|maybe|perhaps|need to think|not ready|busy)\b/i,-];--const QUESTION_WEIGHT = -0.1; // Questions are slightly negative (indicate uncertainty)--// Sentiment Analyzer Service--export class SentimentAnalyzerService {- private cache: Map<string, Sentiment> = new Map(); // segmentId -> sentiment- private useLLMFallback: boolean = true;-- constructor(useLLMFallback: boolean = true) {- this.useLLMFallback = useLLMFallback;- }-- /**- * Analyze sentiment of a single text (fast, pattern-based)- */- analyze(text: string): SentimentResult {- const signals: string[] = [];- let score = 0;-- // Check positive patterns- for (const pattern of POSITIVE_PATTERNS) {- const matches = text.match(pattern);- if (matches) {- score += 0.3;- signals.push(matches[0]);- }- }-- // Check negative patterns- for (const pattern of NEGATIVE_PATTERNS) {- const matches = text.match(pattern);- if (matches) {- score -= 0.3;- signals.push(matches[0]);- }- }-- // Questions indicate uncertainty- if (/\?/.test(text)) {- score += QUESTION_WEIGHT;- }-- // Normalize score to -1 to 1- score = Math.max(-1, Math.min(1, score));-- // Determine sentiment- let sentiment: Sentiment;- if (score > 0.15) {- sentiment = 'positive';- } else if (score < -0.15) {- sentiment = 'negative';- } else {- sentiment = 'neutral';- }-- return {- sentiment,- confidence: Math.abs(score),- signals,- };- }-- /**- * Analyze sentiment of multiple statements using LLM (batch analysis)- * More efficient than analyzing one at a time- */- async analyzeBatchWithLLM(statements: Array<{ id: string; text: string; time: number }>): Promise<Map<string, SentimentResult>> {- const llm = getLLMService();- const results = new Map<string, SentimentResult>();-- if (statements.length === 0) {- return results;- }-- const statementsText = statements- .map((s, i) => `[${i + 1}] "${s.text}"`)- .join('\n');-- const prompt = `Analyze the sentiment of each participant statement from a meeting.-Consider the emotional tone, concerns, satisfaction, and engagement level.-Statements like "this is bad", "killing myself", "hate this" are clearly NEGATIVE.-Statements showing interest, agreement, or positivity are POSITIVE.--Statements:-${statementsText}--Respond with JSON array (one entry per statement, in order):-[- {- "index": 1,- "sentiment": "positive" | "neutral" | "negative",- "confidence": 0.0-1.0,- "signals": ["key words or phrases that indicate sentiment"]- },- ...-]`;-- try {- const response = await llm.completeJSON<Array<{- index: number;- sentiment: Sentiment;- confidence: number;- signals: string[];- }>>(prompt, 'You are a sentiment analysis expert for meetings. Analyze participant emotions accurately. Return valid JSON array only.');-- if (response.success && response.data && Array.isArray(response.data)) {- for (const item of response.data) {- const statement = statements[item.index - 1];- if (statement) {- const result: SentimentResult = {- sentiment: item.sentiment || 'neutral',- confidence: item.confidence || 0.5,- signals: item.signals || [],- };- results.set(statement.id, result);- this.cache.set(statement.id, result.sentiment);- }- }- log.debug({- statementCount: statements.length,- resultsCount: results.size,- sentiments: Array.from(results.values()).map(r => r.sentiment),- }, 'LLM batch sentiment analysis completed');- return results;- }- } catch (error) {- log.warn({ error }, 'LLM batch sentiment analysis failed, falling back to pattern-based');- }-- // Fallback: analyze each with pattern matching- for (const statement of statements) {- const result = this.analyze(statement.text);- results.set(statement.id, result);- this.cache.set(statement.id, result.sentiment);- }- return results;- }-- /**- * Analyze sentiment using LLM for a single statement- */- async analyzeWithLLM(text: string): Promise<SentimentResult> {- const llm = getLLMService();-- const prompt = `Analyze the sentiment of this participant statement in a meeting.-Consider emotional tone, concerns, frustration, satisfaction level.-Statements expressing distress, negativity, or complaints are NEGATIVE.--Statement: "${text}"--Respond with JSON:-{- "sentiment": "positive" | "neutral" | "negative",- "confidence": 0.0-1.0,- "reasoning": "brief explanation",- "signals": ["key words or phrases"]-}`;-- try {- const response = await llm.completeJSON<{- sentiment: Sentiment;- confidence: number;- reasoning: string;- signals: string[];- }>(prompt, 'You are a sentiment analysis expert. Return valid JSON only.');-- if (response.success && response.data) {- return {- sentiment: response.data.sentiment || 'neutral',- confidence: response.data.confidence || 0.5,- signals: response.data.signals || [],- };- }- } catch (error) {- log.warn({ error }, 'LLM sentiment analysis failed, using pattern-based');- }-- // Fallback to pattern-based- return this.analyze(text);- }-- /**- * Analyze a segment with caching- */- analyzeSegment(segment: TranscriptSegmentData): SentimentResult {- // Check cache- const cached = this.cache.get(segment.id);- if (cached) {- return { sentiment: cached, confidence: 0.8, signals: [] };- }-- const result = this.analyze(segment.text);-- // Cache result- this.cache.set(segment.id, result.sentiment);-- return result;- }-- /**- * Get sentiment trend from recent customer segments (LLM-driven)- * Uses batch LLM analysis for accurate sentiment detection- */- async getSentimentTrend(segments: TranscriptSegmentData[]): Promise<SentimentTrend> {- // Filter to other participant ("them") segments only- const themSegments = segments- .filter(s => s.isFinal && s.channel === 'them')- .slice(-15); // Last 15 customer statements-- if (themSegments.length === 0) {- return {- current: 'neutral',- trend: 'stable',- history: [],- averageScore: 0,- };- }-- // Find segments that need analysis (not in cache)- const uncachedSegments = themSegments.filter(s => !this.cache.has(s.id));-- // Batch analyze uncached segments with LLM- if (uncachedSegments.length > 0) {- const statements = uncachedSegments.map(s => ({- id: s.id,- text: s.text,- time: s.startTime,- }));- await this.analyzeBatchWithLLM(statements);- }-- // Build history from cache- const history: SentimentTrend['history'] = [];- let totalScore = 0;-- for (const segment of themSegments) {- const cached = this.cache.get(segment.id);- const sentiment = cached || 'neutral';-- history.push({- time: segment.startTime,- sentiment,- text: segment.text.substring(0, 100),- });-- // Convert to score- if (sentiment === 'positive') totalScore += 1;- else if (sentiment === 'negative') totalScore -= 1;- }-- const averageScore = totalScore / themSegments.length;-- // Compare recent vs earlier- const recentCount = Math.min(5, history.length);- const recent = history.slice(-recentCount);- const earlier = history.slice(0, recentCount);-- const recentScore = this.calculateAverageScore(recent.map(h => h.sentiment));- const earlierScore = this.calculateAverageScore(earlier.map(h => h.sentiment));-- // Determine trend- let trend: SentimentTrend['trend'] = 'stable';- if (recentScore > earlierScore + 0.3) {- trend = 'improving';- } else if (recentScore < earlierScore - 0.3) {- trend = 'declining';- }-- // Current sentiment is the most recent- const current = history.length > 0- ? history[history.length - 1].sentiment- : 'neutral';-- return {- current,- trend,- history,- averageScore,- };- }-- /**- * Calculate average sentiment score from sentiment values- */- private calculateAverageScore(sentiments: Sentiment[]): number {- if (sentiments.length === 0) return 0;-- const scores: number[] = sentiments.map(s => {- if (s === 'positive') return 1;- if (s === 'negative') return -1;- return 0;- });-- return scores.reduce((a, b) => a + b, 0) / scores.length;- }-- /**- * Check if sentiment is concerning (needs attention)- */- isConcerning(trend: SentimentTrend): boolean {- return (- trend.current === 'negative' ||- trend.trend === 'declining' ||- trend.averageScore < -0.3- );- }-- /**- * Get a human-readable summary- */- getSentimentSummary(trend: SentimentTrend): string {- if (trend.history.length === 0) {- return 'Not enough data';- }-- const trendText = {- improving: 'improving',- stable: 'stable',- declining: 'declining',- }[trend.trend];-- const currentText = {- positive: 'positive',- neutral: 'neutral',- negative: 'concerned',- }[trend.current];-- return `Participant sentiment is ${currentText} and ${trendText}`;- }-- /**- * Clear cache for a session- */- clear(): void {- this.cache.clear();- }-}--// Singleton Instance--let instance: SentimentAnalyzerService | null = null;--export function getSentimentAnalyzer(): SentimentAnalyzerService {- if (!instance) {- instance = new SentimentAnalyzerService();- }- return instance;-}--export function resetSentimentAnalyzer(): void {- instance = null;-}--export default SentimentAnalyzerService;diff --git a/src/main/services/copilot/smart-card-engine.service.ts b/src/main/services/copilot/smart-card-engine.service.tsdeleted file mode 100644index 7af3527..0000000--- a/src/main/services/copilot/smart-card-engine.service.ts+++ /dev/null@@ -1,514 +0,0 @@-/**- * Smart Card Engine Service- *- * Detects meaningful moments in meeting conversations using keyword patterns and LLM- * classification. Surfaces context-aware smart cards with suggested responses- * and follow-up questions.- */--import { v4 as uuid } from 'uuid';-import { logger } from '../../lib/logger';-import { getLLMService } from '../llm.service';-import {- getSmartCardsByType,- createSmartCardTrigger,- updateSmartCardTrigger,-} from '../../db';-import type { TranscriptSegmentData } from './transcript-buffer.service';--const log = logger.child({ module: 'smart-card-engine' });--// Types--export type TriggerCategory =- | 'open_question'- | 'decision_point'- | 'concern'- | 'risk'- | 'commitment'- | 'follow_up'- | 'information_request'- | 'silence';--export interface SmartCardContent {- id: string;- triggerCategory: TriggerCategory;- title: string;- suggestedResponses: string[];- followUpQuestions: string[];- referencePoints?: string[];- avoidSaying?: string[];- sourceDoc?: string;- confidence: number;-}--export interface SmartCardTriggerData extends SmartCardContent {- triggerId: string;- triggerText: string;- segmentId: string;- timestamp: number;- status: 'active' | 'pinned' | 'dismissed';-}--export interface TriggerDetectionResult {- detected: boolean;- triggerCategory?: TriggerCategory;- confidence: number;- triggerText?: string;-}--// Detection Patterns for generic meeting moments--const DETECTION_PATTERNS: Record<TriggerCategory, RegExp[]> = {- open_question: [- /\b(what do you think|how would|could you explain|can you clarify)\b/i,- /\b(what's your.*opinion|how do you see|what are your thoughts)\b/i,- /\?\s*$/, // Ends with question mark- /\b(wondering|curious|question about)\b/i,- ],- decision_point: [- /\b(should we|do we want to|need to decide|decision|which option)\b/i,- /\b(let's.*agree|we need to.*choose|what.*approach)\b/i,- /\b(go with|move forward with|proceed with)\b/i,- /\b(consensus|vote|settle on)\b/i,- ],- concern: [- /\b(concerned|worried|hesitant|not sure about|skeptical)\b/i,- /\b(issue|problem|challenge|difficult|hard to)\b/i,- /\b(but|however|although|on the other hand)\b/i,- /\b(risky|uncomfortable|unsure)\b/i,- ],- risk: [- /\b(risk|blocker|dependency|deadline|delay)\b/i,- /\b(might not|could fail|at risk|blocking)\b/i,- /\b(scope creep|budget.*issue|timeline.*concern)\b/i,- /\b(won't be able|can't complete|running out of)\b/i,- ],- commitment: [- /\b(I'll|I will|we'll|we will|let me|I can)\b/i,- /\b(take.*action|follow up|send.*over|get back)\b/i,- /\b(by.*date|by.*end of|before.*meeting)\b/i,- /\b(promise|commit|agree to|action item)\b/i,- ],- follow_up: [- /\b(circle back|revisit|follow up|next meeting)\b/i,- /\b(table.*for now|park.*for later|come back to)\b/i,- /\b(schedule.*another|set up.*time|book.*slot)\b/i,- /\b(needs more.*discussion|discuss.*further)\b/i,- ],- information_request: [- /\b(send.*info|share.*document|forward.*details)\b/i,- /\b(need.*data|look up|find out|research)\b/i,- /\b(where can I|how do I|documentation)\b/i,- /\b(link to|reference|resource)\b/i,- ],- silence: [- // Silence is detected via timing, not text patterns- ],-};--// Smart Card Engine Service--export class SmartCardEngineService {- private recentTriggers: Map<string, number> = new Map(); // triggerCategory -> timestamp- private readonly TRIGGER_COOLDOWN = 60000; // 1 minute between same type-- constructor() {}-- /**- * Detect trigger in a segment (fast, pattern-based)- */- detectTriggerFast(segment: TranscriptSegmentData): TriggerDetectionResult {- const text = segment.text.toLowerCase();-- for (const [category, patterns] of Object.entries(DETECTION_PATTERNS)) {- if (category === 'silence') continue; // Silence is handled separately-- for (const pattern of patterns) {- if (pattern.test(text)) {- // Check cooldown- const lastTrigger = this.recentTriggers.get(category);- if (lastTrigger && Date.now() - lastTrigger < this.TRIGGER_COOLDOWN) {- continue;- }-- return {- detected: true,- triggerCategory: category as TriggerCategory,- confidence: 0.7,- triggerText: segment.text,- };- }- }- }-- return { detected: false, confidence: 0 };- }-- /**- * Detect trigger using LLM for nuanced detection- */- async detectTriggerWithLLM(- segment: TranscriptSegmentData,- context: string- ): Promise<TriggerDetectionResult> {- const llm = getLLMService();-- const prompt = `Analyze this statement from a meeting for meaningful moments that could benefit from a smart prompt.--Context (recent conversation):-${context}--Current statement from ${segment.channel === 'me' ? 'You' : 'Other Participant'}: "${segment.text}"--Trigger categories:-- open_question: An unanswered question that needs addressing-- decision_point: A moment requiring a decision or agreement-- concern: Hesitation, skepticism, or worry being expressed-- risk: A potential blocker, risk, or issue being raised-- commitment: Someone making or suggesting a commitment/action item-- follow_up: Something that needs to be revisited or followed up on-- information_request: A request for information, documents, or data--Respond with JSON:-{- "detected": true/false,- "trigger_category": "open_question" | "decision_point" | "concern" | "risk" | "commitment" | "follow_up" | "information_request" | null,- "confidence": 0.0-1.0,- "reasoning": "brief explanation"-}`;-- try {- const response = await llm.completeJSON<{- detected: boolean;- trigger_category: TriggerCategory | null;- confidence: number;- reasoning: string;- }>(prompt, 'You are a meeting analysis expert. Return valid JSON only.');-- if (response.success && response.data) {- if (response.data.detected && response.data.trigger_category && response.data.confidence > 0.6) {- return {- detected: true,- triggerCategory: response.data.trigger_category,- confidence: response.data.confidence,- triggerText: segment.text,- };- }- }- } catch (error) {- log.warn({ error }, 'LLM trigger detection failed');- }-- return { detected: false, confidence: 0 };- }-- /**- * Retrieve smart card for a trigger category- */- async getSmartCard(- triggerCategory: TriggerCategory,- triggerText: string,- context: string- ): Promise<SmartCardContent | null> {- // Get smart cards from database (uses old schema with objectionType/talkTracks)- const cards = getSmartCardsByType(triggerCategory);-- if (cards.length === 0) {- // Generate a smart card using LLM- return this.generateSmartCard(triggerCategory, triggerText, context);- }-- // If multiple cards, use LLM to pick the best one- if (cards.length > 1) {- return this.selectBestSmartCard(cards.map(this.mapDbCardToSmartCard.bind(this)), triggerText, context);- }-- // Single card - map from DB schema to SmartCardContent- return this.mapDbCardToSmartCard(cards[0]);- }-- /**- * Map database card (old schema) to SmartCardContent (new schema)- */- private mapDbCardToSmartCard(card: {- id: string;- objectionType: string;- title: string;- talkTracks: string;- followUpQuestions: string;- proofPoints?: string | null;- avoidSaying?: string | null;- sourceDoc?: string | null;- }): SmartCardContent {- return {- id: card.id,- triggerCategory: card.objectionType as TriggerCategory,- title: card.title,- suggestedResponses: JSON.parse(card.talkTracks),- followUpQuestions: JSON.parse(card.followUpQuestions),- referencePoints: card.proofPoints ? JSON.parse(card.proofPoints) : undefined,- avoidSaying: card.avoidSaying ? JSON.parse(card.avoidSaying) : undefined,- sourceDoc: card.sourceDoc || undefined,- confidence: 0.9,- };- }-- /**- * Process a segment and potentially return a smart card trigger- */- async processSegment(- segment: TranscriptSegmentData,- context: string,- recordingId: number,- useLLM: boolean = false- ): Promise<SmartCardTriggerData | null> {- // Fast detection first- let detection = this.detectTriggerFast(segment);-- // If not detected and LLM is enabled, try LLM- if (!detection.detected && useLLM) {- detection = await this.detectTriggerWithLLM(segment, context);- }-- if (!detection.detected || !detection.triggerCategory) {- return null;- }-- // Update cooldown- this.recentTriggers.set(detection.triggerCategory, Date.now());-- // Get smart card- const smartCard = await this.getSmartCard(- detection.triggerCategory,- detection.triggerText || segment.text,- context- );-- if (!smartCard) {- return null;- }-- // Create trigger record (using old schema field names for DB compatibility)- const triggerId = uuid();- try {- createSmartCardTrigger({- id: triggerId,- recordingId,- segmentId: segment.id,- cueCardId: smartCard.id, // Old schema name- objectionType: detection.triggerCategory, // Old schema name- triggerText: segment.text,- confidence: smartCard.confidence,- status: 'active',- timestamp: segment.startTime,- });- } catch (error) {- log.error({ error }, 'Failed to save smart card trigger');- }-- return {- ...smartCard,- triggerId,- triggerText: segment.text,- segmentId: segment.id,- timestamp: segment.startTime,- status: 'active',- };- }-- /**- * Generate a smart card using LLM- */- private async generateSmartCard(- triggerCategory: TriggerCategory,- triggerText: string,- context: string- ): Promise<SmartCardContent> {- const llm = getLLMService();-- const categoryDescriptions: Record<TriggerCategory, string> = {- open_question: 'An unanswered question',- decision_point: 'A decision that needs to be made',- concern: 'A concern or hesitation being raised',- risk: 'A potential risk or blocker',- commitment: 'A commitment or action item',- follow_up: 'Something to follow up on',- information_request: 'A request for information',- silence: 'An awkward silence or pause',- };-- const prompt = `Generate a smart card to help respond to this meeting moment.--Trigger type: ${triggerCategory} - ${categoryDescriptions[triggerCategory]}-Statement: "${triggerText}"--Context:-${context}--Respond with JSON:-{- "title": "Brief title for this card",- "suggested_responses": ["3-5 suggested responses or talking points"],- "follow_up_questions": ["2-4 helpful questions to ask"],- "reference_points": ["1-2 key points to keep in mind"],- "avoid_saying": ["1-2 things to avoid"]-}`;-- try {- const response = await llm.completeJSON<{- title: string;- suggested_responses: string[];- follow_up_questions: string[];- reference_points?: string[];- avoid_saying?: string[];- }>(prompt, 'You are a meeting facilitation expert. Return valid JSON only.');-- if (response.success && response.data) {- return {- id: `generated-${uuid()}`,- triggerCategory,- title: response.data.title || `Responding to ${triggerCategory.replace('_', ' ')}`,- suggestedResponses: response.data.suggested_responses || [],- followUpQuestions: response.data.follow_up_questions || [],- referencePoints: response.data.reference_points,- avoidSaying: response.data.avoid_saying,- confidence: 0.6,- };- }- } catch (error) {- log.warn({ error }, 'Failed to generate smart card');- }-- // Fallback- return {- id: `fallback-${uuid()}`,- triggerCategory,- title: `${triggerCategory.replace('_', ' ')} detected`,- suggestedResponses: ['Acknowledge the point', 'Ask for clarification if needed'],- followUpQuestions: ['Can you tell me more about that?', 'What would help here?'],- confidence: 0.3,- };- }-- /**- * Select the best smart card from multiple options- */- private async selectBestSmartCard(- cards: SmartCardContent[],- triggerText: string,- context: string- ): Promise<SmartCardContent> {- const llm = getLLMService();-- const cardsContext = cards.map((card, idx) => {- const responses = card.suggestedResponses;- return `Card ${idx + 1} (${card.id}):\nTitle: ${card.title}\nResponses: ${responses.slice(0, 2).join('; ')}`;- }).join('\n\n');-- const prompt = `Select the most relevant smart card for this meeting moment.--Statement: "${triggerText}"--Context:-${context}--Available smart cards:-${cardsContext}--Respond with JSON:-{- "selected_index": 0-${cards.length - 1},- "confidence": 0.0-1.0,- "reasoning": "why this card is best"-}`;-- try {- const response = await llm.completeJSON<{- selected_index: number;- confidence: number;- reasoning: string;- }>(prompt, 'You are a meeting facilitation expert. Return valid JSON only.');-- if (response.success && response.data) {- const selectedIndex = Math.max(0, Math.min(response.data.selected_index, cards.length - 1));- const selected = cards[selectedIndex];-- return {- ...selected,- confidence: response.data.confidence,- };- }- } catch (error) {- log.warn({ error }, 'Failed to select best smart card');- }-- // Fallback to first card- return {- ...cards[0],- confidence: 0.7,- };- }-- /**- * Update smart card trigger status- */- updateTriggerStatus(triggerId: string, status: 'active' | 'pinned' | 'dismissed'): void {- try {- updateSmartCardTrigger(triggerId, { status });- } catch (error) {- log.error({ error, triggerId, status }, 'Failed to update trigger status');- }- }-- /**- * Submit feedback for a smart card trigger- */- submitFeedback(triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant'): void {- try {- updateSmartCardTrigger(triggerId, { feedback });- log.info({ triggerId, feedback }, 'Smart card feedback submitted');- } catch (error) {- log.error({ error, triggerId, feedback }, 'Failed to submit feedback');- }- }-- /**- * Reset cooldowns- */- reset(): void {- this.recentTriggers.clear();- }-}--// Singleton Instance--let instance: SmartCardEngineService | null = null;--export function getSmartCardEngine(): SmartCardEngineService {- if (!instance) {- instance = new SmartCardEngineService();- }- return instance;-}--export function resetSmartCardEngine(): void {- if (instance) {- instance.reset();- }- instance = null;-}--// Backwards compatibility aliases-export {- SmartCardEngineService as CueCardEngineService,- getSmartCardEngine as getCueCardEngine,- resetSmartCardEngine as resetCueCardEngine,-};--export type ObjectionType = TriggerCategory;-export type CueCardContent = SmartCardContent;-export type CueCardTriggerData = SmartCardTriggerData;-export type ObjectionDetectionResult = TriggerDetectionResult;--export default SmartCardEngineService;diff --git a/src/main/services/copilot/summary-generator.service.ts b/src/main/services/copilot/summary-generator.service.tsindex 5d90f5e..22598c6 100644--- a/src/main/services/copilot/summary-generator.service.ts+++ b/src/main/services/copilot/summary-generator.service.ts@@ -8,7 +8,6 @@import { logger } from '../../lib/logger';import { getLLMService } from '../llm.service';import type { TranscriptSegmentData } from './transcript-buffer.service';-import type { PlaybookSnapshot } from './playbook-tracker.service';import type { ConversationMetrics } from './conversation-metrics.service';const log = logger.child({ module: 'summary-generator' });@@ -24,7 +23,6 @@ export interface CallSummary {export interface FullCallReport {summary: CallSummary;- playbook?: PlaybookSnapshot;metrics?: ConversationMetrics;callDuration: number;segmentCount: number;diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex d9ba99e..b5dfe1a 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -16,21 +16,14 @@ import { Card, CardContent, CardHeader, CardTitle, CardDescription } from './comimport { Button } from './components/ui/button';import { Badge } from './components/ui/badge';import { ErrorToast } from './components/ui/error-toast';-import { AlertCircle, Shield, BookOpen, X, Mic, Users, Gauge, Loader2 } from 'lucide-react';+import { AlertCircle, Shield, Loader2 } from 'lucide-react';import {- CueCardOverlay,- PlaybookPanel,NudgeToast,- SentimentIndicator,CallSummaryView,} from './components/copilot';import { MCPResultsOverlay } from './components/mcp';import { useCopilotStore } from './stores/copilot.store';-import { CueCardEditor } from './components/settings/CueCardEditor';-import { PlaybookEditor } from './components/settings/PlaybookEditor';-import { PromptsEditor } from './components/settings/PromptsEditor';import { MCPServersPanel } from './components/settings/MCPServersPanel';-import { cn } from './lib/utils';type Tab = 'recording' | 'history' | 'settings';@@ -93,135 +86,8 @@ function PermissionsView() {);}-function PlaybookModal({- isOpen,- onClose,-}: {- isOpen: boolean;- onClose: () => void;-}) {- if (!isOpen) return null;-- return (- <div- className="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 animate-in fade-in duration-200 p-8"- onClick={onClose}- >- <Card- className="w-full max-w-2xl max-h-full overflow-hidden flex flex-col animate-in zoom-in-95 duration-200"- onClick={(e) => e.stopPropagation()}- >- <CardHeader className="border-b flex flex-row items-center justify-between shrink-0">- <div>- <CardTitle>Playbook Progress</CardTitle>- <CardDescription>Track your discovery progress</CardDescription>- </div>- <Button variant="ghost" size="icon" onClick={onClose}>- <X className="h-5 w-5" />- </Button>- </CardHeader>- <CardContent className="p-4 flex-1 overflow-hidden min-h-0">- <PlaybookPanel className="h-full" />- </CardContent>- </Card>- </div>- );-}--function MetricsSidebar() {- const { metrics, healthScore, isCallActive } = useCopilotStore();-- if (!isCallActive || !metrics) {- return null;- }-- const mePercent = Math.round(metrics.talkRatio.me * 100);- const themPercent = Math.round(metrics.talkRatio.them * 100);-- const getHealthColor = () => {- if (healthScore >= 80) return 'text-green-500';- if (healthScore >= 60) return 'text-amber-500';- return 'text-red-500';- };-- const getHealthLabel = () => {- if (healthScore >= 80) return 'Great';- if (healthScore >= 60) return 'Good';- if (healthScore >= 40) return 'Fair';- return 'Needs Work';- };-- return (- <Card>- <CardHeader className="pb-2">- <div className="flex items-center justify-between">- <CardTitle className="text-sm font-medium flex items-center gap-2">- <Gauge className="h-4 w-4" />- Conversation Metrics- </CardTitle>- <Badge variant="outline" className="text-xs">- {Math.floor(metrics.callDuration / 60)}:{String(Math.floor(metrics.callDuration % 60)).padStart(2, '0')}- </Badge>- </div>- </CardHeader>- <CardContent className="space-y-4">- {/* Health Score */}- <div className="flex items-center justify-between p-3 bg-gradient-to-r from-muted/50 to-muted rounded-lg">- <div>- <p className="text-sm font-medium">Conversation Health</p>- <p className="text-xs text-muted-foreground">{getHealthLabel()}</p>- </div>- <div className="flex items-center gap-2">- <div className={cn('text-3xl font-bold', getHealthColor())}>{healthScore}</div>- <span className="text-sm text-muted-foreground">/100</span>- </div>- </div>-- {/* Talk Ratio */}- <div>- <p className="text-xs font-medium text-muted-foreground mb-2">Talk Ratio</p>- <div className="space-y-2">- <div className="flex justify-between text-xs text-muted-foreground">- <span className="flex items-center gap-1">- <Mic className="h-3 w-3" />- You: {mePercent}%- </span>- <span className="flex items-center gap-1">- <Users className="h-3 w-3" />- Them: {themPercent}%- </span>- </div>- <div className="h-3 flex rounded-full overflow-hidden bg-muted">- <div- className={cn(- 'transition-all duration-500',- mePercent > 65 ? 'bg-amber-500' : mePercent >= 35 ? 'bg-green-500' : 'bg-blue-500'- )}- style={{ width: `${mePercent}%` }}- />- <div className="bg-slate-400 transition-all duration-500" style={{ width: `${themPercent}%` }} />- </div>- </div>- </div>-- {/* Speaking Pace */}- <div className="flex items-center justify-between p-2 rounded-lg bg-muted/50">- <div className="flex items-center gap-2">- <Gauge className="h-4 w-4 text-muted-foreground" />- <span className="text-sm">Speaking Pace</span>- </div>- <span className={cn('text-lg font-semibold', metrics.pace > 180 ? 'text-amber-500' : '')}>- {metrics.pace} WPM- </span>- </div>- </CardContent>- </Card>- );-}-function RecordingView() {- const [showPlaybookModal, setShowPlaybookModal] = useState(false);- const { isCallActive, callSummary, playbook } = useCopilotStore();+ const { isCallActive, callSummary } = useCopilotStore();const { status, streams, toggleStream, isStarting, isStopping } = useSession();const isRecording = status === 'recording';@@ -304,58 +170,27 @@ function RecordingView() {</div></div>- {/* Right Column - Assistance + Metrics */}+ {/* Right Column - MCP Results */}<div className="w-96 flex flex-col gap-4 shrink-0 overflow-hidden">- {/* Scrollable container for right panel */}- <div className="flex-1 overflow-y-auto space-y-4 pr-1">+ <div className="flex-1 overflow-y-auto pr-1">{/* MCP Results Overlay - Shows tool call results */}<MCPResultsOverlay />-- {/* Cue Card Overlay */}- <CueCardOverlay />-- {/* Sentiment Indicator */}- <SentimentIndicator />-- {/* Metrics Sidebar */}- <MetricsSidebar /></div></div></div>- {/* Floating Playbook Button */}- {isCallActive && playbook && (- <button- onClick={() => setShowPlaybookModal(true)}- className="fixed bottom-6 right-6 w-14 h-14 bg-gradient-to-br from-blue-600 to-purple-600 rounded-full shadow-lg hover:shadow-xl transition-all hover:scale-110 flex items-center justify-center text-white z-40"- title="View Playbook Progress"- >- <BookOpen className="w-6 h-6" />- {playbook.coveragePercentage < 70 && (- <span className="absolute -top-1 -right-1 w-5 h-5 bg-red-500 rounded-full text-xs flex items-center justify-center font-bold">- {playbook.missing}- </span>- )}- </button>- )}-- {/* Playbook Modal */}- <PlaybookModal isOpen={showPlaybookModal} onClose={() => setShowPlaybookModal(false)} /></div>);}function SettingsView() {const [activeSettingsTab, setActiveSettingsTab] = useState<- 'account' | 'cueCards' | 'playbooks' | 'prompts' | 'mcpServers'+ 'account' | 'mcpServers'>('account');const configStore = useConfigStore();const settingsTabs = [{ id: 'account' as const, label: 'Account' },- { id: 'cueCards' as const, label: 'Cue Cards' },- { id: 'playbooks' as const, label: 'Playbooks' },- { id: 'prompts' as const, label: 'AI Settings' },{ id: 'mcpServers' as const, label: 'MCP Servers' },];@@ -414,9 +249,6 @@ function SettingsView() {</div>)}- {activeSettingsTab === 'cueCards' && <CueCardEditor />}- {activeSettingsTab === 'playbooks' && <PlaybookEditor />}- {activeSettingsTab === 'prompts' && <PromptsEditor />}{activeSettingsTab === 'mcpServers' && <MCPServersPanel />}</div></div>diff --git a/src/renderer/components/copilot/CueCardOverlay.tsx b/src/renderer/components/copilot/CueCardOverlay.tsxdeleted file mode 100644index e2e2548..0000000--- a/src/renderer/components/copilot/CueCardOverlay.tsx+++ /dev/null@@ -1,331 +0,0 @@-/**- * Cue Card Overlay (Assistance Panel) Component- *- * Redesigned as a slide-in panel with:- * - Gradient header with objection type- * - Talk tracks in green boxes- * - Follow-up questions in blue boxes- * - Proof points in purple boxes- * - Feedback buttons- */--import React, { useState } from 'react';-import { Card, CardContent, CardHeader } from '../ui/card';-import { Button } from '../ui/button';-import { Badge } from '../ui/badge';-import { ScrollArea } from '../ui/scroll-area';-import {- X,- Pin,- ThumbsUp,- ThumbsDown,- Lightbulb,- Check,- HelpCircle,- BarChart3,- AlertCircle,-} from 'lucide-react';-import { useCopilotStore } from '../../stores/copilot.store';-import { useCopilot } from '../../hooks/useCopilot';-import { cn } from '../../lib/utils';-import type { CopilotCueCard } from '../../../shared/types/ipc.types';--// Sub-components--interface CueCardItemProps {- cueCard: CopilotCueCard;- isPinned?: boolean;- onDismiss: (triggerId: string) => void;- onPin: (triggerId: string) => void;- onFeedback: (triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant') => void;-}--function CueCardItem({ cueCard, isPinned, onDismiss, onPin, onFeedback }: CueCardItemProps) {- const [showFeedback, setShowFeedback] = useState(false);-- const getTriggerGradient = (type: string) => {- switch (type) {- case 'open_question':- return 'from-blue-50 to-indigo-50 dark:from-blue-950/30 dark:to-indigo-950/30';- case 'decision_point':- return 'from-purple-50 to-violet-50 dark:from-purple-950/30 dark:to-violet-950/30';- case 'concern':- return 'from-amber-50 to-orange-50 dark:from-amber-950/30 dark:to-orange-950/30';- case 'risk':- return 'from-red-50 to-rose-50 dark:from-red-950/30 dark:to-rose-950/30';- case 'commitment':- return 'from-green-50 to-emerald-50 dark:from-green-950/30 dark:to-emerald-950/30';- case 'follow_up':- return 'from-cyan-50 to-teal-50 dark:from-cyan-950/30 dark:to-teal-950/30';- case 'information_request':- return 'from-indigo-50 to-blue-50 dark:from-indigo-950/30 dark:to-blue-950/30';- default:- return 'from-slate-50 to-gray-50 dark:from-slate-950/30 dark:to-gray-950/30';- }- };-- const getTriggerColor = (type: string) => {- switch (type) {- case 'open_question':- return 'bg-blue-500 text-white';- case 'decision_point':- return 'bg-purple-500 text-white';- case 'concern':- return 'bg-amber-500 text-white';- case 'risk':- return 'bg-red-500 text-white';- case 'commitment':- return 'bg-green-500 text-white';- case 'follow_up':- return 'bg-cyan-500 text-white';- case 'information_request':- return 'bg-indigo-500 text-white';- default:- return 'bg-slate-500 text-white';- }- };-- const formatTriggerLabel = (type: string) => {- return type.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');- };-- // Backwards compatibility aliases- const getObjectionGradient = getTriggerGradient;- const getObjectionColor = getTriggerColor;-- return (- <Card className="overflow-hidden shadow-lg border-2 animate-in slide-in-from-right duration-300">- {/* Header with gradient */}- <CardHeader- className={cn('border-b p-4 bg-gradient-to-r', getTriggerGradient(cueCard.objectionType))}- >- <div className="flex items-start justify-between mb-2">- <div className="flex-1">- <Badge className={cn('mb-2 text-xs', getTriggerColor(cueCard.objectionType))}>- {formatTriggerLabel(cueCard.objectionType)}- </Badge>- <h3 className="font-semibold text-base leading-tight">{cueCard.title}</h3>- </div>- <div className="flex gap-1 shrink-0">- {!isPinned && (- <Button- variant="ghost"- size="icon"- className="h-7 w-7"- onClick={() => onPin(cueCard.triggerId)}- title="Pin this card"- >- <Pin className="h-4 w-4" />- </Button>- )}- <Button- variant="ghost"- size="icon"- className="h-7 w-7"- onClick={() => onDismiss(cueCard.triggerId)}- title="Dismiss"- >- <X className="h-4 w-4" />- </Button>- </div>- </div>- <p className="text-sm text-slate-600 dark:text-slate-400 italic line-clamp-2">- "{cueCard.triggerText}"- </p>- </CardHeader>-- {/* Content */}- <CardContent className="p-4 space-y-4">- {/* Talk Tracks - Say This */}- <div>- <h4 className="text-sm font-semibold text-green-600 dark:text-green-400 mb-2 flex items-center gap-2">- <Check className="h-4 w-4" />- Say This- </h4>- <div className="space-y-2">- {cueCard.talkTracks.slice(0, 3).map((track, idx) => (- <div- key={idx}- className="p-3 bg-green-50 dark:bg-green-950/30 rounded-lg border border-green-200 dark:border-green-800 hover:shadow-md transition-shadow cursor-pointer group"- >- <p className="text-sm leading-relaxed text-slate-700 dark:text-slate-300">{track}</p>- </div>- ))}- </div>- </div>-- {/* Follow-up Questions - Ask This */}- <div>- <h4 className="text-sm font-semibold text-blue-600 dark:text-blue-400 mb-2 flex items-center gap-2">- <HelpCircle className="h-4 w-4" />- Ask This- </h4>- <div className="space-y-2">- {cueCard.followUpQuestions.slice(0, 3).map((question, idx) => (- <div- key={idx}- className="p-3 bg-blue-50 dark:bg-blue-950/30 rounded-lg border border-blue-200 dark:border-blue-800 hover:shadow-md transition-shadow cursor-pointer"- >- <p className="text-sm leading-relaxed text-slate-700 dark:text-slate-300">- {question}- </p>- </div>- ))}- </div>- </div>-- {/* Proof Points */}- {cueCard.proofPoints && cueCard.proofPoints.length > 0 && (- <div>- <h4 className="text-sm font-semibold text-purple-600 dark:text-purple-400 mb-2 flex items-center gap-2">- <BarChart3 className="h-4 w-4" />- Proof Points- </h4>- <div className="space-y-2">- {cueCard.proofPoints.slice(0, 2).map((point, idx) => (- <div- key={idx}- className="p-2 bg-purple-50 dark:bg-purple-950/30 rounded-lg text-sm text-slate-600 dark:text-slate-400"- >- {point}- </div>- ))}- </div>- </div>- )}-- {/* Avoid Saying */}- {cueCard.avoidSaying && cueCard.avoidSaying.length > 0 && (- <div>- <h4 className="text-sm font-semibold text-red-600 dark:text-red-400 mb-2 flex items-center gap-2">- <AlertCircle className="h-4 w-4" />- Avoid Saying- </h4>- <div className="space-y-2">- {cueCard.avoidSaying.slice(0, 2).map((avoid, idx) => (- <div- key={idx}- className="p-2 bg-red-50 dark:bg-red-950/30 rounded-lg text-sm text-slate-600 dark:text-slate-400 border border-red-200 dark:border-red-800"- >- {avoid}- </div>- ))}- </div>- </div>- )}- </CardContent>-- {/* Footer - Feedback */}- <div className="border-t p-3 bg-slate-50 dark:bg-slate-900">- {!showFeedback ? (- <button- className="text-xs text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"- onClick={() => setShowFeedback(true)}- >- Was this helpful?- </button>- ) : (- <div className="flex gap-2">- <Button- variant="outline"- size="sm"- className="flex-1 gap-2 h-8 text-xs"- onClick={() => {- onFeedback(cueCard.triggerId, 'helpful');- setShowFeedback(false);- }}- >- <ThumbsUp className="w-3 h-3" />- Helpful- </Button>- <Button- variant="outline"- size="sm"- className="flex-1 gap-2 h-8 text-xs"- onClick={() => {- onFeedback(cueCard.triggerId, 'wrong');- setShowFeedback(false);- }}- >- <ThumbsDown className="w-3 h-3" />- Wrong- </Button>- </div>- )}- </div>- </Card>- );-}--// Main Component--interface CueCardOverlayProps {- className?: string;- maxCards?: number;-}--export function CueCardOverlay({ className, maxCards = 2 }: CueCardOverlayProps) {- const { activeCueCards, pinnedCueCards, isCallActive } = useCopilotStore();- const { dismissCueCard, pinCueCard, submitCueCardFeedback } = useCopilot();-- const allCards = [- ...pinnedCueCards,- ...activeCueCards.slice(0, maxCards - pinnedCueCards.length),- ];-- if (!isCallActive || allCards.length === 0) {- return (- <div className={cn('flex flex-col', className)}>- <div className="flex items-center justify-between mb-3">- <div className="flex items-center gap-2">- <Lightbulb className="h-4 w-4 text-amber-500" />- <span className="text-sm font-medium">Live Assist</span>- </div>- </div>- <Card className="flex-1">- <CardContent className="flex items-center justify-center h-full min-h-[200px]">- <div className="text-center">- <Lightbulb className="h-8 w-8 text-slate-300 dark:text-slate-600 mx-auto mb-2" />- <p className="text-sm text-slate-500 dark:text-slate-400">- {isCallActive- ? 'Smart cards will appear when relevant moments are detected'- : 'Start recording to see live assistance'}- </p>- </div>- </CardContent>- </Card>- </div>- );- }-- return (- <div className={cn('flex flex-col', className)}>- <div className="flex items-center justify-between mb-3">- <div className="flex items-center gap-2">- <Lightbulb className="h-4 w-4 text-amber-500" />- <span className="text-sm font-semibold">Live Assist</span>- </div>- <Badge variant="secondary" className="text-xs">- {allCards.length} active- </Badge>- </div>-- <ScrollArea className="flex-1">- <div className="space-y-3 pr-2">- {allCards.map((card) => (- <CueCardItem- key={card.triggerId}- cueCard={card}- isPinned={card.status === 'pinned'}- onDismiss={dismissCueCard}- onPin={pinCueCard}- onFeedback={submitCueCardFeedback}- />- ))}- </div>- </ScrollArea>- </div>- );-}--export default CueCardOverlay;diff --git a/src/renderer/components/copilot/PlaybookPanel.tsx b/src/renderer/components/copilot/PlaybookPanel.tsxdeleted file mode 100644index 4c44ffa..0000000--- a/src/renderer/components/copilot/PlaybookPanel.tsx+++ /dev/null@@ -1,268 +0,0 @@-/**- * Playbook Panel Component- *- * Displays meeting template progress:- * - Agenda item checklist- * - Coverage status per item- * - Suggested questions- * - Evidence links- */--import React, { useState } from 'react';-import { Card, CardContent, CardHeader, CardTitle } from '../ui/card';-import { Button } from '../ui/button';-import { Badge } from '../ui/badge';-import { ScrollArea } from '../ui/scroll-area';-import {- CheckCircle2,- Circle,- CircleDot,- ChevronDown,- ChevronUp,- BookOpen,- Target,- Lightbulb,- Clock,-} from 'lucide-react';-import { useCopilotStore } from '../../stores/copilot.store';-import { cn } from '../../lib/utils';-import type { CopilotPlaybookItem, CopilotPlaybookSnapshot } from '../../../shared/types/ipc.types';--// Sub-components--function CoverageProgress({ snapshot }: { snapshot: CopilotPlaybookSnapshot }) {- const { covered, partial, missing, total, coveragePercentage } = snapshot;-- return (- <div className="space-y-2">- <div className="flex items-center justify-between text-sm">- <span className="font-medium">{coveragePercentage}% Complete</span>- <div className="flex items-center gap-2 text-xs text-muted-foreground">- <span className="flex items-center gap-1">- <CheckCircle2 className="h-3 w-3 text-green-500" />- {covered}- </span>- <span className="flex items-center gap-1">- <CircleDot className="h-3 w-3 text-amber-500" />- {partial}- </span>- <span className="flex items-center gap-1">- <Circle className="h-3 w-3 text-muted-foreground" />- {missing}- </span>- </div>- </div>- <div className="h-2 flex rounded-full overflow-hidden bg-muted">- <div- className="bg-green-500 transition-all duration-500"- style={{ width: `${(covered / total) * 100}%` }}- />- <div- className="bg-amber-500 transition-all duration-500"- style={{ width: `${(partial / total) * 100}%` }}- />- </div>- </div>- );-}--interface PlaybookItemRowProps {- item: CopilotPlaybookItem;- isExpanded: boolean;- onToggle: () => void;-}--function PlaybookItemRow({ item, isExpanded, onToggle }: PlaybookItemRowProps) {- const getStatusIcon = () => {- switch (item.status) {- case 'covered':- return <CheckCircle2 className="h-4 w-4 text-green-500" />;- case 'partial':- return <CircleDot className="h-4 w-4 text-amber-500" />;- default:- return <Circle className="h-4 w-4 text-muted-foreground" />;- }- };-- const getStatusBg = () => {- switch (item.status) {- case 'covered':- return 'bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-800';- case 'partial':- return 'bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800';- default:- return 'bg-background border-border';- }- };-- return (- <div className={cn("rounded-lg border transition-colors", getStatusBg())}>- <button- className="w-full flex items-center justify-between p-3 text-left"- onClick={onToggle}- >- <div className="flex items-center gap-3">- {getStatusIcon()}- <div>- <p className="font-medium text-sm">{item.label}</p>- <p className="text-xs text-muted-foreground">{item.description}</p>- </div>- </div>- {isExpanded ? (- <ChevronUp className="h-4 w-4 text-muted-foreground" />- ) : (- <ChevronDown className="h-4 w-4 text-muted-foreground" />- )}- </button>-- {isExpanded && (- <div className="px-3 pb-3 space-y-3">- {/* Suggested Questions */}- {item.suggestedQuestions && item.suggestedQuestions.length > 0 && (- <div>- <p className="text-xs font-semibold text-muted-foreground mb-1 flex items-center gap-1">- <Lightbulb className="h-3 w-3" />- Suggested Questions- </p>- <ul className="space-y-1">- {item.suggestedQuestions.slice(0, 3).map((q, i) => (- <li key={i} className="text-sm text-muted-foreground pl-3 border-l-2 border-blue-400 py-0.5">- {q}- </li>- ))}- </ul>- </div>- )}-- {/* Evidence (if covered/partial) */}- {item.evidence && item.evidence.length > 0 && (- <div>- <p className="text-xs font-semibold text-muted-foreground mb-1 flex items-center gap-1">- <Clock className="h-3 w-3" />- Evidence- </p>- <ul className="space-y-1">- {item.evidence.slice(0, 2).map((e, i) => (- <li key={i} className="text-xs p-2 bg-muted/50 rounded">- <span className="text-muted-foreground">- @ {Math.floor(e.timestamp / 60)}:{String(Math.floor(e.timestamp % 60)).padStart(2, '0')}- </span>- <p className="mt-0.5 italic">"{e.excerpt}"</p>- </li>- ))}- </ul>- </div>- )}- </div>- )}- </div>- );-}--// Main Component--interface PlaybookPanelProps {- className?: string;- compact?: boolean;-}--export function PlaybookPanel({ className, compact = false }: PlaybookPanelProps) {- const { playbook, isCallActive } = useCopilotStore();- const [expandedItem, setExpandedItem] = useState<string | null>(null);-- if (!playbook) {- return (- <Card className={cn("", className)}>- <CardHeader className="pb-2">- <CardTitle className="text-sm font-medium flex items-center gap-2">- <BookOpen className="h-4 w-4" />- Playbook- </CardTitle>- </CardHeader>- <CardContent>- <p className="text-sm text-muted-foreground text-center py-4">- {isCallActive ? 'Loading playbook...' : 'Start a recording to track playbook progress'}- </p>- </CardContent>- </Card>- );- }-- if (compact) {- const missingItems = playbook.items.filter(i => i.status === 'missing');-- return (- <div className={cn("space-y-2", className)}>- <div className="flex items-center justify-between">- <span className="text-sm font-medium flex items-center gap-1">- <Target className="h-3 w-3" />- {playbook.playbookName}- </span>- <Badge variant={playbook.coveragePercentage >= 70 ? "default" : "secondary"}>- {playbook.coveragePercentage}%- </Badge>- </div>- <CoverageProgress snapshot={playbook} />- {missingItems.length > 0 && (- <p className="text-xs text-muted-foreground">- Missing: {missingItems.slice(0, 2).map(i => i.label).join(', ')}- {missingItems.length > 2 && ` +${missingItems.length - 2} more`}- </p>- )}- </div>- );- }-- return (- <Card className={cn("flex flex-col overflow-hidden", className)}>- <CardHeader className="pb-2 shrink-0">- <div className="flex items-center justify-between">- <CardTitle className="text-sm font-medium flex items-center gap-2">- <BookOpen className="h-4 w-4" />- {playbook.playbookName}- </CardTitle>- <Badge variant={playbook.coveragePercentage >= 70 ? "default" : "secondary"}>- {playbook.coveragePercentage}% Complete- </Badge>- </div>- </CardHeader>- <CardContent className="flex flex-col gap-4 min-h-0 flex-1 overflow-hidden p-4 pt-0">- <CoverageProgress snapshot={playbook} />-- <ScrollArea className="flex-1 -mx-4 px-4">- <div className="space-y-2 pr-2">- {playbook.items.map((item) => (- <PlaybookItemRow- key={item.id}- item={item}- isExpanded={expandedItem === item.id}- onToggle={() => setExpandedItem(- expandedItem === item.id ? null : item.id- )}- />- ))}- </div>- </ScrollArea>-- {/* Recommendations */}- {playbook.recommendations && playbook.recommendations.length > 0 && (- <div className="pt-2 border-t shrink-0">- <p className="text-xs font-semibold text-muted-foreground mb-2 flex items-center gap-1">- <Lightbulb className="h-3 w-3" />- Recommendations- </p>- <ul className="space-y-1">- {playbook.recommendations.slice(0, 2).map((rec, i) => (- <li key={i} className="text-xs text-muted-foreground">- • {rec}- </li>- ))}- </ul>- </div>- )}- </CardContent>- </Card>- );-}--export default PlaybookPanel;diff --git a/src/renderer/components/copilot/SentimentIndicator.tsx b/src/renderer/components/copilot/SentimentIndicator.tsxdeleted file mode 100644index 6a96269..0000000--- a/src/renderer/components/copilot/SentimentIndicator.tsx+++ /dev/null@@ -1,238 +0,0 @@-/**- * Sentiment Indicator Component- *- * Displays participant sentiment with trend visualization.- * Compact view for sidebar, expanded view with history.- */--import React from 'react';-import { Card, CardContent, CardHeader, CardTitle } from '../ui/card';-import { Badge } from '../ui/badge';-import {- SmilePlus,- Meh,- Frown,- TrendingUp,- TrendingDown,- Minus,- Heart,-} from 'lucide-react';-import { useCopilotStore } from '../../stores/copilot.store';-import { cn } from '../../lib/utils';-import type { CopilotSentiment } from '../../../shared/types/ipc.types';--// Sub-components--function SentimentIcon({ sentiment, className }: { sentiment: string; className?: string }) {- switch (sentiment) {- case 'positive':- return <SmilePlus className={cn("text-green-500", className)} />;- case 'negative':- return <Frown className={cn("text-red-500", className)} />;- default:- return <Meh className={cn("text-amber-500", className)} />;- }-}--function TrendIcon({ trend, className }: { trend: string; className?: string }) {- switch (trend) {- case 'improving':- return <TrendingUp className={cn("text-green-500", className)} />;- case 'declining':- return <TrendingDown className={cn("text-red-500", className)} />;- default:- return <Minus className={cn("text-muted-foreground", className)} />;- }-}--function SentimentMeter({ averageScore }: { averageScore: number }) {- // averageScore is -1 to 1, convert to 0-100 for display- const percentage = Math.round((averageScore + 1) * 50);-- const getColor = () => {- if (percentage >= 60) return 'bg-green-500';- if (percentage >= 40) return 'bg-amber-500';- return 'bg-red-500';- };-- return (- <div className="space-y-1">- <div className="h-2 rounded-full bg-muted overflow-hidden">- <div- className={cn("h-full transition-all duration-500 rounded-full", getColor())}- style={{ width: `${percentage}%` }}- />- </div>- <div className="flex justify-between text-xs text-muted-foreground">- <span>Negative</span>- <span>Neutral</span>- <span>Positive</span>- </div>- </div>- );-}--function SentimentHistory({ history }: { history: CopilotSentiment['history'] }) {- if (!history || history.length === 0) {- return null;- }-- // Take last 10 entries- const recentHistory = history.slice(-10);-- return (- <div className="flex items-center gap-0.5">- {recentHistory.map((entry, i) => (- <div- key={i}- className={cn(- "w-2 h-4 rounded-sm transition-colors",- entry.sentiment === 'positive'- ? "bg-green-400"- : entry.sentiment === 'negative'- ? "bg-red-400"- : "bg-amber-400"- )}- title={`${entry.text.substring(0, 50)}...`}- />- ))}- </div>- );-}--// Main Component--interface SentimentIndicatorProps {- className?: string;- compact?: boolean;-}--export function SentimentIndicator({ className, compact = false }: SentimentIndicatorProps) {- const { sentiment, isCallActive } = useCopilotStore();-- if (!isCallActive || !sentiment) {- if (compact) {- return (- <div className={cn("flex items-center gap-2 text-muted-foreground", className)}>- <Heart className="h-4 w-4" />- <span className="text-xs">--</span>- </div>- );- }-- return (- <Card className={cn("", className)}>- <CardHeader className="pb-2">- <CardTitle className="text-sm font-medium flex items-center gap-2">- <Heart className="h-4 w-4" />- Participant Sentiment- </CardTitle>- </CardHeader>- <CardContent>- <p className="text-sm text-muted-foreground text-center py-2">- Sentiment analysis will appear here- </p>- </CardContent>- </Card>- );- }-- const getSentimentLabel = () => {- switch (sentiment.current) {- case 'positive':- return 'Positive';- case 'negative':- return 'Concerned';- default:- return 'Neutral';- }- };-- const getTrendLabel = () => {- switch (sentiment.trend) {- case 'improving':- return 'Improving';- case 'declining':- return 'Declining';- default:- return 'Stable';- }- };-- if (compact) {- return (- <div className={cn("flex items-center gap-2", className)}>- <SentimentIcon sentiment={sentiment.current} className="h-4 w-4" />- <span className="text-xs font-medium">{getSentimentLabel()}</span>- <TrendIcon trend={sentiment.trend} className="h-3 w-3" />- </div>- );- }-- return (- <Card className={cn("", className)}>- <CardHeader className="pb-2">- <div className="flex items-center justify-between">- <CardTitle className="text-sm font-medium flex items-center gap-2">- <Heart className="h-4 w-4" />- Participant Sentiment- </CardTitle>- <Badge- variant={- sentiment.current === 'positive'- ? 'default'- : sentiment.current === 'negative'- ? 'destructive'- : 'secondary'- }- className="text-xs"- >- {getSentimentLabel()}- </Badge>- </div>- </CardHeader>- <CardContent className="space-y-4">- {/* Current Status */}- <div className="flex items-center justify-between p-3 bg-muted/50 rounded-lg">- <div className="flex items-center gap-3">- <SentimentIcon sentiment={sentiment.current} className="h-8 w-8" />- <div>- <p className="font-medium">{getSentimentLabel()}</p>- <p className="text-xs text-muted-foreground flex items-center gap-1">- <TrendIcon trend={sentiment.trend} className="h-3 w-3" />- {getTrendLabel()}- </p>- </div>- </div>- </div>-- {/* Sentiment Meter */}- <div>- <p className="text-xs font-medium text-muted-foreground mb-2">Overall Sentiment</p>- <SentimentMeter averageScore={sentiment.averageScore} />- </div>-- {/* History Timeline */}- {sentiment.history && sentiment.history.length > 0 && (- <div>- <p className="text-xs font-medium text-muted-foreground mb-2">Recent Trend</p>- <SentimentHistory history={sentiment.history} />- </div>- )}-- {/* Warning for negative/declining */}- {(sentiment.current === 'negative' || sentiment.trend === 'declining') && (- <div className="p-2 bg-amber-50 dark:bg-amber-950/20 rounded border border-amber-200 dark:border-amber-800">- <p className="text-xs text-amber-700 dark:text-amber-400">- {sentiment.current === 'negative'- ? 'Participant may have concerns - consider addressing them'- : 'Sentiment is declining - consider checking in'}- </p>- </div>- )}- </CardContent>- </Card>- );-}--export default SentimentIndicator;diff --git a/src/renderer/components/copilot/index.ts b/src/renderer/components/copilot/index.tsindex 65b8e10..25dca6b 100644--- a/src/renderer/components/copilot/index.ts+++ b/src/renderer/components/copilot/index.ts@@ -5,8 +5,5 @@*/export { MetricsPanel } from './MetricsPanel';-export { CueCardOverlay } from './CueCardOverlay';-export { PlaybookPanel } from './PlaybookPanel';export { NudgeToast } from './NudgeToast';-export { SentimentIndicator } from './SentimentIndicator';export { CallSummaryView } from './CallSummaryView';diff --git a/src/renderer/components/history/RecordingCard.tsx b/src/renderer/components/history/RecordingCard.tsxindex d558f60..b02b77a 100644--- a/src/renderer/components/history/RecordingCard.tsx+++ b/src/renderer/components/history/RecordingCard.tsx@@ -42,7 +42,7 @@ export function RecordingCard({ recording, onViewDetails }: RecordingCardProps)const getSummaryBadge = () => {// Prioritize call summary over insights- if (recording.callSummary?.bullets && recording.callSummary.bullets.length > 0) {+ if (recording.callSummary?.summary && recording.callSummary.summary.length > 0) {return <Badge variant="default">Summary ready</Badge>;}@@ -109,19 +109,15 @@ export function RecordingCard({ recording, onViewDetails }: RecordingCardProps)</div>{/* Call Summary preview (prioritized) */}- {recording.callSummary?.bullets && recording.callSummary.bullets.length > 0 && (+ {recording.callSummary?.summary && recording.callSummary.summary.length > 0 && (<div className="mt-3 pt-3 border-t"><p className="text-xs font-medium text-muted-foreground mb-1">Call Summary</p>- <ul className="text-sm space-y-0.5">- {recording.callSummary.bullets.slice(0, 2).map((bullet, i) => (- <li key={i} className="line-clamp-1">• {bullet}</li>- ))}- </ul>+ <p className="text-sm line-clamp-2">{stripMarkdown(recording.callSummary.summary)}</p></div>)}{/* Fallback to insights if no call summary */}- {!recording.callSummary?.bullets?.length && recording.insightsStatus === 'ready' && recording.insights && (+ {!recording.callSummary?.summary?.length && recording.insightsStatus === 'ready' && recording.insights && (<div className="mt-3 pt-3 border-t"><p className="text-xs font-medium text-muted-foreground mb-1">AI Summary</p><p className="text-sm line-clamp-2">{stripMarkdown(recording.insights)}</p>diff --git a/src/renderer/components/recording/TopStatusBar.tsx b/src/renderer/components/recording/TopStatusBar.tsxindex 9cacb83..211b008 100644--- a/src/renderer/components/recording/TopStatusBar.tsx+++ b/src/renderer/components/recording/TopStatusBar.tsx@@ -4,13 +4,12 @@* Compact status bar showing recording info:* - Recording time with indicator* - Talk ratio visualization- * - Sentiment indicator- * - Playbook progress+ * - Health score* - Stop recording button*/import React from 'react';-import { Circle, Square, Smile, Meh, Frown, BookOpen, Mic, Users, Loader2 } from 'lucide-react';+import { Circle, Square, Mic, Users, Loader2, Gauge } from 'lucide-react';import { Button } from '../ui/button';import { Badge } from '../ui/badge';import { useSession } from '../../hooks/useSession';@@ -20,35 +19,11 @@ import { formatDuration, cn } from '../../lib/utils';export function TopStatusBar() {const { status, elapsedTime, isRecording, isStopping, stopRecording, startRecording, isStarting } =useSession();- const { metrics, healthScore, sentiment, playbook, isCallActive } = useCopilotStore();+ const { metrics, healthScore, isCallActive } = useCopilotStore();const mePercent = metrics ? Math.round(metrics.talkRatio.me * 100) : 0;const themPercent = metrics ? Math.round(metrics.talkRatio.them * 100) : 0;- const getSentimentIcon = () => {- if (!sentiment) return <Meh className="w-5 h-5 text-slate-400" />;- switch (sentiment.current) {- case 'positive':- return <Smile className="w-5 h-5 text-green-500" />;- case 'negative':- return <Frown className="w-5 h-5 text-red-500" />;- default:- return <Meh className="w-5 h-5 text-amber-500" />;- }- };-- const getSentimentLabel = () => {- if (!sentiment) return 'Neutral';- switch (sentiment.current) {- case 'positive':- return 'Positive';- case 'negative':- return 'Concerned';- default:- return 'Neutral';- }- };-if (!isRecording && status === 'idle') {return (<div className="h-16 border-b bg-white/80 dark:bg-slate-900/80 backdrop-blur-lg flex items-center px-6 gap-6">@@ -167,26 +142,19 @@ export function TopStatusBar() {</div></div>- <div className="h-8 w-px bg-slate-200 dark:bg-slate-700" />-- {/* Sentiment */}- <div className="flex items-center gap-2">- {getSentimentIcon()}- <span className="text-sm font-medium">{getSentimentLabel()}</span>- </div>-- {playbook && (+ {/* Speaking Pace */}+ {metrics && (<><div className="h-8 w-px bg-slate-200 dark:bg-slate-700" /><div className="flex items-center gap-2">- <BookOpen className="w-4 h-4 text-slate-500" />- <span className="text-sm font-medium">{playbook.playbookName}</span>- <Badge- variant={playbook.coveragePercentage >= 70 ? 'default' : 'outline'}- className="ml-1"- >- {playbook.covered}/{playbook.total}- </Badge>+ <Gauge className="w-4 h-4 text-slate-500" />+ <span className={cn(+ 'text-lg font-bold',+ metrics.pace > 180 ? 'text-amber-500' : 'text-slate-600 dark:text-slate-400'+ )}>+ {metrics.pace}+ </span>+ <span className="text-sm text-slate-500">WPM</span></div></>)}diff --git a/src/renderer/components/settings/CueCardEditor.tsx b/src/renderer/components/settings/CueCardEditor.tsxdeleted file mode 100644index ce0e3c2..0000000--- a/src/renderer/components/settings/CueCardEditor.tsx+++ /dev/null@@ -1,453 +0,0 @@-/**- * Cue Card Editor Component- *- * Allows users to view, create, edit, and delete cue cards- * for objection handling.- */--import React, { useState } from 'react';-import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../ui/card';-import { Button } from '../ui/button';-import { Input } from '../ui/input';-import { Label } from '../ui/label';-import { Textarea } from '../ui/textarea';-import { Badge } from '../ui/badge';-import { ScrollArea } from '../ui/scroll-area';-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from '../ui/dialog';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '../ui/select';-import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,- AlertDialogTrigger,-} from '../ui/alert-dialog';-import { Plus, Pencil, Trash2, MessageSquare, HelpCircle, X } from 'lucide-react';-import { trpc } from '../../api/trpc';-import { cn } from '../../lib/utils';--// New trigger categories (preferred)-const TRIGGER_CATEGORIES = [- { value: 'open_question', label: 'Open Question', color: 'bg-blue-100 text-blue-800' },- { value: 'decision_point', label: 'Decision Point', color: 'bg-purple-100 text-purple-800' },- { value: 'concern', label: 'Concern', color: 'bg-amber-100 text-amber-800' },- { value: 'risk', label: 'Risk', color: 'bg-red-100 text-red-800' },- { value: 'commitment', label: 'Commitment', color: 'bg-green-100 text-green-800' },- { value: 'follow_up', label: 'Follow Up', color: 'bg-cyan-100 text-cyan-800' },- { value: 'information_request', label: 'Info Request', color: 'bg-indigo-100 text-indigo-800' },- // Legacy types for backwards compatibility with existing data- { value: 'pricing', label: 'Pricing (Legacy)', color: 'bg-green-100 text-green-800' },- { value: 'timing', label: 'Timing (Legacy)', color: 'bg-amber-100 text-amber-800' },- { value: 'competitor', label: 'Competitor (Legacy)', color: 'bg-purple-100 text-purple-800' },- { value: 'authority', label: 'Authority (Legacy)', color: 'bg-blue-100 text-blue-800' },- { value: 'security', label: 'Security (Legacy)', color: 'bg-red-100 text-red-800' },- { value: 'integration', label: 'Integration (Legacy)', color: 'bg-cyan-100 text-cyan-800' },- { value: 'not_interested', label: 'Not Interested (Legacy)', color: 'bg-gray-100 text-gray-800' },- { value: 'send_info', label: 'Send Info (Legacy)', color: 'bg-indigo-100 text-indigo-800' },-];--// For backwards compatibility-const OBJECTION_TYPES = TRIGGER_CATEGORIES;--type TriggerCategory = typeof TRIGGER_CATEGORIES[number]['value'];-type ObjectionType = string; // Use string for flexibility with both old and new types--interface CueCard {- id: string;- objectionType: string;- title: string;- talkTracks: string[];- followUpQuestions: string[];- proofPoints?: string[];- avoidSaying?: string[];- sourceDoc?: string;- isDefault: boolean;-}--interface CueCardFormData {- objectionType: string;- title: string;- talkTracks: string;- followUpQuestions: string;- proofPoints: string;- avoidSaying: string;- sourceDoc: string;-}--const emptyForm: CueCardFormData = {- objectionType: 'open_question',- title: '',- talkTracks: '',- followUpQuestions: '',- proofPoints: '',- avoidSaying: '',- sourceDoc: '',-};--function CueCardForm({- initialData,- onSubmit,- onCancel,- isLoading,-}: {- initialData?: CueCard;- onSubmit: (data: CueCardFormData) => void;- onCancel: () => void;- isLoading: boolean;-}) {- const [form, setForm] = useState<CueCardFormData>(- initialData- ? {- objectionType: initialData.objectionType,- title: initialData.title,- talkTracks: initialData.talkTracks.join('\n'),- followUpQuestions: initialData.followUpQuestions.join('\n'),- proofPoints: initialData.proofPoints?.join('\n') || '',- avoidSaying: initialData.avoidSaying?.join('\n') || '',- sourceDoc: initialData.sourceDoc || '',- }- : emptyForm- );-- const handleSubmit = (e: React.FormEvent) => {- e.preventDefault();- onSubmit(form);- };-- return (- <form onSubmit={handleSubmit} className="space-y-4">- <div className="grid grid-cols-2 gap-4">- <div className="space-y-2">- <Label htmlFor="triggerCategory">Trigger Category</Label>- <Select- value={form.objectionType}- onValueChange={(v) => setForm({ ...form, objectionType: v })}- >- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- {TRIGGER_CATEGORIES.map((type) => (- <SelectItem key={type.value} value={type.value}>- {type.label}- </SelectItem>- ))}- </SelectContent>- </Select>- </div>- <div className="space-y-2">- <Label htmlFor="title">Title</Label>- <Input- id="title"- value={form.title}- onChange={(e) => setForm({ ...form, title: e.target.value })}- placeholder="e.g., Responding to Open Questions"- required- />- </div>- </div>-- <div className="space-y-2">- <Label htmlFor="talkTracks">- Talk Tracks <span className="text-muted-foreground text-xs">(one per line)</span>- </Label>- <Textarea- id="talkTracks"- value={form.talkTracks}- onChange={(e) => setForm({ ...form, talkTracks: e.target.value })}- placeholder="I understand budget is a concern. Let's talk about the ROI... What would the cost of NOT solving this problem be?"- rows={4}- required- />- </div>-- <div className="space-y-2">- <Label htmlFor="followUpQuestions">- Follow-up Questions <span className="text-muted-foreground text-xs">(one per line)</span>- </Label>- <Textarea- id="followUpQuestions"- value={form.followUpQuestions}- onChange={(e) => setForm({ ...form, followUpQuestions: e.target.value })}- placeholder="What budget range were you expecting? How do you typically evaluate ROI?"- rows={3}- required- />- </div>-- <div className="grid grid-cols-2 gap-4">- <div className="space-y-2">- <Label htmlFor="proofPoints">- Proof Points <span className="text-muted-foreground text-xs">(optional, one per line)</span>- </Label>- <Textarea- id="proofPoints"- value={form.proofPoints}- onChange={(e) => setForm({ ...form, proofPoints: e.target.value })}- placeholder="Key data point or statistic Reference from documentation"- rows={2}- />- </div>- <div className="space-y-2">- <Label htmlFor="avoidSaying">- Avoid Saying <span className="text-muted-foreground text-xs">(optional, one per line)</span>- </Label>- <Textarea- id="avoidSaying"- value={form.avoidSaying}- onChange={(e) => setForm({ ...form, avoidSaying: e.target.value })}- placeholder="I can give you a discount It's not that expensive"- rows={2}- />- </div>- </div>-- <div className="space-y-2">- <Label htmlFor="sourceDoc">- Source Document <span className="text-muted-foreground text-xs">(optional reference)</span>- </Label>- <Input- id="sourceDoc"- value={form.sourceDoc}- onChange={(e) => setForm({ ...form, sourceDoc: e.target.value })}- placeholder="e.g., Meeting Playbook v2.0, Page 15"- />- </div>-- <DialogFooter>- <Button type="button" variant="outline" onClick={onCancel}>- Cancel- </Button>- <Button type="submit" disabled={isLoading}>- {isLoading ? 'Saving...' : initialData ? 'Update' : 'Create'}- </Button>- </DialogFooter>- </form>- );-}--export function CueCardEditor() {- const [editingCard, setEditingCard] = useState<CueCard | null>(null);- const [isCreateOpen, setIsCreateOpen] = useState(false);- const [isEditOpen, setIsEditOpen] = useState(false);-- const { data: cueCards, refetch } = trpc.settings.getCueCards.useQuery();- const createMutation = trpc.settings.createCueCard.useMutation({- onSuccess: () => {- refetch();- setIsCreateOpen(false);- },- });- const updateMutation = trpc.settings.updateCueCard.useMutation({- onSuccess: () => {- refetch();- setIsEditOpen(false);- setEditingCard(null);- },- });- const deleteMutation = trpc.settings.deleteCueCard.useMutation({- onSuccess: () => refetch(),- });-- const handleCreate = (data: CueCardFormData) => {- createMutation.mutate({- objectionType: data.objectionType as TriggerCategory,- title: data.title,- talkTracks: data.talkTracks.split('\n').filter(Boolean),- followUpQuestions: data.followUpQuestions.split('\n').filter(Boolean),- proofPoints: data.proofPoints ? data.proofPoints.split('\n').filter(Boolean) : undefined,- avoidSaying: data.avoidSaying ? data.avoidSaying.split('\n').filter(Boolean) : undefined,- sourceDoc: data.sourceDoc || undefined,- });- };-- const handleUpdate = (data: CueCardFormData) => {- if (!editingCard) return;- updateMutation.mutate({- id: editingCard.id,- data: {- objectionType: data.objectionType as TriggerCategory,- title: data.title,- talkTracks: data.talkTracks.split('\n').filter(Boolean),- followUpQuestions: data.followUpQuestions.split('\n').filter(Boolean),- proofPoints: data.proofPoints ? data.proofPoints.split('\n').filter(Boolean) : [],- avoidSaying: data.avoidSaying ? data.avoidSaying.split('\n').filter(Boolean) : [],- sourceDoc: data.sourceDoc || undefined,- },- });- };-- const getTypeColor = (type: string) => {- return OBJECTION_TYPES.find((t) => t.value === type)?.color || 'bg-gray-100 text-gray-800';- };-- return (- <div className="space-y-4">- <div className="flex items-center justify-between">- <div>- <h3 className="text-lg font-medium">Smart Cards</h3>- <p className="text-sm text-muted-foreground">- Customize context-aware prompts shown during meetings- </p>- </div>- <Dialog open={isCreateOpen} onOpenChange={setIsCreateOpen}>- <DialogTrigger asChild>- <Button>- <Plus className="h-4 w-4 mr-2" />- Add Smart Card- </Button>- </DialogTrigger>- <DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">- <DialogHeader>- <DialogTitle>Create Smart Card</DialogTitle>- <DialogDescription>- Add a new smart card with suggested responses and follow-up questions.- </DialogDescription>- </DialogHeader>- <CueCardForm- onSubmit={handleCreate}- onCancel={() => setIsCreateOpen(false)}- isLoading={createMutation.isPending}- />- </DialogContent>- </Dialog>- </div>-- <ScrollArea className="h-[500px]">- <div className="space-y-3 pr-4">- {cueCards?.map((card) => (- <Card key={card.id} className="relative">- <CardHeader className="pb-2">- <div className="flex items-start justify-between">- <div>- <div className="flex items-center gap-2">- <CardTitle className="text-base">{card.title}</CardTitle>- {card.isDefault && (- <Badge variant="secondary" className="text-xs">- Default- </Badge>- )}- </div>- <Badge className={cn('mt-1 text-xs', getTypeColor(card.objectionType))}>- {OBJECTION_TYPES.find((t) => t.value === card.objectionType)?.label}- </Badge>- </div>- <div className="flex items-center gap-1">- <Button- variant="ghost"- size="icon"- className="h-8 w-8"- onClick={() => {- setEditingCard(card as CueCard);- setIsEditOpen(true);- }}- >- <Pencil className="h-4 w-4" />- </Button>- <AlertDialog>- <AlertDialogTrigger asChild>- <Button variant="ghost" size="icon" className="h-8 w-8 text-destructive">- <Trash2 className="h-4 w-4" />- </Button>- </AlertDialogTrigger>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>Delete Smart Card</AlertDialogTitle>- <AlertDialogDescription>- Are you sure you want to delete "{card.title}"? This action cannot be- undone.- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction- onClick={() => deleteMutation.mutate({ id: card.id })}- className="bg-destructive text-destructive-foreground"- >- Delete- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- </div>- </div>- </CardHeader>- <CardContent className="space-y-2">- <div className="flex items-start gap-2">- <MessageSquare className="h-4 w-4 mt-0.5 text-muted-foreground" />- <div className="text-sm">- <span className="font-medium">Talk Tracks:</span>{' '}- {card.talkTracks.slice(0, 2).join(' • ')}- {card.talkTracks.length > 2 && (- <span className="text-muted-foreground"> +{card.talkTracks.length - 2} more</span>- )}- </div>- </div>- <div className="flex items-start gap-2">- <HelpCircle className="h-4 w-4 mt-0.5 text-muted-foreground" />- <div className="text-sm">- <span className="font-medium">Questions:</span>{' '}- {card.followUpQuestions.slice(0, 2).join(' • ')}- {card.followUpQuestions.length > 2 && (- <span className="text-muted-foreground">- {' '}- +{card.followUpQuestions.length - 2} more- </span>- )}- </div>- </div>- </CardContent>- </Card>- ))}-- {(!cueCards || cueCards.length === 0) && (- <div className="text-center py-8 text-muted-foreground">- No smart cards yet. Create one to get started.- </div>- )}- </div>- </ScrollArea>-- {/* Edit Dialog */}- <Dialog open={isEditOpen} onOpenChange={setIsEditOpen}>- <DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">- <DialogHeader>- <DialogTitle>Edit Smart Card</DialogTitle>- <DialogDescription>Update the smart card content.</DialogDescription>- </DialogHeader>- {editingCard && (- <CueCardForm- initialData={editingCard}- onSubmit={handleUpdate}- onCancel={() => {- setIsEditOpen(false);- setEditingCard(null);- }}- isLoading={updateMutation.isPending}- />- )}- </DialogContent>- </Dialog>- </div>- );-}--export default CueCardEditor;diff --git a/src/renderer/components/settings/PlaybookEditor.tsx b/src/renderer/components/settings/PlaybookEditor.tsxdeleted file mode 100644index 851a648..0000000--- a/src/renderer/components/settings/PlaybookEditor.tsx+++ /dev/null@@ -1,545 +0,0 @@-/**- * Meeting Template Editor Component- *- * Allows users to view, create, edit, and manage meeting templates- * (1:1s, Project Reviews, Retrospectives, Discovery calls, etc.)- */--import React, { useState } from 'react';-import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../ui/card';-import { Button } from '../ui/button';-import { Input } from '../ui/input';-import { Label } from '../ui/label';-import { Textarea } from '../ui/textarea';-import { Badge } from '../ui/badge';-import { ScrollArea } from '../ui/scroll-area';-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DialogTrigger,-} from '../ui/dialog';-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from '../ui/select';-import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,- AlertDialogTrigger,-} from '../ui/alert-dialog';-import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,-} from '../ui/accordion';-import { Plus, Pencil, Trash2, Star, BookOpen, X } from 'lucide-react';-import { trpc } from '../../api/trpc';-import { cn } from '../../lib/utils';--const PLAYBOOK_TYPES = [- { value: '1on1', label: '1:1 Check-in' },- { value: 'ProjectReview', label: 'Project Review' },- { value: 'Retrospective', label: 'Retrospective' },- { value: 'Discovery', label: 'Discovery / Requirements' },- { value: 'Interview', label: 'Interview' },- { value: 'Brainstorm', label: 'Brainstorm / Ideation' },- { value: 'Custom', label: 'Custom' },-] as const;--type PlaybookType = typeof PLAYBOOK_TYPES[number]['value'];--interface PlaybookItem {- id: string;- label: string;- description: string;- keywords: string[];- suggestedQuestions: string[];- detectionPrompt?: string;-}--interface Playbook {- id: string;- name: string;- type: PlaybookType;- description?: string;- items: PlaybookItem[];- isDefault: boolean;-}--interface PlaybookItemFormData {- id: string;- label: string;- description: string;- keywords: string;- suggestedQuestions: string;-}--interface PlaybookFormData {- name: string;- type: PlaybookType;- description: string;- items: PlaybookItemFormData[];-}--function PlaybookItemForm({- item,- index,- onChange,- onRemove,-}: {- item: PlaybookItemFormData;- index: number;- onChange: (index: number, data: PlaybookItemFormData) => void;- onRemove: (index: number) => void;-}) {- return (- <Card className="p-4 space-y-3">- <div className="flex items-center justify-between">- <span className="font-medium text-sm">Item {index + 1}</span>- <Button- type="button"- variant="ghost"- size="icon"- className="h-8 w-8 text-destructive"- onClick={() => onRemove(index)}- >- <X className="h-4 w-4" />- </Button>- </div>- <div className="grid grid-cols-2 gap-3">- <div className="space-y-1">- <Label className="text-xs">Label</Label>- <Input- value={item.label}- onChange={(e) => onChange(index, { ...item, label: e.target.value })}- placeholder="e.g., Metrics"- required- />- </div>- <div className="space-y-1">- <Label className="text-xs">ID (unique)</Label>- <Input- value={item.id}- onChange={(e) => onChange(index, { ...item, id: e.target.value.toLowerCase().replace(/\s+/g, '-') })}- placeholder="e.g., m-metrics"- required- />- </div>- </div>- <div className="space-y-1">- <Label className="text-xs">Description</Label>- <Input- value={item.description}- onChange={(e) => onChange(index, { ...item, description: e.target.value })}- placeholder="What this item tracks"- required- />- </div>- <div className="space-y-1">- <Label className="text-xs">Keywords (comma-separated)</Label>- <Input- value={item.keywords}- onChange={(e) => onChange(index, { ...item, keywords: e.target.value })}- placeholder="ROI, cost savings, revenue, metrics"- />- </div>- <div className="space-y-1">- <Label className="text-xs">Suggested Questions (one per line)</Label>- <Textarea- value={item.suggestedQuestions}- onChange={(e) => onChange(index, { ...item, suggestedQuestions: e.target.value })}- placeholder="What metrics matter most? How do you measure success?"- rows={2}- />- </div>- </Card>- );-}--function PlaybookForm({- initialData,- onSubmit,- onCancel,- isLoading,-}: {- initialData?: Playbook;- onSubmit: (data: PlaybookFormData) => void;- onCancel: () => void;- isLoading: boolean;-}) {- const [form, setForm] = useState<PlaybookFormData>(- initialData- ? {- name: initialData.name,- type: initialData.type,- description: initialData.description || '',- items: initialData.items.map((item) => ({- id: item.id,- label: item.label,- description: item.description,- keywords: item.keywords.join(', '),- suggestedQuestions: item.suggestedQuestions.join('\n'),- })),- }- : {- name: '',- type: 'Custom',- description: '',- items: [- { id: '', label: '', description: '', keywords: '', suggestedQuestions: '' },- ],- }- );-- const handleItemChange = (index: number, data: PlaybookItemFormData) => {- const newItems = [...form.items];- newItems[index] = data;- setForm({ ...form, items: newItems });- };-- const handleRemoveItem = (index: number) => {- if (form.items.length <= 1) return;- const newItems = form.items.filter((_, i) => i !== index);- setForm({ ...form, items: newItems });- };-- const handleAddItem = () => {- setForm({- ...form,- items: [- ...form.items,- { id: '', label: '', description: '', keywords: '', suggestedQuestions: '' },- ],- });- };-- const handleSubmit = (e: React.FormEvent) => {- e.preventDefault();- onSubmit(form);- };-- return (- <form onSubmit={handleSubmit} className="space-y-4">- <div className="grid grid-cols-2 gap-4">- <div className="space-y-2">- <Label htmlFor="name">Playbook Name</Label>- <Input- id="name"- value={form.name}- onChange={(e) => setForm({ ...form, name: e.target.value })}- placeholder="e.g., Team Weekly 1:1"- required- />- </div>- <div className="space-y-2">- <Label htmlFor="type">Type</Label>- <Select- value={form.type}- onValueChange={(v) => setForm({ ...form, type: v as PlaybookType })}- >- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- {PLAYBOOK_TYPES.map((type) => (- <SelectItem key={type.value} value={type.value}>- {type.label}- </SelectItem>- ))}- </SelectContent>- </Select>- </div>- </div>-- <div className="space-y-2">- <Label htmlFor="description">Description</Label>- <Textarea- id="description"- value={form.description}- onChange={(e) => setForm({ ...form, description: e.target.value })}- placeholder="A brief description of this playbook..."- rows={2}- />- </div>-- <div className="space-y-2">- <div className="flex items-center justify-between">- <Label>Checklist Items</Label>- <Button type="button" variant="outline" size="sm" onClick={handleAddItem}>- <Plus className="h-3 w-3 mr-1" />- Add Item- </Button>- </div>- <ScrollArea className="h-[300px] pr-4">- <div className="space-y-3">- {form.items.map((item, index) => (- <PlaybookItemForm- key={index}- item={item}- index={index}- onChange={handleItemChange}- onRemove={handleRemoveItem}- />- ))}- </div>- </ScrollArea>- </div>-- <DialogFooter>- <Button type="button" variant="outline" onClick={onCancel}>- Cancel- </Button>- <Button type="submit" disabled={isLoading}>- {isLoading ? 'Saving...' : initialData ? 'Update' : 'Create'}- </Button>- </DialogFooter>- </form>- );-}--export function PlaybookEditor() {- const [editingPlaybook, setEditingPlaybook] = useState<Playbook | null>(null);- const [isCreateOpen, setIsCreateOpen] = useState(false);- const [isEditOpen, setIsEditOpen] = useState(false);-- const { data: playbooks, refetch } = trpc.settings.getPlaybooks.useQuery();- const createMutation = trpc.settings.createPlaybook.useMutation({- onSuccess: () => {- refetch();- setIsCreateOpen(false);- },- });- const updateMutation = trpc.settings.updatePlaybook.useMutation({- onSuccess: () => {- refetch();- setIsEditOpen(false);- setEditingPlaybook(null);- },- });- const deleteMutation = trpc.settings.deletePlaybook.useMutation({- onSuccess: () => refetch(),- });- const setDefaultMutation = trpc.settings.setDefaultPlaybook.useMutation({- onSuccess: () => refetch(),- });-- const handleCreate = (data: PlaybookFormData) => {- createMutation.mutate({- name: data.name,- type: data.type,- description: data.description || undefined,- items: data.items.map((item) => ({- id: item.id,- label: item.label,- description: item.description,- keywords: item.keywords.split(',').map((k) => k.trim()).filter(Boolean),- suggestedQuestions: item.suggestedQuestions.split('\n').filter(Boolean),- })),- });- };-- const handleUpdate = (data: PlaybookFormData) => {- if (!editingPlaybook) return;- updateMutation.mutate({- id: editingPlaybook.id,- data: {- name: data.name,- type: data.type,- description: data.description || undefined,- items: data.items.map((item) => ({- id: item.id,- label: item.label,- description: item.description,- keywords: item.keywords.split(',').map((k) => k.trim()).filter(Boolean),- suggestedQuestions: item.suggestedQuestions.split('\n').filter(Boolean),- })),- },- });- };-- return (- <div className="space-y-4">- <div className="flex items-center justify-between">- <div>- <h3 className="text-lg font-medium">Meeting Templates</h3>- <p className="text-sm text-muted-foreground">- Manage meeting agendas and checklists for different meeting types- </p>- </div>- <Dialog open={isCreateOpen} onOpenChange={setIsCreateOpen}>- <DialogTrigger asChild>- <Button>- <Plus className="h-4 w-4 mr-2" />- Add Playbook- </Button>- </DialogTrigger>- <DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">- <DialogHeader>- <DialogTitle>Create Meeting Template</DialogTitle>- <DialogDescription>- Create a new meeting agenda template with discussion topics.- </DialogDescription>- </DialogHeader>- <PlaybookForm- onSubmit={handleCreate}- onCancel={() => setIsCreateOpen(false)}- isLoading={createMutation.isPending}- />- </DialogContent>- </Dialog>- </div>-- <ScrollArea className="h-[500px]">- <div className="space-y-3 pr-4">- {playbooks?.map((playbook) => (- <Card key={playbook.id}>- <CardHeader className="pb-2">- <div className="flex items-start justify-between">- <div>- <div className="flex items-center gap-2">- <BookOpen className="h-4 w-4" />- <CardTitle className="text-base">{playbook.name}</CardTitle>- {playbook.isDefault && (- <Badge className="bg-amber-100 text-amber-800">- <Star className="h-3 w-3 mr-1 fill-current" />- Active- </Badge>- )}- </div>- <div className="flex items-center gap-2 mt-1">- <Badge variant="outline">{playbook.type}</Badge>- <span className="text-xs text-muted-foreground">- {playbook.items.length} items- </span>- </div>- </div>- <div className="flex items-center gap-1">- {!playbook.isDefault && (- <Button- variant="ghost"- size="sm"- onClick={() => setDefaultMutation.mutate({ id: playbook.id })}- >- <Star className="h-4 w-4 mr-1" />- Set Active- </Button>- )}- <Button- variant="ghost"- size="icon"- className="h-8 w-8"- onClick={() => {- setEditingPlaybook(playbook as Playbook);- setIsEditOpen(true);- }}- >- <Pencil className="h-4 w-4" />- </Button>- <AlertDialog>- <AlertDialogTrigger asChild>- <Button variant="ghost" size="icon" className="h-8 w-8 text-destructive">- <Trash2 className="h-4 w-4" />- </Button>- </AlertDialogTrigger>- <AlertDialogContent>- <AlertDialogHeader>- <AlertDialogTitle>Delete Playbook</AlertDialogTitle>- <AlertDialogDescription>- Are you sure you want to delete "{playbook.name}"? This action cannot be- undone.- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction- onClick={() => deleteMutation.mutate({ id: playbook.id })}- className="bg-destructive text-destructive-foreground"- >- Delete- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- </div>- </div>- {playbook.description && (- <CardDescription className="mt-2">{playbook.description}</CardDescription>- )}- </CardHeader>- <CardContent>- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="items" className="border-none">- <AccordionTrigger className="py-2 text-sm">- View Checklist Items- </AccordionTrigger>- <AccordionContent>- <div className="space-y-2">- {playbook.items.map((item: PlaybookItem, index: number) => (- <div- key={item.id}- className="flex items-start gap-2 p-2 bg-muted/50 rounded"- >- <span className="text-xs font-medium text-muted-foreground w-6">- {index + 1}.- </span>- <div>- <p className="text-sm font-medium">{item.label}</p>- <p className="text-xs text-muted-foreground">{item.description}</p>- </div>- </div>- ))}- </div>- </AccordionContent>- </AccordionItem>- </Accordion>- </CardContent>- </Card>- ))}-- {(!playbooks || playbooks.length === 0) && (- <div className="text-center py-8 text-muted-foreground">- No playbooks yet. Create one to get started.- </div>- )}- </div>- </ScrollArea>-- {/* Edit Dialog */}- <Dialog open={isEditOpen} onOpenChange={setIsEditOpen}>- <DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">- <DialogHeader>- <DialogTitle>Edit Playbook</DialogTitle>- <DialogDescription>Update this meeting template.</DialogDescription>- </DialogHeader>- {editingPlaybook && (- <PlaybookForm- initialData={editingPlaybook}- onSubmit={handleUpdate}- onCancel={() => {- setIsEditOpen(false);- setEditingPlaybook(null);- }}- isLoading={updateMutation.isPending}- />- )}- </DialogContent>- </Dialog>- </div>- );-}--export default PlaybookEditor;diff --git a/src/renderer/components/settings/PromptsEditor.tsx b/src/renderer/components/settings/PromptsEditor.tsxdeleted file mode 100644index 31065f2..0000000--- a/src/renderer/components/settings/PromptsEditor.tsx+++ /dev/null@@ -1,289 +0,0 @@-/**- * Prompts & Settings Editor Component- *- * Allows users to customize AI prompts, thresholds, and configuration.- */--import React, { useState, useEffect } from 'react';-import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '../ui/card';-import { Button } from '../ui/button';-import { Input } from '../ui/input';-import { Label } from '../ui/label';-import { Textarea } from '../ui/textarea';-import { Switch } from '../ui/switch';-import { ScrollArea } from '../ui/scroll-area';-import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';-import { Save, RotateCcw, Sparkles, Gauge, Settings2 } from 'lucide-react';-import { trpc } from '../../api/trpc';-import { cn } from '../../lib/utils';--interface Setting {- key: string;- value: string;- category: 'prompt' | 'config' | 'threshold';- label: string;- description?: string | null;-}--function PromptCard({- setting,- value,- onChange,-}: {- setting: Setting;- value: string;- onChange: (value: string) => void;-}) {- return (- <Card>- <CardHeader className="pb-2">- <CardTitle className="text-sm">{setting.label}</CardTitle>- {setting.description && (- <CardDescription className="text-xs">{setting.description}</CardDescription>- )}- </CardHeader>- <CardContent>- <Textarea- value={value}- onChange={(e) => onChange(e.target.value)}- rows={6}- className="font-mono text-xs"- placeholder="Enter prompt..."- />- <p className="text-xs text-muted-foreground mt-2">- Use <code className="bg-muted px-1 rounded">{'{text}'}</code> or{' '}- <code className="bg-muted px-1 rounded">{'{transcript}'}</code> as placeholders.- </p>- </CardContent>- </Card>- );-}--function ThresholdCard({- setting,- value,- onChange,-}: {- setting: Setting;- value: string;- onChange: (value: string) => void;-}) {- const numValue = parseFloat(value) || 0;-- return (- <Card>- <CardHeader className="pb-2">- <div className="flex items-center justify-between">- <div>- <CardTitle className="text-sm">{setting.label}</CardTitle>- {setting.description && (- <CardDescription className="text-xs">{setting.description}</CardDescription>- )}- </div>- <span className="text-2xl font-bold text-primary">{value}</span>- </div>- </CardHeader>- <CardContent>- <Input- type="number"- value={value}- onChange={(e) => onChange(e.target.value)}- className="w-full"- />- </CardContent>- </Card>- );-}--function ConfigCard({- setting,- value,- onChange,-}: {- setting: Setting;- value: string;- onChange: (value: string) => void;-}) {- const boolValue = value === 'true';-- return (- <Card>- <CardContent className="pt-4">- <div className="flex items-center justify-between">- <div className="space-y-0.5">- <Label className="text-sm font-medium">{setting.label}</Label>- {setting.description && (- <p className="text-xs text-muted-foreground">{setting.description}</p>- )}- </div>- <Switch- checked={boolValue}- onCheckedChange={(checked) => onChange(checked ? 'true' : 'false')}- />- </div>- </CardContent>- </Card>- );-}--export function PromptsEditor() {- const [localSettings, setLocalSettings] = useState<Record<string, string>>({});- const [hasChanges, setHasChanges] = useState(false);-- const { data: settings, refetch } = trpc.settings.getSettings.useQuery();- const updateMutation = trpc.settings.updateSettings.useMutation({- onSuccess: () => {- refetch();- setHasChanges(false);- },- });-- // Initialize local settings from server data- useEffect(() => {- if (settings) {- const settingsMap: Record<string, string> = {};- settings.forEach((s) => {- settingsMap[s.key] = s.value;- });- setLocalSettings(settingsMap);- }- }, [settings]);-- const handleChange = (key: string, value: string) => {- setLocalSettings((prev) => ({ ...prev, [key]: value }));- setHasChanges(true);- };-- const handleSave = () => {- if (!settings) return;-- const updates = settings.map((s) => ({- key: s.key,- value: localSettings[s.key] ?? s.value,- category: s.category as 'prompt' | 'config' | 'threshold',- label: s.label,- description: s.description || undefined,- }));-- updateMutation.mutate(updates);- };-- const handleReset = () => {- if (settings) {- const settingsMap: Record<string, string> = {};- settings.forEach((s) => {- settingsMap[s.key] = s.value;- });- setLocalSettings(settingsMap);- setHasChanges(false);- }- };-- const prompts = settings?.filter((s) => s.category === 'prompt') || [];- const thresholds = settings?.filter((s) => s.category === 'threshold') || [];- const configs = settings?.filter((s) => s.category === 'config') || [];-- return (- <div className="space-y-4">- <div className="flex items-center justify-between">- <div>- <h3 className="text-lg font-medium">AI Prompts & Settings</h3>- <p className="text-sm text-muted-foreground">- Customize AI behavior, thresholds, and detection settings- </p>- </div>- <div className="flex items-center gap-2">- {hasChanges && (- <Button variant="outline" onClick={handleReset}>- <RotateCcw className="h-4 w-4 mr-2" />- Reset- </Button>- )}- <Button onClick={handleSave} disabled={!hasChanges || updateMutation.isPending}>- <Save className="h-4 w-4 mr-2" />- {updateMutation.isPending ? 'Saving...' : 'Save Changes'}- </Button>- </div>- </div>-- <Tabs defaultValue="prompts" className="w-full">- <TabsList className="grid w-full grid-cols-3">- <TabsTrigger value="prompts" className="flex items-center gap-2">- <Sparkles className="h-4 w-4" />- AI Prompts- </TabsTrigger>- <TabsTrigger value="thresholds" className="flex items-center gap-2">- <Gauge className="h-4 w-4" />- Thresholds- </TabsTrigger>- <TabsTrigger value="config" className="flex items-center gap-2">- <Settings2 className="h-4 w-4" />- Config- </TabsTrigger>- </TabsList>-- <TabsContent value="prompts" className="mt-4">- <ScrollArea className="h-[450px]">- <div className="space-y-4 pr-4">- {prompts.map((setting) => (- <PromptCard- key={setting.key}- setting={setting}- value={localSettings[setting.key] ?? setting.value}- onChange={(v) => handleChange(setting.key, v)}- />- ))}- {prompts.length === 0 && (- <div className="text-center py-8 text-muted-foreground">- No prompts configured. Run the app to seed defaults.- </div>- )}- </div>- </ScrollArea>- </TabsContent>-- <TabsContent value="thresholds" className="mt-4">- <ScrollArea className="h-[450px]">- <div className="grid grid-cols-2 gap-4 pr-4">- {thresholds.map((setting) => (- <ThresholdCard- key={setting.key}- setting={setting}- value={localSettings[setting.key] ?? setting.value}- onChange={(v) => handleChange(setting.key, v)}- />- ))}- </div>- {thresholds.length === 0 && (- <div className="text-center py-8 text-muted-foreground">- No thresholds configured. Run the app to seed defaults.- </div>- )}- </ScrollArea>- </TabsContent>-- <TabsContent value="config" className="mt-4">- <ScrollArea className="h-[450px]">- <div className="space-y-3 pr-4">- {configs.map((setting) => (- <ConfigCard- key={setting.key}- setting={setting}- value={localSettings[setting.key] ?? setting.value}- onChange={(v) => handleChange(setting.key, v)}- />- ))}- </div>- {configs.length === 0 && (- <div className="text-center py-8 text-muted-foreground">- No config options available. Run the app to seed defaults.- </div>- )}- </ScrollArea>- </TabsContent>- </Tabs>- </div>- );-}--export default PromptsEditor;diff --git a/src/renderer/components/transcription/BookmarkDialog.tsx b/src/renderer/components/transcription/BookmarkDialog.tsxdeleted file mode 100644index 4f60278..0000000--- a/src/renderer/components/transcription/BookmarkDialog.tsx+++ /dev/null@@ -1,210 +0,0 @@-/**- * Bookmark Dialog Component- *- * Modal for creating bookmarks with category selection- */--import React, { useState } from 'react';-import {- Dialog,- DialogContent,- DialogHeader,- DialogTitle,- DialogDescription,- DialogFooter,-} from '../ui/dialog';-import { Button } from '../ui/button';-import { Textarea } from '../ui/textarea';-import { cn } from '../../lib/utils';-import {- Flag,- AlertTriangle,- DollarSign,- Users,- CheckCircle,- ArrowRight,- Star,-} from 'lucide-react';--export type BookmarkCategory =- | 'important'- | 'follow_up'- | 'pricing'- | 'competitor'- | 'risk'- | 'decision'- | 'action_item';--interface BookmarkDialogProps {- open: boolean;- onOpenChange: (open: boolean) => void;- onSubmit: (category: BookmarkCategory, note?: string) => void;- transcriptText?: string;-}--const BOOKMARK_CATEGORIES: Array<{- id: BookmarkCategory;- label: string;- icon: React.ElementType;- color: string;- description: string;-}> = [- {- id: 'important',- label: 'Important',- icon: Star,- color: 'text-yellow-600 bg-yellow-100 dark:bg-yellow-900/30',- description: 'Key moment to remember',- },- {- id: 'action_item',- label: 'Action Item',- icon: CheckCircle,- color: 'text-green-600 bg-green-100 dark:bg-green-900/30',- description: 'Task or follow-up needed',- },- {- id: 'follow_up',- label: 'Follow Up',- icon: ArrowRight,- color: 'text-blue-600 bg-blue-100 dark:bg-blue-900/30',- description: 'Requires follow-up later',- },- {- id: 'pricing',- label: 'Pricing',- icon: DollarSign,- color: 'text-emerald-600 bg-emerald-100 dark:bg-emerald-900/30',- description: 'Pricing discussion',- },- {- id: 'competitor',- label: 'Competitor',- icon: Users,- color: 'text-purple-600 bg-purple-100 dark:bg-purple-900/30',- description: 'Competitor mention',- },- {- id: 'risk',- label: 'Risk',- icon: AlertTriangle,- color: 'text-red-600 bg-red-100 dark:bg-red-900/30',- description: 'Potential risk or objection',- },- {- id: 'decision',- label: 'Decision',- icon: Flag,- color: 'text-orange-600 bg-orange-100 dark:bg-orange-900/30',- description: 'Decision point',- },-];--export function BookmarkDialog({- open,- onOpenChange,- onSubmit,- transcriptText,-}: BookmarkDialogProps) {- const [selectedCategory, setSelectedCategory] = useState<BookmarkCategory | null>(null);- const [note, setNote] = useState('');- const [isSubmitting, setIsSubmitting] = useState(false);-- const handleSubmit = async () => {- if (!selectedCategory) return;-- setIsSubmitting(true);- try {- await onSubmit(selectedCategory, note.trim() || undefined);- // Reset state- setSelectedCategory(null);- setNote('');- onOpenChange(false);- } finally {- setIsSubmitting(false);- }- };-- const handleOpenChange = (open: boolean) => {- if (!open) {- setSelectedCategory(null);- setNote('');- }- onOpenChange(open);- };-- return (- <Dialog open={open} onOpenChange={handleOpenChange}>- <DialogContent className="sm:max-w-md">- <DialogHeader>- <DialogTitle>Create Bookmark</DialogTitle>- <DialogDescription>- Mark this moment for easy reference later- </DialogDescription>- </DialogHeader>-- {transcriptText && (- <div className="bg-muted/50 rounded-lg p-3 text-sm text-muted-foreground italic border">- "{transcriptText.slice(0, 100)}{transcriptText.length > 100 ? '...' : ''}"- </div>- )}-- <div className="space-y-3">- <label className="text-sm font-medium">Category</label>- <div className="grid grid-cols-2 gap-2">- {BOOKMARK_CATEGORIES.map((cat) => {- const Icon = cat.icon;- const isSelected = selectedCategory === cat.id;- return (- <button- key={cat.id}- onClick={() => setSelectedCategory(cat.id)}- className={cn(- 'flex items-center gap-2 p-3 rounded-lg border text-left transition-all',- isSelected- ? 'border-primary bg-primary/5 ring-2 ring-primary/20'- : 'border-border hover:border-primary/50 hover:bg-muted/50'- )}- >- <div className={cn('p-1.5 rounded', cat.color)}>- <Icon className="w-4 h-4" />- </div>- <div className="flex-1 min-w-0">- <div className="text-sm font-medium">{cat.label}</div>- <div className="text-xs text-muted-foreground truncate">- {cat.description}- </div>- </div>- </button>- );- })}- </div>- </div>-- <div className="space-y-2">- <label className="text-sm font-medium">Note (optional)</label>- <Textarea- placeholder="Add a note about this moment..."- value={note}- onChange={(e) => setNote(e.target.value)}- rows={2}- />- </div>-- <DialogFooter>- <Button variant="outline" onClick={() => handleOpenChange(false)}>- Cancel- </Button>- <Button- onClick={handleSubmit}- disabled={!selectedCategory || isSubmitting}- >- {isSubmitting ? 'Saving...' : 'Save Bookmark'}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>- );-}--export default BookmarkDialog;diff --git a/src/renderer/components/transcription/TranscriptionPanel.tsx b/src/renderer/components/transcription/TranscriptionPanel.tsxindex 4b4bcf1..bc24909 100644--- a/src/renderer/components/transcription/TranscriptionPanel.tsx+++ b/src/renderer/components/transcription/TranscriptionPanel.tsx@@ -5,31 +5,25 @@* - Avatar indicators (Me/Them)* - Timestamp badges* - Styled message bubbles- * - Trigger detection highlighting* - Auto-scroll to latest- * - Bookmarking support*/-import React, { useEffect, useRef, useState, useCallback } from 'react';-import { Mic, Volume2, Bookmark, BookmarkCheck } from 'lucide-react';+import React, { useEffect, useRef } from 'react';+import { Mic, Volume2 } from 'lucide-react';import { Card, CardContent, CardHeader, CardTitle } from '../ui/card';import { ScrollArea } from '../ui/scroll-area';import { Switch } from '../ui/switch';import { Badge } from '../ui/badge';-import { Button } from '../ui/button';import { useTranscriptionStore, TranscriptItem } from '../../stores/transcription.store';import { useSessionStore } from '../../stores/session.store';-import { useCopilot } from '../../hooks/useCopilot';import { cn } from '../../lib/utils';-import { BookmarkDialog, BookmarkCategory } from './BookmarkDialog';interface TranscriptMessageProps {item: TranscriptItem;isLive?: boolean;- onBookmark?: (item: TranscriptItem) => void;}-function TranscriptMessage({ item, isLive, onBookmark }: TranscriptMessageProps) {+function TranscriptMessage({ item, isLive }: TranscriptMessageProps) {const isMe = item.source === 'mic';// Format timestamp from epoch to MM:SS relative to recording start@@ -42,7 +36,7 @@ function TranscriptMessage({ item, isLive, onBookmark }: TranscriptMessageProps)return (<divclassName={cn(- 'group relative animate-in slide-in-from-bottom-2 duration-300',+ 'animate-in slide-in-from-bottom-2 duration-300',isLive && 'opacity-90')}>@@ -94,21 +88,6 @@ function TranscriptMessage({ item, isLive, onBookmark }: TranscriptMessageProps){item.text}</div></div>-- {/* Quick Actions (on hover) */}- {onBookmark && (- <div className="opacity-0 group-hover:opacity-100 transition-opacity shrink-0 pt-6">- <Button- variant="ghost"- size="icon"- className="h-8 w-8 hover:text-primary"- title="Bookmark this moment"- onClick={() => onBookmark(item)}- >- <Bookmark className="w-4 h-4" />- </Button>- </div>- )}</div></div>);@@ -160,42 +139,11 @@ function PendingMessage({ text, source }: { text: string; source: 'mic' | 'systeexport function TranscriptionPanel() {const { items, enabled, pendingMic, pendingSystemAudio, setEnabled } = useTranscriptionStore();- const { status, elapsedTime } = useSessionStore();- const { createBookmark, recordingId } = useCopilot();+ const { status } = useSessionStore();const scrollRef = useRef<HTMLDivElement>(null);- const [bookmarkDialogOpen, setBookmarkDialogOpen] = useState(false);- const [bookmarkItem, setBookmarkItem] = useState<TranscriptItem | null>(null);-const isRecording = status === 'recording';- // Handle bookmark button click on a specific transcript item- const handleBookmarkItem = useCallback((item: TranscriptItem) => {- setBookmarkItem(item);- setBookmarkDialogOpen(true);- }, []);-- // Handle bookmark button in header (bookmark current moment)- const handleBookmarkNow = useCallback(() => {- setBookmarkItem(null); // No specific item, just the current moment- setBookmarkDialogOpen(true);- }, []);-- // Handle bookmark submission- const handleBookmarkSubmit = useCallback(async (category: BookmarkCategory, note?: string) => {- // Calculate timestamp - use item timestamp or current elapsed time- const timestamp = bookmarkItem- ? (bookmarkItem.timestamp - (items[0]?.timestamp || bookmarkItem.timestamp)) / 1000- : elapsedTime;-- const success = await createBookmark(timestamp, category, note);- if (success) {- console.log('Bookmark created successfully');- } else {- console.error('Failed to create bookmark');- }- }, [bookmarkItem, items, elapsedTime, createBookmark]);-// Auto-scroll to bottom when new items arriveuseEffect(() => {if (scrollRef.current) {@@ -214,24 +162,11 @@ export function TranscriptionPanel() {<CardTitle className="text-base font-semibold">Live Transcription</CardTitle><p className="text-xs text-slate-500 mt-0.5">Real-time conversation feed</p></div>- <div className="flex items-center gap-3">- <Button- variant="outline"- size="sm"- className="gap-2 h-8"- onClick={handleBookmarkNow}- disabled={!isRecording || !recordingId}- title={!isRecording ? 'Start recording to bookmark' : 'Bookmark this moment'}- >- <Bookmark className="w-3 h-3" />- Bookmark- </Button>- <div className="flex items-center gap-2 pl-3 border-l">- <span className="text-xs text-muted-foreground">- {enabled ? 'Enabled' : 'Disabled'}- </span>- <Switch checked={enabled} onCheckedChange={setEnabled} disabled={isRecording} />- </div>+ <div className="flex items-center gap-2">+ <span className="text-xs text-muted-foreground">+ {enabled ? 'Enabled' : 'Disabled'}+ </span>+ <Switch checked={enabled} onCheckedChange={setEnabled} disabled={isRecording} /></div></div></CardHeader>@@ -261,7 +196,6 @@ export function TranscriptionPanel() {<TranscriptMessagekey={item.id}item={item}- onBookmark={recordingId ? handleBookmarkItem : undefined}/>))}@@ -273,14 +207,6 @@ export function TranscriptionPanel() {</div></ScrollArea></CardContent>-- {/* Bookmark Dialog */}- <BookmarkDialog- open={bookmarkDialogOpen}- onOpenChange={setBookmarkDialogOpen}- onSubmit={handleBookmarkSubmit}- transcriptText={bookmarkItem?.text}- /></Card>);}diff --git a/src/renderer/hooks/useCopilot.ts b/src/renderer/hooks/useCopilot.tsindex e29ec16..ddc06a7 100644--- a/src/renderer/hooks/useCopilot.ts+++ b/src/renderer/hooks/useCopilot.ts@@ -19,10 +19,6 @@ export function useCopilot() {recordingId,metrics,healthScore,- sentiment,- activeCueCards,- pinnedCueCards,- playbook,activeNudge,callSummary,callDuration,@@ -31,12 +27,6 @@ export function useCopilot() {startCall,endCall,setMetrics,- setSentiment,- addCueCard,- dismissCueCard,- pinCueCard,- setPlaybook,- updatePlaybookItem,setNudge,dismissNudge,setCallSummary,@@ -113,44 +103,6 @@ export function useCopilot() {}}, [setConfig]);- /**- * Dismiss a cue card- */- const handleDismissCueCard = useCallback(async (triggerId: string) => {- dismissCueCard(triggerId);- try {- await window.electronAPI.copilot.dismissCueCard(triggerId);- } catch (error) {- console.error('Error dismissing cue card:', error);- }- }, [dismissCueCard]);-- /**- * Pin a cue card- */- const handlePinCueCard = useCallback(async (triggerId: string) => {- pinCueCard(triggerId);- try {- await window.electronAPI.copilot.pinCueCard(triggerId);- } catch (error) {- console.error('Error pinning cue card:', error);- }- }, [pinCueCard]);-- /**- * Submit cue card feedback- */- const submitCueCardFeedback = useCallback(async (- triggerId: string,- feedback: 'helpful' | 'wrong' | 'irrelevant'- ) => {- try {- await window.electronAPI.copilot.cueCardFeedback(triggerId, feedback);- } catch (error) {- console.error('Error submitting feedback:', error);- }- }, []);-/*** Dismiss active nudge*/@@ -165,30 +117,6 @@ export function useCopilot() {}}, [activeNudge, dismissNudge]);- /**- * Create a bookmark- */- const createBookmark = useCallback(async (- timestamp: number,- category: string,- note?: string- ) => {- if (!recordingId) return;-- try {- const result = await window.electronAPI.copilot.createBookmark({- recordingId,- timestamp,- category,- note,- });- return result.success;- } catch (error) {- console.error('Error creating bookmark:', error);- return false;- }- }, [recordingId]);-/*** Setup IPC event listeners*/@@ -206,28 +134,12 @@ export function useCopilot() {setMetrics(metrics, health);});- const unsubSentiment = window.electronAPI.copilotOn.onSentiment(({ sentiment }) => {- setSentiment(sentiment);- });-const unsubNudge = window.electronAPI.copilotOn.onNudge(({ nudge }) => {setNudge(nudge);});- const unsubCueCard = window.electronAPI.copilotOn.onCueCard(({ cueCard }) => {- addCueCard(cueCard);- });-- const unsubPlaybook = window.electronAPI.copilotOn.onPlaybook(({ item, snapshot }) => {- setPlaybook(snapshot);- updatePlaybookItem(item);- });-- const unsubCallEnded = window.electronAPI.copilotOn.onCallEnded(({ summary, playbook, metrics, duration }) => {+ const unsubCallEnded = window.electronAPI.copilotOn.onCallEnded(({ summary, metrics, duration }) => {setCallSummary(summary, duration);- if (playbook) {- setPlaybook(playbook);- }setMetrics(metrics, 0);});@@ -238,10 +150,7 @@ export function useCopilot() {unsubscribersRef.current = [unsubTranscript,unsubMetrics,- unsubSentiment,unsubNudge,- unsubCueCard,- unsubPlaybook,unsubCallEnded,unsubError,];@@ -252,11 +161,7 @@ export function useCopilot() {}, [addTranscriptSegment,setMetrics,- setSentiment,setNudge,- addCueCard,- setPlaybook,- updatePlaybookItem,setCallSummary,]);@@ -277,10 +182,6 @@ export function useCopilot() {recordingId,metrics,healthScore,- sentiment,- activeCueCards,- pinnedCueCards,- playbook,activeNudge,callSummary,callDuration,@@ -290,11 +191,7 @@ export function useCopilot() {startCopilot,stopCopilot,updateConfig,- dismissCueCard: handleDismissCueCard,- pinCueCard: handlePinCueCard,- submitCueCardFeedback,dismissNudge: handleDismissNudge,- createBookmark,reset,};}diff --git a/src/renderer/stores/copilot.store.ts b/src/renderer/stores/copilot.store.tsindex f47e423..c0fd800 100644--- a/src/renderer/stores/copilot.store.ts+++ b/src/renderer/stores/copilot.store.ts@@ -1,11 +1,8 @@/*** Meeting Co-Pilot Store*- * Centralized state management for all Meeting Co-Pilot features:+ * Centralized state management for Meeting Co-Pilot features:* - Conversation metrics- * - Sentiment tracking- * - Cue cards- * - Playbook progress* - Nudges* - Call summary*/@@ -13,11 +10,7 @@import { create } from 'zustand';import type {CopilotMetrics,- CopilotSentiment,CopilotNudge,- CopilotCueCard,- CopilotPlaybookItem,- CopilotPlaybookSnapshot,CopilotCallSummary,CopilotConfig,CopilotTranscriptSegment,@@ -36,18 +29,6 @@ export interface CopilotState {metrics: CopilotMetrics | null;healthScore: number;- // Sentiment- sentiment: CopilotSentiment | null;-- // Cue Cards- activeCueCards: CopilotCueCard[];- pinnedCueCards: CopilotCueCard[];- dismissedCueCardIds: Set<string>;-- // Playbook- playbook: CopilotPlaybookSnapshot | null;- selectedPlaybookId: string | null;-// NudgesactiveNudge: CopilotNudge | null;nudgeHistory: CopilotNudge[];@@ -68,20 +49,6 @@ export interface CopilotState {// Metrics actionssetMetrics: (metrics: CopilotMetrics, health: number) => void;- // Sentiment actions- setSentiment: (sentiment: CopilotSentiment) => void;-- // Cue card actions- addCueCard: (cueCard: CopilotCueCard) => void;- dismissCueCard: (triggerId: string) => void;- pinCueCard: (triggerId: string) => void;- clearCueCards: () => void;-- // Playbook actions- setPlaybook: (playbook: CopilotPlaybookSnapshot) => void;- updatePlaybookItem: (item: CopilotPlaybookItem) => void;- setSelectedPlaybook: (id: string | null) => void;-// Nudge actionssetNudge: (nudge: CopilotNudge) => void;dismissNudge: () => void;@@ -102,11 +69,7 @@ export interface CopilotState {const initialConfig: CopilotConfig = {enableTranscription: true,enableMetrics: true,- enableSentiment: true,enableNudges: true,- enableCueCards: true,- enablePlaybook: true,- useLLMForDetection: false,};const initialState = {@@ -116,12 +79,6 @@ const initialState = {recordingId: null,metrics: null,healthScore: 100,- sentiment: null,- activeCueCards: [],- pinnedCueCards: [],- dismissedCueCardIds: new Set<string>(),- playbook: null,- selectedPlaybookId: null,activeNudge: null,nudgeHistory: [],callSummary: null,@@ -149,11 +106,6 @@ export const useCopilotStore = create<CopilotState>((set, get) => ({recordingId,metrics: null,healthScore: 100,- sentiment: null,- activeCueCards: [],- pinnedCueCards: [],- dismissedCueCardIds: new Set(),- playbook: null,activeNudge: null,nudgeHistory: [],callSummary: null,@@ -174,101 +126,6 @@ export const useCopilotStore = create<CopilotState>((set, get) => ({set({ metrics, healthScore: health });},- // Sentiment- setSentiment: (sentiment) => {- set({ sentiment });- },-- // Cue Cards- addCueCard: (cueCard) => {- const { dismissedCueCardIds, activeCueCards } = get();-- // Don't add if already dismissed- if (dismissedCueCardIds.has(cueCard.triggerId)) {- return;- }-- // Check if already exists- const exists = activeCueCards.some(c => c.triggerId === cueCard.triggerId);- if (exists) {- return;- }-- set((state) => ({- activeCueCards: [...state.activeCueCards, cueCard],- }));- },-- dismissCueCard: (triggerId) => {- set((state) => {- const newDismissed = new Set(state.dismissedCueCardIds);- newDismissed.add(triggerId);-- return {- activeCueCards: state.activeCueCards.filter(c => c.triggerId !== triggerId),- pinnedCueCards: state.pinnedCueCards.filter(c => c.triggerId !== triggerId),- dismissedCueCardIds: newDismissed,- };- });- },-- pinCueCard: (triggerId) => {- set((state) => {- const card = state.activeCueCards.find(c => c.triggerId === triggerId);- if (!card) return state;-- const pinnedCard = { ...card, status: 'pinned' as const };-- return {- activeCueCards: state.activeCueCards.filter(c => c.triggerId !== triggerId),- pinnedCueCards: [...state.pinnedCueCards, pinnedCard],- };- });- },-- clearCueCards: () => {- set({- activeCueCards: [],- pinnedCueCards: [],- dismissedCueCardIds: new Set(),- });- },-- // Playbook- setPlaybook: (playbook) => {- set({ playbook });- },-- updatePlaybookItem: (item) => {- set((state) => {- if (!state.playbook) return state;-- const updatedItems = state.playbook.items.map(i =>- i.id === item.id ? item : i- );-- const covered = updatedItems.filter(i => i.status === 'covered').length;- const partial = updatedItems.filter(i => i.status === 'partial').length;- const missing = updatedItems.filter(i => i.status === 'missing').length;- const total = updatedItems.length;-- return {- playbook: {- ...state.playbook,- items: updatedItems,- covered,- partial,- missing,- coveragePercentage: total > 0 ? Math.round(((covered + partial * 0.5) / total) * 100) : 0,- },- };- });- },-- setSelectedPlaybook: (id) => {- set({ selectedPlaybookId: id });- },-// NudgessetNudge: (nudge) => {set((state) => ({@@ -301,7 +158,6 @@ export const useCopilotStore = create<CopilotState>((set, get) => ({reset: () => {set({...initialState,- dismissedCueCardIds: new Set(),});},}));@@ -309,10 +165,6 @@ export const useCopilotStore = create<CopilotState>((set, get) => ({// Selectors (for optimized re-renders)export const selectMetrics = (state: CopilotState) => state.metrics;-export const selectSentiment = (state: CopilotState) => state.sentiment;-export const selectActiveCueCards = (state: CopilotState) => state.activeCueCards;-export const selectPinnedCueCards = (state: CopilotState) => state.pinnedCueCards;-export const selectPlaybook = (state: CopilotState) => state.playbook;export const selectActiveNudge = (state: CopilotState) => state.activeNudge;export const selectCallSummary = (state: CopilotState) => state.callSummary;export const selectIsCallActive = (state: CopilotState) => state.isCallActive;diff --git a/src/shared/types/ipc.types.ts b/src/shared/types/ipc.types.tsindex 7d8edff..7d57237 100644--- a/src/shared/types/ipc.types.ts+++ b/src/shared/types/ipc.types.ts@@ -141,12 +141,7 @@ export interface CopilotCallSummary {export interface CopilotConfig {enableTranscription: boolean;enableMetrics: boolean;- enableSentiment: boolean;enableNudges: boolean;- enableCueCards: boolean;- enablePlaybook: boolean;- playbookId?: string;- useLLMForDetection: boolean;}export interface IpcApi {@@ -190,23 +185,13 @@ export interface IpcApi {sendTranscript: (channel: 'me' | 'them', data: { text: string; is_final: boolean; start: number; end: number }) => Promise<{ success: boolean; error?: string }>;updateConfig: (config: Partial<CopilotConfig>) => Promise<{ success: boolean; error?: string }>;getState: () => Promise<{ success: boolean; data?: any; error?: string }>;- dismissCueCard: (triggerId: string) => Promise<{ success: boolean; error?: string }>;- pinCueCard: (triggerId: string) => Promise<{ success: boolean; error?: string }>;- cueCardFeedback: (triggerId: string, feedback: 'helpful' | 'wrong' | 'irrelevant') => Promise<{ success: boolean; error?: string }>;dismissNudge: (nudgeId: string) => Promise<{ success: boolean; error?: string }>;- getPlaybooks: () => Promise<{ success: boolean; playbooks?: any[]; error?: string }>;- getCueCards: () => Promise<{ success: boolean; cueCards?: any[]; error?: string }>;- createBookmark: (data: { recordingId: number; timestamp: number; category: string; note?: string }) => Promise<{ success: boolean; bookmark?: any; error?: string }>;- getBookmarks: (recordingId: number) => Promise<{ success: boolean; bookmarks?: any[]; error?: string }>;};copilotOn: {onTranscript: (callback: (segment: CopilotTranscriptSegment) => void) => () => void;onMetrics: (callback: (data: { metrics: CopilotMetrics; health: number }) => void) => () => void;- onSentiment: (callback: (data: { sentiment: CopilotSentiment }) => void) => () => void;onNudge: (callback: (data: { nudge: CopilotNudge }) => void) => () => void;- onCueCard: (callback: (data: { cueCard: CopilotCueCard }) => void) => () => void;- onPlaybook: (callback: (data: { item: CopilotPlaybookItem; snapshot: CopilotPlaybookSnapshot }) => void) => () => void;- onCallEnded: (callback: (data: { summary: CopilotCallSummary; playbook?: CopilotPlaybookSnapshot; metrics: CopilotMetrics; duration: number }) => void) => () => void;+ onCallEnded: (callback: (data: { summary: CopilotCallSummary; metrics: CopilotMetrics; duration: number }) => void) => () => void;onError: (callback: (data: { error: string; context?: string }) => void) => () => void;};mcp: {