pub enum CallerIdentity {
Ctrl,
Pm {
session_id: String,
project_id: String,
},
Agent {
session_id: String,
project_id: String,
agent_id: String,
},
}Expand description
Which component is making a memory/context call.
Why: Each tier has different access rights to the memory store. Encoding
the tier as a sum type makes the privilege boundary visible in every
signature that needs to enforce it.
What: Ctrl is the operator (unrestricted); Pm runs one session in a
project; Agent is a single sub-agent inside that session.
Test: auto_tags_for_each_variant, max_recall_scope_for_each_variant.
Variants§
Ctrl
Operator / controller — unrestricted.
Pm
PM — bounded to a single session within a project.
Agent
Sub-agent — bounded to its own writes within a session.
Implementations§
Source§impl CallerIdentity
impl CallerIdentity
Sourcepub fn max_recall_scope(&self) -> RecallCeiling
pub fn max_recall_scope(&self) -> RecallCeiling
Maximum scope this caller is allowed to recall.
Why: Enforced by the harness — not by agent code. An agent that passes
scope: "all" is silently downgraded to Agent.
What: Ctrl → All, Pm → Session, Agent → Agent.
Test: max_recall_scope_for_each_variant.
Tags to automatically apply when this caller stores a memory.
Why: Auto-tagging at write time means future scope filters can match on
tags without trusting agent-supplied metadata.
What: Ctrl → ["scope/user"]; Pm → session+project tags; Agent
→ session+project+agent tags.
Test: auto_tags_for_each_variant.
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Try to construct a CallerIdentity from environment variables.
Why: Subprocesses receive identity as env vars; this constructor
centralises the parse logic.
What: Reads TCODE_CALLER and the corresponding ID vars.
Returns None if the env var is absent or unrecognised.
Test: caller_identity_from_env_*.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
Return the session ID if this identity has one.
Why: Memory tools that scope by session need to extract the ID
without pattern-matching on the full identity.
What: Some(session_id) for Pm and Agent, None for Ctrl.
Test: session_id_for_each_variant.
Trait Implementations§
Source§impl Clone for CallerIdentity
impl Clone for CallerIdentity
Source§impl Debug for CallerIdentity
impl Debug for CallerIdentity
Source§impl<'de> Deserialize<'de> for CallerIdentity
impl<'de> Deserialize<'de> for CallerIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CallerIdentity
Source§impl PartialEq for CallerIdentity
impl PartialEq for CallerIdentity
Source§impl Serialize for CallerIdentity
impl Serialize for CallerIdentity
impl StructuralPartialEq for CallerIdentity
Auto Trait Implementations§
impl Freeze for CallerIdentity
impl RefUnwindSafe for CallerIdentity
impl Send for CallerIdentity
impl Sync for CallerIdentity
impl Unpin for CallerIdentity
impl UnsafeUnpin for CallerIdentity
impl UnwindSafe for CallerIdentity
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more