browser-autopilot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +251 -0
  2. package/dist/agent/history.d.ts +41 -0
  3. package/dist/agent/history.js +98 -0
  4. package/dist/agent/history.js.map +1 -0
  5. package/dist/agent/loop.d.ts +34 -0
  6. package/dist/agent/loop.js +278 -0
  7. package/dist/agent/loop.js.map +1 -0
  8. package/dist/agent/run.d.ts +4 -0
  9. package/dist/agent/run.js +67 -0
  10. package/dist/agent/run.js.map +1 -0
  11. package/dist/agent/state.d.ts +37 -0
  12. package/dist/agent/state.js +82 -0
  13. package/dist/agent/state.js.map +1 -0
  14. package/dist/agent/tools.d.ts +414 -0
  15. package/dist/agent/tools.js +399 -0
  16. package/dist/agent/tools.js.map +1 -0
  17. package/dist/browser/cdp.d.ts +91 -0
  18. package/dist/browser/cdp.js +470 -0
  19. package/dist/browser/cdp.js.map +1 -0
  20. package/dist/browser/dom.d.ts +30 -0
  21. package/dist/browser/dom.js +79 -0
  22. package/dist/browser/dom.js.map +1 -0
  23. package/dist/browser/snapshot.d.ts +19 -0
  24. package/dist/browser/snapshot.js +70 -0
  25. package/dist/browser/snapshot.js.map +1 -0
  26. package/dist/captcha/solver.d.ts +20 -0
  27. package/dist/captcha/solver.js +101 -0
  28. package/dist/captcha/solver.js.map +1 -0
  29. package/dist/config.d.ts +36 -0
  30. package/dist/config.js +44 -0
  31. package/dist/config.js.map +1 -0
  32. package/dist/index.d.ts +20 -0
  33. package/dist/index.js +43 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/orchestrator.d.ts +33 -0
  36. package/dist/orchestrator.js +197 -0
  37. package/dist/orchestrator.js.map +1 -0
  38. package/dist/viewer/server.d.ts +14 -0
  39. package/dist/viewer/server.js +93 -0
  40. package/dist/viewer/server.js.map +1 -0
  41. package/dist/x11/agent.d.ts +34 -0
  42. package/dist/x11/agent.js +103 -0
  43. package/dist/x11/agent.js.map +1 -0
  44. package/dist/x11/chrome.d.ts +9 -0
  45. package/dist/x11/chrome.js +107 -0
  46. package/dist/x11/chrome.js.map +1 -0
  47. package/dist/x11/input.d.ts +13 -0
  48. package/dist/x11/input.js +75 -0
  49. package/dist/x11/input.js.map +1 -0
  50. package/dist/x11/login.d.ts +6 -0
  51. package/dist/x11/login.js +76 -0
  52. package/dist/x11/login.js.map +1 -0
  53. package/package.json +79 -0
