- app/ (Electron 45 + TypeScript): the core joins one voice channel, decodes each speaker's Opus to 48 kHz stereo and streams it to the voice worker, sends speaking_end and speaker_leave, and emits speech_start/partial/final with the speaker's display name. - Sentence playback from the worker's TTS, first come first served, with stop that silences the clip at once and cancels unfinished requests; slash command join/leave/stop (create-or-update by name). - Transcription notice posted on every join; other bots ignored by default; at most maxSpeakers people transcribed at once. - Registered chat channels: live message events, history reads, sends split at 2,000 characters with mentions disabled; Message Content intent checked before login. - The app starts the Python voice worker with a fresh token in the environment, restarts it with backoff, and the worker client reconnects and fails in-flight TTS on a lost connection. - Spec in app/src/core/discord_core.spec.md; Vitest unit tests, a protocol test against the real Python worker server with fake engines, and an opt-in live test with two bots on real Discord. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
722 B
TypeScript
24 lines
722 B
TypeScript
/** Run the app's services without Electron (development and tests): node dist/cli.js <data folder> */
|
|
import { errorLog } from "./core/log.js";
|
|
import { startServices } from "./services.js";
|
|
|
|
const dataDir = process.argv[2] ?? process.env.JARVIS_DATA_DIR;
|
|
if (!dataDir) {
|
|
errorLog("usage: node dist/cli.js <data folder> (or set JARVIS_DATA_DIR)");
|
|
process.exit(2);
|
|
}
|
|
|
|
startServices(dataDir).then((services) => {
|
|
let stopping = false;
|
|
const stop = () => {
|
|
if (stopping) return;
|
|
stopping = true;
|
|
void services.stop().finally(() => process.exit(0));
|
|
};
|
|
process.on("SIGINT", stop);
|
|
process.on("SIGTERM", stop);
|
|
}, (e: Error) => {
|
|
errorLog(`could not start: ${e.message}`);
|
|
process.exit(1);
|
|
});
|