# Masix Configuration Example
#
# Run 'masix config init' for interactive setup wizard
# The wizard will help you configure providers and models

[core]
data_dir = "~/.masix"
log_level = "info"

[core.agent_loop]
auto_continue_enabled = true
auto_continue_max = 3
continuation_detection = "heuristic_v1" # or "strict_v1"
# max_tool_iterations = 25

[core.tool_progress]
enabled = true
mode = "first_round" # first_round | periodic | milestones
interval_secs = 8
max_updates = 5
include_tool_names = true

[core.streaming]
enabled = false
mode = "off" # off | telegram_edit | telegram_chunked
flush_interval_ms = 900
max_message_edits = 20
finalize_timeout_secs = 10

[core.cron]
dispatch_concurrency = 2 # validated and logged; cron delivery remains sequential in 0.4.4
delivery_retry_count = 2
delivery_retry_backoff_secs = 10
dead_letter_enabled = true

[updates]
enabled = false
check_on_start = false
auto_apply = false
restart_after_update = false
channel = "latest"

[telegram]
poll_timeout_secs = 60

[[telegram.accounts]]
bot_token = "YOUR_BOT_TOKEN_HERE"
admins = []
users = []
readonly = []
dm_policy = "pairing" # pairing | allowlist | open | disabled
access_mode = "assistant_autoregister" # admin_only_registered | assistant_autoregister | group_tag_response | group_profiler | group_all_response
group_policy = "allowlist" # allowlist | open | disabled
group_require_mention = true
group_allow_known_untagged = false
notify_admin_on_new_user = true
# new_user_welcome_message = "Welcome! I'm online."
user_tools_mode = "none"
# user_allowed_tools = ["web_fetch", "plugin_discovery_web_search", "read_file"]
user_allowed_tools = []

# Plugin packages are installed via `masix plugin ...` or bundled postinstall flows.

[stt]
enabled = false
engine = "local_whisper_cpp"
# local_model_path = "~/.masix/models/whisper/whisper_base.bin"
# local_bin = "whisper-cli"
# local_threads = 2
# local_language = "it"

[mcp]
enabled = true

[[mcp.servers]]
name = "filesystem"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/data/data/com.termux/files/home"]
timeout_secs = 30
startup_timeout_secs = 20
healthcheck_interval_secs = 60

[[mcp.servers]]
name = "memory"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-memory"]
timeout_secs = 30
startup_timeout_secs = 20
healthcheck_interval_secs = 60

# Example: long-running MCP server (codex tools) with extended timeout
# [[mcp.servers]]
# name = "plugin_codex_tools"
# command = "/path/to/codex-tools"
# args = ["serve-mcp"]
# env = { CODEX_TIMEOUT_SECS = "1800" }
# timeout_secs = 1800  # Match internal plugin timeout (default: 30)
# startup_timeout_secs = 30
# healthcheck_interval_secs = 120

# Providers will be configured by 'masix config init' wizard
[providers]
default_provider = ""

# Bot profiles (optional)
# [bots]
# [[bots.profiles]]
# name = "default"
# workdir = "~/.masix"
# memory_file = "~/.masix/MEMORY.md"
# provider_primary = ""
# vision_provider = "" # optional dedicated provider for media analysis
# provider_fallback = []

# Command execution
[exec]
enabled = true
allow_base = true
allow_termux = true

[policy]
rate_limit = { messages_per_minute = 60 }
