# scorpiox code configuration
# Place this file alongside scorpiox binaries or in ~/.scorpiox/

# Provider: scorpiox (router), claude_code (native OAuth), or codex (OpenAI Codex)
PROVIDER=claude_code

# Claude Code token source (only used when PROVIDER=claude_code)
# local = Read from ~/.claude/.credentials.json
# http  = Fetch from HTTP endpoint (CLAUDE_CODE_REMOTE_URL)
# ssh   = Fetch via SSH from remote machine (CLAUDE_CODE_SSH_*)
# tcp   = Fetch via raw TCP socket (TCP_HOST:TCP_PORT)
CLAUDE_CODE_TOKEN_SOURCE=tcp

# Router URL (only used when PROVIDER=scorpiox)
ROUTER_URL=

# =============================================================================
# Anthropic Provider Settings (only used when PROVIDER=anthropic)
# =============================================================================

# Authentication Provider
# official    = Direct Anthropic API (api.anthropic.com)
# antigravity = Antigravity proxy (custom model names)
# zai         = Z.AI proxy
# custom      = Custom endpoint (set ANTHROPIC_API_URL)
ANTHROPIC_AUTH_PROVIDER=official

# API Key for Official/Custom (also used as fallback)
# Get from: https://console.anthropic.com/settings/keys
ANTHROPIC_API_KEY=

# Custom API URL (only when ANTHROPIC_AUTH_PROVIDER=custom)
# Default: https://api.anthropic.com/v1/messages
ANTHROPIC_API_URL=https://api.anthropic.com/v1/messages

# Antigravity API Key
ANTHROPIC_ANTIGRAVITY_KEY=
# Antigravity API URL
ANTHROPIC_ANTIGRAVITY_URL=

# Z.AI API Key
ANTHROPIC_ZAI_KEY=
# Z.AI API URL (default: https://api.z.ai/api/anthropic/v1/messages)
ANTHROPIC_ZAI_URL=https://api.z.ai/api/anthropic/v1/messages

# API Backend (only used when PROVIDER=scorpiox)
# Options: claude, gemini, gemini-internal, glm
#   claude          -> /claude/v1/messages (Claude Code internal API)
#   gemini          -> /google/gemini/public/v1/messages (Gemini public API)
#   gemini-internal -> /google/gemini/internal/v1/messages (Gemini CLI internal)
#   glm             -> /glm/v1/messages (z.ai API)
#   llamacpp             -> /llamacpp/v1/messages (z.ai API)
API_BACKEND=gemini

# Default Model (use short name: opus, sonnet, haiku)
MODEL=opus

# Model ID Overrides (pin specific Claude model versions)
# When set, these override the compiled-in model IDs for alias resolution.
# Only applies when using -m opus/sonnet/haiku. Full model IDs pass through as-is.
# Leave empty to use compiled defaults.
CLAUDE_MODEL_OPUS_ID_OVERRIDE=
CLAUDE_MODEL_SONNET_ID_OVERRIDE=
CLAUDE_MODEL_HAIKU_ID_OVERRIDE=

# Streaming (SSE) mode (0=disabled, 1=enabled)
# Default: 0 (non-streaming for simpler response handling)
STREAMING=0

# Tools Master Switch (0=disabled, 1=enabled)
TOOLS=1

# Individual Tool Settings (only applies when TOOLS=1)
TOOL_BASH=1
TOOL_READIMAGE=1
TOOL_READDOCS=1
TOOL_WEBSEARCH=1
TOOL_TASKMANAGER=1
TOOL_PLANMODE=1
TOOL_ASKUSERQUESTION=1
TOOL_INVOKESKILL=1

# Built-in skills (1=enabled, 0=disabled)
SKILL_GOOGLEMAPS=1
SKILL_CREATE_COMMAND=1
SKILL_CREATE_SKILL=1
SKILL_EDIT_COMMAND=1
SKILL_EDIT_SKILL=1
SKILL_FAST_CLONE_INSTRUCTIONS=0
SKILL_FAST_CLONE=0
SKILL_PREFERRED_FILE_TOOLS=1
SKILL_WINDOWS_DESKTOP_SCREENSHOT=1

