feat(app): M5 step 2, service control and the dashboard data

- control: one Controller starts, stops and restarts the services (stopped,
  starting, running, stopping, failed); a failed start leaves nothing
  running and keeps its error with secrets masked. The app binary uses it.
- dashboard: built from the core's events alone: the bot's tag, the voice
  channel, live captions (screen only, cleared on leaving or stopping), the
  last 20 voice answers split into stages with medians (matched by the new
  AnswerAsked event), and missed requests without text.
- system: memory in use and per NVIDIA GPU its use and VRAM (nvidia-smi).
- DiscordCore::voice_members, WorkerClient::hello, the conversation's missed
  requests shared with the dashboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 13:49:51 +09:00
parent eb0fa2f159
commit 0973ad9815
13 changed files with 799 additions and 36 deletions

View File

@@ -17,6 +17,8 @@ pub struct Services {
pub events: mpsc::UnboundedReceiver<CoreEvent>,
pub worker: WorkerClient,
pub worker_process: WorkerProcess,
/// The conversation's missed requests, for the dashboard.
pub missed: conversation::MissedLog,
}
impl Services {
@@ -66,6 +68,7 @@ pub async fn start_services(data_dir: &Path) -> Result<Services, Box<dyn std::er
// Call detection and the response policy answer what is heard; every event still reaches `events`.
let (out, events) = mpsc::unbounded_channel();
let conv = Conversation::new(core.clone(), calls, response).with_chat(chat_calls);
let missed = conv.missed_handle();
tokio::spawn(conversation::run(conv, core_events, out));
if let Err(e) = core.start().await {
worker.close();
@@ -73,5 +76,5 @@ pub async fn start_services(data_dir: &Path) -> Result<Services, Box<dyn std::er
return Err(Box::new(e));
}
crate::info_log!("app", "services started");
Ok(Services { core, events, worker, worker_process })
Ok(Services { core, events, worker, worker_process, missed })
}