pub struct ActorPresenceStore { /* private fields */ }Expand description
Manages actor presence stored in .heddle/actor-presence/.
Implementations§
Source§impl ActorPresenceStore
impl ActorPresenceStore
pub fn current_entries(&self) -> Result<Vec<ActorPresence>>
pub fn active_entries(&self) -> Result<Vec<ActorPresence>>
Sourcepub fn create_generated_entry<F>(&self, build_entry: F) -> Result<ActorPresence>
pub fn create_generated_entry<F>(&self, build_entry: F) -> Result<ActorPresence>
Create and persist a new agent entry with a unique generated session ID.
Sourcepub fn save(&self, entry: &ActorPresence) -> Result<()>
pub fn save(&self, entry: &ActorPresence) -> Result<()>
Persist an agent entry.
Atomic write: uses write-to-temp-then-rename so a crash mid-write never leaves the TOML file truncated or partially written.
Sourcepub fn load(&self, session_id: &str) -> Result<Option<ActorPresence>>
pub fn load(&self, session_id: &str) -> Result<Option<ActorPresence>>
Load a single agent entry by session ID.
Sourcepub fn list(&self) -> Result<Vec<ActorPresence>>
pub fn list(&self) -> Result<Vec<ActorPresence>>
List all agent entries, most-recently-started first.
Sourcepub fn update_status(
&self,
session_id: &str,
status: ActorPresenceStatus,
) -> Result<()>
pub fn update_status( &self, session_id: &str, status: ActorPresenceStatus, ) -> Result<()>
Update the status of an agent entry in place.
Sourcepub fn update_entry<F>(
&self,
session_id: &str,
update: F,
) -> Result<Option<ActorPresence>>where
F: FnMut(&mut ActorPresence),
pub fn update_entry<F>(
&self,
session_id: &str,
update: F,
) -> Result<Option<ActorPresence>>where
F: FnMut(&mut ActorPresence),
Mutate an existing agent entry under the registry write lock.
Sourcepub fn find_or_create_active_entry<FMatch, FUpdate, FBuild>(
&self,
matches: FMatch,
update_existing: FUpdate,
build_entry: FBuild,
) -> Result<(ActorPresence, bool)>where
FMatch: FnMut(&ActorPresence) -> bool,
FUpdate: FnMut(&mut ActorPresence),
FBuild: FnMut(&str) -> Result<ActorPresence>,
pub fn find_or_create_active_entry<FMatch, FUpdate, FBuild>(
&self,
matches: FMatch,
update_existing: FUpdate,
build_entry: FBuild,
) -> Result<(ActorPresence, bool)>where
FMatch: FnMut(&ActorPresence) -> bool,
FUpdate: FnMut(&mut ActorPresence),
FBuild: FnMut(&str) -> Result<ActorPresence>,
Under one registry write lock, reuse a matching active entry if one exists; otherwise create a new generated entry.
Sourcepub fn find_active_by_path(
&self,
worktree_root: &Path,
) -> Result<Option<ActorPresence>>
pub fn find_active_by_path( &self, worktree_root: &Path, ) -> Result<Option<ActorPresence>>
Find the active session whose visible or private execution root matches the given worktree root.
Sourcepub fn find_active_by_heddle_session_id(
&self,
heddle_session_id: &str,
) -> Result<Option<ActorPresence>>
pub fn find_active_by_heddle_session_id( &self, heddle_session_id: &str, ) -> Result<Option<ActorPresence>>
Find the active registry entry associated with the given Heddle session ID.
Sourcepub fn find_active_by_client_instance_id(
&self,
client_instance_id: &str,
) -> Result<Option<ActorPresence>>
pub fn find_active_by_client_instance_id( &self, client_instance_id: &str, ) -> Result<Option<ActorPresence>>
Find the active registry entry associated with a stable harness-side client instance identifier.
Sourcepub fn find_active_by_native_actor_key(
&self,
native_actor_key: &str,
) -> Result<Option<ActorPresence>>
pub fn find_active_by_native_actor_key( &self, native_actor_key: &str, ) -> Result<Option<ActorPresence>>
Find the active registry entry associated with a harness-native actor key.
Sourcepub fn actor_chain_for_session(
&self,
session_id: &str,
) -> Result<Vec<ActorChainNode>>
pub fn actor_chain_for_session( &self, session_id: &str, ) -> Result<Vec<ActorChainNode>>
Return this actor’s native parent chain, ordered root to leaf.
The lookup intentionally follows harness-native actor keys rather than thread names: subagents may work in lightweight directories or forked threads, but the native parent key is the stable “who spawned whom” edge that preserves Human -> agent -> agent attribution.
Sourcepub fn find_active_by_native_instance_key_at_path(
&self,
native_instance_key: &str,
worktree_root: &Path,
) -> Result<Option<ActorPresence>>
pub fn find_active_by_native_instance_key_at_path( &self, native_instance_key: &str, worktree_root: &Path, ) -> Result<Option<ActorPresence>>
Find the active registry entry associated with a harness-native instance key inside the given worktree root.
Sourcepub fn log_context_query(
&self,
session_id: &str,
query: ContextQueryEntry,
) -> Result<()>
pub fn log_context_query( &self, session_id: &str, query: ContextQueryEntry, ) -> Result<()>
Append a context query to an active session’s log.
Best-effort: silently ignored if the session no longer exists or has completed.