Skip to main content

Module command

Module command 

Source
Expand description

Async handlers for every cli leaf command (except api, schemas, the internal instance subprocess runner, and clap’s external plugin dispatch). Stubs today; typed Args

  • pub async fn handle(...) signatures land in follow-up commits.

Re-exports§

pub use command_executor::*;

Modules§

agents
api
command_executor
config
db
db — direct database access at the CLI level.
functions
mcp
plugins
swarms
tasks
agents tasks — task store + (eventual) runner.
tools
update
update — async handler stub.
viewer

Structs§

AgentArguments
Agent identity + response routing args carried per call.
FromArgsError
ResponseSchema
StreamOnce

Enums§

Command
FromArgsErrorSource
McpResponseItem
MCP-side projection of one CLI response item.
Ok
Success-only response shape. Wire form is the bare string "Ok" — a single-variant enum gives us a typed sentinel that serializes and deserializes through serde as the static string. Used as Response on every cli leaf whose only success signal is “it worked.”
ParseError
Error from parse_request. Either clap rejected the argv (ParseError::Clap--help, unknown subcommand, missing required arg, etc.) or the typed Command couldn’t be lowered into a Request (ParseError::FromArgs — inline body JSON failed to parse, etc.).
Remote
Wire-level source enum: which remote backend a path references. Same shape as crate::Remote but lives under cli::command so it can be clap::ValueEnum without dragging clap into the SDK’s non-cli surface.
RemotePathCommitOptionalOrFavorite
Either a fully resolved RemotePathCommitOptional or a favorite name that the cli host resolves at handler time. Parsed from CLI input via FromStr (docker-style key=value,...); after that the typed enum is carried around in-process — Requests are never actually serialized at runtime. The serde + schemars::JsonSchema derives exist solely so the SDK can generate the JSON Schema for this type (untagged so the schema describes either the path’s object form or a bare string).
Request
ResponseItem

Traits§

CommandRequest
Convert a typed CLI request struct into the argv tail the cli binary should be invoked with. Implementors are the per-leaf request shapes in the surrounding tree (e.g. agents::spawn::Request) and emit the flags + positional args their leaf command expects — without the binary name. Callers prepend whatever launcher prefix they need (["objectiveai-cli"], ["objectiveai-cli", "instance"], …).
CommandResponse
Convert a typed CLI response item into its MCP-shaped projection — either a media [ContentBlock] for MCP tool results or a JSONL serde_json::Value for the line-oriented stream wire format. Implementors are the per-leaf response shapes in the surrounding tree (agents::spawn::ResponseItem, tools::run::ResponseItem, …) — not yet wired up; the trait exists to anchor the contract.

Functions§

execute
execute_jq
parse_request
Parse an argv slice into a typed Request. Accepts either shape:
remote_path_to_arg_string
Serialize a RemotePathCommitOptional back into its docker-style key=value,... form for round-tripping through argv.