Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b38805c00 | ||
|
|
59412452af |
1 changed files with 21 additions and 9 deletions
|
|
@ -129,21 +129,22 @@ pub fn format_recv(resp: Result<SocketReply, anyhow::Error>) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format helper for `get_loose_ends`: renders a short bulleted list
|
/// Format helper for `get_loose_ends`: renders a short bulleted list
|
||||||
/// of pending approvals + questions. Empty list collapses to a clear
|
/// of pending approvals + questions + reminders. Empty list collapses
|
||||||
/// marker so claude doesn't go hunting for a payload that isn't there.
|
/// to a clear marker so claude doesn't go hunting for a payload that
|
||||||
|
/// isn't there.
|
||||||
pub fn format_loose_ends(resp: Result<SocketReply, anyhow::Error>) -> String {
|
pub fn format_loose_ends(resp: Result<SocketReply, anyhow::Error>) -> String {
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
let threads = match resp {
|
let loose_ends = match resp {
|
||||||
Ok(SocketReply::LooseEnds(t)) => t,
|
Ok(SocketReply::LooseEnds(t)) => t,
|
||||||
Ok(SocketReply::Err(m)) => return format!("get_loose_ends failed: {m}"),
|
Ok(SocketReply::Err(m)) => return format!("get_loose_ends failed: {m}"),
|
||||||
Ok(other) => return format!("get_loose_ends unexpected response: {other:?}"),
|
Ok(other) => return format!("get_loose_ends unexpected response: {other:?}"),
|
||||||
Err(e) => return format!("get_loose_ends transport error: {e:#}"),
|
Err(e) => return format!("get_loose_ends transport error: {e:#}"),
|
||||||
};
|
};
|
||||||
if threads.is_empty() {
|
if loose_ends.is_empty() {
|
||||||
return "(no open threads)".to_owned();
|
return "(no loose ends)".to_owned();
|
||||||
}
|
}
|
||||||
let mut out = format!("{} open thread(s):\n", threads.len());
|
let mut out = format!("{} loose end(s):\n", loose_ends.len());
|
||||||
for t in &threads {
|
for t in &loose_ends {
|
||||||
match t {
|
match t {
|
||||||
hive_sh4re::LooseEnd::Approval {
|
hive_sh4re::LooseEnd::Approval {
|
||||||
id,
|
id,
|
||||||
|
|
@ -205,6 +206,17 @@ fn parse_loose_end_kind(raw: &str) -> Result<hive_sh4re::CancelLooseEndKind, Str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Canonical user-facing label for a `CancelLooseEndKind` — used in
|
||||||
|
/// the success ack so the caller always sees `"question"` /
|
||||||
|
/// `"reminder"` instead of whatever alias they passed in (`"q"` /
|
||||||
|
/// `"r"`).
|
||||||
|
fn loose_end_kind_label(kind: hive_sh4re::CancelLooseEndKind) -> &'static str {
|
||||||
|
match kind {
|
||||||
|
hive_sh4re::CancelLooseEndKind::Question => "question",
|
||||||
|
hive_sh4re::CancelLooseEndKind::Reminder => "reminder",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Format helper for `whoami`: renders the identity block as a short
|
/// Format helper for `whoami`: renders the identity block as a short
|
||||||
/// human-readable string. Skips fields that are `None` so the output
|
/// human-readable string. Skips fields that are `None` so the output
|
||||||
/// doesn't carry dead placeholders.
|
/// doesn't carry dead placeholders.
|
||||||
|
|
@ -491,13 +503,13 @@ impl AgentServer {
|
||||||
)]
|
)]
|
||||||
async fn cancel_loose_end(&self, Parameters(args): Parameters<CancelLooseEndArgs>) -> String {
|
async fn cancel_loose_end(&self, Parameters(args): Parameters<CancelLooseEndArgs>) -> String {
|
||||||
let log = format!("{args:?}");
|
let log = format!("{args:?}");
|
||||||
let kind_label = args.kind.clone();
|
|
||||||
let id = args.id;
|
let id = args.id;
|
||||||
run_tool_envelope("cancel_loose_end", log, async move {
|
run_tool_envelope("cancel_loose_end", log, async move {
|
||||||
let kind = match parse_loose_end_kind(&args.kind) {
|
let kind = match parse_loose_end_kind(&args.kind) {
|
||||||
Ok(k) => k,
|
Ok(k) => k,
|
||||||
Err(e) => return e,
|
Err(e) => return e,
|
||||||
};
|
};
|
||||||
|
let kind_label = loose_end_kind_label(kind);
|
||||||
let (resp, retries) = self
|
let (resp, retries) = self
|
||||||
.dispatch(hive_sh4re::AgentRequest::CancelLooseEnd { kind, id })
|
.dispatch(hive_sh4re::AgentRequest::CancelLooseEnd { kind, id })
|
||||||
.await;
|
.await;
|
||||||
|
|
@ -1031,13 +1043,13 @@ impl ManagerServer {
|
||||||
)]
|
)]
|
||||||
async fn cancel_loose_end(&self, Parameters(args): Parameters<CancelLooseEndArgs>) -> String {
|
async fn cancel_loose_end(&self, Parameters(args): Parameters<CancelLooseEndArgs>) -> String {
|
||||||
let log = format!("{args:?}");
|
let log = format!("{args:?}");
|
||||||
let kind_label = args.kind.clone();
|
|
||||||
let id = args.id;
|
let id = args.id;
|
||||||
run_tool_envelope("cancel_loose_end", log, async move {
|
run_tool_envelope("cancel_loose_end", log, async move {
|
||||||
let kind = match parse_loose_end_kind(&args.kind) {
|
let kind = match parse_loose_end_kind(&args.kind) {
|
||||||
Ok(k) => k,
|
Ok(k) => k,
|
||||||
Err(e) => return e,
|
Err(e) => return e,
|
||||||
};
|
};
|
||||||
|
let kind_label = loose_end_kind_label(kind);
|
||||||
let (resp, retries) = self
|
let (resp, retries) = self
|
||||||
.dispatch(hive_sh4re::ManagerRequest::CancelLooseEnd { kind, id })
|
.dispatch(hive_sh4re::ManagerRequest::CancelLooseEnd { kind, id })
|
||||||
.await;
|
.await;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue