Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 07 Jun 10:18
· 74 commits to main since this release

First step of the multi-backend MAGI integration: the magi-core crate (already
declared but unused) is now wired in, giving the agent a three-perspective
consensus
capability (Melchior / Balthasar / Caspar). Additive only — the
Provider trait, the agent loop, config discovery, and encrypted memory are
unchanged.

Added

  • consult tool — exposes magi-core's 3-perspective consensus as a tool the main LLM can invoke autonomously when a question has genuine trade-offs. Routing emerges from the existing tool loop (no separate classifier); each call passes the inline approval gate, which doubles as cost control for the ≈ 3 model calls.
  • /consult <question> command — forces a MAGI consensus directly in the TUI, bypassing the router and approval, rendering the verbatim report (three perspectives + verdict). Runs analyze in a joined task so a panic in magi-core surfaces as a recoverable error instead of killing the runner; blocks the session while it runs, like a normal turn.
  • MagiCoreProviderAdapter (src/agent/magi_adapter.rs) — bridges magi-rs's resolved Provider to magi_core::provider::LlmProvider, so the consensus reuses the same backend + credentials (Anthropic or any OpenAI-compatible endpoint). No second LLM config layer.
  • StaticProvider guardconsult is registered (and /consult works) only when a real provider is configured; on the static/no-key path the tool is absent and /consult reports that a provider is required.
  • Degraded surfacing — a consult that completes with fewer than three agents is prefixed [DEGRADED: …] so a low-quality consensus is never silent.
  • New tests for the adapter (assembled text, role-fold delimiter, error mapping), the tool (contract + consensus + invalid-args + empty-query + oversized-query + backend-error via magi-core's RoutingMockProvider), and the /consult parser + a full-report render-safety test. Total tests: 147 (was 136).

Changed

  • magi-core dependency bumped 1.01.1 (no features enabled; reqwest 0.12 is not pulled — the adapter reuses magi-rs's existing reqwest 0.11 stack). test-utils enabled as a dev-dependency for RoutingMockProvider.

Security

  • The verbatim consult report (LLM-generated) is run through sanitize_text before rendering — strips ANSI escapes / control characters, matching the streaming-delta path. Consult input is length-capped (8192 bytes) on both the tool and forced /consult paths, and empty queries are rejected before any model call.

Known limitations

  • System-prompt fold. magi-core differentiates its three personas via distinct system prompts, but magi-rs's Provider has no system-role channel yet, so the system text is folded into the user turn (behind an explicit delimiter). On weak / small local models this can weaken persona divergence and JSON adherence. Revisit when magi-rs gains a system-prompt channel.
  • CompletionConfig not applied. The adapter does not forward max_tokens / temperature to the backend (the Provider trait exposes no per-call knobs). Deferred.
  • Deferred follow-ups (internal dev-docs): repetitive-call detection keyed on the consult query argument, and an InputTooLarge early-rejection UX for oversized /consult input.

Full Changelog: v0.3.1...v0.4.0