Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

1.3 KB
Raw Blame
"""BrainManager hides plugin tools whose CLI is connected (req 4 fallback)."""
from types import SimpleNamespace

from dodaios.brain.manager import BrainManager
from dodaios.core.bus import EventBus
from dodaios.core.config import JarvisConfig


def _mgr() -> BrainManager:
    cfg = JarvisConfig()
    cfg.brain.primary = "fake"
    return BrainManager(config=cfg, bus=EventBus(), tools={}, tool_executor=None)


def test_method_drops_plugin_when_cli_present():
    mgr = _mgr()
    tools = {
        "cli_gh": SimpleNamespace(name="cli_gh"),
        "github/list_prs": SimpleNamespace(name="github/list_prs"),
        "search_web": SimpleNamespace(name="search_web"),
    }
    out = mgr._suppress_plugins_covered_by_cli(tools)
    assert set(out) == {"cli_gh", "search_web"}


def test_method_keeps_plugin_when_cli_absent():
    mgr = _mgr()
    tools = {"github/list_prs": SimpleNamespace(name="github/list_prs")}
    assert mgr._suppress_plugins_covered_by_cli(tools) == tools


def test_method_keeps_explicit_plugin_request_when_cli_present():
    mgr = _mgr()
    tools = {
        "cli_gh": SimpleNamespace(name="cli_gh"),
        "github/get_me": SimpleNamespace(name="github/get_me"),
    }
    assert mgr._suppress_plugins_covered_by_cli(
        tools, "Use github/get_me through the GitHub plugin."
    ) == tools