browser-pilot 0.0.10 → 0.0.12

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
@@ -33,6 +33,7 @@ await browser.close();
33
33
  | Bun CDP connection bugs | Custom CDP client that works everywhere |
34
34
  | Single-selector API (fragile) | Multi-selector by default: `['#primary', '.fallback']` |
35
35
  | No action batching (high latency) | Batch DSL: one call for entire sequences |
36
+ | No inline assertions (extra API calls to verify) | Built-in assertions: verify state within the same batch |
36
37
  | No AI-optimized snapshots | Built-in accessibility tree extraction |
37
38
  | No audio I/O for voice agents | Mic injection + output capture + Whisper transcription |
38
39
 
@@ -131,6 +132,25 @@ console.log(result.totalDurationMs); // total execution time
131
132
  console.log(result.steps[5].result); // snapshot from step 5
132
133
  ```
133
134
 
135
+ Assertion steps verify expected state within the same batch — no extra round trips. Available: `assertVisible`, `assertExists`, `assertText`, `assertUrl`, `assertValue`.
136
+
137
+ ```typescript
138
+ const result = await page.batch([
139
+ { action: 'goto', url: 'https://example.com/login' },
140
+ { action: 'fill', selector: '#email', value: 'user@example.com' },
141
+ { action: 'fill', selector: '#password', value: 'secret' },
142
+ { action: 'submit', selector: '#login-btn' },
143
+ { action: 'assertUrl', expect: '/dashboard' },
144
+ { action: 'assertVisible', selector: '.welcome-message' },
145
+ ]);
146
+ ```
147
+
148
+ Any step supports `retry` and `retryDelay` for flaky or async content:
149
+
150
+ ```typescript
151
+ { action: 'assertVisible', selector: '.async-content', retry: 3, retryDelay: 1000 }
152
+ ```
153
+
134
154
  ### AI-Optimized Snapshots
135
155
 
136
156
  Get the page state in a format perfect for LLMs:
@@ -380,6 +400,16 @@ bp listen ws -m "*voice*" # monitor WebSocket traffic
380
400
  bp list # list all sessions
381
401
  bp close -s my-session # close session
382
402
  bp actions # show complete action reference
403
+ bp run workflow.json # run a workflow file
404
+
405
+ # Actions with inline assertions (no extra bp eval needed)
406
+ bp exec '[
407
+ {"action":"goto","url":"https://example.com/login"},
408
+ {"action":"fill","selector":"#email","value":"user@example.com"},
409
+ {"action":"submit","selector":"form"},
410
+ {"action":"assertUrl","expect":"/dashboard"},
411
+ {"action":"assertText","expect":"Welcome"}
412
+ ]'
383
413
  ```
384
414
 
385
415
  ### CLI for AI Agents
@@ -572,7 +602,7 @@ const browserTool = {
572
602
  items: {
573
603
  type: 'object',
574
604
  properties: {
575
- action: { enum: ['goto', 'click', 'fill', 'submit', 'snapshot'] },
605
+ action: { enum: ['goto', 'click', 'fill', 'submit', 'snapshot', 'assertVisible', 'assertExists', 'assertText', 'assertUrl', 'assertValue'] },
576
606
  selector: { type: ['string', 'array'] },
577
607
  value: { type: 'string' },
578
608
  url: { type: 'string' },