Skip to main content

Module coder

Module coder 

Source
Expand description

The Coder orchestrator — prompt -> infer -> normalize -> apply.

One method, Coder::run, wires the four pieces together:

  1. build_prompt scans the workspace for relevant files and composes a (system, user) pair around the S5 whole-file directive.
  2. The injected InferenceBackend runs one complete turn.
  3. normalize_emission classifies the raw reply as WholeFiles / UnifiedDiff / Prose.
  4. The classified emission is applied to the workspace: apply_whole_files for the directive’s happy path, apply_patch for the diff fallback, no-op + warn for prose.

The caller (newt-acp-worker) then runs git diff to capture the real workspace diff — the foreman’s empty-diff signal is computed from git diff, not from anything in this struct.

Structs§

Coder
The coder. Holds the inference backend the orchestrator uses for each run call; the backend is Arc<dyn …> so callers can share one backend across coder + non-coder paths.
CoderRun
Outcome of one Coder::run turn. Surfaced via the ACP worker’s TaskReply.emission_shape so the foreman’s scorecard can distinguish T0a / T0b / T0c instead of lumping them as “empty diff”.