@@ -185,6 +185,8 @@ export const detectTerminalApp = async (pid: number): Promise<string> => {
185185 if ( ! comm ) break ;
186186
187187 const commLower = comm . toLowerCase ( ) ;
188+ // CodeV's embedded terminal (node-pty runs under Electron)
189+ if ( commLower . includes ( 'electron' ) || commLower . includes ( 'codev' ) ) return 'codev' ;
188190 if ( commLower . includes ( 'iterm' ) || commLower . includes ( 'iterm2' ) ) return 'iterm2' ;
189191 if ( commLower . includes ( 'cmux' ) ) return 'cmux' ;
190192 if ( commLower . includes ( 'ghostty' ) ) return 'ghostty' ;
@@ -578,7 +580,7 @@ end tell`);
578580
579581 // Ghostty + unknown terminals: cwd fallback (no async work, runs after cross-ref)
580582 for ( const [ terminal , items ] of Object . entries ( byTerminal ) ) {
581- if ( terminal === 'iterm2' || terminal === 'cmux' || terminal === 'terminal' ) continue ;
583+ if ( terminal === 'iterm2' || terminal === 'cmux' || terminal === 'terminal' || terminal === 'codev' ) continue ;
582584 for ( const item of items ) {
583585 const fallback = item . candidates . find ( s => ! activeMap . has ( s . sessionId ) ) ;
584586 if ( fallback ) {
@@ -747,6 +749,10 @@ export const openSession = async (
747749 }
748750
749751 switch ( effectiveTerminal ) {
752+ case 'codev' :
753+ // Session is in CodeV's embedded terminal — notify renderer to switch to Term tab
754+ openSessionInCodeV ( sessionId ) ;
755+ break ;
750756 case 'cmux' :
751757 openSessionInCmux ( sessionId , projectPath , isActive , activePid , customTitle ) ;
752758 break ;
@@ -768,6 +774,26 @@ export const openSession = async (
768774 * If the session is already active, switch to its tab
769775 * Otherwise, open a new tab and run claude --resume
770776 */
777+ /**
778+ * Callback for opening sessions in CodeV's embedded terminal.
779+ * Set by main.ts to avoid circular dependency.
780+ */
781+ let codevTerminalCallback : ( ( sessionId : string ) => void ) | null = null ;
782+
783+ export const setCodevTerminalCallback = ( cb : ( sessionId : string ) => void ) => {
784+ codevTerminalCallback = cb ;
785+ } ;
786+
787+ /**
788+ * "Open" a session that's running in CodeV's embedded terminal.
789+ * Switches to the Terminal tab instead of opening an external terminal.
790+ */
791+ export const openSessionInCodeV = ( sessionId : string ) : void => {
792+ if ( codevTerminalCallback ) {
793+ codevTerminalCallback ( sessionId ) ;
794+ }
795+ } ;
796+
771797export const openSessionInITerm2 = (
772798 sessionId : string ,
773799 projectPath : string ,
0 commit comments