mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
agent: use action enum for tool calls and trim REPL input
- Update `buildToolCall` to use `browser_tools.Action` enum. - Trim whitespace from REPL input in `Agent.zig`. - Replace `expectEqualStrings` with `expectString` in tests.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
//! heal roundtrip themselves.
|
||||
|
||||
const std = @import("std");
|
||||
const browser_tools = @import("browser/tools.zig");
|
||||
|
||||
pub const Command = @import("script/command.zig").Command;
|
||||
pub const Recorder = @import("script/Recorder.zig");
|
||||
@@ -369,7 +370,8 @@ test "applyReplacements: heals a multi-line /eval block using iterator span" {
|
||||
fn buildToolCall(arena: std.mem.Allocator, name: []const u8, kvs: []const struct { []const u8, []const u8 }) Command {
|
||||
var obj: std.json.ObjectMap = .init(arena);
|
||||
for (kvs) |kv| obj.put(kv[0], .{ .string = kv[1] }) catch unreachable;
|
||||
return .{ .tool_call = .{ .name = name, .args = .{ .object = obj } } };
|
||||
const action = std.meta.stringToEnum(browser_tools.Action, name).?;
|
||||
return .{ .tool_call = .{ .action = action, .args = .{ .object = obj } } };
|
||||
}
|
||||
|
||||
test "formatHealReplacement: single command produces one-line replacement" {
|
||||
|
||||
Reference in New Issue
Block a user