From 11818552dad254649af012df3b4277633943d2b6 Mon Sep 17 00:00:00 2001 From: t Date: Sun, 7 Jun 2026 11:42:41 -0600 Subject: Migrate panto CLI onto the public.zig surface Move the CLI off the internal libpanto module namespaces onto the curated public API: data-type aliases (Config family, Message/MessageRole/ effectiveSystemBlocks, Event, Pricing/PricingRegistry, the session seam, FileSystemJSONLStore, ContentBlockType), process lifecycle (panto.init/ deinit), and ResultParts.fromText/fromTextOwned/deinit in place of the freestanding textResult/ownedTextResult/freeResultParts. The CLI remains on two flagged internal namespaces, panto.agent and panto.conversation: it is a deep embedder that drives the loop below the curated Agent/Conversation facades (system-prompt seeding through the agent, compaction_system_prompt, the open_stream_fn test seam, standalone Conversation values, compactAndPersist). These stay re-exported from public.zig as a documented deep-embedder escape hatch; trimming the transitional block removed every other internal re-export. --- src/lua_bridge.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lua_bridge.zig') diff --git a/src/lua_bridge.zig b/src/lua_bridge.zig index 245b0ec..444cedc 100644 --- a/src/lua_bridge.zig +++ b/src/lua_bridge.zig @@ -270,7 +270,7 @@ pub fn pushJsonAsLua( /// one `.media` part per attachment (`data` is base64-encoded bytes). /// /// Every returned slice/part owns its bytes (allocated with `allocator`); -/// the caller frees via `panto.freeResultParts`. +/// the caller frees via `panto.ResultParts.deinit`. pub fn readHandlerResult( L: *c.lua_State, idx: c_int, @@ -281,8 +281,8 @@ pub fn readHandlerResult( var len: usize = 0; const ptr = c.lua_tolstring(L, idx, &len); if (ptr == null) return BridgeError.BadHandlerReturn; - return (panto.textResult(allocator, ptr[0..len]) catch - BridgeError.OutOfMemory); + return ((panto.ResultParts.fromText(allocator, ptr[0..len]) catch + return BridgeError.OutOfMemory).items); } if (ty != T_TABLE) return BridgeError.BadHandlerReturn; return readHandlerResultTable(L, idx, allocator); @@ -796,7 +796,7 @@ test "handler invocation: input parsed, result captured" { } const result = try readHandlerResult(L, -1, std.testing.allocator); - defer panto.freeResultParts(std.testing.allocator, result); + defer (panto.ResultParts{ .items = result }).deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 1), result.len); try std.testing.expectEqualStrings("got: hello", result[0].text); } @@ -821,7 +821,7 @@ test "readHandlerResult: table with text and attachments" { } const result = try readHandlerResult(L, -1, std.testing.allocator); - defer panto.freeResultParts(std.testing.allocator, result); + defer (panto.ResultParts{ .items = result }).deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 3), result.len); try std.testing.expectEqualStrings("see image", result[0].text); try std.testing.expectEqualStrings("image/png", result[1].media.media_type.?); -- cgit v1.3