pub struct PythonTool { /* private fields */ }Expand description
A plugin’s Python tool.
Implementations§
Source§impl PythonTool
impl PythonTool
Sourcepub fn new(
name: String,
plugin: PluginRef,
decl: ManifestTool,
interpreter: Vec<OsString>,
) -> Option<Self>
pub fn new( name: String, plugin: PluginRef, decl: ManifestTool, interpreter: Vec<OsString>, ) -> Option<Self>
decl must be a script tool (ToolKind::Script); None otherwise.
Sourcepub fn with_sandbox(self, sandbox: Option<Sandbox>) -> Self
pub fn with_sandbox(self, sandbox: Option<Sandbox>) -> Self
Run the script in sandbox (see run_script_sandboxed); None: unsandboxed.
pub fn with_timeout(self, timeout: Duration) -> Self
pub fn plugin(&self) -> &PluginRef
Trait Implementations§
Source§impl Tool for PythonTool
impl Tool for PythonTool
fn spec(&self) -> ToolSpec
Source§fn title(&self, args: &Value) -> String
fn title(&self, args: &Value) -> String
Short human title for the finished call, e.g. “Wrote notes.md”.
args is untrusted.Source§fn access(&self, _args: &Value) -> Access
fn access(&self, _args: &Value) -> Access
What this call would do; drives the permission gate. Must not have side effects.
Source§fn run(&self, args: &Value, ctx: &ToolContext<'_>) -> ToolOutput
fn run(&self, args: &Value, ctx: &ToolContext<'_>) -> ToolOutput
Do it.
args is untrusted model output: validate everything, never panic.Source§fn pending_title(&self, _args: &Value) -> String
fn pending_title(&self, _args: &Value) -> String
Title for the call before and while it runs, and on approval cards, e.g.
“Write notes.md”. Defaults to “Run ”.
Auto Trait Implementations§
impl Forget for PythonTool
impl Freeze for PythonTool
impl RefUnwindSafe for PythonTool
impl Send for PythonTool
impl Sync for PythonTool
impl Unpin for PythonTool
impl UnsafeUnpin for PythonTool
impl UnwindSafe for PythonTool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more