From 02b4c7a35ac0b714bc045d54fb4bb45d1ce4e490 Mon Sep 17 00:00:00 2001 From: t Date: Sat, 13 Jun 2026 23:45:59 -0600 Subject: Add Codex Responses support and session debugging Teach provider config and auth resolution about the Codex Responses dialect, including user-facing `style = "openai_responses"` with `dialect = "codex"`. Serialize and parse Responses traffic with provider-specific reasoning replay, assistant phase metadata, and robust function-call assembly keyed by `output_index` so streamed tool inputs survive proxy quirks and empty terminal payloads. Also persist thinking origins and message metadata across sessions, add the Anthropic interleaved-thinking header switch, write per-session debug logs, and improve the TUI and scripts for inspecting tool output and session costs. --- libpanto/src/agent.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libpanto/src/agent.zig') diff --git a/libpanto/src/agent.zig b/libpanto/src/agent.zig index 1da0261..0ff231a 100644 --- a/libpanto/src/agent.zig +++ b/libpanto/src/agent.zig @@ -78,7 +78,12 @@ fn cloneMessage(alloc: Allocator, msg: conversation.Message) !conversation.Messa for (msg.content.items) |block| { content.appendAssumeCapacity(try cloneBlock(alloc, block)); } - return .{ .role = msg.role, .content = content, .usage = msg.usage }; + return .{ + .role = msg.role, + .content = content, + .usage = msg.usage, + .metadata = if (msg.metadata) |m| try alloc.dupe(u8, m) else null, + }; } fn cloneBlock(alloc: Allocator, block: conversation.ContentBlock) !conversation.ContentBlock { @@ -91,7 +96,9 @@ fn cloneBlock(alloc: Allocator, block: conversation.ContentBlock) !conversation. mut.deinit(alloc); } const sig: ?[]const u8 = if (b.signature) |s| try alloc.dupe(u8, s) else null; - break :blk .{ .Thinking = .{ .text = tb, .signature = sig } }; + errdefer if (sig) |s| alloc.free(s); + const origin: ?conversation.SignatureOrigin = if (b.signature_origin) |o| try o.dupe(alloc) else null; + break :blk .{ .Thinking = .{ .text = tb, .signature = sig, .signature_origin = origin } }; }, .ToolUse => |b| blk: { const id = try alloc.dupe(u8, b.id); -- cgit v1.3