pub struct GoalTracker { /* private fields */ }Expand description
Pure state machine for goal tracking.
Implementations§
Source§impl GoalTracker
impl GoalTracker
Sourcepub fn from_snapshot(session_dir: PathBuf, snapshot: GoalOrchestration) -> Self
pub fn from_snapshot(session_dir: PathBuf, snapshot: GoalOrchestration) -> Self
Restore tracker state from a persisted snapshot.
Sourcepub fn snapshot(&self) -> Option<&GoalOrchestration>
pub fn snapshot(&self) -> Option<&GoalOrchestration>
Return an immutable reference to the current orchestration snapshot.
Sourcepub fn snapshot_mut(&mut self) -> Option<&mut GoalOrchestration>
pub fn snapshot_mut(&mut self) -> Option<&mut GoalOrchestration>
Return a mutable reference to the current orchestration snapshot.
Sourcepub fn status(&self) -> Option<GoalStatus>
pub fn status(&self) -> Option<GoalStatus>
Current lifecycle status, if a goal is active.
Sourcepub fn current_subagent_id(&self) -> Option<&str>
pub fn current_subagent_id(&self) -> Option<&str>
ID of the currently executing subagent, if any.
Sourcepub fn token_budget(&self) -> Option<i64>
pub fn token_budget(&self) -> Option<i64>
Token budget cap, if set.
Sourcepub fn create_goal(
&mut self,
goal_id: String,
objective: String,
token_budget: Option<i64>,
token_baseline: i64,
created_at: String,
baseline_commit: Option<String>,
)
pub fn create_goal( &mut self, goal_id: String, objective: String, token_budget: Option<i64>, token_baseline: i64, created_at: String, baseline_commit: Option<String>, )
Create a new goal. Replaces any existing orchestration.
Sourcepub fn set_current_subagent(&mut self, id: Option<String>, role: Option<String>)
pub fn set_current_subagent(&mut self, id: Option<String>, role: Option<String>)
Update the current subagent ID and role.
Sourcepub fn pause(&mut self, reason: GoalPauseReason) -> bool
pub fn pause(&mut self, reason: GoalPauseReason) -> bool
Pause the goal with a specific reason. Only transitions from Active.
Sourcepub fn pause_with_message(
&mut self,
reason: GoalPauseReason,
message: String,
) -> bool
pub fn pause_with_message( &mut self, reason: GoalPauseReason, message: String, ) -> bool
Like Self::pause but also stores a human-readable message.
Sourcepub fn resume(&mut self) -> bool
pub fn resume(&mut self) -> bool
Resume a paused goal (any paused variant). Returns true if applied.
Sourcepub fn complete(&mut self) -> bool
pub fn complete(&mut self) -> bool
Mark the goal as complete. Accepts Active or any paused variant.
Sourcepub fn budget_limit(&mut self) -> bool
pub fn budget_limit(&mut self) -> bool
Mark the goal as budget-limited. Accepts Active or any paused variant.
Sourcepub fn account_elapsed(&mut self)
pub fn account_elapsed(&mut self)
Flush elapsed wall-clock time into elapsed_ms.
Sourcepub fn record_classifier_stall(&mut self, fingerprint: &str) -> bool
pub fn record_classifier_stall(&mut self, fingerprint: &str) -> bool
Record a NotAchieved rejection’s gap fingerprint and report
whether the goal has stalled.
Sourcepub fn rollback_classifier_attempt(&mut self)
pub fn rollback_classifier_attempt(&mut self)
Undo the most recent attempt-slot reservation.
Sourcepub fn reset_classifier_stall(&mut self)
pub fn reset_classifier_stall(&mut self)
Clear the stall streak.
Sourcepub fn record_not_achieved_streak(&mut self) -> u32
pub fn record_not_achieved_streak(&mut self) -> u32
Increment the consecutive-NotAchieved streak and return the new value.
Sourcepub fn claim_strategist_fire(
&mut self,
should_fire: impl Fn(u32, u32) -> bool,
) -> Option<u32>
pub fn claim_strategist_fire( &mut self, should_fire: impl Fn(u32, u32) -> bool, ) -> Option<u32>
Atomically evaluate the strategist trigger and claim a fire.
Sourcepub fn revoke_strategist_cap_bonus(&mut self)
pub fn revoke_strategist_cap_bonus(&mut self)
Revoke the cap bonus granted by Self::claim_strategist_fire.
Sourcepub fn reset_strategist_state(&mut self)
pub fn reset_strategist_state(&mut self)
Reset ALL strategist state.
Sourcepub fn record_strategy_recommendation(
&mut self,
path: String,
recommendation: String,
)
pub fn record_strategy_recommendation( &mut self, path: String, recommendation: String, )
Persist the strategist’s latest output path + short recommendation.
Sourcepub fn append_history(&mut self, entry: GoalHistoryEntry)
pub fn append_history(&mut self, entry: GoalHistoryEntry)
Append a history entry to the active goal, if any.