feat(phase3-4): add OpenFang config.toml and TypeScript type definitions
Phase 3: Configuration Migration (P1) - Create config/config.toml with comprehensive OpenFang settings - Migrate openclaw.default.json content to TOML format - Add server, agent, skills, hands, llm, security, logging configs - Add desktop-specific settings for ZClaw client Phase 4: Type System Enhancement (P2) - Create types/agent.ts: Agent, AgentConfig, AgentStatus types - Create types/session.ts: Session, SessionMessage, MessageRole types - Create types/settings.ts: QuickConfig, MCPService, AppSettings types - Create types/index.ts: Barrel export for all type definitions Documentation Updates: - Mark Phase 3 config migration tasks as completed (2/3) - Mark Phase 4 type definition tasks as completed (3/4) - Update technical debt cleanup status - Update type definition section in SYSTEM_ANALYSIS.md Files Added: - config/config.toml (289 lines) - desktop/src/types/agent.ts (68 lines) - desktop/src/types/session.ts (75 lines) - desktop/src/types/settings.ts (89 lines) - desktop/src/types/index.ts (41 lines) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
289
config/config.toml
Normal file
289
config/config.toml
Normal file
@@ -0,0 +1,289 @@
|
||||
# ============================================================
|
||||
# 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
|
||||
host = "127.0.0.1"
|
||||
port = 50051
|
||||
|
||||
# WebSocket configuration
|
||||
websocket_port = 50051
|
||||
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-5" = "zhipu/glm-4-plus"
|
||||
"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
|
||||
Reference in New Issue
Block a user