# Required skills tracking (1=enabled, 0=disabled)
REQUIRED_SKILLS=1
# Force-inject required skill content into context at session start (0=nudge only, 1=inject content)
REQUIRED_SKILLS_FORCED=0

# Timeout for interactive questions in seconds (0 = no timeout, default: 120)
ASKUSER_TIMEOUT=120

# Default timeout in milliseconds for Bash tool execution (120000 = 2 minutes)
# Per-call timeouts specified by the agent override this value.
BASH_DEFAULT_TIMEOUT=30000

# Minimum bash timeout in milliseconds (floor, overrides Claude per-call timeout)
# 0 = no minimum (default). Set via .vars or -e for agents needing longer timeouts.
BASH_MIN_TIMEOUT=0

# Auto-accept plan mode (0=disabled, 1=enabled)
# When enabled, after agent exits plan mode with a plan file,
# automatically approve and instruct agent to proceed with implementation
AUTO_ACCEPT_PLAN=1

# System Prompt (base prompt for Claude)
SYSTEM_PROMPT=You are Claude Code, Anthropic's official CLI for Claude.

# Log Directory (for scorpiox-logger file logging)
# Default: .scorpiox/logs (project-local)
LOG_DIR=.scorpiox/logs

# =============================================================================
# DNS Server Settings (scorpiox-dns)
# =============================================================================

# Enable DNS query audit logging (0=disabled, 1=enabled)
# Logs every DNS query with timestamp, source IP, type, domain, resolution, latency
# Format: dns-audit-YYYY-MM-DD.log (daily rotation)
DNS_AUDIT_LOG=0

# Directory for DNS audit log files
DNS_AUDIT_LOG_DIR=/var/log/scorpiox-dns

# =============================================================================
# Session Retention Policy
# =============================================================================

# Auto-delete sessions older than N days at startup (0=disabled/keep forever)
# Options: 0, 1 (daily), 7 (weekly), 14 (fortnightly), 30 (monthly), 365 (yearly)
# Default: 7
SESSION_RETENTION_DAYS=7


# =============================================================================
# System Prompt Context Settings
# =============================================================================

# Include current date/time in system prompt (1=enabled, 0=disabled)
PROMPT_INCLUDE_DATETIME=1

# Include timezone in system prompt
PROMPT_INCLUDE_TIMEZONE=1

# Include working directory in system prompt
PROMPT_INCLUDE_CWD=1

# Include OS info in system prompt (default: disabled)
PROMPT_INCLUDE_OS=0

# Include CLAUDE.md in system prompt (1=enabled, 0=disabled)
# When disabled, CLAUDE.md from the working directory is NOT loaded into the system prompt
# Default: 1 (enabled)
PROMPT_INCLUDE_CLAUDEMD=1

# Include directory tree in system prompt (0=disabled, 1=enabled)
PROMPT_INCLUDE_TREE=0
# Auto-fix malformed tool calls in thinking/text (retry with error message)
FIX_MALFORMED_TOOL_CALL=1

# Max tree depth (default: 3)
PROMPT_TREE_DEPTH=3

# Max files in tree output (default: 100)
PROMPT_TREE_MAX_FILES=100

# Patterns to ignore in tree (comma-separated)
PROMPT_TREE_IGNORE=.git,node_modules,build,__pycache__

# Use patch format for file edits (0=disabled, 1=enabled)
# When enabled, instructs AI to edit files using unified diff format
PATCH_EDIT=1

# Date/time format (strftime format)
# Default: %Y-%m-%d %H:%M:%S %Z
# Examples:
#   %Y-%m-%d               -> 2025-01-24
#   %A, %B %d, %Y          -> Friday, January 24, 2025
#   %Y-%m-%d %H:%M:%S      -> 2025-01-24 14:30:45
#   %Y-%m-%d %H:%M:%S %Z   -> 2025-01-24 14:30:45 EST
PROMPT_DATETIME_FORMAT=%Y-%m-%d %H:%M:%S %Z

# PROMPT_TIMEZONE - Override timezone for date/time display in system prompt
#   Uses IANA timezone names (e.g. America/New_York, Europe/London, Asia/Tokyo)
#   Empty = use system timezone
PROMPT_TIMEZONE=Pacific/Auckland

LOG_LEVEL=DEBUG

THINKING=1

