summaryrefslogtreecommitdiff
path: root/src/tui_components.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-16 11:49:54 -0600
committert <t@tjp.lol>2026-06-16 11:58:44 -0600
commit28cb3eacfcf1217b4d014dd864005deb2d7f0585 (patch)
tree22a49deb365589e3180a8e119870d6abb2ed308c /src/tui_components.zig
parent92ce53385fa438cab221c6881da141b5ef0a7261 (diff)
tool collapsed state, and fixing dirty component flags
Diffstat (limited to 'src/tui_components.zig')
-rw-r--r--src/tui_components.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tui_components.zig b/src/tui_components.zig
index 545ccce..3944ffa 100644
--- a/src/tui_components.zig
+++ b/src/tui_components.zig
@@ -2369,6 +2369,8 @@ pub const ToolUse = struct {
cache: RenderCache,
/// Resolved tool name, or null until `tool_details`/completion.
name: ?std.ArrayList(u8) = null,
+ /// Tool-call id, once resolved.
+ id: ?std.ArrayList(u8) = null,
/// Accumulated verbatim input JSON (streamed args).
input: std.ArrayList(u8) = .empty,
/// Result output text, or null until the result lands.
@@ -2385,11 +2387,25 @@ pub const ToolUse = struct {
pub fn deinit(self: *ToolUse) void {
if (self.name) |*n| n.deinit(self.alloc);
+ if (self.id) |*i| i.deinit(self.alloc);
self.input.deinit(self.alloc);
if (self.output) |*o| o.deinit(self.alloc);
self.cache.deinit();
}
+ /// Resolve the tool-call id.
+ pub fn setId(self: *ToolUse, id: []const u8) !void {
+ if (id.len == 0) return;
+ if (self.id) |existing| {
+ if (std.mem.eql(u8, existing.items, id)) return;
+ self.id.?.clearRetainingCapacity();
+ } else {
+ self.id = .empty;
+ }
+ try self.id.?.appendSlice(self.alloc, id);
+ self.cache.markDirty();
+ }
+
/// Resolve the tool name (from `tool_details` or the completed block).
pub fn setName(self: *ToolUse, name: []const u8) !void {
if (self.name) |existing| {