mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-02-24 09:37:38 +00:00
fix: add support for Codex in the shell (#424)
* fix: add support for Codex in the shell * fix: harden codex shell session resume command
This commit is contained in:
@@ -1138,7 +1138,7 @@ function handleShellConnection(ws) {
|
|||||||
if (isPlainShell) {
|
if (isPlainShell) {
|
||||||
welcomeMsg = `\x1b[36mStarting terminal in: ${projectPath}\x1b[0m\r\n`;
|
welcomeMsg = `\x1b[36mStarting terminal in: ${projectPath}\x1b[0m\r\n`;
|
||||||
} else {
|
} else {
|
||||||
const providerName = provider === 'cursor' ? 'Cursor' : 'Claude';
|
const providerName = provider === 'cursor' ? 'Cursor' : provider === 'codex' ? 'Codex' : 'Claude';
|
||||||
welcomeMsg = hasSession ?
|
welcomeMsg = hasSession ?
|
||||||
`\x1b[36mResuming ${providerName} session ${sessionId} in: ${projectPath}\x1b[0m\r\n` :
|
`\x1b[36mResuming ${providerName} session ${sessionId} in: ${projectPath}\x1b[0m\r\n` :
|
||||||
`\x1b[36mStarting new ${providerName} session 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`;
|
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 {
|
} else {
|
||||||
// Use claude command (default) or initialCommand if provided
|
// Use claude command (default) or initialCommand if provided
|
||||||
const command = initialCommand || 'claude';
|
const command = initialCommand || 'claude';
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell
|
|||||||
projectPath: selectedProjectRef.current.fullPath || selectedProjectRef.current.path,
|
projectPath: selectedProjectRef.current.fullPath || selectedProjectRef.current.path,
|
||||||
sessionId: isPlainShellRef.current ? null : selectedSessionRef.current?.id,
|
sessionId: isPlainShellRef.current ? null : selectedSessionRef.current?.id,
|
||||||
hasSession: isPlainShellRef.current ? false : !!selectedSessionRef.current,
|
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,
|
cols: terminal.current.cols,
|
||||||
rows: terminal.current.rows,
|
rows: terminal.current.rows,
|
||||||
initialCommand: initialCommandRef.current,
|
initialCommand: initialCommandRef.current,
|
||||||
|
|||||||
Reference in New Issue
Block a user