@remcp/runtime 0.2.167 → 0.2.169
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.169 — 2026-10-19
|
|
4
|
+
|
|
5
|
+
- Emit redacted, bounded lifecycle events when ReMCP-owned Chrome exits and distinguish clean exit, nonzero exit, OS signal and spawn error.
|
|
6
|
+
- On a missing default loopback CDP endpoint, include a fresh, explicitly non-causal hint only if the managed browser process recently exited. Never auto-launch browser_tabs/browser_snapshot, and never reveal URLs, tab content, Chrome arguments, credentials or profile paths.
|
|
7
|
+
- Add detached subprocess, privacy, TTL and missing-listener regression tests.
|
|
8
|
+
|
|
3
9
|
## 0.2.165 — 2026-10-18
|
|
4
10
|
|
|
5
11
|
**Crash-session recovery without losing browser automation when the local snapshot budget fills.**
|
package/package.json
CHANGED
|
@@ -125,6 +125,9 @@ export const PAGE_FILL_FORM = `function(fields) {
|
|
|
125
125
|
}
|
|
126
126
|
const tag = el.tagName.toLowerCase();
|
|
127
127
|
if (!['input','textarea','select'].includes(tag)) throw new Error('Unsupported form field: ' + field.selector);
|
|
128
|
+
if (tag === 'input' && ['checkbox','radio'].includes(el.type) && typeof field.value !== 'boolean') {
|
|
129
|
+
throw new Error('Checkbox and radio fields require a boolean value: ' + field.selector);
|
|
130
|
+
}
|
|
128
131
|
if (tag === 'select' && !Array.from(el.options).some(option => option.value === String(field.value))) {
|
|
129
132
|
throw new Error('No matching select option: ' + field.selector);
|
|
130
133
|
}
|
|
@@ -8,6 +8,7 @@ import { resolveSafePath } from '../util.mjs';
|
|
|
8
8
|
import { selectSafeBrowserLaunchProfile } from './browser-session-backup.mjs';
|
|
9
9
|
import { shouldRestoreBrowserSession } from './browser-session-directory.mjs';
|
|
10
10
|
import { shareBrowserDiscovery } from './browser-discovery-flight.mjs';
|
|
11
|
+
import { observeBrowserLaunchExit, browserLaunchExitHint } from './browser-launch-lifecycle.mjs';
|
|
11
12
|
import { clamp, commandExists, jsonResult, optionalString, requireEnum, spawnDetached, unavailable } from './common.mjs';
|
|
12
13
|
|
|
13
14
|
|
|
@@ -110,7 +111,13 @@ export async function ensureBrowserEndpoint(endpoint) {
|
|
|
110
111
|
// evidence before a restart, including profiles with only Tabs_* left.
|
|
111
112
|
const selected = selectSafeBrowserLaunchProfile(profile);
|
|
112
113
|
if (selected.isolated) console.warn('ReMCP browser: using an isolated recovery profile; existing session and backups are preserved, and sign-in state is not copied.');
|
|
113
|
-
|
|
114
|
+
const restore = shouldRestoreBrowserSession(selected.profile);
|
|
115
|
+
const startedAt = Date.now();
|
|
116
|
+
spawnDetached(executable, browserAutoLaunchArgs(selected.profile), {
|
|
117
|
+
onExit:value => observeBrowserLaunchExit(value, { startedAt, restore, isolated:selected.isolated }),
|
|
118
|
+
onError:({ code }) => observeBrowserLaunchExit({ error:code || 'UNKNOWN' },
|
|
119
|
+
{ startedAt, restore, isolated:selected.isolated }),
|
|
120
|
+
});
|
|
114
121
|
if (!await waitForBrowserEndpoint(5000)) throw new Error('ReMCP launched a browser but its local CDP endpoint did not become ready');
|
|
115
122
|
return true;
|
|
116
123
|
})().finally(() => { browserLaunchPromise = null; });
|
|
@@ -415,7 +422,7 @@ export async function listBrowserTargets(endpoint, { targetId = null, readOnlySi
|
|
|
415
422
|
if (!/fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|abort|timed out|network error/i.test(message)) throw error;
|
|
416
423
|
const configured = Boolean(endpoint || process.env.REMCP_CDP_URL);
|
|
417
424
|
const label = configured ? 'The configured CDP endpoint' : 'Browser CDP endpoint';
|
|
418
|
-
throw new Error(`${label} is unavailable at ${base.origin}. Read-only browser_tabs and browser_snapshot do not launch a browser. Use ui_snapshot and ui_find for the existing browser window; do not retry this CDP endpoint unchanged. Only browser_navigate(action=new_tab), when explicitly requested, may start a local isolated browser
|
|
425
|
+
throw new Error(`${label} is unavailable at ${base.origin}. Read-only browser_tabs and browser_snapshot do not launch a browser. Use ui_snapshot and ui_find for the existing browser window; do not retry this CDP endpoint unchanged. Only browser_navigate(action=new_tab), when explicitly requested, may start a local isolated browser.${browserLaunchExitHint({ configured })}`);
|
|
419
426
|
}
|
|
420
427
|
// Retain the current bounded concurrent DNS/security checks for up to 1000 tabs.
|
|
421
428
|
return filterBrowserTargets(list, { targetId, validate });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Bounded, content-free telemetry for ReMCP-owned Chrome child lifecycles.
|
|
2
|
+
let recentExit = null;
|
|
3
|
+
const HINT_WINDOW_MS = 60_000;
|
|
4
|
+
|
|
5
|
+
export function classifyBrowserLaunchExit({ code = null, signal = null, error = null } = {}) {
|
|
6
|
+
if (error) return 'spawn_error';
|
|
7
|
+
if (typeof signal === 'string' && /^SIG[A-Z0-9]+$/.test(signal)) return 'signaled';
|
|
8
|
+
if (code === 0) return 'clean_exit';
|
|
9
|
+
if (Number.isInteger(code)) return 'nonzero_exit';
|
|
10
|
+
return 'unknown_exit';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function observeBrowserLaunchExit({ code = null, signal = null, error = null } = {}, {
|
|
14
|
+
startedAt = Date.now(), now = Date.now(), restore = false, isolated = false,
|
|
15
|
+
log = console.warn,
|
|
16
|
+
} = {}) {
|
|
17
|
+
const event = {
|
|
18
|
+
event:'dedicated_browser_exit',
|
|
19
|
+
reason:classifyBrowserLaunchExit({ code, signal, error }),
|
|
20
|
+
exit_code:Number.isInteger(code) ? code : null,
|
|
21
|
+
signal:typeof signal === 'string' && /^SIG[A-Z0-9]+$/.test(signal) ? signal : null,
|
|
22
|
+
elapsed_ms:Math.min(86_400_000, Math.max(0, now - startedAt)),
|
|
23
|
+
restore_requested:Boolean(restore),
|
|
24
|
+
recovery_profile:Boolean(isolated),
|
|
25
|
+
};
|
|
26
|
+
recentExit = { at:now, reason:event.reason };
|
|
27
|
+
log(`ReMCP browser lifecycle: ${JSON.stringify(event)}`);
|
|
28
|
+
return event;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Advisory only: a Chrome launcher can exit without bringing CDP down. Never
|
|
32
|
+
// claim this event caused a later endpoint failure or authorize a relaunch.
|
|
33
|
+
export function browserLaunchExitHint({ now = Date.now(), configured = false } = {}) {
|
|
34
|
+
if (configured || !recentExit || now < recentExit.at || now - recentExit.at > HINT_WINDOW_MS) return '';
|
|
35
|
+
return ` A recently launched ReMCP browser process exited (${recentExit.reason}); the event may be unrelated to CDP availability.`;
|
|
36
|
+
}
|
package/src/extended/common.mjs
CHANGED
|
@@ -238,6 +238,18 @@ export function spawnDetached(file, args = [], options = {}) {
|
|
|
238
238
|
stdio: 'ignore',
|
|
239
239
|
windowsHide: true,
|
|
240
240
|
});
|
|
241
|
+
// Opt-in process lifecycle callbacks for long-lived detached services.
|
|
242
|
+
// Do not forward command arguments or OS error messages into telemetry.
|
|
243
|
+
if (typeof options.onExit === 'function') {
|
|
244
|
+
child.once('exit', (code, signal) => {
|
|
245
|
+
try { options.onExit({ pid: child.pid ?? null, code, signal }); } catch {}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
if (typeof options.onError === 'function') {
|
|
249
|
+
child.once('error', error => {
|
|
250
|
+
try { options.onError({ pid: child.pid ?? null, code: String(error?.code || 'UNKNOWN') }); } catch {}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
241
253
|
child.unref();
|
|
242
254
|
return child.pid;
|
|
243
255
|
}
|