Files
optimclaw/src/lib.rs
T
Illia PolosukhinandClaude Opus 4.5 3718cfa767 Simplify workspace to path-based storage, remove legacy code
- Consolidate all migrations into V1__initial.sql
- Replace DocType enum with flexible path-based file storage
- Add list_workspace_files SQL function for directory listing
- Update memory tools for path-based API (memory_read, memory_write,
  memory_search, memory_list)
- Remove unused OpenAI/Anthropic providers (NEAR AI only)
- Simplify config to remove multi-provider support
- Update CLAUDE.md documentation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-02 21:38:53 -08:00

68 lines
4.7 KiB
Rust

//! NEAR AI Agentic Worker Framework
//!
//! An LLM-powered autonomous agent that operates on the NEAR AI marketplace.
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────────────────────┐
//! │ User Interaction Layer │
//! │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
//! │ │ CLI │ │ Slack │ │ Telegram │ │ HTTP │ │
//! │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
//! │ └─────────────┴────────────┬┴─────────────┘ │
//! └──────────────────────────────────┼──────────────────────────────────────────────┘
//! ▼
//! ┌──────────────────────────────────────────────────────────────────────────────────┐
//! │ Main Agent Loop │
//! │ ┌────────────────┐ ┌────────────────┐ ┌────────────────┐ │
//! │ │ Message Router │──│ LLM Reasoning │──│ Action Executor│ │
//! │ └────────────────┘ └───────┬────────┘ └───────┬────────┘ │
//! │ ▲ │ │ │
//! │ │ ┌──────────┴───────────────────┴──────────┐ │
//! │ │ ▼ ▼ │
//! │ ┌──────┴─────────────┐ ┌───────────────────────┐ │
//! │ │ Safety Layer │ │ Self-Repair │ │
//! │ │ - Input sanitizer │ │ - Stuck job detection │ │
//! │ │ - Injection defense│ │ - Tool fixer │ │
//! │ └────────────────────┘ └───────────────────────┘ │
//! └──────────────────────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Features
//!
//! - **Multi-channel interaction** - CLI, Slack, Telegram, HTTP webhooks
//! - **Parallel job execution** - Run multiple jobs with isolated contexts
//! - **Pluggable tools** - MCP, 3rd party services, dynamic tools
//! - **Self-repair** - Detect and fix stuck jobs and broken tools
//! - **Prompt injection defense** - Sanitize all external data
//! - **Continuous learning** - Improve estimates from historical data
pub mod agent;
pub mod channels;
pub mod config;
pub mod context;
pub mod error;
pub mod estimation;
pub mod evaluation;
pub mod history;
pub mod llm;
pub mod safety;
pub mod tools;
pub mod workspace;
pub use config::Config;
pub use error::{Error, Result};
/// Re-export commonly used types.
pub mod prelude {
pub use crate::channels::{Channel, IncomingMessage, MessageStream};
pub use crate::config::Config;
pub use crate::context::{JobContext, JobState};
pub use crate::error::{Error, Result};
pub use crate::llm::LlmProvider;
pub use crate::safety::{SanitizedOutput, Sanitizer};
pub use crate::tools::{Tool, ToolOutput, ToolRegistry};
pub use crate::workspace::{MemoryDocument, Workspace};
}