/** * Tools client for the agent-tools API. */ import type { DocumentResult, ExecuteResult, ScrapeResult } from "./types.js"; import { type HttpConfig } from "./_http.js"; type DocumentBaseContentType = "text/plain" | "text/html" | "application/xhtml+xml"; /** A supported document MIME, optionally followed by parameters such as charset. */ export type DocumentContentType = DocumentBaseContentType | `${DocumentBaseContentType};${string}`; export type ParseDocumentOpts = ({ url: string; base64?: never; content_type?: never; } | { url?: never; base64: string; content_type?: DocumentContentType; }) & { /** Opaque, already signed x402 V2 `PAYMENT-SIGNATURE` base64-JSON value. */ paymentSignature?: string; }; export interface ScrapeOptions { selector?: string; extract_links?: boolean; /** Opaque, already signed x402 V2 `PAYMENT-SIGNATURE` base64-JSON value. */ paymentSignature?: string; } /** * Client for the agent-tools API (scrape, browse, execute, document). * * Note: web search is BYOK as of 0.7.0 — agenttool is not a paid-API * reseller. Retrieve provider credentials only inside your own trusted * process and call the provider from infrastructure you control; hosted * execute does not inject vault values and is not a tenant sandbox. * * @example * ```ts * const at = new AgentTool(); * // Static scrape uses the bounded public-URL path; legacy execute is disabled. * const page = at.tools.scrape("https://example.com"); * const out = at.tools.execute("print(42)"); * ``` */ export declare class ToolsClient { private readonly http; /** @internal */ constructor(http: HttpConfig); /** * Scrape a public HTTP(S) URL through the server's bounded fetch path. * The server reads the bytes; HTTP is cleartext and returned content is * untrusted. Responses are capped before parsing. * * @param url - The URL to scrape. * @returns ScrapeResult with the page content. */ scrape(url: string, options?: ScrapeOptions): Promise; /** * Call the disabled-by-default legacy host-execute route. This is not a * tenant sandbox; the API returns 503 unless its operator explicitly opts in. * * @param code - Source code to execute. * @param options - Optional language (default: "python"). * @returns ExecuteResult with stdout, stderr, exit_code, duration_ms. */ execute(code: string, options?: { language?: string; }): Promise; /** * Parse a document and extract readable text. * * Supports HTML (via Mozilla Readability) and plain text. Pass either * `url` (fetched server-side through the bounded public-URL path) or * `base64` encoded content. Remote bytes are server-readable and untrusted; * HTTP is cleartext. * * @example * ```ts * const doc = await at.tools.parse_document({ * base64: btoa("local document"), * content_type: "text/plain", * }); * console.log(doc.title, doc.word_count); * ``` */ parse_document(options: ParseDocumentOpts): Promise; private post; } export {};