Skip to content

Conversation

@dingfeli
Copy link
Contributor

@dingfeli dingfeli commented Oct 23, 2025

Issue #, if available:

Description of changes:
Premise:

  • The current event loop has been instrumented to write to an abstraction that writes to stderr and stdout on behalf of the caller. This is in contrast to its previous implementation where writing are done directly to stderr and stdout.
  • See feat: chat cli UI revamp prep #3112 for more detail.
  • This is part of a series of changes made to provide the new event loop with the same UX as the current event loop.

This PR builds on top of #3112 with the following changes (and their respective reasoning)

  • Addition of a "managed input" in the abstraction (chat-cli-ui crate)
    • This means the stdin is owned by the ui abstraction (as opposed to the event loop)
    • This is necessitated by the fact that the new event loop will not (nor should it) have ownership of stdin
  • Instrumentation of the current event loop to emit structured event to signal to the ui abstraction when / how to prompt user for input (chat-cli crate)
    • This is necessitated by the fact that the ui is decoupled from the event loop and would not have the info to determine when / how to prompt user for input otherwise
    • This is also done for testing purposes to test the ui abstraction in the absence of the new event loop (which is WIP at the time of writing)
  • Instrumentation of the current event loop to conditionally construct InputSource (chat-cli crate)
    • InputSource is how the current event loop reads from stdin. When the ui abstraction is configured to take on the responsibility to manage input, InputSource is no longer constructed.
    • This is also done for testing purposes to test the ui abstraction in the absence of the new event loop (which is WIP at the time of writing)
  • Instrumentation of the current event loop to look for the env var "Q_UI_MANAGED_INPUT" (chat-cli crate)
    • This controls whether or not the ui abstraction owns the stdin
    • This is also done for testing purposes to test the ui abstraction in the absence of the new event loop (which is WIP at the time of writing)

With this, chat has 2 dials that affect the code path of information to and from event loop:

event loop output: unstructured event loop output: structured
input: event loop managed A B
input: ui managed C D

A is the current experience. This is identical in UX to what we have now.
D is the experience we are replicating for when the new event loop lands.

image

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dingfeli dingfeli force-pushed the dingfeli/old-ui-new-loop branch 2 times, most recently from 8c9adc8 to e739dc1 Compare October 24, 2025 06:25
@dingfeli dingfeli force-pushed the dingfeli/old-ui-new-loop branch from e739dc1 to f0e9cfb Compare October 24, 2025 16:28
@dingfeli dingfeli changed the title Dingfeli/old UI new loop chore: legacy UI for new event loop Oct 24, 2025
@dingfeli dingfeli marked this pull request as ready for review October 24, 2025 19:08
@dingfeli dingfeli force-pushed the dingfeli/old-ui-new-loop branch from f0e9cfb to c528fd4 Compare October 24, 2025 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant