pub struct ExecCtx {
pub cancel: CancellationToken,
pub interact: Arc<dyn InteractionChannel>,
pub interact_timeout: Option<Duration>,
}Expand description
Execution context threaded through execute (OV-6): one cancel token for
user interrupt / timeout / watchdog, one interaction channel for consent
and ask_user. Reach the channel only through ExecCtx::request_consent /
ExecCtx::ask_user — those carry the suspension discipline (answer /
cancel / watchdog deadline); calling the trait directly drops it.
Fields§
§cancel: CancellationTokenUser interrupt / timeout / watchdog share this token.
interact: Arc<dyn InteractionChannel>Consent / ask_user suspension points.
interact_timeout: Option<Duration>Per-interaction deadline: an unanswered suspension cancels the run’s
token and fails with InteractionError::Timeout instead of hanging
forever. None = the run’s cancel token is the only guard (human time
is unbounded — phimint’s TUI sets this).
Implementations§
Source§impl ExecCtx
impl ExecCtx
Sourcepub fn new(
cancel: CancellationToken,
interact: Arc<dyn InteractionChannel>,
) -> Self
pub fn new( cancel: CancellationToken, interact: Arc<dyn InteractionChannel>, ) -> Self
One run’s execution context. Interactions carry the
DEFAULT_INTERACT_TIMEOUT watchdog; the construction site overrides
(or clears) interact_timeout when it knows better.
Sourcepub fn with_interact_timeout(self, interact_timeout: Option<Duration>) -> Self
pub fn with_interact_timeout(self, interact_timeout: Option<Duration>) -> Self
Set the per-interaction deadline (None = wait as long as the run lives).
Sourcepub async fn request_consent(
&self,
request: ApprovalRequest,
) -> Result<ApprovalDecision, InteractionError>
pub async fn request_consent( &self, request: ApprovalRequest, ) -> Result<ApprovalDecision, InteractionError>
Consent request: suspends on the product layer, released by the answer, the cancel token, or the interaction watchdog.
Sourcepub async fn ask_user(
&self,
question: &str,
options: &[AskOption],
) -> Result<AskAnswer, InteractionError>
pub async fn ask_user( &self, question: &str, options: &[AskOption], ) -> Result<AskAnswer, InteractionError>
Ask the user to pick between candidates: suspends like
ExecCtx::request_consent and shares its guards.