Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { reportWorkerTerminalUserInput } from './worker-terminal-takeover-report'
import { getTerminalLiveAccessoryRawSendTarget } from './terminal-live-accessory-raw-send-target'
import { buildTerminalSendParams, TERMINAL_INPUT_SEND_OPTIONS } from './terminal-send-request'
import { terminalInputSend } from './mobile-terminal-operations'
import type { RpcOperationSender } from '../transport/rpc-operation-sender'
import type { ConnectionState } from '../transport/types'
type TerminalLiveAccessoryRawSendArgs = {
readonly sendTerminalUserInput: typeof terminalInputSend.request
readonly client: RpcOperationSender | null
readonly targetHandle: string
readonly activeHandle: string | null
readonly activeSessionTabType: string | null
readonly connState: ConnectionState
readonly bytes: string
readonly deviceToken: string | null
}
export async function sendTerminalLiveAccessoryRawBytes(
args: TerminalLiveAccessoryRawSendArgs
): Promise<boolean> {
// IME flush can outlive terminal selection; recheck the target afterward.
const rawSendTarget = getTerminalLiveAccessoryRawSendTarget({
targetHandle: args.targetHandle,
activeHandle: args.activeHandle,
activeSessionTabType: args.activeSessionTabType
})
if (!args.client || !rawSendTarget || args.connState !== 'connected') {
return false
}
return args
.sendTerminalUserInput(
args.client,
buildTerminalSendParams({
terminal: rawSendTarget,
text: args.bytes,
enter: false,
deviceToken: args.deviceToken
}),
TERMINAL_INPUT_SEND_OPTIONS
)
.then(
(reply) => {
const accepted = terminalInputSend.interpret(reply) === true
if (accepted) {
reportWorkerTerminalUserInput(args.client!, rawSendTarget)
}
return accepted
},
() => false
)
}