# Max thinking tokens budget (default: 10000)
THINKING_BUDGET=10000

ENABLE_WELCOME=1

ENABLE_GRADIENT=0

ENABLE_TEXT_BG=0

# Prepend system-reminder to user messages (0=disabled, 1=enabled)
# When enabled, CLAUDE.md content is injected into each user message for context reinforcement
# Default: 0 (disabled - system prompt in separate field is sufficient)
USER_SYSTEM_REMINDER=0

# Terminal Background Color (1=enabled, 0=disabled)
# When enabled, sets terminal background to dark blue (#000050)
# Disable if your terminal theme already has a preferred background
ENABLE_TERM_BACKGROUND=0

# Terminal auto-show: 1=terminal pops up on tool use (default), 0=hidden by default
TERMINAL_AUTO_SHOW=1

# Background Bash Tools (for long-running commands)
# These allow running commands in background without blocking the agentic loop
TOOL_BACKGROUNDBASH=1
TOOL_READBGOUTPUT=1
TOOL_LISTBGTASKS=1
TOOL_KILLBGTASK=1
TOOL_SETCALLBACK=1
TOOL_CREATEFILE=1

# EmitEvent tool — agent-emitted custom events into session event stream
# Disabled by default. Enable in pipeline agents via TOOL_EMITEVENT=1
TOOL_EMITEVENT=0

# Lazy-load skills. When enabled, skills are NOT listed in InvokeSkill description.
# Instead, the LLM uses SearchSkills tool to discover skills by keyword first.
# Disabled by default — enable via TOOL_SEARCHSKILLS=1
TOOL_SEARCHSKILLS=0

# =============================================================================
# Vertex AI Provider (PROVIDER=gemini_vertex)
# Uses aiplatform.googleapis.com — bills against Google Cloud billing
# =============================================================================
VERTEX_API_KEY=
VERTEX_MODEL=gemini-3.1-pro-preview

# =============================================================================
# Google Gemini — AI Pro subscription (PROVIDER=google_gemini)
# Uses cloudcode-pa.googleapis.com with OAuth
# =============================================================================
GOOGLE_ACCOUNT=
GOOGLE_TOKEN_SOURCE=tcp
GOOGLE_REMOTE_URL=https://google-accounts.scorpiox.net/token
GOOGLE_GEMINI_MODEL=gemini-3-flash

# =============================================================================
# Google Claude — AI Pro subscription (PROVIDER=google_claude)
# Uses cloudcode-pa.googleapis.com with OAuth (same token as google_gemini)
# =============================================================================
GOOGLE_CLAUDE_MODEL=claude-sonnet-4-6


# =============================================================================
# Google Maps API Settings
# =============================================================================
MAPS_TOKEN_SOURCE=tcp
MAPS_TOKEN_URL=https://token.scorpiox.net/maps
# =============================================================================
# OpenAI Provider Settings (only used when PROVIDER=openai)
# Works with any OpenAI-compatible endpoint: llama.cpp, ollama, vllm, lm-studio
# =============================================================================

# OpenAI API Key (optional for local servers, required for OpenAI cloud)
OPENAI_API_KEY=

# OpenAI Base URL (e.g. https://opus.scorpiox.net)
OPENAI_BASE_URL=https://opus.scorpiox.net
# OPENAI_API_BASE is also accepted as an alias for OPENAI_BASE_URL

# OpenAI Model (passed through to server, server decides actual model)
#OPENAI_MODEL=

# OpenAI request timeout in seconds (default: 600)
# Increase for slow models with long prefill times (e.g. large MoE models)
OPENAI_TIMEOUT=600

# =============================================================================
# Cache Keep-Alive Settings
# =============================================================================

# Auto-ping to keep Claude prompt cache alive before 5min TTL expires
# 0=disabled, 1=enabled
CACHE_KEEPALIVE=1

# Seconds before cache expiry to trigger keep-alive ping
# Default: 270 (4:30 of 5:00 TTL, giving 30s margin)
CACHE_KEEPALIVE_TRIGGER=270

# Max consecutive cache misses before pausing keepalive
# Default: 1 (pause after first miss — cache is already gone)
CACHE_KEEPALIVE_MAX_TRIES=1

