pub struct NodeTaskResponse {
pub protocol_version: u32,
pub output: Option<WireNodeOutput>,
pub error: Option<String>,
pub interrupt: Option<Value>,
}Expand description
The worker’s reply to a NodeTask.
Exactly one of output / error / interrupt must be set; anything else
is a malformed response. All fields are optional on the wire so a minimal
worker can answer with e.g. { "interrupt": <value> }.
Fields§
§protocol_version: u32Protocol version of the responder. Informational on the client side (v1 evolution is additive-only); workers should always set it.
output: Option<WireNodeOutput>Success payload: the node’s output.
error: Option<String>Failure payload: a human-readable worker-side error message.
interrupt: Option<Value>Suspend payload: the node called interrupt(value).
Implementations§
Source§impl NodeTaskResponse
impl NodeTaskResponse
Sourcepub fn ok(output: impl Into<WireNodeOutput>) -> Self
pub fn ok(output: impl Into<WireNodeOutput>) -> Self
A successful response carrying the node’s output.
Sourcepub fn error(message: impl Into<String>) -> Self
pub fn error(message: impl Into<String>) -> Self
A failure response. Surfaced client-side as RustyError::Node.
Sourcepub fn interrupt(value: Value) -> Self
pub fn interrupt(value: Value) -> Self
An interrupt (suspend) response. Surfaced client-side as
RustyError::Interrupt, so the executor’s HITL machinery works
unchanged for remote nodes.
Sourcepub fn into_result(self) -> Result<NodeOutput>
pub fn into_result(self) -> Result<NodeOutput>
Convert into a local node result.
Mapping:
output→Ok(NodeOutput)error→Err(RustyError::Node(message))interrupt→Err(RustyError::Interrupt { value })
Zero or multiple set payloads are a malformed-response node error.