clawft_plugin/lib.rs
1//! Plugin trait definitions for clawft.
2//!
3//! This crate defines the unified plugin architecture for the clawft AI
4//! assistant framework. It provides trait definitions for tools, channels,
5//! pipeline stages, skills, memory backends, and voice handlers -- the
6//! six core extension points that all downstream feature work depends on.
7//!
8//! # Trait Overview
9//!
10//! | Trait | Purpose |
11//! |-------|---------|
12//! | [`Tool`] | Tool execution interface for agent capabilities |
13//! | [`ChannelAdapter`] | Channel message handling for external platforms |
14//! | [`PipelineStage`] | Processing stage in the agent pipeline |
15//! | [`Skill`] | High-level agent capability with tools and instructions |
16//! | [`MemoryBackend`] | Pluggable memory storage backend |
17//! | [`VoiceHandler`] | Voice/audio processing (placeholder for Workstream G) |
18//!
19//! # Supporting Traits
20//!
21//! | Trait | Purpose |
22//! |-------|---------|
23//! | [`KeyValueStore`] | Key-value storage exposed to plugins via `ToolContext` |
24//! | [`ToolContext`] | Execution context passed to tool/skill invocations |
25//! | [`ChannelAdapterHost`] | Host services for channel adapters |
26//!
27//! # Plugin Manifest
28//!
29//! Plugins declare their capabilities, permissions, and resource limits
30//! through a [`PluginManifest`], typically parsed from a JSON file
31//! (`clawft.plugin.json`).
32//!
33//! # Feature Flags
34//!
35//! - `voice` -- Enables the voice pipeline module (implies `voice-vad`).
36//! - `voice-vad` -- Voice Activity Detection (Silero VAD stub).
37//! - `voice-stt` -- Speech-to-Text (sherpa-rs stub).
38//! - `voice-tts` -- Text-to-Speech (sherpa-rs stub).
39//! - `voice-wake` -- Wake-word detection (reserved).
40//!
41//! ## Crate Ecosystem
42//!
43//! WeftOS is built from these crates:
44//!
45//! | Crate | Role |
46//! |-------|------|
47//! | [`weftos`](https://crates.io/crates/weftos) | Product facade -- re-exports kernel, core, types |
48//! | [`clawft-kernel`](https://crates.io/crates/clawft-kernel) | Kernel: processes, services, governance, mesh, ExoChain |
49//! | [`clawft-core`](https://crates.io/crates/clawft-core) | Agent framework: pipeline, context, tools, skills |
50//! | [`clawft-types`](https://crates.io/crates/clawft-types) | Shared type definitions |
51//! | [`clawft-platform`](https://crates.io/crates/clawft-platform) | Platform abstraction (native/WASM/browser) |
52//! | [`clawft-plugin`](https://crates.io/crates/clawft-plugin) | Plugin SDK for tools, channels, and extensions |
53//! | [`clawft-llm`](https://crates.io/crates/clawft-llm) | LLM provider abstraction (11 providers + local) |
54//! | [`exo-resource-tree`](https://crates.io/crates/exo-resource-tree) | Hierarchical resource namespace with Merkle integrity |
55//!
56//! Source: <https://github.com/weave-logic-ai/weftos>
57
58pub mod error;
59pub mod manifest;
60pub mod message;
61pub mod sandbox;
62pub mod traits;
63
64#[cfg(feature = "voice")]
65pub mod voice;
66
67// Re-export core types at crate root for convenience.
68pub use error::PluginError;
69pub use manifest::{
70 PermissionDiff, PluginCapability, PluginManifest, PluginPermissions, PluginResourceConfig,
71};
72pub use message::MessagePayload;
73pub use sandbox::{
74 SandboxAuditEntry, SandboxPolicy, SandboxType,
75 NetworkPolicy, FilesystemPolicy, ProcessPolicy, EnvPolicy,
76};
77pub use traits::{
78 CancellationToken, ChannelAdapter, ChannelAdapterHost, KeyValueStore, MemoryBackend,
79 PipelineStage, PipelineStageType, Skill, Tool, ToolContext, VoiceHandler,
80};