']
# Header (if present)
@@ -116,12 +127,18 @@ def format_askuserquestion_input(ask_input: AskUserQuestionInput) -> str:
def format_askuserquestion_result(content: str) -> str:
- """Format AskUserQuestion tool result with styled question/answer pairs.
-
- Parses the result format:
- 'User has answered your questions: "Q1"="A1", "Q2"="A2". You can now continue...'
-
- Returns HTML with styled Q&A blocks matching the input styling.
+ """
+ Render AskUserQuestion tool result into HTML with styled Q/A blocks.
+
+ Parses a success message containing quoted Question="Answer" pairs (the expected
+ format begins with "User has answered your question" and contains entries like
+ "Q"="A") and returns an escaped HTML fragment with each pair rendered as a
+ question block and an answer block. Returns an empty string if the input does
+ not match the expected success format or contains no pairs.
+
+ Returns:
+ html (str): HTML fragment containing the rendered Q/A blocks, or an empty
+ string when the input format is not a recognized successful response.
"""
# Check if this is a successful answer
if not content.startswith("User has answered your question"):
@@ -381,13 +398,14 @@ def format_task_output(output: TaskOutput) -> str:
def format_askuserquestion_output(output: AskUserQuestionOutput) -> str:
- """Format AskUserQuestion tool result with styled Q&A pairs.
-
- Args:
- output: Parsed AskUserQuestionOutput with Q&A pairs
-
+ """
+ Render an AskUserQuestionOutput as HTML containing styled question and answer blocks.
+
+ Parameters:
+ output (AskUserQuestionOutput): Parsed tool output containing a sequence of Q/A pairs.
+
Returns:
- HTML string with styled question/answer blocks
+ html (str): HTML string with one styled question/answer block per pair.
"""
html_parts: list[str] = [
'
'
@@ -822,4 +840,4 @@ def format_tool_result_content_raw(tool_result: ToolResultContent) -> str:
"format_tool_use_title",
# Generic
"render_params_table",
-]
+]
\ No newline at end of file