diff options
| author | T <t@tjp.lol> | 2026-05-27 17:07:49 -0600 |
|---|---|---|
| committer | T <t@tjp.lol> | 2026-05-27 18:05:12 -0600 |
| commit | 48651e123ef0cf1d02eac781902517c0628b310a (patch) | |
| tree | f8f87205b2ca716f406ae69288ebef622659dd9e /src/ping_tool.zig | |
| parent | f72b5793a5c7e7891e4904be73c0bc6bc038fa18 (diff) | |
real coding agent tools
Diffstat (limited to 'src/ping_tool.zig')
| -rw-r--r-- | src/ping_tool.zig | 59 |
1 files changed, 0 insertions, 59 deletions
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 {} |
