pub struct SubgoalRegistry {
pub subgoals: Vec<Subgoal>,
pub msg_to_subgoal: HashMap<usize, SubgoalId>,
/* private fields */
}Expand description
In-memory registry of all subgoals in the current session.
Not persisted across restarts — subgoal state is transient session data.
Fields§
§subgoals: Vec<Subgoal>§msg_to_subgoal: HashMap<usize, SubgoalId>Maps message index → subgoal ID for fast lookup during compaction.
Implementations§
Source§impl SubgoalRegistry
impl SubgoalRegistry
Sourcepub fn push_active(
&mut self,
description: String,
start_msg_index: usize,
) -> SubgoalId
pub fn push_active( &mut self, description: String, start_msg_index: usize, ) -> SubgoalId
Register a new active subgoal starting at the given message index.
Auto-completes any existing Active subgoal before creating the new one.
Sourcepub fn complete_active(&mut self, end_msg_index: usize)
pub fn complete_active(&mut self, end_msg_index: usize)
Mark the current active subgoal as completed and assign an end boundary.
Sourcepub fn extend_active(&mut self, new_end: usize)
pub fn extend_active(&mut self, new_end: usize)
Extend the active subgoal to cover new messages up to new_end.
Sourcepub fn tag_range(&mut self, start: usize, end: usize, id: SubgoalId)
pub fn tag_range(&mut self, start: usize, end: usize, id: SubgoalId)
Tag messages in range [start, end] with the given subgoal ID.
Sourcepub fn subgoal_state(&self, msg_index: usize) -> Option<SubgoalState>
pub fn subgoal_state(&self, msg_index: usize) -> Option<SubgoalState>
Get the subgoal state for a given message index.
Sourcepub fn active_subgoal(&self) -> Option<&Subgoal>
pub fn active_subgoal(&self) -> Option<&Subgoal>
Get the current active subgoal (for debug output and TUI metrics).
Sourcepub fn rebuild_after_compaction(
&mut self,
messages: &[Message],
old_compact_end: usize,
)
pub fn rebuild_after_compaction( &mut self, messages: &[Message], old_compact_end: usize, )
Rebuild the registry after compaction.
When old_compact_end == 0, repairs shifted indices without dropping subgoals.
When old_compact_end > 0, drops subgoals whose entire span was drained.
Trait Implementations§
Source§impl Debug for SubgoalRegistry
impl Debug for SubgoalRegistry
Source§impl Default for SubgoalRegistry
impl Default for SubgoalRegistry
Source§fn default() -> SubgoalRegistry
fn default() -> SubgoalRegistry
Auto Trait Implementations§
impl Freeze for SubgoalRegistry
impl RefUnwindSafe for SubgoalRegistry
impl Send for SubgoalRegistry
impl Sync for SubgoalRegistry
impl Unpin for SubgoalRegistry
impl UnsafeUnpin for SubgoalRegistry
impl UnwindSafe for SubgoalRegistry
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request