mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* fix(routines): persist full LLM transcript and remove sandbox gate for full_job Routine execution output was invisible — routine_fire returned a one-liner, routine_history had no actual output, and the conversation thread contained only a summary. Full-job routines also hard-failed without Docker. Three fixes: 1. **Full transcript persistence**: execute_lightweight now persists every message (prompt, LLM responses, tool calls with params, tool results) to the routine's conversation thread as it executes, not just a summary after the fact. 2. **Routine output visibility**: routine_history includes conversation_id and recent_output messages. routine_fire tells the user to check routine_history. Web detail page has a "View Execution Thread" button that navigates to the chat tab. ROUTINE_OK stores "No issues found" instead of None. Full-job summary pulls actual job output instead of generic "Job X finished". 3. **Remove SandboxReadiness gate**: full_job routines dispatch through the scheduler like regular /job commands — no Docker required. The SandboxReadiness enum is removed entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * style: apply cargo fmt Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(worker): treat AutonomousUnavailable tool errors as recoverable The job worker crashed the entire job when a tool was denied for autonomous execution (e.g. secret_list). The error was already recorded in reason_ctx for the LLM to see, but process_tool_result_job returned Err which propagated through the agentic loop and terminated the job. Now all tool errors (including AutonomousUnavailable) return Ok, letting the LLM see the denial and try a different approach. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(llm): sanitize tool names for OpenAI Codex Responses API The Codex API requires tool names to match `^[a-zA-Z0-9_-]+$` but MCP/extension tools can have dots in their names (e.g. `mcp.server.tool`). This caused HTTP 400 errors when the job worker sent tool calls back to the LLM. Sanitize tool names in both `convert_tool_definition` and `convert_message` (function_call items) by replacing invalid characters with underscores. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(routines): inject execution context into full_job description [skip-regression-check] When a full_job routine dispatches a job, the LLM had no context that it was already executing inside a routine. It wasted iterations on infrastructure (discovering tools, creating routines, setting up auth) instead of doing the actual work. Prepend a clear directive to the job description telling the LLM that tools and the routine are already configured, and to execute the task directly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(mcp): auto-refresh expired OAuth tokens on access [skip-regression-check] When IronClaw restarts, MCP servers fail with "Secret has expired" because get_access_token() checks token expiry locally and returns an error before any HTTP request is made — so the existing 401-retry refresh logic never triggers. Now get_access_token() catches SecretError::Expired and automatically calls refresh_access_token() using the stored refresh token. If the refresh succeeds, the new token is returned transparently. If it fails, the error message includes both the expiry and the refresh failure. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(mcp): align refresh token naming and set expiry on stored tokens Two bugs prevented MCP OAuth token auto-refresh on restart: 1. Naming mismatch: the hosted OAuth flow stored the refresh token as `{token_secret_name}_refresh_token` (e.g. `mcp_notion_access_token_refresh_token`) but `McpServerConfig::refresh_token_secret_name()` returned `mcp_notion_refresh_token`. The refresh token was there but unfindable. 2. Missing expiry: `store_tokens` in auth.rs never called `with_expiry()` even though `AccessToken::expires_in` was available. Combined with the fix from the previous commit (auto-refresh on Expired), tokens stored via the MCP auth flow will now also trigger refresh correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(web): show activity and transitions for agent jobs in job detail [skip-regression-check] The job events endpoint only checked sandbox jobs for ownership, returning 404 for agent jobs dispatched from routines. The detail handler also returned empty transitions for agent jobs. - events handler: fall back to agent job ownership check - detail handler: populate transitions from job's state history Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * feat(routines): expose max_iterations for full_job routines (default 25) The max_iterations parameter was hardcoded to 10 and not configurable via routine_create or routine_update, causing complex tasks to hit the iteration cap. - Add max_iterations to full_job execution schema (1-200, default 25) - Thread it through parse → build → RoutineAction - Support updating via routine_update - Raise default from 10 to 25 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(routines): break self-dialogue loop after full_job plan execution After plan execution, the completion-check Q&A ("Is the job complete?" / "No, not complete...") was left in the message context, causing the agentic loop to repeat the same analysis instead of calling tools. Replace the stale dialogue with an action-oriented continuation prompt that instructs the LLM to use tools for remaining work. Also strip <suggestions> tags from all job output since they're only meaningful for interactive chat sessions. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(repl): prevent test hang in single-message mode In single-message mode, start() stored a clone of the mpsc sender in self.msg_tx for approval injection. After the thread sent /quit and exited, the stored clone kept the stream alive, so stream.next() blocked forever in the test assertion that the stream ends. Skip storing the sender in single-message mode since interactive approval is not needed. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(jobs): treat text responses as final answer in agentic loop When the LLM produces a non-empty text response with no tool intent (already filtered by the nudge mechanism), it is the job's final answer. Previously, handle_text_response only exited the loop if the text matched rigid completion phrases like "job is complete". Natural summaries like "Weekly review completed and saved to Notion" were added to context and the loop continued, causing the LLM to restate the same summary until max_iterations was hit. Now any non-empty text response marks the job complete and stops the loop, matching the chat dispatcher behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * perf(tests): reduce skills catalog network failure test from 10s to 1s The test_search_returns_error_on_network_failure test connects to an unreachable RFC 5737 TEST-NET IP and waited for the full 10s production REQUEST_TIMEOUT. Add with_url_and_timeout test helper and use a 1s timeout instead. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(tools): accept 'message' as alias for 'content' in message tool LLMs frequently call the message tool with {"message": "..."} instead of {"content": "..."}. Fall back to the 'message' key when 'content' is missing to avoid InvalidParameters errors during autonomous job execution. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(tools): attach thread_id for gateway broadcast in message tool When the message tool broadcasts to all channels (channel=null), it sent an OutgoingResponse without a thread_id. The gateway silently dropped these messages (returned Ok but never sent the SSE event), so they appeared in repl but not in the web UI. The thread_id was only populated when channel was explicitly "gateway". Now it is always populated from notify_thread_id metadata, so broadcast_all delivers to the gateway correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(gateway): return error instead of silently dropping messages Gateway broadcast() and respond() previously returned Ok(()) when thread_id was missing, silently swallowing the message. Callers (message tool, agent loop) believed delivery succeeded when it didn't. Now returns ChannelError::MissingRoutingTarget so callers can detect and report the failure. Four regression tests verify the contract: respond/broadcast with and without thread_id. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: resolve rebase conflicts with staging Restore sandbox_readiness field removed by pre-rebase commits (staging still uses it). Update repl test to match staging's single-message behavior (no longer sends /quit). Add missing reasoning field to ToolCall in codex test. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(tools): log error when routine conversation lookup fails The routine_history tool silently swallowed errors from get_or_create_routine_conversation, returning empty output without any diagnostic logging. Add tracing::warn so failures are visible in logs. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address PR #1650 review comments - E2E test: accept submitted/accepted as success states in job assertion - TimeTool: remove operation from required schema (defaults to "now") - jobs handler: log DB errors server-side, return generic message to client - routines handler: use read-only find_routine_conversation on GET - codex provider: reverse-map sanitized tool names so MCP tools resolve Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: address zmanian review feedback on PR #1650 - MCP refresh token: fall back to legacy secret name (mcp_{name}_refresh_token) so existing users don't need to re-authenticate after the naming fix - Job worker: replace fragile messages.pop() with truncate-to-saved-count to avoid maintenance hazard if message flow changes - Document cost implications of max_iterations 10->25 default bump - Revert Cargo.toml dist profile change (thin LTO comment, codegen-units=16) as it's unrelated to this PR Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix: resolve rebase conflicts and address new Copilot comments - Fix no_silent_drop tests for updated GatewayConfig (user_id moved to GatewayChannel::new second arg, user_tokens removed) - Fix handle_text_response param name (_reason_ctx -> reason_ctx) - Fix missing has_text_response field in test JobDelegate - Propagate row.get errors in find_routine_conversation instead of unwrap_or_default - Only fall back to legacy refresh token name on NotFound/Expired, propagate real errors (DB, decryption) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
300 lines
8.7 KiB
TOML
300 lines
8.7 KiB
TOML
[workspace]
|
|
members = [".", "crates/ironclaw_common", "crates/ironclaw_safety"]
|
|
exclude = [
|
|
"channels-src/discord",
|
|
"channels-src/telegram",
|
|
"channels-src/slack",
|
|
"channels-src/whatsapp",
|
|
"tools-src/github",
|
|
"tools-src/gmail",
|
|
"tools-src/google-calendar",
|
|
"tools-src/google-docs",
|
|
"tools-src/google-drive",
|
|
"tools-src/google-sheets",
|
|
"tools-src/google-slides",
|
|
"tools-src/slack",
|
|
"tools-src/telegram",
|
|
"fuzz",
|
|
"crates/ironclaw_safety/fuzz",
|
|
]
|
|
|
|
[package]
|
|
name = "ironclaw"
|
|
version = "0.22.0"
|
|
edition = "2024"
|
|
rust-version = "1.92"
|
|
description = "Secure personal AI assistant that protects your data and expands its capabilities on the fly"
|
|
authors = ["NEAR AI <[email protected]>"]
|
|
license = "MIT OR Apache-2.0"
|
|
homepage = "https://github.com/nearai/ironclaw"
|
|
repository = "https://github.com/nearai/ironclaw"
|
|
|
|
[package.metadata.wix]
|
|
upgrade-guid = "D0156E61-BA37-451E-8AB9-1A2ECCCFA48F"
|
|
path-guid = "F90B6EA6-87F7-499B-BB19-CF55DE1EB339"
|
|
license = false
|
|
eula = false
|
|
|
|
[dependencies]
|
|
# Async runtime
|
|
tokio = { version = "1", features = ["full"] }
|
|
tokio-stream = { version = "0.1", features = ["sync"] }
|
|
futures = "0.3"
|
|
eventsource-stream = "0.2"
|
|
|
|
# HTTP client
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls-native-roots", "stream"] }
|
|
|
|
# Serialization
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
|
|
# Database - PostgreSQL (default, feature-gated)
|
|
deadpool-postgres = { version = "0.14", optional = true }
|
|
tokio-postgres = { version = "0.7", features = ["with-uuid-1", "with-chrono-0_4", "with-serde_json-1"], optional = true }
|
|
postgres-types = { version = "0.2", features = ["with-serde_json-1"], optional = true }
|
|
refinery = { version = "0.8", features = ["tokio-postgres"], optional = true }
|
|
tokio-postgres-rustls = { version = "0.13", optional = true }
|
|
rustls = { version = "0.23", optional = true, default-features = false }
|
|
rustls-native-certs = { version = "0.8", optional = true }
|
|
webpki-roots = { version = "0.26", optional = true }
|
|
|
|
# Database - libSQL/Turso (optional embedded database)
|
|
libsql = { version = "0.6", optional = true, default-features = false, features = ["core", "replication", "remote", "tls"] }
|
|
|
|
# Error handling
|
|
thiserror = "2"
|
|
anyhow = "1"
|
|
|
|
# Logging
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
|
|
# Configuration
|
|
dotenvy = "0.15"
|
|
toml = "0.8"
|
|
|
|
# Core types
|
|
uuid = { version = "1", features = ["v4", "v5", "serde"] }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
chrono-tz = "0.10"
|
|
iana-time-zone = "0.1"
|
|
rust_decimal = { version = "1", features = ["serde", "serde-with-str", "maths"] }
|
|
rust_decimal_macros = "1"
|
|
|
|
# Async traits
|
|
async-trait = "0.1"
|
|
|
|
# CLI
|
|
clap = { version = "4", features = ["derive", "env"] }
|
|
|
|
# Terminal
|
|
crossterm = "0.29"
|
|
rustyline = { version = "17", features = ["custom-bindings", "derive", "with-file-history"] }
|
|
termimad = "0.34"
|
|
|
|
# Channel integrations
|
|
axum = { version = "0.8", features = ["ws"] }
|
|
tower = "0.5"
|
|
tower-http = { version = "0.6", features = ["trace", "cors", "set-header", "catch-panic"] }
|
|
|
|
# Cron scheduling for routines
|
|
cron = "0.13"
|
|
|
|
# Shared types
|
|
ironclaw_common = { path = "crates/ironclaw_common", version = "0.1.0" }
|
|
|
|
# Safety/sanitization
|
|
ironclaw_safety = { path = "crates/ironclaw_safety", version = "0.2.0" }
|
|
regex = "1"
|
|
aho-corasick = "1"
|
|
|
|
# YAML parsing for SKILL.md frontmatter
|
|
serde_yml = "0.0.12"
|
|
|
|
# Filesystem paths
|
|
dirs = "6"
|
|
fs4 = "0.6"
|
|
|
|
# Semantic versioning
|
|
semver = "1"
|
|
|
|
# Secrecy for sensitive values
|
|
secrecy = { version = "0.10", features = ["serde"] }
|
|
|
|
# URL parsing and encoding
|
|
url = "2"
|
|
urlencoding = "2"
|
|
|
|
# Open URLs in browser
|
|
open = "5"
|
|
|
|
# Vector embeddings for semantic search
|
|
# The postgres feature provides ToSql/FromSql for postgres-types (shared by tokio-postgres)
|
|
pgvector = { version = "0.4", features = ["postgres"], optional = true }
|
|
|
|
# WASM sandbox for untrusted tool execution
|
|
wasmtime = { version = "28", features = ["component-model"] }
|
|
wasmtime-wasi = "28" # WASI support for component model
|
|
wasmparser = "0.220" # WASM binary parsing for validation
|
|
|
|
# Cryptography for secrets management
|
|
aes-gcm = "0.10"
|
|
hkdf = "0.12"
|
|
hmac = "0.12"
|
|
sha2 = "0.10"
|
|
blake3 = "1"
|
|
rand = "0.8"
|
|
subtle = "2" # Constant-time comparisons for token validation
|
|
|
|
# Multi-provider LLM support
|
|
rig-core = { version = "0.30", default-features = false, features = ["reqwest-rustls"] }
|
|
|
|
# AWS Bedrock (native Converse API, opt-in via --features bedrock)
|
|
aws-config = { version = "1", features = ["behavior-version-latest"], optional = true }
|
|
aws-sdk-bedrockruntime = { version = "1", optional = true }
|
|
aws-smithy-types = { version = "1", optional = true }
|
|
|
|
# Docker sandbox
|
|
bollard = "0.18"
|
|
|
|
# Archive extraction for WASM extension bundles
|
|
flate2 = "1"
|
|
tar = "0.4"
|
|
|
|
# Document text extraction
|
|
pdf-extract = "0.7"
|
|
zip = { version = "2", default-features = false, features = ["deflate"] }
|
|
|
|
# HTTP proxy for sandboxed network access
|
|
hyper = { version = "1.5", features = ["server", "http1", "http2"] }
|
|
hyper-util = { version = "0.1", features = ["server", "tokio", "http1", "http2"] }
|
|
http-body-util = "0.1"
|
|
bytes = "1"
|
|
base64 = "0.22.1"
|
|
mime_guess = "2.0.5"
|
|
clap_complete = "4.5.0"
|
|
lru = "0.16.3"
|
|
|
|
# HTML to Markdown conversion (feature gated)
|
|
html-to-markdown-rs = { version = "2.3", optional = true }
|
|
readabilityrs = { version = "0.1.2", optional = true }
|
|
ed25519-dalek = { version = "2.2.0", features = ["std"] }
|
|
hex = "0.4.3"
|
|
|
|
# OpenClaw import (feature gated)
|
|
json5 = { version = "0.4", optional = true }
|
|
|
|
# macOS keychain
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
security-framework = "3"
|
|
|
|
# PTY allocation for Claude CLI stdout buffering fix (Unix only)
|
|
[target.'cfg(unix)'.dependencies]
|
|
pty-process = { version = "0.5", features = ["async"] }
|
|
|
|
# Linux secret-service (GNOME Keyring, KWallet)
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
secret-service = { version = "4", features = ["rt-tokio-crypto-rust"] }
|
|
zbus = "4"
|
|
|
|
[dev-dependencies]
|
|
tokio-test = "0.4"
|
|
tracing-test = "0.2"
|
|
tokio-tungstenite = "0.26"
|
|
testcontainers-modules = { version = "0.11", features = ["postgres"] }
|
|
pretty_assertions = "1"
|
|
tempfile = "3"
|
|
insta = "1.46.3"
|
|
criterion = "0.5"
|
|
|
|
[[bench]]
|
|
name = "safety_check"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "safety_pipeline"
|
|
harness = false
|
|
|
|
[features]
|
|
default = ["postgres", "libsql", "html-to-markdown"]
|
|
postgres = [
|
|
"dep:deadpool-postgres",
|
|
"dep:tokio-postgres",
|
|
"dep:tokio-postgres-rustls",
|
|
"dep:rustls",
|
|
"dep:rustls-native-certs",
|
|
"dep:webpki-roots",
|
|
"dep:postgres-types",
|
|
"dep:refinery",
|
|
"dep:pgvector",
|
|
"rust_decimal/db-tokio-postgres",
|
|
]
|
|
libsql = ["dep:libsql"]
|
|
# Opt-in feature for especially heavy integration-test targets that run in a
|
|
# dedicated CI job instead of the default Rust test matrix.
|
|
integration = []
|
|
html-to-markdown = ["dep:html-to-markdown-rs", "dep:readabilityrs"]
|
|
bedrock = ["dep:aws-config", "dep:aws-sdk-bedrockruntime", "dep:aws-smithy-types"]
|
|
import = ["dep:json5", "libsql"]
|
|
|
|
[[test]]
|
|
name = "e2e_thread_scheduling"
|
|
required-features = ["libsql", "integration"]
|
|
|
|
[[test]]
|
|
name = "html_to_markdown"
|
|
required-features = ["html-to-markdown"]
|
|
|
|
[profile.release]
|
|
strip = true # Remove debug symbols from release binaries
|
|
|
|
# The profile that 'cargo dist' will build with
|
|
[profile.dist]
|
|
inherits = "release"
|
|
lto = "thin"
|
|
|
|
# Config for 'dist'
|
|
[workspace.metadata.dist]
|
|
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
|
|
cargo-dist-version = "0.30.3"
|
|
# Ignore out-of-date generated CI so custom release.yml jobs are allowed
|
|
allow-dirty = ["ci"]
|
|
# CI backends to support
|
|
ci = "github"
|
|
# The installers to generate for each app
|
|
installers = ["shell", "powershell", "npm", "msi"]
|
|
# Publish jobs to run in CI
|
|
publish-jobs = []
|
|
# Target platforms to build apps for (Rust target-triple syntax)
|
|
targets = [
|
|
"aarch64-apple-darwin",
|
|
"aarch64-unknown-linux-gnu",
|
|
"aarch64-unknown-linux-musl",
|
|
"x86_64-apple-darwin",
|
|
"x86_64-unknown-linux-gnu",
|
|
"x86_64-unknown-linux-musl",
|
|
"x86_64-pc-windows-msvc",
|
|
]
|
|
# The archive format to use for windows builds (defaults .zip)
|
|
windows-archive = ".tar.gz"
|
|
# The archive format to use for non-windows builds (defaults .tar.xz)
|
|
unix-archive = ".tar.gz"
|
|
# Which actions to run on pull requests
|
|
pr-run-mode = "skip"
|
|
# Path that installers should place binaries in
|
|
install-path = "CARGO_HOME"
|
|
# Whether to install an updater program
|
|
install-updater = true
|
|
# Cache intermediate build artifacts to speed up the release pipelines
|
|
cache-builds = true
|
|
|
|
[workspace.metadata.dist.github-custom-runners]
|
|
aarch64-unknown-linux-gnu = "ubuntu-24.04-arm"
|
|
aarch64-unknown-linux-musl = "ubuntu-24.04-arm"
|
|
x86_64-unknown-linux-gnu = "ubuntu-22.04"
|
|
x86_64-unknown-linux-musl = "ubuntu-22.04"
|
|
x86_64-pc-windows-msvc = "windows-2022"
|
|
x86_64-apple-darwin = "macos-15-intel"
|
|
aarch64-apple-darwin = "macos-14"
|