feat: prompt returns answer to caller + commit on own header line
This commit is contained in:
parent
c5ef006414
commit
996f74b24f
5 changed files with 15 additions and 9 deletions
|
|
@ -27,12 +27,8 @@ fn banner() {
|
|||
println!();
|
||||
// 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
|
||||
println!(
|
||||
" {} {:<14} {}",
|
||||
"☀ ".yellow().bold(), // 1-wide + explicit space = 2 display cols
|
||||
"HELIOS REMOTE".bold(),
|
||||
env!("GIT_COMMIT").dimmed()
|
||||
);
|
||||
println!(" {} {}", "☀ ".yellow().bold(), "HELIOS REMOTE".bold());
|
||||
display::info_line("🔗", "commit:", &env!("GIT_COMMIT").dimmed().to_string());
|
||||
}
|
||||
|
||||
fn print_session_info(label: &str, sid: &uuid::Uuid) {
|
||||
|
|
@ -369,7 +365,7 @@ async fn handle_message(
|
|||
input.trim().to_string()
|
||||
}).await.unwrap_or_default();
|
||||
display::prompt_done(&message, &answer);
|
||||
ClientMessage::Ack { request_id }
|
||||
ClientMessage::PromptResponse { request_id, answer }
|
||||
}
|
||||
|
||||
ServerMessage::ExecRequest { request_id, command, timeout_ms } => {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ pub enum ClientMessage {
|
|||
},
|
||||
/// Response to a clipboard-get request
|
||||
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
|
||||
|
|
|
|||
|
|
@ -564,6 +564,9 @@ pub async fn prompt_user(
|
|||
})
|
||||
.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(),
|
||||
Err(e) => e.into_response(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ async fn handle_client_message(session_id: Uuid, msg: ClientMessage, state: &App
|
|||
| ClientMessage::LogsResponse { request_id, .. }
|
||||
| ClientMessage::DownloadResponse { request_id, .. }
|
||||
| ClientMessage::ClipboardGetResponse { request_id, .. }
|
||||
| ClientMessage::PromptResponse { request_id, .. }
|
||||
| ClientMessage::Ack { request_id }
|
||||
| ClientMessage::Error { request_id, .. } => {
|
||||
let rid = *request_id;
|
||||
|
|
|
|||
|
|
@ -390,8 +390,12 @@ def cmd_prompt(args):
|
|||
body = {"message": args.message}
|
||||
if args.title:
|
||||
body["title"] = args.title
|
||||
_req("POST", f"/sessions/{sid}/prompt", json=body)
|
||||
print(f"User confirmed prompt on session {sid!r}.")
|
||||
resp = _req("POST", f"/sessions/{sid}/prompt", json=body)
|
||||
answer = resp.get("answer", "")
|
||||
if answer:
|
||||
print(answer)
|
||||
else:
|
||||
print(f"Prompt confirmed (no answer returned).")
|
||||
|
||||
|
||||
def cmd_wait_for_window(args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue