Skip to main content

Module common

Module common 

Source
Expand description

Shared machinery for harness adapters (CONTEXT.md §8).

A harness worker is an autonomous agent: it gets a chunky self-contained prompt and reads/edits the repo itself, so context is passed as a prompt plus pinned file paths, never inlined contents (CONTEXT.md §8 behavioral split, §12 context assembler).

Structs§

HarnessAdapter
A generic harness worker driven over the subprocess-json transport. Each concrete CLI supplies its program name, argv builder, output parser, and an optional line mapper for richer streaming.
ParsedHarness
What an adapter extracts from a harness CLI’s raw output. Parsers should be defensive: on any doubt, fall back to the raw stdout as the result text so a schema change in a beta CLI degrades gracefully (CONTEXT.md §21).
Provision
How a harness invocation is augmented to use a set of MCP servers — the provision path (MCP_SKILLS.md §6). A provisioner writes whatever config the CLI needs and returns the extra argv, the subprocess environment (carrying secret tokens, kept out of the file via ${VAR} expansion), and a file to clean up afterward.

Functions§

approvals_are_auto
Whether harness sessions should pass their non-interactive approval flags.
compose_prompt
Compose a harness prompt from the request: the instruction, any critique fed back on loop-back, ambient steering, and the pinned file paths the worker should read itself.
default_interactive_args
Default interactive argv: model flag (if any) + prompt as a positional arg. Used when an adapter has no custom interactive_args (opens product TUI).
parse_generic_json
Defensive parser for harnesses that emit a single JSON result object: probe common result fields, falling back to raw stdout on any surprise (CONTEXT.md §21). Suitable for not-yet-pinned beta CLIs.
parse_raw
The trivial parser: the captured stdout is the result (for CLIs that print plain text, e.g. Aider).

Type Aliases§

ArgsBuilder
Build the argv for a harness invocation given the composed prompt and an optional model selection.
McpProvisioner
Builds the MCP provisioning for a harness given the node’s servers and a scratch directory to write any config file into.
OutputParser
Parse a harness CLI’s captured output into normalized fields.