Skip to main content

astrid_plugins/
lib.rs

1//! Plugin trait and registry for the Astrid secure agent runtime SDK.
2//!
3//! Provides the core abstractions for extending Astrid with plugins:
4//!
5//! - [`PluginId`]: Stable, human-readable plugin identifier
6//! - [`PluginManifest`]: Describes a plugin's identity, entry point, and capabilities
7//! - [`Plugin`]: Trait for plugin lifecycle (load/unload) and tool provision
8//! - [`PluginTool`]: Trait for tools provided by plugins (mirrors `BuiltinTool`)
9//! - [`PluginContext`] / [`PluginToolContext`]: Execution contexts with scoped KV storage
10//! - [`PluginRegistry`]: Registry for loaded plugins with cross-plugin tool lookup
11//! - [`discover_manifests`]: Filesystem discovery of `plugin.toml` manifests
12//!
13//! # Tool Naming Convention
14//!
15//! Plugin tools are exposed to the LLM as `plugin:{plugin_id}:{tool_name}`,
16//! which avoids collision with built-in tools (no colons) and MCP tools
17//! (`server:tool` — single colon).
18//!
19//! # Storage Isolation
20//!
21//! Each plugin gets a [`ScopedKvStore`](astrid_storage::ScopedKvStore) pre-bound
22//! to the namespace `plugin:{plugin_id}`. Plugins cannot access each other's data.
23
24#![deny(unsafe_code)]
25#![warn(missing_docs)]
26#![deny(clippy::all)]
27#![warn(unreachable_pub)]
28
29pub mod context;
30pub mod discovery;
31pub mod error;
32pub mod lockfile;
33pub mod manifest;
34pub mod mcp_plugin;
35#[cfg(feature = "http")]
36pub mod npm;
37pub mod plugin;
38pub mod registry;
39pub mod sandbox;
40pub mod security;
41pub mod tool;
42pub mod wasm;
43
44pub use context::{PluginContext, PluginToolContext};
45pub use discovery::{discover_manifests, load_manifest, load_manifests_from_dir};
46pub use error::{PluginError, PluginResult};
47pub use lockfile::{IntegrityViolation, LockedPlugin, PluginLockfile, PluginSource};
48pub use manifest::{PluginCapability, PluginEntryPoint, PluginManifest};
49pub use mcp_plugin::{McpPlugin, create_plugin};
50pub use plugin::{Plugin, PluginId, PluginState};
51pub use registry::{PluginRegistry, PluginToolDefinition};
52pub use sandbox::SandboxProfile;
53pub use security::PluginSecurityGate;
54pub use tool::PluginTool;
55pub use wasm::{WasmPlugin, WasmPluginLoader, WasmPluginTool};