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 [--from ] [--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 [--from ] [--json]', allowedFlags: [...GLOBAL_FLAGS, 'id', 'from', 'retry-request'] }, { path: ['orchestration', 'run-current'], summary: 'Show the Run bound to this coordinator terminal', usage: 'orca orchestration run-current [--from ] [--json]', allowedFlags: [...GLOBAL_FLAGS, 'from'] }, { path: ['orchestration', 'run-list'], summary: 'List lightweight orchestration Runs', usage: 'orca orchestration run-list [--json]', allowedFlags: [...GLOBAL_FLAGS] }, { path: ['orchestration', 'run-show'], summary: 'Show one lightweight orchestration Run', usage: 'orca orchestration run-show --id [--json]', allowedFlags: [...GLOBAL_FLAGS, 'id'] }, { path: ['orchestration', 'send'], summary: 'Send an inter-agent message', usage: 'orca orchestration send --subject [--to ] [--run ] [--from ] [--body ] [--type ] [--priority ] [--thread-id ] [--payload ] [--task-id ] [--dispatch-id ] [--outcome ] [--files-modified ] [--report-path ] [--phase ] [--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:".', "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: 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 ] [--run ] [--ack ] [--unread | --peek | --all] [--types ] [--format] [--wait] [--timeout-ms ] [--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 --body [--run ] [--from ] [--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 ] [--terminal ] [--full] [--json]', allowedFlags: [...GLOBAL_FLAGS, 'limit', 'terminal', 'full'] }, { path: ['orchestration', 'task-create'], summary: 'Create an orchestration task', usage: 'orca orchestration task-create --spec [--task-title ] [--display-name ] [--deps ] [--parent ] [--run ] [--from ] [--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 ] [--ready] [--brief] [--run ] [--from ] [--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 --status [--result ] [--run ] [--from ] [--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 --to [--from ] [--run ] [--inject] [--dry-run] [--return-preamble] [--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 [--preamble] [--from ] [--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 | --resume ) [--to ] [--run ] [--options ] [--timeout-ms ] [--from ] [--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 [--from ] [--poll-interval-ms ] [--max-concurrent ] [--worktree ] [--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 --question [--options ] [--json]', allowedFlags: [...GLOBAL_FLAGS, 'task', 'question', 'options', 'retry-request'] }, { path: ['orchestration', 'gate-resolve'], summary: 'Resolve a pending decision gate', usage: 'orca orchestration gate-resolve --id --resolution [--json]', allowedFlags: [...GLOBAL_FLAGS, 'id', 'resolution', 'retry-request'] }, { path: ['orchestration', 'gate-list'], summary: 'List decision gates', usage: 'orca orchestration gate-list [--task ] [--status ] [--json]', allowedFlags: [...GLOBAL_FLAGS, 'task', 'status'] }, { path: ['orchestration', 'reset'], summary: 'Reset one explicit orchestration state scope', usage: 'orca orchestration reset (--all | --tasks | --messages) [--json]', allowedFlags: [...GLOBAL_FLAGS, 'all', 'tasks', 'messages', 'retry-request'] } ]