//! All settings live here for now (no config file, no CLI flags).
/// Endpoint base. For now: local llama-server (start-iq3.sh, port 8085).
/// To switch back to the LiteLLM proxy: "https://api.kentonc.net" (model
/// "qwen38-iq3xxs-mtp", key "sk-1234").
pub const BASE_URL: &str = "http://127.0.0.1:8085";
/// Bearer token. llama-server ignores it; override with KENTONC_API_KEY for the proxy.
pub const API_KEY: &str = "none";
/// Model to chat with (must exist on the server: GET {BASE_URL}/v1/models).
pub const MODEL: &str = "Qwen3.8-27B-GSQ-RCO-IQ3_XXS-mtp.gguf";
/// System prompt prepended to every request.
pub const SYSTEM_PROMPT: &str = "You are a helpful assistant running in a terminal. \
You have tools to read and search files, write files, and run shell commands. \
File paths are relative to the current working directory. \
Use tools when they would help instead of guessing. \
Answers are rendered as Markdown, so use headings, lists, and bold where they help readability, \
and keep responses concise.";
pub const MAX_TOKENS: u32 = 2048;
pub const TEMPERATURE: f32 = 0.7;
/// Cap on tool round-trips within one user turn. Purely a guard against a
/// model that loops without ever answering — a real investigation legitimately
/// runs many rounds, and hitting this still keeps everything gathered so far
/// rather than throwing the turn away.
pub const MAX_TOOL_ROUNDS: usize = 50;
/// Largest image accepted on the command line (base64 inflates ~33%, so the
/// request body ends up ~1.3x this).
pub const MAX_IMAGE_BYTES: usize = 20 * 1_000_000;
/// Cap on text a single tool call may return, so one huge file or command
/// can't blow out the context window.
pub const TOOL_OUTPUT_MAX_CHARS: usize = 16_000;
/// Seconds a shell command may run before it is killed.
pub const SHELL_TIMEOUT_SECS: u64 = 60;
/// Seconds to wait for the connection to be established.
pub const CONNECT_TIMEOUT_SECS: u64 = 30;
/// Seconds a stream may go silent before we call it stalled. Generations
/// longer than this are fine as long as tokens keep arriving.
pub const READ_TIMEOUT_SECS: u64 = 120;
// ─── shell used by the run_shell tool ───────────────────────────────────────
// Windows has no `sh`, so fall back to cmd.exe there. Everything else keeps
// using `sh -c`.
#[cfg(windows)]
pub const SHELL_PROGRAM: &str = "cmd";
#[cfg(windows)]
pub const SHELL_FLAG: &str = "/C";
#[cfg(windows)]
pub const SHELL_DESC: &str = "cmd.exe (`cmd /C`)";
#[cfg(not(windows))]
pub const SHELL_PROGRAM: &str = "sh";
#[cfg(not(windows))]
pub const SHELL_FLAG: &str = "-c";
#[cfg(not(windows))]
pub const SHELL_DESC: &str = "sh (`sh -c`)";
pub fn api_key() -> String {
std::env::var("KENTONC_API_KEY").unwrap_or_else(|_| API_KEY.to_string())
}