mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
Replace the opencode GrokProvider with GrokCliProvider: reuses the orchestrator's shared mount/auth/git assembly (gateway + identity) exactly like the Claude path, mounts the host ~/.grok/auth.json read-only (SuperGrok subscription) instead of injecting an xAI key, and sets the slim env the grok-cli entrypoint + renderer read (ROBOCO_AGENT_ID for per-role flags, model, mcp-config, prompt). Provider routing fields are blanked before the shared step so the grok endpoint is never mislabelled ANTHROPIC_*. Per-role permission logic now lives in grok_cli_config, so the provider is slim. Registry/orchestrator/exports updated; provider tests rewritten for the CLI behavior (no XAI key, auth mount present/absent).
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""The orchestrator routes only dedicated-backend providers through the registry.
|
|
|
|
GROK gets the GrokCliProvider; Anthropic / Ollama Cloud / self-hosted (and any
|
|
unknown value) return None so ``_spawn_container`` runs its built-in Claude Code
|
|
path unchanged. This keeps the GROK addition purely additive.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import patch
|
|
|
|
from roboco.llm.providers import GrokCliProvider
|
|
from roboco.runtime.orchestrator import AgentOrchestrator
|
|
|
|
|
|
def _make_orch() -> AgentOrchestrator:
|
|
with patch.object(AgentOrchestrator, "__init__", return_value=None):
|
|
orch = AgentOrchestrator.__new__(AgentOrchestrator)
|
|
orch._provider_registry = None
|
|
return orch
|
|
|
|
|
|
def test_provider_for_grok_returns_grok_provider() -> None:
|
|
assert isinstance(_make_orch()._provider_for("grok"), GrokCliProvider)
|
|
|
|
|
|
def test_provider_for_anthropic_returns_none() -> None:
|
|
assert _make_orch()._provider_for("anthropic") is None
|
|
|
|
|
|
def test_provider_for_ollama_cloud_returns_none() -> None:
|
|
assert _make_orch()._provider_for("ollama_cloud") is None
|
|
|
|
|
|
def test_provider_for_unknown_value_returns_none() -> None:
|
|
assert _make_orch()._provider_for("bogus") is None
|
|
|
|
|
|
def test_provider_registry_built_once() -> None:
|
|
orch = _make_orch()
|
|
assert orch._ensure_provider_registry() is orch._ensure_provider_registry()
|