pub struct ToolRenderContext {Show 17 fields
pub expanded: bool,
pub args_complete: bool,
pub is_partial: bool,
pub is_error: bool,
pub tool_call_id: String,
pub execution_started: bool,
pub cwd: String,
pub duration_secs: Option<f64>,
pub exit_code: Option<i32>,
pub cancelled: bool,
pub was_truncated: bool,
pub full_output_path: Option<String>,
pub file_path: Option<String>,
pub expand_key: String,
pub details: Option<Value>,
pub state: Rc<RefCell<Value>>,
pub invalidate: Option<UnboundedSender<()>>,
}Expand description
Context passed to ToolRenderer methods (matching pi’s ToolRenderContext). Carries all metadata about the tool execution that renderers may need.
Fields§
§expanded: bool§args_complete: bool§is_partial: bool§is_error: bool§tool_call_id: StringUnique id for this tool execution (pi’s toolCallId).
execution_started: boolWhether the tool execution has started (pi’s executionStarted).
cwd: StringWorking directory for path resolution.
duration_secs: Option<f64>Duration in seconds (bash).
exit_code: Option<i32>Exit code (bash).
cancelled: boolWhether execution was cancelled (bash).
was_truncated: boolWhether output was truncated (bash/read).
full_output_path: Option<String>Path to full output file (bash).
file_path: Option<String>File path for syntax highlighting (read).
expand_key: StringKeybinding hint for the expand action, e.g. “C-O”.
details: Option<Value>Structured rendering details from the tool execution (pi-compatible). Set by tool renderers for preview/actual diff data. Not sent to the LLM.
state: Rc<RefCell<Value>>Shared mutable state per tool execution (pi’s context.state).
Initialized as an empty JSON object {}. Renderers can mutate it
across renderCall/renderResult invocations for the same tool call.
invalidate: Option<UnboundedSender<()>>Callback for renderers to request re-render (e.g. after async preview computation).
Pi-compatible: context.invalidate() in renderCall/renderResult.
Cloned from the original at context construction time.
Uses a channel sender internally to bridge from async to UI thread.
Trait Implementations§
Source§impl Clone for ToolRenderContext
impl Clone for ToolRenderContext
Source§fn clone(&self) -> ToolRenderContext
fn clone(&self) -> ToolRenderContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more