summaryrefslogtreecommitdiff
path: root/libpanto/src/conversation.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-07 11:35:49 -0600
committert <t@tjp.lol>2026-06-07 11:35:49 -0600
commitb14859b9726185ab873356390068e887b7f486d3 (patch)
tree6530d8ee62e7639b50c99a67d23f89e25ef572dc /libpanto/src/conversation.zig
parentd36a51358efbc48de3d5b732727455efc60acae1 (diff)
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).
Diffstat (limited to 'libpanto/src/conversation.zig')
-rw-r--r--libpanto/src/conversation.zig7
1 files changed, 7 insertions, 0 deletions
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| {