Delegate CLI I/O Contract v1.
This module owns the machine-facing contract for pixir delegate. It is intentionally
small and testable: parse CLI flags, read a JSON spec, validate the contract, and emit
a stable dry-run result, attached runtime result, or structured error. Runtime
execution is delegated to Pixir.Delegate.Runner after the same parser accepts the
request.
The scaling rule is part of the contract: delegate should enter Pixir once and let
BEAM coordinate fanout. Caller-side polling loops and process-per-child shell fanout
are explicitly outside this surface.
TODO(delegate-service-v1)
The start, status, attach, and cancel subcommands attempt daemon/IPC Delegate
service work when a manual workspace daemon is reachable. start requires that
resident owner so returned running work survives the short-lived CLI process; status,
attach, and cancel can fall back to durable Delegate snapshots. attach is
snapshot-first, and attach --progress=stderr-jsonl --wait-horizon-ms N requests a
daemon/owner follow stream rather than a caller-side polling loop. Keep the CLI shape
agent-useful:
--jsonresponses should always exposedelegate_id, parentsession_id, diagnostics commands, and host-boundary metadata;attach --progress=stderr-jsonlshould emit bounded live/snapshot progress frames to stderr while stdout remains exactly one final JSON envelope;- long-running snapshots should distinguish accepted/running/incomplete from terminal success/failure;
pixir delegate helpshould become a supported alias for the delegate section ofpixir help;command_okmeans the Delegate command itself was accepted and rendered a structured response;work_completereports whether delegated work reached a clean terminal success, so consumers must not collapse them into one boolean;- service mode should still start exactly one Pixir entrypoint and let OTP own Subagent/Workflow fanout.
Summary
Functions
Return the supported Delegate contract version.
Parse and execute Delegate CLI Contract v1 dry-run or attached runtime behavior.
Types
Functions
@spec contract_version() :: pos_integer()
Return the supported Delegate contract version.
Parse and execute Delegate CLI Contract v1 dry-run or attached runtime behavior.