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 { z } from 'zod'
import {
OptionalBoolean,
OptionalFiniteNumber,
OptionalString,
requiredString
} from './rpc-param-primitives'
export type DispatchMutationMessageType =
| 'worker_done'
| 'heartbeat'
| 'escalation'
| 'decision_gate'
export function isDispatchMutationMessageType(
type: string | undefined
): type is DispatchMutationMessageType {
return (
type === 'worker_done' ||
type === 'heartbeat' ||
type === 'escalation' ||
type === 'decision_gate'
)
}
export function getLifecycleGroupRecipientError(type: DispatchMutationMessageType): string {
return `${type} messages belong to one exact Dispatch and cannot target a group address.`
}
export const CheckParams = z
.object({
terminal: OptionalString,
terminalPaneKey: OptionalString,
unread: OptionalBoolean,
peek: OptionalBoolean,
// all skips mark-read; legacy clients encoded it as unread:false.
all: OptionalBoolean,
types: OptionalString,
format: OptionalBoolean,
// Why: one-release RPC compatibility only; the public CLI uses --format because no terminal input is injected.
inject: OptionalBoolean,
ack: OptionalString,
compatibilityAck: OptionalString,
compatibilityQuestionAck: OptionalString,
compatibilityCliCommand: z.enum(['orca', 'orca-ide', 'orca-dev']).optional(),
run: OptionalString,
wait: OptionalBoolean,
timeoutMs: OptionalFiniteNumber
})
.superRefine((params, ctx) => {
// Why: CLI encodes --peek as {peek:true, unread:false} for pre-peek runtimes, so that pair is one mode, not a conflict.
const modes = [
params.unread === true,
params.peek === true,
params.all === true || (params.unread === false && params.peek !== true)
].filter(Boolean)
if (modes.length > 1) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Choose at most one message read mode: --unread, --peek, or --all.'
})
}
})
export const ReplyParams = z.object({
id: requiredString('Missing --id'),
body: requiredString('Missing --body'),
from: OptionalString,
run: OptionalString
})
export const InboxParams = z.object({
limit: OptionalFiniteNumber,
// Filter inbox by handle to agree with check --all.
terminal: OptionalString
})
export const TaskCreateParams = z.object({
spec: requiredString('Missing --spec'),
taskTitle: OptionalString,
displayName: OptionalString,
deps: OptionalString,
parent: OptionalString,
callerTerminalHandle: OptionalString,
run: OptionalString
})
export const TaskListParams = z.object({
status: z.enum(['pending', 'ready', 'dispatched', 'completed', 'failed', 'blocked']).optional(),
ready: OptionalBoolean,
// Why: server-side truncation keeps --brief cheap over SSH/relay instead of shipping full specs the CLI throws away.
brief: OptionalBoolean,
run: OptionalString,
callerTerminalHandle: OptionalString
})
export const DispatchParams = z.object({
task: requiredString('Missing --task'),
// Why: --to is optional so --dry-run can preview without a target; the handler enforces presence before any side-effecting work.
to: OptionalString,
from: OptionalString,
inject: OptionalBoolean,
dryRun: OptionalBoolean,
returnPreamble: OptionalBoolean,
devMode: OptionalBoolean,
run: OptionalString
})
/** An Orca agent session id; the answer is its conversation's Orca session ID. */
export const SessionAddressParams = z.object({
sessionId: requiredString('Missing sessionId')
})
/** Resolve earlier-run mailbox handles through the message’s recorded sender pane. */
export const PartyLocationParams = z.object({
address: requiredString('Missing address'),
messageIds: z.array(z.string().min(1).max(256)).max(50).optional()
})
export const DispatchShowParams = z.object({
task: OptionalString,
preamble: OptionalBoolean,
from: OptionalString,
devMode: OptionalBoolean
})
export const AskParams = z
.object({
to: OptionalString,
question: OptionalString,
resume: OptionalString,
options: OptionalString,
timeoutMs: OptionalFiniteNumber,
from: OptionalString,
run: OptionalString,
compatibilityCliCommand: z.enum(['orca', 'orca-ide', 'orca-dev']).optional(),
compatibilityWindowsCommand: z.enum(['orca', 'orca-ide']).optional()
})
.superRefine((params, ctx) => {
if ((params.question ? 1 : 0) + (params.resume ? 1 : 0) !== 1) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Choose exactly one of --question or --resume.'
})
}
})
export const ResetParams = z
.object({
all: OptionalBoolean,
tasks: OptionalBoolean,
messages: OptionalBoolean
})
.superRefine((params, ctx) => {
const selectedScopeCount = [params.all, params.tasks, params.messages].filter(
(scope) => scope === true
).length
if (selectedScopeCount !== 1) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'Choose exactly one reset scope: --all, --tasks, or --messages.'
})
}
})