Skip to main content

sim_lib_skill/
lib.rs

1//! Agent skills for the SIM runtime.
2//!
3//! A *skill* is a callable capability that an agent can invoke -- a tool, a
4//! model, a resource, a prompt, a memory, a retriever, a judge, or a router.
5//! Each skill is described by a [`SkillCard`] that pairs a stable identity and
6//! symbol with input and output [`sim_shape`] contracts, a [`SkillPolicy`]
7//! governing caching/recording/privacy, and the transport that actually runs
8//! the call. Cards are bound into a [`SkillRegistry`] and exposed as ordinary
9//! callable runtime objects through [`SkillCallable`].
10//!
11//! Behavior is provided by a [`SkillTransport`]: a backend (fixture, HTTP, MCP,
12//! process, OpenAI-compatible server, ...) that knows how to discover and call
13//! skills. [`SkillLib`] registers the `skill/*` operations (install, bind,
14//! list, card, call, and the feature-gated audit/tool/runner/serve surfaces)
15//! when the library is loaded into a [`sim_kernel::Cx`].
16//!
17//! Optional Cargo features select transports and integrations: `mcp`, `http`,
18//! `openai`, `process`, `agent`, `runner`, `serve`, and the `cache`/`cassette`
19//! recording surfaces.
20
21#![forbid(unsafe_code)]
22#![deny(missing_docs)]
23
24#[cfg(feature = "agent")]
25mod agent;
26mod browse;
27mod callable;
28mod card;
29mod citizen;
30mod expr;
31mod fixture;
32#[cfg(feature = "http")]
33pub mod http;
34mod install;
35mod manifest;
36#[cfg(feature = "mcp")]
37pub mod mcp;
38#[cfg(feature = "openai")]
39mod openai;
40mod ops;
41#[cfg(feature = "process")]
42pub mod process;
43#[cfg(any(feature = "cache", feature = "cassette"))]
44mod record;
45mod registry;
46#[cfg(feature = "runner")]
47mod runner;
48#[cfg(feature = "serve")]
49mod serve;
50mod transport;
51
52#[cfg(test)]
53mod tests;
54
55#[cfg(feature = "agent")]
56pub use agent::skill_as_tool_symbol;
57pub use callable::SkillCallable;
58pub use card::{
59    FixtureSkillSpec, SkillCacheMode, SkillCard, SkillCassetteMode, SkillPolicy,
60    SkillPrivacyPolicy, SkillRole,
61};
62pub use citizen::{SkillCardDescriptor, skill_card_descriptor_class_symbol};
63pub use fixture::{FixtureBehavior, FixtureTransport};
64pub use install::{install_fixture_skill, install_skill_lib};
65pub use manifest::{SkillLib, manifest_name, skill_exports};
66#[cfg(feature = "mcp")]
67pub use mcp::{
68    FixtureMcpTransport, McpCallParams, McpPromptArgument, McpPromptDescriptor, McpPromptGetParams,
69    McpResourceDescriptor, McpResourceReadParams, McpToolDescriptor, McpToolResult,
70    mcp_call_params_class_symbol, mcp_prompt_argument_class_symbol,
71    mcp_prompt_descriptor_class_symbol, mcp_prompt_get_params_class_symbol,
72    mcp_resource_descriptor_class_symbol, mcp_resource_read_params_class_symbol,
73    mcp_tool_descriptor_class_symbol, mcp_tool_result_class_symbol, skill_mcp_call_symbol,
74    skill_mcp_tools_symbol,
75};
76#[cfg(feature = "openai")]
77pub use openai::{
78    insert_skill_openai_tools, skill_openai_tool_descriptor, skill_openai_tool_symbol,
79    skill_openai_tools_symbol,
80};
81pub use ops::{
82    SkillFunction, skill_bind_symbol, skill_call_capability, skill_call_symbol, skill_card_symbol,
83    skill_install_capability, skill_install_symbol, skill_list_symbol, skill_serve_capability,
84    skill_specific_call_capability,
85};
86#[cfg(any(feature = "cache", feature = "cassette"))]
87pub use ops::{skill_audit_capability, skill_audit_symbol};
88#[cfg(feature = "process")]
89pub use process::{
90    ProcessSkillProtocol, ProcessSkillSpec, ProcessSkillTransport, skill_process_capability,
91};
92pub use registry::{SkillRegistry, skill_registry, skill_registry_symbol};
93#[cfg(feature = "runner")]
94pub use runner::{SkillModelRunner, skill_as_runner_symbol, skill_model_runner};
95#[cfg(feature = "serve")]
96pub use serve::skill_serve_mcp_symbol;
97pub use transport::{SkillEventSink, SkillTransport, SkillTransportValue, skill_transport_value};
98
99/// Stable identifier for the skill library and its symbol namespace.
100pub const SKILL_LIB_ID: &str = "skill";