Skip to content

Commit 5234fc8

Browse files
authored
Polish huddles UI (#1041)
1 parent 424ea70 commit 5234fc8

17 files changed

Lines changed: 1812 additions & 929 deletions

File tree

crates/buzz-core/src/kind.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ pub const KIND_PAIRING: u32 = 24134;
187187
pub const KIND_TYPING_INDICATOR: u32 = 20002;
188188
/// Ephemeral: owner-scoped encrypted agent observer telemetry and control frame.
189189
pub const KIND_AGENT_OBSERVER_FRAME: u32 = 24200;
190+
/// Ephemeral: huddle emoji reaction burst. Channel-scoped to the ephemeral
191+
/// huddle channel with an `h` tag; never stored in the timeline.
192+
pub const KIND_HUDDLE_REACTION: u32 = 24810;
190193
/// Ephemeral: mesh status report (desktop → relay). A relay member reports its
191194
/// current mesh serve availability + EndpointAddr(s) so the relay can project a
192195
/// sanitized, relay-signed kind:30621 discovery note keyed per reporter. Tagged
@@ -395,6 +398,7 @@ pub const ALL_KINDS: &[u32] = &[
395398
KIND_NIP29_GROUP_ROLES,
396399
KIND_PRESENCE_UPDATE,
397400
KIND_TYPING_INDICATOR,
401+
KIND_HUDDLE_REACTION,
398402
KIND_MESH_STATUS_REPORT,
399403
KIND_MESH_CONNECT_REQUEST,
400404
KIND_MESH_CALL_ME_NOW,

desktop/src-tauri/src/huddle/mod.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ async fn emit_end_and_archive(
427427
}
428428
}
429429
}
430+
remove_huddle_agents(ephemeral_channel_id, state).await;
430431
if !ephemeral_channel_id.is_empty() {
431432
if let Ok(uuid) = parse_channel_uuid(ephemeral_channel_id) {
432433
if let Ok(archive_builder) = events::build_archive(uuid) {
@@ -438,6 +439,38 @@ async fn emit_end_and_archive(
438439
}
439440
}
440441

442+
/// Best-effort agent removal before archiving an ended huddle.
443+
///
444+
/// Archive should make the ephemeral channel unavailable on its own, but removing
445+
/// bot-role members first prevents an agent-only huddle from lingering if the
446+
/// archive publish is delayed or rejected.
447+
async fn remove_huddle_agents(ephemeral_channel_id: &str, state: &AppState) {
448+
if ephemeral_channel_id.is_empty() {
449+
return;
450+
}
451+
let Ok(eph_uuid) = parse_channel_uuid(ephemeral_channel_id) else {
452+
return;
453+
};
454+
455+
let agent_pubkeys = match fetch_channel_members(ephemeral_channel_id, Some("bot"), state).await
456+
{
457+
Ok(pubkeys) => pubkeys,
458+
Err(e) => {
459+
eprintln!("buzz-desktop: fetch huddle agents for cleanup failed: {e}");
460+
return;
461+
}
462+
};
463+
464+
for pubkey in agent_pubkeys {
465+
let Ok(remove_builder) = events::build_remove_member(eph_uuid, &pubkey) else {
466+
continue;
467+
};
468+
if let Err(e) = submit_event(remove_builder, state).await {
469+
eprintln!("buzz-desktop: remove huddle agent {pubkey} failed: {e}");
470+
}
471+
}
472+
}
473+
441474
/// Leave the current huddle.
442475
///
443476
/// Steps:

desktop/src-tauri/src/huddle/state.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ use super::{stt, tts};
1313

1414
/// Voice input mode: push-to-talk (PTT) or voice-activity detection (VAD).
1515
///
16-
/// PTT (default): mic is gated by a global shortcut (Ctrl+Space). Pressing the
17-
/// key sets `ptt_active` and immediately cancels any playing TTS. Releasing
18-
/// the key (after a 200 ms delay) stops mic capture and flushes the utterance.
16+
/// PTT: mic is gated by a global shortcut (Ctrl+Space). Pressing the key sets
17+
/// `ptt_active` and immediately cancels any playing TTS. Releasing the key
18+
/// (after a 200 ms delay) stops mic capture and flushes the utterance.
1919
///
20-
/// VAD: the earshot VAD runs continuously and speech is accumulated whenever
21-
/// the probability exceeds the threshold. Barge-in is enabled in this mode.
20+
/// VAD (default): the earshot VAD runs continuously and speech is accumulated
21+
/// whenever the probability exceeds the threshold. Barge-in is enabled in this
22+
/// mode.
2223
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
2324
#[serde(rename_all = "snake_case")]
2425
pub enum VoiceInputMode {
25-
#[default]
2626
PushToTalk,
27+
#[default]
2728
VoiceActivity,
2829
}
2930

0 commit comments

Comments
 (0)