pub struct JsExtensionSession {
pub resources: JsResources,
pub commands: Vec<String>,
/* private fields */
}Fields§
§resources: JsResources§commands: Vec<String>Implementations§
Source§impl JsExtensionSession
impl JsExtensionSession
pub fn load(paths: &[PathBuf], _verbose: bool) -> Result<Option<Self>, String>
pub fn load_with_context( paths: &[PathBuf], _verbose: bool, context: Value, ) -> Result<Option<Self>, String>
pub fn capabilities(&self) -> Vec<String>
pub fn tools(&self) -> impl Iterator<Item = JsToolAdapter> + '_
pub fn invoke_command(&self, command: &str, args: &str) -> Result<Value, String>
pub fn invoke_command_with_context( &self, command: &str, args: &str, context: Value, ) -> Result<Value, String>
pub fn set_runtime_context(&self, context: Value) -> Result<(), String>
pub fn set_runtime_handler(&self, handler: RuntimeHandler) -> Result<(), String>
pub fn add_runtime_handler(&self, handler: RuntimeHandler) -> Result<(), String>
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stop the persistent Node host even when detached command/tool work still holds a clone of this session. The transport wakes those callers, and repeated calls are harmless.
pub fn custom_active(&self) -> bool
Sourcepub fn active_tools(&self) -> Option<Vec<String>>
pub fn active_tools(&self) -> Option<Vec<String>>
Names of JS tools currently selected by the extension runtime. The returned list intentionally contains only the Node-side view; callers merge it with Rust built-ins before updating the harness lane.
pub fn tool_names(&self) -> Vec<String>
Sourcepub fn custom_accepts_input(&self) -> bool
pub fn custom_accepts_input(&self) -> bool
Whether the active custom component should receive terminal input. Hidden overlay handles keep their promise alive but release keyboard focus back to the outer TUI.
pub fn send_custom_input(&self, data: &str) -> Result<(), String>
Sourcepub fn send_custom_input_with_consumed(
&self,
data: &str,
) -> Result<bool, String>
pub fn send_custom_input_with_consumed( &self, data: &str, ) -> Result<bool, String>
Send raw input to the Node custom component and return whether a
ctx.ui.onTerminalInput listener consumed it. Hidden overlays still
need to see the event for their reopen shortcut, while unconsumed input
must fall through to the outer editor.
pub fn send_custom_resize( &self, width: usize, height: usize, ) -> Result<(), String>
pub fn install_ui_runtime(&self, tui: Arc<TuiAltScreen>) -> Result<(), String>
Sourcepub fn ensure_runtime(&self) -> Result<(), String>
pub fn ensure_runtime(&self) -> Result<(), String>
Start the lazy Node host after all interactive runtime handlers are
installed and the TUI input worker is running. Startup executes the
before_agent_start lifecycle hook, which may wait on a native dialog;
callers must therefore invoke this only once the dialog bridge can
service pending requests.
Sourcepub fn prepare_for_prompt(&self) -> Result<(), String>
pub fn prepare_for_prompt(&self) -> Result<(), String>
Prepare the Node runtime for one agent prompt. Starting a fresh lazy
host already runs before_agent_start during its context handoff;
prompts that reuse a live host send one context snapshot so the same
lifecycle runs exactly once again for that prompt.
Sourcepub fn install_ui_dialog_runtime(
&self,
handler: RuntimeHandler,
) -> Result<(), String>
pub fn install_ui_dialog_runtime( &self, handler: RuntimeHandler, ) -> Result<(), String>
Install the host side of the small dialog protocol used by
ctx.ui.select/confirm/input/editor in the Node runtime.
The handler is deliberately supplied by the interactive TUI: opening a
dialog needs to swap/focus a native component and then wait for a key
press, while this module only owns the Node transport. It receives both
ui.dialog and ui.dialog.cancel actions and must return one of the
JSON result shapes documented in node_host.mjs ({value},
{confirmed}, or {cancelled:true}).
pub fn enable_capability(&self, capability: &str) -> Result<(), String>
Sourcepub fn enable_provider_runtime(
&self,
provider: Arc<dyn Provider>,
runtime: Handle,
) -> Result<(), String>
pub fn enable_provider_runtime( &self, provider: Arc<dyn Provider>, runtime: Handle, ) -> Result<(), String>
Install the Rust provider as the Node Pi model registry’s runtime implementation. Node receives a complete AssistantMessage; Rust remains the only owner of HTTP, authentication, retries, and provider details.
Trait Implementations§
Source§impl Clone for JsExtensionSession
impl Clone for JsExtensionSession
Source§fn clone(&self) -> JsExtensionSession
fn clone(&self) -> JsExtensionSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more