pub struct AgentSession {
pub host: &'static str,
pub marker: String,
pub markers: Vec<String>,
pub session_id: Option<String>,
}Expand description
An AI agent session detected from environment variables.
Fields§
§host: &'static strclaude-code, codex, cursor, gemini-cli, or ai-agent.
marker: StringThe environment variable that identified the session.
markers: Vec<String>Every non-empty marker variable present, for any host, sorted by name.
session_id: Option<String>The host’s session id (ASCII letters, digits, -, _, .; at most 64), when it sets one.
Implementations§
Source§impl AgentSession
impl AgentSession
Sourcepub fn stamp(&self, trace: &mut Trace) -> Result<()>
pub fn stamp(&self, trace: &mut Trace) -> Result<()>
Apply the agent-session rule to a trace this session is about to write: refuse verified
(an agent cannot attest its own memory) and record the session as the locator, keeping any
caller locator after it.
Sourcepub fn refuse_person_only(&self, command: &str, why: &str) -> KernelError
pub fn refuse_person_only(&self, command: &str, why: &str) -> KernelError
The refusal for a command only a person may run inside this session, such as accepting
ledger records no hikmah write acknowledged (verify-ledger --accept-tail or
--reset-head). Those records may be a forged append (the chain is unkeyed), and an agent
that follows a refusal message must not be the one to approve them. The message tells the
agent to stop and ask a person; it deliberately gives no command that gets around the check.