json_schema.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. // This is the json schema exported from browser-use, change page_id to tab_id
  2. // TODO: don't know why zod can not generate the same schema, need to fix it
  3. export const jsonNavigatorOutputSchema = {
  4. $defs: {
  5. ActionModel: {
  6. properties: {
  7. done: {
  8. anyOf: [
  9. {
  10. $ref: '#/$defs/DoneAction',
  11. },
  12. {
  13. type: 'null',
  14. },
  15. ],
  16. description: 'Complete task',
  17. },
  18. search_google: {
  19. anyOf: [
  20. {
  21. $ref: '#/$defs/SearchGoogleAction',
  22. },
  23. {
  24. type: 'null',
  25. },
  26. ],
  27. description:
  28. 'Search the query in Google in the current tab, the query should be a search query like humans search in Google, concrete and not vague or super long. More the single most important items. ',
  29. },
  30. go_to_url: {
  31. anyOf: [
  32. {
  33. $ref: '#/$defs/GoToUrlAction',
  34. },
  35. {
  36. type: 'null',
  37. },
  38. ],
  39. description: 'Navigate to URL in the current tab',
  40. },
  41. go_back: {
  42. anyOf: [
  43. {
  44. $ref: '#/$defs/NoParamsAction',
  45. },
  46. {
  47. type: 'null',
  48. },
  49. ],
  50. description: 'Go back',
  51. },
  52. click_element: {
  53. anyOf: [
  54. {
  55. $ref: '#/$defs/ClickElementAction',
  56. },
  57. {
  58. type: 'null',
  59. },
  60. ],
  61. description: 'Click element',
  62. },
  63. input_text: {
  64. anyOf: [
  65. {
  66. $ref: '#/$defs/InputTextAction',
  67. },
  68. {
  69. type: 'null',
  70. },
  71. ],
  72. description: 'Input text into a input interactive element',
  73. },
  74. switch_tab: {
  75. anyOf: [
  76. {
  77. $ref: '#/$defs/SwitchTabAction',
  78. },
  79. {
  80. type: 'null',
  81. },
  82. ],
  83. description: 'Switch tab',
  84. },
  85. open_tab: {
  86. anyOf: [
  87. {
  88. $ref: '#/$defs/OpenTabAction',
  89. },
  90. {
  91. type: 'null',
  92. },
  93. ],
  94. description: 'Open url in new tab',
  95. },
  96. cache_content: {
  97. anyOf: [
  98. {
  99. $ref: '#/$defs/cache_content_parameters',
  100. },
  101. {
  102. type: 'null',
  103. },
  104. ],
  105. description: 'Cache what you have found so far from the current page so that it can be used in future steps',
  106. },
  107. scroll_down: {
  108. anyOf: [
  109. {
  110. $ref: '#/$defs/ScrollAction',
  111. },
  112. {
  113. type: 'null',
  114. },
  115. ],
  116. description: 'Scroll down the page by pixel amount - if no amount is specified, scroll down one page',
  117. },
  118. scroll_up: {
  119. anyOf: [
  120. {
  121. $ref: '#/$defs/ScrollAction',
  122. },
  123. {
  124. type: 'null',
  125. },
  126. ],
  127. description: 'Scroll up the page by pixel amount - if no amount is specified, scroll up one page',
  128. },
  129. send_keys: {
  130. anyOf: [
  131. {
  132. $ref: '#/$defs/SendKeysAction',
  133. },
  134. {
  135. type: 'null',
  136. },
  137. ],
  138. description:
  139. 'Send strings of special keys like Backspace, Insert, PageDown, Delete, Enter, Shortcuts such as `Control+o`, `Control+Shift+T` are supported as well. This gets used in keyboard.press. Be aware of different operating systems and their shortcuts',
  140. },
  141. scroll_to_text: {
  142. anyOf: [
  143. {
  144. $ref: '#/$defs/scroll_to_text_parameters',
  145. },
  146. {
  147. type: 'null',
  148. },
  149. ],
  150. description: 'If you dont find something which you want to interact with, scroll to it',
  151. },
  152. get_dropdown_options: {
  153. anyOf: [
  154. {
  155. $ref: '#/$defs/get_dropdown_options_parameters',
  156. },
  157. {
  158. type: 'null',
  159. },
  160. ],
  161. description: 'Get all options from a native dropdown',
  162. },
  163. select_dropdown_option: {
  164. anyOf: [
  165. {
  166. $ref: '#/$defs/select_dropdown_option_parameters',
  167. },
  168. {
  169. type: 'null',
  170. },
  171. ],
  172. description:
  173. 'Select dropdown option for interactive element index by the text of the option you want to select',
  174. },
  175. },
  176. title: 'ActionModel',
  177. type: 'object',
  178. },
  179. AgentBrain: {
  180. description: 'Current state of the agent',
  181. properties: {
  182. page_summary: {
  183. title: 'Page Summary',
  184. type: 'string',
  185. },
  186. evaluation_previous_goal: {
  187. title: 'Evaluation Previous Goal',
  188. type: 'string',
  189. },
  190. memory: {
  191. title: 'Memory',
  192. type: 'string',
  193. },
  194. next_goal: {
  195. title: 'Next Goal',
  196. type: 'string',
  197. },
  198. },
  199. required: ['page_summary', 'evaluation_previous_goal', 'memory', 'next_goal'],
  200. title: 'AgentBrain',
  201. type: 'object',
  202. },
  203. ClickElementAction: {
  204. properties: {
  205. desc: {
  206. title: 'Intent',
  207. type: 'string',
  208. description: 'Very short explanation of the intent or purpose for calling this action',
  209. },
  210. index: {
  211. title: 'Index',
  212. type: 'integer',
  213. },
  214. xpath: {
  215. anyOf: [
  216. {
  217. type: 'string',
  218. },
  219. {
  220. type: 'null',
  221. },
  222. ],
  223. title: 'Xpath',
  224. },
  225. },
  226. required: ['desc', 'index'],
  227. title: 'ClickElementAction',
  228. type: 'object',
  229. },
  230. DoneAction: {
  231. properties: {
  232. text: {
  233. title: 'Text',
  234. type: 'string',
  235. },
  236. },
  237. required: ['text'],
  238. title: 'DoneAction',
  239. type: 'object',
  240. },
  241. GoToUrlAction: {
  242. properties: {
  243. url: {
  244. title: 'Url',
  245. type: 'string',
  246. },
  247. },
  248. required: ['url'],
  249. title: 'GoToUrlAction',
  250. type: 'object',
  251. },
  252. InputTextAction: {
  253. properties: {
  254. desc: {
  255. title: 'Intent',
  256. type: 'string',
  257. description: 'Very short explanation of the intent or purpose for calling this action',
  258. },
  259. index: {
  260. title: 'Index',
  261. type: 'integer',
  262. },
  263. text: {
  264. title: 'Text',
  265. type: 'string',
  266. },
  267. xpath: {
  268. anyOf: [
  269. {
  270. type: 'string',
  271. },
  272. {
  273. type: 'null',
  274. },
  275. ],
  276. title: 'Xpath',
  277. },
  278. },
  279. required: ['desc', 'index', 'text'],
  280. title: 'InputTextAction',
  281. type: 'object',
  282. },
  283. NoParamsAction: {
  284. additionalProperties: true,
  285. description:
  286. 'Accepts absolutely anything in the incoming data\nand discards it, so the final parsed model is empty.',
  287. properties: {},
  288. title: 'NoParamsAction',
  289. type: 'object',
  290. },
  291. OpenTabAction: {
  292. properties: {
  293. url: {
  294. title: 'Url',
  295. type: 'string',
  296. },
  297. },
  298. required: ['url'],
  299. title: 'OpenTabAction',
  300. type: 'object',
  301. },
  302. ScrollAction: {
  303. properties: {
  304. desc: {
  305. title: 'Intent',
  306. type: 'string',
  307. description: 'Very short explanation of the intent or purpose for calling this action',
  308. },
  309. amount: {
  310. anyOf: [
  311. {
  312. type: 'integer',
  313. },
  314. {
  315. type: 'null',
  316. },
  317. ],
  318. title: 'Amount',
  319. },
  320. },
  321. required: ['desc'],
  322. title: 'ScrollAction',
  323. type: 'object',
  324. },
  325. SearchGoogleAction: {
  326. properties: {
  327. query: {
  328. title: 'Query',
  329. type: 'string',
  330. },
  331. },
  332. required: ['query'],
  333. title: 'SearchGoogleAction',
  334. type: 'object',
  335. },
  336. SendKeysAction: {
  337. properties: {
  338. desc: {
  339. title: 'Intent',
  340. type: 'string',
  341. description: 'Very short explanation of the intent or purpose for calling this action',
  342. },
  343. keys: {
  344. title: 'Keys',
  345. type: 'string',
  346. },
  347. },
  348. required: ['desc', 'keys'],
  349. title: 'SendKeysAction',
  350. type: 'object',
  351. },
  352. SwitchTabAction: {
  353. properties: {
  354. tab_id: {
  355. title: 'Page Id',
  356. type: 'integer',
  357. },
  358. },
  359. required: ['tab_id'],
  360. title: 'SwitchTabAction',
  361. type: 'object',
  362. },
  363. cache_content_parameters: {
  364. properties: {
  365. content: {
  366. title: 'Content',
  367. type: 'string',
  368. },
  369. },
  370. required: ['content'],
  371. title: 'cache_content_parameters',
  372. type: 'object',
  373. },
  374. get_dropdown_options_parameters: {
  375. properties: {
  376. index: {
  377. title: 'Index',
  378. type: 'integer',
  379. },
  380. },
  381. required: ['index'],
  382. title: 'get_dropdown_options_parameters',
  383. type: 'object',
  384. },
  385. scroll_to_text_parameters: {
  386. properties: {
  387. desc: {
  388. title: 'Intent',
  389. type: 'string',
  390. description: 'Very short explanation of the intent or purpose for calling this action',
  391. },
  392. text: {
  393. title: 'Text',
  394. type: 'string',
  395. },
  396. },
  397. required: ['desc', 'text'],
  398. title: 'scroll_to_text_parameters',
  399. type: 'object',
  400. },
  401. select_dropdown_option_parameters: {
  402. properties: {
  403. index: {
  404. title: 'Index',
  405. type: 'integer',
  406. },
  407. text: {
  408. title: 'Text',
  409. type: 'string',
  410. },
  411. },
  412. required: ['index', 'text'],
  413. title: 'select_dropdown_option_parameters',
  414. type: 'object',
  415. },
  416. },
  417. properties: {
  418. current_state: {
  419. $ref: '#/$defs/AgentBrain',
  420. },
  421. action: {
  422. items: {
  423. $ref: '#/$defs/ActionModel',
  424. },
  425. title: 'Action',
  426. type: 'array',
  427. },
  428. },
  429. required: ['current_state', 'action'],
  430. title: 'AgentOutput',
  431. type: 'object',
  432. };