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_runtime.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lua_runtime.zig') 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 => {}, }; } -- cgit v1.3