Skip to main content

Module quit_question

Module quit_question 

Source
Expand description

The question asked before a quit that would stop agents in the middle of a turn.

Quitting stops every agent. A window’s own close warns first (frontend/app/window/window-close.ts); a quit that comes from outside a window does not pass a page. So whoever starts such a quit asks srv who is working (GET /agentmux/quit-question) and, when srv says to ask, puts the question in a native dialog of its own: one that needs no window and that no page or agent can answer.

The launcher asks for the tray’s Quit (crates/launcher/src/quit_ask.rs); the host asks for the macOS app menu’s Quit and Cmd+Q (crates/cef/src/macos_menu.rs). They share this: the question, the text, and the macOS dialog.

Quitting must always work. No answer from srv within [ANSWER_WITHIN] (srv is gone, hung or from a version without the question), or no way to show a dialog, quits as before. Only an explicit “keep running” stops the quit.

Structs§

Question
What srv said when it said to ask.

Constants§

DIALOG_TITLE
KEEP_RUNNING
QUIT

Functions§

ask_srv
Ask srv. Blocking, bounded by [ANSWER_WITHIN] for the connection and for each read.
goes_ahead
Whether the quit goes ahead: always, unless there is a question and the person answers it with “keep running”. confirm is None when no dialog could be shown.
macos_answer
What osascript said. The alert ([MACOS_ALERT]) exits 0 and prints button returned: and the title of the button clicked: Quit, or Keep running. The “User canceled” error, -128, is what a display dialog with a cancel button gives for Keep running; it is read as Keep running too. Any other failure is an alert that was never answered: None, and the quit goes ahead.
text
The dialog’s text.