@monoes/monodesign 1.2.17 → 1.2.18
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.
|
@@ -43,12 +43,6 @@ const CDP_PORT_RELEASE_TIMEOUT_MS = process.env.CI ? 15_000 : 5_000;
|
|
|
43
43
|
const CDP_PORT_RELEASE_POLL_MS = 25;
|
|
44
44
|
const PROFILE_CLEANUP_RETRY_MS = 2_000;
|
|
45
45
|
|
|
46
|
-
// Ports we launch headless Chrome on for detection runs. Deliberately away
|
|
47
|
-
// from 9222 (the default `monomind browse` port): we must never attach to a
|
|
48
|
-
// browser we did not launch, because browser.close() issues Browser.close.
|
|
49
|
-
const MONOBROWSE_PORT_MIN = 9520;
|
|
50
|
-
const MONOBROWSE_PORT_RANGE = 380;
|
|
51
|
-
|
|
52
46
|
function serializeEvalArg(arg) {
|
|
53
47
|
const json = JSON.stringify(arg);
|
|
54
48
|
return json === undefined ? 'undefined' : json;
|
|
@@ -186,20 +180,16 @@ async function launchMonobrowseBrowser(options = {}) {
|
|
|
186
180
|
const headless = options.headless ?? true;
|
|
187
181
|
const launchArgs = options.launchArgs || (process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : []);
|
|
188
182
|
|
|
183
|
+
// We must never attach to a browser we did not launch: browser.close()
|
|
184
|
+
// issues Browser.close. Picking a "free" port ourselves cannot guarantee
|
|
185
|
+
// that — the port is only probed, and a concurrent launch (node --test runs
|
|
186
|
+
// files in parallel) can pick the same one before either Chrome binds it.
|
|
187
|
+
// The losing Chrome then listens on [::1] instead and its launcher attaches
|
|
188
|
+
// to the winner's browser, which dies under it ("CDP connection closed")
|
|
189
|
+
// when the winner closes. Port 0 has Chrome take a kernel-assigned port and
|
|
190
|
+
// report it in its own profile dir, so the endpoint is always ours.
|
|
189
191
|
const forcedPort = Number(process.env.MONODESIGN_MONOBROWSE_PORT);
|
|
190
|
-
|
|
191
|
-
if (Number.isInteger(forcedPort) && forcedPort > 0) {
|
|
192
|
-
port = forcedPort;
|
|
193
|
-
} else {
|
|
194
|
-
// Pick a free-looking port; skip ports where a CDP endpoint already
|
|
195
|
-
// listens so we never take over (and later Browser.close) someone
|
|
196
|
-
// else's browser session.
|
|
197
|
-
for (let attempt = 0; attempt < 5 && port === null; attempt++) {
|
|
198
|
-
const candidate = MONOBROWSE_PORT_MIN + Math.floor(Math.random() * MONOBROWSE_PORT_RANGE);
|
|
199
|
-
if (!(await mb.isPortOpen(candidate))) port = candidate;
|
|
200
|
-
}
|
|
201
|
-
if (port === null) throw new Error('Could not find a free CDP port for monobrowse');
|
|
202
|
-
}
|
|
192
|
+
const port = Number.isInteger(forcedPort) && forcedPort > 0 ? forcedPort : 0;
|
|
203
193
|
|
|
204
194
|
// CI runners (observed on the Windows GH Actions runner) are slower to get
|
|
205
195
|
// Chrome's CDP port open than the 10s default — a batch of sequential
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monodesign",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"description": "Frontend design intelligence for AI agents — design tokens, antipattern detection, and the monodesign skill",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"puppeteer": "^25.1.0",
|
|
48
|
-
"@monoes/monobrowse": "1.0.
|
|
48
|
+
"@monoes/monobrowse": "1.0.19"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"prebuild": "node ../../../scripts/build-fs.mjs clean dist tsconfig.tsbuildinfo",
|