summaryrefslogtreecommitdiff
path: root/src/lua_bridge.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-07 11:42:41 -0600
committert <t@tjp.lol>2026-06-07 11:42:41 -0600
commit11818552dad254649af012df3b4277633943d2b6 (patch)
tree88c60f54b0a71d92adb4b09c7ff984080b5d86ac /src/lua_bridge.zig
parent457ee6a0d56c5a0470e77fca79d3e85f65f51fec (diff)
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.
Diffstat (limited to 'src/lua_bridge.zig')
-rw-r--r--src/lua_bridge.zig10
1 files changed, 5 insertions, 5 deletions
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.?);