rename: open_threads → loose_ends + cancel_thread → cancel_loose_end across wire / tools / web ui

This commit is contained in:
damocles 2026-05-18 18:22:49 +02:00
parent b1d0a62cb9
commit 6e23d087d2
16 changed files with 152 additions and 139 deletions

View file

@ -106,7 +106,7 @@ pub async fn serve(
.route("/api/compact", post(post_compact))
.route("/api/model", post(post_set_model))
.route("/api/new-session", post(post_new_session))
.route("/api/open-threads", get(api_open_threads))
.route("/api/loose-ends", get(api_loose_ends))
.with_state(state);
let addr = SocketAddr::from(([0, 0, 0, 0], port));
let listener = bind_with_retry(addr, "web UI").await?;
@ -240,25 +240,25 @@ struct SessionView {
exit_note: Option<String>,
}
/// Proxy this agent's open-threads via the per-agent socket. The
/// Proxy this agent's loose-ends list via the per-agent socket. The
/// web UI surfaces the result as a collapsible section in the page
/// so the operator can see at a glance what's pending against the
/// agent (questions asked by it, peer questions targeting it,
/// approvals for the manager). Same data the
/// `mcp__hyperhive__get_open_threads` tool sees from inside the
/// reminders it scheduled, approvals for the manager). Same data
/// the `mcp__hyperhive__get_loose_ends` tool sees from inside the
/// container.
async fn api_open_threads(State(state): State<AppState>) -> Response {
let threads: Vec<hive_sh4re::OpenThread> = match state.flavor() {
async fn api_loose_ends(State(state): State<AppState>) -> Response {
let loose_ends: Vec<hive_sh4re::LooseEnd> = match state.flavor() {
Flavor::Agent => {
match client::request::<_, hive_sh4re::AgentResponse>(
&state.socket,
&hive_sh4re::AgentRequest::GetOpenThreads,
&hive_sh4re::AgentRequest::GetLooseEnds,
)
.await
{
Ok(hive_sh4re::AgentResponse::OpenThreads { threads }) => threads,
Ok(hive_sh4re::AgentResponse::LooseEnds { loose_ends }) => loose_ends,
Ok(hive_sh4re::AgentResponse::Err { message }) => {
return error_response(&format!("get_open_threads: {message}"));
return error_response(&format!("get_loose_ends: {message}"));
}
Ok(other) => return error_response(&format!("unexpected response: {other:?}")),
Err(e) => return error_response(&format!("transport: {e:#}")),
@ -267,20 +267,20 @@ async fn api_open_threads(State(state): State<AppState>) -> Response {
Flavor::Manager => {
match client::request::<_, hive_sh4re::ManagerResponse>(
&state.socket,
&hive_sh4re::ManagerRequest::GetOpenThreads,
&hive_sh4re::ManagerRequest::GetLooseEnds,
)
.await
{
Ok(hive_sh4re::ManagerResponse::OpenThreads { threads }) => threads,
Ok(hive_sh4re::ManagerResponse::LooseEnds { loose_ends }) => loose_ends,
Ok(hive_sh4re::ManagerResponse::Err { message }) => {
return error_response(&format!("get_open_threads: {message}"));
return error_response(&format!("get_loose_ends: {message}"));
}
Ok(other) => return error_response(&format!("unexpected response: {other:?}")),
Err(e) => return error_response(&format!("transport: {e:#}")),
}
}
};
axum::Json(serde_json::json!({ "threads": threads })).into_response()
axum::Json(serde_json::json!({ "loose_ends": loose_ends })).into_response()
}
async fn api_state(State(state): State<AppState>) -> axum::Json<StateSnapshot> {