@remcp/runtime 0.2.194 → 0.2.195
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/package.json
CHANGED
|
@@ -84,12 +84,23 @@ export function browserAutoLaunchArgs(profile, {
|
|
|
84
84
|
return args;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
// macOS Chrome may take longer than 5 seconds to expose loopback CDP after
|
|
88
|
+
// a cold launch with a separate profile (measured on real Apple Silicon).
|
|
89
|
+
// Keep Linux/Windows fast-path unchanged; never auto-launch for read-only calls.
|
|
90
|
+
export function browserStartupReadyTimeoutMs(platform = process.platform) {
|
|
91
|
+
return platform === 'darwin' ? 12000 : 5000;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function waitForBrowserEndpoint(timeoutMs = 5000, {
|
|
95
|
+
available = browserCapabilityAvailable,
|
|
96
|
+
now = Date.now,
|
|
97
|
+
pause = ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
98
|
+
} = {}) {
|
|
99
|
+
const deadline = now() + timeoutMs;
|
|
89
100
|
do {
|
|
90
|
-
if (await
|
|
91
|
-
await
|
|
92
|
-
} while (
|
|
101
|
+
if (await available(undefined, 250)) return true;
|
|
102
|
+
await pause(100);
|
|
103
|
+
} while (now() < deadline);
|
|
93
104
|
return false;
|
|
94
105
|
}
|
|
95
106
|
|
|
@@ -114,7 +125,7 @@ export async function ensureBrowserEndpoint(endpoint) {
|
|
|
114
125
|
onError:({ code }) => observeBrowserLaunchExit({ error:code || 'UNKNOWN' },
|
|
115
126
|
{ startedAt, restore, isolated:selected.isolated }),
|
|
116
127
|
});
|
|
117
|
-
if (!await waitForBrowserEndpoint(
|
|
128
|
+
if (!await waitForBrowserEndpoint(browserStartupReadyTimeoutMs())) throw new Error('ReMCP launched a browser but its local CDP endpoint did not become ready');
|
|
118
129
|
return true;
|
|
119
130
|
})().finally(() => { browserLaunchPromise = null; });
|
|
120
131
|
}
|