11 Commits
Author SHA1 Message Date
Sayt-0 47321fa374 feat(codingharness): put Claude Code's questions and plan approvals to the user
The harness runs Claude Code in print mode, where AskUserQuestion and
the plan mode tools are disabled: Claude Code asked its questions in
plain text and ended the turn.

For each turn, the Claude Code driver now serves a permission_prompt
tool from an MCP server on loopback and hands it to the CLI as its
permission prompt tool. Claude Code then offers AskUserQuestion and plan
mode, and consults the tool before AskUserQuestion and ExitPlanMode
only. The driver turns them into elicitation forms and answers with the
user's choices, or with a denial when the form is declined or
dismissed.

The server requires a bearer token kept in a 0600 MCP config file, sets
a 24 hour tool timeout (Claude Code otherwise abandons an HTTP tool
call after 60 seconds), and ends open questions with the turn. Through
the new optional harness.Eliciter capability, the runtime passes an
elicitation handler only when someone can answer: serve mcp, A2A and
background agents keep plain text questions.

Signed-off-by: Sayt-0 <louis.dal-moro-compta@epita.fr>
2026-10-30 05:14:14 +00:00
Sayt-0 2dcfb4fb64 fix(harness): accept the claude CLI's verbose JSON output for titles
In print mode, the claude CLI's JSON output is the result message alone,
unless verbose mode is on in the user's config: it is then an array of
every message of the run, where system notices can follow the result.
Complete only decoded the single object, so for those users every title
request failed with "unexpected output" and sessions stayed untitled.

Complete now accepts both shapes and takes the run's last result
message. Tests cover a verbose array as Claude Code 2.1.310 prints it,
a notice after the result, and errors reported inside an array.

Signed-off-by: Sayt-0 <louis.dal-moro-compta@epita.fr>
2026-10-26 13:49:32 +00:00
Sayt-0 d3981ccf15 feat(harness): title Claude Code harness sessions through the CLI
A harness agent has no docker-agent model, so the TUI got no title
generator for it and its sessions stayed untitled.

The Claude Code driver now implements an optional harness.Completer: a
one-shot `claude` call in print mode on the haiku model, with no tools,
no MCP servers and no saved session, the prompt passed on stdin and the
JSON result parsed. sessiontitle.Generator accepts such completers after
its models, and LocalRuntime.TitleGenerator uses the driver's completer
for a harness agent. Other harness types still get no title.

Signed-off-by: Sayt-0 <louis.dal-moro-compta@epita.fr>
2026-10-26 13:46:08 +00:00
David Gageot 8621f7aa81 test: reuse the Codex CLI executable across cases 2026-10-16 11:34:49 +01:00
PremModhaOfficial 8eeb6f85fb codingharness: add the command-code harness type
Wire the Command Code CLI (`cmd`) in as a new coding-harness type,
alongside claude-code, codex, pi and opencode, so an agent can be run by
it:

    harness:
      type: command-code

The provider lives in github.com/rumpl/harness, so this bumps that
dependency. Until the commandcode package lands upstream
(https://github.com/rumpl/harness/pull/13) the bump is a temporary
replace, allow-listed in .golangci.yml with a TODO to drop it.

Signed-off-by: PremModhaOfficial <PremModhaOfficial@users.noreply.github.com>
2026-10-13 17:44:59 +05:30
David Gageot 277b161d5c fix(codingharness): use upstream streaming fixes 2026-10-08 08:43:04 +02:00
David Gageot ded1292bb5 feat(codingharness): harden codex exec --json runner
Wrap the codex provider's Run/Resume so the documented codex exec
--json interface is driven directly instead of relying on the
upstream library's own process handling:

- bound each JSON event to 16 MiB instead of bufio.Scanner's default
  64 KiB, rejecting oversized or malformed events without waiting for
  the CLI to finish writing them
- require turn.completed (or treat turn.failed / an unexpected EOF as
  an error) while tolerating transient reconnection error events
- drain stdout for a bounded window after the process exits, counting
  only pipe idle time (not slow consumer callback time) against the
  budget, and join the reader goroutine before returning
- on Unix, cancel the whole process group in one shot so descendants
  holding stdout open don't keep the drain alive
- cap and redact stderr diagnostics, discarding (rather than
  truncating) output that exceeds the limit so a partial secret can't
  leak

Covered by regression tests for large messages/tool outputs, malformed
and unknown events, EOF/failure/exit handling, cancellation with active
descendants and inherited pipes, slow callbacks, and redaction.
2026-10-07 23:52:46 +02:00
David Gageot 9ef47aed45 refactor(runtime): run harness agents through a registered driver
pkg/harness defines the Event/Provider contract; pkg/codingharness
implements it on top of rumpl/harness and exposes Factory. The runtime no
longer imports either, so embedders that never run harness agents drop the
harness CLI drivers. The CLI and loaderdefaults.Opts register the driver
with runtime.RegisterHarness(codingharness.Factory); an unregistered
harness agent fails with ErrHarnessNotRegistered.
2026-09-04 09:23:11 +02:00
Sayt-0 e555770a91 feat: add Claude Code harness setup and diagnostics 2026-07-17 16:37:38 +02:00
David Gageot 69231c755e test: add t.Parallel() to eligible tests
Assisted-By: Claude
2026-06-29 13:39:47 +02:00
Djordje Lukic 6420142281 feat: add external coding harness agents
Add support for harness-backed agents that delegate coding tasks to external
coding CLIs through github.com/rumpl/harness.

Harness agents can now be configured with a `harness` block in agent YAML and
used as sub-agents by an orchestrator. The runtime detects harness-backed
agents, builds a prompt from the current session, streams text/reasoning output
back into docker-agent, records final assistant responses, and forwards usage
when reported by the harness.

Supported harness types:
- claude-code
- codex
- pi
- opencode

Also update config validation and schema support so harness agents do not need
docker-agent model providers, add an example configuration, and handle external
harness tool call lifecycle events including partial tool calls and tool
results.:

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2026-05-20 00:59:07 +02:00