mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-01 17:19:24 +00:00
* refactor: split large files and consolidate test stubs for contributor velocity - Extract 7 Database sub-traits (ConversationStore, JobStore, SandboxStore, RoutineStore, ToolFailureStore, SettingsStore, WorkspaceStore) with Database as a supertrait combining them all - Split libsql_backend.rs (2769 lines) into src/db/libsql/ directory with one file per sub-trait implementation - Split config.rs (1753 lines) into src/config/ directory with 16 domain files - Consolidate 3 duplicate test LLM stubs into shared StubLlm in src/testing.rs - Split server.rs handlers into src/channels/web/handlers/ directory - Extract main.rs init phases into AppBuilder (src/app.rs) - Add developer setup script (scripts/dev-setup.sh) Co-Authored-By: Claude Opus 4.6 <[email protected]> * refactor: move heartbeat test from examples/ to tests/ Convert standalone example binary into a proper #[ignore] integration test, matching the convention of the other integration tests. Co-Authored-By: Claude Opus 4.6 <[email protected]> * style: fix rustfmt formatting for CI Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: address PR review comments from Copilot - tunnel.rs: replace .ok().flatten() with ? to propagate env var errors - secrets.rs: remove misleading "process-wide cache" comment - database.rs: use uppercase "DATABASE_URL" in error key - testing.rs: gate harness tests with #[cfg(feature = "libsql")] Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Illia Polosukhin <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use crate::config::helpers::{optional_env, parse_optional_env};
|
|
use crate::error::ConfigError;
|
|
|
|
/// Skills system configuration.
|
|
#[derive(Debug, Clone)]
|
|
pub struct SkillsConfig {
|
|
/// Whether the skills system is enabled.
|
|
pub enabled: bool,
|
|
/// Directory containing local skills (default: ~/.ironclaw/skills/).
|
|
pub local_dir: PathBuf,
|
|
/// Maximum number of skills that can be active simultaneously.
|
|
pub max_active_skills: usize,
|
|
/// Maximum total context tokens allocated to skill prompts.
|
|
pub max_context_tokens: usize,
|
|
}
|
|
|
|
impl Default for SkillsConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
enabled: false,
|
|
local_dir: default_skills_dir(),
|
|
max_active_skills: 3,
|
|
max_context_tokens: 4000,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Get the default skills directory (~/.ironclaw/skills/).
|
|
fn default_skills_dir() -> PathBuf {
|
|
dirs::home_dir()
|
|
.unwrap_or_else(|| PathBuf::from("."))
|
|
.join(".ironclaw")
|
|
.join("skills")
|
|
}
|
|
|
|
impl SkillsConfig {
|
|
pub(crate) fn resolve() -> Result<Self, ConfigError> {
|
|
Ok(Self {
|
|
enabled: optional_env("SKILLS_ENABLED")?
|
|
.map(|s| s.parse())
|
|
.transpose()
|
|
.map_err(|e| ConfigError::InvalidValue {
|
|
key: "SKILLS_ENABLED".to_string(),
|
|
message: format!("must be 'true' or 'false': {e}"),
|
|
})?
|
|
.unwrap_or(false),
|
|
local_dir: optional_env("SKILLS_DIR")?
|
|
.map(PathBuf::from)
|
|
.unwrap_or_else(default_skills_dir),
|
|
max_active_skills: parse_optional_env("SKILLS_MAX_ACTIVE", 3)?,
|
|
max_context_tokens: parse_optional_env("SKILLS_MAX_CONTEXT_TOKENS", 4000)?,
|
|
})
|
|
}
|
|
}
|