Repository navigation
feat: add OpenCode plugin support (@browserbasehq/opencode) #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+829
−1
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c7185fc
feat: add OpenCode plugin support
cursoragent 88dd0af
feat: add npm trusted publishing CI for @browserbasehq/opencode
cursoragent 939a22a
docs: soften wording about OpenCode plugin distribution
cursoragent db7d426
fix: bump Node to 22 for npm OIDC trusted publishing
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Publish OpenCode Plugin | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "opencode/package.json" | ||
| workflow_dispatch: | ||
| inputs: | ||
| force: | ||
| description: "Force publish even if version exists (will fail if already published)" | ||
| required: false | ||
| default: "false" | ||
| type: boolean | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: opencode | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - name: Get package info | ||
| id: pkg | ||
| run: | | ||
| NAME=$(node -pe "require('./package.json').name") | ||
| VERSION=$(node -pe "require('./package.json').version") | ||
| echo "name=$NAME" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "Package: $NAME@$VERSION" | ||
|
|
||
| - name: Check if version already published | ||
| id: check | ||
| run: | | ||
| if npm view "${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}" version 2>/dev/null; then | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| echo "Version ${{ steps.pkg.outputs.version }} already exists on npm" | ||
| else | ||
| echo "exists=false" >> "$GITHUB_OUTPUT" | ||
| echo "Version ${{ steps.pkg.outputs.version }} not yet published" | ||
| fi | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.check.outputs.exists == 'false' || inputs.force == 'true' | ||
| run: npm ci --ignore-scripts || npm install --ignore-scripts | ||
|
|
||
| - name: Type check | ||
| if: steps.check.outputs.exists == 'false' || inputs.force == 'true' | ||
| run: npm run check | ||
|
|
||
| # Uses npm OIDC trusted publishing - no NPM_TOKEN secret required. | ||
| # First-time setup: someone with @browserbasehq npm org access must | ||
| # configure this package to trust GitHub Actions from this repo/workflow. | ||
| # See: https://docs.npmjs.com/generating-provenance-statements | ||
| - name: Publish to npm | ||
| if: steps.check.outputs.exists == 'false' || inputs.force == 'true' | ||
| run: npm publish --access public --provenance | ||
|
|
||
| - name: Skip publish (version exists) | ||
| if: steps.check.outputs.exists == 'true' && inputs.force != 'true' | ||
| run: | | ||
| echo "::notice::Skipping publish - ${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }} already exists on npm" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # @browserbasehq/opencode | ||
|
|
||
| [OpenCode](https://opencode.ai) plugin for [Browserbase](https://browserbase.com) browser automation. It gives your agent the [browse CLI](https://github.com/browserbase/stagehand/tree/main/packages/cli) for navigating pages, extracting content, taking screenshots, and interacting with real web pages. | ||
|
|
||
| ## Installation | ||
|
|
||
| The plugin supports OpenCode 2 and OpenCode 1 from the same package. | ||
|
|
||
| ### OpenCode 2 | ||
|
|
||
| ```bash | ||
| opencode plugin add @browserbasehq/opencode | ||
| ``` | ||
|
|
||
| Or add it to `opencode.jsonc` yourself: | ||
|
|
||
| ```jsonc | ||
| { | ||
| "$schema": "https://opencode.ai/config.json", | ||
| "plugins": ["@browserbasehq/opencode"] | ||
| } | ||
| ``` | ||
|
|
||
| ### OpenCode 1 | ||
|
|
||
| Add it to `opencode.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "$schema": "https://opencode.ai/config.json", | ||
| "plugin": ["@browserbasehq/opencode"] | ||
| } | ||
| ``` | ||
|
|
||
| OpenCode installs the package on the next start. | ||
|
|
||
| ### Install the browse CLI | ||
|
|
||
| The plugin bundles the browse skill, but you need the CLI installed globally: | ||
|
|
||
| ```bash | ||
| npm install -g browse | ||
| ``` | ||
|
|
||
| Verify the installation: | ||
|
|
||
| ```bash | ||
| which browse && browse --help | ||
| ``` | ||
|
|
||
| ## Authentication | ||
|
|
||
| ### Local browsing (no key required) | ||
|
|
||
| For local browser sessions, no API key is needed. The browse CLI uses Chrome or Chromium on your machine: | ||
|
|
||
| ```bash | ||
| browse open https://example.com --local | ||
| browse snapshot | ||
| browse stop | ||
| ``` | ||
|
|
||
| ### Browserbase cloud | ||
|
|
||
| For remote stealth sessions, proxies, and CAPTCHA solving, set your API key: | ||
|
|
||
| ```bash | ||
| export BROWSERBASE_API_KEY=your-api-key | ||
| ``` | ||
|
|
||
| Get a key at [browserbase.com/settings](https://browserbase.com/settings). | ||
|
|
||
| Optionally set a project ID: | ||
|
|
||
| ```bash | ||
| export BROWSERBASE_PROJECT_ID=your-project-id | ||
| ``` | ||
|
|
||
| The plugin passes these environment variables to shell commands automatically, so the browse CLI is authenticated without manual configuration in each session. | ||
|
|
||
| ## Skills | ||
|
|
||
| The plugin bundles the browse CLI skill, which teaches your agent: | ||
|
|
||
| - Opening and navigating web pages | ||
| - Taking accessibility snapshots (structured page state) | ||
| - Taking screenshots | ||
| - Clicking, typing, and interacting with elements | ||
| - Managing browser sessions and tabs | ||
| - Using Browserbase cloud APIs | ||
| - Working with contexts, extensions, and functions | ||
|
|
||
| Just ask your agent: | ||
|
|
||
| - *"Go to Hacker News and get the top 5 stories."* | ||
| - *"Fill out the signup form on example.com."* | ||
| - *"Take a screenshot of localhost:3000."* | ||
|
|
||
| ## Links | ||
|
|
||
| - [browse CLI documentation](https://github.com/browserbase/stagehand/tree/main/packages/cli) | ||
| - [Browserbase documentation](https://docs.browserbase.com) | ||
| - [OpenCode plugin docs](https://opencode.ai/v2/docs/plugins) | ||
| - [browse-plugin repository](https://github.com/browserbase/browse-plugin) | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { server } from "./v1.ts"; | ||
| import { v2 } from "./v2.ts"; | ||
|
|
||
| // One entrypoint for both hosts: OpenCode 1 calls `server()`, OpenCode 2 reads `id` and `setup()`. | ||
| export default { ...v2, server }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| { | ||
| "name": "@browserbasehq/opencode", | ||
| "version": "0.4.0", | ||
| "description": "Browserbase browse plugin for OpenCode: browser automation, navigation, extraction, screenshots, and interaction via the browse CLI", | ||
| "type": "module", | ||
| "main": "index.ts", | ||
| "files": [ | ||
| "index.ts", | ||
| "v1.ts", | ||
| "v2.ts", | ||
| "skills.ts", | ||
| "skills" | ||
| ], | ||
| "keywords": [ | ||
| "opencode", | ||
| "opencode-plugin", | ||
| "browserbase", | ||
| "browser", | ||
| "automation", | ||
| "stagehand", | ||
| "browse", | ||
| "web-scraping", | ||
| "screenshot", | ||
| "llm", | ||
| "ai" | ||
| ], | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/browserbase/browse-plugin.git", | ||
| "directory": "opencode" | ||
| }, | ||
| "homepage": "https://browserbase.com", | ||
| "author": { | ||
| "name": "Browserbase", | ||
| "email": "support@browserbase.com", | ||
| "url": "https://browserbase.com" | ||
| }, | ||
| "scripts": { | ||
| "check": "tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "gray-matter": "^4.0.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@opencode-ai/plugin": "^1.19.5", | ||
| "@opencode/plugin": "^2.2.5", | ||
| "@types/node": "^22.0.0", | ||
| "typescript": "^5.0.0" | ||
| }, | ||
| "exports": { | ||
| ".": "./index.ts" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.