import { n as CreateBrowserToolsOptions } from "../../ai-CDn3Abax.js";
import {
  T as BrowserSource,
  b as BrowserNewTab
} from "../../browser-CI97khiJ.js";
import {
  n as BrowserToolOptions,
  r as BrowserToolOutput,
  t as BrowserToolInput
} from "../../browser-tool-Cxtiwfua.js";
import { SchemaInput, ServerTool } from "@tanstack/ai";

//#region src/browser/tanstack-ai.d.ts
/**
 * Create TanStack AI tools for browser automation via CDP code mode.
 *
 * Returns an array with a single durable `browser_execute` `ServerTool`
 * backed by the same codemode runtime as `agents/browser/ai` — the model
 * writes TypeScript against the `cdp` connector and browser sessions
 * survive pauses.
 *
 * The stateless Quick Action tools are not surfaced through this TanStack
 * wrapper (it exposes only `browser_execute`); use `createQuickActionTools`
 * from `agents/browser/ai` if you want them.
 *
 * @example
 * ```ts
 * import { createBrowserTools } from "agents/browser/tanstack-ai";
 * import { chat } from "@tanstack/ai";
 *
 * // inside a Durable Object / Agent:
 * const browserTools = createBrowserTools({
 *   ctx: this.ctx,
 *   browser: this.env.BROWSER,
 *   loader: this.env.LOADER,
 * });
 *
 * const stream = chat({
 *   adapter: openaiText("gpt-4o"),
 *   tools: [...browserTools, ...otherTools],
 *   messages,
 * });
 * ```
 *
 * @deprecated Use `browserTool` from `agents/browser/ai-sdk`,
 * `agents/browser/tanstack-ai` or `agents/browser/pi`. See
 * https://github.com/cloudflare/agents/blob/main/docs/agents/browse-the-web.md#persistent-browser
 */
declare function createBrowserTools(
  options: CreateBrowserToolsOptions
): ServerTool<SchemaInput, SchemaInput>[];
//#endregion
//#region src/browser/tools/tanstack-ai.d.ts
interface TanStackBrowserToolOptions<
  TName extends string = "browser"
> extends BrowserToolOptions {
  /** The tool's name. TanStack AI tools carry it in the definition. */
  name?: TName;
}
/**
 * Create a TanStack AI tool that lets the model drive a persistent browser
 * with JavaScript and the Chrome DevTools Protocol.
 *
 * Works like `browserTool` in `agents/browser/ai-sdk`: tabs, cookies, and
 * logins carry over between runs, `sessionId: "active"` addresses the tab the
 * model last worked in, and a replaced browser is reported in the
 * result's `notice`. The tool is named `browser` unless you pass `name`.
 *
 * Unlike the AI SDK tool, the host gets the same output as the model, and
 * screenshots aren't supported: a returned screenshot is replaced by a
 * sentence saying it was left out.
 *
 * @example
 * ```ts
 * import { Browser, browserRun } from "agents/browser";
 * import { browserTool } from "agents/browser/tanstack-ai";
 * import { chat } from "@tanstack/ai";
 *
 * export class MyAgent extends Agent<Env> {
 *   browser = new Browser({ provider: browserRun(this.env.BROWSER) });
 *
 *   constructor(ctx: AgentContext, env: Env) {
 *     super(ctx, env);
 *     this.lifecycle.use(this.browser);
 *   }
 *
 *   async onChatMessage() {
 *     const stream = chat({
 *       adapter,
 *       tools: [browserTool({ browser: this.browser, loader: this.env.LOADER })],
 *       messages
 *     });
 *   }
 * }
 * ```
 */
declare function browserTool<TName extends string = "browser">(
  options: TanStackBrowserToolOptions<TName>
): import("@tanstack/ai").ServerTool<
  {
    "~standard": {
      version: 1;
      vendor: string;
      types:
        | {
            readonly input: BrowserToolInput;
            readonly output: BrowserToolInput;
          }
        | undefined;
      validate: (value: unknown) =>
        | {
            readonly value: BrowserToolInput;
          }
        | {
            readonly issues: ReadonlyArray<{
              readonly message: string;
            }>;
          };
      jsonSchema: {
        input: (_options: { readonly target: string }) => {
          type: string;
          properties: {
            code: {
              type: string;
              description: string;
            };
          };
          required: string[];
          additionalProperties: boolean;
        };
        output: (_options: { readonly target: string }) => {
          type: string;
          properties: {
            code: {
              type: string;
              description: string;
            };
          };
          required: string[];
          additionalProperties: boolean;
        };
      };
    };
  },
  import("@tanstack/ai").SchemaInput,
  TName,
  unknown
>;
//#endregion
export {
  type BrowserNewTab,
  type BrowserSource,
  type BrowserToolInput,
  type BrowserToolOptions,
  type BrowserToolOutput,
  type CreateBrowserToolsOptions,
  TanStackBrowserToolOptions,
  browserTool,
  createBrowserTools
};
//# sourceMappingURL=tanstack-ai.d.ts.map
