npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

doubao-browser-agent

v1.5.0

Published

NPM package for interacting with Doubao web version via Playwright

Readme

doubao-browser-agent

NPM package for interacting with Doubao (豆包) web version via Playwright.

Features

  • Automated browser interaction with Doubao web version
  • Automatic Chrome profile management for login persistence
  • Retry mechanism for network failures
  • CLI and Node.js API support
  • TypeScript support with full type definitions

Prerequisites

  1. Chrome browser installed on your system
  2. Logged into Doubao (https://www.doubao.com/chat/) in your Chrome browser at least once

The package uses your Chrome profile to maintain login state, so you need to login manually first.

Installation

npm install doubao-browser-agent

Node.js API Usage

import { DoubaoAgent } from 'doubao-browser-agent';

// Create agent instance
const agent = new DoubaoAgent({
  timeout: 120000,    // Timeout in milliseconds (default: 120000)
  retryCount: 3,      // Retry count (default: 3)
});

// Send a question and get answer
try {
  const answer = await agent.ask('What is TypeScript?');
  console.log('Answer:', answer);
} catch (error) {
  console.error('Error:', error.message);
}

// Check login status
const status = agent.status();
console.log('Logged in:', status.loggedIn);
console.log('Profile path:', status.profilePath);

// Clear saved profile (if needed)
await agent.reset();

CLI Usage

# Send a question
doubao-agent ask "What is TypeScript?"

# With options
doubao-agent ask "Explain Promise" --timeout 60000 --retry 5

# Check login status
doubao-agent status

# Clear saved profile
doubao-agent reset

# Show help
doubao-agent --help

API Documentation

DoubaoAgent

Main class for interacting with Doubao.

Constructor

new DoubaoAgent(options?: DoubaoAgentOptions)

Options:

  • timeout?: number - Timeout in milliseconds (default: 120000)
  • retryCount?: number - Number of retry attempts (default: 3)
  • profileDir?: string - Custom directory for storing Chrome profile copy
  • chromePath?: string - Custom Chrome executable path

Methods

ask(question: string): Promise<string>

Send a question to Doubao and return the answer.

status(): { loggedIn: boolean; profilePath: string }

Check the login status (whether profile exists).

reset(): Promise<void>

Clear the saved profile copy.

Error Types

The package throws DoubaoAgentError with the following error types:

| Type | Description | |------|-------------| | BROWSER_LAUNCH | Failed to launch Chrome browser | | PROFILE_COPY | Failed to copy Chrome profile | | TIMEOUT | Timeout while waiting for response | | NETWORK | Network or connection error |

import { DoubaoAgentError } from 'doubao-browser-agent';

try {
  const answer = await agent.ask('Hello');
} catch (error) {
  if (error instanceof DoubaoAgentError) {
    console.log('Error type:', error.type);
    console.log('Error message:', error.message);
  }
}

How It Works

  1. On first run, the package copies your Chrome profile to a temporary directory
  2. Launches Chrome in headless mode with the copied profile
  3. Navigates to Doubao chat page
  4. Sends your question and waits for response
  5. Extracts the response and closes the browser

Supported Platforms

  • Windows (Chrome paths: C:/Program Files/Google/Chrome/Application/chrome.exe)
  • macOS (Chrome paths: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
  • Linux (Chrome paths: /usr/bin/google-chrome, /usr/bin/chrome)

License

MIT