Files
orca/src/main/ssh/ssh-remote-cli-in-process-result.ts
T
OrcaWinandOrcaWin 363e478909 fix(orchestration): preserve active workers across updates (#11271)
* fix(orchestration): preserve active workers across updates

* test(ssh): model absent legacy adoption

* test(orchestration): align compatibility contracts

* fix(windows): escape updater PowerShell booleans

* fix(windows): restore stock uninstall process check

* fix(orchestration): keep recovery off renderer startup barrier

* fix(orchestration): harden legacy recovery migration

* fix(orchestration): close recovery review gaps

* fix(orchestration): complete legacy worker cutover recovery

* fix(orchestration): preserve legacy workers across updates

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-07-29 11:31:35 -07:00

41 lines
1.5 KiB
TypeScript

import type { RpcResponse } from '../runtime/rpc/core'
import type { ParsedRemoteCli } from './ssh-remote-cli-argument-error'
import type { RemoteOrcaCliResult } from './ssh-remote-cli-host-passthrough'
import { formatRemoteCli } from './ssh-remote-cli-format'
import {
formatRemoteOrchestrationAsk,
getRemoteCliExitCode
} from './ssh-remote-orchestration-ask-output'
import { formatRemoteOrchestrationCheck } from './ssh-remote-orchestration-check-output'
import { getRemoteCliPostOutput } from './ssh-remote-orchestration-post-output'
import { resolveRemoteCliHandle } from './ssh-remote-cli-args'
export function formatInProcessRemoteCliResult(
parsed: ParsedRemoteCli,
env: Record<string, string>,
response: RpcResponse,
json: boolean
): RemoteOrcaCliResult {
const command = parsed.commandPath.join(' ')
const formatted =
command === 'orchestration check'
? formatRemoteOrchestrationCheck(
response,
json,
resolveRemoteCliHandle(parsed.flags, env, 'terminal'),
parsed.flags.has('format')
)
: command === 'orchestration ask'
? formatRemoteOrchestrationAsk(response, json)
: json
? { stdout: `${JSON.stringify(response, null, 2)}\n`, stderr: '' }
: formatRemoteCli(response)
const postOutput = getRemoteCliPostOutput(parsed, env, response)
return {
stdout: formatted.stdout,
stderr: formatted.stderr,
exitCode: getRemoteCliExitCode(command, response),
...(postOutput ? { postOutput } : {})
}
}