# Max total keepalive pings before auto-stop (0=unlimited)
# Default: 12 (~54 minutes at 270s interval)
CACHE_KEEPALIVE_MAX_PINGS=2

# =============================================================================
# Context Window Management
# =============================================================================

# Auto-compact threshold: compact conversation when cache_read >= N tokens
# Default: 190000 (190K tokens)
CONTEXT_CLEAR_THRESHOLD=190000

# Enable auto-compact when context limit is reached (0=disabled, 1=enabled)
# When disabled, the session continues without compaction (may hit API limits)
# Default: 1
CONTEXT_AUTO_COMPACT=1

# Warn when context usage reaches this percentage of the threshold
# Shows a warning in the status bar (e.g. "CTX:80%" at 152K/190K)
# Set to 0 to disable warnings. Range: 0-99
# Default: 80
CONTEXT_WARN_THRESHOLD=80

# PowerShell bridge host (default: localhost:3001)
PWSH_HOST=localhost:3001

# =============================================================================
# scorpiox-tmux (Mission Control)
# =============================================================================

TMUX_REMOTE_HOST=
# Colon-separated base paths (first match wins).
# /codebases = local NVMe
TMUX_REMOTE_BASE=/codebases
TMUX_SMB_SHARE=
TMUX_DEFAULT_DISTRO=agentcore-latest

# Backend: "tmux" (legacy CLI) or "sxmux" (scorpiox-multiplexer)
# Auto-detect: uses tmux if installed, otherwise sxmux
TMUX_BACKEND=tmux

# Session mode: "remote" (SSH to TMUX_REMOTE_HOST) or "local" (run on this machine)
# Default: remote
TMUX_MODE=local

# Launch mode: "unshare", "podman", or "wsl" (default: unshare)
TMUX_LAUNCH_MODE=unshare

# Podman container settings (used when TMUX_LAUNCH_MODE=podman or /new <project> podman)
TMUX_PODMAN_REGISTRY=registry.scorpiox.net
TMUX_PODMAN_IMAGE=startauto:latest
TMUX_PODMAN_TLS_VERIFY=false
# Volume mount (host:container). Leave empty to auto-mount all REMOTE_BASE paths.
# Example: /codebases:/codebases (single) or leave blank for multi-path auto
TMUX_PODMAN_VOLUME_MOUNT=
TMUX_PODMAN_EXTRA_ARGS=

# Unshare container settings (used when TMUX_LAUNCH_MODE=unshare or /new <project> unshare)
# Extra CLI args passed to scorpiox-unshare (e.g. "--persist /data -p 8080:8080")
TMUX_UNSHARE_EXTRA_ARGS=
# Network mode: empty=isolated (default), "host"=share host networking
TMUX_UNSHARE_NET_MODE=
# Volume mount (host:container). Leave empty to auto-mount all REMOTE_BASE paths.
TMUX_UNSHARE_VOLUME_MOUNT=
# Bind-mount host scorpiox binaries into container (skips download)
# 1=enabled (default), 0=disabled (always download from dist)
TMUX_BIND_HOST_BINS=1

# WSL container settings (used when TMUX_LAUNCH_MODE=wsl or /new <project> wsl)
# Extra CLI args passed to scorpiox-wsl (e.g. "-p 8080:8080")
TMUX_WSL_EXTRA_ARGS=
# Volume mount (host:container). Leave empty to auto-mount all REMOTE_BASE paths.
TMUX_WSL_VOLUME_MOUNT=

# Packages to auto-install in container on startup (comma-separated)
# Auto-detects package manager (apk/apt-get/pacman).
# Skips if packages already installed. Set to "none" to disable.
# Packages baked into agentcore image. Set to "none" to skip.
CONTAINER_PACKAGES=none

# =============================================================================
# MCP (Model Context Protocol) Settings
# =============================================================================

# MCP Master Switch (0=disabled, 1=enabled)
# When enabled, MCP server tools are discovered and added alongside built-in tools
MCP=0

# MCP Server definitions (semicolon-separated for multiple servers)
# Format: name:command:arg1,arg2
# Examples:
#   MCP_SERVER=devkit:/root/.claude/devkit-linux-x64
#   MCP_SERVER=devkit:/root/.claude/devkit-linux-x64;fs:npx:-y,@anthropic/mcp-filesystem,/home
MCP_SERVER=

