pub struct LatchRequest {
pub nonce: String,
pub command: String,
pub paths: Vec<String>,
pub hint: String,
pub tool: String,
pub argv: Vec<String>,
pub ttl: u64,
pub job_id: Option<u64>,
}Expand description
A pending confirmation-latch request, decoded from a latched ExecResult.
When the confirmation latch (set -o latch) gates a destructive operation,
the kernel returns exit code 2 with this typed payload on the dedicated
ExecResult::latch field. Embedders read it via
ExecResult::latch_request — the seam to apply preapproval policy or a
model review before approving the operation. It is deliberately not the
data-plane ExecResult::data: a stdout redirect clears .data but never
this control-plane signal, and it survives --json formatting (surfaced
under a latch key in the error envelope).
To approve, re-run the same argv with --confirm=<nonce> (the hint
shows the exact form). The nonce is command- and path-scoped, so it cannot
authorize a different command or a path outside paths.
Fields§
§nonce: StringConfirmation nonce — pass back as --confirm=<nonce> on the same command.
command: StringThe canonical command being gated (e.g. "rm", "kaish-trash empty").
A human/display label — for a precise machine replay use tool + argv.
paths: Vec<String>The resolved paths the operation would touch. Empty for command-only ops.
hint: StringA ready-to-run confirmation command string (informational, for humans).
Machine fulfillment should prefer Kernel::confirm (which replays the
captured tool/argv); the hint is a display string and does not
robustly quote paths with spaces or glob characters.
tool: StringThe dispatch name of the gated tool (e.g. "rm", "kaish-trash"), as
resolved at the dispatch seam — the argv0 for a replay via
Kernel::execute_argv. Empty only when the latch was produced outside a
dispatch (a direct tool.execute in a unit test).
argv: Vec<String>The exact captured argv (ToolArgs::to_argv) of the gated invocation,
minus the tool name and the --confirm nonce. Kernel::confirm prepends
--confirm=<nonce> and replays execute_argv(tool, argv) — the
highest-fidelity fulfillment, with no re-parsing of the hint.
ttl: u64Seconds until the nonce expires.
job_id: Option<u64>The id of the backgrounded job that raised this latch, if any —
Some only when the gate came from a job the JobManager is tracking
(rm x & reaching its gate), None for a foreground latch (the common
case: rm x gated directly at the dispatch seam, no job involved).
Deliberately a bare u64, not a JobId: this crate (kaish-types) is
a dependency-light leaf with no notion of JobId — that type lives in
kaish-kernel’s scheduler module, which depends on kaish-types, not
the other way around. kaish-kernel re-wraps this as JobId(id) at
the two call sites that care ([JobManager]’s Job::latch() stamps
it; Kernel::confirm reads it back to retire the originating job
after a successful replay). Skipped on the wire when absent, so a
foreground latch’s --json shape is unchanged.
Trait Implementations§
Source§impl Clone for LatchRequest
impl Clone for LatchRequest
Source§fn clone(&self) -> LatchRequest
fn clone(&self) -> LatchRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LatchRequest
impl Debug for LatchRequest
Source§impl<'de> Deserialize<'de> for LatchRequest
impl<'de> Deserialize<'de> for LatchRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LatchRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LatchRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for LatchRequest
Source§impl PartialEq for LatchRequest
impl PartialEq for LatchRequest
Source§impl Serialize for LatchRequest
impl Serialize for LatchRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for LatchRequest
Auto Trait Implementations§
impl Freeze for LatchRequest
impl RefUnwindSafe for LatchRequest
impl Send for LatchRequest
impl Sync for LatchRequest
impl Unpin for LatchRequest
impl UnsafeUnpin for LatchRequest
impl UnwindSafe for LatchRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.