Skip to main content

Module ask

Module ask 

Source
Expand description

Ask tool — ask the user one or more clarifying questions via the TUI overlay. Ask tool — ask the user one or more questions via the TUI overlay.

Architecture (omp ask style, adapted to oxicode’s ratatui stack):

  • AskBridge is created in oxicode-cli and shared (via Arc) between AskTool (agent thread) and AppState (TUI main thread).
  • When the tool executes, it creates a oneshot channel and stores (questions, sender) in the bridge — a single round-trip. The overlay drives the sequential, one-question-at-a-time flow internally (←/→ to move between questions), matching omp’s askSingleQuestion UX.
  • The TUI main loop polls the bridge; when a pending ask is found it creates an AskOverlay to display it.
  • User interaction drives the overlay to send an AskResponse via the oneshot Sender. The tool’s execute() receives it via rx.await.
  • Abort (Ctrl+C) is handled via tokio::select! with the abort signal.

The transcript renderer (format_ask_result in oxicode-tui) reconstructs the “filled menu” (every option re-shown with its selection marker filled) by combining the call arguments (the full option list) with the result text (which option was selected).

Structs§

Answer
A single answer to a question.
AskBridge
Shared bridge between the ask tool (agent thread) and the TUI overlay (main thread). Created in oxicode-cli, injected into both the tool and AppState.
AskResponse
Response from user interaction.
AskTool
The ask tool — asks the user one or more questions via TUI overlay.
PendingAsk
A pending ask waiting for user interaction. The responder is a oneshot Sender — the overlay calls send() when the user submits or cancels, and the tool’s rx.await receives it.
Question
A single question to ask the user.
QuestionOption
An option within a question.

Functions§

format_answers
Format answers into a human-readable text for the tool result.