# External MCP config file (standard mcp_servers.json format)
# Leave empty to use MCP_SERVER definitions above
# If both set, MCP_CONFIG takes precedence for server definitions
MCP_CONFIG=

# External .mcp file path (set by scorpiox-agent for agent tasks)
# Leave empty for normal usage
MCP_FILE=

# MCP tool allow patterns (semicolon-separated, glob syntax)
# Format: server:pattern1,pattern2
# If empty, all discovered tools are allowed
# Examples:
#   MCP_ALLOW=devkit:mailing_tool_*
#   MCP_ALLOW=devkit:mailing_tool_*,git_smart_commit_*;fs:*
MCP_ALLOW=

# MCP tool deny patterns (overrides allow, semicolon-separated)
# Format: server:pattern1,pattern2
# Examples:
#   MCP_DENY=devkit:*shutdown*,*delete*
MCP_DENY=

# MCP Server Name (used in initialize handshake response)
# Default: scorpiox-server
MCP_SERVER_NAME=

# MCP Tool Exclude patterns (comma-separated globs)
# Scripts matching these patterns will NOT be registered as MCP tools
# Supports * (any chars) and ? (single char) wildcards
#   MCP_TOOL_EXCLUDE=helper-*,setup,*.bak
MCP_TOOL_EXCLUDE=

# =============================================================================
# Claude Code Token (SSH source)
# =============================================================================

# SSH credentials for fetching Claude Code token from remote machine
# Used when CLAUDE_CODE_TOKEN_SOURCE=ssh
CLAUDE_CODE_SSH_HOST=
CLAUDE_CODE_SSH_PORT=
CLAUDE_CODE_SSH_USER=
CLAUDE_CODE_SSH_PASS=

# HTTP endpoint for fetching Claude Code token
# Used when CLAUDE_CODE_TOKEN_SOURCE=http
CLAUDE_CODE_REMOTE_URL=https://token.scorpiox.net/claude

# =============================================================================
# Shared TCP Token Settings (used by all providers when TOKEN_SOURCE=tcp)
# =============================================================================

# TCP endpoint for fetching tokens (raw socket, no HTTP/SSL)
TCP_HOST=203.184.53.244
TCP_PORT=9800
TCP_API_KEY=

# Token server (TCP-to-HTTP bridge, runs on proxy server)
# Used by: scorpiox-server-fetchtoken
FETCHTOKEN_LISTEN_PORT=9800

# Claude Code API base domain (default: api.anthropic.com)
# Only the domain name — path /v1/messages is appended automatically
CLAUDE_CODE_API_URL=api.anthropic.com

# Claude Code Proxy (transparent reverse proxy to Anthropic)
# Only the domain name — path /v1/messages is appended automatically
# host: api.anthropic.com header is always sent regardless of proxy domain
CLAUDE_CODE_PROXY_URL=anthropic.scorpiox.net

# Enable proxy (1=use proxy, 0=direct to Anthropic)
CLAUDE_CODE_PROXY_ENABLED=0

# Strict proxy mode (1=fail if proxy down, 0=fallback to direct Anthropic)
CLAUDE_CODE_PROXY_STRICT=0

# =============================================================================
# Codex Token Configuration
# =============================================================================

# Codex token source (only used when PROVIDER=codex)
# local = Read from ~/.codex/auth.json
# http  = Fetch from HTTP endpoint (CODEX_REMOTE_URL)
# ssh   = Fetch via SSH from remote machine (CODEX_SSH_*)
# tcp   = Fetch via raw TCP socket (TCP_HOST:TCP_PORT)
CODEX_TOKEN_SOURCE=tcp

# SSH credentials for fetching Codex token from remote machine
# Used when CODEX_TOKEN_SOURCE=ssh
CODEX_SSH_HOST=
CODEX_SSH_PORT=
CODEX_SSH_USER=
CODEX_SSH_PASS=

# HTTP endpoint for fetching Codex token
# Used when CODEX_TOKEN_SOURCE=http
CODEX_REMOTE_URL=https://token.scorpiox.net/codex

# =============================================================================
# Email Settings (SMTP)
# =============================================================================

# SMTP server hostname (e.g. smtp.gmail.com, smtp.office365.com)
SMTP_HOST=

