Expand description
AskUserQuestion sequential sequencing. Mirrors upstream’s
agent-sdk/src/bridge/user_interaction.ts (323 LoC) - focused on
the multi-question loop + answer-payload assembly.
The actual loop driver lives in forge_sdk_worker::run_ask_user_question
because it needs the worker’s pending map + event_tx + the
oneshot machinery. This module owns the pure parsing helpers.
Re-exports§
use serde_json::Map;🔒use serde_json::Value;🔒use forge_primitives::QuestionAnnotation;🔒use forge_primitives::QuestionOption;🔒use forge_primitives::QuestionPrompt;🔒use forge_primitives::QuestionRequest;🔒use forge_primitives::ToolCall;🔒
Structs§
- AskUser
Question Option - AskUser
Question Prompt - Monitor
Input Monitortool’stool_use.inputpayload. The renderer consumesdescriptionfor the chat one-liner + the MONITORS-section header;commandis informational;persistenttoggles the “(persistent)” suffix on the chat notice;timeout_msis honoured by the CLI’s task-lifecycle handler.
Constants§
Functions§
- ask_
user_ 🔒question_ wire_ options - Mirrors
askUserQuestionOptions(prompt)- synthesises wireoption_idslugs asquestion_<index>so a view can map back to the upstream label list when responding. - build_
question_ request - Mirrors
buildQuestionRequest(promptToolCall, prompt, index, total). - build_
updated_ input - Helper used by the worker’s loop driver: build the final
updatedInputpayload after every question has been answered. Mirrors the tail ofrequestAskUserQuestionAnswersupstream. - derive_
annotation - Mirrors
deriveAnnotation. Joins option previews with a blank line separator when no caller-supplied annotation preview is present. - has_
recommended_ 🔒suffix - #273: CLI 2.1.156 marks the “best” choice in an
AskUserQuestionoption list with a literal(Recommended)suffix on the option label (space + paren + capital R). The label itself reaches the UI verbatim; this only reports the marker’s presence. Match is case-sensitive because the CLI emits the canonical form; lower-caserecommendedfrom the model’s own prose is just label text. - parse_
ask_ user_ question_ prompts - Mirrors upstream’s
parseAskUserQuestionPrompts. Walks the rawinput.questionsJSON array, dropping malformed entries and requiring at least 2 options per question (matches upstream’s validity rule). - parse_
monitor_ input - Parse a
Monitortool_use’sraw_inputinto aMonitorInput. ReturnsNonewhendescriptionorcommandis missing or non-string - both are required for a meaningful render.