anybrowser 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.
Files changed (93) hide show
  1. anybrowser-0.1.0/.gitignore +19 -0
  2. anybrowser-0.1.0/LICENSE +202 -0
  3. anybrowser-0.1.0/NOTICE +8 -0
  4. anybrowser-0.1.0/PKG-INFO +245 -0
  5. anybrowser-0.1.0/README.md +185 -0
  6. anybrowser-0.1.0/conformance/anybrowser_conformance/__init__.py +18 -0
  7. anybrowser-0.1.0/conformance/anybrowser_conformance/pages/drag.html +24 -0
  8. anybrowser-0.1.0/conformance/anybrowser_conformance/pages/frames.html +5 -0
  9. anybrowser-0.1.0/conformance/anybrowser_conformance/pages/index.html +39 -0
  10. anybrowser-0.1.0/conformance/anybrowser_conformance/pages/second.html +4 -0
  11. anybrowser-0.1.0/conformance/anybrowser_conformance/plugin.py +365 -0
  12. anybrowser-0.1.0/conformance/anybrowser_conformance/test_contract.py +341 -0
  13. anybrowser-0.1.0/conformance/anybrowser_conformance/test_model.py +120 -0
  14. anybrowser-0.1.0/conformance/anybrowser_conformance/test_transport.py +168 -0
  15. anybrowser-0.1.0/docs/adr/0001-capabilities-over-exceptions.md +78 -0
  16. anybrowser-0.1.0/docs/adr/0002-truthful-outcomes.md +54 -0
  17. anybrowser-0.1.0/docs/adr/0003-narrow-engine-interface.md +57 -0
  18. anybrowser-0.1.0/docs/adr/0004-async-engine-interface.md +46 -0
  19. anybrowser-0.1.0/docs/adr/README.md +15 -0
  20. anybrowser-0.1.0/docs/architecture/README.md +92 -0
  21. anybrowser-0.1.0/docs/architecture/capabilities.md +70 -0
  22. anybrowser-0.1.0/docs/architecture/truthful-outcomes.md +65 -0
  23. anybrowser-0.1.0/docs/guides/chrome-extension.md +103 -0
  24. anybrowser-0.1.0/docs/guides/safari-extension.md +93 -0
  25. anybrowser-0.1.0/docs/guides/writing-a-model-provider.md +48 -0
  26. anybrowser-0.1.0/docs/guides/writing-a-transport.md +63 -0
  27. anybrowser-0.1.0/docs/guides/writing-an-engine.md +133 -0
  28. anybrowser-0.1.0/docs/porting/README.md +23 -0
  29. anybrowser-0.1.0/docs/porting/chrome.md +89 -0
  30. anybrowser-0.1.0/docs/porting/safari.md +87 -0
  31. anybrowser-0.1.0/examples/custom_engine.py +83 -0
  32. anybrowser-0.1.0/examples/quickstart.py +46 -0
  33. anybrowser-0.1.0/pyproject.toml +113 -0
  34. anybrowser-0.1.0/src/anybrowser/__init__.py +64 -0
  35. anybrowser-0.1.0/src/anybrowser/agent/__init__.py +32 -0
  36. anybrowser-0.1.0/src/anybrowser/agent/llm_planner.py +233 -0
  37. anybrowser-0.1.0/src/anybrowser/agent/memory/__init__.py +1 -0
  38. anybrowser-0.1.0/src/anybrowser/agent/planner.py +75 -0
  39. anybrowser-0.1.0/src/anybrowser/agent/runner.py +262 -0
  40. anybrowser-0.1.0/src/anybrowser/agent/tool.py +105 -0
  41. anybrowser-0.1.0/src/anybrowser/agent/tools/__init__.py +27 -0
  42. anybrowser-0.1.0/src/anybrowser/agent/tools/browser.py +234 -0
  43. anybrowser-0.1.0/src/anybrowser/cli/__init__.py +5 -0
  44. anybrowser-0.1.0/src/anybrowser/cli/main.py +256 -0
  45. anybrowser-0.1.0/src/anybrowser/core/__init__.py +62 -0
  46. anybrowser-0.1.0/src/anybrowser/core/engine.py +389 -0
  47. anybrowser-0.1.0/src/anybrowser/core/errors.py +136 -0
  48. anybrowser-0.1.0/src/anybrowser/core/registry.py +111 -0
  49. anybrowser-0.1.0/src/anybrowser/core/sync.py +119 -0
  50. anybrowser-0.1.0/src/anybrowser/core/types.py +241 -0
  51. anybrowser-0.1.0/src/anybrowser/daemon/__init__.py +29 -0
  52. anybrowser-0.1.0/src/anybrowser/daemon/client.py +459 -0
  53. anybrowser-0.1.0/src/anybrowser/daemon/codec.py +253 -0
  54. anybrowser-0.1.0/src/anybrowser/daemon/protocol.py +128 -0
  55. anybrowser-0.1.0/src/anybrowser/daemon/server.py +421 -0
  56. anybrowser-0.1.0/src/anybrowser/daemon/transport.py +130 -0
  57. anybrowser-0.1.0/src/anybrowser/daemon/transports/__init__.py +14 -0
  58. anybrowser-0.1.0/src/anybrowser/daemon/transports/base.py +156 -0
  59. anybrowser-0.1.0/src/anybrowser/daemon/transports/memory.py +128 -0
  60. anybrowser-0.1.0/src/anybrowser/daemon/transports/unix.py +196 -0
  61. anybrowser-0.1.0/src/anybrowser/daemon/transports/websocket.py +145 -0
  62. anybrowser-0.1.0/src/anybrowser/engines/__init__.py +1 -0
  63. anybrowser-0.1.0/src/anybrowser/engines/chrome/__init__.py +30 -0
  64. anybrowser-0.1.0/src/anybrowser/engines/chrome/cdp.py +459 -0
  65. anybrowser-0.1.0/src/anybrowser/engines/chrome/engine.py +1072 -0
  66. anybrowser-0.1.0/src/anybrowser/engines/playwright/__init__.py +5 -0
  67. anybrowser-0.1.0/src/anybrowser/engines/playwright/engine.py +601 -0
  68. anybrowser-0.1.0/src/anybrowser/engines/playwright/script.py +165 -0
  69. anybrowser-0.1.0/src/anybrowser/engines/safari/__init__.py +33 -0
  70. anybrowser-0.1.0/src/anybrowser/engines/safari/bridge.py +210 -0
  71. anybrowser-0.1.0/src/anybrowser/engines/safari/build.py +128 -0
  72. anybrowser-0.1.0/src/anybrowser/engines/safari/channel.py +153 -0
  73. anybrowser-0.1.0/src/anybrowser/engines/safari/engine.py +531 -0
  74. anybrowser-0.1.0/src/anybrowser/engines/safari/mac_engine/AnyBrowserSafariEngine.swift +698 -0
  75. anybrowser-0.1.0/src/anybrowser/engines/safari/mac_engine/Info.plist.in +48 -0
  76. anybrowser-0.1.0/src/anybrowser/models/__init__.py +16 -0
  77. anybrowser-0.1.0/src/anybrowser/models/anthropic.py +347 -0
  78. anybrowser-0.1.0/src/anybrowser/models/openai_compatible.py +347 -0
  79. anybrowser-0.1.0/src/anybrowser/models/provider.py +130 -0
  80. anybrowser-0.1.0/src/anybrowser/perception/__init__.py +20 -0
  81. anybrowser-0.1.0/src/anybrowser/perception/assets.py +45 -0
  82. anybrowser-0.1.0/src/anybrowser/perception/dom.py +90 -0
  83. anybrowser-0.1.0/src/anybrowser/perception/js/collect-elements.js +162 -0
  84. anybrowser-0.1.0/src/anybrowser/perception/js/deep-dom-helpers.js +594 -0
  85. anybrowser-0.1.0/src/anybrowser/perception/js/read.js +155 -0
  86. anybrowser-0.1.0/tests/test_agent_runner.py +251 -0
  87. anybrowser-0.1.0/tests/test_capabilities.py +87 -0
  88. anybrowser-0.1.0/tests/test_daemon_server.py +240 -0
  89. anybrowser-0.1.0/tests/test_model_providers.py +207 -0
  90. anybrowser-0.1.0/tests/test_protocol.py +44 -0
  91. anybrowser-0.1.0/tests/test_registry.py +40 -0
  92. anybrowser-0.1.0/tests/test_transport_probe.py +51 -0
  93. anybrowser-0.1.0/tests/test_types.py +69 -0
