summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorT <t@tjp.lol>2026-05-25 22:54:43 -0600
committerT <t@tjp.lol>2026-05-26 10:10:42 -0600
commitc2f727e188c1558bcc6b34569af2feab3b0366c0 (patch)
tree24573b32e92cb45f998c24c304d2b060c6737b1f /src/main.zig
parentf026bb81ae68f516910d0eb4f23c9344dd36b62b (diff)
phase 3 part 1
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig23
1 files changed, 17 insertions, 6 deletions
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,
};