agent: add markdown command

This commit is contained in:
Adrià Arrufat
2026-04-03 09:54:35 +02:00
parent 15c0a7be83
commit 3b1ef66b51
2 changed files with 6 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ pub const Command = union(enum) {
type_cmd: TypeArgs,
wait: []const u8,
tree: void,
markdown: void,
extract: ExtractArgs,
eval_js: []const u8,
exit: void,
@@ -61,6 +62,10 @@ pub fn parse(line: []const u8) Command {
return .{ .tree = {} };
}
if (eqlIgnoreCase(cmd_word, "MARKDOWN") or eqlIgnoreCase(cmd_word, "MD")) {
return .{ .markdown = {} };
}
if (eqlIgnoreCase(cmd_word, "EXTRACT")) {
const selector = extractQuoted(rest) orelse {
if (rest.len == 0) return .{ .natural_language = trimmed };

View File

@@ -28,6 +28,7 @@ pub fn execute(self: *Self, cmd: Command.Command) void {
.type_cmd => |args| self.execType(a, args),
.wait => |selector| self.tool_executor.call(a, "waitForSelector", buildJson(a, .{ .selector = selector })) catch "Error: wait failed",
.tree => self.tool_executor.call(a, "semantic_tree", "") catch "Error: tree failed",
.markdown => self.tool_executor.call(a, "markdown", "") catch "Error: markdown failed",
.extract => |args| self.execExtract(a, args),
.eval_js => |script| self.tool_executor.call(a, "evaluate", buildJson(a, .{ .script = script })) catch "Error: eval failed",
.exit, .natural_language => unreachable,