mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 16:02:41 +00:00
Fix CLI-launched agent terminal viewport (#2561)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -130,6 +130,10 @@ function isCodexExecutable(command: string): boolean {
|
||||
return command === 'codex' || command === 'codex.exe' || command === 'codex.cmd'
|
||||
}
|
||||
|
||||
function isClaudeExecutable(command: string): boolean {
|
||||
return command === 'claude' || command === 'claude.exe' || command === 'claude.cmd'
|
||||
}
|
||||
|
||||
function isShellAssignment(token: string): boolean {
|
||||
return /^[A-Za-z_][A-Za-z0-9_]*=/.test(token)
|
||||
}
|
||||
@@ -178,6 +182,11 @@ function isVersionFlag(token: string): boolean {
|
||||
return token === '--version' || token === '-V'
|
||||
}
|
||||
|
||||
function isClaudePrintFlag(token: string): boolean {
|
||||
const optionName = codexGlobalOptionName(token)
|
||||
return optionName === '-p' || optionName === '--print'
|
||||
}
|
||||
|
||||
function findCodexSubcommand(
|
||||
tokens: string[],
|
||||
startIndex: number,
|
||||
@@ -259,7 +268,7 @@ function isNonInteractiveCodexSubcommand(tokens: string[]): boolean {
|
||||
return CODEX_NON_INTERACTIVE_SUBCOMMANDS.has(normalizedSubcommand)
|
||||
}
|
||||
|
||||
export function shouldForceVisibleCodexTerminal(command: string | undefined): boolean {
|
||||
export function shouldUseRendererBackedCodexTerminal(command: string | undefined): boolean {
|
||||
if (!command) {
|
||||
return false
|
||||
}
|
||||
@@ -275,3 +284,24 @@ export function shouldForceVisibleCodexTerminal(command: string | undefined): bo
|
||||
|
||||
return !isNonInteractiveCodexSubcommand(tokens)
|
||||
}
|
||||
|
||||
export function shouldUseRendererBackedInteractiveTerminal(command: string | undefined): boolean {
|
||||
if (!command) {
|
||||
return false
|
||||
}
|
||||
|
||||
const tokens = stripShellLaunchPrefix(
|
||||
tokenizeLeadingShellWords(command.trim(), 32).filter((token) => token.length > 0)
|
||||
)
|
||||
|
||||
const executable = tokens[0] ? commandBasename(tokens[0]) : ''
|
||||
if (isCodexExecutable(executable)) {
|
||||
return !isNonInteractiveCodexSubcommand(tokens)
|
||||
}
|
||||
if (isClaudeExecutable(executable)) {
|
||||
return !tokens
|
||||
.slice(1)
|
||||
.some((token) => isHelpFlag(token) || isVersionFlag(token) || isClaudePrintFlag(token))
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user