@ricsam/browser-mcp 0.3.21 → 0.3.23
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/README.md +2 -2
- package/dist/{chunk-pj7a03s7.js → chunk-fvjengps.js} +396 -35
- package/dist/main.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Native Chrome companion. Requires Node >=22.14.0 and an installed
|
|
4
4
|
Google Chrome. No browser download or startup occurs during npm installation.
|
|
5
5
|
|
|
6
|
-
Release 0.3.
|
|
6
|
+
Release 0.3.23 uses one cross-platform Node package with matching server/chart 0.3.23, native protocol 3 and no database schema change. The runtime is unchanged from 0.3.22 apart from its version; the server's live view no longer shows the "You're in control" card. Passkey prompt detection, which refuses agent input on a tab with an open prompt (`passkey_prompt_open`), reports the prompt and cancels it with `browser_handle_dialog`, and back, forward and reload for the user who controls a tab with `--live-view` (0.3.22) remain. Takeover from the dashboard or an MCP App with `user_in_control` refusals and tab results without internal session identifiers (0.3.21), screenshots returned as soon as Chrome captures them with `pageState` timing (0.3.20), upload and secret-export capabilities in tool text with up-front transfer grant limits (0.3.19), private download routing (0.3.18), background screenshots and capture-only download retry remain. Verified readiness is still required before retrieving bytes. Keep administrative sign-ins outside automated profiles unless deliberately delegated: internal pages, local files and the Browser MCP dashboard are no longer blanket-blocked, subject to Chrome's interface limits. Older runtimes require an update for new capabilities. Stop the old CLI before upgrading, then restart the same named profile to preserve sign-ins and pairing; never replay uncertain actions automatically.
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npm install -g @ricsam/browser-mcp@0.3.
|
|
9
|
+
npm install -g @ricsam/browser-mcp@0.3.23
|
|
10
10
|
browser-mcp browser start --server https://browser-mcp.click --profile work
|
|
11
11
|
browser-mcp browser status --profile work
|
|
12
12
|
browser-mcp browser pause --profile work
|
|
@@ -54,7 +54,7 @@ function onceAsync(action) {
|
|
|
54
54
|
// cli/src/browser/owned-chrome.ts
|
|
55
55
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
56
56
|
// cli/package.json
|
|
57
|
-
var version = "0.3.
|
|
57
|
+
var version = "0.3.23";
|
|
58
58
|
|
|
59
59
|
// cli/src/browser/chrome-diagnostics.ts
|
|
60
60
|
import { constants } from "node:fs";
|
|
@@ -2866,7 +2866,85 @@ function observeNavigation(page, input) {
|
|
|
2866
2866
|
return { result, dispose: () => finish(false, "navigation_observation_cancelled", "Navigation observation ended.") };
|
|
2867
2867
|
}
|
|
2868
2868
|
|
|
2869
|
+
// cli/src/browser/passkey-guard.ts
|
|
2870
|
+
var MAX_PASSKEY_REQUESTS = 16;
|
|
2871
|
+
function passkeyGuardSource(binding, cancelEvent) {
|
|
2872
|
+
const name = JSON.stringify(binding), cancel = JSON.stringify(cancelEvent);
|
|
2873
|
+
return `(() => {
|
|
2874
|
+
const report = globalThis[${name}];
|
|
2875
|
+
try { delete globalThis[${name}]; } catch {}
|
|
2876
|
+
const C = globalThis.CredentialsContainer;
|
|
2877
|
+
if (typeof report !== "function" || !C || !C.prototype || typeof AbortController !== "function") return;
|
|
2878
|
+
const send = (message) => { try { report(JSON.stringify(message)); } catch {} };
|
|
2879
|
+
const pending = new Map();
|
|
2880
|
+
let seq = 0;
|
|
2881
|
+
addEventListener(${cancel}, () => {
|
|
2882
|
+
for (const controller of pending.values()) controller.abort(new DOMException("The passkey prompt was cancelled.", "AbortError"));
|
|
2883
|
+
});
|
|
2884
|
+
for (const name of ["get", "create"]) {
|
|
2885
|
+
const descriptor = Object.getOwnPropertyDescriptor(C.prototype, name);
|
|
2886
|
+
const original = descriptor && descriptor.value;
|
|
2887
|
+
if (typeof original !== "function") continue;
|
|
2888
|
+
const wrapped = { [name](options) {
|
|
2889
|
+
if (!options || typeof options !== "object" || !options.publicKey || options.mediation === "conditional") return original.apply(this, arguments);
|
|
2890
|
+
const id = ++seq, controller = new AbortController();
|
|
2891
|
+
let request;
|
|
2892
|
+
try {
|
|
2893
|
+
let signal = controller.signal;
|
|
2894
|
+
const own = options.signal;
|
|
2895
|
+
if (own && typeof AbortSignal.any === "function") signal = AbortSignal.any([own, controller.signal]);
|
|
2896
|
+
else if (own) {
|
|
2897
|
+
if (own.aborted) controller.abort(own.reason);
|
|
2898
|
+
else own.addEventListener("abort", () => controller.abort(own.reason), { once: true });
|
|
2899
|
+
}
|
|
2900
|
+
// The page's own options, with the combined signal in place of theirs: members on their
|
|
2901
|
+
// prototype chain included, and their getters still run on them. A signal property
|
|
2902
|
+
// the page made non-configurable cannot be replaced that way; it is shadowed instead.
|
|
2903
|
+
const fixed = Object.getOwnPropertyDescriptor(options, "signal");
|
|
2904
|
+
request = fixed && !fixed.configurable
|
|
2905
|
+
? Object.create(options, { signal: { value: signal, enumerable: true } })
|
|
2906
|
+
: new Proxy(options, { get: (target, key) => (key === "signal" ? signal : Reflect.get(target, key, target)) });
|
|
2907
|
+
} catch {
|
|
2908
|
+
// Not an AbortSignal: Chrome rejects the request itself, as without this script.
|
|
2909
|
+
return original.apply(this, arguments);
|
|
2910
|
+
}
|
|
2911
|
+
const result = original.call(this, request);
|
|
2912
|
+
pending.set(id, controller);
|
|
2913
|
+
send({ state: "open", id, request: name });
|
|
2914
|
+
const done = () => { if (pending.delete(id)) send({ state: "closed", id }); };
|
|
2915
|
+
Promise.resolve(result).then(done, done);
|
|
2916
|
+
return result;
|
|
2917
|
+
} }[name];
|
|
2918
|
+
try { Object.defineProperty(wrapped, "length", { value: original.length }); } catch {}
|
|
2919
|
+
Object.defineProperty(C.prototype, name, Object.assign({}, descriptor, { value: wrapped }));
|
|
2920
|
+
}
|
|
2921
|
+
})();`;
|
|
2922
|
+
}
|
|
2923
|
+
function parsePasskeyReport(payload) {
|
|
2924
|
+
let value;
|
|
2925
|
+
try {
|
|
2926
|
+
value = JSON.parse(payload);
|
|
2927
|
+
} catch {
|
|
2928
|
+
return null;
|
|
2929
|
+
}
|
|
2930
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
2931
|
+
return null;
|
|
2932
|
+
const v = value;
|
|
2933
|
+
if (typeof v.id !== "number" || !Number.isSafeInteger(v.id) || v.id < 1)
|
|
2934
|
+
return null;
|
|
2935
|
+
if (v.state === "closed")
|
|
2936
|
+
return { state: "closed", id: v.id };
|
|
2937
|
+
if (v.state === "open" && (v.request === "get" || v.request === "create"))
|
|
2938
|
+
return { state: "open", id: v.id, request: v.request };
|
|
2939
|
+
return null;
|
|
2940
|
+
}
|
|
2941
|
+
var PASSKEY_PROMPT_RECOVERY = `Chrome is showing a passkey prompt for this tab. Chrome draws it outside the page, so screenshots and live view don't show it, and it ignores mouse, keyboard and scroll input to the tab until the prompt is completed or cancelled. Only the user can complete it, at the computer that runs this browser (Touch ID or Windows Hello, a security key, or a phone that scans its QR code); Chrome shows it there only while this tab is the active tab of its window (browser_present {mode: "focus"} makes it so). Hand the tab to the user with browser_takeover so they can complete or cancel it, or cancel it with browser_handle_dialog {dialogId, decision: "dismiss"} when choosing another sign-in method is within the user's authorized task. Reloading or navigating the tab also cancels it.`;
|
|
2942
|
+
|
|
2869
2943
|
// cli/src/browser/browser-events.ts
|
|
2944
|
+
var PASSKEY_ANNOUNCE_MS = 300;
|
|
2945
|
+
var PASSKEY_CANCEL_MS = 2000;
|
|
2946
|
+
var PASSKEY_FLUSH_MS = 250;
|
|
2947
|
+
var PASSKEY_WORLD = "__browser_mcp_passkey__";
|
|
2870
2948
|
var CAPACITY = 200;
|
|
2871
2949
|
var RETENTION_MS = 10 * 60000;
|
|
2872
2950
|
var MAX_INFLIGHT = 500;
|
|
@@ -2891,6 +2969,7 @@ function diagnosticText(text) {
|
|
|
2891
2969
|
|
|
2892
2970
|
class BrowserPageEvents {
|
|
2893
2971
|
page;
|
|
2972
|
+
passkeyDetection;
|
|
2894
2973
|
sequence = 0;
|
|
2895
2974
|
entries = [];
|
|
2896
2975
|
listeners = new Set;
|
|
@@ -2904,6 +2983,10 @@ class BrowserPageEvents {
|
|
|
2904
2983
|
assets = new Map;
|
|
2905
2984
|
dialog;
|
|
2906
2985
|
dialogOrigin;
|
|
2986
|
+
passkey;
|
|
2987
|
+
contextFrames = new Map;
|
|
2988
|
+
passkeyBinding = `__bmcpPasskey${crypto.randomUUID().replaceAll("-", "")}`;
|
|
2989
|
+
passkeyCancel = `bmcp-passkey-cancel-${crypto.randomUUID()}`;
|
|
2907
2990
|
cdp;
|
|
2908
2991
|
crashListeners = new Set;
|
|
2909
2992
|
crashed = false;
|
|
@@ -2912,8 +2995,9 @@ class BrowserPageEvents {
|
|
|
2912
2995
|
currentAction;
|
|
2913
2996
|
recentAction;
|
|
2914
2997
|
document = 0;
|
|
2915
|
-
constructor(page) {
|
|
2998
|
+
constructor(page, passkeyDetection = true) {
|
|
2916
2999
|
this.page = page;
|
|
3000
|
+
this.passkeyDetection = passkeyDetection;
|
|
2917
3001
|
this.ready = page.context().newCDPSession(page).then((cdp) => {
|
|
2918
3002
|
this.cdp = cdp;
|
|
2919
3003
|
cdp.on("close", () => {
|
|
@@ -2928,8 +3012,10 @@ class BrowserPageEvents {
|
|
|
2928
3012
|
this.dialog.event.origin = this.dialogOrigin;
|
|
2929
3013
|
});
|
|
2930
3014
|
cdp.on("Page.frameNavigated", ({ frame }) => {
|
|
2931
|
-
if (
|
|
2932
|
-
|
|
3015
|
+
if (frame.parentId)
|
|
3016
|
+
return;
|
|
3017
|
+
this.dropPreviousDocumentRequests();
|
|
3018
|
+
this.closePasskey("navigated");
|
|
2933
3019
|
});
|
|
2934
3020
|
cdp.on("Page.javascriptDialogClosed", (event) => {
|
|
2935
3021
|
this.dialogOrigin = undefined;
|
|
@@ -2949,6 +3035,8 @@ class BrowserPageEvents {
|
|
|
2949
3035
|
cdp.send("Page.enable").catch(() => {
|
|
2950
3036
|
return;
|
|
2951
3037
|
});
|
|
3038
|
+
if (this.passkeyDetection)
|
|
3039
|
+
this.watchPasskeys(cdp);
|
|
2952
3040
|
}).catch(() => {
|
|
2953
3041
|
return;
|
|
2954
3042
|
});
|
|
@@ -3025,16 +3113,187 @@ class BrowserPageEvents {
|
|
|
3025
3113
|
this.downloads.clear();
|
|
3026
3114
|
this.inflight.clear();
|
|
3027
3115
|
this.dialog = undefined;
|
|
3116
|
+
this.closePasskey("closed");
|
|
3117
|
+
this.contextFrames.clear();
|
|
3028
3118
|
this.dialogListeners.clear();
|
|
3029
3119
|
});
|
|
3030
3120
|
}
|
|
3121
|
+
watchPasskeys(cdp) {
|
|
3122
|
+
cdp.on("Runtime.executionContextCreated", ({ context }) => {
|
|
3123
|
+
const aux = context.auxData;
|
|
3124
|
+
if (aux?.isDefault !== true || typeof aux.frameId !== "string")
|
|
3125
|
+
return;
|
|
3126
|
+
this.contextFrames.set(context.id, aux.frameId);
|
|
3127
|
+
if (this.contextFrames.size > 500)
|
|
3128
|
+
this.contextFrames.delete(this.contextFrames.keys().next().value);
|
|
3129
|
+
});
|
|
3130
|
+
cdp.on("Runtime.executionContextDestroyed", ({ executionContextId }) => {
|
|
3131
|
+
this.contextFrames.delete(executionContextId);
|
|
3132
|
+
const current = this.passkey;
|
|
3133
|
+
if (!current)
|
|
3134
|
+
return;
|
|
3135
|
+
for (const key2 of [...current.requests.keys()])
|
|
3136
|
+
if (key2.startsWith(`${executionContextId}:`))
|
|
3137
|
+
current.requests.delete(key2);
|
|
3138
|
+
if (!current.requests.size)
|
|
3139
|
+
this.closePasskey("settled");
|
|
3140
|
+
});
|
|
3141
|
+
cdp.on("Runtime.executionContextsCleared", () => {
|
|
3142
|
+
this.contextFrames.clear();
|
|
3143
|
+
this.closePasskey("navigated");
|
|
3144
|
+
});
|
|
3145
|
+
cdp.on("Runtime.bindingCalled", ({ name, payload, executionContextId }) => {
|
|
3146
|
+
if (name === this.passkeyBinding)
|
|
3147
|
+
this.passkeyReport(executionContextId, payload);
|
|
3148
|
+
});
|
|
3149
|
+
cdp.send("Runtime.enable").catch(() => {
|
|
3150
|
+
return;
|
|
3151
|
+
});
|
|
3152
|
+
cdp.send("Runtime.addBinding", { name: this.passkeyBinding }).catch(() => {
|
|
3153
|
+
return;
|
|
3154
|
+
});
|
|
3155
|
+
cdp.send("Page.addScriptToEvaluateOnNewDocument", { source: passkeyGuardSource(this.passkeyBinding, this.passkeyCancel), runImmediately: true }).catch(() => {
|
|
3156
|
+
return;
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
passkeyReport(contextId, payload) {
|
|
3160
|
+
const report = parsePasskeyReport(payload);
|
|
3161
|
+
if (!report)
|
|
3162
|
+
return;
|
|
3163
|
+
const key2 = `${contextId}:${report.id}`;
|
|
3164
|
+
if (report.state === "closed") {
|
|
3165
|
+
const current2 = this.passkey;
|
|
3166
|
+
if (current2?.requests.delete(key2) && !current2.requests.size)
|
|
3167
|
+
this.closePasskey(current2.cancelledBy ? "cancelled" : "settled");
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
let current = this.passkey;
|
|
3171
|
+
if (!current) {
|
|
3172
|
+
const origin = this.origin(this.page.url());
|
|
3173
|
+
const event = this.record("dialog", { type: "passkey", request: report.request, origin, state: "open" });
|
|
3174
|
+
const opened = { event, request: report.request, origin, requests: new Map, announced: false };
|
|
3175
|
+
opened.timer = setTimeout(() => {
|
|
3176
|
+
if (this.passkey !== opened)
|
|
3177
|
+
return;
|
|
3178
|
+
opened.announced = true;
|
|
3179
|
+
this.dialogChanged();
|
|
3180
|
+
}, PASSKEY_ANNOUNCE_MS);
|
|
3181
|
+
current = this.passkey = opened;
|
|
3182
|
+
}
|
|
3183
|
+
if (current.requests.size < MAX_PASSKEY_REQUESTS)
|
|
3184
|
+
current.requests.set(key2, report.request);
|
|
3185
|
+
}
|
|
3186
|
+
closePasskey(reason) {
|
|
3187
|
+
const current = this.passkey;
|
|
3188
|
+
if (!current)
|
|
3189
|
+
return;
|
|
3190
|
+
this.passkey = undefined;
|
|
3191
|
+
clearTimeout(current.timer);
|
|
3192
|
+
current.event.state = reason === "cancelled" ? "dismissed" : "closed";
|
|
3193
|
+
if (current.cancelledBy)
|
|
3194
|
+
current.event.handledBy = current.cancelledBy;
|
|
3195
|
+
if (reason !== "closed")
|
|
3196
|
+
this.record("dialog", {
|
|
3197
|
+
dialogId: current.event.eventId,
|
|
3198
|
+
type: "passkey",
|
|
3199
|
+
state: current.event.state,
|
|
3200
|
+
reason,
|
|
3201
|
+
...current.cancelledBy ? { handledBy: current.cancelledBy } : {}
|
|
3202
|
+
});
|
|
3203
|
+
if (current.announced)
|
|
3204
|
+
this.dialogChanged();
|
|
3205
|
+
}
|
|
3206
|
+
passkeyPrompt() {
|
|
3207
|
+
const current = this.passkey;
|
|
3208
|
+
return current ? { dialogId: current.event.eventId, type: "passkey", request: current.request, origin: current.origin, state: "open", openedAt: current.event.timestamp } : null;
|
|
3209
|
+
}
|
|
3210
|
+
async settledPasskeyPrompt(afterInput = false) {
|
|
3211
|
+
if (afterInput)
|
|
3212
|
+
await this.flushPasskeyReports();
|
|
3213
|
+
const current = this.passkey;
|
|
3214
|
+
if (current && !current.announced) {
|
|
3215
|
+
const remaining = PASSKEY_ANNOUNCE_MS - (Date.now() - Date.parse(current.event.timestamp));
|
|
3216
|
+
if (remaining > 0)
|
|
3217
|
+
await this.passkeyClosed(current, remaining + 10);
|
|
3218
|
+
}
|
|
3219
|
+
return this.passkeyPrompt();
|
|
3220
|
+
}
|
|
3221
|
+
async flushPasskeyReports() {
|
|
3222
|
+
const cdp = this.cdp;
|
|
3223
|
+
if (!cdp || !this.passkeyDetection || this.dialog || this.crashed)
|
|
3224
|
+
return;
|
|
3225
|
+
let timer2;
|
|
3226
|
+
await Promise.race([
|
|
3227
|
+
cdp.send("Runtime.evaluate", { expression: "0", silent: true }).catch(() => {
|
|
3228
|
+
return;
|
|
3229
|
+
}),
|
|
3230
|
+
new Promise((resolve2) => {
|
|
3231
|
+
timer2 = setTimeout(resolve2, PASSKEY_FLUSH_MS);
|
|
3232
|
+
})
|
|
3233
|
+
]);
|
|
3234
|
+
clearTimeout(timer2);
|
|
3235
|
+
}
|
|
3236
|
+
async cancelPasskey(handledBy) {
|
|
3237
|
+
const current = this.passkey, cdp = this.cdp;
|
|
3238
|
+
if (!current || !cdp)
|
|
3239
|
+
return !current;
|
|
3240
|
+
if (this.crashed) {
|
|
3241
|
+
this.closePasskey("crashed");
|
|
3242
|
+
return true;
|
|
3243
|
+
}
|
|
3244
|
+
current.cancelledBy = handledBy;
|
|
3245
|
+
const frames = new Set;
|
|
3246
|
+
for (const key2 of current.requests.keys()) {
|
|
3247
|
+
const frameId = this.contextFrames.get(Number(key2.slice(0, key2.indexOf(":"))));
|
|
3248
|
+
if (frameId)
|
|
3249
|
+
frames.add(frameId);
|
|
3250
|
+
}
|
|
3251
|
+
const expression = `dispatchEvent(new Event(${JSON.stringify(this.passkeyCancel)}))`;
|
|
3252
|
+
let timer2;
|
|
3253
|
+
await Promise.race([
|
|
3254
|
+
Promise.all([...frames].map(async (frameId) => {
|
|
3255
|
+
try {
|
|
3256
|
+
const world = await cdp.send("Page.createIsolatedWorld", { frameId, worldName: PASSKEY_WORLD });
|
|
3257
|
+
await cdp.send("Runtime.evaluate", { contextId: world.executionContextId, expression });
|
|
3258
|
+
} catch {}
|
|
3259
|
+
})),
|
|
3260
|
+
new Promise((resolve2) => {
|
|
3261
|
+
timer2 = setTimeout(resolve2, PASSKEY_CANCEL_MS);
|
|
3262
|
+
})
|
|
3263
|
+
]);
|
|
3264
|
+
clearTimeout(timer2);
|
|
3265
|
+
const closed = await this.passkeyClosed(current, PASSKEY_CANCEL_MS);
|
|
3266
|
+
if (!closed && this.passkey === current)
|
|
3267
|
+
current.cancelledBy = undefined;
|
|
3268
|
+
return closed;
|
|
3269
|
+
}
|
|
3270
|
+
passkeyClosed(current, ms) {
|
|
3271
|
+
if (this.passkey !== current)
|
|
3272
|
+
return Promise.resolve(true);
|
|
3273
|
+
return new Promise((resolve2) => {
|
|
3274
|
+
const finish = () => {
|
|
3275
|
+
clearTimeout(timer2);
|
|
3276
|
+
this.changes.delete(changed);
|
|
3277
|
+
resolve2(this.passkey !== current);
|
|
3278
|
+
};
|
|
3279
|
+
const changed = () => {
|
|
3280
|
+
if (this.passkey !== current)
|
|
3281
|
+
finish();
|
|
3282
|
+
};
|
|
3283
|
+
const timer2 = setTimeout(finish, ms);
|
|
3284
|
+
this.changes.add(changed);
|
|
3285
|
+
});
|
|
3286
|
+
}
|
|
3031
3287
|
onDialog(listener) {
|
|
3032
3288
|
this.dialogListeners.add(listener);
|
|
3033
3289
|
return () => this.dialogListeners.delete(listener);
|
|
3034
3290
|
}
|
|
3035
3291
|
dialogDetails() {
|
|
3036
3292
|
const value = this.dialog?.value;
|
|
3037
|
-
|
|
3293
|
+
if (value)
|
|
3294
|
+
return { type: value.type(), message: value.message(), defaultValue: value.defaultValue() };
|
|
3295
|
+
const passkey = this.passkey;
|
|
3296
|
+
return passkey?.announced ? { type: "passkey", message: "", defaultValue: "", request: passkey.request, origin: passkey.origin } : null;
|
|
3038
3297
|
}
|
|
3039
3298
|
dialogChanged() {
|
|
3040
3299
|
const details = this.dialogDetails();
|
|
@@ -3085,9 +3344,11 @@ class BrowserPageEvents {
|
|
|
3085
3344
|
}
|
|
3086
3345
|
setCrashed(crashed) {
|
|
3087
3346
|
this.crashed = crashed;
|
|
3088
|
-
if (crashed)
|
|
3089
|
-
|
|
3090
|
-
|
|
3347
|
+
if (!crashed)
|
|
3348
|
+
return;
|
|
3349
|
+
for (const listener of [...this.crashListeners])
|
|
3350
|
+
listener();
|
|
3351
|
+
this.closePasskey("crashed");
|
|
3091
3352
|
}
|
|
3092
3353
|
onCrash(listener) {
|
|
3093
3354
|
this.crashListeners.add(listener);
|
|
@@ -3197,6 +3458,27 @@ class BrowserPageEvents {
|
|
|
3197
3458
|
return this.pending ? { actionId: this.pending.actionId, status: "pending" } : null;
|
|
3198
3459
|
}
|
|
3199
3460
|
async handleDialog(input, handledBy = "agent") {
|
|
3461
|
+
const passkey = this.passkey;
|
|
3462
|
+
if (passkey && input.dialogId === passkey.event.eventId) {
|
|
3463
|
+
if (input.decision !== "dismiss" || input.promptText !== undefined)
|
|
3464
|
+
return { handled: false, code: "passkey_requires_user", passkeyPrompt: this.passkeyPrompt(), recovery: PASSKEY_PROMPT_RECOVERY };
|
|
3465
|
+
if (this.dialog)
|
|
3466
|
+
return {
|
|
3467
|
+
handled: false,
|
|
3468
|
+
code: "dialog_blocking",
|
|
3469
|
+
dialog: this.activeDialog(),
|
|
3470
|
+
passkeyPrompt: this.passkeyPrompt(),
|
|
3471
|
+
recovery: "The page also shows a JavaScript dialog. Handle that dialog first, then cancel the passkey prompt."
|
|
3472
|
+
};
|
|
3473
|
+
if (await this.cancelPasskey(handledBy))
|
|
3474
|
+
return { handled: true, dialogId: input.dialogId, decision: "dismiss", type: "passkey" };
|
|
3475
|
+
return {
|
|
3476
|
+
handled: false,
|
|
3477
|
+
code: "passkey_cancel_unconfirmed",
|
|
3478
|
+
passkeyPrompt: this.passkeyPrompt(),
|
|
3479
|
+
recovery: 'The passkey prompt did not close. Reload the tab with browser_history {direction: "reload"} to end it, or hand the tab to the user with browser_takeover.'
|
|
3480
|
+
};
|
|
3481
|
+
}
|
|
3200
3482
|
const current = this.dialog;
|
|
3201
3483
|
if (!current || current.event.eventId !== input.dialogId)
|
|
3202
3484
|
return { handled: false, code: "stale_dialog", dialog: this.activeDialog() };
|
|
@@ -3794,13 +4076,14 @@ class BrowserTabState {
|
|
|
3794
4076
|
// cli/src/browser/page-state.ts
|
|
3795
4077
|
var READY_STATES = new Set(["loading", "interactive", "complete"]);
|
|
3796
4078
|
var VISIBILITY_STATES = new Set(["visible", "hidden", "prerender"]);
|
|
3797
|
-
function pageState(capturedAt, network, lastAction, document2) {
|
|
4079
|
+
function pageState(capturedAt, network, lastAction, document2, passkeyPrompt) {
|
|
3798
4080
|
return {
|
|
3799
4081
|
capturedAt: new Date(capturedAt).toISOString(),
|
|
3800
4082
|
...typeof document2?.readyState === "string" && READY_STATES.has(document2.readyState) ? { readyState: document2.readyState } : {},
|
|
3801
4083
|
...typeof document2?.visibilityState === "string" && VISIBILITY_STATES.has(document2.visibilityState) ? { visibilityState: document2.visibilityState } : {},
|
|
3802
4084
|
...network,
|
|
3803
|
-
lastAction: lastAction ? { operation: lastAction.operation, endedAt: new Date(lastAction.endedAt).toISOString(), msBeforeCapture: Math.max(0, capturedAt - lastAction.endedAt) } : null
|
|
4085
|
+
lastAction: lastAction ? { operation: lastAction.operation, endedAt: new Date(lastAction.endedAt).toISOString(), msBeforeCapture: Math.max(0, capturedAt - lastAction.endedAt) } : null,
|
|
4086
|
+
...passkeyPrompt ? { passkeyPrompt: { dialogId: passkeyPrompt.dialogId, request: passkeyPrompt.request, openedAt: passkeyPrompt.openedAt } } : {}
|
|
3804
4087
|
};
|
|
3805
4088
|
}
|
|
3806
4089
|
var PAGE_EFFECT_OPERATIONS = new Set([
|
|
@@ -3991,6 +4274,18 @@ var MAX_RUN_JS_ARTIFACT_COUNT = 32;
|
|
|
3991
4274
|
var REF_ACTION_TIMEOUT_MS = 5000;
|
|
3992
4275
|
var NAVIGATION_TIMEOUT_MS = 20000;
|
|
3993
4276
|
var READ_PAGE_TIMEOUT_MS = 1e4;
|
|
4277
|
+
var PASSKEY_BLOCKED_OPERATIONS = new Set([
|
|
4278
|
+
"mouse_click",
|
|
4279
|
+
"move_mouse",
|
|
4280
|
+
"hover",
|
|
4281
|
+
"drag",
|
|
4282
|
+
"scroll",
|
|
4283
|
+
"keyboard",
|
|
4284
|
+
"keyboard_type",
|
|
4285
|
+
"form_input",
|
|
4286
|
+
"select_text",
|
|
4287
|
+
"edit_text"
|
|
4288
|
+
]);
|
|
3994
4289
|
var SCREENSHOT_TIMEOUT_MS = 15000;
|
|
3995
4290
|
var SCREENSHOT_FONT_WAIT_MS = 1000;
|
|
3996
4291
|
var MAX_FULL_PAGE_HEIGHT = 4000;
|
|
@@ -4035,6 +4330,7 @@ class BrowserRuntime {
|
|
|
4035
4330
|
downloadsPath;
|
|
4036
4331
|
downloadHandler;
|
|
4037
4332
|
guardPage;
|
|
4333
|
+
passkeyDetection;
|
|
4038
4334
|
screenshots = new Map;
|
|
4039
4335
|
ids = new WeakMap;
|
|
4040
4336
|
pages = new Map;
|
|
@@ -4049,11 +4345,12 @@ class BrowserRuntime {
|
|
|
4049
4345
|
lastActions = new Map;
|
|
4050
4346
|
tabPresentation = new WeakMap;
|
|
4051
4347
|
savingDownloads = new Set;
|
|
4052
|
-
constructor(context, downloadsPath, uploadsPath = `${downloadsPath}.uploads`, downloadHandler, guardPage) {
|
|
4348
|
+
constructor(context, downloadsPath, uploadsPath = `${downloadsPath}.uploads`, downloadHandler, guardPage, passkeyDetection = true) {
|
|
4053
4349
|
this.context = context;
|
|
4054
4350
|
this.downloadsPath = downloadsPath;
|
|
4055
4351
|
this.downloadHandler = downloadHandler;
|
|
4056
4352
|
this.guardPage = guardPage;
|
|
4353
|
+
this.passkeyDetection = passkeyDetection;
|
|
4057
4354
|
this.uploads = new BrowserUploadStore(uploadsPath, (target2) => {
|
|
4058
4355
|
target2.dispose().catch(() => {
|
|
4059
4356
|
return;
|
|
@@ -4072,7 +4369,7 @@ class BrowserRuntime {
|
|
|
4072
4369
|
const id = crypto.randomUUID();
|
|
4073
4370
|
this.ids.set(page, id);
|
|
4074
4371
|
this.pages.set(id, page);
|
|
4075
|
-
this.events.set(page, new BrowserPageEvents(page));
|
|
4372
|
+
this.events.set(page, new BrowserPageEvents(page, this.passkeyDetection));
|
|
4076
4373
|
page.on("framenavigated", () => {
|
|
4077
4374
|
const tabId = this.ids.get(page);
|
|
4078
4375
|
if (tabId)
|
|
@@ -4333,8 +4630,8 @@ class BrowserRuntime {
|
|
|
4333
4630
|
this.lastActions.set(tabId, { operation, endedAt: Date.now() });
|
|
4334
4631
|
}
|
|
4335
4632
|
observedAt(page, tabId, capturedAt = Date.now()) {
|
|
4336
|
-
const
|
|
4337
|
-
return (document2) => pageState(capturedAt, network, lastAction, document2);
|
|
4633
|
+
const events = this.events.get(page), network = events.networkState(capturedAt), lastAction = this.lastActions.get(tabId), prompt = events.passkeyPrompt();
|
|
4634
|
+
return (document2) => pageState(capturedAt, network, lastAction, document2, prompt);
|
|
4338
4635
|
}
|
|
4339
4636
|
async observationSession(page, read) {
|
|
4340
4637
|
const events = this.events.get(page);
|
|
@@ -4409,6 +4706,14 @@ class BrowserRuntime {
|
|
|
4409
4706
|
dialog: events.activeDialog(),
|
|
4410
4707
|
recovery: "Handle this dialog explicitly within the user's authorized task."
|
|
4411
4708
|
};
|
|
4709
|
+
const passkeyPrompt = events?.passkeyPrompt();
|
|
4710
|
+
if (passkeyPrompt && PASSKEY_BLOCKED_OPERATIONS.has(action))
|
|
4711
|
+
return {
|
|
4712
|
+
tabId: input.tabId,
|
|
4713
|
+
dispatch: { status: "not_dispatched", code: "passkey_prompt_open" },
|
|
4714
|
+
passkeyPrompt,
|
|
4715
|
+
recovery: PASSKEY_PROMPT_RECOVERY
|
|
4716
|
+
};
|
|
4412
4717
|
const observation = parseObservation(input.observe);
|
|
4413
4718
|
const previous = this.observations.get(String(input.tabId));
|
|
4414
4719
|
const previousTabs = new Set(this.pages.keys());
|
|
@@ -4433,6 +4738,9 @@ class BrowserRuntime {
|
|
|
4433
4738
|
recordAction();
|
|
4434
4739
|
throw error;
|
|
4435
4740
|
}
|
|
4741
|
+
const promptAfter = action !== "events" && page && !page.isClosed() ? await events?.settledPasskeyPrompt(PASSKEY_BLOCKED_OPERATIONS.has(action)) : undefined;
|
|
4742
|
+
if (promptAfter && result && typeof result === "object" && !("passkeyPrompt" in result))
|
|
4743
|
+
result = { ...result, passkeyPrompt: promptAfter, passkeyRecovery: PASSKEY_PROMPT_RECOVERY };
|
|
4436
4744
|
const notDispatched = result.invoked === false || result.dispatched === false || result.selected === false || result.handled === false;
|
|
4437
4745
|
if (!notDispatched && result.dispatch?.status !== "not_dispatched")
|
|
4438
4746
|
recordAction();
|
|
@@ -4653,6 +4961,7 @@ class BrowserRuntime {
|
|
|
4653
4961
|
tabId,
|
|
4654
4962
|
...await this.events.get(page).waitQuery(input),
|
|
4655
4963
|
dialog: this.events.get(page).activeDialog(),
|
|
4964
|
+
passkeyPrompt: this.events.get(page).passkeyPrompt(),
|
|
4656
4965
|
pendingAction: this.events.get(page).pendingAction()
|
|
4657
4966
|
};
|
|
4658
4967
|
case "diagnostics":
|
|
@@ -5277,12 +5586,12 @@ class NativeRuntime {
|
|
|
5277
5586
|
hooks = Promise.resolve();
|
|
5278
5587
|
browserId;
|
|
5279
5588
|
userControlledTabs = new Set;
|
|
5280
|
-
constructor(context, instanceId, directory, serverOrigin) {
|
|
5589
|
+
constructor(context, instanceId, directory, serverOrigin, passkeyDetection = true) {
|
|
5281
5590
|
this.context = context;
|
|
5282
5591
|
this.instanceId = instanceId;
|
|
5283
5592
|
this.serverOrigin = serverOrigin;
|
|
5284
5593
|
installCancellation(context);
|
|
5285
|
-
this.engine = new BrowserRuntime(context, directory, `${directory}.uploads`, (download, page, downloadId) => this.download(download, page, downloadId), async (page) => this.assertPageAvailable(page));
|
|
5594
|
+
this.engine = new BrowserRuntime(context, directory, `${directory}.uploads`, (download, page, downloadId) => this.download(download, page, downloadId), async (page) => this.assertPageAvailable(page), passkeyDetection);
|
|
5286
5595
|
context.on("page", (page) => {
|
|
5287
5596
|
this.track(page);
|
|
5288
5597
|
});
|
|
@@ -5722,6 +6031,7 @@ function sanitizeLiveEvent(value) {
|
|
|
5722
6031
|
}
|
|
5723
6032
|
}
|
|
5724
6033
|
var LIVE_MODIFIERS = { Alt: 1, Control: 2, Meta: 4, Shift: 8 };
|
|
6034
|
+
var NAVIGATIONS = new Set(["reload", "back", "forward"]);
|
|
5725
6035
|
var MAX_LIVE_INPUT_TEXT = 200;
|
|
5726
6036
|
var isLiveRelease = (event) => event.kind === "release" || (event.kind === "mouse" || event.kind === "key") && event.type === "up";
|
|
5727
6037
|
var MAX_LIVE_DIALOG_TEXT = 500;
|
|
@@ -5762,11 +6072,15 @@ function sanitizeLiveInput(value) {
|
|
|
5762
6072
|
if (e.text === undefined)
|
|
5763
6073
|
return { kind: "dialog", accept: e.accept };
|
|
5764
6074
|
return typeof e.text === "string" && e.text.length <= MAX_LIVE_DIALOG_TEXT && !CONTROL.test(e.text) && !LONE_SURROGATE.test(e.text) ? { kind: "dialog", accept: e.accept, text: e.text } : null;
|
|
6075
|
+
case "navigate":
|
|
6076
|
+
return NAVIGATIONS.has(e.action) ? { kind: "navigate", action: e.action } : null;
|
|
6077
|
+
case "show":
|
|
6078
|
+
return { kind: "show" };
|
|
5765
6079
|
default:
|
|
5766
6080
|
return null;
|
|
5767
6081
|
}
|
|
5768
6082
|
}
|
|
5769
|
-
var DIALOG_TYPES = new Set(["alert", "confirm", "prompt", "beforeunload"]);
|
|
6083
|
+
var DIALOG_TYPES = new Set(["alert", "confirm", "prompt", "beforeunload", "passkey"]);
|
|
5770
6084
|
var MAX_LIVE_DIALOG_MESSAGE = 500;
|
|
5771
6085
|
|
|
5772
6086
|
// cli/src/live/wire.ts
|
|
@@ -6174,7 +6488,8 @@ class NativeLiveProducer {
|
|
|
6174
6488
|
// cli/src/live/takeover.ts
|
|
6175
6489
|
var MAX_QUEUE = 128;
|
|
6176
6490
|
var STEP_TIMEOUT_MS = 3000;
|
|
6177
|
-
var
|
|
6491
|
+
var SHOW_INTERVAL_MS = 1000;
|
|
6492
|
+
var DIALOG_TYPES2 = new Set(["alert", "confirm", "prompt", "beforeunload", "passkey"]);
|
|
6178
6493
|
var MODIFIERS = Object.entries(LIVE_MODIFIERS);
|
|
6179
6494
|
async function bounded3(work, ms) {
|
|
6180
6495
|
let timer2;
|
|
@@ -6298,7 +6613,7 @@ class TakeoverInput {
|
|
|
6298
6613
|
focus(group, tabId, page) {
|
|
6299
6614
|
if (group.session)
|
|
6300
6615
|
this.close(group.session);
|
|
6301
|
-
const session = { tabId, page, keys: new Map, buttons: new Set, pointer: { x: Number.NaN, y: Number.NaN }, ended: false, cleanup: [] };
|
|
6616
|
+
const session = { tabId, page, keys: new Map, buttons: new Set, pointer: { x: Number.NaN, y: Number.NaN }, ended: false, cleanup: [], shownAt: 0 };
|
|
6302
6617
|
group.session = session;
|
|
6303
6618
|
const gate = this.options.agentActivity(tabId);
|
|
6304
6619
|
if (gate) {
|
|
@@ -6365,12 +6680,12 @@ class TakeoverInput {
|
|
|
6365
6680
|
}
|
|
6366
6681
|
reportDialog(tabId, dialog) {
|
|
6367
6682
|
const type = dialog?.type;
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
});
|
|
6683
|
+
let shown = null;
|
|
6684
|
+
if (dialog && type === "passkey")
|
|
6685
|
+
shown = { type, message: "", request: dialog.request === "create" ? "create" : "get", ...dialog.origin ? { origin: dialog.origin } : {} };
|
|
6686
|
+
else if (dialog && type && DIALOG_TYPES2.has(type))
|
|
6687
|
+
shown = { type, message: dialog.message.slice(0, MAX_LIVE_DIALOG_MESSAGE), ...type === "prompt" ? { defaultValue: dialog.defaultValue.slice(0, MAX_LIVE_DIALOG_TEXT) } : {} };
|
|
6688
|
+
this.options.sendEvent({ type: "event", event: "live_dialog", runtimeTabId: tabId, dialog: shown });
|
|
6374
6689
|
}
|
|
6375
6690
|
push(item) {
|
|
6376
6691
|
this.queue.push(item);
|
|
@@ -6422,7 +6737,18 @@ class TakeoverInput {
|
|
|
6422
6737
|
await this.answerDialog(events, event);
|
|
6423
6738
|
return;
|
|
6424
6739
|
}
|
|
6425
|
-
if (events?.
|
|
6740
|
+
if (events?.activeDialog())
|
|
6741
|
+
return;
|
|
6742
|
+
if (event.kind === "show") {
|
|
6743
|
+
if (events?.passkeyPrompt())
|
|
6744
|
+
await this.show(session, events);
|
|
6745
|
+
return;
|
|
6746
|
+
}
|
|
6747
|
+
if (event.kind === "navigate") {
|
|
6748
|
+
await this.navigate(page, event.action);
|
|
6749
|
+
return;
|
|
6750
|
+
}
|
|
6751
|
+
if (events?.passkeyPrompt())
|
|
6426
6752
|
return;
|
|
6427
6753
|
switch (event.kind) {
|
|
6428
6754
|
case "mouse": {
|
|
@@ -6488,6 +6814,33 @@ class TakeoverInput {
|
|
|
6488
6814
|
}
|
|
6489
6815
|
}
|
|
6490
6816
|
}
|
|
6817
|
+
async navigate(page, action) {
|
|
6818
|
+
const options = { waitUntil: "commit", timeout: STEP_TIMEOUT_MS };
|
|
6819
|
+
await (action === "back" ? page.goBack(options) : action === "forward" ? page.goForward(options) : page.reload(options)).catch(() => {});
|
|
6820
|
+
}
|
|
6821
|
+
async show(session, events) {
|
|
6822
|
+
const now = Date.now();
|
|
6823
|
+
if (now - session.shownAt < SHOW_INTERVAL_MS)
|
|
6824
|
+
return;
|
|
6825
|
+
session.shownAt = now;
|
|
6826
|
+
const { page } = session;
|
|
6827
|
+
const shared = events.session();
|
|
6828
|
+
const cdp = shared ?? await page.context().newCDPSession(page).catch(() => {
|
|
6829
|
+
return;
|
|
6830
|
+
});
|
|
6831
|
+
try {
|
|
6832
|
+
if (cdp) {
|
|
6833
|
+
const { windowId } = await cdp.send("Browser.getWindowForTarget");
|
|
6834
|
+
const { bounds } = await cdp.send("Browser.getWindowBounds", { windowId });
|
|
6835
|
+
if (bounds.windowState === "minimized")
|
|
6836
|
+
await cdp.send("Browser.setWindowBounds", { windowId, bounds: { windowState: "normal" } });
|
|
6837
|
+
}
|
|
6838
|
+
} catch {} finally {
|
|
6839
|
+
if (cdp && cdp !== shared)
|
|
6840
|
+
await cdp.detach().catch(() => {});
|
|
6841
|
+
}
|
|
6842
|
+
await page.bringToFront().catch(() => {});
|
|
6843
|
+
}
|
|
6491
6844
|
async releaseAll(session) {
|
|
6492
6845
|
const buttons = [...session.buttons], keys = new Set(session.keys.values());
|
|
6493
6846
|
session.buttons.clear();
|
|
@@ -6498,11 +6851,17 @@ class TakeoverInput {
|
|
|
6498
6851
|
await session.page.keyboard.up(key2).catch(() => {});
|
|
6499
6852
|
}
|
|
6500
6853
|
async answerDialog(events, event) {
|
|
6501
|
-
|
|
6502
|
-
|
|
6854
|
+
if (!events)
|
|
6855
|
+
return;
|
|
6856
|
+
const dialog = events.activeDialog(), details = events.dialogDetails();
|
|
6857
|
+
if (dialog && details) {
|
|
6858
|
+
const prompt = details.type === "prompt" && event.accept && event.text !== undefined;
|
|
6859
|
+
await events.handleDialog({ dialogId: dialog.dialogId, decision: event.accept ? "accept" : "dismiss", ...prompt ? { promptText: event.text } : {} }, "viewer");
|
|
6503
6860
|
return;
|
|
6504
|
-
|
|
6505
|
-
|
|
6861
|
+
}
|
|
6862
|
+
const passkey = events.passkeyPrompt();
|
|
6863
|
+
if (passkey && !event.accept)
|
|
6864
|
+
await events.handleDialog({ dialogId: passkey.dialogId, decision: "dismiss" }, "viewer");
|
|
6506
6865
|
}
|
|
6507
6866
|
}
|
|
6508
6867
|
|
|
@@ -6761,7 +7120,7 @@ class Relay {
|
|
|
6761
7120
|
if (this.paused || this.stopping || socket !== this.socket || socket.readyState !== WebSocket2.OPEN)
|
|
6762
7121
|
return;
|
|
6763
7122
|
this.state = "authenticating";
|
|
6764
|
-
socket.send(JSON.stringify({ type: "auth", token: this.token, client: { protocol: 3, version: "0.3.
|
|
7123
|
+
socket.send(JSON.stringify({ type: "auth", token: this.token, client: { protocol: 3, version: "0.3.23", instanceId: this.runtime.instanceId, operations: [...BROWSER_OPERATIONS, ...this.runtime.plugins.flatMap((p) => p.operations), "session_end", "release_tab", "runtime_health", "runtime_recover"], capabilities: ["runtime-queue.v1", "runtime-quarantine.v1", "binary-artifacts.v1", "browser-controls.v1", "screenshot-ids.v1", "webmcp.page-context.v1", "clipboard.native.v1", "native-transfers.v1", "secrets.v1", "forwarding.v1", "live-view.v1", "live-control.v1", "live-navigate.v1"], liveView: { enabled: this.liveEnabled } } }));
|
|
6765
7124
|
});
|
|
6766
7125
|
socket.on("message", (bytes, binary) => {
|
|
6767
7126
|
if (binary || Buffer.byteLength(bytes.toString()) > LIMIT) {
|
|
@@ -8082,6 +8441,8 @@ function parse2(args) {
|
|
|
8082
8441
|
options.ephemeral = true;
|
|
8083
8442
|
else if (key2 === "--live-view")
|
|
8084
8443
|
options.liveView = true;
|
|
8444
|
+
else if (key2 === "--no-passkey-detection")
|
|
8445
|
+
options.passkeyDetection = false;
|
|
8085
8446
|
else if (key2 === "--profile" || key2 === "--server" || key2 === "--chrome-path") {
|
|
8086
8447
|
if (!args[i + 1] || args[i + 1].startsWith("--"))
|
|
8087
8448
|
throw new Error(`Missing ${key2} value`);
|
|
@@ -8098,10 +8459,10 @@ function parse2(args) {
|
|
|
8098
8459
|
async function runBrowser(args) {
|
|
8099
8460
|
const command = args.shift() ?? "help";
|
|
8100
8461
|
if (command === "help" || command === "--help" || args.includes("--help")) {
|
|
8101
|
-
console.log(`browser-mcp browser start [--server https://browser-mcp.click] [--profile work] [--profile personal ...] [--ephemeral] [--chrome-path /path/to/chrome] [--live-view]
|
|
8462
|
+
console.log(`browser-mcp browser start [--server https://browser-mcp.click] [--profile work] [--profile personal ...] [--ephemeral] [--chrome-path /path/to/chrome] [--live-view] [--no-passkey-detection]
|
|
8102
8463
|
browser-mcp browser status|pause|resume|stop|recover [--profile work]
|
|
8103
8464
|
Repeat --profile to launch multiple isolated browsers. Without --profile, uses default. Approve each new profile separately. Local controls target one profile; Ctrl-C closes all browsers started by this command. A launch/runtime failure stops the group.
|
|
8104
|
-
Dedicated Chrome only. Foreground lifecycle with loopback CDP: stopping the CLI closes Chrome; no detach/reattach. recover removes only verified stale lock/socket artifacts, never profile data. Live view requires local --live-view opt-in (screenshots may expose secrets). Windows browser host is not yet supported.`);
|
|
8465
|
+
Dedicated Chrome only. Foreground lifecycle with loopback CDP: stopping the CLI closes Chrome; no detach/reattach. recover removes only verified stale lock/socket artifacts, never profile data. Live view requires local --live-view opt-in (screenshots may expose secrets). --no-passkey-detection keeps the passkey prompt script out of pages. Windows browser host is not yet supported.`);
|
|
8105
8466
|
return;
|
|
8106
8467
|
}
|
|
8107
8468
|
if (!["start", "status", "pause", "resume", "stop", "recover"].includes(command))
|
|
@@ -8240,7 +8601,7 @@ async function startProfile(root, server, profile, options, groupSignal) {
|
|
|
8240
8601
|
abort.signal.throwIfAborted();
|
|
8241
8602
|
runtimeStage = "runtime-setup";
|
|
8242
8603
|
const previews = path11.join(session.runPath, "previews");
|
|
8243
|
-
runtime = new NativeRuntime(session.context, session.instanceId, previews, server);
|
|
8604
|
+
runtime = new NativeRuntime(session.context, session.instanceId, previews, server, options.passkeyDetection !== false);
|
|
8244
8605
|
runtime.plugins.push(await createDataPlugin(runtime, { directory: path11.join(session.runPath, "data"), downloads: session.downloads, serverOrigin: server, allowInsecureLoopback: new URL(server).protocol === "http:", onSourceCleanupFailure: () => {
|
|
8245
8606
|
console.error("Download cleanup could not be verified; closing the owned browser to bound private spool retention. No website action was replayed.");
|
|
8246
8607
|
requestStop("owner-close");
|
|
@@ -8280,7 +8641,7 @@ async function startProfile(root, server, profile, options, groupSignal) {
|
|
|
8280
8641
|
return;
|
|
8281
8642
|
} else if (cmd !== "status")
|
|
8282
8643
|
throw new Error("Invalid command");
|
|
8283
|
-
socket.end(JSON.stringify({ ...relay.health(), instanceId: session.instanceId, profile, version: "0.3.
|
|
8644
|
+
socket.end(JSON.stringify({ ...relay.health(), instanceId: session.instanceId, profile, version: "0.3.23", protocol: 3 }) + `
|
|
8284
8645
|
`);
|
|
8285
8646
|
})().catch(() => socket.destroy());
|
|
8286
8647
|
});
|
package/dist/main.js
CHANGED
|
@@ -8,7 +8,7 @@ var args = process.argv.slice(2);
|
|
|
8
8
|
var command = args.shift();
|
|
9
9
|
async function main() {
|
|
10
10
|
if (!command || command === "--help" || command === "help") {
|
|
11
|
-
console.log(`@ricsam/browser-mcp 0.3.
|
|
11
|
+
console.log(`@ricsam/browser-mcp 0.3.23
|
|
12
12
|
Usage: browser-mcp browser start|status|pause|resume|stop|recover [options]
|
|
13
13
|
browser-mcp files upload|download [options]
|
|
14
14
|
browser-mcp secrets export|exec [options]
|
|
@@ -18,11 +18,11 @@ Browser dependencies load only for browser commands. No automatic Chrome downloa
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (command === "--version") {
|
|
21
|
-
console.log("0.3.
|
|
21
|
+
console.log("0.3.23");
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
if (command === "browser")
|
|
25
|
-
return (await import("./chunk-
|
|
25
|
+
return (await import("./chunk-fvjengps.js")).runBrowser(args);
|
|
26
26
|
if (command === "files")
|
|
27
27
|
return (await import("./chunk-zv1900tw.js")).runFilesCommand(args);
|
|
28
28
|
if (command === "secrets")
|