oino-extension — guest SDK
Write Oino extensions in Rust, compiled to WASM components (wasm32-wasip2) for the WIT
package oino:extension@2.0.0 (the WIT tree is bundled in this crate under
wit/oino-extension). Component-model async: tool calls,
commands and event handlers of one extension run concurrently.
Crate setup
[]
= "my-extension"
= "2024"
[]
= ["cdylib"]
[]
= "1.0" # add features = ["provider"] for providers
= { = "1", = ["derive"] }
= "1.2"
Next to Cargo.toml, an extension.json manifest (extension-api §7):
Every permission defaults to denied (except ui); a missing grant makes the import fail
with permission denied: <permission>.
Example
use Duration;
use Command;
use *;
;
export_extension!;
Modules
| Module | Capability |
|---|---|
session |
entries, branch, tree, append_entry, send_message, send_user_message, sessions index |
control |
model/thinking, tools, commands, compact, execute_tool, command-context ops (new_session, fork, …) |
models |
complete, stream, summarize_default, credential_for, classify, generate_image |
ui |
dialog (select/confirm/input helpers), notify, status/clear_status (plain text or a v2 Line), widget (v2 node) / widget_lines (plain text), Panel builder (open/update/patch/close), register_turn_footer, register_settings, editor, OS notify, clipboard, open URL, external editor; node trees come from ui::widgets (the oino-ui builder, ui-protocol §11) |
agents |
nested agent sessions: Agent::spawn(spec), prompt, steer, wait_idle, events() |
process |
exec, Child::spawn with streaming stdio, signals, process trees/stats |
tasks |
host background tasks (start, list, logs, kill) with oino_task events |
http |
get/post/request(..).send() with streaming bodies, provider auth, loopback Listener |
fs |
preopens (/ext-global, fs::ext_workspace(), fs::ext_session(sid), /tmp, /cache, /logs, /project), atomic_write, JSON helpers, Lock, Watcher; plain std::fs works on preopen paths |
timers |
set/cancel (oino_timer events), sleep, now_ms |
kv |
scoped key-value (Scope::Global/Workspace/Session), JSON helpers |
secrets, bus, services |
secrets, pub/sub (oino_bus events), inter-extension service calls |
host |
platform/version/mode, workspace id, env (granted vars), logging |
provider (feature) |
Provider trait, ProviderStream::spawn, before_request/after_response/stream_event hooks |
sync |
Mutex for state held across .await, SessionMap<T> |
wit |
raw generated WIT types (escape hatch) |
Build and test
Integration tests load components with oino_wasm_host::testing::Harness against
oino_extension_api::testing::RecordingHostServices (see crates/oino-wasm-host/tests/);
the fixtures in extensions/fixtures/ are worked examples (echo: every contribution and
import; async-probe: concurrency, cancellation, services, tasks; ui-probe: UI;
provider-faux: a provider).