show answered question history on dashboard

This commit is contained in:
damocles 2026-05-17 01:32:22 +02:00
parent 411cf86632
commit 6ba4241a45
4 changed files with 67 additions and 3 deletions

View file

@ -147,6 +147,8 @@ struct StateSnapshot {
/// we mark the row answered and fire `HelperEvent::OperatorAnswered`
/// into the manager's inbox.
questions: Vec<crate::operator_questions::OpQuestion>,
/// Last 20 answered questions, newest-first.
question_history: Vec<crate::operator_questions::OpQuestion>,
/// State dirs (config history + claude creds + /state/ notes) that
/// survive after a destroy-without-purge. The operator can re-spawn
/// with the same name to resume, or PURG3 to wipe them.
@ -298,6 +300,8 @@ async fn api_state(headers: HeaderMap, State(state): State<AppState>) -> axum::J
.recent_for(hive_sh4re::OPERATOR_RECIPIENT, 50),
);
let questions = log_default("questions.pending", state.coord.questions.pending());
let question_history =
log_default("questions.recent_answered", state.coord.questions.recent_answered(20));
axum::Json(StateSnapshot {
hostname,
@ -310,6 +314,7 @@ async fn api_state(headers: HeaderMap, State(state): State<AppState>) -> axum::J
meta_inputs: read_meta_inputs(),
operator_inbox,
questions,
question_history,
tombstones,
port_conflicts,
})