Skip to main content

Module spec

Module spec 

Source
Expand description

The known code-agent CLIs and their per-agent invocation differences, encoded as a static table so adding an agent is a single data literal (issue #11). All per-agent-variable logic — argv construction and version and result parsing — lives here as pure functions, directly unit-testable without spawning a process.

Structs§

AgentSpec
Everything wt needs to detect and drive one agent CLI.

Enums§

AgentKind
A code-agent CLI that wt knows how to detect and drive.
ResultFormat
How an agent’s JSON output mode frames its result. New formats (e.g. a JSON-lines event stream) are added here as more agents are supported.

Statics§

AGENTS
The known agents. Add a new agent by appending one literal here.

Functions§

apply_effort
Applies an Effort level to a prompt by prepending its directive (a blank line separates it from the body); the baseline (medium) returns the prompt unchanged. This is how wt conveys effort to agents without a native effort flag — it never fails and is a no-op for unsupported levels.
parse_result
Parses JSON-mode stdout into a normalized AgentRun for kind, per format. Malformed JSON maps to crate::error::Error::Json.
parse_version
Extracts a best-effort version from --version output: the first MAJOR.MINOR[.PATCH]-shaped token on the first line. No semver crate is used (matching repo convention); the trimmed raw line is preserved too.
prompt_argv
Builds the full non-interactive, JSON-mode argv for spec, prompt, and model: run_args, then the prompt (when positional), then json_args, then the model selector (model_flag + the model id) when the agent has one. The prompt is a single argv element — never shell-interpolated — so it needs no quoting and cannot inject extra arguments.
version_argv
Builds the version-probe argv for spec.