Files
zclaw_openfang/config/config.toml
iven 3ff08faa56 release(v0.2.0): streaming, MCP protocol, Browser Hand, security enhancements
## Major Features

### Streaming Response System
- Implement LlmDriver trait with `stream()` method returning async Stream
- Add SSE parsing for Anthropic and OpenAI API streaming
- Integrate Tauri event system for frontend streaming (`stream:chunk` events)
- Add StreamChunk types: Delta, ToolStart, ToolEnd, Complete, Error

### MCP Protocol Implementation
- Add MCP JSON-RPC 2.0 types (mcp_types.rs)
- Implement stdio-based MCP transport (mcp_transport.rs)
- Support tool discovery, execution, and resource operations

### Browser Hand Implementation
- Complete browser automation with Playwright-style actions
- Support Navigate, Click, Type, Scrape, Screenshot, Wait actions
- Add educational Hands: Whiteboard, Slideshow, Speech, Quiz

### Security Enhancements
- Implement command whitelist/blacklist for shell_exec tool
- Add SSRF protection with private IP blocking
- Create security.toml configuration file

## Test Improvements
- Fix test import paths (security-utils, setup)
- Fix vi.mock hoisting issues with vi.hoisted()
- Update test expectations for validateUrl and sanitizeFilename
- Add getUnsupportedLocalGatewayStatus mock

## Documentation Updates
- Update architecture documentation
- Improve configuration reference
- Add quick-start guide updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 03:24:24 +08:00

294 lines
6.6 KiB
TOML

# ============================================================
# ZClaw OpenFang Main Configuration
# OpenFang TOML format configuration file
# ============================================================
#
# Usage:
# 1. Copy this file to ~/.openfang/config.toml
# 2. Set environment variables for API keys
# 3. Import chinese-providers.toml for Chinese LLM support
#
# Environment variables:
# ZHIPU_API_KEY, QWEN_API_KEY, KIMI_API_KEY,
# MINIMAX_API_KEY, DEEPSEEK_API_KEY, OPENAI_API_KEY
# ============================================================
# ============================================================
# Server Configuration
# ============================================================
[server]
# gRPC server host and port (default 4200 from runtime-manifest.json)
host = "127.0.0.1"
port = 4200
# WebSocket configuration
websocket_port = 4200
websocket_path = "/ws"
# CORS settings for desktop client
cors_origins = ["http://localhost:1420", "tauri://localhost"]
# API version prefix
api_version = "v1"
# ============================================================
# Agent Configuration
# ============================================================
[agent.defaults]
# Default workspace for agent operations
workspace = "~/.openfang/zclaw-workspace"
# Default model for new sessions
default_model = "zhipu/glm-4-plus"
# Fallback models if primary fails
fallback_models = ["qwen/qwen-max", "deepseek/deepseek-chat"]
# Heartbeat interval for agent health checks
heartbeat_interval = "1h"
# Session timeout
session_timeout = "24h"
# Maximum concurrent sessions
max_sessions = 10
[agent.defaults.sandbox]
# Sandbox root directory
workspace_root = "~/.openfang/zclaw-workspace"
# Allowed shell commands (empty = all allowed)
# allowed_commands = ["git", "npm", "pnpm", "cargo"]
# Enable shell execution
shell_enabled = true
# Network access in sandbox
network_enabled = true
[agent.defaults.memory]
# Conversation memory settings
max_history_length = 100
summarize_threshold = 50
# ============================================================
# Skills Configuration
# ============================================================
[skills]
# Additional skill directories to load
extra_dirs = ["./skills"]
# Enable hot reload for skill development
hot_reload = false
# Skill execution timeout
execution_timeout = "5m"
# ============================================================
# Hands Configuration
# ============================================================
[hands]
# Additional hand directories to load
extra_dirs = ["./hands"]
# Default approval mode: "auto", "manual", "smart"
default_approval_mode = "smart"
# Hand execution settings
max_concurrent = 5
execution_timeout = "30m"
# Audit settings
audit_enabled = true
audit_log_path = "~/.openfang/logs/hands-audit.log"
# ============================================================
# LLM Provider Configuration
# ============================================================
[llm]
# Default provider settings
default_provider = "zhipu"
default_model = "glm-4-plus"
# Rate limiting
requests_per_minute = 60
tokens_per_minute = 100000
# Retry settings
max_retries = 3
retry_delay = "1s"
# ============================================================
# Model Aliases
# ============================================================
[llm.aliases]
# 智谱 GLM 模型 (使用正确的 API 模型 ID)
"glm-4-flash" = "zhipu/glm-4-flash"
"glm-4-plus" = "zhipu/glm-4-plus"
"glm-4.5" = "zhipu/glm-4.5"
# 其他模型
"qwen3.5" = "qwen/qwen-plus"
"gpt-4" = "openai/gpt-4o"
# ============================================================
# Security Configuration
# ============================================================
[security]
# Enable all security layers
enabled = true
# Authentication
[security.auth]
# JWT token expiration
token_expiration = "24h"
# Ed25519 key settings
key_rotation_interval = "30d"
# RBAC settings
[security.rbac]
enabled = true
default_role = "user"
# Rate limiting
[security.rate_limit]
enabled = true
requests_per_second = 10
burst_size = 20
# Audit logging
[security.audit]
enabled = true
log_path = "~/.openfang/logs/audit.log"
log_format = "json"
# ============================================================
# Logging Configuration
# ============================================================
[logging]
# Log level: "trace", "debug", "info", "warn", "error"
level = "info"
# Log format: "json", "pretty", "compact"
format = "pretty"
# Log file settings
[logging.file]
enabled = true
path = "~/.openfang/logs/openfang.log"
max_size = "10MB"
max_files = 5
compress = true
# Console logging
[logging.console]
enabled = true
colorize = true
# ============================================================
# Channels Configuration (Integrations)
# ============================================================
[channels]
# Feishu (Lark) integration
[channels.feishu]
enabled = false
[channels.feishu.default]
app_id = ""
app_secret = ""
enabled = false
# ============================================================
# Tools Configuration
# ============================================================
[tools]
# Shell execution tool
[tools.exec]
shell_enabled = true
timeout = "30s"
# Web search tool
[tools.web]
[tools.web.search]
enabled = true
default_engine = "duckduckgo"
max_results = 10
# File system tool
[tools.fs]
allowed_paths = ["~/.openfang/zclaw-workspace"]
max_file_size = "10MB"
# ============================================================
# Workflow Configuration
# ============================================================
[workflow]
# Workflow storage
storage_path = "~/.openfang/workflows"
# Execution settings
max_steps = 100
step_timeout = "5m"
# Trigger settings
[workflow.triggers]
enabled = true
max_scheduled = 50
# ============================================================
# Desktop Client Configuration
# ============================================================
[desktop]
# Desktop-specific settings for ZClaw client
[desktop.ui]
# Theme settings
default_theme = "system"
theme_transition_ms = 200
# Animation settings
animations_enabled = true
animation_duration_ms = 300
[desktop.connection]
# Connection retry settings
auto_reconnect = true
reconnect_delay_ms = 1000
max_reconnect_attempts = 5
# Connection timeout
connection_timeout_ms = 5000
request_timeout_ms = 30000
# ============================================================
# Development Settings (for local development only)
# ============================================================
[development]
# Enable debug mode
debug = false
# Verbose logging
verbose = false
# Mock mode (for testing without real LLM)
mock_llm = false
# Profiling
profiling_enabled = false
profiling_port = 6060