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
impl ExtRuntime
Sourcepub fn new() -> Result<Self, Error>
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}Sourcepub fn session_parse(
&self,
component_bytes: &[u8],
agent: &str,
path: &str,
updated_ms: u64,
content: &str,
) -> Result<Option<String>, Error>
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§
impl !RefUnwindSafe for ExtRuntime
impl !UnwindSafe for ExtRuntime
impl Freeze for ExtRuntime
impl Send for ExtRuntime
impl Sync for ExtRuntime
impl Unpin for ExtRuntime
impl UnsafeUnpin for ExtRuntime
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
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,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
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 moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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