feat: add built-in browser tool

Add a first-class browser tool backed by agent-browser and enable it by default in coding sessions.

Include CLI and system-prompt wiring plus focused coverage for the new tool.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Harivansh Rathi 2026-03-08 12:50:02 -07:00
parent df702d95a3
commit 0720c47495
8 changed files with 797 additions and 15 deletions

View file

@ -5,7 +5,11 @@
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import chalk from "chalk";
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR } from "../config.js";
import { allTools, type ToolName } from "../core/tools/index.js";
import {
allTools,
defaultCodingToolNames,
type ToolName,
} from "../core/tools/index.js";
export type Mode = "text" | "json" | "rpc";
@ -193,7 +197,11 @@ export function parseArgs(
}
export function printHelp(): void {
console.log(`${chalk.bold(APP_NAME)} - AI coding assistant with read, bash, edit, write tools
const defaultToolsText = defaultCodingToolNames.join(",");
const availableToolsText = Object.keys(allTools).join(", ");
const defaultToolsLabel = defaultCodingToolNames.join(", ");
console.log(`${chalk.bold(APP_NAME)} - AI coding assistant with read, bash, browser, edit, write tools
${chalk.bold("Usage:")}
${APP_NAME} [options] [@files...] [messages...]
@ -224,8 +232,8 @@ ${chalk.bold("Options:")}
--models <patterns> Comma-separated model patterns for Ctrl+P cycling
Supports globs (anthropic/*, *sonnet*) and fuzzy matching
--no-tools Disable all built-in tools
--tools <tools> Comma-separated list of tools to enable (default: read,bash,edit,write)
Available: read, bash, edit, write, grep, find, ls
--tools <tools> Comma-separated list of tools to enable (default: ${defaultToolsText})
Available: ${availableToolsText}
--thinking <level> Set thinking level: off, minimal, low, medium, high, xhigh
--extension, -e <path> Load an extension file (can be used multiple times)
--no-extensions, -ne Disable extension discovery (explicit -e paths still work)
@ -322,9 +330,10 @@ ${chalk.bold("Environment Variables:")}
PI_SHARE_VIEWER_URL - Base URL for /share command (default: https://pi.dev/session/)
PI_AI_ANTIGRAVITY_VERSION - Override Antigravity User-Agent version (e.g., 1.23.0)
${chalk.bold("Available Tools (default: read, bash, edit, write):")}
${chalk.bold(`Available Tools (default: ${defaultToolsLabel}):`)}
read - Read file contents
bash - Execute bash commands
browser - Browser automation with persistent state
edit - Edit files with find/replace
write - Write files (creates/overwrites)
grep - Search file contents (read-only, off by default)