summaryrefslogtreecommitdiff
path: root/src/lua_runtime.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_runtime.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_runtime.zig')
-rw-r--r--src/lua_runtime.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua_runtime.zig b/src/lua_runtime.zig
index 73078c0..c15ee63 100644
--- a/src/lua_runtime.zig
+++ b/src/lua_runtime.zig
@@ -549,7 +549,7 @@ const Slot = struct {
/// via the `pcall` wrapping.
ok: bool = false,
/// Result payload as owned parts. Allocated from `allocator`.
- /// Caller frees via `panto.freeResultParts`.
+ /// Caller frees via `panto.ResultParts.deinit`.
value: ?[]panto.ResultPart = null,
/// On `ok = false`, an owned copy of the error message.
err_msg: ?[]u8 = null,
@@ -703,11 +703,11 @@ fn runBatch(
continue;
}
if (slot.ok) {
- results[i] = .{ .ok = slot.value orelse try panto.textResult(allocator, "") };
+ results[i] = .{ .ok = slot.value orelse (try panto.ResultParts.fromText(allocator, "")).items };
// Free the err_msg if both ended up set somehow.
if (slot.err_msg) |m| allocator.free(m);
} else {
- if (slot.value) |v| panto.freeResultParts(allocator, v);
+ if (slot.value) |v| (panto.ResultParts{ .items = v }).deinit(allocator);
std.log.warn(
"panto-lua: tool '{s}' failed: {s}",
.{
@@ -740,7 +740,7 @@ fn formatToolError(
"panto-lua: tool '{s}' failed: {s}",
.{ tool_name, message },
);
- return panto.ownedTextResult(allocator, text);
+ return (try panto.ResultParts.fromTextOwned(allocator, text)).items;
}
/// Start one coroutine: create a thread under the runtime's lua_State,
@@ -1077,7 +1077,7 @@ fn okText(result: panto.ToolCallResult) []const u8 {
/// Test helper: free a results slice (parts on `.ok`).
fn freeResults(results: []panto.ToolCallResult) void {
for (results) |r| switch (r) {
- .ok => |b| panto.freeResultParts(testing.allocator, b),
+ .ok => |b| (panto.ResultParts{ .items = b }).deinit(testing.allocator),
.err => {},
};
}