hive-c0re: remove the dashboard's ask/answer surface

This commit is contained in:
damocles 2026-08-29 23:20:17 +02:00
commit 47cac50e6e
8 changed files with 25 additions and 463 deletions

View file

@ -5,9 +5,17 @@
//!
//! Routing rules at a glance:
//!
//! - `Ask { to: None | Some("operator") }` → stored with `target = NULL`;
//! the dashboard's `pending()` query surfaces it; operator answers
//! via the dashboard.
//! - `Ask { to: None | Some("operator") }` → stored with `target = NULL`.
//! ⚠️ As of the ask/answer removal's dashboard-backend slice, nothing
//! surfaces or answers an operator-targeted row any more — the
//! dashboard's questions pane, its `/api/answer-question` /
//! `/api/cancel-question` endpoints, and the `pending_all()`/
//! `recent_answered_all()` reads that fed them are all gone. An
//! operator-targeted `ask()` (if anything still calls it — the MCP
//! tool itself was removed earlier in the same effort) would queue a
//! row nothing can ever resolve. Left as-is rather than special-cased,
//! since the whole `Ask`/`Answer` flow this file implements is itself
//! slated for removal next.
//! - `Ask { to: Some(<agent>) }` → stored with `target = <agent>`;
//! a `HelperEvent::QuestionAsked` is pushed into `<agent>`'s
//! inbox so they can `Answer { id, answer }` on their own socket.
@ -73,8 +81,7 @@ pub fn handle_ask(
// Agent-targeted questions need to wake the recipient — drop a
// QuestionAsked event into their inbox so the answerer doesn't
// have to poll. Operator-targeted questions show up on the
// dashboard's pending pane via `pending()` instead, plus a
// `QuestionAdded` dashboard event so the browser updates live.
// dashboard's pending pane via `pending()` instead.
if let Some(target_agent) = target {
coord.notify_agent(
target_agent,
@ -87,17 +94,6 @@ pub fn handle_ask(
},
);
}
// Always fire on the dashboard channel — both operator-targeted
// and peer threads now surface in the dashboard's questions pane.
coord.emit_question_added(&crate::coordinator::QuestionAdded {
id,
asker,
question,
options,
multi,
deadline_at,
target,
});
if let Some(t) = ttl {
spawn_question_watchdog(coord, id, t);
}
@ -115,7 +111,7 @@ pub fn handle_answer(
answer: &str,
) -> Result<(), String> {
limits::check_size("answer", answer)?;
let (question, asker, target) = coord
let (question, asker, _target) = coord
.questions
.answer(id, answer, answerer)
.map_err(|e| format!("{e:#}"))?;
@ -132,11 +128,6 @@ pub fn handle_answer(
answerer: answerer.to_owned(),
},
);
// Dashboard surfaces both operator-targeted and peer threads;
// emit unconditionally so the derived store moves the row.
// `cancelled = false` because this path is a real answer (the
// operator-cancel button goes through `post_cancel_question`).
coord.emit_question_resolved(id, answer, answerer, false, target.as_deref());
Ok(())
}
@ -160,7 +151,7 @@ pub fn handle_cancel_loose_end(
// Agent-socket path: never privileged — an agent may only cancel
// its own question (ownership). The operator's cancel-anything
// path goes through a separate handler with `privileged = true`.
let (question, asker, target) = coord
let (question, asker, _target) = coord
.questions
.cancel(id, canceller, false)
.map_err(|e| format!("{e:#}"))?;
@ -182,7 +173,6 @@ pub fn handle_cancel_loose_end(
},
);
}
coord.emit_question_resolved(id, &sentinel, canceller, true, target.as_deref());
Ok(())
}
hive_sh4re::inbox::CancelLooseEndKind::Reminder => {