feat: externalize LLM providers and tool enable flags via config

Adds ProviderConfig + providers list and per-tool enabled flags to
CorrexConfig, and rewires apps/server/Main to build the provider list
from config instead of the hardcoded buildLlamaProvider() factory. Env
vars (CORREX_MODEL_ID, CORREX_MODEL_PATH, CORREX_LLAMA_URL) remain a
fallback only when no providers are declared in config.

Completes slice A of the config layer alongside commit 0834c70 which
already shipped the TOML parser upgrade and sample config — those
parser changes referenced these types but were committed prematurely
in isolation; this commit makes HEAD buildable.
This commit is contained in:
2026-05-30 01:15:55 +04:00
parent 0834c705fd
commit 84a7568e15
2 changed files with 89 additions and 14 deletions
@@ -9,6 +9,7 @@ data class CorrexConfig(
val cli: CliConfig = CliConfig(),
val approval: ApprovalConfig = ApprovalConfig(),
val tools: ToolsConfig = ToolsConfig(),
val providers: List<ProviderConfig> = emptyList(),
)
@Serializable
@@ -39,4 +40,18 @@ data class ToolsConfig(
val workingDir: String = "",
val shellAllowedExecutables: List<String> = emptyList(),
val defaultSystemPromptPath: String = "~/.config/correx/prompts/default_system.md",
val shellEnabled: Boolean = true,
val fileReadEnabled: Boolean = true,
val fileWriteEnabled: Boolean = true,
val fileEditEnabled: Boolean = true,
)
@Serializable
data class ProviderConfig(
val id: String,
val type: String,
val modelId: String,
val modelPath: String = "",
val url: String = "http://127.0.0.1:10000",
val capabilities: Map<String, Double> = emptyMap(),
)