Skip to main content

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
41pub mod error;
42pub mod manifest;
43pub mod message;
44pub mod sandbox;
45pub mod traits;
46
47#[cfg(feature = "voice")]
48pub mod voice;
49
50// Re-export core types at crate root for convenience.
51pub use error::PluginError;
52pub use manifest::{
53    PermissionDiff, PluginCapability, PluginManifest, PluginPermissions, PluginResourceConfig,
54};
55pub use message::MessagePayload;
56pub use sandbox::{
57    SandboxAuditEntry, SandboxPolicy, SandboxType,
58    NetworkPolicy, FilesystemPolicy, ProcessPolicy, EnvPolicy,
59};
60pub use traits::{
61    CancellationToken, ChannelAdapter, ChannelAdapterHost, KeyValueStore, MemoryBackend,
62    PipelineStage, PipelineStageType, Skill, Tool, ToolContext, VoiceHandler,
63};