browser-pilot 0.0.9 → 0.0.11

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.
package/README.md CHANGED
@@ -376,6 +376,7 @@ bp exec --dialog accept '{"action":"click","selector":"#delete-btn"}'
376
376
  # Other commands
377
377
  bp text -s my-session --selector ".main-content"
378
378
  bp screenshot -s my-session --output page.png
379
+ bp listen ws -m "*voice*" # monitor WebSocket traffic
379
380
  bp list # list all sessions
380
381
  bp close -s my-session # close session
381
382
  bp actions # show complete action reference
package/dist/actions.cjs CHANGED
@@ -32,7 +32,12 @@ var ElementNotFoundError = class extends Error {
32
32
  hints;
33
33
  constructor(selectors, hints) {
34
34
  const selectorList = Array.isArray(selectors) ? selectors : [selectors];
35
- super(`Element not found: ${selectorList.join(", ")}`);
35
+ let msg = `Element not found: ${selectorList.join(", ")}`;
36
+ if (hints?.length) {
37
+ msg += `. Did you mean: ${hints.slice(0, 3).map((h) => `${h.element.ref} (${h.element.role} "${h.element.name}")`).join(", ")}`;
38
+ }
39
+ msg += `. Run 'bp snapshot' to see available elements.`;
40
+ super(msg);
36
41
  this.name = "ElementNotFoundError";
37
42
  this.selectors = selectorList;
38
43
  this.hints = hints;
@@ -111,7 +116,7 @@ var BatchExecutor = class {
111
116
  }
112
117
  case "click": {
113
118
  if (!step.selector) throw new Error("click requires selector");
114
- if (step.waitForNavigation) {
119
+ if (step.waitForNavigation === true) {
115
120
  const navPromise = this.page.waitForNavigation({ timeout, optional });
116
121
  await this.page.click(step.selector, { timeout, optional });
117
122
  await navPromise;
@@ -126,7 +131,6 @@ var BatchExecutor = class {
126
131
  await this.page.fill(step.selector, step.value, {
127
132
  timeout,
128
133
  optional,
129
- clear: step.clear ?? true,
130
134
  blur: step.blur
131
135
  });
132
136
  return { selectorUsed: this.getUsedSelector(step.selector) };
@@ -174,7 +178,8 @@ var BatchExecutor = class {
174
178
  await this.page.submit(step.selector, {
175
179
  timeout,
176
180
  optional,
177
- method: step.method ?? "enter+click"
181
+ method: step.method ?? "enter+click",
182
+ waitForNavigation: step.waitForNavigation
178
183
  });
179
184
  return { selectorUsed: this.getUsedSelector(step.selector) };
180
185
  }
@@ -396,7 +401,6 @@ var ACTION_RULES = {
396
401
  fill: {
397
402
  required: { selector: { type: "string|string[]" }, value: { type: "string" } },
398
403
  optional: {
399
- clear: { type: "boolean" },
400
404
  blur: { type: "boolean" }
401
405
  }
402
406
  },
@@ -427,7 +431,8 @@ var ACTION_RULES = {
427
431
  submit: {
428
432
  required: { selector: { type: "string|string[]" } },
429
433
  optional: {
430
- method: { type: "string", enum: ["enter", "click", "enter+click"] }
434
+ method: { type: "string", enum: ["enter", "click", "enter+click"] },
435
+ waitForNavigation: { type: "boolean|auto" }
431
436
  }
432
437
  },
433
438
  press: {
@@ -505,7 +510,6 @@ var KNOWN_STEP_FIELDS = /* @__PURE__ */ new Set([
505
510
  "timeout",
506
511
  "optional",
507
512
  "method",
508
- "clear",
509
513
  "blur",
510
514
  "delay",
511
515
  "waitForNavigation",
@@ -586,6 +590,11 @@ function checkFieldType(value, rule) {
586
590
  case "boolean":
587
591
  if (typeof value !== "boolean") return `expected boolean, got ${typeof value}`;
588
592
  return null;
593
+ case "boolean|auto":
594
+ if (typeof value !== "boolean" && value !== "auto") {
595
+ return `expected boolean or "auto", got ${typeof value}`;
596
+ }
597
+ return null;
589
598
  }
590
599
  }
591
600
  function validateSteps(steps) {
@@ -1,5 +1,5 @@
1
- import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-CYw-7vx1.cjs';
2
- export { A as ActionType, c as StepResult } from './types-CYw-7vx1.cjs';
1
+ import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-GWuQJs_e.cjs';
2
+ export { A as ActionType, c as StepResult } from './types-GWuQJs_e.cjs';
3
3
  import './client-7Nqka5MV.cjs';
4
4
 
5
5
  /**
package/dist/actions.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-DOGsEYQa.js';
2
- export { A as ActionType, c as StepResult } from './types-DOGsEYQa.js';
1
+ import { y as Page, S as Step, B as BatchOptions, b as BatchResult } from './types-DtGF3yGl.js';
2
+ export { A as ActionType, c as StepResult } from './types-DtGF3yGl.js';
3
3
  import './client-7Nqka5MV.js';
4
4
 
5
5
  /**
package/dist/actions.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  BatchExecutor,
3
3
  addBatchToPage,
4
4
  validateSteps
5
- } from "./chunk-KKW2SZLV.mjs";
5
+ } from "./chunk-FAUNIZR7.mjs";
6
6
  export {
7
7
  BatchExecutor,
8
8
  addBatchToPage,