Watch
0
0
Fork
You've already forked hyperhive
0

remove the agent's live terminal page and the endpoints only it used

This commit is contained in:
iris 2026-11-16 04:31:36 +01:00 • committed by mara
commit 6289b8d64b

View file

@ -1,32 +1,15 @@
//! Logout handler (`/api/logout`). The agent has no login flow of its own:
//! credentials come from the swarm's secret store (`claude_credentials`).
use axum::{
extract::State,
response::{IntoResponse, Response},
};
//! The logout the swarm login watch drives. The agent has no login flow of
//! its own: credentials come from the swarm's secret store
//! (`claude_credentials`).
use crate::events::Bus;
use crate::login::LoginState;
use super::{AppState, LoginStateCell};
use super::LoginStateCell;
/// Operator-driven `/logout`: SIGINT claude, delete the credential
/// files (via [`crate::login::clear_session`]), flip `LoginState::NeedsLogin`.
/// The turn loop's next iteration parks into `wait_for_login` which
/// resumes when a fresh credentials file appears (the swarm login stores
/// one and `claude_credentials` installs it).
/// Always returns 200 with a body describing what happened. See
/// `docs/4-implementation/web-ui/agent-page.md::Per-agent endpoints`
/// (the `/api/logout` bullet) for the three-step rationale +
/// preservation invariants.
pub(super) async fn post_logout(State(state): State<AppState>) -> Response {
let said = force_logout(&state.login, &state.bus, "operator: /logout").await;
(axum::http::StatusCode::OK, format!("ok: {said}")).into_response()
}
/// The three steps of a logout, shared by `/api/logout` and the swarm login
/// watch: `by` heads the Note. Returns what was wiped, for the response.
/// The three steps of a logout, run by the swarm login watch: SIGINT claude, delete
/// the credential files (via [`crate::login::clear_session`]) and flip
/// `LoginState::NeedsLogin`; `by` heads the Note. Returns what was wiped, for the response.
pub(crate) async fn force_logout(login: &LoginStateCell, bus: &Bus, by: &str) -> String {
// Step 1: SIGINT claude (best-effort, matches `post_cancel_turn`).
let _ = super::sigint_claude();