# SMTP port (587 = STARTTLS, 465 = SSL, 25 = plain)
SMTP_PORT=587

# SMTP authentication credentials
SMTP_USER=
SMTP_PASS=

# Sender address (From: header)
SMTP_FROM=

# Encryption: starttls, ssl, none
SMTP_TLS=starttls

# =============================================================================
# Container Image Distribution
# =============================================================================

# Base URL for container images (used by scorpiox-unshare and scorpiox-wsl)
IMAGE_BASE_URL=https://dist.scorpiox.net/container-images/

# Self-update URL for scorpiox-wsl
UPDATE_URL=https://dist.scorpiox.net/executables/scorpiox-wsl.exe

# Examples:

# =============================================================================
# Podman Standalone (scorpiox-podman)
# =============================================================================

# Container registry for scorpiox-podman
SCORPIOX_REGISTRY=registry.scorpiox.net

# SCORPIOX_DIST_BASE_URL - Base URL for scorpiox distribution (without branch)
#   Branch is resolved automatically from SCORPIOX_INDEX_URL at runtime.
#   Final URL: <base>/<branch>/scorpiox_code.tar.gz
SCORPIOX_DIST_BASE_URL=https://dist.scorpiox.net/scorpiox

# SCORPIOX_INDEX_URL - URL to index.txt that contains the default branch name
#   Fetched once at startup, cached for session lifetime.
#   If unreachable, falls back to branch "sx".
SCORPIOX_INDEX_URL=https://dist.scorpiox.net/scorpiox/index.txt

# SCORPIOX_DIST_FILENAME - Platform-specific distribution filename
#   Default is auto-detected at compile time:
#     Linux x86_64:  scorpiox_code.tar.gz
#     Linux ARM64:   scorpiox_code_arm64.tar.gz
#     macOS:         scorpiox_code_macos.tar.gz
#     Windows:       scorpiox_code_windows.zip
#   Override when local arch differs from target (e.g. SSH to ARM64 from x86).
SCORPIOX_DIST_FILENAME=scorpiox_code.tar.gz

# =============================================================================
# Usage Tracking Settings
# =============================================================================

# Enable/disable token usage tracking (0=disabled, 1=enabled)
# When enabled, scorpiox-usage posts token counts to the usage API after each API call
USAGE_TRACKING=0

# Usage API endpoint (override default)
# Default: https://code.scorpiox.net/usage-send
USAGE_API_URL=https://code.scorpiox.net/usage-send

# Enable/disable session event telemetry (0=disabled, 1=enabled)
# When enabled, scorpiox-emit-session posts full conversation messages
# (user prompts, assistant responses, tool calls) to the emit session API.
# DISABLED by default because it transmits actual conversation content.
EMIT_SESSION_TRACKING=0

# Emit Session API endpoint (override default)
# Default: https://code.scorpiox.net/sessions-send
EMIT_SESSION_API_URL=https://code.scorpiox.net/sessions-send

# =============================================================================
# Bash Permissions (scorpiox-askuserpermission)
# =============================================================================

# Require user approval before executing Bash/BackgroundBash commands
# 0=disabled (default, all commands run immediately), 1=enabled (prompt user)
PERMISSIONS_BASH=0

# Commands auto-approved without prompting (comma-separated glob patterns)
# Matched against each segment of piped/chained commands
# Wildcards: * (match any), prefix match
# Examples: ls*,cat *,pwd,git status*,grep*,find *,head *,tail *,wc*
PERMISSIONS_BASH_ALLOW=

# Commands always denied (overrides allow, comma-separated glob patterns)
# If any segment of a piped/chained command matches, entire command is rejected
# Examples: rm -rf*,shutdown*,reboot*,mkfs*,dd if=*
PERMISSIONS_BASH_DENY=

# =============================================================================
# Event Hook System (scorpiox-hook)
# =============================================================================

# Enable/disable hook execution (0=disabled, 1=enabled)
# When enabled, scripts in .scorpiox/hooks/<event>/ run on lifecycle events
HOOKS_ENABLED=1

# Timeout for sync hooks in seconds (async hooks have no timeout)
HOOKS_TIMEOUT=30

# =============================================================================
# WhatsApp Channel (scorpiox-whatsapp)
# =============================================================================

