# `SuperPi.Plugins.Questionnaire`
[🔗](https://github.com/oleksandr/super-pi-beam/blob/v0.1.0/lib/super_pi/plugins/questionnaire.ex#L1)

Questionnaire Plugin (migrated from Pi ecosystem `questionnaire.ts` & `question.ts`).

Adds the `ask_question` tool. A call publishes the questions as a `ui_request` event and
waits for a client to answer (`SuperPi.UI.Broker`). The CLI chat asks on the terminal. An
RPC client that watches the conversation receives the event and answers with `ui.respond`.

- With no client able to answer (the HTTP gateway, a headless run), the call returns an
  error at once. The model is not given invented answers.
- The wait ends after `config :super_pi, questionnaire_timeout_ms` (default 10 minutes) or
  when the conversation is cancelled.
- A pending question is not stored. After a crash the turn restarts and the model asks again.
- `ctx[:questionnaire_answers]` (a map of question text to selected option) answers without
  asking. It is for headless runs and tests, and the output says the answers were preset.

While a question waits, the conversation process is blocked in the tool call, so a `steer`
message is handled only after the answer. `session.cancel` ends the wait.

# `description`

# `id`

# `name`

# `tool_spec`

Returns the tool specification map for direct registration.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
