Skip to main content

ag_contracts/
notice.rs

1//! Noteworthy changes to how one agent turn ran.
2
3/// Something about how a turn ran that the user should know, reported at
4/// most once per occurrence while the turn runs. Hosts show it in the
5/// session transcript beside the turn's answer.
6#[derive(Clone, Debug, Eq, PartialEq)]
7pub enum TurnNotice {
8    /// Earlier turns were summarized into a checkpoint that later requests
9    /// carry in their place, so the session fits the model's context window.
10    ContextCompacted {
11        /// Model that wrote the summary, when known.
12        model: Option<String>,
13    },
14    /// Summarizing earlier turns failed, so the oldest turns that no longer
15    /// fit were dropped from the context instead.
16    ContextCompactionFailed {
17        /// Short, one-line category of the failure, such as `invalid
18        /// output`; never a provider's response text.
19        reason: String,
20    },
21    /// The turn's shell commands run without the native sandbox, or inside
22    /// it without a grant this host cannot honor. Every turn offering
23    /// commands reports it while the condition lasts.
24    SandboxUnavailable {
25        /// What is missing, written for the user.
26        message: String,
27        /// How the user can fix it.
28        remedy: String,
29    },
30    /// The turn offered shell commands and the native sandbox ran them, so
31    /// a host can tell the user when an earlier warning no longer applies.
32    SandboxAvailable,
33    /// A sandboxed command failed with an operating-system denial the
34    /// sandbox may have caused. The guess is heuristic, since the command's
35    /// own output can trigger it; hosts never rerun a command outside the
36    /// sandbox because of it.
37    LikelySandboxDenial,
38    /// The turn asked to share the host's dependency caches, but these stay
39    /// per session because sharing them could not be confined: a cache that
40    /// is a link, lies outside the home directory or on `PATH`, or whose
41    /// lock file has another link.
42    HostCachesNotShared {
43        /// The caches kept per session, named for the user, such as `Cargo`.
44        caches: Vec<String>,
45    },
46}