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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
"""Tests for the sessions/chats commands."""
from __future__ import annotations
from typer.testing import CliRunner
from dodaios.cli_ctl.__main__ import app
runner = CliRunner()
def test_list(capture_api):
runner.invoke(app, ["sessions", "list"])
assert capture_api["calls"][-1]["path"] == "/api/chats"
def test_show(capture_api):
runner.invoke(app, ["sessions", "show", "text", "c1"])
assert capture_api["calls"][-1]["path"] == "/api/chats/text/c1"
def test_latest_turn(capture_api):
result = runner.invoke(app, ["sessions", "latest-turn"])
assert result.exit_code == 0
call = capture_api["calls"][-1]
assert call["method"] == "GET"
assert call["path"] == "/api/sessions/latest-turn"
assert call["query"] == {}
def test_latest_turn_can_be_scoped_to_session(capture_api):
result = runner.invoke(
app,
["sessions", "latest-turn", "--session-id", "voice-1"],
)
assert result.exit_code == 0
assert capture_api["calls"][-1]["query"] == {"session_id": "voice-1"}
def test_delete_requires_yes(capture_api):
assert runner.invoke(app, ["sessions", "delete", "c1"]).exit_code == 1
assert capture_api["calls"] == []
def test_delete_with_yes(capture_api):
res = runner.invoke(app, ["sessions", "delete", "c1", "--yes"])
assert res.exit_code == 0
call = capture_api["calls"][-1]
assert call["method"] == "DELETE" and call["path"] == "/api/chats/text/c1"
def test_resume_proceeds_without_yes(capture_api):
res = runner.invoke(app, ["sessions", "resume", "text", "c1"])
assert res.exit_code == 0
assert capture_api["calls"][-1]["path"] == "/api/chats/text/c1/resume"
def test_chat_control_reads_without_confirmation(capture_api):
result = runner.invoke(app, ["sessions", "control", "society:test"])
assert result.exit_code == 0
assert capture_api["calls"][-1]["path"] == "/api/agent-chat/sessions/society:test/control"
def test_chat_command_preserves_request_id_and_requires_yes(capture_api):
args = [
"sessions",
"command",
"society:test",
"goal",
"--arguments",
"Finish the task",
"--request-id",
"stable-request",
]
assert runner.invoke(app, args).exit_code == 1
assert capture_api["calls"] == []
assert runner.invoke(app, [*args, "--yes"]).exit_code == 0
call = capture_api["calls"][-1]
assert call["path"] == "/api/agent-chat/sessions/society:test/commands"
assert call["body"] == {
"command": "goal",
"arguments": "Finish the task",
"request_id": "stable-request",
}