Skip to main content

ScriptHost

Trait ScriptHost 

Source
pub trait ScriptHost {
    // Required methods
    fn ready(&self) -> Result<bool, String>;
    fn run(&self, source: &str) -> Result<String, String>;
    fn result(&self, id: &str) -> Result<Option<Value>, String>;
    fn halt(&self, id: &str) -> Result<(), String>;
}
Expand description

Where Run sends a program when the app has a script runner: the app’s own server’s code mode (crate::mcp::EditorHost), the same realm, limits and generated brep.<group>.<tool> functions an agent’s run_script gets. Without one (the web build, a bare test harness) Run uses the plugin runner’s editor action.

Required Methods§

Source

fn ready(&self) -> Result<bool, String>

Whether the runner is up; the first call starts it.

Source

fn run(&self, source: &str) -> Result<String, String>

Submit a program; answers its execution id.

Source

fn result(&self, id: &str) -> Result<Option<Value>, String>

The execution’s result once it has ended, None while it runs.

Source

fn halt(&self, id: &str) -> Result<(), String>

Halt it: the worker is killed wherever it is.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§