oino_extension_api/lib.rs
1//! `oino-extension-api`: the contract between `oino-core` and any extension runtime
2//! (extension-api.md ยง6). It knows nothing about wasmtime.
3//!
4//! # Boundary
5//!
6//! Core implements [`HostServices`] (what extensions may do to sessions, UI, models, agents);
7//! a runtime (the WASM host) implements [`ExtensionRuntime`] / [`ExtensionInstance`] (what core
8//! may ask an extension). Data-model values cross as [`RawJson`] with exact shapes (D5);
9//! capability calls use the typed records of the WIT package `oino:extension@2.0.0`.
10//!
11//! # API map
12//!
13//! | Module | WIT | Contents |
14//! |---|---|---|
15//! | [`json`] | `types.json` | [`RawJson`] |
16//! | [`types`] | `types` | [`ExtensionId`], [`CallContext`], [`Mode`], [`CallKind`], [`HostError`], [`ExtensionError`] |
17//! | [`registry`] | `registry` | [`EventKind`] (wire names), tool/command/shortcut/flag/renderer specs, [`Registration`] |
18//! | [`guest`] | `guest` | [`InitInput`], [`ToolInvocation`], [`CompletionItem`] |
19//! | [`ops`] | `session`, `control`, `models`, `ui`, `tasks`, `secrets`, `provider-host` | one enum variant per WIT function |
20//! | [`runtime`] | โ | [`ExtensionRuntime`], [`ExtensionInstance`], [`ProviderInstance`], [`HostServices`], [`AgentHandle`] |
21//! | [`manifest`] | โ | `extension.json`, [`manifest::Permissions`], package validation |
22//! | [`host_service`] | `host-service` | [`host_service::HostService`] (capabilities an embedding host registers) |
23//! | `testing` (feature) | โ | `RecordingHostServices`, `FakeExtensionRuntime` |
24
25#![forbid(unsafe_code)]
26#![cfg_attr(
27 test,
28 allow(
29 clippy::unwrap_used,
30 clippy::expect_used,
31 clippy::panic,
32 reason = "tests assert by unwrapping"
33 )
34)]
35
36pub mod guest;
37pub mod host_service;
38pub mod json;
39pub mod manifest;
40pub mod ops;
41pub mod registry;
42pub mod runtime;
43#[cfg(feature = "testing")]
44pub mod testing;
45pub mod types;
46
47pub use guest::{CompletionItem, InitInput, ToolInvocation};
48pub use host_service::HostService;
49pub use json::RawJson;
50pub use manifest::{ExtensionKind, Manifest};
51pub use registry::{EventKind, Registration};
52pub use runtime::{
53 AgentHandle, BoxFut, ComponentSource, DetachedBash, ExtensionInstance, ExtensionRuntime,
54 HostServices, LoadedPackage, ProviderEventStream, ProviderInstance,
55};
56pub use tokio_util::sync::CancellationToken;
57pub use types::{CallContext, CallKind, ExtensionError, ExtensionId, HostError, LogLevel, Mode};