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#![doc(
26 html_logo_url = "https://raw.githubusercontent.com/Neuron-Mr-White/Oino/main/docs/assets/brand/png/oino-256.png",
27 html_favicon_url = "https://raw.githubusercontent.com/Neuron-Mr-White/Oino/main/docs/assets/brand/oino.ico"
28)]
29#![forbid(unsafe_code)]
30#![cfg_attr(
31 test,
32 allow(
33 clippy::unwrap_used,
34 clippy::expect_used,
35 clippy::panic,
36 reason = "tests assert by unwrapping"
37 )
38)]
39
40pub mod guest;
41pub mod host_service;
42pub mod json;
43pub mod manifest;
44pub mod ops;
45pub mod registry;
46pub mod runtime;
47#[cfg(feature = "testing")]
48pub mod testing;
49pub mod types;
50
51pub use guest::{CompletionItem, InitInput, ToolInvocation};
52pub use host_service::HostService;
53pub use json::RawJson;
54pub use manifest::{ExtensionKind, Manifest};
55pub use registry::{EventKind, Registration};
56pub use runtime::{
57 AgentHandle, BoxFut, ComponentSource, DetachedBash, ExtensionInstance, ExtensionRuntime,
58 HostServices, LoadedPackage, ProviderEventStream, ProviderInstance,
59};
60pub use tokio_util::sync::CancellationToken;
61pub use types::{CallContext, CallKind, ExtensionError, ExtensionId, HostError, LogLevel, Mode};