diff options
| author | t <t@tjp.lol> | 2026-06-07 21:56:51 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-06-07 21:56:57 -0600 |
| commit | 75dedacfbeab1fea281d1bce124b920dcf878844 (patch) | |
| tree | be1f46a59979d7cafeb12fef7865c6603bcc639d /src/lua_runtime.zig | |
| parent | eb4179f9958deeae408a0a06b1f8ae6437e089db (diff) | |
further libpanto public API name cleanup
Diffstat (limited to 'src/lua_runtime.zig')
| -rw-r--r-- | src/lua_runtime.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lua_runtime.zig b/src/lua_runtime.zig index c15ee63..eb760f8 100644 --- a/src/lua_runtime.zig +++ b/src/lua_runtime.zig @@ -550,7 +550,7 @@ const Slot = struct { ok: bool = false, /// Result payload as owned parts. Allocated from `allocator`. /// Caller frees via `panto.ResultParts.deinit`. - value: ?[]panto.ResultPart = null, + value: ?panto.ResultParts = 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.ResultParts.fromText(allocator, "")).items }; + results[i] = .{ .ok = slot.value orelse try panto.ResultParts.fromText(allocator, "") }; // Free the err_msg if both ended up set somehow. if (slot.err_msg) |m| allocator.free(m); } else { - if (slot.value) |v| (panto.ResultParts{ .items = v }).deinit(allocator); + if (slot.value) |v| v.deinit(allocator); std.log.warn( "panto-lua: tool '{s}' failed: {s}", .{ @@ -734,13 +734,13 @@ fn formatToolError( allocator: Allocator, tool_name: []const u8, message: []const u8, -) ![]panto.ResultPart { +) !panto.ResultParts { const text = try std.fmt.allocPrint( allocator, "panto-lua: tool '{s}' failed: {s}", .{ tool_name, message }, ); - return (try panto.ResultParts.fromTextOwned(allocator, text)).items; + return panto.ResultParts.fromTextOwned(allocator, text); } /// Start one coroutine: create a thread under the runtime's lua_State, @@ -848,7 +848,7 @@ fn invokeCoroutineSync( input: []const u8, allocator: Allocator, err_msg_out: *?[]u8, -) ![]panto.ResultPart { +) !panto.ResultParts { const co = c.lua_newthread(L) orelse return RuntimeError.LuaInitFailed; defer c.lua_settop(L, c.lua_gettop(L) - 1); @@ -1065,7 +1065,7 @@ const testing = std.testing; fn okText(result: panto.ToolCallResult) []const u8 { switch (result) { .ok => |parts| { - for (parts) |p| { + for (parts.items) |p| { if (p == .text) return p.text; } return ""; @@ -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.ResultParts{ .items = b }).deinit(testing.allocator), + .ok => |b| b.deinit(testing.allocator), .err => {}, }; } |
