@browserbasehq/orca 3.0.0-preview.0
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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/index.d.ts +1611 -0
- package/dist/index.js +28681 -0
- package/dist/lib/api.d.ts +23 -0
- package/dist/lib/dom/build/scriptContent.d.ts +1 -0
- package/dist/lib/inference.d.ts +71 -0
- package/dist/lib/inferenceLogUtils.d.ts +12 -0
- package/dist/lib/logger.d.ts +54 -0
- package/dist/lib/prompt.d.ts +12 -0
- package/dist/lib/utils.d.ts +65 -0
- package/dist/lib/v3/agent/AgentClient.d.ts +18 -0
- package/dist/lib/v3/agent/AgentProvider.d.ts +18 -0
- package/dist/lib/v3/agent/AnthropicCUAClient.d.ts +55 -0
- package/dist/lib/v3/agent/OpenAICUAClient.d.ts +64 -0
- package/dist/lib/v3/agent/StagehandAgent.d.ts +15 -0
- package/dist/lib/v3/agent/tools/index.d.ts +229 -0
- package/dist/lib/v3/agent/tools/v3-act.d.ts +29 -0
- package/dist/lib/v3/agent/tools/v3-ariaTree.d.ts +11 -0
- package/dist/lib/v3/agent/tools/v3-close.d.ts +24 -0
- package/dist/lib/v3/agent/tools/v3-extract.d.ts +38 -0
- package/dist/lib/v3/agent/tools/v3-fillform.d.ts +37 -0
- package/dist/lib/v3/agent/tools/v3-goto.d.ts +29 -0
- package/dist/lib/v3/agent/tools/v3-navback.d.ts +17 -0
- package/dist/lib/v3/agent/tools/v3-screenshot.d.ts +13 -0
- package/dist/lib/v3/agent/tools/v3-scroll.d.ts +23 -0
- package/dist/lib/v3/agent/tools/v3-wait.d.ts +19 -0
- package/dist/lib/v3/agent/utils/cuaKeyMapping.d.ts +10 -0
- package/dist/lib/v3/agent/utils/imageCompression.d.ts +18 -0
- package/dist/lib/v3/agent/utils/messageProcessing.d.ts +13 -0
- package/dist/lib/v3/dom/build/scriptV3Content.d.ts +1 -0
- package/dist/lib/v3/dom/genDomScripts.d.ts +1 -0
- package/dist/lib/v3/dom/index.d.ts +1 -0
- package/dist/lib/v3/dom/piercer.entry.d.ts +1 -0
- package/dist/lib/v3/dom/piercer.runtime.d.ts +25 -0
- package/dist/lib/v3/handlers/actHandler.d.ts +18 -0
- package/dist/lib/v3/handlers/extractHandler.d.ts +29 -0
- package/dist/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +18 -0
- package/dist/lib/v3/handlers/observeHandler.d.ts +15 -0
- package/dist/lib/v3/handlers/v3AgentHandler.d.ts +17 -0
- package/dist/lib/v3/handlers/v3CuaAgentHandler.d.ts +26 -0
- package/dist/lib/v3/index.d.ts +10 -0
- package/dist/lib/v3/launch/browserbase.d.ts +8 -0
- package/dist/lib/v3/launch/local.d.ts +13 -0
- package/dist/lib/v3/llm/AnthropicClient.d.ts +16 -0
- package/dist/lib/v3/llm/CerebrasClient.d.ts +17 -0
- package/dist/lib/v3/llm/GoogleClient.d.ts +19 -0
- package/dist/lib/v3/llm/GroqClient.d.ts +17 -0
- package/dist/lib/v3/llm/LLMClient.d.ts +99 -0
- package/dist/lib/v3/llm/LLMProvider.d.ts +10 -0
- package/dist/lib/v3/llm/OpenAIClient.d.ts +15 -0
- package/dist/lib/v3/llm/aisdk.d.ts +15 -0
- package/dist/lib/v3/logger.d.ts +48 -0
- package/dist/lib/v3/mcp/connection.d.ts +11 -0
- package/dist/lib/v3/mcp/utils.d.ts +3 -0
- package/dist/lib/v3/tests/default-page-tracking.spec.d.ts +1 -0
- package/dist/lib/v3/tests/perform-understudy-method.spec.d.ts +1 -0
- package/dist/lib/v3/tests/shadow-iframe.spec.d.ts +1 -0
- package/dist/lib/v3/tests/timeouts.spec.d.ts +1 -0
- package/dist/lib/v3/tests/v3.config.d.ts +4 -0
- package/dist/lib/v3/tests/v3.playwright.config.d.ts +2 -0
- package/dist/lib/v3/tests/xpath-for-location-deep.spec.d.ts +1 -0
- package/dist/lib/v3/types/act.d.ts +10 -0
- package/dist/lib/v3/types/agent.d.ts +132 -0
- package/dist/lib/v3/types/api.d.ts +40 -0
- package/dist/lib/v3/types/cache.d.ts +71 -0
- package/dist/lib/v3/types/context.d.ts +2 -0
- package/dist/lib/v3/types/evals.d.ts +71 -0
- package/dist/lib/v3/types/evaluator.d.ts +40 -0
- package/dist/lib/v3/types/llm.d.ts +11 -0
- package/dist/lib/v3/types/log.d.ts +23 -0
- package/dist/lib/v3/types/model.d.ts +20 -0
- package/dist/lib/v3/types/playwright.d.ts +6 -0
- package/dist/lib/v3/types/stagehand.d.ts +113 -0
- package/dist/lib/v3/types/stagehandApiErrors.d.ts +18 -0
- package/dist/lib/v3/types/stagehandErrors.d.ts +104 -0
- package/dist/lib/v3/types.d.ts +176 -0
- package/dist/lib/v3/understudy/a11y/snapshot.d.ts +71 -0
- package/dist/lib/v3/understudy/cdp.d.ts +58 -0
- package/dist/lib/v3/understudy/context.d.ts +120 -0
- package/dist/lib/v3/understudy/deepLocator.d.ts +69 -0
- package/dist/lib/v3/understudy/executionContextRegistry.d.ts +15 -0
- package/dist/lib/v3/understudy/frame.d.ts +63 -0
- package/dist/lib/v3/understudy/frameLocator.d.ts +46 -0
- package/dist/lib/v3/understudy/frameRegistry.d.ts +100 -0
- package/dist/lib/v3/understudy/locator.d.ts +196 -0
- package/dist/lib/v3/understudy/page.d.ts +241 -0
- package/dist/lib/v3/understudy/piercer.d.ts +4 -0
- package/dist/lib/v3/v3.d.ts +156 -0
- package/dist/lib/version.d.ts +5 -0
- package/package.json +130 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Browserbase Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<div id="toc" align="center" style="margin-bottom: 0;">
|
|
2
|
+
<ul style="list-style: none; margin: 0; padding: 0;">
|
|
3
|
+
<a href="https://stagehand.dev">
|
|
4
|
+
<picture>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/dark_logo.png" />
|
|
6
|
+
<img alt="Stagehand" src="media/light_logo.png" width="200" style="margin-right: 30px;" />
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</ul>
|
|
10
|
+
</div>
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>The AI Browser Automation Framework</strong><br>
|
|
13
|
+
<a href="https://docs.stagehand.dev">Read the Docs</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://github.com/browserbase/stagehand/tree/main?tab=MIT-1-ov-file#MIT-1-ov-file">
|
|
18
|
+
<picture>
|
|
19
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/dark_license.svg" />
|
|
20
|
+
<img alt="MIT License" src="media/light_license.svg" />
|
|
21
|
+
</picture>
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://join.slack.com/t/stagehand-dev/shared_invite/zt-38khc8iv5-T2acb50_0OILUaX7lxeBOg">
|
|
24
|
+
<picture>
|
|
25
|
+
<source media="(prefers-color-scheme: dark)" srcset="media/dark_slack.svg" />
|
|
26
|
+
<img alt="Slack Community" src="media/light_slack.svg" />
|
|
27
|
+
</picture>
|
|
28
|
+
</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<a href="https://trendshift.io/repositories/12122" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12122" alt="browserbase%2Fstagehand | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
If you're looking for the Python implementation, you can find it
|
|
37
|
+
<a href="https://github.com/browserbase/stagehand-python"> here</a>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<div align="center" style="display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 0;">
|
|
41
|
+
<b>Vibe code</b>
|
|
42
|
+
<span style="font-size: 1.05em;"> Stagehand with </span>
|
|
43
|
+
<a href="https://director.ai" style="display: flex; align-items: center;">
|
|
44
|
+
<span>Director</span>
|
|
45
|
+
</a>
|
|
46
|
+
<span> </span>
|
|
47
|
+
<picture>
|
|
48
|
+
<img alt="Director" src="media/director_icon.svg" width="25" />
|
|
49
|
+
</picture>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
## Why Stagehand?
|
|
53
|
+
|
|
54
|
+
Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production. By letting developers choose what to write in code vs. natural language, Stagehand is the natural choice for browser automations in production.
|
|
55
|
+
|
|
56
|
+
1. **Choose when to write code vs. natural language**: use AI when you want to navigate unfamiliar pages, and use code ([Playwright](https://playwright.dev/)) when you know exactly what you want to do.
|
|
57
|
+
|
|
58
|
+
2. **Preview and cache actions**: Stagehand lets you preview AI actions before running them, and also helps you easily cache repeatable actions to save time and tokens.
|
|
59
|
+
|
|
60
|
+
3. **Computer use models with one line of code**: Stagehand lets you integrate SOTA computer use models from OpenAI and Anthropic into the browser with one line of code.
|
|
61
|
+
|
|
62
|
+
## Example
|
|
63
|
+
|
|
64
|
+
Here's how to build a sample browser automation with Stagehand:
|
|
65
|
+
|
|
66
|
+
<div align="center">
|
|
67
|
+
<div style="max-width:300px;">
|
|
68
|
+
<img src="/media/github_demo.gif" alt="See Stagehand in Action">
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// Use Playwright functions on the page object
|
|
74
|
+
const page = stagehand.page;
|
|
75
|
+
await page.goto("https://github.com/browserbase");
|
|
76
|
+
|
|
77
|
+
// Use act() to execute individual actions
|
|
78
|
+
await page.act("click on the stagehand repo");
|
|
79
|
+
|
|
80
|
+
// Use Computer Use agents for larger actions
|
|
81
|
+
const agent = stagehand.agent({
|
|
82
|
+
provider: "openai",
|
|
83
|
+
model: "computer-use-preview",
|
|
84
|
+
});
|
|
85
|
+
await agent.execute("Get to the latest PR");
|
|
86
|
+
|
|
87
|
+
// Use extract() to read data from the page
|
|
88
|
+
const { author, title } = await page.extract({
|
|
89
|
+
instruction: "extract the author and title of the PR",
|
|
90
|
+
schema: z.object({
|
|
91
|
+
author: z.string().describe("The username of the PR author"),
|
|
92
|
+
title: z.string().describe("The title of the PR"),
|
|
93
|
+
}),
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
Visit [docs.stagehand.dev](https://docs.stagehand.dev) to view the full documentation.
|
|
100
|
+
|
|
101
|
+
## Getting Started
|
|
102
|
+
|
|
103
|
+
Start with Stagehand with one line of code, or check out our [Quickstart Guide](https://docs.stagehand.dev/get_started/quickstart) for more information:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx create-browser-app
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<div align="center">
|
|
110
|
+
<a href="https://www.loom.com/share/f5107f86d8c94fa0a8b4b1e89740f7a7">
|
|
111
|
+
<p>Watch Anirudh demo create-browser-app to create a Stagehand project!</p>
|
|
112
|
+
</a>
|
|
113
|
+
<a href="https://www.loom.com/share/f5107f86d8c94fa0a8b4b1e89740f7a7">
|
|
114
|
+
<img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/f5107f86d8c94fa0a8b4b1e89740f7a7-ec3f428b6775ceeb-full-play.gif">
|
|
115
|
+
</a>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
### Build and Run from Source
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git clone https://github.com/browserbase/stagehand.git
|
|
122
|
+
cd stagehand
|
|
123
|
+
pnpm install
|
|
124
|
+
pnpm playwright install
|
|
125
|
+
pnpm run build
|
|
126
|
+
pnpm run example # run the blank script at ./examples/example.ts
|
|
127
|
+
pnpm run example 2048 # run the 2048 example at ./examples/2048.ts
|
|
128
|
+
pnpm run evals -man # see evaluation suite options
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Stagehand is best when you have an API key for an LLM provider and Browserbase credentials. To add these to your project, run:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cp .env.example .env
|
|
135
|
+
nano .env # Edit the .env file to add API keys
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
> [!NOTE]
|
|
141
|
+
> We highly value contributions to Stagehand! For questions or support, please join our [Slack community](https://join.slack.com/t/stagehand-dev/shared_invite/zt-38khc8iv5-T2acb50_0OILUaX7lxeBOg).
|
|
142
|
+
|
|
143
|
+
At a high level, we're focused on improving reliability, speed, and cost in that order of priority. If you're interested in contributing, we strongly recommend reaching out to [Miguel Gonzalez](https://x.com/miguel_gonzf) or [Paul Klein](https://x.com/pk_iv) in our [Slack community](https://join.slack.com/t/stagehand-dev/shared_invite/zt-38khc8iv5-T2acb50_0OILUaX7lxeBOg) before starting to ensure that your contribution aligns with our goals.
|
|
144
|
+
|
|
145
|
+
For more information, please see our [Contributing Guide](https://docs.stagehand.dev/examples/contributing).
|
|
146
|
+
|
|
147
|
+
## Acknowledgements
|
|
148
|
+
|
|
149
|
+
This project heavily relies on [Playwright](https://playwright.dev/) as a resilient backbone to automate the web. It also would not be possible without the awesome techniques and discoveries made by [tarsier](https://github.com/reworkd/tarsier), [gemini-zod](https://github.com/jbeoris/gemini-zod), and [fuji-web](https://github.com/normal-computing/fuji-web).
|
|
150
|
+
|
|
151
|
+
We'd like to thank the following people for their major contributions to Stagehand:
|
|
152
|
+
- [Paul Klein](https://github.com/pkiv)
|
|
153
|
+
- [Anirudh Kamath](https://github.com/kamath)
|
|
154
|
+
- [Sean McGuire](https://github.com/seanmcguire12)
|
|
155
|
+
- [Miguel Gonzalez](https://github.com/miguelg719)
|
|
156
|
+
- [Sameel Arif](https://github.com/sameelarif)
|
|
157
|
+
- [Filip Michalsky](https://github.com/filip-michalsky)
|
|
158
|
+
- [Jeremy Press](https://x.com/jeremypress)
|
|
159
|
+
- [Navid Pour](https://github.com/navidpour)
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
Licensed under the MIT License.
|
|
164
|
+
|
|
165
|
+
Copyright 2025 Browserbase, Inc.
|