UNPKG

@hyperbrowser/agent

Version:

Hyperbrowsers Web Agent

27 lines (26 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserInteractionAction = exports.UserInteractionActionParams = void 0; const zod_1 = require("zod"); exports.UserInteractionActionParams = zod_1.z.object({ message: zod_1.z .string() .describe("A message to provide to the user. Make it friendly and ask them for a suitable response. Keep it short and between 1-2 sentences if possible."), kind: zod_1.z .enum(["password", "text_input", "select", "confirm"]) .describe("The kind of response that is expected from the user. If you can't find a suitable option, then respond with confirm."), choices: zod_1.z .array(zod_1.z.string()) .optional() .describe("If you select choices as the kind option, then what options should be offered to the user."), }).describe(`Action to request input from the user during task execution. Use this when you need to collect information from the user such as text input, password, selection from choices, or confirmation. The response will be returned to continue the workflow.`); const UserInteractionAction = (userInputFn) => { return { type: "UserInteractionActionParams", actionParams: exports.UserInteractionActionParams, run: async (ctx, action) => await userInputFn(action), }; }; exports.UserInteractionAction = UserInteractionAction;