vercel-labs--agent-browser
cb15c5e0d8
Release / Check for new version (push) Has been cancelled
Release / Build macOS ARM64 (push) Has been cancelled
Release / Build macOS x64 (push) Has been cancelled
Release / Build Linux ARM64 (push) Has been cancelled
Release / Build Linux musl ARM64 (push) Has been cancelled
Release / Build Linux musl x64 (push) Has been cancelled
Release / Build Linux x64 (push) Has been cancelled
Release / Build Windows x64 (push) Has been cancelled
Release / Publish to npm (push) Has been cancelled
Release / Publish sandbox package to npm (push) Has been cancelled
Release / Create GitHub Release (push) Has been cancelled
CI / Rust (windows-latest - x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Native E2E Tests (push) Has been cancelled
CI / Windows Integration Test (push) Has been cancelled
CI / Global Install (macos-latest) (push) Has been cancelled
CI / Global Install (ubuntu-latest) (push) Has been cancelled
CI / Version Sync Check (push) Has been cancelled
CI / Rust (push) Has been cancelled
CI / Dashboard (push) Has been cancelled
CI / Sandbox Package (push) Has been cancelled
CI / Rust (macos-latest - aarch64-apple-darwin) (push) Has been cancelled
CI / Rust (macos-latest - x86_64-apple-darwin) (push) Has been cancelled
CI / Global Install (windows-latest) (push) Has been cancelled
20 行
641 B
TypeScript
20 行
641 B
TypeScript
import { runAgentBrowser } from "@agent-browser/sandbox/eve";
|
|
import { defineTool } from "eve/tools";
|
|
import { z } from "zod";
|
|
|
|
export default defineTool({
|
|
description: "Open a URL in a sandboxed browser and return an accessibility snapshot.",
|
|
inputSchema: z.object({
|
|
url: z.string().url(),
|
|
}),
|
|
async execute({ url }, ctx) {
|
|
await runAgentBrowser(ctx, ["open", url]);
|
|
try {
|
|
const snapshot = await runAgentBrowser(ctx, ["snapshot", "-i", "-c"], { json: false });
|
|
return { snapshot: snapshot.stdout };
|
|
} finally {
|
|
await runAgentBrowser(ctx, ["close"], { json: false }).catch(() => {});
|
|
}
|
|
},
|
|
});
|