loominum 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.
@@ -0,0 +1,43 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ name: Build sdist + wheel
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.11'
18
+ - name: Install build
19
+ run: python -m pip install --upgrade pip build
20
+ - name: Build
21
+ run: python -m build
22
+ - name: Check artifacts
23
+ run: |
24
+ python -m pip install --upgrade twine
25
+ twine check dist/*
26
+ - uses: actions/upload-artifact@v4
27
+ with:
28
+ name: dist
29
+ path: dist/
30
+
31
+ publish:
32
+ name: Publish to PyPI (Trusted Publisher)
33
+ needs: build
34
+ runs-on: ubuntu-latest
35
+ environment: release
36
+ permissions:
37
+ id-token: write
38
+ steps:
39
+ - uses: actions/download-artifact@v4
40
+ with:
41
+ name: dist
42
+ path: dist/
43
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,24 @@
1
+ # Local-only dev metadata (gitea config, bare-repo notes, etc.)
2
+ .local/
3
+
4
+ # Python build artifacts
5
+ __pycache__/
6
+ *.pyc
7
+ *.pyo
8
+ *.egg-info/
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+
12
+ # Runtime data — keep config.json template tracked, ignore generated state
13
+ data/loominum/*.pem
14
+ data/loominum/*.pem.bak
15
+ data/loominum/pids/
16
+ log/
17
+
18
+ # OAuth + secrets, in case a transport later persists tokens
19
+ .oauth-tokens.json
20
+
21
+ # Misc
22
+ *.bak
23
+ *.swp
24
+ .DS_Store
loominum-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Christopher M. Mapes
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: loominum
3
+ Version: 0.1.0
4
+ Summary: Drive and observe a live browser session from Python, with bidirectional async events.
5
+ Project-URL: Homepage, http://tide.gigaro.ai:3000/gigacity/loominum
6
+ Project-URL: Repository, http://tide.gigaro.ai:3000/gigacity/loominum.git
7
+ Project-URL: Issues, http://tide.gigaro.ai:3000/gigacity/loominum/issues
8
+ Author: Christopher M. Mapes
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: asyncio,browser-automation,browser-control,cdp,chrome-devtools-protocol,remote-javascript,scraping,websocket
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: AsyncIO
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
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 :: Internet :: WWW/HTTP :: Dynamic Content
24
+ Classifier: Topic :: Software Development :: Testing
25
+ Requires-Python: >=3.9
26
+ Requires-Dist: aiohttp>=3.9
27
+ Requires-Dist: websockets>=12
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # loominum
33
+
34
+ A Python library for driving and observing a live browser session from Python
35
+ code, with bidirectional async event flow. Python pushes JavaScript into the
36
+ page; the page emits events back.
37
+
38
+ ## Two transports
39
+
40
+ 1. **JS-injection mode** (working today) — a one-time paste-bootstrap opens a
41
+ WebSocket from the page back to the Python server. Site-agnostic, no Chrome
42
+ flags, but bootstrap is manual and injection dies on navigation unless
43
+ re-pasted.
44
+
45
+ 2. **CDP sidecar mode** (working today, via the `lum-cdp` console script) —
46
+ a Python sidecar speaks Chrome DevTools Protocol to a CDP-enabled browser
47
+ and impersonates a browser to the Loominum server. Gives nav-surviving
48
+ injection (`Page.addScriptToEvaluateOnNewDocument`) and CAPTCHA-safe
49
+ trusted-event dispatch (`Input.dispatchKeyEvent` / `dispatchMouseEvent`).
50
+ Requires the browser launched with `--remote-debugging-port`.
51
+
52
+ Same `lum.exec / on / add_init / navigate` API across both transports.
53
+
54
+ ## Use cases
55
+
56
+ - Authenticated API automation (call APIs in browser context with session cookies)
57
+ - Scrape orchestration with DOM-event triggers
58
+ - Download monitoring (watch DOM for ready-links, hand off filenames to Python)
59
+ - Form automation
60
+ - Interactive Python-REPL → browser debugging
61
+
62
+ ## Status
63
+
64
+ - `src/loominum/` — JS-injection implementation. Site-agnostic API surface;
65
+ ships with localhost defaults in `data/loominum/config.json` (port 7773,
66
+ TLS off).
67
+ - `src/loominum/README.md` — the API documentation (server/client/browser).
68
+ - `src/loominum/EVENTS.md` — event-system documentation.
69
+ - `src/loominum/NGINX.md` — deployment notes for fronting the server with
70
+ nginx (TLS termination, path-based routing).
71
+ - CDP sidecar — implemented in `src/loominum/cdp.py`; run via the
72
+ `lum-cdp` console script. Bridge logic covered by an automated fake-CDP
73
+ test harness in `tests/test_cdp.py`.
74
+
75
+ ## Layout
76
+
77
+ ```
78
+ loominum/
79
+ ├── README.md this file
80
+ ├── HANDOFF.md design doc for the next agent picking this up
81
+ ├── src/loominum/ library source (JS-injection base + CDP sidecar)
82
+ │ ├── __init__.py
83
+ │ ├── server.py WS server — handles both the /remote browser and /client python endpoints
84
+ │ ├── client.py Python client
85
+ │ ├── config.py config schema + discovery (discover_config, LumConf.auto)
86
+ │ ├── cdp.py CDP sidecar transport (lum-cdp)
87
+ │ ├── htdocs/ served static files: remote.js (the bootstrap),
88
+ │ │ evtcap.js (console tap helper), install-cert scripts
89
+ │ ├── scripts/ cert install helpers
90
+ │ ├── README.md API reference
91
+ │ ├── EVENTS.md event system
92
+ │ └── NGINX.md nginx deployment notes
93
+ ├── data/loominum/
94
+ │ └── config.json template — localhost defaults, no TLS
95
+ └── tests/
96
+ ├── test_cdp.py CDP bridge tests (fake-CDP harness)
97
+ ├── test_config.py config discovery + env-override tests
98
+ └── test_lum.py manual live-server smoke script
99
+ ```
100
+
101
+ ## Installation
102
+
103
+ ```bash
104
+ pip install loominum
105
+ ```
106
+
107
+ Installs the `lum` (server) and `lum-cdp` (CDP sidecar) console scripts.
108
+
109
+ ## Configuration
110
+
111
+ Loominum runs with localhost defaults and **no config file required**. To
112
+ customize, drop a `config.json` in any conventional location or override
113
+ single settings via environment variables — full precedence rules in
114
+ [`src/loominum/README.md`](src/loominum/README.md#config-discovery).
115
+
116
+ ```json
117
+ {
118
+ "verbose": false,
119
+ "log_file": "log/lum.log",
120
+ "server_url": "http://127.0.0.1:7773",
121
+ "client_url": "http://127.0.0.1:7773",
122
+ "cert_sans": null
123
+ }
124
+ ```
125
+
126
+ Quick paths:
127
+
128
+ - A file: `./loominum.json`, `~/.config/loominum/config.json`, or
129
+ `$LOOMINUM_CONFIG=/full/path.json`. (`PRJ_DIR` is still honored for
130
+ back-compat but no longer required.)
131
+ - A single setting: `LOOMINUM_SERVER_URL`, `LOOMINUM_CLIENT_URL`,
132
+ `LOOMINUM_LOG_FILE`, `LOOMINUM_CERT_SANS`, `LOOMINUM_VERBOSE`.
133
+
134
+ For TLS: set `cert_sans` to a comma-separated list of hostnames/IPs to
135
+ include in the cert SANs (e.g. `"localhost,192.168.1.100"`) and use an
136
+ `https://` scheme on `server_url`. Cert install helpers under
137
+ `src/loominum/scripts/`.
138
+
139
+ ## Quick start (current JS-injection mode)
140
+
141
+ ```bash
142
+ lum # or, from a source checkout: PYTHONPATH=src python -m loominum.server
143
+ ```
144
+
145
+ Then in the browser DevTools console of the target page:
146
+
147
+ ```javascript
148
+ fetch('http://127.0.0.1:7773/remote.js?t='+Date.now()).then(r=>r.text()).then(eval);
149
+ ```
150
+
151
+ Then from Python:
152
+
153
+ ```python
154
+ import asyncio
155
+ from loominum import LumClient
156
+
157
+ async def main():
158
+ async with LumClient() as client:
159
+ title = await client.exec('document.title')
160
+ print(title)
161
+
162
+ asyncio.run(main())
163
+ ```
164
+
165
+ See `src/loominum/README.md` for the full API.
166
+
167
+ ## Quick start (CDP sidecar mode)
168
+
169
+ Launch a Chromium-based browser with remote debugging enabled:
170
+
171
+ ```bash
172
+ chromium --remote-debugging-port=9222
173
+ ```
174
+
175
+ Then start the server and the sidecar (it discovers the target tab,
176
+ auto-injects the page bridge, and impersonates a browser to the server):
177
+
178
+ ```bash
179
+ lum & # start the server (installed console script)
180
+ lum-cdp --target-url example.com
181
+ ```
182
+
183
+ From Python, the API is identical to JS-injection mode:
184
+
185
+ ```python
186
+ import asyncio
187
+ from loominum import LumClient
188
+
189
+ async def main():
190
+ async with LumClient() as client:
191
+ print(await client.exec('document.title'))
192
+
193
+ asyncio.run(main())
194
+ ```
195
+
196
+ The CDP transport survives page navigations (init code re-runs on every new
197
+ document) and can dispatch trusted input via `CDPTransport.dispatch_key`,
198
+ `type_text`, and `click`.
199
+
200
+ ## Testing
201
+
202
+ ```bash
203
+ pytest tests/test_cdp.py
204
+ ```
205
+
206
+ Covers the bridge with a fake CDP browser (no real Chrome required). A real-
207
+ browser scenario auto-runs when `localhost:9222` is reachable and otherwise
208
+ skips.
209
+
210
+ ## License
211
+
212
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,181 @@
1
+ # loominum
2
+
3
+ A Python library for driving and observing a live browser session from Python
4
+ code, with bidirectional async event flow. Python pushes JavaScript into the
5
+ page; the page emits events back.
6
+
7
+ ## Two transports
8
+
9
+ 1. **JS-injection mode** (working today) — a one-time paste-bootstrap opens a
10
+ WebSocket from the page back to the Python server. Site-agnostic, no Chrome
11
+ flags, but bootstrap is manual and injection dies on navigation unless
12
+ re-pasted.
13
+
14
+ 2. **CDP sidecar mode** (working today, via the `lum-cdp` console script) —
15
+ a Python sidecar speaks Chrome DevTools Protocol to a CDP-enabled browser
16
+ and impersonates a browser to the Loominum server. Gives nav-surviving
17
+ injection (`Page.addScriptToEvaluateOnNewDocument`) and CAPTCHA-safe
18
+ trusted-event dispatch (`Input.dispatchKeyEvent` / `dispatchMouseEvent`).
19
+ Requires the browser launched with `--remote-debugging-port`.
20
+
21
+ Same `lum.exec / on / add_init / navigate` API across both transports.
22
+
23
+ ## Use cases
24
+
25
+ - Authenticated API automation (call APIs in browser context with session cookies)
26
+ - Scrape orchestration with DOM-event triggers
27
+ - Download monitoring (watch DOM for ready-links, hand off filenames to Python)
28
+ - Form automation
29
+ - Interactive Python-REPL → browser debugging
30
+
31
+ ## Status
32
+
33
+ - `src/loominum/` — JS-injection implementation. Site-agnostic API surface;
34
+ ships with localhost defaults in `data/loominum/config.json` (port 7773,
35
+ TLS off).
36
+ - `src/loominum/README.md` — the API documentation (server/client/browser).
37
+ - `src/loominum/EVENTS.md` — event-system documentation.
38
+ - `src/loominum/NGINX.md` — deployment notes for fronting the server with
39
+ nginx (TLS termination, path-based routing).
40
+ - CDP sidecar — implemented in `src/loominum/cdp.py`; run via the
41
+ `lum-cdp` console script. Bridge logic covered by an automated fake-CDP
42
+ test harness in `tests/test_cdp.py`.
43
+
44
+ ## Layout
45
+
46
+ ```
47
+ loominum/
48
+ ├── README.md this file
49
+ ├── HANDOFF.md design doc for the next agent picking this up
50
+ ├── src/loominum/ library source (JS-injection base + CDP sidecar)
51
+ │ ├── __init__.py
52
+ │ ├── server.py WS server — handles both the /remote browser and /client python endpoints
53
+ │ ├── client.py Python client
54
+ │ ├── config.py config schema + discovery (discover_config, LumConf.auto)
55
+ │ ├── cdp.py CDP sidecar transport (lum-cdp)
56
+ │ ├── htdocs/ served static files: remote.js (the bootstrap),
57
+ │ │ evtcap.js (console tap helper), install-cert scripts
58
+ │ ├── scripts/ cert install helpers
59
+ │ ├── README.md API reference
60
+ │ ├── EVENTS.md event system
61
+ │ └── NGINX.md nginx deployment notes
62
+ ├── data/loominum/
63
+ │ └── config.json template — localhost defaults, no TLS
64
+ └── tests/
65
+ ├── test_cdp.py CDP bridge tests (fake-CDP harness)
66
+ ├── test_config.py config discovery + env-override tests
67
+ └── test_lum.py manual live-server smoke script
68
+ ```
69
+
70
+ ## Installation
71
+
72
+ ```bash
73
+ pip install loominum
74
+ ```
75
+
76
+ Installs the `lum` (server) and `lum-cdp` (CDP sidecar) console scripts.
77
+
78
+ ## Configuration
79
+
80
+ Loominum runs with localhost defaults and **no config file required**. To
81
+ customize, drop a `config.json` in any conventional location or override
82
+ single settings via environment variables — full precedence rules in
83
+ [`src/loominum/README.md`](src/loominum/README.md#config-discovery).
84
+
85
+ ```json
86
+ {
87
+ "verbose": false,
88
+ "log_file": "log/lum.log",
89
+ "server_url": "http://127.0.0.1:7773",
90
+ "client_url": "http://127.0.0.1:7773",
91
+ "cert_sans": null
92
+ }
93
+ ```
94
+
95
+ Quick paths:
96
+
97
+ - A file: `./loominum.json`, `~/.config/loominum/config.json`, or
98
+ `$LOOMINUM_CONFIG=/full/path.json`. (`PRJ_DIR` is still honored for
99
+ back-compat but no longer required.)
100
+ - A single setting: `LOOMINUM_SERVER_URL`, `LOOMINUM_CLIENT_URL`,
101
+ `LOOMINUM_LOG_FILE`, `LOOMINUM_CERT_SANS`, `LOOMINUM_VERBOSE`.
102
+
103
+ For TLS: set `cert_sans` to a comma-separated list of hostnames/IPs to
104
+ include in the cert SANs (e.g. `"localhost,192.168.1.100"`) and use an
105
+ `https://` scheme on `server_url`. Cert install helpers under
106
+ `src/loominum/scripts/`.
107
+
108
+ ## Quick start (current JS-injection mode)
109
+
110
+ ```bash
111
+ lum # or, from a source checkout: PYTHONPATH=src python -m loominum.server
112
+ ```
113
+
114
+ Then in the browser DevTools console of the target page:
115
+
116
+ ```javascript
117
+ fetch('http://127.0.0.1:7773/remote.js?t='+Date.now()).then(r=>r.text()).then(eval);
118
+ ```
119
+
120
+ Then from Python:
121
+
122
+ ```python
123
+ import asyncio
124
+ from loominum import LumClient
125
+
126
+ async def main():
127
+ async with LumClient() as client:
128
+ title = await client.exec('document.title')
129
+ print(title)
130
+
131
+ asyncio.run(main())
132
+ ```
133
+
134
+ See `src/loominum/README.md` for the full API.
135
+
136
+ ## Quick start (CDP sidecar mode)
137
+
138
+ Launch a Chromium-based browser with remote debugging enabled:
139
+
140
+ ```bash
141
+ chromium --remote-debugging-port=9222
142
+ ```
143
+
144
+ Then start the server and the sidecar (it discovers the target tab,
145
+ auto-injects the page bridge, and impersonates a browser to the server):
146
+
147
+ ```bash
148
+ lum & # start the server (installed console script)
149
+ lum-cdp --target-url example.com
150
+ ```
151
+
152
+ From Python, the API is identical to JS-injection mode:
153
+
154
+ ```python
155
+ import asyncio
156
+ from loominum import LumClient
157
+
158
+ async def main():
159
+ async with LumClient() as client:
160
+ print(await client.exec('document.title'))
161
+
162
+ asyncio.run(main())
163
+ ```
164
+
165
+ The CDP transport survives page navigations (init code re-runs on every new
166
+ document) and can dispatch trusted input via `CDPTransport.dispatch_key`,
167
+ `type_text`, and `click`.
168
+
169
+ ## Testing
170
+
171
+ ```bash
172
+ pytest tests/test_cdp.py
173
+ ```
174
+
175
+ Covers the bridge with a fake CDP browser (no real Chrome required). A real-
176
+ browser scenario auto-runs when `localhost:9222` is reachable and otherwise
177
+ skips.
178
+
179
+ ## License
180
+
181
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,7 @@
1
+ {
2
+ "verbose": false,
3
+ "log_file": "log/lum.log",
4
+ "server_url": "http://127.0.0.1:7773",
5
+ "client_url": "http://127.0.0.1:7773",
6
+ "cert_sans": null
7
+ }