Expand description
ask_question (#1660): parse/validate the model’s clarifying-question
batch, and the pure types the turn loop’s question-pause phase builds and
consumes.
This is a sibling pause path to the tool-approval gate, not a reuse of
it — see issue #1660 and its parent PRD #1659. This module owns only
the parse/validate half (invariant I5: a malformed call is rejected back
to the model as a tool-call error and never reaches a pause or an
event-log write); the pause/resume machinery that consumes
QuestionItem (a pending-question record, the turn result’s own
pending-questions list) lands in a later slice of this same issue.
§Why the tool name is duplicated here rather than imported
polyc_tools already depends on polyc_agent (for
crate::ToolExecutor), so this crate cannot depend back on
polyc_tools without a cycle. ASK_QUESTION_TOOL_NAME is therefore the
same literal as polyc_tools::ask_question::TOOL_NAME, duplicated
deliberately — the same reasoning polyc_proto’s INVITE_TOOL_NAME
duplication already documents. A cross-crate test in polyc-tools pins
the two literals equal.
Structs§
- Pending
Question - One question from an
ask_questioncall, paused and awaiting an answer. - Question
Args Error - A validation failure from
parse_ask_question_args(invariant I5). - Question
Item - One clarifying question: a short header, a one-sentence prompt, and 2-4
mutually exclusive
QuestionOptions. - Question
Option - One option a question offers: a short label and its one-sentence
consequence. At most one option per
QuestionItemisrecommended. - Unrecognized
Answer State sdid not match any ofpolyc_crypto::question’s three signed state strings.- Verified
Answer - A verified, signature-checked answer to one pending question.
Enums§
- Answer
State - A resolved answer’s state (invariant I4: three states, pairwise distinguishable in the tool result).
Constants§
- ASK_
QUESTION_ TOOL_ NAME - The
ask_questiontool name the turn loop recognizes to trigger the question-pause phase. - MAX_
HEADER_ CHARS - Maximum length (in characters) of a question’s
header. Kept in sync withpolyc_tools::ask_question::MAX_HEADER_CHARS. - MAX_
OPTIONS - Maximum number of options a question may offer. Kept in sync with
polyc_tools::ask_question::MAX_OPTIONS. - MAX_
OPTION_ LABEL_ CHARS - Maximum length (in characters) of an option’s
label. Kept in sync withpolyc_tools::ask_question::MAX_OPTION_LABEL_CHARS. - MAX_
QUESTIONS_ PER_ CALL - Maximum number of questions in a single
ask_questioncall. Kept in sync withpolyc_tools::ask_question::MAX_QUESTIONS_PER_CALL. - MAX_
SENTENCE_ CHARS - Maximum length (in characters) of a one-sentence field (
questionor an option’sdescription). Kept in sync withpolyc_tools::ask_question::MAX_SENTENCE_CHARS. - MIN_
OPTIONS - Minimum number of options a question may offer. Kept in sync with
polyc_tools::ask_question::MIN_OPTIONS.
Functions§
- parse_
ask_ question_ args - Parses and validates one
ask_questioncall’s arguments (invariant I5). - question_
call_ result_ json - Build the combined tool-call result JSON for one
ask_questioncall. - question_
still_ pending_ json - Builds a transcript-only interim result for a call whose question(s) are still unanswered when new turn input arrives (invariant I8).