mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* fix: strip reasoning from LLM responses and persist assistant messages reliably - Filter out `type: "reasoning"` output items from NEAR AI Responses API parsing so chain-of-thought never reaches the UI (nearai.rs) - Rewrite clean_response with regex-based tag stripping that is code-aware (preserves tags inside fenced blocks and inline backticks), supports 9+ tag names (think, thought, reasoning, reflection, etc.), handles <final> extraction, pipe-delimited tags, and case/whitespace tolerance (reasoning.rs) - Add Reasoning::complete() helper so all non-agentic LLM call sites (summarize, suggest, heartbeat, compaction) get automatic response cleaning; thread SafetyLayer through to those callers - Change persist_turn from fire-and-forget tokio::spawn to awaited async so both user and assistant messages are written before returning, preventing data loss on shutdown/restart - Pass input_count through seed_response_chain so response chaining delta calculation is accurate after thread hydration on restart - Make NearAiResponse.usage optional and preserve response_id in alt response path for chaining continuity - Persist session token to DB during onboarding wizard so runtime loads it without legacy-key fallback; suppress spurious warning on fresh installs - Fix dev tool double-registration when builder already registers them - Load dotenv/ironclaw env for doctor and status subcommands - Reduce startup log noise (demote info→debug for skills, remove redundant info lines) Co-Authored-By: Claude Opus 4.6 <[email protected]> * Nudge to not loop over tools continuesly * refactor: remove Responses API, consolidate NEAR AI to Chat Completions only The Responses API provider (nearai.rs, 1278 lines) added significant complexity (response chaining state machine, delta message calculation, previous_response_id persistence) for marginal benefit. This consolidates to the Chat Completions API only, upgrading NearAiChatProvider with dual auth (session token + API key) and 401 retry for session token renewal. - Delete src/llm/nearai.rs (Responses API provider) - Upgrade nearai_chat.rs with SessionManager, dual auth, flexible list_models - Remove response_id from CompletionResponse and ToolCompletionResponse - Remove seed_response_chain/get_response_chain_id from LlmProvider trait - Remove response chain persistence from agent (thread_ops, session) - Remove NearAiApiMode enum and NEARAI_API_MODE config - Clean up all wrapper providers (retry, circuit_breaker, failover, cache) - Update documentation (CLAUDE.md, .env.example) Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: runtime log level control via gateway UI and URL parameter Add server-side log level switching using tracing_subscriber::reload::Layer so the EnvFilter can be swapped at runtime without restarting. Expose via GET/PUT /api/logs/level endpoints, a "Server: LEVEL" dropdown in the logs toolbar, and a ?log_level=debug URL parameter for one-click activation. Also applies cargo fmt to pre-existing files (llm/, tests/). Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
90 lines
2.8 KiB
Bash
90 lines
2.8 KiB
Bash
# Database Configuration
|
|
DATABASE_URL=postgres://localhost/ironclaw
|
|
DATABASE_POOL_SIZE=10
|
|
|
|
# LLM Provider
|
|
# LLM_BACKEND=nearai # default
|
|
# Possible values: nearai, ollama, openai_compatible, openai, anthropic, tinfoil
|
|
|
|
# === NEAR AI (Chat Completions API) ===
|
|
# Two auth modes:
|
|
# 1. Session token (default): Uses browser OAuth (GitHub/Google) on first run.
|
|
# Session token stored in ~/.ironclaw/session.json automatically.
|
|
# Base URL defaults to https://private.near.ai
|
|
# 2. API key: Set NEARAI_API_KEY to use API key auth from cloud.near.ai.
|
|
# Base URL defaults to https://cloud-api.near.ai
|
|
NEARAI_MODEL=zai-org/GLM-5-FP8
|
|
NEARAI_BASE_URL=https://private.near.ai
|
|
NEARAI_AUTH_URL=https://private.near.ai
|
|
# NEARAI_SESSION_TOKEN=sess_... # hosting providers: set this
|
|
# NEARAI_SESSION_PATH=~/.ironclaw/session.json # optional, default shown
|
|
# NEARAI_API_KEY=... # API key from cloud.near.ai
|
|
|
|
# Local LLM Providers (Ollama, LM Studio, vLLM, LiteLLM)
|
|
|
|
# === Ollama ===
|
|
# OLLAMA_MODEL=llama3.2
|
|
# LLM_BACKEND=ollama
|
|
# OLLAMA_BASE_URL=http://localhost:11434 # default
|
|
|
|
# === OpenAI-compatible (LM Studio, vLLM, Anything-LLM) ===
|
|
# LLM_MODEL=llama-3.2-3b-instruct-q4_K_M
|
|
# LLM_BACKEND=openai_compatible
|
|
# LLM_BASE_URL=http://localhost:1234/v1
|
|
# LLM_API_KEY=sk-... # optional for local servers
|
|
|
|
# === OpenRouter (via OpenAI-compatible) ===
|
|
# LLM_MODEL=anthropic/claude-sonnet-4
|
|
# LLM_BACKEND=openai_compatible
|
|
# LLM_BASE_URL=https://openrouter.ai/api/v1
|
|
# LLM_API_KEY=sk-or-...
|
|
|
|
|
|
# Channel Configuration
|
|
# CLI is always enabled
|
|
|
|
# Slack Bot (optional)
|
|
SLACK_BOT_TOKEN=xoxb-...
|
|
SLACK_APP_TOKEN=xapp-...
|
|
SLACK_SIGNING_SECRET=...
|
|
|
|
# Telegram Bot (optional)
|
|
TELEGRAM_BOT_TOKEN=...
|
|
|
|
# HTTP Webhook Server (optional)
|
|
HTTP_HOST=0.0.0.0
|
|
HTTP_PORT=8080
|
|
HTTP_WEBHOOK_SECRET=your-webhook-secret
|
|
|
|
# Agent Settings
|
|
AGENT_NAME=ironclaw
|
|
AGENT_MAX_PARALLEL_JOBS=5
|
|
AGENT_JOB_TIMEOUT_SECS=3600
|
|
AGENT_STUCK_THRESHOLD_SECS=300
|
|
# Enable planning phase before tool execution (default: true)
|
|
AGENT_USE_PLANNING=true
|
|
|
|
# Self-repair settings
|
|
SELF_REPAIR_CHECK_INTERVAL_SECS=60
|
|
SELF_REPAIR_MAX_ATTEMPTS=3
|
|
|
|
# Heartbeat settings (proactive periodic execution)
|
|
# When enabled, reads HEARTBEAT.md checklist and reports findings
|
|
HEARTBEAT_ENABLED=false
|
|
HEARTBEAT_INTERVAL_SECS=1800
|
|
HEARTBEAT_NOTIFY_CHANNEL=cli
|
|
HEARTBEAT_NOTIFY_USER=default
|
|
|
|
# Memory hygiene settings (automatic cleanup of stale workspace documents)
|
|
# Runs on each heartbeat tick; identity files (IDENTITY.md, SOUL.md) are never deleted
|
|
# MEMORY_HYGIENE_ENABLED=true
|
|
# MEMORY_HYGIENE_RETENTION_DAYS=30 # delete daily/ docs older than this many days
|
|
# MEMORY_HYGIENE_CADENCE_HOURS=12 # minimum hours between cleanup passes
|
|
|
|
# Safety settings
|
|
SAFETY_MAX_OUTPUT_LENGTH=100000
|
|
SAFETY_INJECTION_CHECK_ENABLED=true
|
|
|
|
# Logging
|
|
RUST_LOG=ironclaw=debug,tower_http=debug
|