huskies: merge 643_story_web_ui_consumer_for_the_unified_status_broadcaster

This commit is contained in:
dave
2026-04-26 11:26:20 +00:00
parent f88bb5f486
commit 8673e563a9
13 changed files with 375 additions and 25 deletions
+16
View File
@@ -9,6 +9,7 @@ use crate::io::onboarding;
use crate::io::watcher::WatcherEvent;
use crate::io::wizard;
use crate::log_buffer;
use crate::service::status::Subscription;
use std::sync::Arc;
use tokio::sync::{broadcast, mpsc};
@@ -116,6 +117,21 @@ pub fn subscribe_watcher(
});
}
/// Spawn a background task that forwards status broadcaster events to the client.
///
/// Each [`StatusEvent`](crate::service::status::StatusEvent) is delivered as a
/// [`WsResponse::StatusUpdate`] with the structured event fields intact, so the
/// frontend can do per-type presentation without parsing strings.
pub fn subscribe_status(tx: mpsc::UnboundedSender<WsResponse>, mut subscription: Subscription) {
tokio::spawn(async move {
while let Some(event) = subscription.recv().await {
if tx.send(WsResponse::StatusUpdate { event }).is_err() {
break;
}
}
});
}
/// Spawn a background task that forwards reconciliation events to the client.
pub fn subscribe_reconciliation(
tx: mpsc::UnboundedSender<WsResponse>,
+10
View File
@@ -8,6 +8,7 @@ use crate::http::workflow::{PipelineState, UpcomingStory};
use crate::io::watcher::WatcherEvent;
use crate::llm::chat;
use crate::llm::types::Message;
use crate::service::status::StatusEvent;
use serde::{Deserialize, Serialize};
/// WebSocket request messages sent by the client.
@@ -153,6 +154,15 @@ pub enum WsResponse {
level: String,
message: String,
},
/// A structured pipeline status event forwarded from the status broadcaster.
///
/// The structured [`StatusEvent`] fields are preserved on the wire so
/// frontend consumers can do per-type presentation without parsing strings.
/// This frame intentionally does NOT call `format_status_event` — that
/// formatter is reserved for chat transports (story 644).
StatusUpdate {
event: StatusEvent,
},
}
// ── Domain event conversions ────────────────────────────────────────────────
+1 -1
View File
@@ -20,6 +20,6 @@ pub use dispatch::{
};
pub use io::{
check_onboarding, load_initial_pipeline_state, load_recent_logs, load_wizard_state,
subscribe_logs, subscribe_reconciliation, subscribe_watcher,
subscribe_logs, subscribe_reconciliation, subscribe_status, subscribe_watcher,
};
pub use message::{WizardStepInfo, WsResponse};