feat(qa): remote NIM provider + headless-QA robustness

Enable autonomous QA through a remote OpenAI-compatible provider (NVIDIA NIM)
and harden the tool/approval path so unattended multi-stage runs complete.

- inference: add openai_compat provider (Bearer chat-completions for NIM/OpenAI),
  dispatched by provider type "nim"/"openai"; key via api_key/api_key_env.
- server: bind configured [server] host/port instead of a hardcoded 8080;
  POST /sessions accepts an optional `intent` (WS parity) for intent-driven workflows.
- kernel: thread the bound operator profile's approval_mode into per-tool gating so
  auto/yolo enable unattended approval (engine still consulted; policy/plane-2 BLOCK
  stays terminal); on a recoverable tool failure feed the tool's arg-schema back into
  context so the model self-corrects instead of repeating a malformed call.
- tools: split deletion out of file_write into a separate, explicitly-named file_delete
  tool — a model can no longer delete a file by getting a write-mode parameter wrong.
- server: add GET /metrics/tool-reliability — per-model tool-call validity from the
  event log (measurement groundwork for capability-aware routing).
- docs: update AGENTS.md across kernel, tools, server, inference.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-29 10:50:16 +00:00
parent d26f20c316
commit 238d353653
27 changed files with 924 additions and 268 deletions
@@ -537,6 +537,8 @@ object ConfigLoader {
modelPath = modelPath,
url = url,
capabilities = capabilities,
apiKey = asString(providerMap["api_key"], ""),
apiKeyEnv = asString(providerMap["api_key_env"], ""),
)
}
@@ -173,6 +173,11 @@ data class ProviderConfig(
val modelPath: String = "",
val url: String = "http://127.0.0.1:10000",
val capabilities: Map<String, Double> = emptyMap(),
// Bearer credentials for remote providers (e.g. NVIDIA NIM). `apiKey` is the literal token;
// `apiKeyEnv` names an env var to read it from at startup (preferred — keeps the secret out
// of config files). Both are blank/unused for local providers like llamacpp.
val apiKey: String = "",
val apiKeyEnv: String = "",
)
@Serializable
@@ -113,6 +113,8 @@ object CorrexConfigWriter {
b.kv("model_path", str(p.modelPath))
b.kv("url", str(p.url))
if (p.capabilities.isNotEmpty()) b.kv("capabilities", caps(p.capabilities))
if (p.apiKey.isNotEmpty()) b.kv("api_key", str(p.apiKey))
if (p.apiKeyEnv.isNotEmpty()) b.kv("api_key_env", str(p.apiKeyEnv))
}
cfg.models.forEach { m ->