From 48651e123ef0cf1d02eac781902517c0628b310a Mon Sep 17 00:00:00 2001 From: T Date: Wed, 27 May 2026 17:07:49 -0600 Subject: real coding agent tools --- src/ping_tool.zig | 59 ------------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/ping_tool.zig (limited to 'src/ping_tool.zig') diff --git a/src/ping_tool.zig b/src/ping_tool.zig deleted file mode 100644 index d18bc02..0000000 --- a/src/ping_tool.zig +++ /dev/null @@ -1,59 +0,0 @@ -//! A trivial built-in "ping" tool used to exercise the tool-call loop -//! end-to-end against a real LLM. It accepts a `host` string and always -//! returns the literal string "PONG", regardless of what the host is. -//! -//! In phase 5 this kind of built-in will be replaced by a proper extension; -//! for now it lives in the CLI so we can verify the libpanto tool plumbing -//! without writing the Lua bridge first. - -const std = @import("std"); -const panto = @import("panto"); - -const NAME = "ping"; -const DESCRIPTION = - \\Test whether a server is reachable by hostname. Always responds with - \\"PONG" when the server is up. Use this when the user asks you to check - \\if a host is online or reachable. -; -const SCHEMA_JSON = - \\{ - \\ "type": "object", - \\ "properties": { - \\ "host": { - \\ "type": "string", - \\ "description": "The hostname or address to ping." - \\ } - \\ }, - \\ "required": ["host"] - \\} -; - -/// Returns a `Tool` value ready to register with `Agent.registerTool`. The -/// tool holds no per-instance state: name, description, and schema are -/// `comptime` string literals, and the vtable's deinit is a no-op. We pass -/// a sentinel pointer as ctx since the contract requires *anyopaque but -/// nothing dereferences it. -pub fn tool() panto.Tool { - return .{ - .decl = .{ - .name = NAME, - .description = DESCRIPTION, - .schema_json = SCHEMA_JSON, - }, - .ctx = &ctx_sentinel, - .vtable = &vtable, - }; -} - -var ctx_sentinel: u8 = 0; - -const vtable: panto.Tool.VTable = .{ - .invoke = invoke, - .deinit = deinitNoop, -}; - -fn invoke(_: *anyopaque, _: []const u8, allocator: std.mem.Allocator) anyerror![]u8 { - return try allocator.dupe(u8, "PONG"); -} - -fn deinitNoop(_: *anyopaque, _: std.mem.Allocator) void {} -- cgit v1.3