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
"""The ``create_artifact`` tool is offered only on a turn that asked for one.
Maintainer mandate (2026-08-11, artifacts 2026-08-23, narrowed: literal word
or Add pin only): an artifact is built when the user literally says the word
("mach ein Artefakt draus", "build me an artifact") or pins the capability
via the Add menu — never because the assistant judges an answer would look
nicer as a page. Prompt wording does not hold that line reliably, so the
enforcement is structural: on any other turn the tool is removed from the
surface and the model cannot call what it cannot see.
This pins the gate's placement in ``BrainManager``. The vocabulary itself is
tested in ``test_artifact_gate.py``; here the questions are narrower — does
the manager actually strip it, does it leave every other tool alone, and does a
fault in the gate fail OPEN (tools unchanged) rather than blinding the brain.
"""
from __future__ import annotations
from dodaios.brain.manager import BrainManager
def _mgr() -> BrainManager:
return BrainManager.__new__(BrainManager) # bypass heavy __init__
def _surface() -> dict:
return {
"create_artifact": object(), # the gated one
"navigate": object(), # opens the EXISTING gallery — never gated
"search_web": object(),
"screenshot": object(),
"spawn_worker": object(),
}
def test_an_explicit_request_keeps_the_tool():
out = _mgr()._hide_artifact_tool_without_request(
_surface(),
"mach mir ein Artefakt draus", # i18n-allow: DE test vocabulary
)
assert "create_artifact" in out
def test_a_visual_verb_alone_loses_it():
out = _mgr()._hide_artifact_tool_without_request(
_surface(),
"visualisier mir das mal", # i18n-allow: DE test vocabulary
)
assert "create_artifact" not in out
def test_an_ordinary_turn_loses_it():
out = _mgr()._hide_artifact_tool_without_request(
_surface(),
"was haben wir gerade besprochen", # i18n-allow: DE test vocabulary
)
assert "create_artifact" not in out
def test_nothing_else_is_touched():
"""The gate owns exactly one name."""
out = _mgr()._hide_artifact_tool_without_request(_surface(), "wie spät ist es")
assert set(out) == {"navigate", "search_web", "screenshot", "spawn_worker"}
def test_opening_the_gallery_does_not_draw_a_new_picture():
""" "Zeig mir die Visualisierungen" is navigate's turn, not create_artifact's.
The regression that makes this worth its own test: both features answer to
the same word, and an artifact tool left on the surface here would start a
background build instead of showing the pages already there.
"""
out = _mgr()._hide_artifact_tool_without_request(
_surface(),
"zeig mir die visualisierungen", # i18n-allow: DE test vocabulary
)
assert "create_artifact" not in out
assert "navigate" in out
def test_a_surface_without_the_tool_is_returned_untouched():
surface = {"search_web": object()}
assert _mgr()._hide_artifact_tool_without_request(surface, "hallo") is surface
def test_a_gate_fault_fails_open(monkeypatch):
"""A gate bug must never cost the brain a tool it was supposed to have."""
import dodaios.brain.artifact_gate as gate
def _boom(_text: str) -> bool:
raise RuntimeError("gate exploded")
monkeypatch.setattr(gate, "wants_artifact", _boom)
out = _mgr()._hide_artifact_tool_without_request(_surface(), "anything")
assert "create_artifact" in out
def test_a_non_dict_surface_is_passed_through():
sentinel = ["not", "a", "dict"]
assert _mgr()._hide_artifact_tool_without_request(sentinel, "mach ein Artefakt") is sentinel