Skip to main content

act_sdk/
lib.rs

1pub mod bytes;
2pub mod cbor;
3pub mod context;
4pub mod response;
5pub mod sessions;
6pub mod types;
7
8pub use act_sdk_macros::{act_component, act_tool, session_close, session_open};
9pub use bytes::Bytes;
10pub use context::ActContext;
11pub use response::{Content, IntoToolResponse, Json};
12pub use sessions::SessionRegistry;
13pub use types::{ActError, ActResult};
14
15pub mod prelude {
16    pub use crate::{ActContext, ActError, ActResult, Bytes, Content, IntoToolResponse, Json};
17    pub use crate::{SessionRegistry, sessions::session_id_from_metadata};
18    pub use crate::{act_component, act_tool, session_close, session_open};
19    pub use schemars::JsonSchema;
20    pub use serde::Deserialize;
21}
22
23// Re-export act-types constants for use by generated code and consumers
24pub use act_types::constants;
25
26/// Spawn a concurrent task on the component's async runtime.
27///
28/// Re-exported from `wit-bindgen` so components do not need their own
29/// `wit-bindgen` dependency. Use it when a tool has to produce data
30/// concurrently with the call it is serving (e.g. filling a request-body
31/// stream while awaiting the response).
32pub use wit_bindgen::spawn_local;
33
34// Re-export dependencies that generated code needs
35#[doc(hidden)]
36pub mod __private {
37    pub use act_types::cbor as ciborium_compat;
38    pub use schemars;
39    pub use serde;
40    pub use serde_json;
41    pub use wit_bindgen;
42}