1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Versioned WIT ABI and guest SDK for Rill runtime handlers.
//!
//! This crate ships the canonical WIT world definition
//! ([`wit/rill-handler.wit`](https://github.com/hello-yunshu/rill-ml/tree/main/crates/rill-handler-api/wit/rill-handler.wit))
//! that every Rill handler must export.
//!
//! Handler authors compile a Rust crate to `wasm32-wasip1` using
//! [`wit-bindgen`](https://crates.io/crates/wit-bindgen) to generate guest
//! bindings from the WIT file, then wrap the core module into a Component
//! Model component with `wasm-tools component new`.
//!
//! This crate intentionally has **no dependencies** so that it can be consumed
//! as a build-time WIT source without pulling in any runtime code. The
//! constants below mirror the WIT declarations and are used by both the host
//! and guest for compile-time version checks.
/// Handler ABI version. Independent from the host IPC API version and the model
/// pack format version. Increment only on a breaking WIT change.
pub const HANDLER_API_VERSION: u32 = 1;
/// WIT package name as declared in `rill-handler.wit`.
pub const WIT_PACKAGE: &str = "rill:handler";
/// WIT package version as declared in `rill-handler.wit`.
pub const WIT_VERSION: &str = "1.0.0";
/// WIT world name as declared in `rill-handler.wit`.
pub const WIT_WORLD: &str = "invoke-handler";
/// Maximum number of capabilities a handler may declare.
pub const MAX_CAPABILITIES: usize = 32;
/// Maximum length of a capability string.
pub const MAX_CAPABILITY_LEN: usize = 96;
/// Maximum length of a handler id.
pub const MAX_HANDLER_ID_LEN: usize = 96;
/// Maximum length of a handler version string.
pub const MAX_HANDLER_VERSION_LEN: usize = 48;