Skip to main content

JsExtensionSession

Struct JsExtensionSession 

Source
pub struct JsExtensionSession {
    pub resources: JsResources,
    pub commands: Vec<String>,
    /* private fields */
}

Fields§

§resources: JsResources§commands: Vec<String>

Implementations§

Source§

impl JsExtensionSession

Source

pub fn load(paths: &[PathBuf], _verbose: bool) -> Result<Option<Self>, String>

Source

pub fn load_with_context( paths: &[PathBuf], _verbose: bool, context: Value, ) -> Result<Option<Self>, String>

Source

pub fn capabilities(&self) -> Vec<String>

Source

pub fn tools(&self) -> impl Iterator<Item = JsToolAdapter> + '_

Source

pub fn invoke_command(&self, command: &str, args: &str) -> Result<Value, String>

Source

pub fn invoke_command_with_context( &self, command: &str, args: &str, context: Value, ) -> Result<Value, String>

Source

pub fn set_runtime_context(&self, context: Value) -> Result<(), String>

Source

pub fn set_runtime_handler(&self, handler: RuntimeHandler) -> Result<(), String>

Source

pub fn add_runtime_handler(&self, handler: RuntimeHandler) -> Result<(), String>

Source

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.

Source

pub fn custom_active(&self) -> bool

Source

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.

Source

pub fn tool_names(&self) -> Vec<String>

Source

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.

Source

pub fn send_custom_input(&self, data: &str) -> Result<(), String>

Source

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.

Source

pub fn send_custom_resize( &self, width: usize, height: usize, ) -> Result<(), String>

Source

pub fn install_ui_runtime(&self, tui: Arc<TuiAltScreen>) -> Result<(), String>

Source

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.

Source

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.

Source

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}).

Source

pub fn enable_capability(&self, capability: &str) -> Result<(), String>

Source

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

Source§

fn clone(&self) -> JsExtensionSession

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ExtensionBackend for JsExtensionSession

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more