pub struct SyncStore { /* private fields */ }Expand description
A small file-backed event log used by the HTTP sync endpoints.
Each request loads the current log, applies its operation, and (for writes) saves it back, so the stateless server still shares one log across requests.
Implementations§
Source§impl SyncStore
impl SyncStore
Sourcepub fn events(&self) -> &[MemoryEvent]
pub fn events(&self) -> &[MemoryEvent]
The events currently held.
Sourcepub fn to_links_notation(&self) -> String
pub fn to_links_notation(&self) -> String
Render the log as a demo_memory Links-Notation document.
Sourcepub fn delta_links_notation(&self, last_seen: Option<&str>) -> String
pub fn delta_links_notation(&self, last_seen: Option<&str>) -> String
Render only the events after last_seen as Links Notation (the delta a
puller applies).
Sourcepub fn import_links_notation(&mut self, text: &str) -> Result<usize>
pub fn import_links_notation(&mut self, text: &str) -> Result<usize>
Import a demo_memory document, merging by id, and persist the result.
Returns the number of events added.
§Errors
Returns an std::io::Error when the backing file cannot be written.
Sourcepub fn record_chat_exchange(
&mut self,
prompt: &str,
answer: &str,
) -> Result<usize>
pub fn record_chat_exchange( &mut self, prompt: &str, answer: &str, ) -> Result<usize>
Record one live chat exchange into the shared memory log (issue #540’s
live-usage loop): the user turn becomes a message event that
requirement learning can lift, and the assistant turn becomes a task
event with the exact input/output pair dreaming can replay and
generalize. Ids are stable over (prompt, answer), so retries do not
duplicate. Set FORMAL_AI_RECORD_CHAT=0 to opt out.
§Errors
Returns an std::io::Error when the backing file cannot be written.
Sourcepub fn record_chat_exchange_with_tools(
&mut self,
prompt: &str,
answer: &str,
tools: &[RecordedToolExecution],
) -> Result<usize>
pub fn record_chat_exchange_with_tools( &mut self, prompt: &str, answer: &str, tools: &[RecordedToolExecution], ) -> Result<usize>
Record a completed exchange plus the actual tool work delegated to and returned by an agentic API client. The tool events use the same durable schema as browser-side tool traces, and the final task cites them as evidence. Stable ids omit transient protocol call ids, so a retried exchange merges instead of duplicating learned evidence.
§Errors
Returns an std::io::Error when the backing file cannot be written.