huskies: merge 1038

This commit is contained in:
dave
2026-05-14 17:00:33 +00:00
parent 4553df5b21
commit 1f9f34ab58
13 changed files with 940 additions and 2 deletions
+23
View File
@@ -283,6 +283,17 @@ async fn main() -> Result<(), std::io::Error> {
let timer_store_for_tick = Arc::clone(&timer_store);
let timer_store_for_bot = Arc::clone(&timer_store);
// Event-based pipeline trigger store.
let event_trigger_store = std::sync::Arc::new(
crate::service::event_triggers::store::EventTriggerStore::load(
startup_root
.as_ref()
.map(|r| r.join(".huskies").join("event_triggers.json"))
.unwrap_or_else(|| std::path::PathBuf::from("/tmp/huskies-event-triggers.json")),
),
);
let event_trigger_store_for_subscriber = Arc::clone(&event_trigger_store);
// Generic scheduled-timer store for the `schedule_timer` MCP tool.
let scheduled_timer_store =
std::sync::Arc::new(crate::service::timer::ScheduledTimerStore::load(
@@ -306,6 +317,7 @@ async fn main() -> Result<(), std::io::Error> {
matrix_shutdown_tx: Some(Arc::clone(&bot_ctxs.matrix_shutdown_tx)),
timer_store,
scheduled_timer_store,
event_trigger_store,
};
// Per-project event buffer for the gateway's `/api/events` poller.
@@ -315,6 +327,9 @@ async fn main() -> Result<(), std::io::Error> {
// Gateway relay task (pushes StatusEvents to a configured gateway).
startup::tick_loop::spawn_gateway_relay(&startup_root, Arc::clone(&services.status));
// Clone ctx before it is consumed by build_routes; AppContext is cheap to clone (all Arcs).
let ctx_for_triggers = ctx.clone();
let app = build_routes(
ctx.clone(),
bot_ctxs.whatsapp_ctx.clone(),
@@ -358,6 +373,14 @@ async fn main() -> Result<(), std::io::Error> {
watcher_rx_for_discord,
);
// Event trigger subscriber: listens on TransitionFired and executes matching triggers.
startup::tick_loop::spawn_event_trigger_subscriber(
event_trigger_store_for_subscriber,
Arc::clone(&startup_agents),
startup_root.clone(),
ctx_for_triggers,
);
// Reconcile completed worktrees and auto-assign free agents.
startup::tick_loop::spawn_startup_reconciliation(
startup_root.clone(),