mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
* fix(windows): codex and claude get a prompt's double quotes in Windows PowerShell Windows PowerShell 5.1 (and pwsh before 7.3) does not escape an embedded `"` when it builds a native program's command line, so every quote in a launch prompt was dropped, and quotes could split the prompt into extra arguments. Orca's PowerShell codex and claude wrappers now escape their arguments at runtime for the PowerShell that is actually running, through one shared __OrcaNativeArgs function. pwsh 7.3+ already escapes, so it gets the text untouched. * fix(windows): escape agent args for .cmd shims under pwsh 7.3+ too pwsh 7.3+ defaults to the Windows argument mode, which still passes .cmd/.bat targets the Legacy way, so a codex or claude .cmd shim kept dropping quotes there. The function now takes the program it escapes for and names the modes that escape by themselves, and anchors the 5.1 trailing-backslash fix at the true end of the text (`$` also matched before a final newline). Tests now run the real codex wrapper with a quoted prompt, cover pwsh's Legacy mode and the newline case, and pin the claude wrapper's call. * fix(windows): strip comment lines from the PowerShell bootstrap payload The shared escaping function pushed the encoded bootstrap to 27,324 of the 28,000-character budget, leaving almost no room for a startup command to ride in -EncodedCommand, so short commands fell back to stdin (the path #7236 broke). Comment lines document the source but only spend that budget in the payload; dropping them frees 3,732 encoded characters, more headroom than main had. * fix(windows): quote agent args with "" where cmd.exe or Windows PowerShell reads them Escaping embedded quotes as \" let pwsh 7.3+'s .cmd quoting expose a prompt's `&` to cmd.exe, which then ran the rest as a command. Where cmd.exe reads the line, or Windows PowerShell counts quotes naively, the function now quotes the argument itself and writes each quote as "", as process-host's windows-command-line.ts already does. That also delivers text 5.1 used to strip, so its special cases go away. The codex and claude wrappers now come as one fragment with the function they call, the bootstrap test pins the startup-command budget instead of restating the strip, and the cwd-restore comment leaves the payload too. --------- Co-authored-by: Orca Worker <orca-worker@localhost>
13 lines
549 B
TypeScript
13 lines
549 B
TypeScript
import { getPowerShellClaudeShellFunction } from './claude-shell-function'
|
|
import { getPowerShellCodexShellLaunchPreflight } from './codex-shell-function'
|
|
import { getPowerShellEscapeNativeArgsFunction } from './powershell-native-argument'
|
|
|
|
/** Orca's PowerShell `codex` and `claude` wrappers, after the argument escaping both call. */
|
|
export function getPowerShellAgentWrappers(): string {
|
|
return [
|
|
getPowerShellEscapeNativeArgsFunction(),
|
|
getPowerShellCodexShellLaunchPreflight(),
|
|
getPowerShellClaudeShellFunction()
|
|
].join('\n')
|
|
}
|