Files
orca/src/cli/specs/orchestration.ts
T
Brennan Benson 78d5920446 fix(orchestration-cli): point dropped mutations at --retry-request (#14586)
* fix(orchestration-cli): guide dropped mutations to idempotent retry

* test(orchestration-cli): preserve read-only drop message

* fix(orchestration): harden mutation replay identity

* fix(orchestration): preserve replay across remints

* fix(orchestration): defer local mutation identity
2026-08-14 18:11:12 -07:00

266 lines
11 KiB
TypeScript

import type { CommandSpec } from '../args'
import { GLOBAL_FLAGS } from '../args'
import { ORCHESTRATION_WORKER_COMMAND_SPECS } from './orchestration-worker-specs'
export const ORCHESTRATION_COMMAND_SPECS: CommandSpec[] = [
{
path: ['orchestration', 'run-create'],
summary: 'Create and bind a lightweight orchestration Run',
usage:
'orca orchestration run-create --objective <text> [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'objective', 'from', 'retry-request'],
notes: [
'A Run is a namespace and home inbox. It never schedules or places workers.',
'--retry-request is only for exact recovery after an unknown mutation result.'
]
},
{
path: ['orchestration', 'run-use'],
summary: 'Bind this coordinator terminal to an existing Run',
usage:
'orca orchestration run-use --id <run_id> [--from <handle>] [--takeover-legacy] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'id', 'from', 'takeover-legacy', 'retry-request'],
notes: [
'--takeover-legacy must run in the live coordinator agent terminal it binds; it preserves existing worker assignments.'
]
},
{
path: ['orchestration', 'run-current'],
summary: 'Show the Run bound to this coordinator terminal',
usage: 'orca orchestration run-current [--from <handle>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'from']
},
{
path: ['orchestration', 'run-list'],
summary: 'List lightweight orchestration Runs',
usage: 'orca orchestration run-list [--limit <n>] [--cursor <cursor>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'limit', 'cursor']
},
{
path: ['orchestration', 'run-show'],
summary: 'Show one lightweight orchestration Run',
usage: 'orca orchestration run-show --id <run_id> [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'id']
},
{
path: ['orchestration', 'send'],
summary: 'Send an inter-agent message',
usage:
'orca orchestration send --subject <text> [--to <run:id|dispatch:id|legacy_handle>] [--run <run_id>] [--from <handle>] [--body <text>] [--type <type>] [--priority <level>] [--thread-id <id>] [--payload <json>] [--task-id <id>] [--dispatch-id <id>] [--outcome <succeeded|failed>] [--files-modified <csv>] [--report-path <path>] [--phase <text>] [--retry-request <id>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'to',
'run',
'from',
'subject',
'body',
'type',
'priority',
'thread-id',
'payload',
'task-id',
'dispatch-id',
'dispatch-capability',
'retry-request',
'outcome',
'files-modified',
'report-path',
'phase'
],
notes: [
'On Windows PowerShell, quote group addresses such as --to "@all" or --to "@worktree:<id>".',
"worker_done and heartbeat are exact-Dispatch signals and cannot target groups; omit --to to use the Dispatch's Run mailbox.",
'worker_done requires --outcome succeeded or --outcome failed.',
'From an active Dispatch, an omitted recipient defaults to its owning Run mailbox.',
'Use --to dispatch:<id> for attempt-specific coordinator guidance; Orca durably relays it to a connected worker server.',
'A worker_done with the active task/dispatch IDs completes that task only from the dispatched pane. When stable pane identity is unavailable, the sender handle must exactly match the dispatch assignee; injected preambles include the correct --from value.',
'Prefer --task-id/--dispatch-id/etc. over raw --payload JSON in worker commands; PowerShell strips JSON quotes easily.'
]
},
{
path: ['orchestration', 'check'],
summary: 'Check messages for a terminal',
usage:
'orca orchestration check [--terminal <handle>] [--run <run_id>] [--ack <delivery_id>] [--unread | --peek | --all] [--types <type,...>] [--format] [--wait] [--timeout-ms <n>] [--retry-request <id>] [--json]\n' +
" default: return the bound Run's oldest unacknowledged FIFO batch.\n" +
' --ack: acknowledge the prior whole batch before checking/waiting.\n' +
' --peek: return only unread messages without marking them read.\n' +
' --all: return every message for the handle; does not mark read.\n' +
' --wait: block until a matching message arrives or --timeout-ms expires.\n' +
' Emits JSON keepalive lines to stderr every 15s so the caller can\n' +
' tell the process is alive. `_keepalive` is unrelated to heartbeat\n' +
' messages; `_heartbeat` remains as a deprecated compatibility alias.\n' +
' Filter with `jq "select(._keepalive|not)"` when merging streams.',
allowedFlags: [
...GLOBAL_FLAGS,
'terminal',
'run',
'ack',
'unread',
'peek',
'all',
'types',
'format',
'wait',
'timeout-ms',
'retry-request'
],
notes: [
'On Windows PowerShell, quote comma-separated type filters, e.g. --types "worker_done,escalation".',
'--format renders the returned rows as local text only; it never writes to another terminal.',
'A bound Run replays the same Delivery until --ack; process every message before acknowledging.'
]
},
{
path: ['orchestration', 'reply'],
summary: 'Reply to a message',
usage:
'orca orchestration reply --id <msg_id> --body <text> [--run <run_id>] [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'id', 'body', 'run', 'from', 'retry-request']
},
{
path: ['orchestration', 'inbox'],
summary: 'Show messages across (or for) recipients',
usage: 'orca orchestration inbox [--limit <n>] [--terminal <handle>] [--full] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'limit', 'terminal', 'full']
},
{
path: ['orchestration', 'task-create'],
summary: 'Create an orchestration task',
usage:
'orca orchestration task-create --spec <text> [--task-title <text>] [--display-name <text>] [--deps <json_array>] [--parent <task_id>] [--run <run_id>] [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'spec',
'task-title',
'display-name',
'deps',
'parent',
'run',
'from',
'retry-request'
]
},
{
path: ['orchestration', 'task-list'],
summary: 'List orchestration tasks',
usage:
'orca orchestration task-list [--status <status>] [--ready] [--brief] [--run <run_id>] [--from <handle>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'status', 'ready', 'brief', 'run', 'from'],
notes: ['--brief collapses whitespace and caps each spec at 160 characters.']
},
{
path: ['orchestration', 'task-update'],
summary: 'Update a task status',
usage:
'orca orchestration task-update --id <task_id> --status <status> [--result <json>] [--run <run_id>] [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'id', 'status', 'result', 'run', 'from', 'retry-request'],
notes: ['Valid --status values: pending, ready, dispatched, completed, failed, blocked.']
},
...ORCHESTRATION_WORKER_COMMAND_SPECS,
{
path: ['orchestration', 'dispatch'],
summary: 'Dispatch a task to a terminal',
usage:
'orca orchestration dispatch --task <task_id> --to <handle> [--from <handle>] [--run <run_id>] [--inject] [--dry-run] [--return-preamble] [--retry-request <id>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'task',
'to',
'from',
'run',
'inject',
'dry-run',
'return-preamble',
'retry-request'
]
},
{
path: ['orchestration', 'dispatch-show'],
summary: 'Show dispatch context for a task',
usage:
'orca orchestration dispatch-show --task <task_id> [--preamble] [--from <handle>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'task', 'preamble', 'from']
},
{
path: ['orchestration', 'ask'],
summary: 'Ask the coordinator a question and block until answered',
usage:
'orca orchestration ask (--question <text> | --resume <message_id>) [--to <run:id>] [--run <run_id>] [--options <csv>] [--timeout-ms <n>] [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'to',
'run',
'question',
'resume',
'dispatch-capability',
'options',
'timeout-ms',
'from',
'retry-request'
],
notes: [
'From an active Dispatch, a new question defaults to its owning Run mailbox.',
'Timeout leaves the question pending; resume with the original message ID.'
]
},
{
path: ['orchestration', 'coordinator-start'],
aliases: [['orchestration', 'run']],
summary: 'Retired: load the current orchestration skill',
usage:
'orca orchestration coordinator-start --spec <text> [--from <handle>] [--poll-interval-ms <n>] [--max-concurrent <n>] [--worktree <selector>] [--json]',
allowedFlags: [
...GLOBAL_FLAGS,
'spec',
'from',
'poll-interval-ms',
'max-concurrent',
'worktree'
],
notes: [
'This command performs no effects and returns the exact `skills get orchestration --full` recovery action.',
'Use the lightweight Run, Task, and worker-start primitives described by the current skill.'
]
},
{
path: ['orchestration', 'coordinator-stop'],
aliases: [['orchestration', 'run-stop']],
summary: 'Retired: load the current orchestration skill',
usage: 'orca orchestration coordinator-stop [--json]',
allowedFlags: [...GLOBAL_FLAGS],
notes: [
'This command performs no effects and returns the exact `skills get orchestration --full` recovery action.'
]
},
{
path: ['orchestration', 'gate-create'],
summary: 'Create a decision gate blocking a task',
usage:
'orca orchestration gate-create --task <task_id> --question <text> [--options <json_array>] [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'task', 'question', 'options', 'from', 'retry-request']
},
{
path: ['orchestration', 'gate-resolve'],
summary: 'Resolve a pending decision gate',
usage:
'orca orchestration gate-resolve --id <gate_id> --resolution <text> [--from <handle>] [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'id', 'resolution', 'from', 'retry-request']
},
{
path: ['orchestration', 'gate-list'],
summary: 'List decision gates',
usage:
'orca orchestration gate-list [--task <task_id>] [--status <status>] [--run <run_id>] [--from <handle>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'task', 'status', 'run', 'from'],
notes: ['--run inspects a named Run without binding; otherwise gates are scoped to the caller.']
},
{
path: ['orchestration', 'reset'],
summary: 'Reset one explicit orchestration state scope',
usage:
'orca orchestration reset (--all | --tasks | --messages) [--retry-request <id>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'all', 'tasks', 'messages', 'retry-request']
}
]