Skip to main content

Module exit_mode

Module exit_mode 

Source
Expand description

Library-level support for --exit interactive mode.

When a session is launched with --exit [<hint>], the user prompt is augmented with instructions telling the agent to call zag ps kill self <result> (or zag ps kill self --file <path>) to terminate the session and submit the final result.

This module owns the prompt template, the typed ExitHint / ExitConstraints state, and the validation logic used by zag ps kill to accept or reject a submitted result.

Structs§

ExitConstraints
All exit-mode constraints captured at session launch.

Enums§

ExitHint
State of the --exit flag for a single session.
ExitValidationError
Reason a zag ps kill invocation was rejected. The CLI prints the Display impl to stderr; the agent is expected to read the message and self-correct.

Functions§

build_exit_suffix
Build the suffix appended to a user prompt when a session is launched with --exit.
exit_template
Exit prompt template (front matter stripped) — {HINT_SECTION}, {JSON_INSTRUCTION}, {SCHEMA_INSTRUCTION} are replaced at run time.
validate_exit_result
Validate a result string against the constraints recorded on a session at launch time. Returns Ok(()) if the kill should proceed.