persistent-browser-bridge 0.1.0__tar.gz
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.
- persistent_browser_bridge-0.1.0/.editorconfig +13 -0
- persistent_browser_bridge-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +32 -0
- persistent_browser_bridge-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +24 -0
- persistent_browser_bridge-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- persistent_browser_bridge-0.1.0/.github/workflows/release.yml +24 -0
- persistent_browser_bridge-0.1.0/.github/workflows/test.yml +24 -0
- persistent_browser_bridge-0.1.0/.gitignore +30 -0
- persistent_browser_bridge-0.1.0/.pre-commit-config.yaml +7 -0
- persistent_browser_bridge-0.1.0/CHANGELOG.md +16 -0
- persistent_browser_bridge-0.1.0/CODE_OF_CONDUCT.md +16 -0
- persistent_browser_bridge-0.1.0/CONTRIBUTING.md +17 -0
- persistent_browser_bridge-0.1.0/LICENSE +22 -0
- persistent_browser_bridge-0.1.0/PKG-INFO +210 -0
- persistent_browser_bridge-0.1.0/README.md +176 -0
- persistent_browser_bridge-0.1.0/ROADMAP.md +18 -0
- persistent_browser_bridge-0.1.0/SECURITY.md +16 -0
- persistent_browser_bridge-0.1.0/benchmarks/README.md +6 -0
- persistent_browser_bridge-0.1.0/benchmarks/benchmark_schema.json +21 -0
- persistent_browser_bridge-0.1.0/docs/agent-integration.md +15 -0
- persistent_browser_bridge-0.1.0/docs/architecture.md +8 -0
- persistent_browser_bridge-0.1.0/docs/cli.md +8 -0
- persistent_browser_bridge-0.1.0/docs/installation.md +12 -0
- persistent_browser_bridge-0.1.0/docs/mcp.md +4 -0
- persistent_browser_bridge-0.1.0/docs/profiles.md +6 -0
- persistent_browser_bridge-0.1.0/docs/python-sdk.md +4 -0
- persistent_browser_bridge-0.1.0/docs/quickstart.md +14 -0
- persistent_browser_bridge-0.1.0/docs/security.md +4 -0
- persistent_browser_bridge-0.1.0/docs/troubleshooting.md +46 -0
- persistent_browser_bridge-0.1.0/examples/agent_example.md +4 -0
- persistent_browser_bridge-0.1.0/examples/basic_usage.py +8 -0
- persistent_browser_bridge-0.1.0/examples/download_file.py +5 -0
- persistent_browser_bridge-0.1.0/examples/form_fill.py +6 -0
- persistent_browser_bridge-0.1.0/examples/persistent_login.py +7 -0
- persistent_browser_bridge-0.1.0/pyproject.toml +69 -0
- persistent_browser_bridge-0.1.0/requirements-dev.txt +1 -0
- persistent_browser_bridge-0.1.0/scripts/dev_setup.ps1 +4 -0
- persistent_browser_bridge-0.1.0/scripts/dev_setup.sh +5 -0
- persistent_browser_bridge-0.1.0/scripts/release_check.py +12 -0
- persistent_browser_bridge-0.1.0/src/pbb/__init__.py +5 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/__init__.py +1 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/browser_detection.py +117 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/locator.py +103 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/locks.py +77 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/manager.py +218 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/profile.py +56 -0
- persistent_browser_bridge-0.1.0/src/pbb/browser/snapshot.py +139 -0
- persistent_browser_bridge-0.1.0/src/pbb/cli.py +305 -0
- persistent_browser_bridge-0.1.0/src/pbb/config.py +66 -0
- persistent_browser_bridge-0.1.0/src/pbb/constants.py +7 -0
- persistent_browser_bridge-0.1.0/src/pbb/daemon/__init__.py +1 -0
- persistent_browser_bridge-0.1.0/src/pbb/daemon/app.py +137 -0
- persistent_browser_bridge-0.1.0/src/pbb/daemon/client.py +39 -0
- persistent_browser_bridge-0.1.0/src/pbb/daemon/server.py +36 -0
- persistent_browser_bridge-0.1.0/src/pbb/utils/__init__.py +1 -0
- persistent_browser_bridge-0.1.0/src/pbb/utils/paths.py +40 -0
- persistent_browser_bridge-0.1.0/tests/conftest.py +18 -0
- persistent_browser_bridge-0.1.0/tests/fixtures/action_page.html +23 -0
- persistent_browser_bridge-0.1.0/tests/test_browser_detection.py +8 -0
- persistent_browser_bridge-0.1.0/tests/test_cli.py +31 -0
- persistent_browser_bridge-0.1.0/tests/test_config.py +26 -0
- persistent_browser_bridge-0.1.0/tests/test_daemon.py +29 -0
- persistent_browser_bridge-0.1.0/tests/test_download.py +8 -0
- persistent_browser_bridge-0.1.0/tests/test_locator.py +7 -0
- persistent_browser_bridge-0.1.0/tests/test_locks.py +25 -0
- persistent_browser_bridge-0.1.0/tests/test_profiles.py +27 -0
- persistent_browser_bridge-0.1.0/tests/test_snapshot.py +49 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report reproducible incorrect behavior
|
|
3
|
+
body:
|
|
4
|
+
- type: markdown
|
|
5
|
+
attributes:
|
|
6
|
+
value: Never attach profiles, credentials, cookies, or private page content.
|
|
7
|
+
- type: input
|
|
8
|
+
id: version
|
|
9
|
+
attributes:
|
|
10
|
+
label: PBB version
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
- type: dropdown
|
|
14
|
+
id: os
|
|
15
|
+
attributes:
|
|
16
|
+
label: Operating system
|
|
17
|
+
options: [Windows 10, Windows 11, macOS, Linux]
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: steps
|
|
22
|
+
attributes:
|
|
23
|
+
label: Reproduction steps
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: expected
|
|
28
|
+
attributes:
|
|
29
|
+
label: Expected and actual behavior
|
|
30
|
+
validations:
|
|
31
|
+
required: true
|
|
32
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Propose a focused, safe improvement
|
|
3
|
+
body:
|
|
4
|
+
- type: textarea
|
|
5
|
+
id: problem
|
|
6
|
+
attributes:
|
|
7
|
+
label: Problem
|
|
8
|
+
description: What agent workflow is blocked today?
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: proposal
|
|
13
|
+
attributes:
|
|
14
|
+
label: Proposed behavior
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: checkboxes
|
|
18
|
+
id: safety
|
|
19
|
+
attributes:
|
|
20
|
+
label: Safety
|
|
21
|
+
options:
|
|
22
|
+
- label: This request does not bypass CAPTCHA, authentication, anti-bot controls, or authorization.
|
|
23
|
+
required: true
|
|
24
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Describe the user-visible change and why it belongs in the current scope.
|
|
4
|
+
|
|
5
|
+
## Verification
|
|
6
|
+
|
|
7
|
+
- [ ] Tests added or updated
|
|
8
|
+
- [ ] `ruff check .` passes
|
|
9
|
+
- [ ] `pytest` passes
|
|
10
|
+
- [ ] `python -m build` passes
|
|
11
|
+
- [ ] No credentials, profiles, cookies, or private page data included
|
|
12
|
+
- [ ] Documentation updated when behavior changed
|
|
13
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- run: python -m pip install build
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- uses: softprops/action-gh-release@v2
|
|
21
|
+
with:
|
|
22
|
+
files: dist/*
|
|
23
|
+
generate_release_notes: true
|
|
24
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
strategy:
|
|
10
|
+
fail-fast: false
|
|
11
|
+
matrix:
|
|
12
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
13
|
+
python: ["3.11", "3.12"]
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python }}
|
|
20
|
+
- run: python -m pip install -e ".[dev]"
|
|
21
|
+
- run: ruff check .
|
|
22
|
+
- run: pytest
|
|
23
|
+
- run: python -m build
|
|
24
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.egg-info/
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.ruff_cache/
|
|
6
|
+
.mypy_cache/
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
*.log
|
|
12
|
+
logs/
|
|
13
|
+
profiles/
|
|
14
|
+
downloads/
|
|
15
|
+
screenshots/
|
|
16
|
+
browser-data/
|
|
17
|
+
user-data-dir/
|
|
18
|
+
pbb-screenshot.png
|
|
19
|
+
/acceptance.png
|
|
20
|
+
/acceptance-downloads/
|
|
21
|
+
.env
|
|
22
|
+
.env.*
|
|
23
|
+
config.local
|
|
24
|
+
config.local.*
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/
|
|
27
|
+
*.code-workspace
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes follow Keep a Changelog. This project uses Semantic Versioning.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-09-30
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Persistent Edge, Chrome, and Chromium profiles.
|
|
12
|
+
- Local FastAPI daemon and Typer CLI.
|
|
13
|
+
- Compact safe DOM snapshots and guarded snapshot references.
|
|
14
|
+
- Navigation, click, fill, text, download, and screenshot actions.
|
|
15
|
+
- JSON output, profile locks, stale-lock recovery, tests, and documentation.
|
|
16
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, experience, education, socioeconomic status, nationality, appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our standards
|
|
8
|
+
|
|
9
|
+
Positive behavior includes empathy, constructive feedback, respect for differing viewpoints, and accepting responsibility. Unacceptable behavior includes harassment, sexualized language or attention, insults, threats, trolling, and publishing private information without permission.
|
|
10
|
+
|
|
11
|
+
## Enforcement
|
|
12
|
+
|
|
13
|
+
Project maintainers may remove, edit, or reject contributions and may temporarily or permanently ban participants for behavior they deem inappropriate. Report conduct issues privately through the repository maintainers. All complaints will be reviewed promptly and fairly, with respect for reporter privacy.
|
|
14
|
+
|
|
15
|
+
This code is adapted from Contributor Covenant 2.1.
|
|
16
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping PBB. Open an issue before substantial changes so scope and safety expectations are clear.
|
|
4
|
+
|
|
5
|
+
```console
|
|
6
|
+
python -m venv .venv
|
|
7
|
+
.venv\Scripts\activate
|
|
8
|
+
python -m pip install -e ".[dev]"
|
|
9
|
+
ruff check .
|
|
10
|
+
pytest
|
|
11
|
+
python -m build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
On macOS or Linux, activate with `source .venv/bin/activate`. Keep changes typed, focused, and tested. Never add credential extraction, CAPTCHA bypass, fingerprint spoofing, anti-detection, or scraping-evasion features. Do not place real profiles or credentials in fixtures.
|
|
15
|
+
|
|
16
|
+
Commits should describe coherent changes, for example `feat: add compact DOM snapshot` or `fix: reject stale profile references`. By participating, you agree to follow the Code of Conduct.
|
|
17
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Persistent Browser Bridge contributors
|
|
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.
|
|
22
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: persistent-browser-bridge
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Give AI coding agents a real persistent browser.
|
|
5
|
+
Author: Persistent Browser Bridge contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai-agents,browser-automation,persistent-profile,playwright
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: fastapi<1,>=0.115
|
|
18
|
+
Requires-Dist: httpx<1,>=0.27
|
|
19
|
+
Requires-Dist: platformdirs<5,>=4.2
|
|
20
|
+
Requires-Dist: playwright<2,>=1.48
|
|
21
|
+
Requires-Dist: psutil<8,>=6
|
|
22
|
+
Requires-Dist: pydantic<3,>=2.9
|
|
23
|
+
Requires-Dist: rich<15,>=13.9
|
|
24
|
+
Requires-Dist: typer<1,>=0.12
|
|
25
|
+
Requires-Dist: uvicorn<1,>=0.30
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build<2,>=1.2; extra == 'dev'
|
|
28
|
+
Requires-Dist: mypy<2,>=1.13; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio<1,>=0.24; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest<9,>=8.3; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff<1,>=0.8; extra == 'dev'
|
|
32
|
+
Requires-Dist: types-psutil<8,>=6; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Persistent Browser Bridge
|
|
36
|
+
|
|
37
|
+
> Give AI coding agents a real persistent browser.
|
|
38
|
+
|
|
39
|
+
Persistent Browser Bridge (PBB) is a local browser-control layer built on Playwright. Instead of forcing AI agents to repeatedly inspect screenshots, PBB exposes lightweight DOM-first browser actions while preserving real browser sessions across runs.
|
|
40
|
+
|
|
41
|
+
**Persistent. DOM-first. Local-first. Agent-friendly. Low-context.**
|
|
42
|
+
|
|
43
|
+
PBB is an early v0.1 release for normal, authorized browser automation. It is not a CAPTCHA bypass, anti-detection toolkit, credential collector, or scraping-evasion framework.
|
|
44
|
+
|
|
45
|
+
## Why PBB
|
|
46
|
+
|
|
47
|
+
Visual automation remains valuable when a page cannot be understood through the DOM. For routine forms, links, text, and downloads, a compact DOM snapshot is faster to inspect and less dependent on screen coordinates. A dedicated persistent browser profile also keeps cookies, local storage, IndexedDB, and login state between runs without touching your everyday browser profile.
|
|
48
|
+
|
|
49
|
+
| Feature | Computer Use | PBB |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Interaction | Visual | DOM-first |
|
|
52
|
+
| Browser state | Depends on environment | Dedicated persistent profile |
|
|
53
|
+
| Login reuse | Environment dependent | Reuses its PBB profile |
|
|
54
|
+
| Element targeting | Vision and coordinates | DOM locators and snapshot references |
|
|
55
|
+
| Downloads | UI dependent | Playwright download events |
|
|
56
|
+
| Agent context | Visual-heavy | Compact DOM snapshot |
|
|
57
|
+
| Recovery | Agent dependent | Basic page and stale-lock recovery |
|
|
58
|
+
| Local-first | Depends | Yes |
|
|
59
|
+
|
|
60
|
+
PBB complements visual browser automation rather than replacing every use case.
|
|
61
|
+
|
|
62
|
+
## Architecture
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
AI agent -> pbb CLI -> localhost daemon -> Playwright
|
|
66
|
+
-> real Edge/Chrome -> dedicated persistent profile -> website
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The daemon binds to `127.0.0.1` by default and owns the Playwright process, active page, snapshot references, and download handling. CLI commands talk only to that local daemon, so a browser is not restarted for each action.
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
PBB requires Python 3.11 or newer. Edge is preferred, Chrome is supported, and Playwright Chromium is the fallback.
|
|
74
|
+
|
|
75
|
+
```console
|
|
76
|
+
cd persistent-browser-bridge
|
|
77
|
+
python -m pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If no system browser is available, install Playwright Chromium with `python -m playwright install chromium`. The package has not been published to PyPI yet; do not use `pip install persistent-browser-bridge` until a release announcement says otherwise.
|
|
81
|
+
|
|
82
|
+
## Quick start
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
pbb doctor
|
|
86
|
+
pbb profile create default
|
|
87
|
+
pbb start --profile default
|
|
88
|
+
pbb open https://example.com
|
|
89
|
+
pbb snapshot
|
|
90
|
+
pbb text h1
|
|
91
|
+
pbb close
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The first start opens a visible browser. Sign in manually when needed. PBB never asks for or stores account passwords; CAPTCHA, 2FA, device confirmation, and reauthentication remain user actions.
|
|
95
|
+
|
|
96
|
+
## Profiles
|
|
97
|
+
|
|
98
|
+
PBB profiles are separate from daily Edge and Chrome profiles:
|
|
99
|
+
|
|
100
|
+
```console
|
|
101
|
+
pbb profile create work
|
|
102
|
+
pbb profile list
|
|
103
|
+
pbb profile path work
|
|
104
|
+
pbb profile delete work
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Deletion requires confirmation (or explicit `--yes`) and only removes directories carrying PBB's own profile marker. PBB never deletes native Edge or Chrome lock files.
|
|
108
|
+
|
|
109
|
+
## CLI
|
|
110
|
+
|
|
111
|
+
| Command | Purpose |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `pbb start --profile NAME` | Start the daemon and persistent browser |
|
|
114
|
+
| `pbb status` | Show process, profile, browser, page, and tabs |
|
|
115
|
+
| `pbb open URL` | Navigate and wait for `domcontentloaded` |
|
|
116
|
+
| `pbb snapshot` | Return a compact DOM snapshot |
|
|
117
|
+
| `pbb click TARGET` | Click a reference, selector, or semantic target |
|
|
118
|
+
| `pbb fill TARGET VALUE` | Fill a field; password values are never returned |
|
|
119
|
+
| `pbb text TARGET` | Read visible element text |
|
|
120
|
+
| `pbb download TARGET` | Wait for a real download event and save the file |
|
|
121
|
+
| `pbb screenshot [PATH]` | Capture a supporting screenshot |
|
|
122
|
+
| `pbb recover` | Clear stale PBB-owned locks |
|
|
123
|
+
| `pbb close` | Close browser and daemon |
|
|
124
|
+
|
|
125
|
+
Every action supports `--json`. Failures use a stable shape:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{"success": false, "error": "element_not_found", "message": "...", "details": {}}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Snapshots and targets
|
|
132
|
+
|
|
133
|
+
`pbb snapshot --json` returns the page title, URL, headings, bounded visible text, and interactive elements. It excludes scripts, styles, hidden elements, cookies, password values, and hidden tokens. Internal selectors remain inside the daemon.
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"success": true,
|
|
138
|
+
"snapshot_id": "s_123abc",
|
|
139
|
+
"elements": [
|
|
140
|
+
{"id": 1, "role": "textbox", "name": "Email", "placeholder": "you@example.com"},
|
|
141
|
+
{"id": 2, "role": "button", "name": "Sign in"}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Use `@1`, `@2`, or the explicit `s_123abc:@2` form. PBB rejects stale references after navigation or when element identity changes. It resolves targets conservatively: snapshot reference, unique selector, exact button/link role, label, placeholder, then exact text. Multiple matches return `ambiguous_target`; PBB never chooses one at random.
|
|
147
|
+
|
|
148
|
+
PowerShell reserves `@` syntax, so quote references there: `pbb click '@2'`. Bash and similar shells accept `pbb click @2`.
|
|
149
|
+
|
|
150
|
+
## Downloads
|
|
151
|
+
|
|
152
|
+
```console
|
|
153
|
+
pbb download "Download PDF"
|
|
154
|
+
pbb download @5 --output ./downloads
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
PBB waits for Playwright's download event and uses `save_as`. A click that does not emit a download returns `download_not_triggered` rather than reporting false success. The default destination is `~/Downloads/PBB`.
|
|
158
|
+
|
|
159
|
+
## Configuration
|
|
160
|
+
|
|
161
|
+
PBB reads `config.toml` from the platform's application config directory. Supported keys are `browser`, `default_profile`, `daemon_host`, `daemon_port`, `download_dir`, `timeout`, `headless`, and `snapshot_max_chars`. v0.1 rejects non-loopback daemon hosts.
|
|
162
|
+
|
|
163
|
+
Environment overrides: `PBB_BROWSER`, `PBB_PROFILE`, `PBB_PORT`, `PBB_DOWNLOAD_DIR`, and `PBB_TIMEOUT`.
|
|
164
|
+
|
|
165
|
+
## Privacy and security
|
|
166
|
+
|
|
167
|
+
PBB runs locally and includes no telemetry. Browser profiles remain on the device. PBB does not upload browsing history, cookies, credentials, or profiles; does not export cookies; and does not access a password manager. Treat the profile directory as sensitive local data. See [SECURITY.md](SECURITY.md).
|
|
168
|
+
|
|
169
|
+
## Agent integration
|
|
170
|
+
|
|
171
|
+
Recommended flow: check status, start if needed, inspect `snapshot --json`, use DOM actions, and only fall back to screenshots or Computer Use when the DOM is insufficient. Full guidance is in [docs/agent-integration.md](docs/agent-integration.md).
|
|
172
|
+
|
|
173
|
+
### Codex integration
|
|
174
|
+
|
|
175
|
+
Copy this prompt into a project instruction:
|
|
176
|
+
|
|
177
|
+
```text
|
|
178
|
+
Always prefer Persistent Browser Bridge for browser automation when it is available.
|
|
179
|
+
|
|
180
|
+
Browser strategy:
|
|
181
|
+
1. Run `pbb status` and start PBB if needed.
|
|
182
|
+
2. Use `pbb snapshot --json` to inspect the current page.
|
|
183
|
+
3. Prefer `pbb click`, `pbb fill`, `pbb text`, and `pbb download`.
|
|
184
|
+
4. Reuse the existing persistent browser profile. Do not launch another browser unless necessary.
|
|
185
|
+
5. Use screenshots or Computer Use only when DOM-based interaction fails.
|
|
186
|
+
6. Never request or store account passwords.
|
|
187
|
+
7. Let the user manually complete authentication, CAPTCHA, 2FA, or device verification.
|
|
188
|
+
8. Continue using the same profile after authentication.
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Python SDK and MCP
|
|
192
|
+
|
|
193
|
+
A stable Python SDK and MCP server are planned for v0.2. The daemon's local HTTP API is an implementation detail in v0.1 and may change. No SDK or MCP support is claimed in this release.
|
|
194
|
+
|
|
195
|
+
## Limitations
|
|
196
|
+
|
|
197
|
+
- Snapshot references are daemon-memory state and do not survive daemon restarts.
|
|
198
|
+
- Shadow DOM, canvas-only controls, cross-origin frames, and highly virtualized UIs may need direct selectors or visual automation.
|
|
199
|
+
- Recovery covers closed pages and stale PBB locks; full crash replay is planned.
|
|
200
|
+
- One daemon controls one profile at a time in v0.1.
|
|
201
|
+
- Benchmarks are not published. PBB is designed to reduce repeated visual context usage, but no token or cost savings are claimed.
|
|
202
|
+
|
|
203
|
+
## Benchmark framework
|
|
204
|
+
|
|
205
|
+
The [benchmarks](benchmarks/README.md) directory defines a future comparison schema. Results are coming soon; no fabricated figures are included.
|
|
206
|
+
|
|
207
|
+
## Roadmap, contributing, and license
|
|
208
|
+
|
|
209
|
+
See [ROADMAP.md](ROADMAP.md), [CONTRIBUTING.md](CONTRIBUTING.md), and the [MIT License](LICENSE).
|
|
210
|
+
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Persistent Browser Bridge
|
|
2
|
+
|
|
3
|
+
> Give AI coding agents a real persistent browser.
|
|
4
|
+
|
|
5
|
+
Persistent Browser Bridge (PBB) is a local browser-control layer built on Playwright. Instead of forcing AI agents to repeatedly inspect screenshots, PBB exposes lightweight DOM-first browser actions while preserving real browser sessions across runs.
|
|
6
|
+
|
|
7
|
+
**Persistent. DOM-first. Local-first. Agent-friendly. Low-context.**
|
|
8
|
+
|
|
9
|
+
PBB is an early v0.1 release for normal, authorized browser automation. It is not a CAPTCHA bypass, anti-detection toolkit, credential collector, or scraping-evasion framework.
|
|
10
|
+
|
|
11
|
+
## Why PBB
|
|
12
|
+
|
|
13
|
+
Visual automation remains valuable when a page cannot be understood through the DOM. For routine forms, links, text, and downloads, a compact DOM snapshot is faster to inspect and less dependent on screen coordinates. A dedicated persistent browser profile also keeps cookies, local storage, IndexedDB, and login state between runs without touching your everyday browser profile.
|
|
14
|
+
|
|
15
|
+
| Feature | Computer Use | PBB |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| Interaction | Visual | DOM-first |
|
|
18
|
+
| Browser state | Depends on environment | Dedicated persistent profile |
|
|
19
|
+
| Login reuse | Environment dependent | Reuses its PBB profile |
|
|
20
|
+
| Element targeting | Vision and coordinates | DOM locators and snapshot references |
|
|
21
|
+
| Downloads | UI dependent | Playwright download events |
|
|
22
|
+
| Agent context | Visual-heavy | Compact DOM snapshot |
|
|
23
|
+
| Recovery | Agent dependent | Basic page and stale-lock recovery |
|
|
24
|
+
| Local-first | Depends | Yes |
|
|
25
|
+
|
|
26
|
+
PBB complements visual browser automation rather than replacing every use case.
|
|
27
|
+
|
|
28
|
+
## Architecture
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
AI agent -> pbb CLI -> localhost daemon -> Playwright
|
|
32
|
+
-> real Edge/Chrome -> dedicated persistent profile -> website
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The daemon binds to `127.0.0.1` by default and owns the Playwright process, active page, snapshot references, and download handling. CLI commands talk only to that local daemon, so a browser is not restarted for each action.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
PBB requires Python 3.11 or newer. Edge is preferred, Chrome is supported, and Playwright Chromium is the fallback.
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
cd persistent-browser-bridge
|
|
43
|
+
python -m pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If no system browser is available, install Playwright Chromium with `python -m playwright install chromium`. The package has not been published to PyPI yet; do not use `pip install persistent-browser-bridge` until a release announcement says otherwise.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```console
|
|
51
|
+
pbb doctor
|
|
52
|
+
pbb profile create default
|
|
53
|
+
pbb start --profile default
|
|
54
|
+
pbb open https://example.com
|
|
55
|
+
pbb snapshot
|
|
56
|
+
pbb text h1
|
|
57
|
+
pbb close
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The first start opens a visible browser. Sign in manually when needed. PBB never asks for or stores account passwords; CAPTCHA, 2FA, device confirmation, and reauthentication remain user actions.
|
|
61
|
+
|
|
62
|
+
## Profiles
|
|
63
|
+
|
|
64
|
+
PBB profiles are separate from daily Edge and Chrome profiles:
|
|
65
|
+
|
|
66
|
+
```console
|
|
67
|
+
pbb profile create work
|
|
68
|
+
pbb profile list
|
|
69
|
+
pbb profile path work
|
|
70
|
+
pbb profile delete work
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Deletion requires confirmation (or explicit `--yes`) and only removes directories carrying PBB's own profile marker. PBB never deletes native Edge or Chrome lock files.
|
|
74
|
+
|
|
75
|
+
## CLI
|
|
76
|
+
|
|
77
|
+
| Command | Purpose |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `pbb start --profile NAME` | Start the daemon and persistent browser |
|
|
80
|
+
| `pbb status` | Show process, profile, browser, page, and tabs |
|
|
81
|
+
| `pbb open URL` | Navigate and wait for `domcontentloaded` |
|
|
82
|
+
| `pbb snapshot` | Return a compact DOM snapshot |
|
|
83
|
+
| `pbb click TARGET` | Click a reference, selector, or semantic target |
|
|
84
|
+
| `pbb fill TARGET VALUE` | Fill a field; password values are never returned |
|
|
85
|
+
| `pbb text TARGET` | Read visible element text |
|
|
86
|
+
| `pbb download TARGET` | Wait for a real download event and save the file |
|
|
87
|
+
| `pbb screenshot [PATH]` | Capture a supporting screenshot |
|
|
88
|
+
| `pbb recover` | Clear stale PBB-owned locks |
|
|
89
|
+
| `pbb close` | Close browser and daemon |
|
|
90
|
+
|
|
91
|
+
Every action supports `--json`. Failures use a stable shape:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{"success": false, "error": "element_not_found", "message": "...", "details": {}}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Snapshots and targets
|
|
98
|
+
|
|
99
|
+
`pbb snapshot --json` returns the page title, URL, headings, bounded visible text, and interactive elements. It excludes scripts, styles, hidden elements, cookies, password values, and hidden tokens. Internal selectors remain inside the daemon.
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"success": true,
|
|
104
|
+
"snapshot_id": "s_123abc",
|
|
105
|
+
"elements": [
|
|
106
|
+
{"id": 1, "role": "textbox", "name": "Email", "placeholder": "you@example.com"},
|
|
107
|
+
{"id": 2, "role": "button", "name": "Sign in"}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use `@1`, `@2`, or the explicit `s_123abc:@2` form. PBB rejects stale references after navigation or when element identity changes. It resolves targets conservatively: snapshot reference, unique selector, exact button/link role, label, placeholder, then exact text. Multiple matches return `ambiguous_target`; PBB never chooses one at random.
|
|
113
|
+
|
|
114
|
+
PowerShell reserves `@` syntax, so quote references there: `pbb click '@2'`. Bash and similar shells accept `pbb click @2`.
|
|
115
|
+
|
|
116
|
+
## Downloads
|
|
117
|
+
|
|
118
|
+
```console
|
|
119
|
+
pbb download "Download PDF"
|
|
120
|
+
pbb download @5 --output ./downloads
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
PBB waits for Playwright's download event and uses `save_as`. A click that does not emit a download returns `download_not_triggered` rather than reporting false success. The default destination is `~/Downloads/PBB`.
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
PBB reads `config.toml` from the platform's application config directory. Supported keys are `browser`, `default_profile`, `daemon_host`, `daemon_port`, `download_dir`, `timeout`, `headless`, and `snapshot_max_chars`. v0.1 rejects non-loopback daemon hosts.
|
|
128
|
+
|
|
129
|
+
Environment overrides: `PBB_BROWSER`, `PBB_PROFILE`, `PBB_PORT`, `PBB_DOWNLOAD_DIR`, and `PBB_TIMEOUT`.
|
|
130
|
+
|
|
131
|
+
## Privacy and security
|
|
132
|
+
|
|
133
|
+
PBB runs locally and includes no telemetry. Browser profiles remain on the device. PBB does not upload browsing history, cookies, credentials, or profiles; does not export cookies; and does not access a password manager. Treat the profile directory as sensitive local data. See [SECURITY.md](SECURITY.md).
|
|
134
|
+
|
|
135
|
+
## Agent integration
|
|
136
|
+
|
|
137
|
+
Recommended flow: check status, start if needed, inspect `snapshot --json`, use DOM actions, and only fall back to screenshots or Computer Use when the DOM is insufficient. Full guidance is in [docs/agent-integration.md](docs/agent-integration.md).
|
|
138
|
+
|
|
139
|
+
### Codex integration
|
|
140
|
+
|
|
141
|
+
Copy this prompt into a project instruction:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
Always prefer Persistent Browser Bridge for browser automation when it is available.
|
|
145
|
+
|
|
146
|
+
Browser strategy:
|
|
147
|
+
1. Run `pbb status` and start PBB if needed.
|
|
148
|
+
2. Use `pbb snapshot --json` to inspect the current page.
|
|
149
|
+
3. Prefer `pbb click`, `pbb fill`, `pbb text`, and `pbb download`.
|
|
150
|
+
4. Reuse the existing persistent browser profile. Do not launch another browser unless necessary.
|
|
151
|
+
5. Use screenshots or Computer Use only when DOM-based interaction fails.
|
|
152
|
+
6. Never request or store account passwords.
|
|
153
|
+
7. Let the user manually complete authentication, CAPTCHA, 2FA, or device verification.
|
|
154
|
+
8. Continue using the same profile after authentication.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Python SDK and MCP
|
|
158
|
+
|
|
159
|
+
A stable Python SDK and MCP server are planned for v0.2. The daemon's local HTTP API is an implementation detail in v0.1 and may change. No SDK or MCP support is claimed in this release.
|
|
160
|
+
|
|
161
|
+
## Limitations
|
|
162
|
+
|
|
163
|
+
- Snapshot references are daemon-memory state and do not survive daemon restarts.
|
|
164
|
+
- Shadow DOM, canvas-only controls, cross-origin frames, and highly virtualized UIs may need direct selectors or visual automation.
|
|
165
|
+
- Recovery covers closed pages and stale PBB locks; full crash replay is planned.
|
|
166
|
+
- One daemon controls one profile at a time in v0.1.
|
|
167
|
+
- Benchmarks are not published. PBB is designed to reduce repeated visual context usage, but no token or cost savings are claimed.
|
|
168
|
+
|
|
169
|
+
## Benchmark framework
|
|
170
|
+
|
|
171
|
+
The [benchmarks](benchmarks/README.md) directory defines a future comparison schema. Results are coming soon; no fabricated figures are included.
|
|
172
|
+
|
|
173
|
+
## Roadmap, contributing, and license
|
|
174
|
+
|
|
175
|
+
See [ROADMAP.md](ROADMAP.md), [CONTRIBUTING.md](CONTRIBUTING.md), and the [MIT License](LICENSE).
|
|
176
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
## v0.1.0
|
|
4
|
+
|
|
5
|
+
Persistent profiles, browser detection, localhost daemon, CLI, compact snapshots, guarded locators, click, fill, text, navigation, downloads, screenshots, JSON output, basic recovery, docs, tests, and release automation.
|
|
6
|
+
|
|
7
|
+
## v0.2.0
|
|
8
|
+
|
|
9
|
+
Stable Python SDK, MCP server, tabs, stronger crash recovery, shadow-DOM and iframe snapshot improvements, and richer smart locators.
|
|
10
|
+
|
|
11
|
+
## v0.3.0
|
|
12
|
+
|
|
13
|
+
Optional Computer Use fallback adapter, visual fallback, browser event stream, and action recorder.
|
|
14
|
+
|
|
15
|
+
## v0.4.0
|
|
16
|
+
|
|
17
|
+
Multi-agent sessions, opt-in authenticated remote mode, session replay, and opt-in telemetry design.
|
|
18
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest released minor version.
|
|
6
|
+
|
|
7
|
+
## Design boundaries
|
|
8
|
+
|
|
9
|
+
PBB binds to loopback only, has no remote mode in v0.1, and includes no telemetry. It does not upload profiles, export cookies, read password managers, bypass CAPTCHA or 2FA, spoof fingerprints, or provide anti-detection behavior. Authentication must be completed by the user.
|
|
10
|
+
|
|
11
|
+
Dedicated PBB profiles contain sensitive browser state. Protect them using normal operating-system account controls. Do not sync or publish these directories. PBB lock recovery only removes `profile.lock`, a file created by PBB; it never removes browser-native lock files.
|
|
12
|
+
|
|
13
|
+
## Reporting a vulnerability
|
|
14
|
+
|
|
15
|
+
Do not open a public issue for a suspected vulnerability. Use GitHub's private security advisory flow for the repository. Include affected version, reproduction steps, impact, and any proposed mitigation. Maintainers should acknowledge a report within seven days.
|
|
16
|
+
|