From b14859b9726185ab873356390068e887b7f486d3 Mon Sep 17 00:00:00 2001 From: t Date: Sun, 7 Jun 2026 11:35:49 -0600 Subject: R2: redesign session store with wire-format identity Replace the single-session SessionManager seam with a directory-backed catalog. session_manager.zig -> file_system_jsonl_store.zig; the old machinery becomes internal SessionFile, and a new FileSystemJSONLStore implements the redesigned SessionStore vtable (create/list/resolve/latest/ load/appendMessages) minting Session/SessionInfo handles. Session logs now record wire-format provider identity ({api_style, base_url, model, reasoning}) instead of a single provider string or CLI aliases; no api_key material is ever stored. Disk* content types renamed Stored*; the rich audit-oriented write record is PersistentMessage (in-memory Message + WireIdentity + provenance). Agent.init now takes a Session; persist_provider/persist_model display strings deleted (banner stays alias-based, resume picks default model). Message.metadata round-trips. Dangling-prompt recovery dropped. CLI migrated to the catalog store for run/resume/list. Clean break, no version bump (old logs wiped). --- libpanto/src/conversation.zig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libpanto/src/conversation.zig') diff --git a/libpanto/src/conversation.zig b/libpanto/src/conversation.zig index f0c822d..1fc5016 100644 --- a/libpanto/src/conversation.zig +++ b/libpanto/src/conversation.zig @@ -209,6 +209,13 @@ pub const Message = struct { /// null on user/system messages and when the provider emitted no usage. /// Used by compaction to size the retention window. usage: ?Usage = null, + /// Opaque per-message metadata bag. `libpanto` never interprets these + /// bytes; the documented contract is that, when present, they are valid + /// JSON (so a store may keep them as a JSON column and tools may + /// deserialize them). Round-trips through persistence: set before a turn + /// commits, read back off the `Message` after `load`. Borrowed; owned by + /// whoever set it (the conversation's allocator on the replay path). + metadata: ?[]const u8 = null, pub fn deinit(self: *Message, alloc: Allocator) void { for (self.content.items) |*block| { -- cgit v1.3