agent: unify interactive prompts and tool execution

This commit is contained in:
Adrià Arrufat
2026-05-09 20:40:38 +02:00
parent 1de98efbc4
commit a5e7ec16be
3 changed files with 60 additions and 42 deletions

View File

@@ -89,5 +89,16 @@ pub fn call(self: *Self, arena: std.mem.Allocator, tool_name: []const u8, argume
else
null;
return self.callValue(arena, tool_name, arguments);
}
/// Like `call` but takes an already-parsed JSON value. Skips the
/// stringify+reparse for callers (e.g. PandaScript replay) that already
/// have a `std.json.Value`.
pub fn callValue(self: *Self, arena: std.mem.Allocator, tool_name: []const u8, arguments: ?std.json.Value) browser_tools.ToolError![]const u8 {
return browser_tools.call(arena, self.session, &self.node_registry, tool_name, arguments);
}
pub fn extractText(self: *Self, arena: std.mem.Allocator, selector: []const u8) browser_tools.EvalResult {
return browser_tools.extractText(arena, self.session, &self.node_registry, selector);
}