Add Discord-native hybrid front-end for Jarvis (bot + bridge)
Some checks failed
Release / semantic-release (push) Successful in 59s
tests / Unit tests (Linux, Python 3.11) (push) Successful in 13m45s
Release / build-linux (push) Failing after 7m47s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled

Transform isair/jarvis into a Discord-controlled voice assistant running on
the Ubuntu VNC desktop, keeping the mature ~39k-line Python brain intact.

- bot/ (Node + bun, discord.js): /자비스 slash commands (ephemeral),
  voice channel join + voice receive/playback, pluggable VNC screen broadcast
  (selfbot live / noVNC / screenshot)
- bridge/ (Python, Flask): wraps jarvis STT + run_reply_engine + Piper TTS
  behind a thin localhost HTTP API
- .env.example, scripts/ (start_bridge/start_bot/dev), README rewrite,
  docs/language-comparison.md and docs/vnc-xfce-setup.md

Language decision: hybrid (Python brain + Node/bun Discord layer) because
Discord blocks bot video; native screen broadcast only works via a Node
selfbot library.
This commit is contained in:
javis-bot
2026-06-09 14:51:05 +09:00
parent a5bf8d1826
commit c4abf63f38
308 changed files with 94135 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
"""Unit tests for the toolSearchTool builtin."""
from unittest.mock import patch
import pytest
from jarvis.tools.builtin.tool_search import ToolSearchTool
from jarvis.tools.base import ToolContext
def _ctx(cfg):
return ToolContext(
db=None,
cfg=cfg,
system_prompt="",
original_prompt="",
redacted_text="",
max_retries=0,
user_print=lambda _m: None,
language=None,
)
class TestToolSearchTool:
def test_rejects_missing_query(self, mock_config):
tool = ToolSearchTool()
result = tool.run({}, _ctx(mock_config))
assert result.success is False
assert "query" in (result.error_message or "").lower()
def test_invokes_select_tools_and_formats_list(self, mock_config):
tool = ToolSearchTool()
with patch(
"jarvis.tools.builtin.tool_search.select_tools",
return_value=["webSearch", "stop", "toolSearchTool", "getWeather"],
) as mock_sel:
result = tool.run({"query": "look up a fact"}, _ctx(mock_config))
assert mock_sel.called
assert result.success is True
text = result.reply_text or ""
# Sentinel and self are filtered out; real tools appear as
# `name: description`.
assert "webSearch" in text
assert "getWeather" in text
assert "stop" not in text.split("\n")[0]
assert "toolSearchTool" not in text.splitlines()[0]
# Each line has the colon-joined description format.
for line in text.splitlines():
assert ":" in line or line.strip() in ("webSearch", "getWeather")
def test_empty_result_returns_honest_note(self, mock_config):
tool = ToolSearchTool()
with patch(
"jarvis.tools.builtin.tool_search.select_tools",
return_value=["stop", "toolSearchTool"],
):
result = tool.run({"query": "do something"}, _ctx(mock_config))
assert result.success is True
assert "no additional tools" in (result.reply_text or "").lower()
def test_select_tools_exception_returns_error(self, mock_config):
tool = ToolSearchTool()
with patch(
"jarvis.tools.builtin.tool_search.select_tools",
side_effect=RuntimeError("router down"),
):
result = tool.run({"query": "x"}, _ctx(mock_config))
assert result.success is False
assert "router down" in (result.error_message or "")