Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to NPM in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/browser-use/browser-use-node/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
run: |
yarn install

- name: Publish to NPM
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.BROWSER_USE_NPM_TOKEN || secrets.NPM_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'browser-use/browser-use-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.BROWSER_USE_NPM_TOKEN || secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browser-use%2Fbrowser-use-86040fd18419e7b4e0947660d9c0ff1abe21550528d2d2a549736cd16f85a92d.yml
openapi_spec_hash: 7c5de9d0f633db35fd9e250fcc834d1f
config_hash: fdda11f4272828e3d5d13f933105a0d7
config_hash: 9ae623b132cbaa42505f45bb1db418ea
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## 0.1.0 (2025-08-09)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/browser-use/browser-use-node/compare/v0.0.1...v0.1.0)

### Features

* **api:** update via SDK Studio ([c56303c](https://github.com/browser-use/browser-use-node/commit/c56303c06357c1b24d6e797dd9a1fb7ca4e4249b))


### Chores

* update SDK settings ([e47a3c0](https://github.com/browser-use/browser-use-node/commit/e47a3c0111c16d7c1e7096a8b69f5e77c85f82fe))
* update SDK settings ([c39de14](https://github.com/browser-use/browser-use-node/commit/c39de1490a0d59e65b376efa94ec959b87b43d47))
24 changes: 19 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ npm install git+ssh://[email protected]:stainless-sdks/browser-use-typescript.git
$ npm install git+ssh://[email protected]:browser-use/browser-use-node.git
```

Alternatively, to link a local copy of the repo:

```sh
# Clone
$ git clone https://www.github.com/stainless-sdks/browser-use-typescript
$ cd browser-use-typescript
$ git clone https://www.github.com/browser-use/browser-use-node
$ cd browser-use-node

# With yarn
$ yarn link
$ cd ../my-package
$ yarn link browser-use-node
$ yarn link browser-use-sdk

# With pnpm
$ pnpm link --global
$ cd ../my-package
$ pnpm link -—global browser-use-node
$ pnpm link -—global browser-use-sdk
```

## Running tests
Expand Down Expand Up @@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
```sh
$ yarn fix
```

## Publishing and releases

Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
the changes aren't made through the automated pipeline, you may want to make releases manually.

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/browser-use/browser-use-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
the environment.
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Browser Use TypeScript API Library

[![NPM version](<https://img.shields.io/npm/v/browser-use-node.svg?label=npm%20(stable)>)](https://npmjs.org/package/browser-use-node) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/browser-use-node)
[![NPM version](<https://img.shields.io/npm/v/browser-use-sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/browser-use-sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/browser-use-sdk)

This library provides convenient access to the Browser Use REST API from server-side TypeScript or JavaScript.

Expand All @@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation

```sh
npm install git+ssh://[email protected]:stainless-sdks/browser-use-typescript.git
npm install browser-use-sdk
```

> [!NOTE]
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install browser-use-node`

## Usage

The full API of this library can be found in [api.md](api.md).

<!-- prettier-ignore -->
```js
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
apiKey: process.env['BROWSER_USE_API_KEY'], // This is the default and can be omitted
Expand All @@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response

<!-- prettier-ignore -->
```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
apiKey: process.env['BROWSER_USE_API_KEY'], // This is the default and can be omitted
Expand Down Expand Up @@ -162,7 +159,7 @@ The log level can be configured in two ways:
2. Using the `logLevel` client option (overrides the environment variable if set)

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
logLevel: 'debug', // Show all log messages
Expand Down Expand Up @@ -190,7 +187,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
below the configured level will not be sent to your logger.

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';
import pino from 'pino';

const logger = pino();
Expand Down Expand Up @@ -259,7 +256,7 @@ globalThis.fetch = fetch;
Or pass it to the client:

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';
import fetch from 'my-fetch';

const client = new BrowserUse({ fetch });
Expand All @@ -270,7 +267,7 @@ const client = new BrowserUse({ fetch });
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
fetchOptions: {
Expand All @@ -287,7 +284,7 @@ options to requests:
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';
import * as undici from 'undici';

const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
Expand All @@ -301,7 +298,7 @@ const client = new BrowserUse({
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>

```ts
import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
fetchOptions: {
Expand All @@ -313,7 +310,7 @@ const client = new BrowserUse({
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>

```ts
import BrowserUse from 'npm:browser-use-node';
import BrowserUse from 'npm:browser-use-sdk';

const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
const client = new BrowserUse({
Expand All @@ -335,7 +332,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/browser-use-typescript/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/browser-use/browser-use-node/issues) with questions, bugs, or suggestions.

## Requirements

Expand Down
22 changes: 22 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

errors=()

if [ -z "${NPM_TOKEN}" ]; then
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"

2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default tseslint.config(
{
patterns: [
{
regex: '^browser-use-node(/.*)?',
regex: '^browser-use-sdk(/.*)?',
message: 'Use a relative import, not a package import.',
},
],
Expand Down
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
},
moduleNameMapper: {
'^browser-use-node$': '<rootDir>/src/index.ts',
'^browser-use-node/(.*)$': '<rootDir>/src/$1',
'^browser-use-sdk$': '<rootDir>/src/index.ts',
'^browser-use-sdk/(.*)$': '<rootDir>/src/$1',
},
modulePathIgnorePatterns: [
'<rootDir>/ecosystem-tests/',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "browser-use-node",
"version": "0.0.1",
"name": "browser-use-sdk",
"version": "0.1.0",
"description": "The official TypeScript library for the Browser Use API",
"author": "Browser Use <[email protected]>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:stainless-sdks/browser-use-typescript",
"repository": "github:browser-use/browser-use-node",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"files": [
Expand Down
64 changes: 64 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "node",
"extra-files": ["src/version.ts", "README.md"]
}
6 changes: 3 additions & 3 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs

# Build into dist and will publish the package from there,
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
# This way importing from `"browser-use-node/resources/foo"` works
# This way importing from `"browser-use-sdk/resources/foo"` works
# even with `"moduleResolution": "node"`

rm -rf dist; mkdir dist
Expand Down Expand Up @@ -42,8 +42,8 @@ node scripts/utils/postprocess-files.cjs

# make sure that nothing crashes when we require the output CJS or
# import the output ESM
(cd dist && node -e 'require("browser-use-node")')
(cd dist && node -e 'import("browser-use-node")' --input-type=module)
(cd dist && node -e 'require("browser-use-sdk")')
(cd dist && node -e 'import("browser-use-sdk")' --input-type=module)

if [ -e ./scripts/build-deno ]
then
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.0.1';
export const VERSION = '0.1.0'; // x-release-please-version
2 changes: 1 addition & 1 deletion tests/api-resources/agent-profiles.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import BrowserUse from 'browser-use-node';
import BrowserUse from 'browser-use-sdk';

const client = new BrowserUse({
apiKey: 'My API Key',
Expand Down
Loading
Loading