diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index bb9cd6c..6991990 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -738,7 +738,6 @@ const App: React.FC = () => { const checkWelcomeWizard = async () => { try { const { hasSeen } = await window.electronAPI.wizard.hasSeenWelcome(); - console.log('Welcome wizard check:', { hasSeen }); if (!hasSeen) { // Mark that we should show wizard once data is loaded setShouldShowWizardWhenReady(true); @@ -753,17 +752,27 @@ const App: React.FC = () => { // Show wizard once data is loaded and we should show it useEffect(() => { - console.log('Wizard show check:', { shouldShowWizardWhenReady, dataLoaded }); if (shouldShowWizardWhenReady && dataLoaded) { // Small delay to ensure UI has rendered const timer = setTimeout(() => { - console.log('Showing welcome wizard'); setShowWelcomeWizard(true); }, 300); return () => clearTimeout(timer); } }, [shouldShowWizardWhenReady, dataLoaded]); + // Expose dev console helper to trigger the wizard: window.cooper.showWizard() + useEffect(() => { + if (process.env.NODE_ENV === 'development' || import.meta.env.DEV) { + (window as any).cooper = { + ...(window as any).cooper, + showWizard: () => { + setShowWelcomeWizard(true); + }, + }; + } + }, []); + // Focus input when active tab changes useEffect(() => { if (activeTabId) { @@ -1022,10 +1031,6 @@ const App: React.FC = () => { try { const config = await window.electronAPI.mcp.getConfig(); setMcpServers(config.mcpServers || {}); - const serverCount = Object.keys(config.mcpServers || {}).length; - console.log('Loaded MCP servers:', Object.keys(config.mcpServers || {})); - if (serverCount > 0) { - } } catch (error) { console.error('Failed to load MCP config:', error); } @@ -1043,7 +1048,6 @@ const App: React.FC = () => { if (result.errors?.length > 0) { console.warn('Some skills had errors:', result.errors); } - console.log('Loaded skills:', result.skills?.length || 0); } catch (error) { console.error('Failed to load skills:', error); } @@ -1125,12 +1129,6 @@ const App: React.FC = () => { // Set up IPC listeners useEffect(() => { const unsubscribeReady = window.electronAPI.copilot.onReady(async (data) => { - console.log( - 'Copilot ready with sessions:', - data.sessions.length, - 'previous:', - data.previousSessions.length - ); setStatus('connected'); setAvailableModels(data.models); @@ -1408,13 +1406,12 @@ const App: React.FC = () => { window.electronAPI.copilot .getModels() .then((data) => { - console.log('Fetched models:', data); if (data.models && data.models.length > 0) { setAvailableModels(data.models); setStatus('connected'); } }) - .catch((err) => console.log('getModels failed (SDK may still be initializing):', err)); + .catch(() => {}); const unsubscribeDelta = window.electronAPI.copilot.onDelta((data) => { const { sessionId, content } = data; @@ -1490,9 +1487,6 @@ const App: React.FC = () => { const now = Date.now(); const lastIdle = lastIdleTimestampRef.current.get(sessionId) || 0; if (now - lastIdle < 500) { - console.log( - `[Idle] Skipping duplicate idle event for session ${sessionId} (${now - lastIdle}ms since last)` - ); return; } lastIdleTimestampRef.current.set(sessionId, now); @@ -1531,7 +1525,6 @@ const App: React.FC = () => { if (!hasCompletionPromise && !maxReached) { // Continue Ralph loop const nextIteration = tab.ralphConfig.currentIteration + 1; - console.log(`[Ralph] Iteration ${nextIteration}/${tab.ralphConfig.maxIterations}`); const screenshotChecklistItem = tab.ralphConfig.requireScreenshot ? '\n- [ ] Screenshot taken of the delivered feature' @@ -1657,9 +1650,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet }); } else { // Ralph loop complete - stop it and close settings - console.log( - `[Ralph] Loop complete. Reason: ${hasCompletionPromise ? 'completion promise found' : 'max iterations reached'}` - ); setShowRalphSettings(false); setShowLisaSettings(false); } @@ -1722,13 +1712,9 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Review approved - move to next phase (or complete if final-review) nextPhase = getNextPhase(currentPhase); if (nextPhase) { - console.log( - `[Lisa] ${getPhaseDisplayName(currentPhase)} approved! Moving to ${getPhaseDisplayName(nextPhase)}` - ); shouldContinue = true; } else { // Final review approved - Lisa loop complete! - console.log(`[Lisa] Final review approved! Loop complete.`); shouldContinue = false; } } else if (isReviewPhase && hasReviewReject) { @@ -1740,18 +1726,12 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet ); if (rejectMatch) { rejectToPhase = rejectMatch[1] as LisaPhase; - console.log( - `[Lisa] ${getPhaseDisplayName(currentPhase)} rejected, returning to ${getPhaseDisplayName(rejectToPhase)}` - ); shouldContinue = true; } } else if (hasPhaseComplete && !isReviewPhase) { // Non-review phase complete - move to its review phase nextPhase = getNextPhase(currentPhase); if (nextPhase) { - console.log( - `[Lisa] ${getPhaseDisplayName(currentPhase)} complete, moving to ${getPhaseDisplayName(nextPhase)}` - ); shouldContinue = true; } } else if (!hasPhaseComplete && !hasReviewApprove && !hasReviewReject) { @@ -1764,8 +1744,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const isNewPhase = targetPhase !== currentPhase; const targetVisitCount = isNewPhase ? 1 : currentVisitCount + 1; - console.log(`[Lisa] ${getPhaseDisplayName(targetPhase)} - Visit #${targetVisitCount}`); - // Build phase-specific continuation prompt const continuationPrompt = buildLisaPhasePrompt( targetPhase, @@ -1807,9 +1785,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet }); } else { // Lisa loop complete - close settings - console.log( - `[Lisa] Loop complete. Phase: ${currentPhase}, Reason: ${hasReviewApprove ? 'final review approved' : 'no continuation needed'}` - ); setShowRalphSettings(false); setShowLisaSettings(false); } @@ -1935,8 +1910,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const name = toolName || 'unknown'; const id = toolCallId || generateId(); - console.log(`[Tool Start] ${name}: toolCallId=${toolCallId}, id=${id}, input=`, input); - // Capture intent from report_intent tool if (name === 'report_intent') { const intent = input?.intent as string | undefined; @@ -1961,8 +1934,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const description = input.description as string | undefined; if (agentType) { - console.log(`[Task Tool → Subagent] ${agentType}: ${description || 'No description'}`); - // Add as a subagent, not a regular tool setTabs((prev) => prev.map((tab) => { @@ -2003,7 +1974,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const path = input.path as string | undefined; if (path && !tab.editedFiles.includes(path)) { newEditedFiles = [...tab.editedFiles, path]; - console.log(`[Tool Start] Added to editedFiles:`, newEditedFiles); } } @@ -2023,12 +1993,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const { sessionId, toolCallId, toolName, input, output } = data; const name = toolName || 'unknown'; - console.log(`[Tool End] ${name}:`, { - toolCallId, - input, - hasInput: !!input, - }); - // Skip internal tools if (name === 'report_intent' || name === 'update_todo') return; @@ -2041,7 +2005,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Check if this task was tracked as a subagent const subagent = (tab.activeSubagents || []).find((s) => s.toolCallId === toolCallId); if (subagent) { - console.log(`[Task Tool → Subagent Completed] ${subagent.agentName}`); return { ...tab, activeSubagents: (tab.activeSubagents || []).map((s) => @@ -2106,7 +2069,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Listen for subagent events const unsubscribeSubagentStarted = window.electronAPI.copilot.onSubagentStarted((data) => { const { sessionId, toolCallId, agentName, agentDisplayName, agentDescription } = data; - console.log(`[Subagent Started] ${agentDisplayName}:`, { toolCallId, agentName }); setTabs((prev) => prev.map((tab) => { @@ -2132,7 +2094,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const unsubscribeSubagentCompleted = window.electronAPI.copilot.onSubagentCompleted((data) => { const { sessionId, toolCallId, agentName } = data; - console.log(`[Subagent Completed] ${agentName}:`, { toolCallId }); setTabs((prev) => prev.map((tab) => { @@ -2156,7 +2117,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet const unsubscribeSubagentFailed = window.electronAPI.copilot.onSubagentFailed((data) => { const { sessionId, toolCallId, agentName, error } = data; - console.log(`[Subagent Failed] ${agentName}:`, { toolCallId, error }); setTabs((prev) => prev.map((tab) => { @@ -2181,7 +2141,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Listen for permission requests const unsubscribePermission = window.electronAPI.copilot.onPermission((data) => { - console.log('Permission requested (full data):', JSON.stringify(data, null, 2)); const sessionId = data.sessionId as string; const requestPath = data.path as string | undefined; @@ -2189,7 +2148,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet if (requestPath && (data.kind === 'read' || data.kind === 'file-read')) { const sessionPaths = userAttachedPathsRef.current.get(sessionId); if (sessionPaths?.has(requestPath)) { - console.log('Auto-approving read for user-attached file:', requestPath); window.electronAPI.copilot.respondPermission({ requestId: data.requestId, decision: 'approved', @@ -2260,7 +2218,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Listen for verified models update (async verification after startup) const unsubscribeModelsVerified = window.electronAPI.copilot.onModelsVerified((data) => { - console.log('Models verified:', data.models.length, 'available'); setAvailableModels(data.models); }); @@ -2482,15 +2439,11 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet !currentMessage.includes(RALPH_COMPLETION_SIGNAL.toLowerCase()); if (isNewTask) { - console.log( - '[Ralph] 👻 Ghost protection triggered - new task detected, cancelling Ralph loop' - ); // Cancel the Ralph loop updateTab(activeTab.id, { ralphConfig: { ...activeTab.ralphConfig, active: false }, }); // Show notification (toast would be better, but for now just log) - console.log('[Ralph] Loop cancelled - you started a new task'); // Don't return - let the new message be sent normally } } @@ -2550,7 +2503,6 @@ Only output ${RALPH_COMPLETION_SIGNAL} when ALL items above are verified complet // Send with enqueue mode to inject into agent's processing queue try { - console.log(`[Injection] Sending enqueued message to session ${activeTab.id}`); await window.electronAPI.copilot.send( activeTab.id, messageContent, @@ -2855,16 +2807,13 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO // Handle image file selection const handleImageSelect = useCallback(async (files: FileList | null) => { - console.log('handleImageSelect called with files:', files?.length); if (!files || files.length === 0) return; const newAttachments: ImageAttachment[] = []; for (let i = 0; i < files.length; i++) { const file = files[i]; - console.log('Processing file:', file.name, 'type:', file.type); if (!file.type.startsWith('image/')) { - console.log('Skipping non-image file:', file.name, file.type); continue; } @@ -2874,12 +2823,10 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO reader.onload = (e) => resolve(e.target?.result as string); reader.readAsDataURL(file); }); - console.log('Read dataUrl, length:', dataUrl.length); // Save to temp file for SDK const filename = `image-${Date.now()}-${i}${file.name.substring(file.name.lastIndexOf('.'))}`; const result = await window.electronAPI.copilot.saveImageToTemp(dataUrl, filename); - console.log('saveImageToTemp result:', result); if (result.success && result.path) { newAttachments.push({ @@ -2893,7 +2840,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO } } - console.log('newAttachments:', newAttachments.length); if (newAttachments.length > 0) { setImageAttachments((prev) => [...prev, ...newAttachments]); inputRef.current?.focus(); @@ -2907,21 +2853,18 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO // Handle file selection (non-image files) const handleFileSelect = useCallback(async (files: FileList | null) => { - console.log('handleFileSelect called with files:', files?.length); if (!files || files.length === 0) return; const newAttachments: FileAttachment[] = []; for (let i = 0; i < files.length; i++) { const file = files[i]; - console.log('Processing file:', file.name, 'type:', file.type); // Note: We allow all files including images - users can attach images as files if they prefer // In Electron, File objects from file picker have a path property // Use it directly to avoid copying and trust issues const electronFile = file as File & { path?: string }; if (electronFile.path) { - console.log('Using original file path:', electronFile.path); newAttachments.push({ id: generateId(), path: electronFile.path, @@ -2938,14 +2881,12 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO reader.onload = (e) => resolve(e.target?.result as string); reader.readAsDataURL(file); }); - console.log('Read dataUrl, length:', dataUrl.length); // Save to temp file for SDK const ext = file.name.includes('.') ? file.name.substring(file.name.lastIndexOf('.')) : ''; const filename = `file-${Date.now()}-${i}${ext}`; const mimeType = file.type || 'application/octet-stream'; const result = await window.electronAPI.copilot.saveFileToTemp(dataUrl, filename, mimeType); - console.log('saveFileToTemp result:', result); if (result.success && result.path) { newAttachments.push({ @@ -2958,7 +2899,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO } } - console.log('newAttachments:', newAttachments.length); if (newAttachments.length > 0) { setFileAttachments((prev) => [...prev, ...newAttachments]); inputRef.current?.focus(); @@ -3050,7 +2990,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO // Try to get files from dataTransfer.files first - separate images and other files if (files.length > 0) { - console.log('Drop event - using files:', files.length); const imageFiles: File[] = []; const otherFiles: File[] = []; for (let i = 0; i < files.length; i++) { @@ -3084,10 +3023,8 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO const otherFiles: File[] = []; for (let i = 0; i < items.length; i++) { const item = items[i]; - console.log('Item:', item.kind, item.type); if (item.kind === 'file') { const file = item.getAsFile(); - console.log('File from item:', file?.name, file?.type, file?.size); if (file) { if ( file.type.startsWith('image/') || @@ -3117,7 +3054,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO // Try getting file paths from URI list const uriList = e.dataTransfer.getData('text/uri-list'); - console.log('URI list:', uriList); if (uriList) { const urls = uriList.split('\n').filter((uri) => uri.trim()); @@ -3126,12 +3062,10 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO (uri) => uri.startsWith('http://') || uri.startsWith('https://') ); if (httpUrls.length > 0) { - console.log('Fetching images from URLs:', httpUrls); const newAttachments: ImageAttachment[] = []; for (const url of httpUrls) { try { const result = await window.electronAPI.copilot.fetchImageFromUrl(url); - console.log('fetchImageFromUrl result:', result); if (result.success && result.path && result.dataUrl) { newAttachments.push({ id: generateId(), @@ -3157,7 +3091,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO const filePaths = urls .filter((uri) => uri.startsWith('file://')) .map((uri) => decodeURIComponent(uri.replace('file://', ''))); - console.log('File paths from URI:', filePaths); } }, [handleImageSelect, handleFileSelect] @@ -3491,7 +3424,6 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO try { const config = await window.electronAPI.mcp.getConfig(); setMcpServers(config.mcpServers || {}); - console.log('Refreshed MCP servers:', Object.keys(config.mcpServers || {})); } catch (error) { console.error('Failed to refresh MCP servers:', error); } @@ -4191,18 +4123,10 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO window.electronAPI.copilot.loadMessageAttachments(result.sessionId), ]); - console.log( - 'Resume session - loaded messages:', - messagesResult.length, - 'attachments:', - attachmentsResult.attachments.length - ); - if (messagesResult.length > 0) { const attachmentMap = new Map( attachmentsResult.attachments.map((a) => [a.messageIndex, a]) ); - console.log('Attachment map entries:', Array.from(attachmentMap.entries())); setTabs((prev) => prev.map((tab) =>