@@ -0,0 +1,19 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ .env
6
+ .env.*
7
+ !.env.example
8
+ build/
9
+ dist/
10
+ *.egg-info/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .mypy_cache/
14
+ .coverage
15
+ htmlcov/
16
+ .DS_Store
17
+ *.log
18
+ test-results/
19
+ node_modules/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 AnyBrowser contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ https://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ AnyBrowser
2
+ Copyright 2026 AnyBrowser contributors
3
+
4
+ This product includes software originally developed as part of Relay
5
+ (https://relaythis.com) and released under the Apache License, Version 2.0.
6
+
7
+ Portions of the Chrome engine's DOM perception and the Safari engine's
8
+ accessibility bridge derive from that work.
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.5
2
+ Name: anybrowser
3
+ Version: 0.1.0
4
+ Summary: A pluggable browser-automation and agent runtime. Bring your own browser, transport, or model.
5
+ Project-URL: Homepage, https://github.com/christopher-inegbedion/anybrowser
6
+ Project-URL: Documentation, https://github.com/christopher-inegbedion/anybrowser/tree/main/docs
7
+ Project-URL: Source, https://github.com/christopher-inegbedion/anybrowser
8
+ Project-URL: Issues, https://github.com/christopher-inegbedion/anybrowser/issues
9
+ Project-URL: Changelog, https://github.com/christopher-inegbedion/anybrowser/blob/main/CHANGELOG.md
10
+ Author: AnyBrowser contributors
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Keywords: agent,automation,browser,cdp,chrome,llm,safari
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Provides-Extra: agent
27
+ Requires-Dist: httpx>=0.27; extra == 'agent'
28
+ Requires-Dist: pillow>=10.0; extra == 'agent'
29
+ Provides-Extra: all
30
+ Requires-Dist: httpx>=0.27; extra == 'all'
31
+ Requires-Dist: pillow>=10.0; extra == 'all'
32
+ Requires-Dist: playwright>=1.44; extra == 'all'
33
+ Requires-Dist: rich>=13.0; extra == 'all'
34
+ Requires-Dist: typer>=0.12; extra == 'all'
35
+ Requires-Dist: websockets>=12.0; extra == 'all'
36
+ Provides-Extra: chrome
37
+ Requires-Dist: websockets>=12.0; extra == 'chrome'
38
+ Provides-Extra: cli
39
+ Requires-Dist: rich>=13.0; extra == 'cli'
40
+ Requires-Dist: typer>=0.12; extra == 'cli'
41
+ Provides-Extra: daemon
42
+ Requires-Dist: websockets>=12.0; extra == 'daemon'
43
+ Provides-Extra: dev
44
+ Requires-Dist: httpx>=0.27; extra == 'dev'
45
+ Requires-Dist: mypy>=1.11; extra == 'dev'
46
+ Requires-Dist: pillow>=10.0; extra == 'dev'
47
+ Requires-Dist: playwright>=1.44; extra == 'dev'
48
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
49
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
50
+ Requires-Dist: pytest>=8.0; extra == 'dev'
51
+ Requires-Dist: rich>=13.0; extra == 'dev'
52
+ Requires-Dist: ruff>=0.6; extra == 'dev'
53
+ Requires-Dist: typer>=0.12; extra == 'dev'
54
+ Requires-Dist: websockets>=12.0; extra == 'dev'
55
+ Provides-Extra: playwright
56
+ Requires-Dist: playwright>=1.44; extra == 'playwright'
57
+ Provides-Extra: safari
58
+ Requires-Dist: websockets>=12.0; extra == 'safari'
59
+ Description-Content-Type: text/markdown
60
+
61
+ # AnyBrowser
62
+
63
+ **A browser-automation and agent runtime you can take apart.** Three interfaces —
64
+ the browser, the transport, the model — each with a registry and a conformance
65
+ suite, so "implement your own" is something you can verify rather than hope for.
66
+
67
+ ```python
68
+ from anybrowser import open_engine
69
+
70
+ async with await open_engine("playwright") as engine:
71
+ await engine.navigate("https://example.com")
72
+ page = await engine.snapshot()
73
+ await engine.click(page.elements[0])
74
+ ```
75
+
76
+ Same code against Chrome attached to your own logged-in window, against Safari,
77
+ or against a browser nobody has written a backend for yet.
78
+
79
+ ---
80
+
81
+ ## Why this exists
82
+
83
+ Most browser automation assumes it owns the browser: a fresh profile, a clean
84
+ window, a driver launched with the right flags. That assumption breaks the
85
+ moment the job is to work in the browser a person actually uses — their tabs,
86
+ their sessions, their logins, already open. You cannot ask them to log in again
87
+ inside a throwaway profile, and you cannot attach WebDriver to a window that was
88
+ not started for automation.
89
+
90
+ AnyBrowser assumes it does not own the browser. Every abstraction here comes from
91
+ driving real Chrome and Safari windows in production, and every one of the three
92
+ ideas below is a failure mode that cost someone a week.
93
+
94
+ **Backends differ in kind, not quality.** Safari has no CDP; Apple's Web
95
+ Inspector protocol needs private entitlements. WebDriver cannot adopt your open
96
+ window. So an engine *declares* what it can do and callers route around the
97
+ gaps, instead of discovering them by catching an exception halfway through a
98
+ task. See [capabilities](docs/architecture/capabilities.md).
99
+
100
+ **A no-op is not a success.** The most common way an agent dies is a click that
101
+ hit nothing, reported as "success", read back by the model as progress, and
102
+ repeated forever. Every action returns `changed` alongside `ok`, and the
103
+ conformance suite fails an engine that clicks dead space and calls it a change.
104
+ See [truthful outcomes](docs/architecture/truthful-outcomes.md).
105
+
106
+ **The contract is executable.** `pytest --pyargs anybrowser_conformance --engine
107
+ yours` is the definition of a working backend.
108
+
109
+ ---
110
+
111
+ ## Install
112
+
113
+ ```bash
114
+ pip install anybrowser[playwright] # the reference engine, easiest start
115
+ pip install anybrowser[chrome] # attach to your own Chrome
116
+ pip install anybrowser[all] # everything
117
+ ```
118
+
119
+ Python 3.10+. `import anybrowser` pulls in no browser driver, no HTTP server and
120
+ no LLM SDK — every backend is an extra.
121
+
122
+ The Playwright engine needs its browser binaries once, which pip cannot fetch
123
+ for you:
124
+
125
+ ```bash
126
+ playwright install chromium
127
+ ```
128
+
129
+ Running a contract against something whose extra is missing skips rather than
130
+ fails, and says which extra to install — so `pip install anybrowser[all]` is the
131
+ shortcut if you would rather not think about it.
132
+
133
+ ---
134
+
135
+ ## The three interfaces
136
+
137
+ | You want to | Implement | Registry group | Ships with |
138
+ |---|---|---|---|
139
+ | Drive a different browser | [`BrowserEngine`](src/anybrowser/core/engine.py) | `anybrowser.engines` | `playwright`, `chrome`, `safari` |
140
+ | Change how clients reach the daemon | [`DaemonTransport`](src/anybrowser/daemon/transport.py) | `anybrowser.transports` | `websocket`, `unix`, `memory` |
141
+ | Use a different model | [`ModelProvider`](src/anybrowser/models/provider.py) | `anybrowser.models` | `openai`, `anthropic` |
142
+
143
+ Register with an entry point and yours is selectable by name everywhere:
144
+
145
+ ```toml
146
+ [project.entry-points."anybrowser.engines"]
147
+ firefox = "my_package.engine:FirefoxEngine"
148
+ ```
149
+
150
+ ```bash
151
+ pytest --pyargs anybrowser_conformance --engine firefox # the engine contract
152
+ pytest --pyargs anybrowser_conformance --transport grpc # the transport one
153
+ ```
154
+
155
+ Each flag selects a contract and skips the other. The suite is capability-gated. A backend that honestly declares it cannot drag
156
+ is skipped, not failed. A backend that *claims* it can drag and then doesn't is
157
+ failed — the suite tests truthfulness as hard as it tests function.
158
+
159
+ Full walkthrough: [**Writing an engine**](docs/guides/writing-an-engine.md).
160
+
161
+ ---
162
+
163
+ ## Engine status
164
+
165
+ | Engine | Attaches to your session | Trusted input | Engine contract | Gated by CI |
166
+ |---|---|---|---|---|
167
+ | `chrome` (DevTools) | no — needs the launch flag | yes | **28 passed, 4 skipped** | yes |
168
+ | `chrome` (extension) | **yes** — your own windows | yes | **passes** (local run) | no — needs a browser with the extension loaded |
169
+ | `playwright` | no — own profile | yes | **28 passed, 4 skipped** | yes, the reference engine |
170
+ | `safari` | yes — accessibility + extension | yes | needs a local setup ([guide](docs/guides/safari-extension.md)) | only that it refuses cleanly off-setup |
171
+
172
+ The engine contract is 32 tests. The 4 skips are the capability gate working as
173
+ intended: those tests assert the *error* an engine raises for something it does
174
+ not declare, so they stand down for an engine that declares it. Run the whole
175
+ suite directory and you will see more skips still — the transport and model
176
+ contracts, idle because you passed neither `--transport` nor `--model`.
177
+
178
+ Pointing the engine contract at the `remote` engine grades the whole daemon
179
+ stack — transport, protocol, codec, dispatch — and it scores the same **28
180
+ passed, 4 skipped** over both the memory and websocket transports.
181
+
182
+ The Chrome engine has two pipes behind one interface. `devtools` talks to a
183
+ browser started with `--remote-debugging-port` — standard, and the only mode
184
+ that runs in CI. `extension` relays CDP through a browser extension and is the
185
+ one that matters, because it attaches to the browser you already have open,
186
+ with your tabs and your logins. Same engine either way; the connection reports
187
+ which it is, and the declared `attach_to_user_session` capability is derived
188
+ from that rather than asserted next to it.
189
+
190
+ Both Chrome pipes pass the contract. To drive the browser you already have
191
+ open, see [driving your own Chrome](docs/guides/chrome-extension.md) — note that
192
+ `--load-extension` is silently ignored by Chrome stable, which is a memorable
193
+ afternoon if nobody tells you.
194
+
195
+ Safari is implemented in both halves: a Swift helper for trusted background
196
+ input and occlusion-proof capture, and a Web Extension for the DOM and pointer
197
+ gestures. It needs a local build and a one-time Accessibility grant, so it skips
198
+ rather than fails where that has not been done — see
199
+ [driving Safari](docs/guides/safari-extension.md).
200
+
201
+ ---
202
+
203
+ ## Layout
204
+
205
+ ```
206
+ src/anybrowser/
207
+ core/ interfaces and value types — imports no backend
208
+ engines/ chrome, safari, playwright
209
+ perception/ turning a page into a snapshot, engine-agnostic
210
+ daemon/ protocol, transports, the server that owns an engine
211
+ agent/ planner, tools, executor, memory
212
+ models/ LLM providers
213
+ conformance/ the executable contract
214
+ docs/ architecture, guides, ADRs
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Docs
220
+
221
+ - [Architecture overview](docs/architecture/README.md)
222
+ - [Capabilities](docs/architecture/capabilities.md) — why backends declare instead of raise
223
+ - [Truthful outcomes](docs/architecture/truthful-outcomes.md) — why `changed` exists
224
+ - [Writing an engine](docs/guides/writing-an-engine.md)
225
+ - [Writing a transport](docs/guides/writing-a-transport.md)
226
+ - [Writing a model provider](docs/guides/writing-a-model-provider.md)
227
+ - [Driving your own Chrome](docs/guides/chrome-extension.md)
228
+ - [Driving Safari](docs/guides/safari-extension.md)
229
+ - [ADRs](docs/adr/) — the decisions and what they cost
230
+
231
+ ---
232
+
233
+ ## Contributing
234
+
235
+ Start with [CONTRIBUTING.md](CONTRIBUTING.md). Good first issues are labelled
236
+ [`good first issue`](https://github.com/christopher-inegbedion/anybrowser/labels/good%20first%20issue);
237
+ a new backend is the highest-value contribution there is, and the conformance
238
+ suite means you can tell when it's done.
239
+
240
+ By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
241
+ Security reports go to [SECURITY.md](SECURITY.md), not the issue tracker.
242
+
243
+ ## License
244
+
245
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,185 @@
1
+ # AnyBrowser
2
+
3
+ **A browser-automation and agent runtime you can take apart.** Three interfaces —
4
+ the browser, the transport, the model — each with a registry and a conformance
5
+ suite, so "implement your own" is something you can verify rather than hope for.
6
+
7
+ ```python
8
+ from anybrowser import open_engine
9
+
10
+ async with await open_engine("playwright") as engine:
11
+ await engine.navigate("https://example.com")
12
+ page = await engine.snapshot()
13
+ await engine.click(page.elements[0])
14
+ ```
15
+
16
+ Same code against Chrome attached to your own logged-in window, against Safari,
17
+ or against a browser nobody has written a backend for yet.
18
+
19
+ ---
20
+
21
+ ## Why this exists
22
+
23
+ Most browser automation assumes it owns the browser: a fresh profile, a clean
24
+ window, a driver launched with the right flags. That assumption breaks the
25
+ moment the job is to work in the browser a person actually uses — their tabs,
26
+ their sessions, their logins, already open. You cannot ask them to log in again
27
+ inside a throwaway profile, and you cannot attach WebDriver to a window that was
28
+ not started for automation.
29
+
30
+ AnyBrowser assumes it does not own the browser. Every abstraction here comes from
31
+ driving real Chrome and Safari windows in production, and every one of the three
32
+ ideas below is a failure mode that cost someone a week.
33
+
34
+ **Backends differ in kind, not quality.** Safari has no CDP; Apple's Web
35
+ Inspector protocol needs private entitlements. WebDriver cannot adopt your open
36
+ window. So an engine *declares* what it can do and callers route around the
37
+ gaps, instead of discovering them by catching an exception halfway through a
38
+ task. See [capabilities](docs/architecture/capabilities.md).
39
+
40
+ **A no-op is not a success.** The most common way an agent dies is a click that
41
+ hit nothing, reported as "success", read back by the model as progress, and
42
+ repeated forever. Every action returns `changed` alongside `ok`, and the
43
+ conformance suite fails an engine that clicks dead space and calls it a change.
44
+ See [truthful outcomes](docs/architecture/truthful-outcomes.md).
45
+
46
+ **The contract is executable.** `pytest --pyargs anybrowser_conformance --engine
47
+ yours` is the definition of a working backend.
48
+
49
+ ---
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ pip install anybrowser[playwright] # the reference engine, easiest start
55
+ pip install anybrowser[chrome] # attach to your own Chrome
56
+ pip install anybrowser[all] # everything
57
+ ```
58
+
59
+ Python 3.10+. `import anybrowser` pulls in no browser driver, no HTTP server and
60
+ no LLM SDK — every backend is an extra.
61
+
62
+ The Playwright engine needs its browser binaries once, which pip cannot fetch
63
+ for you:
64
+
65
+ ```bash
66
+ playwright install chromium
67
+ ```
68
+
69
+ Running a contract against something whose extra is missing skips rather than
70
+ fails, and says which extra to install — so `pip install anybrowser[all]` is the
71
+ shortcut if you would rather not think about it.
72
+
73
+ ---
74
+
75
+ ## The three interfaces
76
+
77
+ | You want to | Implement | Registry group | Ships with |
78
+ |---|---|---|---|
79
+ | Drive a different browser | [`BrowserEngine`](src/anybrowser/core/engine.py) | `anybrowser.engines` | `playwright`, `chrome`, `safari` |
80
+ | Change how clients reach the daemon | [`DaemonTransport`](src/anybrowser/daemon/transport.py) | `anybrowser.transports` | `websocket`, `unix`, `memory` |
81
+ | Use a different model | [`ModelProvider`](src/anybrowser/models/provider.py) | `anybrowser.models` | `openai`, `anthropic` |
82
+
83
+ Register with an entry point and yours is selectable by name everywhere:
84
+
85
+ ```toml
86
+ [project.entry-points."anybrowser.engines"]
87
+ firefox = "my_package.engine:FirefoxEngine"
88
+ ```
89
+
90
+ ```bash
91
+ pytest --pyargs anybrowser_conformance --engine firefox # the engine contract
92
+ pytest --pyargs anybrowser_conformance --transport grpc # the transport one
93
+ ```
94
+
95
+ Each flag selects a contract and skips the other. The suite is capability-gated. A backend that honestly declares it cannot drag
96
+ is skipped, not failed. A backend that *claims* it can drag and then doesn't is
97
+ failed — the suite tests truthfulness as hard as it tests function.
98
+
99
+ Full walkthrough: [**Writing an engine**](docs/guides/writing-an-engine.md).
100
+
101
+ ---
102
+
103
+ ## Engine status
104
+
105
+ | Engine | Attaches to your session | Trusted input | Engine contract | Gated by CI |
106
+ |---|---|---|---|---|
107
+ | `chrome` (DevTools) | no — needs the launch flag | yes | **28 passed, 4 skipped** | yes |
108
+ | `chrome` (extension) | **yes** — your own windows | yes | **passes** (local run) | no — needs a browser with the extension loaded |
109
+ | `playwright` | no — own profile | yes | **28 passed, 4 skipped** | yes, the reference engine |
110
+ | `safari` | yes — accessibility + extension | yes | needs a local setup ([guide](docs/guides/safari-extension.md)) | only that it refuses cleanly off-setup |
111
+
112
+ The engine contract is 32 tests. The 4 skips are the capability gate working as
113
+ intended: those tests assert the *error* an engine raises for something it does
114
+ not declare, so they stand down for an engine that declares it. Run the whole
115
+ suite directory and you will see more skips still — the transport and model
116
+ contracts, idle because you passed neither `--transport` nor `--model`.
117
+
118
+ Pointing the engine contract at the `remote` engine grades the whole daemon
119
+ stack — transport, protocol, codec, dispatch — and it scores the same **28
120
+ passed, 4 skipped** over both the memory and websocket transports.
121
+
122
+ The Chrome engine has two pipes behind one interface. `devtools` talks to a
123
+ browser started with `--remote-debugging-port` — standard, and the only mode
124
+ that runs in CI. `extension` relays CDP through a browser extension and is the
125
+ one that matters, because it attaches to the browser you already have open,
126
+ with your tabs and your logins. Same engine either way; the connection reports
127
+ which it is, and the declared `attach_to_user_session` capability is derived
128
+ from that rather than asserted next to it.
129
+
130
+ Both Chrome pipes pass the contract. To drive the browser you already have
131
+ open, see [driving your own Chrome](docs/guides/chrome-extension.md) — note that
132
+ `--load-extension` is silently ignored by Chrome stable, which is a memorable
133
+ afternoon if nobody tells you.
134
+
135
+ Safari is implemented in both halves: a Swift helper for trusted background
136
+ input and occlusion-proof capture, and a Web Extension for the DOM and pointer
137
+ gestures. It needs a local build and a one-time Accessibility grant, so it skips
138
+ rather than fails where that has not been done — see
139
+ [driving Safari](docs/guides/safari-extension.md).
140
+
141
+ ---
142
+
143
+ ## Layout
144
+
145
+ ```
146
+ src/anybrowser/
147
+ core/ interfaces and value types — imports no backend
148
+ engines/ chrome, safari, playwright
149
+ perception/ turning a page into a snapshot, engine-agnostic
150
+ daemon/ protocol, transports, the server that owns an engine
151
+ agent/ planner, tools, executor, memory
152
+ models/ LLM providers
153
+ conformance/ the executable contract
154
+ docs/ architecture, guides, ADRs
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Docs
160
+
161
+ - [Architecture overview](docs/architecture/README.md)
162
+ - [Capabilities](docs/architecture/capabilities.md) — why backends declare instead of raise
163
+ - [Truthful outcomes](docs/architecture/truthful-outcomes.md) — why `changed` exists
164
+ - [Writing an engine](docs/guides/writing-an-engine.md)
165
+ - [Writing a transport](docs/guides/writing-a-transport.md)
166
+ - [Writing a model provider](docs/guides/writing-a-model-provider.md)
167
+ - [Driving your own Chrome](docs/guides/chrome-extension.md)
168
+ - [Driving Safari](docs/guides/safari-extension.md)
169
+ - [ADRs](docs/adr/) — the decisions and what they cost
170
+
171
+ ---
172
+
173
+ ## Contributing
174
+
175
+ Start with [CONTRIBUTING.md](CONTRIBUTING.md). Good first issues are labelled
176
+ [`good first issue`](https://github.com/christopher-inegbedion/anybrowser/labels/good%20first%20issue);
177
+ a new backend is the highest-value contribution there is, and the conformance
178
+ suite means you can tell when it's done.
179
+
180
+ By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
181
+ Security reports go to [SECURITY.md](SECURITY.md), not the issue tracker.
182
+
183
+ ## License
184
+
185
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,18 @@
1
+ """The engine contract, as an executable test suite.
2
+
3
+ Run it against any registered engine::
4
+
5
+ pytest --pyargs anybrowser_conformance --engine chrome
6
+ pytest --pyargs anybrowser_conformance --engine my-firefox -o k=v
7
+
8
+ Every test is gated on the capabilities the engine declares, so a backend that
9
+ honestly reports it cannot drag is not failed for not dragging -- it is failed
10
+ for *claiming* it can and then not doing it. That asymmetry is the point: the
11
+ suite tests truthfulness as much as function.
12
+
13
+ A green run is what the README means by "the agent runs on your browser".
14
+ """
15
+
16
+ __all__ = ["__version__"]
17
+
18
+ __version__ = "0.1.0"