Files
orca/src/cli/computer/computer-command-target.ts
T
Neil 8af94ff899 refactor(cli): group runtime modules by responsibility (#42378)
* refactor(cli): group runtime modules by responsibility

* test(cli): retain QR privacy and mounted AppImage observations
2026-11-14 04:43:56 -08:00

35 lines
1.1 KiB
TypeScript

import type { ComputerAppQuery } from '../../shared/computer-use-runtime-types'
import type { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/connection/types'
import { getOptionalStringFlag, getRequiredStringFlag } from '../arguments/flags'
import { getBrowserWorktreeSelector } from '../workspace-selection/workspace-selector'
export type ComputerCliTarget = {
session?: string
worktree?: string
app: ComputerAppQuery
}
export async function getComputerCommandTarget(
flags: Map<string, string | boolean>,
cwd: string,
client: RuntimeClient
): Promise<ComputerCliTarget> {
const app = getRequiredStringFlag(flags, 'app')
const session = getOptionalStringFlag(flags, 'session')
const worktree = getOptionalStringFlag(flags, 'worktree')
if (session && worktree) {
throw new RuntimeClientError(
'invalid_argument',
'Computer-use targeting accepts either --session or --worktree, not both'
)
}
if (session) {
return { session, app }
}
return {
app,
worktree: await getBrowserWorktreeSelector(flags, cwd, client)
}
}