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§
- Agent
Spec - Everything
wtneeds to detect and drive one agent CLI.
Enums§
- Agent
Kind - A code-agent CLI that
wtknows how to detect and drive. - Result
Format - 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
Effortlevel to a prompt by prepending its directive (a blank line separates it from the body); the baseline (medium) returns the prompt unchanged. This is howwtconveys 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
AgentRunforkind, performat. Malformed JSON maps tocrate::error::Error::Json. - parse_
version - Extracts a best-effort version from
--versionoutput: the firstMAJOR.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, andmodel:run_args, then the prompt (when positional), thenjson_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.