Skip to main content

ExtRuntime

Struct ExtRuntime 

Source
pub struct ExtRuntime { /* private fields */ }
Expand description

Bounded in-process host for WebAssembly Components.

WASI P2 is linked for ABI compatibility, but the default context inherits no arguments, environment, stdio, directories, or network access. TCP/UDP are disabled outright. AgentSight-specific authority must be linked by an explicit capability-bearing host interface.

Component compilation is only exposed for trusted components shipped with AgentSight. This type is not an upload boundary for arbitrary user-supplied Wasm. Execution and input sizes are bounded independently.

Implementations§

Source§

impl ExtRuntime

Source

pub fn new() -> Result<Self, Error>

Examples found in repository?
examples/session_smoke.rs (line 15)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let component = std::env::args()
9        .nth(1)
10        .ok_or("usage: session_smoke <component.wasm>")?;
11    let bytes = fs::read(component)?;
12    let content = r#"{"timestamp":"2026-08-14T00:00:00Z","type":"session_meta","payload":{"id":"smoke","cwd":"/tmp/project"}}
13{"timestamp":"2026-08-14T00:00:01Z","type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"inspect this repository"}]}}
14"#;
15    let parsed = ExtRuntime::new()?.session_parse(
16        &bytes,
17        "codex",
18        "/tmp/.codex/sessions/2026/08/14/smoke.jsonl",
19        1_786_665_600_000,
20        content,
21    )?;
22    let parsed = parsed.ok_or("session component returned no session")?;
23    if !parsed.contains("smoke") || !parsed.contains("inspect this repository") {
24        return Err("session component returned unexpected output".into());
25    }
26
27    let windows_content = r#"{"timestamp":"2026-08-14T00:00:00Z","type":"user","message":{"role":"user","content":"inspect the Windows checkout"}}
28"#;
29    let windows = ExtRuntime::new()?
30        .session_parse(
31            &bytes,
32            "claude",
33            r"C:\Users\agent\.claude\projects\repo\windows-session.jsonl",
34            1_786_665_600_000,
35            windows_content,
36        )?
37        .ok_or("session component returned no Windows session")?;
38    if !windows.contains(r#""session_id":"windows-session""#) {
39        return Err("session component did not normalize the Windows path".into());
40    }
41    println!("{parsed}");
42    Ok(())
43}
Source

pub fn session_parse( &self, component_bytes: &[u8], agent: &str, path: &str, updated_ms: u64, content: &str, ) -> Result<Option<String>, Error>

Examples found in repository?
examples/session_smoke.rs (lines 15-21)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let component = std::env::args()
9        .nth(1)
10        .ok_or("usage: session_smoke <component.wasm>")?;
11    let bytes = fs::read(component)?;
12    let content = r#"{"timestamp":"2026-08-14T00:00:00Z","type":"session_meta","payload":{"id":"smoke","cwd":"/tmp/project"}}
13{"timestamp":"2026-08-14T00:00:01Z","type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"inspect this repository"}]}}
14"#;
15    let parsed = ExtRuntime::new()?.session_parse(
16        &bytes,
17        "codex",
18        "/tmp/.codex/sessions/2026/08/14/smoke.jsonl",
19        1_786_665_600_000,
20        content,
21    )?;
22    let parsed = parsed.ok_or("session component returned no session")?;
23    if !parsed.contains("smoke") || !parsed.contains("inspect this repository") {
24        return Err("session component returned unexpected output".into());
25    }
26
27    let windows_content = r#"{"timestamp":"2026-08-14T00:00:00Z","type":"user","message":{"role":"user","content":"inspect the Windows checkout"}}
28"#;
29    let windows = ExtRuntime::new()?
30        .session_parse(
31            &bytes,
32            "claude",
33            r"C:\Users\agent\.claude\projects\repo\windows-session.jsonl",
34            1_786_665_600_000,
35            windows_content,
36        )?
37        .ok_or("session component returned no Windows session")?;
38    if !windows.contains(r#""session_id":"windows-session""#) {
39        return Err("session component did not normalize the Windows path".into());
40    }
41    println!("{parsed}");
42    Ok(())
43}

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetSetFdFlags for T

Source§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
Source§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: Sized + AsFilelike,

Set the “status” flags for the self file descriptor. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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