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,50 @@
"""Format the current time for injection into the LLM system context.
Prefers the user's local timezone (derived from location) so the assistant can
answer "what time is it?" in the form the user expects, instead of UTC.
"""
from datetime import datetime, timezone
from typing import Optional
try:
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
except ImportError: # pragma: no cover - Python < 3.9
ZoneInfo = None # type: ignore[assignment]
ZoneInfoNotFoundError = Exception # type: ignore[assignment,misc]
_UTC_FORMAT = "%A, %B %d, %Y at %H:%M UTC"
_LOCAL_FORMAT = "%A, %B %d, %Y at %H:%M %Z"
def format_time_context(
tz_name: Optional[str] = None,
*,
now_utc: Optional[datetime] = None,
) -> str:
"""Return a human-readable string describing the current time.
Resolution order:
1. ``tz_name`` via ``zoneinfo`` (when GeoIP exposes an IANA zone).
2. The OS local timezone (``datetime.astimezone()``).
3. UTC, as a last resort when neither zone can be named.
"""
now = now_utc if now_utc is not None else datetime.now(timezone.utc)
if tz_name and ZoneInfo is not None:
try:
local = now.astimezone(ZoneInfo(tz_name))
if local.tzname():
return local.strftime(_LOCAL_FORMAT)
except (ZoneInfoNotFoundError, KeyError, ValueError):
pass
try:
system_local = now.astimezone()
if system_local.tzname():
return system_local.strftime(_LOCAL_FORMAT)
except (ValueError, OSError):
pass
return now.strftime(_UTC_FORMAT)