summaryrefslogtreecommitdiff
path: root/libpanto/src/config.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/config.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/config.zig')
-rw-r--r--libpanto/src/config.zig31
1 files changed, 31 insertions, 0 deletions
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig
index 8efa810..203a091 100644
--- a/libpanto/src/config.zig
+++ b/libpanto/src/config.zig
@@ -67,6 +67,37 @@ pub const ProviderConfig = union(APIStyle) {
pub fn style(self: ProviderConfig) APIStyle {
return @as(APIStyle, self);
}
+
+ /// The wire-format provider identity for this config: the ground-truth
+ /// `{api_style, base_url, model, reasoning}` that a turn is sent with.
+ /// Anthropic has no reasoning-effort knob, so it reports `.default`.
+ /// Borrowed slices; valid as long as the config is.
+ pub fn wireIdentity(self: ProviderConfig) WireIdentity {
+ return switch (self) {
+ .openai_chat => |c| .{
+ .api_style = .openai_chat,
+ .base_url = c.base_url,
+ .model = c.model,
+ .reasoning = c.reasoning,
+ },
+ .anthropic_messages => |c| .{
+ .api_style = .anthropic_messages,
+ .base_url = c.base_url,
+ .model = c.model,
+ .reasoning = .default,
+ },
+ };
+ }
+};
+
+/// Wire-format provider identity (see `ProviderConfig.wireIdentity`). This
+/// is the same shape as `session_store.WireIdentity`; defined here to avoid
+/// a module cycle (config must not import session_store).
+pub const WireIdentity = struct {
+ api_style: APIStyle,
+ base_url: []const u8,
+ model: []const u8,
+ reasoning: ReasoningEffort = .default,
};
/// Compaction settings the agent consults when summarizing old history.