238d353653
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>
47 lines
2.1 KiB
Markdown
47 lines
2.1 KiB
Markdown
# apps/server
|
|
|
|
## Purpose
|
|
|
|
Ktor HTTP + WebSocket server. Exposes the orchestration kernel to CLI and TUI clients, manages session lifecycle, and streams events over WebSocket.
|
|
|
|
## Ownership
|
|
|
|
All sources under `apps/server/src/`.
|
|
|
|
## Local Contracts
|
|
|
|
### HTTP REST routes
|
|
- `GET/POST /sessions` — session browse and start (`POST` accepts an optional `intent` brief, parity with the WS `StartSession`)
|
|
- `POST /sessions/{id}/resume` — resume a session after restart
|
|
- `GET/POST /tasks` — task listing and management
|
|
- `GET/POST /providers` — provider configuration
|
|
- `GET/POST /workflows` — workflow management
|
|
- `GET /health` — health report (probes: event-store, llama-server, disk watermark)
|
|
- `GET /stats` — metrics report (MetricsProjection)
|
|
- `GET /metrics/tool-reliability` — per-model tool-call validity across the event log (`ToolReliabilityInspectionService`); groundwork for capability-aware routing
|
|
|
|
### WebSocket protocol (`/ws`)
|
|
- **ServerMessage** (server → client): sealed hierarchy — `SessionMessage` (event-derived, carries `sequence` + `sessionSequence`) and `NonEventMessage` (control/infra). Variants include session lifecycle, approval requests, clarification requests, narration, proposed workflows, health/metrics pushes.
|
|
- **ClientMessage** (client → server): `StartSession`, `ApproveToolCall`, `RejectToolCall`, `GrantApproval`, `AnswerClarification`, `SetChatMode`, and others.
|
|
- All protocol types are in `protocol/` (Dtos.kt, ServerMessage.kt, ClientMessage.kt, ProtocolSerializer.kt).
|
|
|
|
### Health monitoring
|
|
- `HealthMonitor` runs probes on a schedule; results folded via `HealthProjection` into `HealthState`.
|
|
- Adding a probe: implement `HealthProbe`, register in `ServerModule`.
|
|
|
|
## Work Guidance
|
|
|
|
- Follow Kotlin rules in root CLAUDE.md.
|
|
- Route handlers must not contain domain logic — delegate to core services injected via `ServerModule`.
|
|
- New WS message variants require updating both `ServerMessage`/`ClientMessage` sealed classes and `ProtocolSerializer`.
|
|
|
|
## Verification
|
|
|
|
```
|
|
./gradlew :apps:server:test --rerun-tasks
|
|
```
|
|
|
|
## Child DOX Index
|
|
|
|
No child AGENTS.md (leaf module).
|