cdp-toolkit 3.2.0 → 3.3.0

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/dist/mcp.js CHANGED
@@ -3000,6 +3000,8 @@ function mapBidiError(e) {
3000
3000
  return driverError2("disconnected", e.message);
3001
3001
  if (code === "unsupported operation")
3002
3002
  return driverError2("unsupported", e.message);
3003
+ if (code === "unknown command")
3004
+ return driverError2("unsupported", `${e.message} (this Firefox predates that WebDriver BiDi command; see BIDI_CAPABILITY_MIN_FIREFOX for the version each capability needs)`);
3003
3005
  if (!code && /timed out/i.test(e.message))
3004
3006
  return driverError2("timeout", e.message);
3005
3007
  if (!code && /(disposed|not open|connection closed)/i.test(e.message))
@@ -3153,6 +3155,69 @@ async function resolveElementLocator2(conn, contextId, loc) {
3153
3155
  throw driverError2("no-such-element", `text '${loc.text}' matched no element`);
3154
3156
  return sharedRefOf(nodes[0], `text '${loc.text}'`);
3155
3157
  }
3158
+ function modifierKeyValues(mods) {
3159
+ const out = [];
3160
+ for (const m of mods ?? []) {
3161
+ const v = MODIFIER_VALUES[m.toLowerCase()];
3162
+ if (v === undefined)
3163
+ throw driverError2("page-error", `unknown modifier '${m}' (use Alt, Control, Meta, or Shift)`);
3164
+ if (!out.includes(v))
3165
+ out.push(v);
3166
+ }
3167
+ return out;
3168
+ }
3169
+ function modifierChord(pointerId, actions, keys) {
3170
+ const pointer = actions;
3171
+ if (keys.length === 0)
3172
+ return [{ type: "pointer", id: pointerId, actions: pointer }];
3173
+ const k = keys.length;
3174
+ const pause = () => ({ type: "pause" });
3175
+ const keyActions = [
3176
+ ...keys.map((v) => ({ type: "keyDown", value: v })),
3177
+ ...pointer.map(pause),
3178
+ ...[...keys].reverse().map((v) => ({ type: "keyUp", value: v }))
3179
+ ];
3180
+ const pointerActions = [
3181
+ ...Array.from({ length: k }, pause),
3182
+ ...pointer,
3183
+ ...Array.from({ length: k }, pause)
3184
+ ];
3185
+ return [
3186
+ { type: "key", id: "cdp-keyboard", actions: keyActions },
3187
+ { type: "pointer", id: pointerId, actions: pointerActions }
3188
+ ];
3189
+ }
3190
+ function firefoxMajor(conn) {
3191
+ const v = conn.capabilities?.browserVersion;
3192
+ if (typeof v !== "string")
3193
+ return;
3194
+ const major = Number.parseInt(v, 10);
3195
+ return Number.isFinite(major) ? major : undefined;
3196
+ }
3197
+ function requireFirefox(conn, token) {
3198
+ const min = BIDI_CAPABILITY_MIN_FIREFOX[token];
3199
+ if (min === undefined)
3200
+ return;
3201
+ const major = firefoxMajor(conn);
3202
+ if (major !== undefined && major < min) {
3203
+ const v = conn.capabilities.browserVersion;
3204
+ throw driverError2("unsupported", `${token} needs Firefox ${min} or newer; this Firefox is ${v}.`);
3205
+ }
3206
+ }
3207
+ async function armPostHocBodies(conn) {
3208
+ if (process.env.CDP_FIREFOX_BODY_COLLECTOR === "off")
3209
+ return;
3210
+ try {
3211
+ requireFirefox(conn, "network.responseBodyPostHoc");
3212
+ } catch {
3213
+ return;
3214
+ }
3215
+ try {
3216
+ await conn.send("network.addDataCollector", { dataTypes: ["response"], maxEncodedDataSize: POST_HOC_BODY_MAX_BYTES });
3217
+ } catch (e) {
3218
+ console.error(`[cdp-toolkit] firefox response-body collector not armed: ${e instanceof Error ? e.message : String(e)}`);
3219
+ }
3220
+ }
3156
3221
  function bumpEpoch(endpoint, conn) {
3157
3222
  sessionEpochs.set(endpoint, (sessionEpochs.get(endpoint) ?? 0) + 1);
3158
3223
  connEndpoints.set(conn, endpoint);
@@ -3350,6 +3415,7 @@ async function getConnection(endpoint, timeoutMs, attached = false) {
3350
3415
  }
3351
3416
  connections.set(endpoint, conn);
3352
3417
  bumpEpoch(endpoint, conn);
3418
+ await armPostHocBodies(conn);
3353
3419
  if (muxMode(attached) !== "off") {
3354
3420
  try {
3355
3421
  const mux = await startBidiMux(conn);
@@ -3565,7 +3631,35 @@ class BidiBrowserDriver {
3565
3631
  conn.release();
3566
3632
  }
3567
3633
  }
3634
+ async withBrowserConnection(fn) {
3635
+ const conn = await getConnection(this.endpoint, this.timeoutMs, this.attached);
3636
+ try {
3637
+ return await fn(conn);
3638
+ } finally {
3639
+ conn.release();
3640
+ }
3641
+ }
3642
+ setDisposeHook(key, hook) {
3643
+ let hooks = disposeHooks.get(this.endpoint);
3644
+ if (!hooks) {
3645
+ hooks = new Map;
3646
+ disposeHooks.set(this.endpoint, hooks);
3647
+ }
3648
+ if (hook)
3649
+ hooks.set(key, hook);
3650
+ else
3651
+ hooks.delete(key);
3652
+ }
3568
3653
  async dispose() {
3654
+ const hooks = disposeHooks.get(this.endpoint);
3655
+ disposeHooks.delete(this.endpoint);
3656
+ const live = connections.get(this.endpoint);
3657
+ if (hooks && live) {
3658
+ for (const hook of hooks.values())
3659
+ await hook(live).catch(() => {
3660
+ return;
3661
+ });
3662
+ }
3569
3663
  for (const key of [...bidiBeaconScripts.keys()]) {
3570
3664
  if (key.startsWith(`${this.endpoint}:`))
3571
3665
  bidiBeaconScripts.delete(key);
@@ -3640,7 +3734,7 @@ async function hostFirefoxMux(endpoint, opts = {}) {
3640
3734
  function createFirefoxDriverForEndpoint(wsUrl, opts) {
3641
3735
  return new BidiBrowserDriver(wsUrl, opts?.timeoutMs, true);
3642
3736
  }
3643
- var LINE_RE, INTERACTIVE_ROLES3, STAMP_ONE_SOURCE, KEY_VALUES, MODIFIER_VALUES, BUTTON_CODES, ARM_SCROLL_SETTLE_WATCH_SOURCE, AWAIT_SCROLL_SETTLE_SOURCE = "function(){return window.__cdpScrollSettle;}", BIDI_CAPABILITIES, connections, slotHandles, muxes, joined, connecting, sessionEpochs, connEndpoints, STALE_ID_HINT, sleep3 = (ms) => new Promise((r) => setTimeout(r, ms)), slotLabelOverride, bidiBeaconScripts, BidiPageDriver;
3737
+ var LINE_RE, INTERACTIVE_ROLES3, STAMP_ONE_SOURCE, KEY_VALUES, MODIFIER_VALUES, BUTTON_CODES, RAW_MOUSE_SOURCE_ID = "cdp-raw-mouse", ARM_SCROLL_SETTLE_WATCH_SOURCE, AWAIT_SCROLL_SETTLE_SOURCE = "function(){return window.__cdpScrollSettle;}", BIDI_CAPABILITY_MIN_FIREFOX, POST_HOC_BODY_MAX_BYTES, BIDI_CAPABILITIES, connections, slotHandles, muxes, joined, connecting, sessionEpochs, connEndpoints, disposeHooks, STALE_ID_HINT, sleep3 = (ms) => new Promise((r) => setTimeout(r, ms)), slotLabelOverride, bidiBeaconScripts, BidiPageDriver;
3644
3738
  var init_driver2 = __esm(() => {
3645
3739
  init_driver();
3646
3740
  init_leases();
@@ -3695,13 +3789,25 @@ var init_driver2 = __esm(() => {
3695
3789
  MODIFIER_VALUES = { shift: "", control: "", ctrl: "", alt: "", meta: "", cmd: "", command: "" };
3696
3790
  BUTTON_CODES = { left: 0, middle: 1, right: 2 };
3697
3791
  ARM_SCROLL_SETTLE_WATCH_SOURCE = "function(){window.__cdpScrollSettle=new Promise((resolve)=>{let t;const done=()=>{window.removeEventListener('scroll',on,true);resolve(true);};" + "const on=()=>{clearTimeout(t);t=setTimeout(done,60);};window.addEventListener('scroll',on,true);t=setTimeout(done,60);setTimeout(done,500);});}";
3792
+ BIDI_CAPABILITY_MIN_FIREFOX = {
3793
+ "browser.downloads": 160,
3794
+ "browser.permissions": 160,
3795
+ "emulate.mediaFeatures": 160,
3796
+ "emulate.networkConditions": 160,
3797
+ "input.raw": 160,
3798
+ "input.modifierClick": 160,
3799
+ "network.responseBodyPostHoc": 160,
3800
+ "screenshot.scale": 160
3801
+ };
3802
+ POST_HOC_BODY_MAX_BYTES = 2 * 1024 * 1024;
3698
3803
  BIDI_CAPABILITIES = new Set([
3699
3804
  "emulate.deviceMetrics",
3700
3805
  "screenshot.fullPage",
3701
3806
  "screenshot.element",
3702
3807
  "screenshot.renderSize",
3703
3808
  "network.intercept",
3704
- "locate.xpath"
3809
+ "locate.xpath",
3810
+ ...Object.keys(BIDI_CAPABILITY_MIN_FIREFOX)
3705
3811
  ]);
3706
3812
  connections = new Map;
3707
3813
  slotHandles = new Map;
@@ -3710,6 +3816,7 @@ var init_driver2 = __esm(() => {
3710
3816
  connecting = new Map;
3711
3817
  sessionEpochs = new Map;
3712
3818
  connEndpoints = new WeakMap;
3819
+ disposeHooks = new Map;
3713
3820
  STALE_ID_HINT = " — the Firefox BiDi session was re-established after its previous holder went away, and Firefox " + "assigns new context ids per session — re-resolve the tab with list_pages (url:/title: selectors) " + "and claim it again";
3714
3821
  bidiBeaconScripts = new Map;
3715
3822
  BidiPageDriver = class BidiPageDriver {
@@ -3876,18 +3983,30 @@ var init_driver2 = __esm(() => {
3876
3983
  return { x, y };
3877
3984
  }
3878
3985
  async click(loc, opts) {
3879
- if (opts?.modifiers && opts.modifiers.length > 0) {
3880
- throw driverError2("unsupported", "click: 'modifiers' is not supported by the Firefox/BiDi driver; omit 'modifiers' or use --browser chrome for a modifier click.");
3881
- }
3986
+ const hasModifiers = !!opts?.modifiers && opts.modifiers.length > 0;
3987
+ if (hasModifiers)
3988
+ requireFirefox(this.conn, "input.modifierClick");
3989
+ const keys = modifierKeyValues(opts?.modifiers);
3882
3990
  const ref = await resolveElementLocator2(this.conn, this.contextId, loc);
3883
3991
  const { x, y } = await this.centerOf(ref);
3884
3992
  const button = BUTTON_CODES[opts?.button ?? "left"];
3885
3993
  const actions = [{ type: "pointerMove", x, y, duration: 0 }];
3886
3994
  for (let i = 0;i < (opts?.clickCount ?? 1); i++)
3887
3995
  actions.push({ type: "pointerDown", button }, { type: "pointerUp", button });
3888
- await this.performActions([{ type: "pointer", id: "cdp-mouse", actions }]);
3996
+ await this.performActions(modifierChord("cdp-mouse", actions, keys));
3889
3997
  return { x, y };
3890
3998
  }
3999
+ async dispatchMouse(event) {
4000
+ requireFirefox(this.conn, "input.raw");
4001
+ const keys = modifierKeyValues(event.modifiers);
4002
+ const button = BUTTON_CODES[event.button ?? "left"];
4003
+ const actions = [{ type: "pointerMove", x: event.x, y: event.y, duration: 0 }];
4004
+ if (event.action === "down")
4005
+ actions.push({ type: "pointerDown", button });
4006
+ else if (event.action === "up")
4007
+ actions.push({ type: "pointerUp", button });
4008
+ await this.performActions(modifierChord(RAW_MOUSE_SOURCE_ID, actions, keys));
4009
+ }
3891
4010
  async scroll(anchor, opts) {
3892
4011
  const { x, y } = await this.resolveScrollPoint(anchor);
3893
4012
  const deltaX = Math.round(opts.deltaX ?? 0);
@@ -3996,11 +4115,23 @@ var init_driver2 = __esm(() => {
3996
4115
  }
3997
4116
  async screenshot(opts, _consumeBands) {
3998
4117
  const renderSize = opts?.renderWidth !== undefined && opts?.renderHeight !== undefined ? { width: opts.renderWidth, height: opts.renderHeight } : undefined;
3999
- if (!renderSize)
4118
+ const scale = opts?.scale !== undefined && opts.scale !== 1 ? opts.scale : undefined;
4119
+ if (!renderSize && scale === undefined)
4000
4120
  return this.capture(opts);
4121
+ if (scale !== undefined)
4122
+ requireFirefox(this.conn, "screenshot.scale");
4001
4123
  const previous = await readViewportRecord(this.browser.scheme, this.contextId);
4124
+ let dprOverride;
4125
+ if (scale !== undefined) {
4126
+ const base = previous?.deviceScaleFactor ?? Number(await this.evaluate("window.devicePixelRatio").catch(() => 1));
4127
+ dprOverride = (Number.isFinite(base) && base > 0 ? base : 1) * scale;
4128
+ }
4002
4129
  try {
4003
- await this.conn.send("browsingContext.setViewport", { context: this.contextId, viewport: { width: renderSize.width, height: renderSize.height } });
4130
+ await this.conn.send("browsingContext.setViewport", {
4131
+ context: this.contextId,
4132
+ ...renderSize ? { viewport: { width: renderSize.width, height: renderSize.height } } : {},
4133
+ ...dprOverride !== undefined ? { devicePixelRatio: dprOverride } : {}
4134
+ });
4004
4135
  } catch (e) {
4005
4136
  throw mapBidiError(e);
4006
4137
  }
@@ -4017,29 +4148,35 @@ var init_driver2 = __esm(() => {
4017
4148
  await this.conn.send("browsingContext.setViewport", {
4018
4149
  context: this.contextId,
4019
4150
  viewport: { width: previous.width, height: previous.height },
4020
- ...previous.deviceScaleFactor != null ? { devicePixelRatio: previous.deviceScaleFactor } : {}
4151
+ ...previous.deviceScaleFactor != null ? { devicePixelRatio: previous.deviceScaleFactor } : scale !== undefined ? { devicePixelRatio: null } : {}
4021
4152
  });
4022
4153
  } else {
4023
- await this.conn.send("browsingContext.setViewport", { context: this.contextId, viewport: null });
4154
+ await this.conn.send("browsingContext.setViewport", {
4155
+ context: this.contextId,
4156
+ ...renderSize ? { viewport: null } : {},
4157
+ ...scale !== undefined ? { devicePixelRatio: null } : {}
4158
+ });
4024
4159
  }
4025
4160
  } catch (e) {
4026
4161
  restoreError = e instanceof Error ? e.message : String(e);
4027
4162
  }
4028
4163
  if (!shot) {
4029
4164
  if (restoreError !== undefined && captureError instanceof Error) {
4030
- captureError.message = `${captureError.message} ${renderRestoreFailureNote(renderSize, restoreError)}`;
4165
+ captureError.message = renderSize ? `${captureError.message} ${renderRestoreFailureNote(renderSize, restoreError)}` : `${captureError.message} (and restoring the device pixel ratio failed too, the tab may still be emulated at ratio ${dprOverride}: ${restoreError})`;
4031
4166
  }
4032
4167
  throw captureError;
4033
4168
  }
4169
+ if (!renderSize) {
4170
+ if (restoreError !== undefined)
4171
+ throw driverError2("page-error", `screenshot captured, but restoring the device pixel ratio failed (the tab may still be emulated at ratio ${dprOverride}): ${restoreError}`);
4172
+ return shot;
4173
+ }
4034
4174
  const result = { ...shot, renderSize, renderRestored: restoreError === undefined };
4035
4175
  if (restoreError !== undefined)
4036
4176
  result.renderRestoreError = restoreError;
4037
4177
  return result;
4038
4178
  }
4039
4179
  async capture(opts) {
4040
- if (opts?.scale !== undefined && opts.scale !== 1) {
4041
- throw driverError2("unsupported", `screenshot scale ${opts.scale} is not supported by this backend (WebDriver BiDi's ` + "browsingContext.captureScreenshot has no scale parameter). Call emulate with " + `deviceScaleFactor:${opts.scale} first and capture at scale 1, or use --browser chrome.`);
4042
- }
4043
4180
  if (opts?.tile === true) {
4044
4181
  throw driverError2("unsupported", "screenshot tile:true is not supported by this backend: band tiling is declared only where the band " + "arithmetic has been measured against a real browser, and Firefox was not driven for it " + `(browsingContext.captureScreenshot's clip:{type:"box"} is the primitive it would ride, untested). ` + "Capture a smaller region or a single element, or use --browser chrome for a tiled capture.");
4045
4182
  }
@@ -4067,10 +4204,29 @@ var init_driver2 = __esm(() => {
4067
4204
  await this.conn.send("browsingContext.setViewport", { context: this.contextId, viewport: null, devicePixelRatio: null }).catch(() => {
4068
4205
  return;
4069
4206
  });
4207
+ await this.conn.send("emulation.setMediaFeaturesOverride", { features: null, contexts: [this.contextId] }).catch(() => {
4208
+ return;
4209
+ });
4210
+ await this.conn.send("emulation.setNetworkConditions", { networkConditions: null, contexts: [this.contextId] }).catch(() => {
4211
+ return;
4212
+ });
4070
4213
  await clearViewportRecord(this.browser.scheme, this.contextId);
4071
4214
  return { applied: [] };
4072
4215
  }
4073
4216
  const applied = [];
4217
+ if (opts.media != null && opts.media !== "") {
4218
+ throw driverError2("unsupported", `emulate media "${opts.media}": WebDriver BiDi's emulation.setMediaFeaturesOverride takes media features (prefers-color-scheme, ...) but has no print/screen media-type override. Use mediaFeatures, or --browser chrome for media type emulation.`);
4219
+ }
4220
+ const net = opts.networkConditions;
4221
+ if (net != null) {
4222
+ const throttled = (net.latency ?? 0) > 0 || (net.downloadThroughput ?? -1) >= 0 || (net.uploadThroughput ?? -1) >= 0;
4223
+ if (throttled) {
4224
+ throw driverError2("unsupported", 'emulate networkConditions: Firefox only emulates offline (emulation.setNetworkConditions has the single type "offline"); latency and download/upload throughput throttling are not available. Pass only {offline:true|false}, or use --browser chrome.');
4225
+ }
4226
+ requireFirefox(this.conn, "emulate.networkConditions");
4227
+ }
4228
+ if (opts.mediaFeatures != null)
4229
+ requireFirefox(this.conn, "emulate.mediaFeatures");
4074
4230
  try {
4075
4231
  if (opts.width != null && opts.height != null) {
4076
4232
  await this.conn.send("browsingContext.setViewport", { context: this.contextId, viewport: { width: opts.width, height: opts.height }, ...opts.deviceScaleFactor != null ? { devicePixelRatio: opts.deviceScaleFactor } : {} });
@@ -4085,6 +4241,21 @@ var init_driver2 = __esm(() => {
4085
4241
  await this.conn.send("emulation.setUserAgentOverride", { userAgent: opts.userAgent, contexts: [this.contextId] });
4086
4242
  applied.push("userAgent");
4087
4243
  }
4244
+ if (opts.mediaFeatures != null) {
4245
+ const features = Object.fromEntries(opts.mediaFeatures.map((f) => [f.name, f.value]));
4246
+ await this.conn.send("emulation.setMediaFeaturesOverride", {
4247
+ features: opts.mediaFeatures.length > 0 ? features : null,
4248
+ contexts: [this.contextId]
4249
+ });
4250
+ applied.push("mediaFeatures");
4251
+ }
4252
+ if (net != null) {
4253
+ await this.conn.send("emulation.setNetworkConditions", {
4254
+ networkConditions: net.offline ? { type: "offline" } : null,
4255
+ contexts: [this.contextId]
4256
+ });
4257
+ applied.push("networkConditions");
4258
+ }
4088
4259
  } catch (e) {
4089
4260
  throw mapBidiError(e);
4090
4261
  }
@@ -4219,12 +4390,25 @@ var init_driver2 = __esm(() => {
4219
4390
  };
4220
4391
  }
4221
4392
  async getResponseBody(requestId) {
4222
- if (!this.bodyCollector)
4223
- throw driverError2("unsupported", "getResponseBody: call startBodyCapture() first (network.responseBodyPostHoc is not supported)");
4393
+ let collector;
4224
4394
  try {
4225
- const { bytes } = await this.conn.send("network.getData", { dataType: "response", collector: this.bodyCollector, request: requestId });
4395
+ requireFirefox(this.conn, "network.responseBodyPostHoc");
4396
+ } catch (e) {
4397
+ if (!this.bodyCollector) {
4398
+ throw driverError2("unsupported", `${e.message} Call startBodyCapture() before the request to read its body on this Firefox.`);
4399
+ }
4400
+ collector = this.bodyCollector;
4401
+ }
4402
+ try {
4403
+ const { bytes } = await this.conn.send("network.getData", { dataType: "response", request: requestId, ...collector ? { collector } : {} });
4226
4404
  return bytes.type === "base64" ? { body: bytes.value, base64Encoded: true } : { body: bytes.value, base64Encoded: false };
4227
4405
  } catch (e) {
4406
+ if (e instanceof BidiError && e.code === "unavailable network data") {
4407
+ throw driverError2("page-error", `getResponseBody: the body of request ${requestId} was collected but has been evicted (Firefox keeps only a bounded recent window of response bodies, on the order of 100-200 MB). Re-issue the request, then read it sooner.`);
4408
+ }
4409
+ if (e instanceof BidiError && e.code === "no such network data") {
4410
+ throw driverError2("page-error", `getResponseBody: no body is held for request ${requestId}. Firefox cannot say which of these applies: the id is wrong, the request started before this Firefox session did, the response was larger than ${POST_HOC_BODY_MAX_BYTES} bytes (not retained), or it has no body.`);
4411
+ }
4228
4412
  throw mapBidiError(e);
4229
4413
  }
4230
4414
  }
@@ -4765,6 +4949,7 @@ var CDP_CAPABILITIES = new Set([
4765
4949
  "locate.xpath",
4766
4950
  "capture.screencast",
4767
4951
  "input.raw",
4952
+ "input.modifierClick",
4768
4953
  "input.html5Drag",
4769
4954
  "emulate.focus",
4770
4955
  "browser.downloads",
@@ -6785,7 +6970,7 @@ function resolveScreenshotScale(scale, capabilities) {
6785
6970
  throw new SharedToolError(`take_screenshot: 'scale' must be a finite number greater than 0 and at most ${MAX_SCREENSHOT_SCALE} (default 1)`);
6786
6971
  }
6787
6972
  if (scale !== 1 && !capabilities.has("screenshot.scale")) {
6788
- throw new SharedToolError("take_screenshot: 'scale' is not supported by this backend (WebDriver BiDi's browsingContext.captureScreenshot has no scale parameter). " + `Call emulate with deviceScaleFactor:${scale} first and capture at scale 1, or use --browser chrome for a per-capture scale.`);
6973
+ throw new SharedToolError("take_screenshot: 'scale' is not supported by this backend (no per-capture scale primitive). " + `Call emulate with deviceScaleFactor:${scale} first and capture at scale 1, or use --browser chrome for a per-capture scale.`);
6789
6974
  }
6790
6975
  return scale;
6791
6976
  }
@@ -9779,7 +9964,7 @@ var MANIFEST = [
9779
9964
  },
9780
9965
  {
9781
9966
  name: "dispatch_mouse",
9782
- description: "Dispatch one raw mouse event at viewport coordinates; Chrome-only.",
9967
+ description: "Dispatch one raw mouse event at viewport coordinates; Firefox needs 160 or newer.",
9783
9968
  inputSchema: {
9784
9969
  type: "object",
9785
9970
  properties: {
@@ -9936,7 +10121,7 @@ var MANIFEST = [
9936
10121
  },
9937
10122
  {
9938
10123
  name: "grant_permissions",
9939
- description: "Grant or reset browser permissions; permissions are origin-scoped and Chrome-only.",
10124
+ description: "Grant or reset browser permissions; permissions are origin-scoped (Chrome, Firefox 160+).",
9940
10125
  inputSchema: {
9941
10126
  type: "object",
9942
10127
  properties: {
@@ -11319,6 +11504,16 @@ async function withPage4(driver, target, fn) {
11319
11504
  await page.release();
11320
11505
  }
11321
11506
  }
11507
+ async function dispatchMouse2(driver, args) {
11508
+ validateDispatchMouseArgs(args);
11509
+ modifierBits(args.modifiers);
11510
+ return withPage4(driver, args.target, async (page) => {
11511
+ if (!page.dispatchMouse)
11512
+ throw new BidiToolError("dispatch_mouse: this page driver has no raw mouse dispatch");
11513
+ await page.dispatchMouse({ action: args.action, x: args.x, y: args.y, button: args.button, clickCount: args.clickCount, modifiers: args.modifiers });
11514
+ return { dispatched: args.action, x: args.x, y: args.y };
11515
+ });
11516
+ }
11322
11517
  var consoleBuffers = new Map;
11323
11518
  var networkBuffers = new Map;
11324
11519
  function refuseWorkerSelector(driver, target) {
@@ -11391,6 +11586,13 @@ async function getNetworkRequest2(driver, args = {}) {
11391
11586
  return withPage4(driver, args.target, async (page) => {
11392
11587
  const buf = bufferFor(networkBuffers, page.info.id);
11393
11588
  const found = args.requestId ? buf.find((r) => r.requestId === args.requestId || r.request === args.requestId) : buf.find((r) => typeof r.url === "string" && r.url.includes(args.url));
11589
+ if (args.includeBody) {
11590
+ const id = args.requestId ?? (found ? String(found.requestId ?? found.request ?? "") : "");
11591
+ if (!id)
11592
+ throw new BidiToolError("get_network_request includeBody on this backend needs a requestId, or a url already present in the buffer (run list_network_requests with reload first)");
11593
+ const { body, base64Encoded } = await page.getResponseBody(id);
11594
+ return { ...found ?? { requestId: id }, body, bodyBase64Encoded: base64Encoded };
11595
+ }
11394
11596
  if (!found)
11395
11597
  throw new BidiToolError("no matching network request in the current buffer; run list_network_requests first");
11396
11598
  return found;
@@ -11466,7 +11668,232 @@ var BIDI_ONLY_TOOLS = {
11466
11668
  get_network_request: getNetworkRequest2,
11467
11669
  mock_request: mockRequest2,
11468
11670
  list_mocks: listMocks2,
11469
- clear_mocks: clearMocks2
11671
+ clear_mocks: clearMocks2,
11672
+ dispatch_mouse: dispatchMouse2
11673
+ };
11674
+
11675
+ // src/bidi-browser-tools.ts
11676
+ init_driver2();
11677
+ import { mkdir as mkdir14, readdir as readdir4, realpath, rename as rename4, stat as stat5 } from "node:fs/promises";
11678
+ import { basename as basename2, dirname as dirname4, join as join14, resolve } from "node:path";
11679
+ function unsupported(message) {
11680
+ return Object.assign(new Error(message), { code: "unsupported" });
11681
+ }
11682
+ function scopeOf(driver, tool) {
11683
+ const d = driver;
11684
+ if (typeof d.withBrowserConnection !== "function" || typeof d.setDisposeHook !== "function") {
11685
+ throw unsupported(`${tool}: this driver has no browser-scoped connection (the Firefox BiDi driver does; Chrome uses src/tools/).`);
11686
+ }
11687
+ return d;
11688
+ }
11689
+ async function targetOf(driver, target) {
11690
+ const page = await driver.page(target);
11691
+ try {
11692
+ return { id: page.info.id, url: page.info.url, title: page.info.title };
11693
+ } finally {
11694
+ await page.release();
11695
+ }
11696
+ }
11697
+ var FIREFOX_DOWNLOAD_STAGING_DIR = join14(dirname4(DOWNLOADS_DIR), "downloads-firefox-staging");
11698
+ var downloadStates = new WeakMap;
11699
+ function downloadId(p) {
11700
+ const v = p.download ?? p.navigation;
11701
+ return typeof v === "string" && v.length > 0 ? v : undefined;
11702
+ }
11703
+ function deliver(s, r) {
11704
+ r.state = "completed";
11705
+ s.downloads.push(r);
11706
+ while (s.downloads.length > DOWNLOAD_BUFFER_LIMIT) {
11707
+ const i = s.downloads.findIndex((d) => d.consumed);
11708
+ s.downloads.splice(i >= 0 ? i : 0, 1);
11709
+ }
11710
+ const waiter = s.waiters.shift();
11711
+ if (waiter) {
11712
+ r.consumed = true;
11713
+ waiter(r);
11714
+ }
11715
+ }
11716
+ function downloadStateFor(conn) {
11717
+ let s = downloadStates.get(conn);
11718
+ if (s)
11719
+ return s;
11720
+ const state = { downloads: [], begun: new Map, waiters: [], stagingDirs: new Set([resolve(FIREFOX_DOWNLOAD_STAGING_DIR)]) };
11721
+ downloadStates.set(conn, state);
11722
+ conn.on("browsingContext.downloadWillBegin", (p) => {
11723
+ const id = downloadId(p);
11724
+ if (!id)
11725
+ return;
11726
+ state.begun.set(id, { id, url: p.url, suggestedFilename: p.suggestedFilename, state: "inProgress", consumed: false });
11727
+ if (state.begun.size > DOWNLOAD_BUFFER_LIMIT)
11728
+ state.begun.delete(state.begun.keys().next().value);
11729
+ });
11730
+ conn.on("browsingContext.downloadEnd", (p) => {
11731
+ const id = downloadId(p);
11732
+ if (!id)
11733
+ return;
11734
+ const rec = state.begun.get(id) ?? { id, state: "inProgress", consumed: false };
11735
+ state.begun.delete(id);
11736
+ if (p.status !== "complete" || !p.filepath)
11737
+ return;
11738
+ if (!state.stagingDirs.has(resolve(dirname4(p.filepath))))
11739
+ return;
11740
+ rec.url ??= p.url;
11741
+ const held = join14(dirname4(p.filepath), `${id.replace(/[^A-Za-z0-9-]/g, "_")}.download`);
11742
+ rename4(p.filepath, held).then(() => {
11743
+ rec.filePath = held;
11744
+ }, () => {
11745
+ rec.filePath = p.filepath ?? undefined;
11746
+ }).finally(() => deliver(state, rec));
11747
+ });
11748
+ return state;
11749
+ }
11750
+ async function armFirefoxDownloads(conn, s, scope) {
11751
+ await mkdir14(FIREFOX_DOWNLOAD_STAGING_DIR, { recursive: true });
11752
+ await mkdir14(DOWNLOADS_DIR, { recursive: true });
11753
+ s.stagingDirs.add(resolve(await realpath(FIREFOX_DOWNLOAD_STAGING_DIR)));
11754
+ scope.setDisposeHook("browser.downloads", async (c) => {
11755
+ await c.send("browser.setDownloadBehavior", { downloadBehavior: null });
11756
+ });
11757
+ await conn.send("browser.setDownloadBehavior", { downloadBehavior: { type: "allowed", destinationFolder: FIREFOX_DOWNLOAD_STAGING_DIR } });
11758
+ }
11759
+ async function disarmFirefoxDownloads(conn, scope) {
11760
+ await conn.send("browser.setDownloadBehavior", { downloadBehavior: null });
11761
+ scope.setDisposeHook("browser.downloads", undefined);
11762
+ }
11763
+ function nextFirefoxDownload(s, timeoutMs) {
11764
+ const buffered = s.downloads.find((d) => !d.consumed);
11765
+ if (buffered) {
11766
+ buffered.consumed = true;
11767
+ return Promise.resolve(buffered);
11768
+ }
11769
+ return new Promise((resolvePromise, reject) => {
11770
+ const waiter = (r) => {
11771
+ clearTimeout(timer);
11772
+ resolvePromise(r);
11773
+ };
11774
+ const timer = setTimeout(() => {
11775
+ const i = s.waiters.indexOf(waiter);
11776
+ if (i >= 0)
11777
+ s.waiters.splice(i, 1);
11778
+ reject(new Error(`wait_for_download: no download completed within ${timeoutMs}ms. On Firefox, downloads are captured only while a wait_for_download call is armed: arm (arm:true) BEFORE the triggering click, and again before every later download, because each collecting call restores Firefox's normal download behavior when it returns.`));
11779
+ }, timeoutMs);
11780
+ s.waiters.push(waiter);
11781
+ });
11782
+ }
11783
+ async function waitForDownloadFirefox(driver, args = {}) {
11784
+ validateWaitForDownloadArgs(args);
11785
+ const scope = scopeOf(driver, "wait_for_download");
11786
+ const target = await targetOf(driver, args.target);
11787
+ return scope.withBrowserConnection(async (conn) => {
11788
+ requireFirefox(conn, "browser.downloads");
11789
+ const s = downloadStateFor(conn);
11790
+ await armFirefoxDownloads(conn, s, scope);
11791
+ if (args.arm === true) {
11792
+ return { armed: true, downloadPath: DOWNLOADS_DIR, pending: s.downloads.filter((d) => !d.consumed).length, target };
11793
+ }
11794
+ let rec;
11795
+ try {
11796
+ rec = await nextFirefoxDownload(s, args.timeoutMs ?? 30000);
11797
+ } finally {
11798
+ if (s.waiters.length === 0)
11799
+ await disarmFirefoxDownloads(conn, scope).catch(() => {
11800
+ return;
11801
+ });
11802
+ }
11803
+ if (!rec.filePath) {
11804
+ throw new Error(`wait_for_download: download ${rec.id} completed without a file path (nothing to return)`);
11805
+ }
11806
+ const suggestedFilename = safeFilename(rec.suggestedFilename);
11807
+ const taken = new Set(await readdir4(DOWNLOADS_DIR).catch(() => []));
11808
+ taken.delete(basename2(rec.filePath));
11809
+ const finalName = nextFreeName(suggestedFilename, taken);
11810
+ const path = join14(DOWNLOADS_DIR, finalName);
11811
+ await rename4(rec.filePath, path);
11812
+ const bytes = (await stat5(path)).size;
11813
+ return { path, suggestedFilename, bytes, ...rec.url ? { url: rec.url } : {}, target };
11814
+ });
11815
+ }
11816
+ var FIREFOX_PERMISSION_DESCRIPTORS = {
11817
+ geolocation: { name: "geolocation" },
11818
+ notifications: { name: "notifications" },
11819
+ audioCapture: { name: "microphone" },
11820
+ videoCapture: { name: "camera" },
11821
+ durableStorage: { name: "persistent-storage" },
11822
+ midi: { name: "midi" },
11823
+ midiSysex: { name: "midi", sysex: true },
11824
+ wakeLockScreen: { name: "screen-wake-lock" }
11825
+ };
11826
+ function mapFirefoxPermissions(names) {
11827
+ return names.map((n) => {
11828
+ const d = Object.hasOwn(FIREFOX_PERMISSION_DESCRIPTORS, n) ? FIREFOX_PERMISSION_DESCRIPTORS[n] : undefined;
11829
+ if (!d) {
11830
+ throw unsupported(`grant_permissions: permission '${n}' is not supported on Firefox (WebDriver BiDi permissions.setPermission has no measured equivalent). Supported on Firefox: ${Object.keys(FIREFOX_PERMISSION_DESCRIPTORS).join(", ")}.`);
11831
+ }
11832
+ return d;
11833
+ });
11834
+ }
11835
+ var trackedGrants = new WeakMap;
11836
+ function grantKey(origin, d) {
11837
+ return `${origin} ${JSON.stringify(d)}`;
11838
+ }
11839
+ async function restoreGrants(conn, grants) {
11840
+ const all = [...grants.values()];
11841
+ grants.clear();
11842
+ for (const g of all) {
11843
+ await conn.send("permissions.setPermission", { descriptor: g.descriptor, state: g.previous, origin: g.origin });
11844
+ }
11845
+ }
11846
+ async function queryState(page, d) {
11847
+ try {
11848
+ const v = await page.evaluate(`navigator.permissions.query(${JSON.stringify(d)}).then((p) => p.state, () => "prompt")`, { awaitPromise: true });
11849
+ return v === "granted" || v === "denied" ? v : "prompt";
11850
+ } catch {
11851
+ return "prompt";
11852
+ }
11853
+ }
11854
+ async function grantPermissionsFirefox(driver, args = {}) {
11855
+ validateGrantPermissionsArgs(args);
11856
+ const reset = args.reset === true;
11857
+ const permissions = args.permissions ?? [];
11858
+ const descriptors = mapFirefoxPermissions(permissions);
11859
+ const scope = scopeOf(driver, "grant_permissions");
11860
+ let grants = trackedGrants.get(driver);
11861
+ if (!grants) {
11862
+ grants = new Map;
11863
+ trackedGrants.set(driver, grants);
11864
+ }
11865
+ const tracked = grants;
11866
+ const page = await driver.page(args.target);
11867
+ try {
11868
+ const target = { id: page.info.id, url: page.info.url, title: page.info.title };
11869
+ return await scope.withBrowserConnection(async (conn) => {
11870
+ requireFirefox(conn, "browser.permissions");
11871
+ if (reset)
11872
+ await restoreGrants(conn, tracked);
11873
+ if (permissions.length === 0)
11874
+ return { reset: true, target };
11875
+ const origin = args.origin ?? originOf(page.info.url);
11876
+ if (!origin) {
11877
+ throw new Error(`grant_permissions: cannot derive an origin from the target tab's url (${JSON.stringify(page.info.url)}); pass 'origin' explicitly, e.g. origin:"https://example.com"`);
11878
+ }
11879
+ const pageIsOrigin = originOf(page.info.url) === origin;
11880
+ scope.setDisposeHook("browser.permissions", (c) => restoreGrants(c, tracked));
11881
+ for (const d of descriptors) {
11882
+ const key = grantKey(origin, d);
11883
+ if (!tracked.has(key)) {
11884
+ tracked.set(key, { origin, descriptor: d, previous: pageIsOrigin ? await queryState(page, d) : "prompt" });
11885
+ }
11886
+ await conn.send("permissions.setPermission", { descriptor: d, state: "granted", origin });
11887
+ }
11888
+ return { granted: [...permissions], origin, ...reset ? { reset: true } : {}, target };
11889
+ });
11890
+ } finally {
11891
+ await page.release();
11892
+ }
11893
+ }
11894
+ var BIDI_BROWSER_TOOLS = {
11895
+ wait_for_download: waitForDownloadFirefox,
11896
+ grant_permissions: grantPermissionsFirefox
11470
11897
  };
11471
11898
 
11472
11899
  // src/firefox-tools.ts
@@ -11474,6 +11901,7 @@ var FIREFOX_TOOLS = {
11474
11901
  ...SHARED_TOOLS,
11475
11902
  ...BIDI_ONLY_TOOLS,
11476
11903
  ...LEASE_TOOLS,
11904
+ ...BIDI_BROWSER_TOOLS,
11477
11905
  extract_page: extractPage
11478
11906
  };
11479
11907
 
@@ -11755,7 +12183,7 @@ var TOOL_DOCS = {
11755
12183
  }
11756
12184
  },
11757
12185
  dispatch_mouse: {
11758
- description: "Dispatches one raw mouse event (move/down/up) at absolute viewport coordinates — the toolkit's lowest-level input primitive. Compose move/down/move/up calls yourself for anything click/drag's fixed sequences can't reach: canvas drag-painting, marquee/rubber-band selection, custom hit-testing widgets. Chrome-only: absent from tools/list under the Firefox backend, never present-and-throwing.",
12186
+ description: "Dispatches one raw mouse event (move/down/up) at absolute viewport coordinates — the toolkit's lowest-level input primitive. Compose move/down/move/up calls yourself for anything click/drag's fixed sequences can't reach: canvas drag-painting, marquee/rubber-band selection, custom hit-testing widgets. Works on Chrome and on Firefox 160 or newer (WebDriver BiDi: a press held by 'down' in one call is released by 'up' in a later call); an older Firefox gets an unsupported error naming the version.",
11759
12187
  params: {
11760
12188
  lease: "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.",
11761
12189
  target: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Prefix any of these with 'endpoint:<name>/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.",
@@ -11763,7 +12191,7 @@ var TOOL_DOCS = {
11763
12191
  x: "Viewport x-coordinate. Required every call — CDP has no 'current pointer position' to default from.",
11764
12192
  y: "Viewport y-coordinate. Required every call.",
11765
12193
  button: "Mouse button: 'left' (default), 'right', or 'middle'.",
11766
- clickCount: "Click-run length for a 'down' or 'up' event (2 = second half of a double-click, 3 = triple-click). Ignored for 'move'; defaults to 1.",
12194
+ clickCount: "Click-run length for a 'down' or 'up' event (2 = second half of a double-click, 3 = triple-click). Ignored for 'move'; defaults to 1. Ignored on Firefox (click counts follow native timing).",
11767
12195
  modifiers: "Modifier keys held for this one event, e.g. ['Shift']."
11768
12196
  }
11769
12197
  },
@@ -11788,7 +12216,7 @@ var TOOL_DOCS = {
11788
12216
  }
11789
12217
  },
11790
12218
  wait_for_download: {
11791
- description: "Wait for a file download to finish and return it as a real file on disk: {path,suggestedFilename,bytes,url,target}, written under the artifact dir's downloads/. ORDERING RULE, not optional: capture must be ARMED BEFORE the click that starts the download — call wait_for_download{arm:true} first (returns {armed:true,downloadPath,pending}), then click, then call again to collect the file. The download-behavior override is per-connection state Chrome REVERTS the moment the arming client disconnects, and an unarmed headless Chrome denies the download outright, so one triggered before arming is lost. SIDE EFFECT, browser-global: arming redirects EVERY download in this browser (all tabs, all origins) into the toolkit's downloads dir until this server exits — they no longer land in the user's normal Downloads folder. The arm lives on a connection this server holds open (an MCP-server capability): under the one-shot CLI the connection dies with the process and nothing is captured. Chrome-only (capability 'browser.downloads'): absent from tools/list under Firefox.",
12219
+ description: "Wait for a file download to finish and return it as a real file on disk: {path,suggestedFilename,bytes,url,target}, written under the artifact dir's downloads/. ORDERING RULE, not optional: capture must be ARMED BEFORE the click that starts the download — call wait_for_download{arm:true} first (returns {armed:true,downloadPath,pending}), then click, then call again to collect the file. The download-behavior override is per-connection state Chrome REVERTS the moment the arming client disconnects, and an unarmed headless Chrome denies the download outright, so one triggered before arming is lost. SIDE EFFECT, browser-global: arming redirects EVERY download in this browser (all tabs, all origins) into the toolkit's downloads dir until this server exits — they no longer land in the user's normal Downloads folder. The arm lives on a connection this server holds open (an MCP-server capability): under the one-shot CLI the connection dies with the process and nothing is captured. Capability 'browser.downloads': Chrome, and Firefox 160+ (an older Firefox is refused as unsupported). FIREFOX DIFFERS: every call arms, and a collecting call (no arm:true) RESTORES Firefox's normal download behavior when it returns or times out, so arm again before every later download.",
11792
12220
  params: {
11793
12221
  lease: "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.",
11794
12222
  target: "Names the tab for the lease check and the echoed target — a download is browser-scoped, so this does not pick which download is returned. Grammar: server instructions.",
@@ -11797,7 +12225,7 @@ var TOOL_DOCS = {
11797
12225
  }
11798
12226
  },
11799
12227
  grant_permissions: {
11800
- description: "Grant browser permissions for an origin up front, so a page asking for geolocation / notifications / clipboard gets an answer instead of a prompt no agent can click. 'permissions' takes CDP PermissionType values ('geolocation','notifications','clipboardReadWrite','camera',...); an unknown name is refused by Chrome, quoting the bad value. Returns {granted,origin,target}, or {reset:true,target} for a reset-only call. Grants are keyed by ORIGIN, not by tab: every tab on that origin is affected, including ones opened later. reset:true clears this server's previous grants first (or instead, when no permissions are given) — CDP's reset is not origin-scoped, so it clears them for every origin at once. The grant lives on a connection this server holds open and Chrome DISCARDS IT when that connection closes: an MCP-server capability, so under the one-shot CLI the grant dies with the process. Chrome-only (capability 'browser.permissions'): absent from tools/list under Firefox, never present-and-throwing.",
12228
+ description: "Grant browser permissions for an origin up front, so a page asking for geolocation / notifications / clipboard gets an answer instead of a prompt no agent can click. 'permissions' takes CDP PermissionType values ('geolocation','notifications','clipboardReadWrite','camera',...); an unknown name is refused by Chrome, quoting the bad value. Returns {granted,origin,target}, or {reset:true,target} for a reset-only call. Grants are keyed by ORIGIN, not by tab: every tab on that origin is affected, including ones opened later. reset:true clears this server's previous grants first (or instead, when no permissions are given) — CDP's reset is not origin-scoped, so it clears them for every origin at once. The grant lives on a connection this server holds open and Chrome DISCARDS IT when that connection closes: an MCP-server capability, so under the one-shot CLI the grant dies with the process. Capability 'browser.permissions': Chrome, and Firefox 160+ (an older Firefox is refused as unsupported). FIREFOX DIFFERS: only geolocation, notifications, audioCapture, videoCapture, durableStorage, midi, midiSysex, wakeLockScreen map to a Firefox permission (any other name, e.g. clipboardReadWrite, is refused as unsupported); Firefox stores grants in the profile, so this server undoes them on reset:true and at shutdown (back to the state the page reported before the grant, or 'prompt' for another origin).",
11801
12229
  params: {
11802
12230
  lease: "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.",
11803
12231
  target: "Also the origin source when 'origin' is omitted. Grammar: server instructions.",
@@ -11861,7 +12289,7 @@ var TOOL_DOCS = {
11861
12289
  format: "Image format, default png. quality applies only to jpeg.",
11862
12290
  quality: "JPEG quality 0-100, default 80; ignored for png.",
11863
12291
  fullPage: "Capture the full scrollable height (via Page.getLayoutMetrics), not just the viewport.",
11864
- scale: "Output-pixel multiplier for this capture only (0<scale<=8, default 1): output px = ceil(css px x scale x devicePixelRatio); the page is never told anything changed. Chrome only (screenshot.scale) — Firefox BiDi has no scale param, use emulate{deviceScaleFactor} then scale:1. A projection over 16384 device px/side is refused up front, naming the largest scale that fits.",
12292
+ scale: "Output-pixel multiplier for this capture only (0<scale<=8, default 1): output px = ceil(css px x scale x devicePixelRatio); the page is never told anything changed. Needs capability screenshot.scale: Chrome, and Firefox 160 or newer (an older Firefox: emulate{deviceScaleFactor} then scale:1). A projection over 16384 device px/side is refused up front, naming the largest scale that fits.",
11865
12293
  renderWidth: "Emulates this viewport width (CSS px, 1-16384) for one capture, then restores it. Required with renderHeight. Unlike scale, this changes what the page believes (media queries re-flow) — e.g. capture a responsive page at 1920x1080 from a differently-sized tab. Restore only works for an override this toolkit itself set; check result.renderRestored (false = still emulated, fix via emulate). Works on both backends (capability screenshot.renderSize).",
11866
12294
  renderHeight: "Emulates this viewport height (CSS px, 1-16384) for one capture. Required with renderWidth — a viewport is two numbers. A narrow renderWidth often reflows pages TALLER, which is the usual way a render-size capture trips the 16384px encode limit.",
11867
12295
  tile: "Whether to allow vertical-band stitching: omitted=AUTO (band only if a single shot wouldn't fit), false=never band (refuse instead), true=always band (Chrome-only capability). Banded output is PNG-only, can't returnBase64, and only bands on HEIGHT (oversized WIDTH is refused, not split). Bands are a faithful crop, but lazy/virtualized content the real viewport never scrolled to renders blank.",
@@ -12195,7 +12623,7 @@ function toolAnnotations(name) {
12195
12623
  }
12196
12624
 
12197
12625
  // src/version.ts
12198
- var VERSION = "3.2.0";
12626
+ var VERSION = "3.3.0";
12199
12627
 
12200
12628
  // src/mcp.ts
12201
12629
  function isDirectRun() {