M0: 기술 검증 - 구조 설계, STT 워커, 앱 코어, 게임 PC 진단

- docs/dev/ARCHITECTURE.md: 코어-워커-사이트 인터페이스 계약
- worker/: faster-whisper 한국어 STT, 음량 정규화, 4단계 잡음 판정, 사전 교정, GPU 감지·모델/CUDA 다운로드, 롤 채팅 OCR·r3dlog, 파인튜닝 파이프라인 (39 tests)
- app/src/core: 디스코드 DAVE 음성 녹음(Ogg Opus), STT 대기열, 발로란트/롤 로컬 API 어댑터, 타임라인·기록 API, 사이트 중계, 7일 음성 삭제, 진단
- tools/gen-dictionary.mjs: 공식 게임 데이터 기반 기본 단어사전 (1993단어)
- M0 결과: DAVE 연결 1.06s Ready, CPU tiny STT 3.6s→0.31s, 가짜 Riot 서버 통합 테스트 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 01:17:48 +09:00
parent 4596989ba7
commit 7c9146cd2d
95 changed files with 18435 additions and 0 deletions

16
app/scripts/vc-list.mts Normal file
View File

@@ -0,0 +1,16 @@
import { Client, GatewayIntentBits, ChannelType } from 'discord.js';
import fs from 'node:fs';
const s = JSON.parse(fs.readFileSync('/home/claude/.config/ejclaw/secrets.json', 'utf8')).credentials['discord.com/bot/game-voice-recorder'];
const c = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates] });
c.once('clientReady', async () => {
const g = c.guilds.cache.first()!;
console.log('guild', g.name, g.id, 'members', g.memberCount);
for (const ch of g.channels.cache.values()) {
if (ch.type === ChannelType.GuildVoice) {
const perms = ch.permissionsFor(c.user!)!;
console.log(ch.id, ch.name, 'members:', [...ch.members.values()].map((m) => m.displayName + (m.user.bot ? '(bot)' : '')).join(','), 'connect', perms.has('Connect'), 'speak', perms.has('Speak'));
}
}
await c.destroy();
});
await c.login(s.token);

View File

@@ -0,0 +1,50 @@
// M0 검증: 겜녹이 봇이 DAVE(E2EE) 음성채널에 실제로 붙는지, TTS 안내를 재생하는지, (말하는 사람이 있으면) 유저별 수신이 되는지.
// node --import tsx scripts/voice-smoke.mts <channelId> [seconds]
import { Client, GatewayIntentBits } from 'discord.js';
import { joinVoiceChannel, entersState, VoiceConnectionStatus, createAudioPlayer, createAudioResource, StreamType, AudioPlayerStatus, EndBehaviorType } from '@discordjs/voice';
import fs from 'node:fs';
import path from 'node:path';
import { OggOpusWriter } from '../src/core/discord/ogg.ts';
const chId = process.argv[2];
const secs = Number(process.argv[3] || 10);
const outDir = process.env.OUT_DIR || path.resolve('.voice-smoke');
fs.mkdirSync(outDir, { recursive: true });
const token = process.env.GVR_BOT_TOKEN || JSON.parse(fs.readFileSync('/home/claude/.config/ejclaw/secrets.json', 'utf8')).credentials['discord.com/bot/game-voice-recorder'].token;
const c = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates] });
c.once('clientReady', async () => {
const ch: any = await c.channels.fetch(chId);
console.log('channel', ch.name);
const t0 = Date.now();
const conn = joinVoiceChannel({ channelId: ch.id, guildId: ch.guild.id, adapterCreator: ch.guild.voiceAdapterCreator, selfDeaf: false, selfMute: false, daveEncryption: true });
conn.on('stateChange', (o, n) => console.log(`state ${o.status} -> ${n.status} (+${Date.now() - t0}ms)`));
try {
await entersState(conn, VoiceConnectionStatus.Ready, 20000);
} catch (e) {
console.log('FAIL: not ready', e);
process.exit(2);
}
const net: any = (conn.state as any).networking?.state;
console.log('READY in', Date.now() - t0, 'ms; encryption mode:', net?.connectionData?.encryptionMode, '; DAVE protocol:', net?.dave?.protocolVersion ?? net?.dave?.session?.protocolVersion ?? 'n/a');
const player = createAudioPlayer();
conn.subscribe(player);
player.play(createAudioResource(fs.createReadStream(path.resolve('resources/tts/announce-default.webm')), { inputType: StreamType.WebmOpus }));
await entersState(player, AudioPlayerStatus.Playing, 5000).then(() => console.log('TTS playing')).catch(() => console.log('TTS did not start'));
const got: Record<string, number> = {};
conn.receiver.speaking.on('start', (uid) => {
if (conn.receiver.subscriptions.has(uid)) return;
const w = new OggOpusWriter(path.join(outDir, `${uid}-${Date.now()}.ogg`));
const s = conn.receiver.subscribe(uid, { end: { behavior: EndBehaviorType.AfterSilence, duration: 800 } });
s.on('data', (p: Buffer) => {
got[uid] = (got[uid] || 0) + 1;
w.write(p);
});
s.once('end', () => w.close());
});
await new Promise((r) => setTimeout(r, secs * 1000));
console.log('received packets per user:', JSON.stringify(got));
conn.destroy();
await c.destroy();
process.exit(0);
});
await c.login(token);