From 17a985cb41727b8a1bca4d95f334106c09386040 Mon Sep 17 00:00:00 2001 From: t Date: Sun, 7 Jun 2026 14:57:58 -0600 Subject: Alias Conversation instead of facading it; merge addAssistantMessage A facade that forwards every method 1:1 is worse than paring the real type down to the intended surface and aliasing it. conversation.Conversation's interface is already the public surface we want (init/deinit, the add*/replace* builders, and messages/allocator as plain data fields), so public.zig now aliases it straight through and Agent.conversation() returns a borrowed *Conversation for in-place surgery. Drops the ConversationData alias and the pointer-wrapper. Merged addAssistantMessageWithUsage into addAssistantMessage(blocks, ?usage) on the real type (separate method deleted), so the alias has the intended one-method shape; all call sites updated. Only Agent and Stream remain true facades -- they have genuinely-internal fields plus API-shaping renames (Stream.phase->state, Phase->State) an alias can't express. --- libpanto/src/openai_chat_json.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libpanto/src/openai_chat_json.zig') diff --git a/libpanto/src/openai_chat_json.zig b/libpanto/src/openai_chat_json.zig index 2307ce8..53d4b0c 100644 --- a/libpanto/src/openai_chat_json.zig +++ b/libpanto/src/openai_chat_json.zig @@ -640,7 +640,7 @@ test "serializeRequest - assistant Thinking blocks are stripped from outbound hi try conv.addAssistantMessage(&.{ .{ .Thinking = .{ .text = try conversation.textualBlockFromSlice(allocator, "thinking step") } }, .{ .Text = try conversation.textualBlockFromSlice(allocator, "answer here") }, - }); + }, null); const cfg = testConfig("gpt-4o"); var tools = emptyTools(); @@ -865,7 +865,7 @@ test "serializeRequest - assistant ToolUse becomes tool_calls" { try conv.addAssistantMessage(&.{ .{ .Text = try conversation.textualBlockFromSlice(allocator, "calling tool") }, .{ .ToolUse = .{ .id = id, .name = name, .input = args } }, - }); + }, null); var tools = emptyTools(); defer tools.deinit(); @@ -1053,7 +1053,7 @@ test "serializeRequest - compaction summary trims superseded prefix" { try conv.addUserMessage("ancient question"); try conv.addAssistantMessage(&.{ .{ .Text = try conversation.textualBlockFromSlice(allocator, "ancient answer") }, - }); + }, null); // Compaction summary resets conversation context. try conv.addCompactionSummary("summary of the ancient exchange"); // Kept-verbatim suffix replayed after the summary. -- cgit v1.3