feat: prompt returns answer to caller + commit on own header line

This commit is contained in:
Helios Agent 2026-03-05 21:22:18 +01:00
parent c5ef006414
commit 996f74b24f
No known key found for this signature in database
GPG key ID: C8259547CD8309B5
5 changed files with 15 additions and 9 deletions

View file

@ -27,12 +27,8 @@ fn banner() {
println!(); println!();
// Use same column layout as info_line: 2sp + emoji_cell(2w) + 2sp + name(14) + 2sp + value // Use same column layout as info_line: 2sp + emoji_cell(2w) + 2sp + name(14) + 2sp + value
// ☀ is 1-wide → emoji_cell pads to 2 → need 1 extra space to match // ☀ is 1-wide → emoji_cell pads to 2 → need 1 extra space to match
println!( println!(" {} {}", "".yellow().bold(), "HELIOS REMOTE".bold());
" {} {:<14} {}", display::info_line("🔗", "commit:", &env!("GIT_COMMIT").dimmed().to_string());
"".yellow().bold(), // 1-wide + explicit space = 2 display cols
"HELIOS REMOTE".bold(),
env!("GIT_COMMIT").dimmed()
);
} }
fn print_session_info(label: &str, sid: &uuid::Uuid) { fn print_session_info(label: &str, sid: &uuid::Uuid) {
@ -369,7 +365,7 @@ async fn handle_message(
input.trim().to_string() input.trim().to_string()
}).await.unwrap_or_default(); }).await.unwrap_or_default();
display::prompt_done(&message, &answer); display::prompt_done(&message, &answer);
ClientMessage::Ack { request_id } ClientMessage::PromptResponse { request_id, answer }
} }
ServerMessage::ExecRequest { request_id, command, timeout_ms } => { ServerMessage::ExecRequest { request_id, command, timeout_ms } => {

View file

@ -137,6 +137,8 @@ pub enum ClientMessage {
}, },
/// Response to a clipboard-get request /// Response to a clipboard-get request
ClipboardGetResponse { request_id: Uuid, text: String }, ClipboardGetResponse { request_id: Uuid, text: String },
/// Response to a prompt request — contains the user's typed answer
PromptResponse { request_id: Uuid, answer: String },
} }
/// Mouse button variants /// Mouse button variants

View file

@ -564,6 +564,9 @@ pub async fn prompt_user(
}) })
.await .await
{ {
Ok(ClientMessage::PromptResponse { answer, .. }) => {
(StatusCode::OK, Json(serde_json::json!({ "ok": true, "answer": answer }))).into_response()
}
Ok(_) => (StatusCode::OK, Json(serde_json::json!({ "ok": true }))).into_response(), Ok(_) => (StatusCode::OK, Json(serde_json::json!({ "ok": true }))).into_response(),
Err(e) => e.into_response(), Err(e) => e.into_response(),
} }

View file

@ -93,6 +93,7 @@ async fn handle_client_message(session_id: Uuid, msg: ClientMessage, state: &App
| ClientMessage::LogsResponse { request_id, .. } | ClientMessage::LogsResponse { request_id, .. }
| ClientMessage::DownloadResponse { request_id, .. } | ClientMessage::DownloadResponse { request_id, .. }
| ClientMessage::ClipboardGetResponse { request_id, .. } | ClientMessage::ClipboardGetResponse { request_id, .. }
| ClientMessage::PromptResponse { request_id, .. }
| ClientMessage::Ack { request_id } | ClientMessage::Ack { request_id }
| ClientMessage::Error { request_id, .. } => { | ClientMessage::Error { request_id, .. } => {
let rid = *request_id; let rid = *request_id;

View file

@ -390,8 +390,12 @@ def cmd_prompt(args):
body = {"message": args.message} body = {"message": args.message}
if args.title: if args.title:
body["title"] = args.title body["title"] = args.title
_req("POST", f"/sessions/{sid}/prompt", json=body) resp = _req("POST", f"/sessions/{sid}/prompt", json=body)
print(f"User confirmed prompt on session {sid!r}.") answer = resp.get("answer", "")
if answer:
print(answer)
else:
print(f"Prompt confirmed (no answer returned).")
def cmd_wait_for_window(args): def cmd_wait_for_window(args):