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 +31 -1
- package/dist/actions.cjs +640 -30
- package/dist/actions.d.cts +2 -2
- package/dist/actions.d.ts +2 -2
- package/dist/actions.mjs +2 -1
- package/dist/browser.cjs +2736 -901
- package/dist/browser.d.cts +22 -5
- package/dist/browser.d.ts +22 -5
- package/dist/browser.mjs +5 -4
- package/dist/cdp.cjs +18 -3
- package/dist/cdp.mjs +4 -2
- package/dist/{chunk-BCOZUKWS.mjs → chunk-4MBSALQL.mjs} +21 -15
- package/dist/{chunk-R3PS4PCM.mjs → chunk-BRAFQUMG.mjs} +34 -12
- package/dist/chunk-JXAUPHZM.mjs +15 -0
- package/dist/chunk-NLIARNEE.mjs +1658 -0
- package/dist/{chunk-7OSR2CAE.mjs → chunk-RUWAXHDX.mjs} +1704 -667
- package/dist/cli.mjs +3759 -1395
- package/dist/index.cjs +2841 -860
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +7 -5
- package/dist/providers.cjs +34 -12
- package/dist/providers.mjs +1 -1
- package/dist/{types-CYw-7vx1.d.cts → types-BOPu0OQZ.d.cts} +91 -17
- package/dist/{types-DOGsEYQa.d.ts → types-j23Iqo2L.d.ts} +91 -17
- package/package.json +6 -2
- package/dist/chunk-KKW2SZLV.mjs +0 -741
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' },
|