pub struct TaskReply {
pub model_id: String,
pub content: String,
pub diff: String,
pub empty_diff: bool,
pub diff_applied: bool,
pub emission_shape: Option<String>,
pub raw_emission: Option<String>,
}Expand description
Structured reply for one prompt turn.
§Contract
Per workspace memory feedback_drake_patch_not_prose and
feedback_empty_diff_is_a_crash:
model_idis mandatory. It is a non-OptionStringso the field cannot be silently omitted from the wire format. UseTaskReply::newfor the validated constructor that rejects an emptymodel_id— foreman uses this field to attribute the patch and update the model’s scorecard, so a missing id is non-recoverable.empty_diff: truemeans the worker produced no real edits and foreman should disqualify it pre-arbiter.diff_applied: truemeans a unified diff was found incontentandnewt_tools::apply_patchaccepted it.
Fields§
§model_id: StringMANDATORY — the model that produced this reply.
content: StringAssistant content (typically the unified diff).
diff: StringCaptured workspace diff after the turn.
empty_diff: boolTrue if the captured diff is empty (no real changes).
diff_applied: boolTrue if a unified diff was detected in content and applied
successfully.
emission_shape: Option<String>Set by the newt-coder plugin: “whole_files”, “unified_diff”,
or “prose” (the wire-stable constants in
plugins_protocol::emission_shape). None when the legacy
newt-flat path produced the reply.
Lets the foreman’s scorecard distinguish failure modes T0a / T0b / T0c instead of lumping them together as “empty diff”.
raw_emission: Option<String>The model’s first raw emission — newt-coder’s
CoderRun.first_emission, or the flat path’s reply content.
The eval diff_applies evaluator runs git apply --check against
this (when it is diff-shaped) rather than the post-hoc captured
diff, so a model that emits an unappliable diff the fuzzy worker
only rescued is scored honestly (#30B). None for legacy payloads.
Implementations§
Source§impl TaskReply
impl TaskReply
Sourcepub fn new(
model_id: impl Into<String>,
content: impl Into<String>,
diff: impl Into<String>,
diff_applied: bool,
) -> Result<Self>
pub fn new( model_id: impl Into<String>, content: impl Into<String>, diff: impl Into<String>, diff_applied: bool, ) -> Result<Self>
Validated constructor. Rejects an empty model_id so a buggy
backend can’t silently produce an unattributable reply.
Sourcepub fn with_emission_shape(self, shape: impl Into<String>) -> Self
pub fn with_emission_shape(self, shape: impl Into<String>) -> Self
Builder: attach the emission shape label the newt-coder plugin
produced. The legacy newt-flat path leaves this None.
Sourcepub fn with_raw_emission(self, raw: impl Into<String>) -> Self
pub fn with_raw_emission(self, raw: impl Into<String>) -> Self
Builder: attach the model’s first raw emission so the eval
diff_applies evaluator can judge it with the strict oracle (#30B).