Files
javis_bot/docs/language-comparison.md
javis-bot c4abf63f38
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
Add Discord-native hybrid front-end for Jarvis (bot + bridge)
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.
2026-06-09 14:51:05 +09:00

3.1 KiB

언어 선택: Python 유지 vs 재작성 — 장단점 비교

요구사항을 만족시키기 위해 "언어를 바꿀지"를 먼저 따졌습니다. 결론은 하이브리드(Python 두뇌 유지 + Node/bun Discord 레이어 신규) 입니다. 근거를 정리합니다.

결정을 좌우한 핵심 사실

  1. 디스코드 봇은 영상(Go Live)을 송출할 수 없다. Discord가 봇 계정의 영상 전송을 정책적으로 막아둠 (2026년 현재도 동일, 공식 API 변화 없음).
  2. 봇 영상 송출이 되는 라이브러리는 Node 전용이고 셀프봇(유저 토큰)을 요구한다. @dank074/discord-video-stream(v6, 2026-03 기준 유지보수 중) + discord.js-selfbot-v13. Python에는 동등한 동작 라이브러리가 없음.
  3. 기존 jarvis 두뇌는 Python 약 39,000줄(메모리 그래프·벡터스토어·planner/evaluator 답변엔진·MCP 툴·redaction·STT(faster-whisper)·TTS(piper)). 검증된 자산.
  4. 음성 입출력/슬래시 명령/ephemeral/음성채널 접속은 Python(py-cord)·Node(discord.js) 모두 가능하지만, Node 생태계가 더 성숙.

옵션별 비교

항목 A. Python 단일 유지 B. 전면 Node/bun 재작성 C. 하이브리드 (채택)
VNC 영상 송출(native) 사실상 불가 가능 가능(Node 레이어)
음성 입출력
슬래시/ephemeral (더 성숙)
기존 두뇌 재사용 그대로 39k줄 재작성 그대로
작업량/리스크 중(영상 막힘) 매우 큼/높음 작음/낮음
유지보수 단일 언어 단일 언어 2개 런타임(경계 단순)
  • A 탈락: 핵심 요구(디스코드 화면 방송)를 만족 못 함.
  • B 탈락: 성숙한 두뇌를 버리고 수 주간 재작성. 회귀·버그 위험 큼. 이득(언어 통일)이 비용보다 작음.
  • C 채택: 영상이 가능한 Node로 "디스코드/음성/영상 인터페이스"만 새로 짜고, 두뇌는 Python 그대로 둔 뒤 얇은 HTTP 브릿지로 연결.

하이브리드 경계 설계

Discord  ──voice/video/slash──▶  bot/ (Node + bun, discord.js)
                                   │  HTTP (localhost)
                                   ▼
                               bridge/ (Python, Flask)
                                   │  in-process import
                                   ▼
                               src/jarvis (기존 두뇌)
  • 경계는 단 하나(HTTP localhost). 직렬화는 WAV(오디오) + JSON(텍스트)뿐이라 단순.
  • Node는 AI 로직을 일절 갖지 않음 → 두 런타임의 책임이 깨끗하게 분리.

Node 채택부의 bun 적극 활용

  • 패키지 매니저/런타임 모두 bun 사용 (bun install, bun run).
  • TypeScript를 트랜스파일 없이 직접 실행(bun run src/index.ts).
  • 네이티브 의존(@discordjs/opus, video-stream의 node-av/node-datachannel)은 bun에서 install 스크립트 허용 필요 → 본 레포는 무거운 네이티브 의존을 optionalDependencies로 분리해 기본 설치를 가볍게 유지.