@@ -0,0 +1,414 @@
1
+ /**
2
+ * Complete browser automation tools.
3
+ * Each tool maps to a CDP operation. Index-based element targeting.
4
+ */
5
+ import { z } from "zod";
6
+ import { CDPBrowser } from "../browser/cdp.js";
7
+ export declare function createBrowserTools(browser: CDPBrowser, dataDir?: string): {
8
+ navigate: import("ai").Tool<z.ZodObject<{
9
+ url: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ url: string;
12
+ }, {
13
+ url: string;
14
+ }>, string> & {
15
+ execute: (args: {
16
+ url: string;
17
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
18
+ };
19
+ go_back: import("ai").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, string> & {
20
+ execute: (args: {}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
21
+ };
22
+ reload: import("ai").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, string> & {
23
+ execute: (args: {}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
24
+ };
25
+ search: import("ai").Tool<z.ZodObject<{
26
+ query: z.ZodString;
27
+ }, "strip", z.ZodTypeAny, {
28
+ query: string;
29
+ }, {
30
+ query: string;
31
+ }>, string> & {
32
+ execute: (args: {
33
+ query: string;
34
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
35
+ };
36
+ click: import("ai").Tool<z.ZodObject<{
37
+ index: z.ZodNumber;
38
+ }, "strip", z.ZodTypeAny, {
39
+ index: number;
40
+ }, {
41
+ index: number;
42
+ }>, string> & {
43
+ execute: (args: {
44
+ index: number;
45
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
46
+ };
47
+ click_at: import("ai").Tool<z.ZodObject<{
48
+ x: z.ZodNumber;
49
+ y: z.ZodNumber;
50
+ }, "strip", z.ZodTypeAny, {
51
+ x: number;
52
+ y: number;
53
+ }, {
54
+ x: number;
55
+ y: number;
56
+ }>, string> & {
57
+ execute: (args: {
58
+ x: number;
59
+ y: number;
60
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
61
+ };
62
+ input: import("ai").Tool<z.ZodObject<{
63
+ index: z.ZodNumber;
64
+ text: z.ZodString;
65
+ clear: z.ZodDefault<z.ZodBoolean>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ text: string;
68
+ index: number;
69
+ clear: boolean;
70
+ }, {
71
+ text: string;
72
+ index: number;
73
+ clear?: boolean | undefined;
74
+ }>, string> & {
75
+ execute: (args: {
76
+ text: string;
77
+ index: number;
78
+ clear: boolean;
79
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
80
+ };
81
+ send_keys: import("ai").Tool<z.ZodObject<{
82
+ keys: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ keys: string;
85
+ }, {
86
+ keys: string;
87
+ }>, string> & {
88
+ execute: (args: {
89
+ keys: string;
90
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
91
+ };
92
+ scroll: import("ai").Tool<z.ZodObject<{
93
+ direction: z.ZodEnum<["up", "down"]>;
94
+ pixels: z.ZodDefault<z.ZodNumber>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ direction: "up" | "down";
97
+ pixels: number;
98
+ }, {
99
+ direction: "up" | "down";
100
+ pixels?: number | undefined;
101
+ }>, string> & {
102
+ execute: (args: {
103
+ direction: "up" | "down";
104
+ pixels: number;
105
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
106
+ };
107
+ find_text: import("ai").Tool<z.ZodObject<{
108
+ text: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ text: string;
111
+ }, {
112
+ text: string;
113
+ }>, string> & {
114
+ execute: (args: {
115
+ text: string;
116
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
117
+ };
118
+ scroll_to_element: import("ai").Tool<z.ZodObject<{
119
+ index: z.ZodNumber;
120
+ }, "strip", z.ZodTypeAny, {
121
+ index: number;
122
+ }, {
123
+ index: number;
124
+ }>, string> & {
125
+ execute: (args: {
126
+ index: number;
127
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
128
+ };
129
+ screenshot: import("ai").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, {
130
+ type: string;
131
+ image_base64: string;
132
+ }> & {
133
+ execute: (args: {}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
134
+ type: string;
135
+ image_base64: string;
136
+ }>;
137
+ };
138
+ extract: import("ai").Tool<z.ZodObject<{
139
+ query: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ query: string;
142
+ }, {
143
+ query: string;
144
+ }>, string> & {
145
+ execute: (args: {
146
+ query: string;
147
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
148
+ };
149
+ search_page: import("ai").Tool<z.ZodObject<{
150
+ query: z.ZodString;
151
+ }, "strip", z.ZodTypeAny, {
152
+ query: string;
153
+ }, {
154
+ query: string;
155
+ }>, string> & {
156
+ execute: (args: {
157
+ query: string;
158
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
159
+ };
160
+ switch_tab: import("ai").Tool<z.ZodObject<{
161
+ tab_id: z.ZodString;
162
+ }, "strip", z.ZodTypeAny, {
163
+ tab_id: string;
164
+ }, {
165
+ tab_id: string;
166
+ }>, string> & {
167
+ execute: (args: {
168
+ tab_id: string;
169
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
170
+ };
171
+ close_tab: import("ai").Tool<z.ZodObject<{
172
+ tab_id: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ tab_id: string;
175
+ }, {
176
+ tab_id: string;
177
+ }>, string> & {
178
+ execute: (args: {
179
+ tab_id: string;
180
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
181
+ };
182
+ new_tab: import("ai").Tool<z.ZodObject<{
183
+ url: z.ZodDefault<z.ZodString>;
184
+ }, "strip", z.ZodTypeAny, {
185
+ url: string;
186
+ }, {
187
+ url?: string | undefined;
188
+ }>, string> & {
189
+ execute: (args: {
190
+ url: string;
191
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
192
+ };
193
+ dropdown_options: import("ai").Tool<z.ZodObject<{
194
+ selector: z.ZodString;
195
+ }, "strip", z.ZodTypeAny, {
196
+ selector: string;
197
+ }, {
198
+ selector: string;
199
+ }>, string> & {
200
+ execute: (args: {
201
+ selector: string;
202
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
203
+ };
204
+ select_dropdown: import("ai").Tool<z.ZodObject<{
205
+ selector: z.ZodString;
206
+ value: z.ZodString;
207
+ }, "strip", z.ZodTypeAny, {
208
+ value: string;
209
+ selector: string;
210
+ }, {
211
+ value: string;
212
+ selector: string;
213
+ }>, string> & {
214
+ execute: (args: {
215
+ value: string;
216
+ selector: string;
217
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
218
+ };
219
+ upload_file: import("ai").Tool<z.ZodObject<{
220
+ selector: z.ZodString;
221
+ file_path: z.ZodString;
222
+ }, "strip", z.ZodTypeAny, {
223
+ selector: string;
224
+ file_path: string;
225
+ }, {
226
+ selector: string;
227
+ file_path: string;
228
+ }>, string> & {
229
+ execute: (args: {
230
+ selector: string;
231
+ file_path: string;
232
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
233
+ };
234
+ write_file: import("ai").Tool<z.ZodObject<{
235
+ path: z.ZodString;
236
+ content: z.ZodString;
237
+ }, "strip", z.ZodTypeAny, {
238
+ content: string;
239
+ path: string;
240
+ }, {
241
+ content: string;
242
+ path: string;
243
+ }>, string> & {
244
+ execute: (args: {
245
+ content: string;
246
+ path: string;
247
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
248
+ };
249
+ read_file: import("ai").Tool<z.ZodObject<{
250
+ path: z.ZodString;
251
+ }, "strip", z.ZodTypeAny, {
252
+ path: string;
253
+ }, {
254
+ path: string;
255
+ }>, string> & {
256
+ execute: (args: {
257
+ path: string;
258
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
259
+ };
260
+ type_text: import("ai").Tool<z.ZodObject<{
261
+ text: z.ZodString;
262
+ }, "strip", z.ZodTypeAny, {
263
+ text: string;
264
+ }, {
265
+ text: string;
266
+ }>, string> & {
267
+ execute: (args: {
268
+ text: string;
269
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
270
+ };
271
+ save_page_snapshot: import("ai").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, string> & {
272
+ execute: (args: {}, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
273
+ };
274
+ save_element_html: import("ai").Tool<z.ZodObject<{
275
+ index: z.ZodOptional<z.ZodNumber>;
276
+ selector: z.ZodOptional<z.ZodString>;
277
+ filename: z.ZodOptional<z.ZodString>;
278
+ }, "strip", z.ZodTypeAny, {
279
+ index?: number | undefined;
280
+ selector?: string | undefined;
281
+ filename?: string | undefined;
282
+ }, {
283
+ index?: number | undefined;
284
+ selector?: string | undefined;
285
+ filename?: string | undefined;
286
+ }>, string> & {
287
+ execute: (args: {
288
+ index?: number | undefined;
289
+ selector?: string | undefined;
290
+ filename?: string | undefined;
291
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
292
+ };
293
+ shell: import("ai").Tool<z.ZodObject<{
294
+ command: z.ZodString;
295
+ }, "strip", z.ZodTypeAny, {
296
+ command: string;
297
+ }, {
298
+ command: string;
299
+ }>, any> & {
300
+ execute: (args: {
301
+ command: string;
302
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<any>;
303
+ };
304
+ evaluate: import("ai").Tool<z.ZodObject<{
305
+ code: z.ZodString;
306
+ }, "strip", z.ZodTypeAny, {
307
+ code: string;
308
+ }, {
309
+ code: string;
310
+ }>, string> & {
311
+ execute: (args: {
312
+ code: string;
313
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
314
+ };
315
+ handle_dialog: import("ai").Tool<z.ZodObject<{
316
+ accept: z.ZodBoolean;
317
+ text: z.ZodOptional<z.ZodString>;
318
+ }, "strip", z.ZodTypeAny, {
319
+ accept: boolean;
320
+ text?: string | undefined;
321
+ }, {
322
+ accept: boolean;
323
+ text?: string | undefined;
324
+ }>, string> & {
325
+ execute: (args: {
326
+ accept: boolean;
327
+ text?: string | undefined;
328
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
329
+ };
330
+ wait: import("ai").Tool<z.ZodObject<{
331
+ seconds: z.ZodNumber;
332
+ }, "strip", z.ZodTypeAny, {
333
+ seconds: number;
334
+ }, {
335
+ seconds: number;
336
+ }>, string> & {
337
+ execute: (args: {
338
+ seconds: number;
339
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
340
+ };
341
+ solve_captcha: import("ai").Tool<z.ZodObject<{
342
+ site_url: z.ZodString;
343
+ site_key: z.ZodString;
344
+ captcha_type: z.ZodDefault<z.ZodEnum<["recaptcha_v2", "recaptcha_v3", "hcaptcha", "turnstile"]>>;
345
+ }, "strip", z.ZodTypeAny, {
346
+ site_url: string;
347
+ site_key: string;
348
+ captcha_type: "recaptcha_v2" | "recaptcha_v3" | "hcaptcha" | "turnstile";
349
+ }, {
350
+ site_url: string;
351
+ site_key: string;
352
+ captcha_type?: "recaptcha_v2" | "recaptcha_v3" | "hcaptcha" | "turnstile" | undefined;
353
+ }>, string> & {
354
+ execute: (args: {
355
+ site_url: string;
356
+ site_key: string;
357
+ captcha_type: "recaptcha_v2" | "recaptcha_v3" | "hcaptcha" | "turnstile";
358
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
359
+ };
360
+ inject_captcha_token: import("ai").Tool<z.ZodObject<{
361
+ token: z.ZodString;
362
+ }, "strip", z.ZodTypeAny, {
363
+ token: string;
364
+ }, {
365
+ token: string;
366
+ }>, string> & {
367
+ execute: (args: {
368
+ token: string;
369
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
370
+ };
371
+ solve_datadome: import("ai").Tool<z.ZodObject<{
372
+ site_url: z.ZodString;
373
+ captcha_url: z.ZodString;
374
+ user_agent: z.ZodOptional<z.ZodString>;
375
+ }, "strip", z.ZodTypeAny, {
376
+ site_url: string;
377
+ captcha_url: string;
378
+ user_agent?: string | undefined;
379
+ }, {
380
+ site_url: string;
381
+ captcha_url: string;
382
+ user_agent?: string | undefined;
383
+ }>, string> & {
384
+ execute: (args: {
385
+ site_url: string;
386
+ captcha_url: string;
387
+ user_agent?: string | undefined;
388
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<string>;
389
+ };
390
+ done: import("ai").Tool<z.ZodObject<{
391
+ text: z.ZodString;
392
+ success: z.ZodDefault<z.ZodBoolean>;
393
+ }, "strip", z.ZodTypeAny, {
394
+ text: string;
395
+ success: boolean;
396
+ }, {
397
+ text: string;
398
+ success?: boolean | undefined;
399
+ }>, {
400
+ done: boolean;
401
+ text: string;
402
+ success: boolean;
403
+ }> & {
404
+ execute: (args: {
405
+ text: string;
406
+ success: boolean;
407
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
408
+ done: boolean;
409
+ text: string;
410
+ success: boolean;
411
+ }>;
412
+ };
413
+ };
414
+ export type BrowserTools = ReturnType<typeof createBrowserTools>;