(
*,
conversation: list[TResponseInputItem],
no_interactive: bool,
run_turn: InteractiveTurnRunner,
)
| 238 | |
| 239 | |
| 240 | async def run_interactive_loop( |
| 241 | *, |
| 242 | conversation: list[TResponseInputItem], |
| 243 | no_interactive: bool, |
| 244 | run_turn: InteractiveTurnRunner, |
| 245 | ) -> list[TResponseInputItem]: |
| 246 | if no_interactive or is_auto_mode(): |
| 247 | return conversation |
| 248 | |
| 249 | console.print("[dim]Enter follow-up prompts. Press Ctrl-D or Ctrl-C to finish.[/dim]") |
| 250 | while True: |
| 251 | try: |
| 252 | next_message = Prompt.ask("[bold cyan]user[/bold cyan]").strip() |
| 253 | except (EOFError, KeyboardInterrupt): |
| 254 | break |
| 255 | |
| 256 | if not next_message: |
| 257 | continue |
| 258 | |
| 259 | conversation.append({"role": "user", "content": next_message}) |
| 260 | conversation = await run_turn(conversation) |
| 261 | |
| 262 | return conversation |
| 263 | |
| 264 | |
| 265 | def print_event(event: PrintableEvent) -> None: |
no test coverage detected