# Bridge binary path override (auto-downloads from dist.scorpiox.net if empty)
WA_BRIDGE_PATH=

# Auto-update bridge binary: on-demand | always | off
WA_BRIDGE_AUTO_UPDATE=on-demand

# Auth directory for WhatsApp session
WA_AUTH_DIR=.scorpiox/whatsapp/auth

# Inbox directory for received messages
WA_INBOX_DIR=.scorpiox/whatsapp/inbox

# Default tmux session for listen mode
WA_LISTEN_SESSION=

# =============================================================================
# WASM Proxy Settings
# =============================================================================

# WASM API Proxy URL (only used in WASM builds)
# When set, ALL outbound HTTP requests are routed through this proxy.
# The proxy receives the original request with an X-Target-URL header.
# This solves mixed-content (http from https) and CORS issues.
# Example: /api/sx-proxy (same-origin relative URL)
WASM_API_PROXY=/api/platform/websites/wasm_scorpiox_proxy

# =============================================================================
# Voice Transcription Settings
# =============================================================================

# Whisper API endpoint for voice transcription
# POST raw WAV bytes with Content-Type: application/octet-stream
# Response: {"text": "transcribed text", "elapsed": 1.2, "language": "en"}
VOICE_WHISPER_URL=https://whisper.scorpiox.net/


# =============================================================================
# TLS / SSL Verification
# =============================================================================
# Verify SSL certificates for all outbound HTTPS requests (defense-in-depth).
# 1 = verify (default, recommended). Sets CURLOPT_SSL_VERIFYPEER=1, VERIFYHOST=2.
# 0 = skip verification (dev/test only — insecure!).
SX_TLS_VERIFY=1


# =============================================================================
# HTTP Relay (route all HTTP through TCP relay server)
# =============================================================================
# When enabled, client sends serialized HTTP over plain TCP to relay server.
# Eliminates libcurl/TLS/cert dependencies on the client side.
HTTP_RELAY=0
HTTP_RELAY_HOST=relay.scorpiox.net
HTTP_RELAY_PORT=9801
HTTP_RELAY_KEY=

# =============================================================================
# Server JWT Authentication (scorpiox-server)
# =============================================================================

# HMAC-SHA256 secret for JWT validation.
# If starts with / or ./ -> reads secret from that file path.
# Otherwise treated as inline secret string.
# Empty = JWT validation disabled (scripts decide auth).
SERVER_JWT_SECRET=

# Expected JWT issuer claim (iss). Empty = skip issuer check.
SERVER_JWT_ISSUER=

# Expected JWT audience claim (aud). Empty = skip audience check.
SERVER_JWT_AUDIENCE=

# Cookie name to extract JWT from (browser clients).
# Bearer token from Authorization header is always checked first.
# Empty = no cookie extraction (Bearer header only).
SERVER_JWT_COOKIE=

# Custom claim-to-environment-variable mappings (comma-separated pairs).
# Format: claim_name=ENV_VAR_NAME,claim_name2=ENV_VAR_NAME2
# Built-in mappings (always active): sub->X_USER_ID, email->X_USER_EMAIL
# Array claims are joined with commas: ["admin","git"] -> "admin,git"
# Example: permissions=X_USER_PERMISSIONS,role=X_USER_ROLE,name=X_USER_NAME
SERVER_JWT_CLAIMS=

# Route prefixes requiring authentication (comma-separated).
# Unauthenticated requests to these prefixes get 401 or redirect.
# Empty = no enforcement (scripts decide).
# Example: /admin,/api/private,/dashboard
SERVER_JWT_PROTECT=

# Login URL for browser clients hitting protected routes without auth.
# If set and Accept header contains text/html -> 302 redirect to this URL.
# Otherwise -> 401 JSON {"error":"unauthorized"}.
SERVER_JWT_LOGIN_URL=

# ── Config profiles ───────────────────────────────────────────────
# Active named profile. Profiles are KEY=VALUE files stored in a
# scorpiox-env/ directory next to any scorpiox-env.txt in the cascade
# (exe dir, ~/.claude/, .scorpiox/). The active profile loads as the
# highest config tier and only overrides the keys it defines.
# Switch at runtime with /profile <name>; empty = no profile.
ACTIVE_PROFILE=
