From c2f727e188c1558bcc6b34569af2feab3b0366c0 Mon Sep 17 00:00:00 2001 From: T Date: Mon, 25 May 2026 22:54:43 -0600 Subject: phase 3 part 1 --- src/main.zig | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 688b61d..20da910 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,5 +1,6 @@ const std = @import("std"); const panto = @import("panto"); +const ping_tool = @import("ping_tool.zig"); const Receiver = panto.provider.Receiver; const ReceiverVTable = panto.provider.ReceiverVTable; @@ -38,10 +39,14 @@ const CLIReceiver = struct { meta: ?BlockMeta, ) anyerror!void { _ = index; - _ = meta; const self: *CLIReceiver = @ptrCast(@alignCast(ptr)); - if (block_type == .Thinking) { - try self.stdout.writeAll("\x1b[2m[thinking] "); + switch (block_type) { + .Thinking => try self.stdout.writeAll("\x1b[2m[thinking] "), + .ToolUse => { + const name = if (meta) |m| (m.tool_name orelse "?") else "?"; + try self.stdout.print("\n\x1b[36m[tool: {s}]\x1b[0m ", .{name}); + }, + else => {}, } try self.file.flush(); } @@ -60,8 +65,10 @@ const CLIReceiver = struct { ) anyerror!void { _ = index; const self: *CLIReceiver = @ptrCast(@alignCast(ptr)); - if (block == .Thinking) { - try self.stdout.writeAll("\x1b[0m\n"); + switch (block) { + .Thinking => try self.stdout.writeAll("\x1b[0m\n"), + .ToolUse => try self.stdout.writeAll("\n"), + else => {}, } try self.file.flush(); } @@ -175,9 +182,13 @@ pub fn main(init: std.process.Init) !void { try conv.addSystemMessage("You are a helpful assistant."); const prov = try panto.provider.Provider.init(alloc, io, config); - const agent = panto.agent.Agent.init(alloc, prov); + var agent = panto.agent.Agent.init(alloc, prov); defer agent.deinit(); + // smoke test: register a trivial built-in tool so we can exercise + // the tool-call loop against a real LLM. + try agent.registerTool(ping_tool.tool()); + const banner_model: []const u8 = switch (config) { inline else => |c| c.model, }; -- cgit v1.3