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,75 @@
"""Tests for the memory viewer graph HTTP API.
Focused on the preset-protection contract: the seeded fixed branches and
root must not be deletable through the public DELETE endpoint, and the
``/api/graph/presets`` endpoint must surface the same set the backend
guards (single source of truth for the JS UI).
"""
from __future__ import annotations
import pytest
try:
import flask # noqa: F401
_HAS_FLASK = True
except ImportError:
_HAS_FLASK = False
from src.jarvis.memory.graph import FIXED_BRANCH_IDS, GraphMemoryStore
@pytest.mark.unit
@pytest.mark.skipif(not _HAS_FLASK, reason="Flask not available")
class TestGraphPresetProtection:
"""End-to-end coverage for non-deletable preset nodes via Flask."""
@pytest.fixture(autouse=True)
def setup_app(self, tmp_path):
from src.desktop_app import memory_viewer
db_path = str(tmp_path / "test.db")
store = GraphMemoryStore(db_path)
# Inject the store directly so we don't need to patch _get_db_path.
memory_viewer._graph_store = store
memory_viewer.app.config["TESTING"] = True
self.client = memory_viewer.app.test_client()
self.store = store
yield
store.close()
memory_viewer._graph_store = None
def test_presets_endpoint_lists_root_and_fixed_branches(self):
resp = self.client.get("/api/graph/presets")
assert resp.status_code == 200
ids = set(resp.get_json()["ids"])
assert ids == {"root", *FIXED_BRANCH_IDS}
def test_delete_root_returns_400(self):
resp = self.client.delete("/api/graph/node/root")
assert resp.status_code == 400
assert "root" in resp.get_json()["error"].lower()
assert self.store.get_node("root") is not None
def test_delete_fixed_branch_returns_400(self):
for branch_id in FIXED_BRANCH_IDS:
resp = self.client.delete(f"/api/graph/node/{branch_id}")
assert resp.status_code == 400, (
f"DELETE on fixed branch {branch_id!r} must be rejected"
)
assert resp.get_json()["error"] == "Cannot delete preset branch"
assert self.store.get_node(branch_id) is not None
def test_delete_user_created_node_succeeds(self):
node = self.store.create_node(
name="Scratch", description="d", parent_id="root"
)
resp = self.client.delete(f"/api/graph/node/{node.id}")
assert resp.status_code == 200
assert resp.get_json() == {"success": True}
assert self.store.get_node(node.id) is None