pub enum MemoryScope {
Run,
Agent,
Team,
User,
Tenant,
}Expand description
The scope a memory lives at: whose memory it is and how far its
visibility reaches. Closed enum; the superset mapping onto R0.7’s
StateScope taxonomy is the module’s load-bearing contract (see the
module docs and MemoryScope::from_state_scope).
Variants§
Run
Memory whose lifetime is bound to one run’s thread. New in R0.8:
StateScope has no run member, because state outlives runs by
design. Run scope is written by the runtime on the run’s behalf.
Agent
One agent’s own memory — StateScope::Private under its memory
name. Scope authorization is the manifest check: an agent may write
agent scope only when its CapabilityManifest declares
StateScope::Private.
Team
Memory shared by a team’s members — StateScope::Team under its
memory name, under the same turn discipline that governs team state.
User
One end user’s memory, shared across that user’s agents and threads —
StateScope::User under its memory name.
Tenant
Configuration-grade memory for the whole tenant — StateScope::Tenant
under its memory name. Writable by operators, not by agents; tenant
isolation is the {tenant}/ id-namespacing unchanged.
Implementations§
Source§impl MemoryScope
impl MemoryScope
Sourcepub fn from_state_scope(scope: StateScope) -> Option<MemoryScope>
pub fn from_state_scope(scope: StateScope) -> Option<MemoryScope>
The memory scope a declared StateScope translates into, one-to-one
(private → agent): the manifest check’s mapping. None is
unreachable — the four StateScopes all have memory names — but the
signature keeps the mapping honest about direction: this is the
superset reading the subset.
Sourcepub fn to_state_scope(self) -> Option<StateScope>
pub fn to_state_scope(self) -> Option<StateScope>
The StateScope this memory scope corresponds to, when it has one:
agent → private, team → team, user → user,
tenant → tenant, and run → None — run scope has no
StateScope member because state outlives runs by design.