mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-09-02 01:29:23 +00:00
refactor: remove glob re-exports, fix clippy warnings, clean up duplicates
- Remove `pub use ironclaw_safety::*` from src/safety/mod.rs and migrate all 20+ call sites to import directly from `ironclaw_safety` - Remove `pub use ironclaw_skills::*` from src/skills/mod.rs and migrate all 15+ call sites to import directly from `ironclaw_skills` - Fix 4 clippy warnings: 2 shadow imports, 2 collapsible if-let chains - Add missing SkillActivated arm to WASM channel StatusUpdate match - Remove duplicate AuthRequired/AuthCompleted arms in repl.rs - Update CLAUDE.md extracted crates guidance and prompt template rule - Fix bench imports (safety_check, safety_pipeline) 46 files changed, zero warnings, 3836 tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -8,9 +8,9 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::context::JobContext;
|
||||
use crate::skills::catalog::SkillCatalog;
|
||||
use crate::skills::registry::SkillRegistry;
|
||||
use crate::tools::tool::{ApprovalRequirement, Tool, ToolError, ToolOutput, require_str};
|
||||
use ironclaw_skills::catalog::SkillCatalog;
|
||||
use ironclaw_skills::registry::SkillRegistry;
|
||||
|
||||
// ── skill_list ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -311,7 +311,7 @@ impl Tool for SkillInstallTool {
|
||||
} else {
|
||||
// Look up in catalog and fetch
|
||||
let download_url =
|
||||
crate::skills::catalog::skill_download_url(self.catalog.registry_url(), name);
|
||||
ironclaw_skills::catalog::skill_download_url(self.catalog.registry_url(), name);
|
||||
fetch_skill_content(&download_url).await?
|
||||
};
|
||||
|
||||
@@ -323,8 +323,8 @@ impl Tool for SkillInstallTool {
|
||||
.map_err(|e| ToolError::ExecutionFailed(format!("Lock poisoned: {}", e)))?;
|
||||
|
||||
// Parse to extract the name (cheap, in-memory)
|
||||
let normalized = crate::skills::normalize_line_endings(&content);
|
||||
let parsed = crate::skills::parser::parse_skill_md(&normalized)
|
||||
let normalized = ironclaw_skills::normalize_line_endings(&content);
|
||||
let parsed = ironclaw_skills::parser::parse_skill_md(&normalized)
|
||||
.map_err(|e| ToolError::ExecutionFailed(e.to_string()))?;
|
||||
let skill_name = parsed.manifest.name.clone();
|
||||
|
||||
@@ -340,10 +340,10 @@ impl Tool for SkillInstallTool {
|
||||
|
||||
// Perform async I/O (write to disk, validate round-trip) with no lock held.
|
||||
let (skill_name, loaded_skill) =
|
||||
crate::skills::registry::SkillRegistry::prepare_install_to_disk(
|
||||
ironclaw_skills::registry::SkillRegistry::prepare_install_to_disk(
|
||||
&user_dir,
|
||||
&skill_name_from_parse,
|
||||
&crate::skills::normalize_line_endings(&content),
|
||||
&ironclaw_skills::normalize_line_endings(&content),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| ToolError::ExecutionFailed(e.to_string()))?;
|
||||
@@ -587,11 +587,11 @@ pub async fn fetch_skill_content(url: &str) -> Result<String, ToolError> {
|
||||
};
|
||||
|
||||
// Basic size check
|
||||
if content.len() as u64 > crate::skills::MAX_PROMPT_FILE_SIZE {
|
||||
if content.len() as u64 > ironclaw_skills::MAX_PROMPT_FILE_SIZE {
|
||||
return Err(ToolError::ExecutionFailed(format!(
|
||||
"Skill content too large: {} bytes (max {} bytes)",
|
||||
content.len(),
|
||||
crate::skills::MAX_PROMPT_FILE_SIZE
|
||||
ironclaw_skills::MAX_PROMPT_FILE_SIZE
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ impl Tool for SkillRemoveTool {
|
||||
};
|
||||
|
||||
// Delete files from disk (async I/O, no lock held).
|
||||
crate::skills::registry::SkillRegistry::delete_skill_files(&skill_path)
|
||||
ironclaw_skills::registry::SkillRegistry::delete_skill_files(&skill_path)
|
||||
.await
|
||||
.map_err(|e| ToolError::ExecutionFailed(e.to_string()))?;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
use crate::context::JobContext;
|
||||
use crate::error::Error;
|
||||
use crate::llm::ChatMessage;
|
||||
use crate::safety::SafetyLayer;
|
||||
use crate::tools::{ToolRegistry, prepare_tool_params, redact_params};
|
||||
use ironclaw_safety::SafetyLayer;
|
||||
|
||||
/// Execute a tool with safety checks: lookup → validate → timeout → execute → serialize.
|
||||
///
|
||||
|
||||
@@ -11,8 +11,6 @@ use crate::extensions::ExtensionManager;
|
||||
use crate::llm::{LlmProvider, ToolDefinition};
|
||||
use crate::orchestrator::job_manager::ContainerJobManager;
|
||||
use crate::secrets::SecretsStore;
|
||||
use crate::skills::catalog::SkillCatalog;
|
||||
use crate::skills::registry::SkillRegistry;
|
||||
use crate::tools::builder::{
|
||||
BuildSoftwareTool, BuilderConfig, LlmSoftwareBuilder, SoftwareBuilder,
|
||||
};
|
||||
@@ -31,6 +29,8 @@ use crate::tools::wasm::{
|
||||
WasmStorageError, WasmToolRuntime, WasmToolStore, WasmToolWrapper,
|
||||
};
|
||||
use crate::workspace::Workspace;
|
||||
use ironclaw_skills::catalog::SkillCatalog;
|
||||
use ironclaw_skills::registry::SkillRegistry;
|
||||
|
||||
/// Names of built-in tools that cannot be shadowed by dynamic registrations.
|
||||
/// This prevents a dynamically built or installed tool from replacing a
|
||||
|
||||
@@ -501,12 +501,12 @@ mod tests {
|
||||
fn test_skill_tool_schemas() {
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::skills::catalog::SkillCatalog;
|
||||
use crate::skills::registry::SkillRegistry;
|
||||
use crate::tools::Tool;
|
||||
use crate::tools::builtin::{
|
||||
SkillInstallTool, SkillListTool, SkillRemoveTool, SkillSearchTool,
|
||||
};
|
||||
use ironclaw_skills::catalog::SkillCatalog;
|
||||
use ironclaw_skills::registry::SkillRegistry;
|
||||
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let path = dir.keep();
|
||||
|
||||
@@ -18,7 +18,6 @@ use wasmtime_wasi::{ResourceTable, WasiCtx, WasiCtxBuilder, WasiView};
|
||||
|
||||
use crate::context::JobContext;
|
||||
use crate::llm::recording::{HttpExchangeRequest, HttpExchangeResponse, HttpInterceptor};
|
||||
use crate::safety::LeakDetector;
|
||||
use crate::secrets::{DecryptedSecret, SecretsStore};
|
||||
use crate::tools::tool::{Tool, ToolError, ToolOutput};
|
||||
use crate::tools::wasm::capabilities::Capabilities;
|
||||
@@ -29,6 +28,7 @@ use crate::tools::wasm::error::WasmError;
|
||||
use crate::tools::wasm::host::{HostState, LogLevel};
|
||||
use crate::tools::wasm::limits::{ResourceLimits, WasmResourceLimiter};
|
||||
use crate::tools::wasm::runtime::{EPOCH_TICK_INTERVAL, PreparedModule, WasmToolRuntime};
|
||||
use ironclaw_safety::LeakDetector;
|
||||
|
||||
// Generate component model bindings from the WIT file.
|
||||
//
|
||||
@@ -2961,7 +2961,7 @@ mod tests {
|
||||
/// tool's own legitimate outbound request.
|
||||
#[test]
|
||||
fn test_leak_scan_runs_before_credential_injection() {
|
||||
use crate::safety::LeakDetector;
|
||||
use ironclaw_safety::LeakDetector;
|
||||
|
||||
// Simulate pre-injection headers: WASM only sees the placeholder, not the real token.
|
||||
let raw_headers: Vec<(String, String)> = vec![
|
||||
|
||||
Reference in New Issue
Block a user