mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-25 21:36:52 +08:00
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Xingyao Wang <xingyao@all-hands.dev>
19 lines
624 B
Python
19 lines
624 B
Python
from openhands_cli.user_actions.types import UserConfirmation
|
|
from openhands_cli.user_actions.utils import cli_confirm
|
|
|
|
|
|
def exit_session_confirmation() -> UserConfirmation:
|
|
"""
|
|
Ask user to confirm exiting session.
|
|
"""
|
|
|
|
question = 'Terminate session?'
|
|
options = ['Yes, proceed', 'No, dismiss']
|
|
index = cli_confirm(question, options) # Blocking UI, not escapable
|
|
|
|
options_mapping = {
|
|
0: UserConfirmation.ACCEPT, # User accepts termination session
|
|
1: UserConfirmation.REJECT, # User does not terminate session
|
|
}
|
|
return options_mapping.get(index, UserConfirmation.REJECT)
|