browser-pilot 0.0.3 → 0.0.5

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/dist/cli.mjs CHANGED
@@ -2,14 +2,14 @@
2
2
  import "./chunk-ZIQA4JOT.mjs";
3
3
  import {
4
4
  connect
5
- } from "./chunk-CWSTSVWO.mjs";
5
+ } from "./chunk-NP56KSAN.mjs";
6
6
  import "./chunk-BCOZUKWS.mjs";
7
7
  import {
8
8
  getBrowserWebSocketUrl
9
9
  } from "./chunk-R3PS4PCM.mjs";
10
10
  import {
11
11
  addBatchToPage
12
- } from "./chunk-YEHK2XY3.mjs";
12
+ } from "./chunk-6RB3GKQP.mjs";
13
13
 
14
14
  // src/cli/commands/actions.ts
15
15
  var ACTIONS_HELP = `
@@ -272,6 +272,60 @@ async function getDefaultSession() {
272
272
  return sessions[0] ?? null;
273
273
  }
274
274
 
275
+ // src/cli/commands/clean.ts
276
+ function parseCleanArgs(args) {
277
+ const options = {};
278
+ for (let i = 0; i < args.length; i++) {
279
+ const arg = args[i];
280
+ if (arg === "--max-age") {
281
+ const value = args[++i];
282
+ options.maxAge = parseInt(value ?? "24", 10);
283
+ } else if (arg === "--dry-run") {
284
+ options.dryRun = true;
285
+ } else if (arg === "--all") {
286
+ options.all = true;
287
+ }
288
+ }
289
+ return options;
290
+ }
291
+ async function cleanCommand(args, globalOptions) {
292
+ const options = parseCleanArgs(args);
293
+ const maxAgeMs = (options.maxAge ?? 24) * 60 * 60 * 1e3;
294
+ const now = Date.now();
295
+ const sessions = await listSessions();
296
+ const stale = sessions.filter((s) => {
297
+ if (options.all) return true;
298
+ const age = now - new Date(s.lastActivity).getTime();
299
+ return age > maxAgeMs;
300
+ });
301
+ if (stale.length === 0) {
302
+ output({ message: "No stale sessions found", cleaned: 0 }, globalOptions.output);
303
+ return;
304
+ }
305
+ if (options.dryRun) {
306
+ output(
307
+ {
308
+ message: `Would clean ${stale.length} session(s)`,
309
+ sessions: stale.map((s) => s.id),
310
+ dryRun: true
311
+ },
312
+ globalOptions.output
313
+ );
314
+ return;
315
+ }
316
+ for (const session of stale) {
317
+ await deleteSession(session.id);
318
+ }
319
+ output(
320
+ {
321
+ message: `Cleaned ${stale.length} session(s)`,
322
+ cleaned: stale.length,
323
+ sessions: stale.map((s) => s.id)
324
+ },
325
+ globalOptions.output
326
+ );
327
+ }
328
+
275
329
  // src/cli/commands/close.ts
276
330
  async function closeCommand(args, globalOptions) {
277
331
  let session;
@@ -390,6 +444,17 @@ async function connectCommand(args, globalOptions) {
390
444
  }
391
445
 
392
446
  // src/cli/commands/exec.ts
447
+ async function validateSession(session) {
448
+ try {
449
+ const wsUrl = new URL(session.wsUrl);
450
+ const protocol = wsUrl.protocol === "wss:" ? "https:" : "http:";
451
+ const httpUrl = `${protocol}//${wsUrl.host}/json/version`;
452
+ const response = await fetch(httpUrl, { signal: AbortSignal.timeout(3e3) });
453
+ return response.ok;
454
+ } catch {
455
+ return false;
456
+ }
457
+ }
393
458
  function parseExecArgs(args) {
394
459
  const options = {};
395
460
  let actionsJson;
@@ -410,15 +475,6 @@ function parseExecArgs(args) {
410
475
  }
411
476
  async function execCommand(args, globalOptions) {
412
477
  const { actionsJson, options: execOptions } = parseExecArgs(args);
413
- let session;
414
- if (globalOptions.session) {
415
- session = await loadSession(globalOptions.session);
416
- } else {
417
- session = await getDefaultSession();
418
- if (!session) {
419
- throw new Error('No session found. Run "bp connect" first.');
420
- }
421
- }
422
478
  if (!actionsJson) {
423
479
  throw new Error(
424
480
  `No actions provided. Usage: bp exec '{"action":"goto","url":"..."}'
@@ -434,6 +490,23 @@ Run 'bp actions' for complete action reference.`
434
490
  "Invalid JSON. Actions must be valid JSON.\n\nRun 'bp actions' for complete action reference."
435
491
  );
436
492
  }
493
+ let session;
494
+ if (globalOptions.session) {
495
+ session = await loadSession(globalOptions.session);
496
+ } else {
497
+ session = await getDefaultSession();
498
+ if (!session) {
499
+ throw new Error('No session found. Run "bp connect" first.');
500
+ }
501
+ }
502
+ const isValid = await validateSession(session);
503
+ if (!isValid) {
504
+ await deleteSession(session.id);
505
+ throw new Error(
506
+ `Session "${session.id}" is no longer valid (browser may have closed).
507
+ Session file has been cleaned up. Run "bp connect" to create a new session.`
508
+ );
509
+ }
437
510
  const browser = await connect({
438
511
  provider: session.provider,
439
512
  wsUrl: session.wsUrl,
@@ -533,67 +606,62 @@ function getAge(date) {
533
606
 
534
607
  // src/cli/commands/quickstart.ts
535
608
  var QUICKSTART = `
536
- browser-pilot - CDP-based browser automation for AI agents
537
-
538
- Zero production dependencies. Works in Node.js, Bun, and Cloudflare Workers.
539
-
540
- RUNNING
541
- npx browser-pilot ... # Node.js projects
542
- bunx browser-pilot ... # Bun projects (faster)
543
-
544
- CONNECTING
545
- npx browser-pilot connect <wsUrl> Connect to existing browser
546
- npx browser-pilot connect --provider browserbase --api-key <key>
547
-
548
- BASIC USAGE (Code)
549
- import { Browser } from 'browser-pilot';
550
-
551
- const browser = await Browser.connect({ wsUrl: '...' });
552
- const page = await browser.newPage();
553
- await page.goto('https://example.com');
554
- await page.click('#button');
555
- await page.fill('#input', 'text');
556
- await browser.close();
557
-
558
- KEY PATTERNS
559
- Multi-Selector await page.click(['#primary', '.fallback', 'button']);
560
- Smart Waiting Every action waits for visibility automatically
561
- Optional Actions await page.click('#banner', { optional: true });
562
-
563
- BATCH EXECUTION
564
- await page.batch([
565
- { action: 'goto', url: 'https://example.com' },
566
- { action: 'fill', selector: '#email', value: 'test@test.com' },
567
- { action: 'submit', selector: 'form' },
568
- ]);
569
-
570
- SNAPSHOTS (FOR AI AGENTS)
571
- const snapshot = await page.snapshot();
572
- // Returns accessibility tree with refs: e1, e2, e3...
573
- await page.click({ ref: 'e5' });
574
-
575
- PROVIDERS
576
- BrowserBase Browser.connect({ provider: 'browserbase', apiKey })
577
- Browserless Browser.connect({ provider: 'browserless', apiKey })
578
- Generic Browser.connect({ wsUrl: 'ws://...' })
609
+ browser-pilot CLI - Quick Start Guide
610
+
611
+ STEP 1: CONNECT TO A BROWSER
612
+ bp connect --provider generic --name mysite
613
+
614
+ This creates a session. The CLI remembers it for subsequent commands.
615
+
616
+ STEP 2: NAVIGATE
617
+ bp exec '{"action":"goto","url":"https://example.com"}'
618
+
619
+ STEP 3: GET PAGE SNAPSHOT
620
+ bp snapshot --format text
621
+
622
+ Output shows the page as an accessibility tree with element refs:
623
+ - heading "Welcome" [ref=e1]
624
+ - button "Sign In" [ref=e2]
625
+ - textbox "Email" [ref=e3]
626
+
627
+ STEP 4: INTERACT USING REFS
628
+ bp exec '{"action":"fill","selector":"ref:e3","value":"test@example.com"}'
629
+ bp exec '{"action":"click","selector":"ref:e2"}'
630
+
631
+ STEP 5: BATCH MULTIPLE ACTIONS
632
+ bp exec '[
633
+ {"action":"fill","selector":"ref:e3","value":"user@test.com"},
634
+ {"action":"click","selector":"ref:e2"},
635
+ {"action":"snapshot"}
636
+ ]'
637
+
638
+ FOR AI AGENTS
639
+ Use -o json for machine-readable output:
640
+ bp snapshot --format text -o json
641
+ bp exec '{"action":"click","selector":"ref:e3"}' -o json
642
+
643
+ TIPS
644
+ \u2022 Refs (e1, e2...) are stable within a page - prefer them over CSS selectors
645
+ \u2022 After navigation, take a new snapshot to get updated refs
646
+ \u2022 Use multi-selectors for resilience: ["ref:e3", "#email", "input[type=email]"]
647
+ \u2022 Add "optional":true to skip elements that may not exist
648
+
649
+ SELECTOR PRIORITY
650
+ 1. ref:e5 From snapshot - most reliable
651
+ 2. #id CSS ID selector
652
+ 3. [data-testid] Test attributes
653
+ 4. .class CSS class (less stable)
579
654
 
580
655
  COMMON ACTIONS
581
- page.goto(url) Navigate to URL
582
- page.click(selector) Click element
583
- page.fill(selector, value) Fill input field
584
- page.submit(selector) Submit form
585
- page.select(selector, val) Select dropdown option
586
- page.screenshot() Capture screenshot
587
- page.snapshot() Get accessibility tree
588
-
589
- AGENT INTEGRATION
590
- - Use snapshot() to get page state as accessibility tree
591
- - Refs (e1, e2...) identify elements without fragile selectors
592
- - Multi-selector arrays handle UI variations
593
- - optional: true prevents failures on transient elements
594
-
595
- Ready to automate!
596
- Run: npx browser-pilot connect <wsUrl>
656
+ goto {"action":"goto","url":"https://..."}
657
+ click {"action":"click","selector":"ref:e3"}
658
+ fill {"action":"fill","selector":"ref:e3","value":"text"}
659
+ submit {"action":"submit","selector":"form"}
660
+ select {"action":"select","selector":"ref:e5","value":"option"}
661
+ snapshot {"action":"snapshot"}
662
+ screenshot {"action":"screenshot"}
663
+
664
+ Run 'bp actions' for the complete action reference.
597
665
  `;
598
666
  async function quickstartCommand() {
599
667
  console.log(QUICKSTART);
@@ -769,56 +837,31 @@ Usage:
769
837
  bp <command> [options]
770
838
 
771
839
  Commands:
772
- quickstart Show getting started guide
773
- connect Create or resume browser session
774
- exec Execute actions on current session
775
- snapshot Get page accessibility snapshot (includes element refs)
776
- text Extract text content from page
840
+ quickstart Getting started guide (start here!)
841
+ connect Create browser session
842
+ exec Execute actions
843
+ snapshot Get page with element refs
844
+ text Extract text content
777
845
  screenshot Take screenshot
778
846
  close Close session
779
- list List all sessions
780
- actions Show all available actions with examples
781
-
782
- Global Options:
783
- -s, --session <id> Session ID to use
784
- -o, --output <fmt> Output format: json | pretty (default: pretty)
785
- --trace Enable execution tracing
786
- -h, --help Show this help message
787
-
788
- Exec Options:
789
- --dialog <mode> Auto-handle dialogs: accept | dismiss
790
-
791
- Ref Selectors (Recommended for AI Agents):
792
- 1. Navigate + snapshot: bp exec '[{"action":"goto","url":"..."},{"action":"snapshot"}]'
793
- Output shows: button "Submit" [ref=e4], textbox "Email" [ref=e5]
794
- 2. Use refs (snapshot cached for same session+URL):
795
- bp exec '[{"action":"click","selector":"ref:e4"}]'
847
+ list List sessions
848
+ clean Clean up old sessions
849
+ actions Complete action reference
796
850
 
797
- Refs are cached per session+URL after snapshot. Use new snapshot after navigation.
798
- Combine with CSS fallbacks:
799
- {"selector": ["ref:e4", "#submit", "button[type=submit]"]}
851
+ Options:
852
+ -s, --session <id> Session ID
853
+ -o, --output <fmt> json | pretty (default: pretty)
854
+ --trace Enable debug tracing
855
+ --dialog <mode> Handle dialogs: accept | dismiss
856
+ -h, --help Show help
800
857
 
801
858
  Examples:
802
- # Connect to browser
803
859
  bp connect --provider generic --name dev
860
+ bp exec '{"action":"goto","url":"https://example.com"}'
861
+ bp snapshot --format text
862
+ bp exec '{"action":"click","selector":"ref:e3"}'
804
863
 
805
- # Navigate and get snapshot with refs
806
- bp exec '[{"action":"goto","url":"https://example.com"},{"action":"snapshot"}]'
807
-
808
- # Use refs (snapshot cached for same session+URL)
809
- bp exec '[{"action":"fill","selector":"ref:e5","value":"test@example.com"},{"action":"click","selector":"ref:e4"}]'
810
-
811
- # Handle native dialogs (alert/confirm/prompt)
812
- bp exec --dialog accept '{"action":"click","selector":"#delete-btn"}'
813
-
814
- # Batch multiple actions (snapshot optional if already cached)
815
- bp exec '[
816
- {"action":"snapshot"},
817
- {"action":"fill","selector":"ref:e5","value":"user@example.com"},
818
- {"action":"click","selector":"ref:e4"},
819
- {"action":"snapshot"}
820
- ]'
821
-
864
+ Run 'bp quickstart' for CLI workflow guide.
822
865
  Run 'bp actions' for complete action reference.
823
866
  `;
824
867
  function parseGlobalOptions(args) {
@@ -849,7 +892,10 @@ function output(data, format = "pretty") {
849
892
  if (typeof data === "string") {
850
893
  console.log(data);
851
894
  } else if (typeof data === "object" && data !== null) {
852
- prettyPrint(data);
895
+ const { truncated } = prettyPrint(data);
896
+ if (truncated) {
897
+ console.log("\n(Output truncated. Use -o json for full data)");
898
+ }
853
899
  } else {
854
900
  console.log(data);
855
901
  }
@@ -857,16 +903,20 @@ function output(data, format = "pretty") {
857
903
  }
858
904
  function prettyPrint(obj, indent = 0) {
859
905
  const prefix = " ".repeat(indent);
906
+ let truncated = false;
860
907
  for (const [key, value] of Object.entries(obj)) {
861
908
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
862
909
  console.log(`${prefix}${key}:`);
863
- prettyPrint(value, indent + 1);
910
+ const result = prettyPrint(value, indent + 1);
911
+ if (result.truncated) truncated = true;
864
912
  } else if (Array.isArray(value)) {
865
913
  console.log(`${prefix}${key}: [${value.length} items]`);
914
+ truncated = true;
866
915
  } else {
867
916
  console.log(`${prefix}${key}: ${value}`);
868
917
  }
869
918
  }
919
+ return { truncated };
870
920
  }
871
921
  async function main() {
872
922
  const args = process.argv.slice(2);
@@ -906,6 +956,9 @@ async function main() {
906
956
  case "list":
907
957
  await listCommand(remaining, options);
908
958
  break;
959
+ case "clean":
960
+ await cleanCommand(remaining, options);
961
+ break;
909
962
  case "actions":
910
963
  await actionsCommand();
911
964
  break;
package/dist/index.cjs CHANGED
@@ -134,7 +134,8 @@ var BatchExecutor = class {
134
134
  await this.page.fill(step.selector, step.value, {
135
135
  timeout,
136
136
  optional,
137
- clear: step.clear ?? true
137
+ clear: step.clear ?? true,
138
+ blur: step.blur
138
139
  });
139
140
  return { selectorUsed: this.getUsedSelector(step.selector) };
140
141
  }
@@ -1353,7 +1354,7 @@ var Page = class {
1353
1354
  * Fill an input field (clears first by default)
1354
1355
  */
1355
1356
  async fill(selector, value, options = {}) {
1356
- const { clear = true } = options;
1357
+ const { clear = true, blur = false } = options;
1357
1358
  return this.withStaleNodeRetry(async () => {
1358
1359
  const element = await this.findElement(selector, options);
1359
1360
  if (!element) {
@@ -1367,7 +1368,11 @@ var Page = class {
1367
1368
  const el = document.querySelector(${JSON.stringify(element.selector)});
1368
1369
  if (el) {
1369
1370
  el.value = '';
1370
- el.dispatchEvent(new Event('input', { bubbles: true }));
1371
+ el.dispatchEvent(new InputEvent('input', {
1372
+ bubbles: true,
1373
+ cancelable: true,
1374
+ inputType: 'deleteContent'
1375
+ }));
1371
1376
  }
1372
1377
  })()`
1373
1378
  );
@@ -1377,11 +1382,21 @@ var Page = class {
1377
1382
  `(() => {
1378
1383
  const el = document.querySelector(${JSON.stringify(element.selector)});
1379
1384
  if (el) {
1380
- el.dispatchEvent(new Event('input', { bubbles: true }));
1385
+ el.dispatchEvent(new InputEvent('input', {
1386
+ bubbles: true,
1387
+ cancelable: true,
1388
+ inputType: 'insertText',
1389
+ data: ${JSON.stringify(value)}
1390
+ }));
1381
1391
  el.dispatchEvent(new Event('change', { bubbles: true }));
1382
1392
  }
1383
1393
  })()`
1384
1394
  );
1395
+ if (blur) {
1396
+ await this.evaluateInFrame(
1397
+ `document.querySelector(${JSON.stringify(element.selector)})?.blur()`
1398
+ );
1399
+ }
1385
1400
  return true;
1386
1401
  });
1387
1402
  }
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { BatchExecutor, addBatchToPage } from './actions.cjs';
2
- import { R as RequestPattern, a as RequestHandler } from './types-C6m0bT04.cjs';
3
- export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-C6m0bT04.cjs';
2
+ import { R as RequestPattern, a as RequestHandler } from './types-DQhA8uQZ.cjs';
3
+ export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-DQhA8uQZ.cjs';
4
4
  export { Browser, BrowserOptions, connect } from './browser.cjs';
5
5
  import { C as CDPClient } from './client-7Nqka5MV.cjs';
6
6
  export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { BatchExecutor, addBatchToPage } from './actions.js';
2
- import { R as RequestPattern, a as RequestHandler } from './types-BJv2dzu0.js';
3
- export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-BJv2dzu0.js';
2
+ import { R as RequestPattern, a as RequestHandler } from './types-DKz34hii.js';
3
+ export { d as ActionOptions, e as ActionResult, A as ActionType, B as BatchOptions, b as BatchResult, Q as ClearCookiesOptions, C as ConsoleHandler, f as ConsoleMessage, g as ConsoleMessageType, z as ContinueRequestOptions, X as Cookie, h as CustomSelectConfig, Y as DeleteCookieOptions, w as DeviceDescriptor, x as DeviceName, D as Dialog, i as DialogHandler, j as DialogType, k as Download, E as ElementInfo, l as ElementNotFoundError, m as EmulationState, n as ErrorHandler, H as FailRequestOptions, F as FileInput, o as FillOptions, J as FulfillRequestOptions, G as GeolocationOptions, I as InteractiveElement, K as InterceptedRequest, N as NavigationError, p as NetworkIdleOptions, P as Page, q as PageError, r as PageSnapshot, L as RequestActions, M as ResourceType, O as RouteOptions, Z as SetCookieOptions, s as SnapshotNode, S as Step, c as StepResult, t as SubmitOptions, T as TimeoutError, u as TypeOptions, U as UserAgentMetadata, v as UserAgentOptions, V as ViewportOptions, W as WaitForOptions, _ as WaitOptions, $ as WaitResult, a0 as WaitState, y as devices, a1 as waitForAnyElement, a2 as waitForElement, a3 as waitForNavigation, a4 as waitForNetworkIdle } from './types-DKz34hii.js';
4
4
  export { Browser, BrowserOptions, connect } from './browser.js';
5
5
  import { C as CDPClient } from './client-7Nqka5MV.js';
6
6
  export { a as CDPClientOptions, c as createCDPClient } from './client-7Nqka5MV.js';
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  waitForElement,
18
18
  waitForNavigation,
19
19
  waitForNetworkIdle
20
- } from "./chunk-CWSTSVWO.mjs";
20
+ } from "./chunk-NP56KSAN.mjs";
21
21
  import {
22
22
  CDPError,
23
23
  createCDPClient
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  BatchExecutor,
35
35
  addBatchToPage
36
- } from "./chunk-YEHK2XY3.mjs";
36
+ } from "./chunk-6RB3GKQP.mjs";
37
37
  export {
38
38
  BatchExecutor,
39
39
  Browser,
@@ -68,6 +68,8 @@ interface ActionOptions {
68
68
  interface FillOptions extends ActionOptions {
69
69
  /** Clear existing content before filling */
70
70
  clear?: boolean;
71
+ /** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
72
+ blur?: boolean;
71
73
  }
72
74
  interface TypeOptions extends ActionOptions {
73
75
  /** Delay between keystrokes in ms */
@@ -866,6 +868,8 @@ interface Step {
866
868
  method?: 'enter' | 'click' | 'enter+click';
867
869
  /** Clear input before filling */
868
870
  clear?: boolean;
871
+ /** Trigger blur after filling (for React/Vue frameworks) */
872
+ blur?: boolean;
869
873
  /** Delay between keystrokes for type action */
870
874
  delay?: number;
871
875
  /** Wait for navigation after click action completes */
@@ -68,6 +68,8 @@ interface ActionOptions {
68
68
  interface FillOptions extends ActionOptions {
69
69
  /** Clear existing content before filling */
70
70
  clear?: boolean;
71
+ /** Trigger blur after filling (useful for React/Vue frameworks that update on blur) */
72
+ blur?: boolean;
71
73
  }
72
74
  interface TypeOptions extends ActionOptions {
73
75
  /** Delay between keystrokes in ms */
@@ -866,6 +868,8 @@ interface Step {
866
868
  method?: 'enter' | 'click' | 'enter+click';
867
869
  /** Clear input before filling */
868
870
  clear?: boolean;
871
+ /** Trigger blur after filling (for React/Vue frameworks) */
872
+ blur?: boolean;
869
873
  /** Delay between keystrokes for type action */
870
874
  delay?: number;
871
875
  /** Wait for navigation after click action completes */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-pilot",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Lightweight CDP-based browser automation for Node.js, Bun, and Cloudflare Workers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",