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/anthropic_messages_json.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libpanto/src/anthropic_messages_json.zig') diff --git a/libpanto/src/anthropic_messages_json.zig b/libpanto/src/anthropic_messages_json.zig index 940d55e..c2b133e 100644 --- a/libpanto/src/anthropic_messages_json.zig +++ b/libpanto/src/anthropic_messages_json.zig @@ -712,7 +712,7 @@ test "serializeRequest - signed assistant Thinking blocks round-trip" { .signature = sig, } }, .{ .Text = try conversation.textualBlockFromSlice(allocator, "the answer is 42") }, - }); + }, null); const cfg = testConfig("claude-x"); var empty_tools = tool_registry_mod.ToolRegistry.init(allocator); @@ -755,7 +755,7 @@ test "serializeRequest - unsigned Thinking blocks are dropped" { .signature = null, } }, .{ .Text = try conversation.textualBlockFromSlice(allocator, "answer") }, - }); + }, null); const cfg = testConfig("claude-x"); var empty_tools = tool_registry_mod.ToolRegistry.init(allocator); @@ -968,7 +968,7 @@ test "serializeRequest - dotted names are wire-encoded in tools and history" { try input.appendSlice(allocator, "{}"); try conv.addAssistantMessage(&.{ .{ .ToolUse = .{ .id = id, .name = name, .input = input } }, - }); + }, null); var tools = tool_registry_mod.ToolRegistry.init(allocator); defer tools.deinit(); @@ -1006,7 +1006,7 @@ test "serializeRequest - assistant ToolUse becomes tool_use content block" { try conv.addAssistantMessage(&.{ .{ .Text = try conversation.textualBlockFromSlice(allocator, "calling tool") }, .{ .ToolUse = .{ .id = id, .name = name, .input = input } }, - }); + }, null); var empty_tools = tool_registry_mod.ToolRegistry.init(allocator); defer empty_tools.deinit(); @@ -1144,7 +1144,7 @@ test "serializeRequest - empty ToolUse input becomes {} not invalid JSON" { const name = try allocator.dupe(u8, "noargs"); try conv.addAssistantMessage(&.{ .{ .ToolUse = .{ .id = id, .name = name, .input = .empty } }, - }); + }, null); var empty_tools = tool_registry_mod.ToolRegistry.init(allocator); defer empty_tools.deinit(); -- cgit v1.3