@getpaseo/protocol 0.1.104-beta.2 → 0.1.104-beta.3

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.
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export const BrowserAutomationErrorCodeSchema = z.enum([
3
3
  "browser_disabled",
4
- "browser_no_desktop",
4
+ "browser_no_host",
5
5
  "browser_tab_not_found",
6
6
  "browser_tab_closed",
7
7
  "browser_timeout",
@@ -14,6 +14,31 @@ export const BrowserAutomationErrorCodeSchema = z.enum([
14
14
  const BROWSER_AUTOMATION_BROWSER_ID_PATTERN = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|\d{13,}-[0-9a-f]+)$/i;
15
15
  const BROWSER_AUTOMATION_BROWSER_ID_MESSAGE = "browserId must be a real id returned by browser_new_tab or browser_list_tabs";
16
16
  const BROWSER_AUTOMATION_WAIT_CONDITION_MESSAGE = "browser_wait requires exactly one of text or url";
17
+ export const BROWSER_AUTOMATION_COMMAND_NAMES = [
18
+ "list_tabs",
19
+ "new_tab",
20
+ "snapshot",
21
+ "click",
22
+ "fill",
23
+ "wait",
24
+ "type",
25
+ "keypress",
26
+ "navigate",
27
+ "back",
28
+ "forward",
29
+ "reload",
30
+ "screenshot",
31
+ "upload",
32
+ "select",
33
+ "hover",
34
+ "drag",
35
+ "logs",
36
+ "evaluate",
37
+ "scroll",
38
+ "resize",
39
+ "close_tab",
40
+ ];
41
+ export const BrowserAutomationCommandNameSchema = z.enum(BROWSER_AUTOMATION_COMMAND_NAMES);
17
42
  export const BrowserAutomationBrowserIdSchema = z
18
43
  .string({ error: () => BROWSER_AUTOMATION_BROWSER_ID_MESSAGE })
19
44
  .min(1, BROWSER_AUTOMATION_BROWSER_ID_MESSAGE)
@@ -24,6 +49,8 @@ const BrowserAutomationTabTargetSchema = z
24
49
  })
25
50
  .strict();
26
51
  const BrowserAutomationRefSchema = z.string().regex(/^@e\d+$/);
52
+ const BrowserAutomationMouseButtonSchema = z.enum(["left", "right", "middle"]);
53
+ const BrowserAutomationInputModifierSchema = z.enum(["Alt", "Control", "Meta", "Shift"]);
27
54
  const BrowserAutomationHttpUrlSchema = z
28
55
  .string()
29
56
  .url()
@@ -52,6 +79,9 @@ export const BrowserAutomationClickCommandSchema = z.object({
52
79
  command: z.literal("click"),
53
80
  args: BrowserAutomationTabTargetSchema.extend({
54
81
  ref: BrowserAutomationRefSchema,
82
+ button: BrowserAutomationMouseButtonSchema.default("left"),
83
+ doubleClick: z.boolean().default(false),
84
+ modifiers: z.array(BrowserAutomationInputModifierSchema).default([]),
55
85
  }),
56
86
  });
57
87
  export const BrowserAutomationFillCommandSchema = z.object({
@@ -142,6 +172,32 @@ export const BrowserAutomationLogsCommandSchema = z.object({
142
172
  maxEntries: z.number().int().positive().max(200).default(50),
143
173
  }),
144
174
  });
175
+ export const BrowserAutomationEvaluateCommandSchema = z.object({
176
+ command: z.literal("evaluate"),
177
+ args: BrowserAutomationTabTargetSchema.extend({
178
+ function: z.string().min(1),
179
+ ref: BrowserAutomationRefSchema.optional(),
180
+ }),
181
+ });
182
+ export const BrowserAutomationScrollCommandSchema = z.object({
183
+ command: z.literal("scroll"),
184
+ args: BrowserAutomationTabTargetSchema.extend({
185
+ ref: BrowserAutomationRefSchema.optional(),
186
+ deltaX: z.number(),
187
+ deltaY: z.number(),
188
+ }),
189
+ });
190
+ export const BrowserAutomationResizeCommandSchema = z.object({
191
+ command: z.literal("resize"),
192
+ args: BrowserAutomationTabTargetSchema.extend({
193
+ width: z.number().int().positive(),
194
+ height: z.number().int().positive(),
195
+ }),
196
+ });
197
+ export const BrowserAutomationCloseTabCommandSchema = z.object({
198
+ command: z.literal("close_tab"),
199
+ args: BrowserAutomationTabTargetSchema,
200
+ });
145
201
  export const BrowserAutomationCommandSchema = z.discriminatedUnion("command", [
146
202
  BrowserAutomationListTabsCommandSchema,
147
203
  BrowserAutomationNewTabCommandSchema,
@@ -161,6 +217,10 @@ export const BrowserAutomationCommandSchema = z.discriminatedUnion("command", [
161
217
  BrowserAutomationHoverCommandSchema,
162
218
  BrowserAutomationDragCommandSchema,
163
219
  BrowserAutomationLogsCommandSchema,
220
+ BrowserAutomationEvaluateCommandSchema,
221
+ BrowserAutomationScrollCommandSchema,
222
+ BrowserAutomationResizeCommandSchema,
223
+ BrowserAutomationCloseTabCommandSchema,
164
224
  ]);
165
225
  export const BrowserAutomationTabInfoSchema = z.object({
166
226
  browserId: BrowserAutomationBrowserIdSchema,
@@ -182,26 +242,32 @@ export const BrowserAutomationNewTabResultSchema = z.object({
182
242
  workspaceId: z.string().min(1),
183
243
  url: z.string().min(1),
184
244
  });
185
- export const BrowserAutomationSnapshotElementSchema = z.object({
186
- ref: z.string().regex(/^@e\d+$/),
187
- role: z.string(),
188
- tagName: z.string(),
189
- text: z.string(),
190
- selector: z.string(),
191
- attributes: z.record(z.string(), z.string()).default({}),
192
- });
245
+ export const BrowserAutomationSnapshotStatsSchema = z
246
+ .object({
247
+ nodeCount: z.number().int().nonnegative(),
248
+ refCount: z.number().int().nonnegative(),
249
+ textLength: z.number().int().nonnegative(),
250
+ iframeCount: z.number().int().nonnegative().optional(),
251
+ maxDepth: z.number().int().nonnegative().optional(),
252
+ })
253
+ .strict();
193
254
  export const BrowserAutomationSnapshotResultSchema = z.object({
194
255
  command: z.literal("snapshot"),
195
256
  browserId: BrowserAutomationBrowserIdSchema,
196
257
  workspaceId: z.string().min(1).optional(),
197
258
  url: z.string(),
198
259
  title: z.string(),
199
- elements: z.array(BrowserAutomationSnapshotElementSchema),
260
+ format: z.literal("aria-yaml"),
261
+ snapshot: z.string(),
262
+ truncated: z.boolean(),
263
+ stats: BrowserAutomationSnapshotStatsSchema,
200
264
  });
201
265
  export const BrowserAutomationClickResultSchema = z.object({
202
266
  command: z.literal("click"),
203
267
  browserId: BrowserAutomationBrowserIdSchema,
204
268
  ref: BrowserAutomationRefSchema,
269
+ x: z.number().optional(),
270
+ y: z.number().optional(),
205
271
  });
206
272
  export const BrowserAutomationFillResultSchema = z.object({
207
273
  command: z.literal("fill"),
@@ -217,12 +283,16 @@ export const BrowserAutomationTypeResultSchema = z.object({
217
283
  command: z.literal("type"),
218
284
  browserId: BrowserAutomationBrowserIdSchema,
219
285
  ref: BrowserAutomationRefSchema.optional(),
286
+ x: z.number().optional(),
287
+ y: z.number().optional(),
220
288
  });
221
289
  export const BrowserAutomationKeypressResultSchema = z.object({
222
290
  command: z.literal("keypress"),
223
291
  browserId: BrowserAutomationBrowserIdSchema,
224
292
  key: z.string().min(1),
225
293
  ref: BrowserAutomationRefSchema.optional(),
294
+ x: z.number().optional(),
295
+ y: z.number().optional(),
226
296
  });
227
297
  export const BrowserAutomationNavigateResultSchema = z.object({
228
298
  command: z.literal("navigate"),
@@ -265,12 +335,18 @@ export const BrowserAutomationHoverResultSchema = z.object({
265
335
  command: z.literal("hover"),
266
336
  browserId: BrowserAutomationBrowserIdSchema,
267
337
  ref: BrowserAutomationRefSchema,
338
+ x: z.number().optional(),
339
+ y: z.number().optional(),
268
340
  });
269
341
  export const BrowserAutomationDragResultSchema = z.object({
270
342
  command: z.literal("drag"),
271
343
  browserId: BrowserAutomationBrowserIdSchema,
272
344
  sourceRef: BrowserAutomationRefSchema,
273
345
  targetRef: BrowserAutomationRefSchema,
346
+ sourceX: z.number().optional(),
347
+ sourceY: z.number().optional(),
348
+ targetX: z.number().optional(),
349
+ targetY: z.number().optional(),
274
350
  });
275
351
  export const BrowserAutomationConsoleLogEntrySchema = z.object({
276
352
  level: z.string(),
@@ -294,6 +370,31 @@ export const BrowserAutomationLogsResultSchema = z.object({
294
370
  console: z.array(BrowserAutomationConsoleLogEntrySchema),
295
371
  network: z.array(BrowserAutomationNetworkLogEntrySchema),
296
372
  });
373
+ export const BrowserAutomationEvaluateResultSchema = z.object({
374
+ command: z.literal("evaluate"),
375
+ browserId: BrowserAutomationBrowserIdSchema,
376
+ resultJson: z.string(),
377
+ truncated: z.boolean(),
378
+ });
379
+ export const BrowserAutomationScrollResultSchema = z.object({
380
+ command: z.literal("scroll"),
381
+ browserId: BrowserAutomationBrowserIdSchema,
382
+ ref: BrowserAutomationRefSchema.optional(),
383
+ deltaX: z.number(),
384
+ deltaY: z.number(),
385
+ x: z.number().optional(),
386
+ y: z.number().optional(),
387
+ });
388
+ export const BrowserAutomationResizeResultSchema = z.object({
389
+ command: z.literal("resize"),
390
+ browserId: BrowserAutomationBrowserIdSchema,
391
+ width: z.number().int().positive(),
392
+ height: z.number().int().positive(),
393
+ });
394
+ export const BrowserAutomationCloseTabResultSchema = z.object({
395
+ command: z.literal("close_tab"),
396
+ browserId: BrowserAutomationBrowserIdSchema,
397
+ });
297
398
  export const BrowserAutomationResultSchema = z.discriminatedUnion("command", [
298
399
  BrowserAutomationListTabsResultSchema,
299
400
  BrowserAutomationNewTabResultSchema,
@@ -313,12 +414,24 @@ export const BrowserAutomationResultSchema = z.discriminatedUnion("command", [
313
414
  BrowserAutomationHoverResultSchema,
314
415
  BrowserAutomationDragResultSchema,
315
416
  BrowserAutomationLogsResultSchema,
417
+ BrowserAutomationEvaluateResultSchema,
418
+ BrowserAutomationScrollResultSchema,
419
+ BrowserAutomationResizeResultSchema,
420
+ BrowserAutomationCloseTabResultSchema,
316
421
  ]);
317
422
  export const BrowserAutomationErrorSchema = z.object({
318
423
  code: BrowserAutomationErrorCodeSchema,
319
424
  message: z.string().min(1),
320
425
  retryable: z.boolean().default(false),
321
426
  });
427
+ export const BrowserAutomationDialogEventSchema = z.object({
428
+ type: z.enum(["alert", "confirm", "prompt", "beforeunload"]),
429
+ message: z.string(),
430
+ defaultValue: z.string().optional(),
431
+ action: z.enum(["accepted", "dismissed"]),
432
+ promptText: z.string().optional(),
433
+ timestamp: z.number(),
434
+ });
322
435
  export const BrowserAutomationExecuteRequestSchema = z
323
436
  .object({
324
437
  type: z.literal("browser.automation.execute.request"),
@@ -336,11 +449,13 @@ export const BrowserAutomationExecuteResponseSchema = z.object({
336
449
  requestId: z.string().min(1),
337
450
  ok: z.literal(true),
338
451
  result: BrowserAutomationResultSchema,
452
+ dialogs: z.array(BrowserAutomationDialogEventSchema).optional(),
339
453
  }),
340
454
  z.object({
341
455
  requestId: z.string().min(1),
342
456
  ok: z.literal(false),
343
457
  error: BrowserAutomationErrorSchema,
458
+ dialogs: z.array(BrowserAutomationDialogEventSchema).optional(),
344
459
  }),
345
460
  ]),
346
461
  });
@@ -2,7 +2,7 @@ export declare const CLIENT_CAPS: {
2
2
  readonly reasoningMergeEnum: "reasoning_merge_enum";
3
3
  readonly customModeIcons: "custom_mode_icons";
4
4
  readonly terminalReflowableSnapshot: "terminal_reflowable_snapshot";
5
- readonly desktopBrowserAutomation: "desktop_browser_automation";
5
+ readonly browserHost: "browser_host";
6
6
  };
7
7
  export type ClientCapability = (typeof CLIENT_CAPS)[keyof typeof CLIENT_CAPS];
8
8
  //# sourceMappingURL=client-capabilities.d.ts.map
@@ -11,6 +11,6 @@ export const CLIENT_CAPS = {
11
11
  // Old clients use a strict TerminalState schema and would reject the extra fields.
12
12
  // Drop the gate (always send the flags) when floor >= v0.1.88.
13
13
  terminalReflowableSnapshot: "terminal_reflowable_snapshot",
14
- desktopBrowserAutomation: "desktop_browser_automation",
14
+ browserHost: "browser_host",
15
15
  };
16
16
  //# sourceMappingURL=client-capabilities.js.map