mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
* fix(setup): correct Windows sequencing wrapper quoting * test(setup): preserve spaced Windows batch paths * refactor(setup): dedupe PowerShell encoder, clarify wrapCmd comment Route the Windows setup-sequencing and Hermes startup planners through the shared renderer-safe encodePowerShellCommand instead of two verbatim btoa copies, and make that shared encoder renderer-safe (Buffer is unavailable in the sandboxed renderer where both planners also run). Reword the wrapCmd comment so it describes the current single-outer-quote behavior instead of the old quote-doubling bug. * test(setup): cover Windows metacharacter paths * fix(setup): keep Windows runner paths out of cmd source * test(setup): preserve Windows setup failures * docs(setup): explain safe cmd path handoff --------- Co-authored-by: OrcaWin <alpha-eng@stably.ai> Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
12 lines
506 B
TypeScript
12 lines
506 B
TypeScript
export function encodePowerShellCommand(command: string): string {
|
|
// Why: some callers (setup sequencing, Hermes startup) run in the sandboxed
|
|
// renderer where Node's Buffer is unavailable, so encode the UTF-16LE bytes
|
|
// PowerShell's -EncodedCommand expects using only renderer-safe globals.
|
|
let bytes = ''
|
|
for (let index = 0; index < command.length; index += 1) {
|
|
const code = command.charCodeAt(index)
|
|
bytes += String.fromCharCode(code & 0xff, code >>> 8)
|
|
}
|
|
return btoa(bytes)
|
|
}
|