@melra/browser-runtime 0.3.0-alpha.10
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.
- package/LICENSE +202 -0
- package/README.md +44 -0
- package/dist/browser-connection.d.ts +25 -0
- package/dist/browser-connection.d.ts.map +1 -0
- package/dist/browser-connection.js +119 -0
- package/dist/browser-connection.js.map +1 -0
- package/dist/browser-connection.test.d.ts +2 -0
- package/dist/browser-connection.test.d.ts.map +1 -0
- package/dist/browser-connection.test.js +210 -0
- package/dist/browser-connection.test.js.map +1 -0
- package/dist/dialogs.test.d.ts +2 -0
- package/dist/dialogs.test.d.ts.map +1 -0
- package/dist/dialogs.test.js +165 -0
- package/dist/dialogs.test.js.map +1 -0
- package/dist/frames.test.d.ts +2 -0
- package/dist/frames.test.d.ts.map +1 -0
- package/dist/frames.test.js +157 -0
- package/dist/frames.test.js.map +1 -0
- package/dist/history-tabs.test.d.ts +2 -0
- package/dist/history-tabs.test.d.ts.map +1 -0
- package/dist/history-tabs.test.js +171 -0
- package/dist/history-tabs.test.js.map +1 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +939 -0
- package/dist/index.js.map +1 -0
- package/dist/input-fidelity.test.d.ts +2 -0
- package/dist/input-fidelity.test.d.ts.map +1 -0
- package/dist/input-fidelity.test.js +260 -0
- package/dist/input-fidelity.test.js.map +1 -0
- package/dist/network-policy.d.ts +28 -0
- package/dist/network-policy.d.ts.map +1 -0
- package/dist/network-policy.js +121 -0
- package/dist/network-policy.js.map +1 -0
- package/dist/network-policy.test.d.ts +2 -0
- package/dist/network-policy.test.d.ts.map +1 -0
- package/dist/network-policy.test.js +39 -0
- package/dist/network-policy.test.js.map +1 -0
- package/dist/pinning-proxy.d.ts +8 -0
- package/dist/pinning-proxy.d.ts.map +1 -0
- package/dist/pinning-proxy.js +115 -0
- package/dist/pinning-proxy.js.map +1 -0
- package/dist/pinning-proxy.test.d.ts +2 -0
- package/dist/pinning-proxy.test.d.ts.map +1 -0
- package/dist/pinning-proxy.test.js +80 -0
- package/dist/pinning-proxy.test.js.map +1 -0
- package/dist/popups-profile.test.d.ts +2 -0
- package/dist/popups-profile.test.d.ts.map +1 -0
- package/dist/popups-profile.test.js +170 -0
- package/dist/popups-profile.test.js.map +1 -0
- package/dist/see-act.test.d.ts +2 -0
- package/dist/see-act.test.d.ts.map +1 -0
- package/dist/see-act.test.js +152 -0
- package/dist/see-act.test.js.map +1 -0
- package/dist/selector.d.ts +30 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +39 -0
- package/dist/selector.js.map +1 -0
- package/dist/selector.test.d.ts +2 -0
- package/dist/selector.test.d.ts.map +1 -0
- package/dist/selector.test.js +34 -0
- package/dist/selector.test.js.map +1 -0
- package/dist/stable-dom.d.ts +21 -0
- package/dist/stable-dom.d.ts.map +1 -0
- package/dist/stable-dom.js +76 -0
- package/dist/stable-dom.js.map +1 -0
- package/dist/stable-dom.test.d.ts +2 -0
- package/dist/stable-dom.test.d.ts.map +1 -0
- package/dist/stable-dom.test.js +22 -0
- package/dist/stable-dom.test.js.map +1 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://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 [yyyy] [name of copyright owner]
|
|
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
|
+
http://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.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @melra/browser-runtime
|
|
2
|
+
|
|
3
|
+
Playwright-backed browser control for
|
|
4
|
+
[MELRA](https://github.com/XAGI-Lab/melra), with the destination checks that
|
|
5
|
+
make it safe to point at a URL an agent chose.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @melra/browser-runtime
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { BrowserRuntime, assertSafeUrl } from "@melra/browser-runtime";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Nineteen actions: navigate, back, forward, reload, inspect, wait, click, type,
|
|
16
|
+
fill_form, select, press, scroll, screenshot, upload, download, tabs, tab_new,
|
|
17
|
+
tab_switch, and close.
|
|
18
|
+
|
|
19
|
+
## The destination boundary
|
|
20
|
+
|
|
21
|
+
`assertSafeUrl` is the actual control, and it runs on every navigation:
|
|
22
|
+
|
|
23
|
+
- non-`http(s)` protocols are rejected, so `file://` cannot read the disk
|
|
24
|
+
- URLs carrying credentials are rejected
|
|
25
|
+
- DNS is resolved first, then **every** resolved address is checked — so a public
|
|
26
|
+
hostname that resolves to a private address is refused rather than rebound
|
|
27
|
+
- private, loopback, link-local, and cloud-metadata ranges are blocked, IPv4 and
|
|
28
|
+
IPv6, including IPv4-mapped IPv6 forms
|
|
29
|
+
|
|
30
|
+
A domain allowlist narrows this further, but the allowlist is not what makes it
|
|
31
|
+
safe — the address checks are, and they hold even with `allowedDomains: ["*"]`.
|
|
32
|
+
|
|
33
|
+
Downloads and uploads stay inside the workspace root. Screenshots and HAR
|
|
34
|
+
recordings are written where you point them, and are the one place page content
|
|
35
|
+
leaves the browser, so treat them as sensitive artifacts.
|
|
36
|
+
|
|
37
|
+
`unhinged: true` disables every check above except URL syntax. That includes the
|
|
38
|
+
cloud-metadata block, which is the check most likely to matter on a hosted
|
|
39
|
+
machine.
|
|
40
|
+
|
|
41
|
+
Requires Node.js 22 or newer, and a Chromium that Playwright can launch. Full
|
|
42
|
+
documentation: [github.com/XAGI-Lab/melra](https://github.com/XAGI-Lab/melra)
|
|
43
|
+
|
|
44
|
+
Apache-2.0
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Browser, BrowserContext } from "playwright-core";
|
|
2
|
+
export interface BrowserConnectionOptions {
|
|
3
|
+
executablePath?: string;
|
|
4
|
+
headless: boolean;
|
|
5
|
+
cdpEndpoint?: string;
|
|
6
|
+
cdpContextIndex?: number;
|
|
7
|
+
recordHarPath?: string;
|
|
8
|
+
userDataDir?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Loopback proxy every non-local request is routed through, so the address a
|
|
11
|
+
* destination was checked against is the address the socket opens to. From
|
|
12
|
+
* `startPinningProxy`; absent means the browser resolves names itself and the
|
|
13
|
+
* DNS-rebinding window between check and connect stays open.
|
|
14
|
+
*/
|
|
15
|
+
proxyServer?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BrowserConnection {
|
|
18
|
+
browser: Browser;
|
|
19
|
+
context: BrowserContext;
|
|
20
|
+
ownsBrowser: boolean;
|
|
21
|
+
ownsContext: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function detectBrowserExecutable(): Promise<string | undefined>;
|
|
24
|
+
export declare function connectBrowser(options: BrowserConnectionOptions): Promise<BrowserConnection>;
|
|
25
|
+
//# sourceMappingURL=browser-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-connection.d.ts","sourceRoot":"","sources":["../src/browser-connection.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAuB/D,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU3E;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC,CAkF5B"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright 2026 XAGI Labs Private Limited
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { access } from "node:fs/promises";
|
|
5
|
+
import { chromium } from "playwright-core";
|
|
6
|
+
const CHROME_PATHS = {
|
|
7
|
+
darwin: [
|
|
8
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
9
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
10
|
+
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
|
11
|
+
],
|
|
12
|
+
linux: [
|
|
13
|
+
"/usr/bin/google-chrome",
|
|
14
|
+
"/usr/bin/google-chrome-stable",
|
|
15
|
+
"/usr/bin/chromium",
|
|
16
|
+
"/usr/bin/chromium-browser",
|
|
17
|
+
"/usr/bin/microsoft-edge",
|
|
18
|
+
],
|
|
19
|
+
win32: [
|
|
20
|
+
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
|
|
21
|
+
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
|
|
22
|
+
"C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe",
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
export async function detectBrowserExecutable() {
|
|
26
|
+
for (const path of CHROME_PATHS[process.platform] ?? []) {
|
|
27
|
+
try {
|
|
28
|
+
await access(path, constants.X_OK);
|
|
29
|
+
return path;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Continue to the next supported browser location.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
export async function connectBrowser(options) {
|
|
38
|
+
if (options.cdpEndpoint !== undefined) {
|
|
39
|
+
if (options.recordHarPath !== undefined) {
|
|
40
|
+
throw new Error("browser_cdp_cannot_start_har_recording");
|
|
41
|
+
}
|
|
42
|
+
let endpoint;
|
|
43
|
+
try {
|
|
44
|
+
endpoint = new URL(options.cdpEndpoint);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw new Error("browser_cdp_endpoint_invalid");
|
|
48
|
+
}
|
|
49
|
+
if (!["http:", "https:"].includes(endpoint.protocol)) {
|
|
50
|
+
throw new Error("browser_cdp_endpoint_invalid");
|
|
51
|
+
}
|
|
52
|
+
const browser = await chromium.connectOverCDP(endpoint.href);
|
|
53
|
+
const contexts = browser.contexts();
|
|
54
|
+
const index = options.cdpContextIndex ?? contexts.length - 1;
|
|
55
|
+
const context = contexts.at(index);
|
|
56
|
+
if (context === undefined) {
|
|
57
|
+
throw new Error("browser_cdp_context_not_found");
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
browser,
|
|
61
|
+
context,
|
|
62
|
+
ownsBrowser: false,
|
|
63
|
+
ownsContext: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const executablePath = options.executablePath ?? (await detectBrowserExecutable());
|
|
67
|
+
if (executablePath === undefined) {
|
|
68
|
+
throw new Error("browser_not_found: install Chrome, Chromium, or Edge and rerun melra doctor");
|
|
69
|
+
}
|
|
70
|
+
const contextOptions = {
|
|
71
|
+
acceptDownloads: true,
|
|
72
|
+
viewport: { width: 1280, height: 800 },
|
|
73
|
+
serviceWorkers: "block",
|
|
74
|
+
...(options.recordHarPath === undefined
|
|
75
|
+
? {}
|
|
76
|
+
: {
|
|
77
|
+
recordHar: {
|
|
78
|
+
path: options.recordHarPath,
|
|
79
|
+
mode: "full",
|
|
80
|
+
// Bodies are embedded rather than omitted because a recording
|
|
81
|
+
// without them cannot be replayed, which made the recording knob
|
|
82
|
+
// evidence-only. It costs file size, and it means a HAR now holds
|
|
83
|
+
// page content alongside the URLs and headers it always held —
|
|
84
|
+
// treat one as the session itself, not as a log about it.
|
|
85
|
+
content: "embed",
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
const launchOptions = {
|
|
90
|
+
executablePath,
|
|
91
|
+
headless: options.headless,
|
|
92
|
+
...(options.proxyServer === undefined
|
|
93
|
+
? {}
|
|
94
|
+
: { proxy: { server: options.proxyServer } }),
|
|
95
|
+
};
|
|
96
|
+
if (options.userDataDir !== undefined) {
|
|
97
|
+
// A persistent profile is a browser, not a context inside one: Chromium
|
|
98
|
+
// locks the directory, so the only way to keep cookies across runs is to
|
|
99
|
+
// launch against it directly. `context.browser()` is what the rest of the
|
|
100
|
+
// runtime closes, and it is the same process either way.
|
|
101
|
+
const context = await chromium.launchPersistentContext(options.userDataDir, {
|
|
102
|
+
...launchOptions,
|
|
103
|
+
...contextOptions,
|
|
104
|
+
});
|
|
105
|
+
const browser = context.browser();
|
|
106
|
+
if (browser === null)
|
|
107
|
+
throw new Error("browser_persistent_profile_unavailable");
|
|
108
|
+
return { browser, context, ownsBrowser: true, ownsContext: true };
|
|
109
|
+
}
|
|
110
|
+
const browser = await chromium.launch(launchOptions);
|
|
111
|
+
const context = await browser.newContext(contextOptions);
|
|
112
|
+
return {
|
|
113
|
+
browser,
|
|
114
|
+
context,
|
|
115
|
+
ownsBrowser: true,
|
|
116
|
+
ownsContext: true,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=browser-connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-connection.js","sourceRoot":"","sources":["../src/browser-connection.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,O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,GAAG;QACpB,cAAc;QACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KAChD,CAAC;IACF,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACtC,wEAAwE;QACxE,yEAAyE;QACzE,0EAA0E;QAC1E,yDAAyD;QACzD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,WAAW,EAAE;YAC1E,GAAG,aAAa;YAChB,GAAG,cAAc;SAClB,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,OAAO,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAChF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACpE,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IACzD,OAAO;QACL,OAAO;QACP,OAAO;QACP,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-connection.test.d.ts","sourceRoot":"","sources":["../src/browser-connection.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Copyright 2026 XAGI Labs Private Limited
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { createServer } from "node:http";
|
|
4
|
+
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { BrowserOperationSchema } from "@melra/protocol";
|
|
8
|
+
import { chromium } from "playwright-core";
|
|
9
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
10
|
+
import { BrowserRuntime, detectBrowserExecutable } from "./index.js";
|
|
11
|
+
const roots = [];
|
|
12
|
+
const servers = [];
|
|
13
|
+
afterEach(async () => {
|
|
14
|
+
await Promise.all(servers.splice(0).map((server) => new Promise((resolvePromise) => {
|
|
15
|
+
server.close(() => resolvePromise());
|
|
16
|
+
})));
|
|
17
|
+
await Promise.all(roots
|
|
18
|
+
.splice(0)
|
|
19
|
+
.map((root) => rm(root, { recursive: true, force: true })));
|
|
20
|
+
});
|
|
21
|
+
async function fixtureServer() {
|
|
22
|
+
const server = createServer((_request, response) => {
|
|
23
|
+
response.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
24
|
+
response.end("<!doctype html><html><head><title>HAR fixture</title></head>" +
|
|
25
|
+
"<body><main>verified page</main></body></html>");
|
|
26
|
+
});
|
|
27
|
+
servers.push(server);
|
|
28
|
+
await new Promise((resolvePromise) => {
|
|
29
|
+
server.listen(0, "127.0.0.1", resolvePromise);
|
|
30
|
+
});
|
|
31
|
+
const address = server.address();
|
|
32
|
+
if (address === null || typeof address === "string") {
|
|
33
|
+
throw new Error("fixture_server_address_unavailable");
|
|
34
|
+
}
|
|
35
|
+
return { server, url: `http://127.0.0.1:${address.port}` };
|
|
36
|
+
}
|
|
37
|
+
async function reservePort() {
|
|
38
|
+
const server = createServer();
|
|
39
|
+
await new Promise((resolvePromise) => {
|
|
40
|
+
server.listen(0, "127.0.0.1", resolvePromise);
|
|
41
|
+
});
|
|
42
|
+
const address = server.address();
|
|
43
|
+
if (address === null || typeof address === "string") {
|
|
44
|
+
throw new Error("reserved_port_unavailable");
|
|
45
|
+
}
|
|
46
|
+
await new Promise((resolvePromise) => {
|
|
47
|
+
server.close(() => resolvePromise());
|
|
48
|
+
});
|
|
49
|
+
return address.port;
|
|
50
|
+
}
|
|
51
|
+
describe("browser connection evidence", () => {
|
|
52
|
+
it("records and flushes HAR for an owned browser context", async () => {
|
|
53
|
+
const executablePath = await detectBrowserExecutable();
|
|
54
|
+
if (executablePath === undefined)
|
|
55
|
+
return;
|
|
56
|
+
const root = await mkdtemp(join(tmpdir(), "melra-browser-har-"));
|
|
57
|
+
roots.push(root);
|
|
58
|
+
const { url } = await fixtureServer();
|
|
59
|
+
const harPath = join(root, "network.har");
|
|
60
|
+
const runtime = new BrowserRuntime({
|
|
61
|
+
workspaceRoot: root,
|
|
62
|
+
artifactDirectory: join(root, "artifacts"),
|
|
63
|
+
executablePath,
|
|
64
|
+
allowedDomains: ["127.0.0.1"],
|
|
65
|
+
allowLocalhost: true,
|
|
66
|
+
recordHarPath: harPath,
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
await runtime.execute(BrowserOperationSchema.parse({
|
|
70
|
+
kind: "browser",
|
|
71
|
+
action: "navigate",
|
|
72
|
+
url,
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
await runtime.close();
|
|
77
|
+
}
|
|
78
|
+
const har = JSON.parse(await readFile(harPath, "utf8"));
|
|
79
|
+
expect(har.log.entries.some((entry) => entry.request.url.startsWith(url))).toBe(true);
|
|
80
|
+
}, 120_000);
|
|
81
|
+
it("replays a recorded HAR after the origin is gone", async () => {
|
|
82
|
+
const executablePath = await detectBrowserExecutable();
|
|
83
|
+
if (executablePath === undefined)
|
|
84
|
+
return;
|
|
85
|
+
const root = await mkdtemp(join(tmpdir(), "melra-browser-replay-"));
|
|
86
|
+
roots.push(root);
|
|
87
|
+
const { server, url } = await fixtureServer();
|
|
88
|
+
const harPath = join(root, "network.har");
|
|
89
|
+
const options = {
|
|
90
|
+
workspaceRoot: root,
|
|
91
|
+
artifactDirectory: join(root, "artifacts"),
|
|
92
|
+
executablePath,
|
|
93
|
+
allowedDomains: ["127.0.0.1"],
|
|
94
|
+
allowLocalhost: true,
|
|
95
|
+
};
|
|
96
|
+
const recorder = new BrowserRuntime({
|
|
97
|
+
...options,
|
|
98
|
+
recordHarPath: harPath,
|
|
99
|
+
});
|
|
100
|
+
try {
|
|
101
|
+
await recorder.execute(BrowserOperationSchema.parse({ kind: "browser", action: "navigate", url }));
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
await recorder.close();
|
|
105
|
+
}
|
|
106
|
+
// The origin is taken down before replay, so a passing assertion below can
|
|
107
|
+
// only have been served from the archive.
|
|
108
|
+
await new Promise((resolvePromise) => {
|
|
109
|
+
server.close(() => resolvePromise());
|
|
110
|
+
});
|
|
111
|
+
const replayer = new BrowserRuntime({ ...options, replayHarPath: harPath });
|
|
112
|
+
try {
|
|
113
|
+
const observation = await replayer.execute(BrowserOperationSchema.parse({ kind: "browser", action: "navigate", url }));
|
|
114
|
+
expect(observation.text).toContain("verified page");
|
|
115
|
+
await expect(replayer.execute(BrowserOperationSchema.parse({
|
|
116
|
+
kind: "browser",
|
|
117
|
+
action: "navigate",
|
|
118
|
+
url: `${url}/absent`,
|
|
119
|
+
}))).rejects.toThrow();
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
await replayer.close();
|
|
123
|
+
}
|
|
124
|
+
}, 180_000);
|
|
125
|
+
it("refuses to record and replay the same session", async () => {
|
|
126
|
+
const root = await mkdtemp(join(tmpdir(), "melra-browser-conflict-"));
|
|
127
|
+
roots.push(root);
|
|
128
|
+
const runtime = new BrowserRuntime({
|
|
129
|
+
workspaceRoot: root,
|
|
130
|
+
artifactDirectory: join(root, "artifacts"),
|
|
131
|
+
allowedDomains: ["127.0.0.1"],
|
|
132
|
+
allowLocalhost: true,
|
|
133
|
+
recordHarPath: join(root, "network.har"),
|
|
134
|
+
replayHarPath: join(root, "network.har"),
|
|
135
|
+
});
|
|
136
|
+
try {
|
|
137
|
+
await expect(runtime.execute(BrowserOperationSchema.parse({
|
|
138
|
+
kind: "browser",
|
|
139
|
+
action: "navigate",
|
|
140
|
+
url: "http://127.0.0.1:1/",
|
|
141
|
+
}))).rejects.toThrow("browser_har_replay_cannot_record");
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
await runtime.close();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
it("refuses a replay archive it cannot read", async () => {
|
|
148
|
+
const root = await mkdtemp(join(tmpdir(), "melra-browser-missing-"));
|
|
149
|
+
roots.push(root);
|
|
150
|
+
const runtime = new BrowserRuntime({
|
|
151
|
+
workspaceRoot: root,
|
|
152
|
+
artifactDirectory: join(root, "artifacts"),
|
|
153
|
+
allowedDomains: ["127.0.0.1"],
|
|
154
|
+
allowLocalhost: true,
|
|
155
|
+
replayHarPath: join(root, "absent.har"),
|
|
156
|
+
});
|
|
157
|
+
try {
|
|
158
|
+
await expect(runtime.execute(BrowserOperationSchema.parse({
|
|
159
|
+
kind: "browser",
|
|
160
|
+
action: "navigate",
|
|
161
|
+
url: "http://127.0.0.1:1/",
|
|
162
|
+
}))).rejects.toThrow("browser_har_replay_not_readable");
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
await runtime.close();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
it("attaches to the selected CDP context without closing its owner", async () => {
|
|
169
|
+
const executablePath = await detectBrowserExecutable();
|
|
170
|
+
if (executablePath === undefined)
|
|
171
|
+
return;
|
|
172
|
+
const root = await mkdtemp(join(tmpdir(), "melra-browser-cdp-"));
|
|
173
|
+
roots.push(root);
|
|
174
|
+
const port = await reservePort();
|
|
175
|
+
const owner = await chromium.launch({
|
|
176
|
+
executablePath,
|
|
177
|
+
headless: true,
|
|
178
|
+
args: [`--remote-debugging-port=${port}`],
|
|
179
|
+
});
|
|
180
|
+
const context = await owner.newContext();
|
|
181
|
+
const page = await context.newPage();
|
|
182
|
+
await page.setContent("<!doctype html><html><body><main>shared CDP page</main></body></html>");
|
|
183
|
+
const runtime = new BrowserRuntime({
|
|
184
|
+
workspaceRoot: root,
|
|
185
|
+
artifactDirectory: join(root, "artifacts"),
|
|
186
|
+
allowedDomains: [],
|
|
187
|
+
allowLocalhost: false,
|
|
188
|
+
cdpEndpoint: `http://127.0.0.1:${port}`,
|
|
189
|
+
cdpContextIndex: -1,
|
|
190
|
+
});
|
|
191
|
+
try {
|
|
192
|
+
const observation = await runtime.execute(BrowserOperationSchema.parse({
|
|
193
|
+
kind: "browser",
|
|
194
|
+
action: "inspect",
|
|
195
|
+
}));
|
|
196
|
+
expect(observation.text).toContain("shared CDP page");
|
|
197
|
+
await runtime.close();
|
|
198
|
+
expect(owner.isConnected()).toBe(true);
|
|
199
|
+
expect(await page.textContent("main")).toBe("shared CDP page");
|
|
200
|
+
const { url } = await fixtureServer();
|
|
201
|
+
await page.goto(url);
|
|
202
|
+
expect(await page.textContent("main")).toBe("verified page");
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
await runtime.close();
|
|
206
|
+
await owner.close();
|
|
207
|
+
}
|
|
208
|
+
}, 120_000);
|
|
209
|
+
});
|
|
210
|
+
//# sourceMappingURL=browser-connection.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-connection.test.js","sourceRoot":"","sources":["../src/browser-connection.test.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS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