From bb85e867bc938138f29fb45230169af1ba60761c Mon Sep 17 00:00:00 2001 From: t Date: Wed, 10 Jun 2026 10:06:07 -0600 Subject: Add addUserText helper; update all call sites Conversation.addUserMessage now takes a []ContentBlock (symmetric with addAssistantMessage). Introduce a thin addUserText wrapper in agent.zig for the plain-text case and update every call site in agent.zig and anthropic_messages_json.zig accordingly. --- libpanto/src/file_system_jsonl_store.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libpanto/src/file_system_jsonl_store.zig') diff --git a/libpanto/src/file_system_jsonl_store.zig b/libpanto/src/file_system_jsonl_store.zig index c77d7d2..979b35e 100644 --- a/libpanto/src/file_system_jsonl_store.zig +++ b/libpanto/src/file_system_jsonl_store.zig @@ -1435,6 +1435,15 @@ fn anStamp() session_mod.WireStamp { return .{ .api_style = .anthropic_messages, .base_url = "https://api.anthropic.com", .model = "claude-sonnet-4-20250514" }; } +/// Test helper: append a single-text user message (see the `addUserMessage` +/// signature change to a block slice). +fn addUserText(conv: *conversation_mod.Conversation, text: []const u8) !void { + const tb = try conversation_mod.textualBlockFromSlice(conv.allocator, text); + var block: conversation_mod.ContentBlock = .{ .Text = tb }; + errdefer block.deinit(conv.allocator); + try conv.addUserMessage(&.{block}); +} + test "newUuidV7: produces 36-char hyphenated string with version 7" { const io = testing.io; const id = try newUuidV7(testing.allocator, io); @@ -2058,7 +2067,7 @@ test "FileSystemJSONLStore catalog: create → append → load round-trips" { // messages owned here). var conv = conversation_mod.Conversation.init(testing.allocator); defer conv.deinit(); - try conv.addUserMessage("ping"); + try addUserText(&conv, "ping"); try conv.addAssistantMessage(&.{}, null); const id: session_store_mod.WireIdentity = .{ .api_style = .openai_chat, .base_url = "u", .model = "m" }; -- cgit v1.3