codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
use crate::tool::{ToolResult, tool_output_budget};

use super::task::TetherScriptRunResult;

pub fn from_run(result: TetherScriptRunResult) -> ToolResult {
    match result {
        TetherScriptRunResult::Finished(Ok(outcome)) => ToolResult {
            output: outcome.output,
            success: outcome.success,
            metadata: [("value".to_string(), outcome.value)].into(),
        }
        .truncate_to(tool_output_budget()),
        TetherScriptRunResult::Finished(Err(error)) => {
            ToolResult::error(format!("TetherScript plugin failed: {error}"))
                .truncate_to(tool_output_budget())
        }
        TetherScriptRunResult::Timeout(secs) => ToolResult::error(format!(
            "TetherScript plugin timed out after {secs} second(s)"
        )),
    }
}