pub struct LoopHistory { /* private fields */ }Expand description
Loop history manager for a single loop.
Wraps an append-only JSONL file for recording loop events.
Implementations§
Source§impl LoopHistory
impl LoopHistory
Sourcepub fn from_context(context: &LoopContext) -> Self
pub fn from_context(context: &LoopContext) -> Self
Create a loop history from a loop context.
Sourcepub fn append(&self, event: HistoryEvent) -> Result<(), HistoryError>
pub fn append(&self, event: HistoryEvent) -> Result<(), HistoryError>
Append an event to the history file.
This is thread-safe via file locking.
Sourcepub fn read_all(&self) -> Result<Vec<HistoryEvent>, HistoryError>
pub fn read_all(&self) -> Result<Vec<HistoryEvent>, HistoryError>
Read all events from the history file.
Sourcepub fn last_iteration(&self) -> Result<Option<u32>, HistoryError>
pub fn last_iteration(&self) -> Result<Option<u32>, HistoryError>
Find the last completed iteration number.
Returns None if no iterations have been completed.
Sourcepub fn is_completed(&self) -> Result<bool, HistoryError>
pub fn is_completed(&self) -> Result<bool, HistoryError>
Check if the loop completed successfully.
Sourcepub fn get_prompt(&self) -> Result<Option<String>, HistoryError>
pub fn get_prompt(&self) -> Result<Option<String>, HistoryError>
Get the original prompt that started the loop.
Sourcepub fn summary(&self) -> Result<HistorySummary, HistoryError>
pub fn summary(&self) -> Result<HistorySummary, HistoryError>
Get summary statistics about the loop.
Sourcepub fn record_started(&self, prompt: &str) -> Result<(), HistoryError>
pub fn record_started(&self, prompt: &str) -> Result<(), HistoryError>
Record loop started event.
Sourcepub fn record_iteration_started(
&self,
iteration: u32,
) -> Result<(), HistoryError>
pub fn record_iteration_started( &self, iteration: u32, ) -> Result<(), HistoryError>
Record iteration started event.
Sourcepub fn record_event_published(
&self,
topic: &str,
payload: &str,
) -> Result<(), HistoryError>
pub fn record_event_published( &self, topic: &str, payload: &str, ) -> Result<(), HistoryError>
Record event published event.
Sourcepub fn record_iteration_completed(
&self,
iteration: u32,
success: bool,
) -> Result<(), HistoryError>
pub fn record_iteration_completed( &self, iteration: u32, success: bool, ) -> Result<(), HistoryError>
Record iteration completed event.
Sourcepub fn record_completed(&self, reason: &str) -> Result<(), HistoryError>
pub fn record_completed(&self, reason: &str) -> Result<(), HistoryError>
Record loop completed event.
Sourcepub fn record_resumed(&self, from_iteration: u32) -> Result<(), HistoryError>
pub fn record_resumed(&self, from_iteration: u32) -> Result<(), HistoryError>
Record loop resumed event.
Sourcepub fn record_terminated(&self, signal: &str) -> Result<(), HistoryError>
pub fn record_terminated(&self, signal: &str) -> Result<(), HistoryError>
Record loop terminated event.
Sourcepub fn record_merge_queued(&self) -> Result<(), HistoryError>
pub fn record_merge_queued(&self) -> Result<(), HistoryError>
Record merge queued event.
Sourcepub fn record_merge_started(&self, pid: u32) -> Result<(), HistoryError>
pub fn record_merge_started(&self, pid: u32) -> Result<(), HistoryError>
Record merge started event.
Sourcepub fn record_merge_completed(&self, commit: &str) -> Result<(), HistoryError>
pub fn record_merge_completed(&self, commit: &str) -> Result<(), HistoryError>
Record merge completed event.
Sourcepub fn record_merge_failed(&self, reason: &str) -> Result<(), HistoryError>
pub fn record_merge_failed(&self, reason: &str) -> Result<(), HistoryError>
Record merge failed event.
Sourcepub fn record_discarded(&self, reason: &str) -> Result<(), HistoryError>
pub fn record_discarded(&self, reason: &str) -> Result<(), HistoryError>
Record loop discarded event.
Auto Trait Implementations§
impl Freeze for LoopHistory
impl RefUnwindSafe for LoopHistory
impl Send for LoopHistory
impl Sync for LoopHistory
impl Unpin for LoopHistory
impl UnwindSafe for LoopHistory
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> Erasable for T
impl<T> Erasable for 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 more