← 返回 Skills 市场
gaxxx

browser

作者 gaxxx · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ⚠ suspicious
211
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install bsession
功能描述
Browser automation — setup the bsession environment, fetch info from a website (one-shot), create scripted automations (one-shot or recurring), or debug exis...
使用说明 (SKILL.md)

/browser skill

You help users automate browsers inside the bsession Docker container — whether it's initial setup, a quick interactive fetch, a scripted automation (one-shot or recurring), or debugging an existing session.

This is a global skill — it works from any repo. bsession is installed at ~/.bsession/, and the bsession CLI is on PATH.

Resolve paths

Before doing anything, determine how to reach bsession. Check in this order:

  1. bsession on PATH → use bsession
  2. ~/.bsession/bsession exists → use ~/.bsession/bsession
  3. ./bsession in current directory → use ./bsession
  4. None found but container is running (docker exec agent-browser echo ok) → use docker exec agent-browser python3 /app/session.py as the CLI

Similarly, resolve workspace:

  1. ~/.bsession/workspace/ exists → use it
  2. ./workspace/ in current directory → use it
  3. Ask docker exec agent-browser ls /workspace/conf → use docker exec to access files

Use these resolved paths for all commands throughout the session.

Constants (defaults)

  • BSESSION_HOME: ~/.bsession/ — where bsession source + docker-compose live
  • WORKSPACE: ~/.bsession/workspace/ (default, overridable) — or resolved per above
  • bsession CLI: resolved per above

Routing

Parse the user's slash command arguments:

  • No arguments or list → List mode (show all available scripts and sessions)
  • setup → Setup mode (install and configure bsession)
  • fetch \x3Curl> → Fetch mode (interactive one-shot extraction, with option to persist)
  • new \x3Cname> → Create mode (scaffold a script — one-shot or recurring)
  • run \x3Cname> → Run mode (execute a saved session and show results)
  • Otherwise → Debug mode (inspect/fix an existing session)

Pre-check (all modes except setup)

Before running any mode except setup, verify the container is running:

docker exec agent-browser echo ok 2>/dev/null

If this fails, tell the user to either:

  • Run /browser setup for a fresh install, or
  • Run docker compose up -d from the bsession project directory

List mode (/browser or /browser list)

Show all available scripts, their status, and what they do.

Step 1: Get session status

bsession list

Step 2: Read script docstrings

For each .py file in ~/.bsession/workspace/scripts/, read the module docstring (the triple-quoted string at the top of the file).

Step 3: Read conf files

For each .conf file in ~/.bsession/workspace/conf/, read the [env] section to show current configuration.

Step 4: Present as a table

Display a summary like:

Session       Status    Type        Description
─────────────────────────────────────────────────────────────────
uscis         running   recurring   USCIS case status monitor
price-check   stopped   one-shot    Amazon product price scraper

Available commands:
  /browser \x3Cname>           debug a session
  /browser new \x3Cname>       create a new automation
  /browser fetch \x3Curl>      quick one-shot fetch

Setup mode (/browser setup)

Run the install script:

bash ~/.openclaw/workspace/skills/browser/scripts/install.sh

Or with options:

bash ~/.openclaw/workspace/skills/browser/scripts/install.sh --workspace /path/to/workspace
bash ~/.openclaw/workspace/skills/browser/scripts/install.sh --vnc-password secret
bash ~/.openclaw/workspace/skills/browser/scripts/install.sh --repo https://github.com/gaxxx/bsession.git

Ask the user for custom options before running. The script handles Docker check, uv/Python install, image build, container start, and CLI setup.


Fetch mode (/browser fetch \x3Curl>)

One-shot: open a URL, extract information, return it. No script, no conf file, no loop.

Step 1: Find an available CDP port

docker exec agent-browser python3 -c "
import urllib.request
try:
    urllib.request.urlopen('http://localhost:9222/json/version', timeout=2)
    print('IN_USE')
except:
    print('FREE')
"

If 9222 is in use, try 9223, 9224, etc. Start a temporary Chrome on a free port:

docker exec agent-browser python3 -c "
import sys; sys.path.insert(0, '/app')
from lib.browser import start_chrome
pid = start_chrome(PORT, '/workspace/data/profile-tmp')
print(f'Chrome started, pid={pid}')
"

Step 2: Navigate and extract

docker exec agent-browser agent-browser --cdp PORT open "URL"
sleep 5
docker exec agent-browser agent-browser --cdp PORT snapshot

Handle Cloudflare if detected:

docker exec agent-browser python3 -c "
import sys; sys.path.insert(0, '/app')
from lib.browser import ab, is_cloudflare, wait_for_cloudflare
snap = ab(PORT, 'snapshot')
if is_cloudflare(snap):
    wait_for_cloudflare(PORT, snap)
    snap = ab(PORT, 'snapshot')
print(snap)
"

Step 3: Parse and interact

docker exec agent-browser agent-browser --cdp PORT fill REF "value"
docker exec agent-browser agent-browser --cdp PORT click REF
docker exec agent-browser agent-browser --cdp PORT snapshot

Step 4: Return results

Parse the relevant information and present it cleanly.

Step 5: Offer to persist

After returning results, always ask if the user wants to save as a reusable script. If yes, create a one-shot script + conf in ~/.bsession/workspace/.

Step 6: Cleanup

docker exec agent-browser python3 -c "
import sys; sys.path.insert(0, '/app')
from lib.browser import stop_chrome
stop_chrome(PORT)
"

