pub struct Output {
pub status: String,
pub output: String,
pub data: Option<Value>,
pub backup_path: Option<PathBuf>,
pub error: Option<String>,
pub duration_ms: u64,
pub telemetry_delta: Telemetry,
pub artifacts: Vec<PathBuf>,
}Expand description
Output from capability execution.
Returned by every Capability::execute call. Provides a standardized
envelope across all capabilities — status distinguishes ok/error,
output carries human-readable text, data holds structured JSON,
and error contains the failure message when status is "error".
§Invariants
statusis always"ok"or"error".- When
status == "error",errorisSome. - When
status == "ok",errorisNone. datais capability-specific structured output (may beNone).backup_pathis set when a file was backed up before mutation.artifactslists paths of files created or modified by the capability.
§Constructors
Use Output::ok for successful executions and Output::error for
failures. Do not construct Output directly — the constructors enforce
the invariants above.
Fields§
§status: StringExecution status: "ok" or "error".
output: StringHuman-readable result message.
data: Option<Value>Capability-specific structured data (JSON). None when the
capability produces no structured output.
backup_path: Option<PathBuf>Path to a backup file created before mutation. None when no
backup was created (e.g., read-only operations, new files).
error: Option<String>Error message when status == "error". None when status == "ok".
duration_ms: u64Wall-clock execution duration in milliseconds.
telemetry_delta: TelemetryTelemetry delta captured around the execution (before/after).
artifacts: Vec<PathBuf>Paths of files created or modified by this capability execution.
Implementations§
Source§impl Output
impl Output
Sourcepub fn ok(output: String) -> Self
pub fn ok(output: String) -> Self
Creates a successful output with the given human-readable message.
Sets status to "ok", error to None, and all other fields
to sensible defaults. Callers should populate data, backup_path,
and artifacts after construction as needed.
§Examples
use runtimo_core::capability::Output;
let out = Output::ok("Read 42 bytes".into());
assert_eq!(out.status, "ok");
assert!(out.error.is_none());Sourcepub fn error(output: String, error: String) -> Self
pub fn error(output: String, error: String) -> Self
Creates an error output with the given human-readable message and error detail.
Sets status to "error" and error to Some(error). The
output field carries a caller-facing summary; error carries
the machine-parseable failure reason.
§Examples
use runtimo_core::capability::Output;
let out = Output::error("failed".into(), "file not found".into());
assert_eq!(out.status, "error");
assert_eq!(out.error.as_deref(), Some("file not found"));