summaryrefslogtreecommitdiff
path: root/libpanto/src/anthropic_messages_json.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-07 14:57:58 -0600
committert <t@tjp.lol>2026-06-07 14:57:58 -0600
commit17a985cb41727b8a1bca4d95f334106c09386040 (patch)
tree237a7f1e0d45dafb61ace13f5112ecd31170df4c /libpanto/src/anthropic_messages_json.zig
parent1eddee33902757f7e06993825a3ad1011e7ec346 (diff)
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.
Diffstat (limited to 'libpanto/src/anthropic_messages_json.zig')
-rw-r--r--libpanto/src/anthropic_messages_json.zig10
1 files changed, 5 insertions, 5 deletions
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();