Create mode (/browser new \x3Cname>)

Ask the user:

  1. What URL(s) to target
  2. One-shot or recurring?
  3. What to detect / extract
  4. Where to send results (webhook, file, etc.)
  5. Env vars needed

Then scaffold ~/.bsession/workspace/conf/\x3Cname>.conf and ~/.bsession/workspace/scripts/\x3Cname>.py following the conventions in the reference section below.


Run mode (/browser run \x3Cname>)

  1. Verify session exists: bsession show \x3Cname>
  2. Run it: bsession run \x3Cname>
  3. Wait and tail logs: bsession logs \x3Cname> -n 50
  4. Present results. If failed, switch to debug mode.

Debug mode (/browser \x3Csession-id>)

  1. Gather state: bsession list, bsession show \x3Cid>, read logs and script
  2. Diagnose: Cloudflare stuck, element not found, crash, wrong data, process dead
  3. Fix the script or conf, then bsession restart \x3Cid>

Script conventions

Imports:

import os, re, sys, time
sys.path.insert(0, "/app")
from lib.browser import (
    ab, ab_quiet, find_ref, is_cloudflare, wait_for_cloudflare,
    send_webhook, make_logger,
)

Config from env vars:

port = int(os.environ.get("CDP_PORT", 9222))
session_name = os.environ.get("SESSION_NAME", "\x3Cname>")
webhook_url = os.environ.get("N8N_WEBHOOK_URL", "")
check_interval = int(os.environ.get("CHECK_INTERVAL", 1800))

Core pattern: open URL → wait → snapshot → handle Cloudflare → find elements → interact → parse results

One-shot: execute and exit. Recurring: wrap in while True with sleep, compare state, webhook on change.

Reference: lib/browser.py

  • ab(port, cmd, *args) / ab_quiet(port, cmd, *args) — run agent-browser commands
  • find_ref(snapshot, pattern) / find_all_refs(snapshot, pattern) — parse accessibility tree
  • is_cloudflare(snapshot) / wait_for_cloudflare(port, snapshot, ...) — Cloudflare handling
  • send_webhook(url, payload) — POST JSON to webhook
  • make_logger(session_name) — create timestamped logger
安全使用建议
This skill appears to do what it says (install and run a browser automation container) but the installer makes persistent, privileged changes and pulls/executes external code. Before installing: 1) Inspect the bsession Dockerfile, session.py, entrypoint.sh and any image sources the repo references; 2) Avoid running the installer on a sensitive host — use an isolated VM or disposable environment; 3) Do not run the install script without reading it first: it runs curl | sh to install 'uv' and builds/starts containers; consider running with --no-start and review the built images; 4) If you need VNC, pass --vnc-password to avoid leaving an open VNC passwordless; 5) Note the script will copy files into ~/.openclaw and ~/.claude and create a symlink in ~/.local/bin — back up or review these locations if you rely on them. If you want a lower-risk audit, provide the bsession repo (or its Dockerfile/session.py) for review.
功能分析
Type: OpenClaw Skill Name: bsession Version: 0.1.0 The bsession skill bundle is a browser automation tool that sets up a Docker-based environment for web scraping and automation. It includes an installation script (install.sh) that configures a local workspace in ~/.bsession, builds a Docker image, and installs a CLI tool. The SKILL.md file provides clear instructions for the AI agent to manage sessions, fetch data, and create new automations. No evidence of malicious intent, data exfiltration, or unauthorized access was found; the behavior is consistent with the stated purpose of providing a global browser automation skill.
能力评估
Purpose & Capability
Name/description align with what the files and SKILL.md do: set up a bsession Docker container, run browser automation, scaffold and run scripts. Required binary (docker) is appropriate.
Instruction Scope
SKILL.md instructs the agent to run docker exec commands and read/modify files under ~/.bsession/workspace (scripts and conf), which is expected for this purpose. It also instructs running the provided install.sh; the instructions assume modifying files in the user's home and starting containers, which is within scope but has side effects the user should be aware of.
Install Mechanism
Although the skill is instruction-only, the included install.sh executes network-installed tooling (curl -LsSf https://astral.sh/uv/install.sh | sh), clones or copies project sources, builds Docker images, and starts containers — all actions that execute code from external sources and write to the host. This increases risk relative to a purely local/scripted install.
Credentials
The skill declares no environment variables or credentials. The install script writes a .env file under ~/.bsession and may set VNC_PASSWORD if provided, which is reasonable for the stated functionality. No unrelated secrets are requested.
Persistence & Privilege
The installer writes files into user directories, creates symlinks (bsession → ~/.local/bin), and copies SKILL.md/install.sh into ~/.openclaw/workspace/skills/browser and ~/.claude/skills/browser. This alters agent/skill directories and creates persistent system presence; users should expect persistent changes to their home directory and agent skill directories.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install bsession
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /bsession 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Browser automation sessions running inside Docker. Each session gets its own Chrome instance managed via CDP, with Cloudflare bypass, persistent profiles, and VNC access for debugging.
元数据
Slug bsession
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

browser 是什么?

Browser automation — setup the bsession environment, fetch info from a website (one-shot), create scripted automations (one-shot or recurring), or debug exis... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 211 次。

如何安装 browser?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install bsession」即可一键安装,无需额外配置。

browser 是免费的吗?

是的,browser 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

browser 支持哪些平台?

browser 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 browser?

由 gaxxx(@gaxxx)开发并维护,当前版本 v0.1.0。

💬 留言讨论