UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

34 lines 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HandleBrowserDialogTool = exports.HandleBrowserDialogGptSchema = exports.HandleBrowserDialogCoreSchema = void 0; const v4_1 = require("zod/v4"); const ToolSchema_1 = require("../models/ToolSchema"); const Tool_1 = require("./Tool"); exports.HandleBrowserDialogCoreSchema = v4_1.z.object({ text: v4_1.z .string() .nullable() .describe('If this is a "confirm" dialog, a string of "true" will accept the dialog and a string of "false" will dismiss it. However, if this is a "prompt" dialog, any non-null string will accept it, and a null value will dismiss it.'), }); exports.HandleBrowserDialogGptSchema = v4_1.z.object({ ...ToolSchema_1.BaseGptArgsSchema.shape, ...exports.HandleBrowserDialogCoreSchema.shape, }); /** * A no-op tool that exists just to record the decisioning around browser alert * dialogs/confirmations. See DonobuFlow#onDialog for details. */ class HandleBrowserDialogTool extends Tool_1.Tool { constructor() { super(HandleBrowserDialogTool.NAME, 'Handle a browser Window:confirm() or Window:prompt().', exports.HandleBrowserDialogCoreSchema, exports.HandleBrowserDialogGptSchema, false, undefined, ['web']); } async call(context, parameters) { return this.call(context, parameters); } async callFromGpt(context, parameters) { return this.call(context, parameters); } } exports.HandleBrowserDialogTool = HandleBrowserDialogTool; HandleBrowserDialogTool.NAME = 'handleBrowserDialog'; //# sourceMappingURL=HandleBrowserDialogTool.js.map