diff --git a/server/index.js b/server/index.js index 4b70cd3..b671dcb 100755 --- a/server/index.js +++ b/server/index.js @@ -1138,7 +1138,7 @@ function handleShellConnection(ws) { if (isPlainShell) { welcomeMsg = `\x1b[36mStarting terminal in: ${projectPath}\x1b[0m\r\n`; } else { - const providerName = provider === 'cursor' ? 'Cursor' : 'Claude'; + const providerName = provider === 'cursor' ? 'Cursor' : provider === 'codex' ? 'Codex' : 'Claude'; welcomeMsg = hasSession ? `\x1b[36mResuming ${providerName} session ${sessionId} in: ${projectPath}\x1b[0m\r\n` : `\x1b[36mStarting new ${providerName} session in: ${projectPath}\x1b[0m\r\n`; @@ -1174,6 +1174,23 @@ function handleShellConnection(ws) { shellCommand = `cd "${projectPath}" && cursor-agent`; } } + } else if (provider === 'codex') { + // Use codex command + if (os.platform() === 'win32') { + if (hasSession && sessionId) { + // Try to resume session, but with fallback to a new session if it fails + shellCommand = `Set-Location -Path "${projectPath}"; codex resume "${sessionId}"; if ($LASTEXITCODE -ne 0) { codex }`; + } else { + shellCommand = `Set-Location -Path "${projectPath}"; codex`; + } + } else { + if (hasSession && sessionId) { + // Try to resume session, but with fallback to a new session if it fails + shellCommand = `cd "${projectPath}" && codex resume "${sessionId}" || codex`; + } else { + shellCommand = `cd "${projectPath}" && codex`; + } + } } else { // Use claude command (default) or initialCommand if provided const command = initialCommand || 'claude'; diff --git a/src/components/Shell.jsx b/src/components/Shell.jsx index 4e6dc3a..44115b9 100644 --- a/src/components/Shell.jsx +++ b/src/components/Shell.jsx @@ -162,7 +162,7 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell projectPath: selectedProjectRef.current.fullPath || selectedProjectRef.current.path, sessionId: isPlainShellRef.current ? null : selectedSessionRef.current?.id, hasSession: isPlainShellRef.current ? false : !!selectedSessionRef.current, - provider: isPlainShellRef.current ? 'plain-shell' : (selectedSessionRef.current?.__provider || 'claude'), + provider: isPlainShellRef.current ? 'plain-shell' : (selectedSessionRef.current?.__provider || localStorage.getItem('selected-provider') || 'claude'), cols: terminal.current.cols, rows: terminal.current.rows, initialCommand: initialCommandRef.current,