{"version":3,"file":"agent/actions/json_gemini.mjs","sources":["webpack://@agent-infra/browser-use/./src/agent/actions/json_gemini.ts"],"sourcesContent":["/**\n * The following code is modified based on\n * https://github.com/nanobrowser/nanobrowser/blob/master/chrome-extension/src/background/agent/actions/json_gemini.ts\n *\n * Apache-2.0 License\n * Copyright (c) 2024 alexchenzl\n * https://github.com/nanobrowser/nanobrowser/blob/master/LICENSE\n */\n// TODO: don't know why zod can not generate the same schema, need to fix it\nexport const geminiNavigatorOutputSchema = {\n  type: 'object',\n  properties: {\n    current_state: {\n      type: 'object',\n      description: 'Current state of the agent',\n      properties: {\n        page_summary: {\n          type: 'string',\n        },\n        evaluation_previous_goal: {\n          type: 'string',\n        },\n        memory: {\n          type: 'string',\n        },\n        next_goal: {\n          type: 'string',\n        },\n      },\n      required: [\n        'page_summary',\n        'evaluation_previous_goal',\n        'memory',\n        'next_goal',\n      ],\n    },\n    action: {\n      type: 'array',\n      items: {\n        type: 'object',\n        properties: {\n          done: {\n            type: 'object',\n            properties: {\n              text: {\n                type: 'string',\n              },\n            },\n            required: ['text'],\n            nullable: true,\n          },\n          search_google: {\n            type: 'object',\n            properties: {\n              query: {\n                type: 'string',\n              },\n            },\n            required: ['query'],\n            nullable: true,\n          },\n          go_to_url: {\n            type: 'object',\n            properties: {\n              url: {\n                type: 'string',\n              },\n            },\n            required: ['url'],\n            nullable: true,\n          },\n          go_back: {\n            type: 'string',\n            nullable: true,\n            description:\n              'Accepts absolutely anything in the incoming data\\nand discards it, so the final parsed model is empty.',\n          },\n          click_element: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              index: {\n                type: 'integer',\n              },\n              xpath: {\n                type: 'string',\n                nullable: true,\n              },\n            },\n            required: ['desc', 'index'],\n            nullable: true,\n          },\n          input_text: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              index: {\n                type: 'integer',\n              },\n              text: {\n                type: 'string',\n              },\n              xpath: {\n                type: 'string',\n                nullable: true,\n              },\n            },\n            required: ['desc', 'index', 'text'],\n            nullable: true,\n          },\n          switch_tab: {\n            type: 'object',\n            properties: {\n              tab_id: {\n                type: 'integer',\n              },\n            },\n            required: ['tab_id'],\n            nullable: true,\n          },\n          open_tab: {\n            type: 'object',\n            properties: {\n              url: {\n                type: 'string',\n              },\n            },\n            required: ['url'],\n            nullable: true,\n          },\n          cache_content: {\n            type: 'object',\n            properties: {\n              content: {\n                type: 'string',\n              },\n            },\n            required: ['content'],\n            nullable: true,\n          },\n          scroll_down: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              amount: {\n                type: 'integer',\n                nullable: true,\n              },\n            },\n            required: ['desc'],\n            nullable: true,\n          },\n          scroll_up: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              amount: {\n                type: 'integer',\n                nullable: true,\n              },\n            },\n            required: ['desc'],\n            nullable: true,\n          },\n          send_keys: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              keys: {\n                type: 'string',\n              },\n            },\n            required: ['desc', 'keys'],\n            nullable: true,\n          },\n          scroll_to_text: {\n            type: 'object',\n            properties: {\n              desc: {\n                type: 'string',\n                description:\n                  'Very short explanation of the intent or purpose for calling this action',\n              },\n              text: {\n                type: 'string',\n              },\n            },\n            required: ['desc', 'text'],\n            nullable: true,\n          },\n          get_dropdown_options: {\n            type: 'object',\n            properties: {\n              index: {\n                type: 'integer',\n              },\n            },\n            required: ['index'],\n            nullable: true,\n          },\n          select_dropdown_option: {\n            type: 'object',\n            properties: {\n              index: {\n                type: 'integer',\n              },\n              text: {\n                type: 'string',\n              },\n            },\n            required: ['index', 'text'],\n            nullable: true,\n          },\n        },\n        required: [],\n      },\n    },\n  },\n  required: ['current_state', 'action'],\n};\n"],"names":["geminiNavigatorOutputSchema"],"mappings":";;;;AASO,MAAMA,8BAA8B;IACzC,MAAM;IACN,YAAY;QACV,eAAe;YACb,MAAM;YACN,aAAa;YACb,YAAY;gBACV,cAAc;oBACZ,MAAM;gBACR;gBACA,0BAA0B;oBACxB,MAAM;gBACR;gBACA,QAAQ;oBACN,MAAM;gBACR;gBACA,WAAW;oBACT,MAAM;gBACR;YACF;YACA,UAAU;gBACR;gBACA;gBACA;gBACA;aACD;QACH;QACA,QAAQ;YACN,MAAM;YACN,OAAO;gBACL,MAAM;gBACN,YAAY;oBACV,MAAM;wBACJ,MAAM;wBACN,YAAY;4BACV,MAAM;gCACJ,MAAM;4BACR;wBACF;wBACA,UAAU;4BAAC;yBAAO;wBAClB,UAAU;oBACZ;oBACA,eAAe;wBACb,MAAM;wBACN,YAAY;4BACV,OAAO;gCACL,MAAM;4BACR;wBACF;wBACA,UAAU;4BAAC;yBAAQ;wBACnB,UAAU;oBACZ;oBACA,WAAW;wBACT,MAAM;wBACN,YAAY;4BACV,KAAK;gCACH,MAAM;4BACR;wBACF;wBACA,UAAU;4BAAC;yBAAM;wBACjB,UAAU;oBACZ;oBACA,SAAS;wBACP,MAAM;wBACN,UAAU;wBACV,aACE;oBACJ;oBACA,eAAe;wBACb,MAAM;wBACN,YAAY;4BACV,MAAM;gCACJ,MAAM;gCACN,aACE;4BACJ;4BACA,OAAO;gCACL,MAAM;4BACR;4BACA,OAAO;gCACL,MAAM;gCACN,UAAU;4BACZ;wBACF;wBACA,UAAU;4BAAC;4BAAQ;yBAAQ;wBAC3B,UAAU;oBACZ;oBACA,YAAY;wBACV,MAAM;wBACN,YAAY;4BACV,MAAM;gCACJ,MAAM;gCACN,aACE;4BACJ;4BACA,OAAO;gCACL,MAAM;4BACR;4BACA,MAAM;gCACJ,MAAM;4BACR;4BACA,OAAO;gCACL,MAAM;gCACN,UAAU;4BACZ;wBACF;wBACA,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