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.4 KB
Raw Blame
"""Read existing ordinary-agent authority without opening a task or chat turn."""

from __future__ import annotations

from typing import TYPE_CHECKING

from dodaios.society.events import AgentState

from .navigation_models import TravelMode

if TYPE_CHECKING:
    from dodaios.society.runtime import SocietyRuntime


class OrdinaryNavigationAuthority:
    """Logical visits need an active roster identity and respect the kill switch.

    No provider, session, capability grant, task scheduler or external tool is
    involved. Task execution continues using its separate station authority.
    """

    def __init__(self, runtime: SocietyRuntime) -> None:
        self.runtime = runtime

    async def __call__(self, agent_id: str, _destination: str, mode: TravelMode) -> bool:
        if mode is not TravelMode.PEDESTRIAN:
            return False
        return await self._active(agent_id)

    async def rover(self, agent_id: str, _destination: str, mode: TravelMode) -> bool:
        """Only the seat-bearing rover action boundary uses this capability."""
        if mode is not TravelMode.ROVER:
            return False
        return await self._active(agent_id)

    async def _active(self, agent_id: str) -> bool:
        agent = await self.runtime.roster.get(agent_id)
        return (
            agent is not None
            and agent.state is AgentState.ACTIVE
            and not await self.runtime.store.kill_switch()
        )