cdp-toolkit 3.5.0 → 3.6.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
@@ -591,6 +591,15 @@ var init_leases = __esm(() => {
591
591
  LEASE_FILE_RE = new RegExp(`^lease-(${BACKEND_KEY_SOURCE})-(.+)\\.json$`);
592
592
  });
593
593
 
594
+ // src/focusPolicy.ts
595
+ function focusDenied() {
596
+ return TRUTHY.has((process.env.CDP_DENY_FOCUS ?? "").trim().toLowerCase());
597
+ }
598
+ var TRUTHY;
599
+ var init_focusPolicy = __esm(() => {
600
+ TRUTHY = new Set(["1", "true", "yes", "on"]);
601
+ });
602
+
594
603
  // src/origins.ts
595
604
  import { mkdir as mkdir2, readFile as readFile2, readdir as readdir2, unlink as unlink2, writeFile as writeFile2 } from "node:fs/promises";
596
605
  import { join as join2 } from "node:path";
@@ -690,7 +699,7 @@ async function originIndex(backend, liveIds) {
690
699
  return index;
691
700
  }
692
701
  async function newTrackedPage(driver, backend, opts = {}) {
693
- const page = await driver.newPage(opts.url, { focus: opts.focus === true });
702
+ const page = await driver.newPage(opts.url, { focus: opts.focus === true && !focusDenied() });
694
703
  await recordOrigin(backend, page.id, { label: opts.label });
695
704
  return page;
696
705
  }
@@ -717,6 +726,7 @@ async function resolveLiveLabel(backend, label, liveIds) {
717
726
  }
718
727
  var ORIGIN_FILE_RE;
719
728
  var init_origins = __esm(() => {
729
+ init_focusPolicy();
720
730
  init_leases();
721
731
  ORIGIN_FILE_RE = new RegExp(`^origin-(${BACKEND_KEY_SOURCE})-(.+)\\.json$`);
722
732
  });
@@ -1006,7 +1016,7 @@ var init_session = __esm(() => {
1006
1016
 
1007
1017
  // src/cdp/hiddenTabs.ts
1008
1018
  function hiddenTabsRequested() {
1009
- return TRUTHY.has((process.env.CDP_HIDDEN_TABS ?? "").trim().toLowerCase());
1019
+ return TRUTHY2.has((process.env.CDP_HIDDEN_TABS ?? "").trim().toLowerCase());
1010
1020
  }
1011
1021
  function hiddenTabsMax() {
1012
1022
  const raw = Number(process.env.CDP_HIDDEN_TABS_MAX);
@@ -1145,10 +1155,10 @@ async function disposeHiddenTabs() {
1145
1155
  owners.clear();
1146
1156
  await Promise.all(all.map((o) => o.dispose()));
1147
1157
  }
1148
- var DEFAULT_HIDDEN_TABS_MAX = 20, HIDDEN_TAB_VIEWPORT, FALLBACK_DEVICE_SCALE_FACTOR = 2, OWNER_COMMAND_TIMEOUT_MS = 5000, TRUTHY, HiddenTabCapError, owners;
1158
+ var DEFAULT_HIDDEN_TABS_MAX = 20, HIDDEN_TAB_VIEWPORT, FALLBACK_DEVICE_SCALE_FACTOR = 2, OWNER_COMMAND_TIMEOUT_MS = 5000, TRUTHY2, HiddenTabCapError, owners;
1149
1159
  var init_hiddenTabs = __esm(() => {
1150
1160
  HIDDEN_TAB_VIEWPORT = { width: 1280, height: 800 };
1151
- TRUTHY = new Set(["1", "true", "yes", "on"]);
1161
+ TRUTHY2 = new Set(["1", "true", "yes", "on"]);
1152
1162
  HiddenTabCapError = class HiddenTabCapError extends Error {
1153
1163
  max;
1154
1164
  openIds;
@@ -1892,7 +1902,10 @@ var init_driver = __esm(() => {
1892
1902
  focus_emulation: ["emulate.focus"],
1893
1903
  click_focus_gated: ["emulate.focus"],
1894
1904
  wait_for_download: ["browser.downloads"],
1895
- grant_permissions: ["browser.permissions"]
1905
+ grant_permissions: ["browser.permissions"],
1906
+ list_tab_groups: ["browser.tabGroups"],
1907
+ group_tabs: ["browser.tabGroups"],
1908
+ ungroup_tabs: ["browser.tabGroups"]
1896
1909
  };
1897
1910
  });
1898
1911
 
@@ -2410,16 +2423,16 @@ var init_client2 = __esm(() => {
2410
2423
  });
2411
2424
 
2412
2425
  // src/bidi/session-lease.ts
2413
- import { mkdir as mkdir13, readFile as readFile9, rename as rename3, unlink as unlink5, writeFile as writeFile10 } from "node:fs/promises";
2414
- import { join as join12 } from "node:path";
2426
+ import { mkdir as mkdir14, readFile as readFile10, rename as rename3, unlink as unlink5, writeFile as writeFile11 } from "node:fs/promises";
2427
+ import { join as join13 } from "node:path";
2415
2428
  function safeEndpoint(endpoint) {
2416
2429
  return endpoint.replace(/[^A-Za-z0-9._-]/g, "_");
2417
2430
  }
2418
2431
  function sessionSlotFile(endpoint) {
2419
- return join12(leaseDir(), `ff-session-${safeEndpoint(endpoint)}.json`);
2432
+ return join13(leaseDir(), `ff-session-${safeEndpoint(endpoint)}.json`);
2420
2433
  }
2421
2434
  function muxDaemonLogFile(endpoint) {
2422
- return join12(leaseDir(), `ff-mux-${safeEndpoint(endpoint)}.log`);
2435
+ return join13(leaseDir(), `ff-mux-${safeEndpoint(endpoint)}.log`);
2423
2436
  }
2424
2437
  function sessionWaitMs() {
2425
2438
  const raw = Number(process.env.CDP_FIREFOX_SESSION_WAIT_MS);
@@ -2428,7 +2441,7 @@ function sessionWaitMs() {
2428
2441
  async function readSessionSlot(endpoint) {
2429
2442
  let raw;
2430
2443
  try {
2431
- raw = await readFile9(sessionSlotFile(endpoint), "utf8");
2444
+ raw = await readFile10(sessionSlotFile(endpoint), "utf8");
2432
2445
  } catch (err) {
2433
2446
  if (err.code === "ENOENT")
2434
2447
  return;
@@ -2457,7 +2470,7 @@ async function acquireSessionSlot(endpoint, opts) {
2457
2470
  record.marionettePort = opts.marionettePort;
2458
2471
  const handle = { endpoint, pid: process.pid, createdAt };
2459
2472
  const payload = JSON.stringify(record);
2460
- await mkdir13(leaseDir(), { recursive: true });
2473
+ await mkdir14(leaseDir(), { recursive: true });
2461
2474
  const deadline = Date.now() + waitMs;
2462
2475
  const maxAttempts = Math.max(100, Math.ceil(waitMs / pollMs) + 100);
2463
2476
  let attempts = 0;
@@ -2467,7 +2480,7 @@ async function acquireSessionSlot(endpoint, opts) {
2467
2480
  throw new SessionSlotBusyError(endpoint, lastLiveHolder);
2468
2481
  attempts++;
2469
2482
  try {
2470
- await writeFile10(file, payload, { flag: "wx" });
2483
+ await writeFile11(file, payload, { flag: "wx" });
2471
2484
  return { handle };
2472
2485
  } catch (err) {
2473
2486
  if (err.code !== "EEXIST")
@@ -2481,7 +2494,7 @@ async function acquireSessionSlot(endpoint, opts) {
2481
2494
  return;
2482
2495
  });
2483
2496
  try {
2484
- await writeFile10(file, payload, { flag: "wx" });
2497
+ await writeFile11(file, payload, { flag: "wx" });
2485
2498
  return { handle, staleHolder: holder };
2486
2499
  } catch (err) {
2487
2500
  if (err.code !== "EEXIST")
@@ -2509,7 +2522,7 @@ async function advertiseMux(handle, muxEndpoint) {
2509
2522
  const tmp = `${file}.tmp-${process.pid}`;
2510
2523
  const next = { ...current, muxEndpoint };
2511
2524
  try {
2512
- await writeFile10(tmp, JSON.stringify(next), "utf8");
2525
+ await writeFile11(tmp, JSON.stringify(next), "utf8");
2513
2526
  await rename3(tmp, file);
2514
2527
  } catch {
2515
2528
  await unlink5(tmp).catch(() => {
@@ -2555,9 +2568,9 @@ var init_session_lease = __esm(() => {
2555
2568
 
2556
2569
  // src/bidi/mux.ts
2557
2570
  import { createServer } from "node:net";
2558
- import { createHash } from "node:crypto";
2571
+ import { createHash as createHash2 } from "node:crypto";
2559
2572
  function acceptKey(key) {
2560
- return createHash("sha1").update(key + WS_GUID).digest("base64");
2573
+ return createHash2("sha1").update(key + WS_GUID).digest("base64");
2561
2574
  }
2562
2575
  function encodeFrame(opcode, payload) {
2563
2576
  const len = payload.length;
@@ -5220,6 +5233,7 @@ var CDP_CAPABILITIES = new Set([
5220
5233
  "emulate.focus",
5221
5234
  "browser.downloads",
5222
5235
  "browser.permissions",
5236
+ "browser.tabGroups",
5223
5237
  "worker.targets",
5224
5238
  "frame.targets"
5225
5239
  ]);
@@ -6132,6 +6146,7 @@ async function reapStaleAgentTabs(driver, backend) {
6132
6146
  }
6133
6147
 
6134
6148
  // src/shared-tools.ts
6149
+ init_focusPolicy();
6135
6150
  init_driver();
6136
6151
  import { mkdir as mkdir5, writeFile as writeFile4 } from "node:fs/promises";
6137
6152
  import { dirname as dirname2, join as join5 } from "node:path";
@@ -6815,7 +6830,10 @@ async function listPagesOne(driver, args = {}) {
6815
6830
  async function newPage(driver, args = {}) {
6816
6831
  const label = typeof args.label === "string" && args.label.length ? args.label : defaultLabel();
6817
6832
  const p = await newTrackedPage(driver, backendOf(driver), { url: args.url, label, focus: args.focus === true });
6818
- const hidden = p.hidden === true ? { hidden: true } : {};
6833
+ const hidden = {
6834
+ ...p.hidden === true ? { hidden: true } : {},
6835
+ ...args.focus === true && focusDenied() ? { focusDenied: true } : {}
6836
+ };
6819
6837
  const explicit = args.claim === true;
6820
6838
  if (!explicit && !requireLease())
6821
6839
  return { targetId: p.id, url: p.url, ...hidden };
@@ -6846,9 +6864,9 @@ async function selectPage(driver, args) {
6846
6864
  if (args.target === undefined || args.target === "")
6847
6865
  throw new SharedToolError("select_page requires an explicit target");
6848
6866
  const p = await resolvePage(driver, args.target);
6849
- if (args.focus !== true) {
6867
+ if (args.focus !== true || focusDenied()) {
6850
6868
  await writeSelectedFile(p.id);
6851
- return { selected: p.id, focused: false };
6869
+ return { selected: p.id, focused: false, ...args.focus === true ? { focusDenied: true } : {} };
6852
6870
  }
6853
6871
  const shown = await driver.activatePage(p.id);
6854
6872
  if (shown.revealedFrom === undefined || shown.id === p.id) {
@@ -7283,7 +7301,7 @@ async function pressKey(driver, args) {
7283
7301
  pressed: args.key,
7284
7302
  modifiers,
7285
7303
  delivered: false,
7286
- note: "the page saw no keydown: a background tab gets no trusted keyboard input. A click on the tab's page (click tool) usually gives it focus so keys land; or open the tab with new_page focus:true. A key handled inside a cross-origin iframe also reads as not delivered."
7304
+ note: "the page saw no keydown: a background tab gets no trusted keyboard input. A click on the tab's page (click tool) usually gives it focus so keys land; or open the tab with new_page focus:true (which raises the browser over the user's work; refused under CDP_DENY_FOCUS). A key handled inside a cross-origin iframe also reads as not delivered."
7287
7305
  };
7288
7306
  }
7289
7307
  return { pressed: args.key, modifiers };
@@ -8285,6 +8303,7 @@ async function performanceAnalyzeInsight(args = {}) {
8285
8303
  }
8286
8304
 
8287
8305
  // src/tools/screencast.ts
8306
+ init_focusPolicy();
8288
8307
  init_client();
8289
8308
  import { spawn } from "node:child_process";
8290
8309
  import { mkdir as mkdir8, rm as rm2, stat as stat2, writeFile as writeFile7 } from "node:fs/promises";
@@ -8585,7 +8604,7 @@ async function startScreenRecording(args = {}) {
8585
8604
  });
8586
8605
  try {
8587
8606
  await conn.send("Page.enable");
8588
- if (args.bringToFront)
8607
+ if (args.bringToFront && !focusDenied())
8589
8608
  await conn.send("Page.bringToFront").catch(() => {});
8590
8609
  const params = { format };
8591
8610
  if (format === "jpeg" && args.quality !== undefined)
@@ -9231,11 +9250,302 @@ async function grantPermissions(args = {}) {
9231
9250
  return { granted: [...permissions], origin, ...reset ? { reset: true } : {}, target };
9232
9251
  }
9233
9252
 
9234
- // src/tools/extract.ts
9253
+ // src/tools/tab-groups.ts
9235
9254
  init_client();
9236
- import { mkdir as mkdir12, writeFile as writeFile9 } from "node:fs/promises";
9237
- import { dirname as dirname3, join as join11 } from "node:path";
9255
+ import { createHash } from "node:crypto";
9256
+ import { mkdir as mkdir12, readFile as readFile9, writeFile as writeFile9 } from "node:fs/promises";
9257
+ import { join as join11 } from "node:path";
9238
9258
  var ARTIFACT_DIR7 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
9259
+ var HELPER_DIR = join11(ARTIFACT_DIR7, "tab-groups-helper");
9260
+ var TAB_GROUP_COLORS = ["grey", "blue", "red", "yellow", "green", "pink", "purple", "cyan", "orange"];
9261
+ var HELPER_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqesYyi7LmBxzWP7VFJGlH2khinCz0uU2z3KNDvZ3Kb8gTLPpthgRWp27pu5/Wk2nvQJdcrunf6u5vqomH2xhvXIqjgXtth2o1GrE6oJMWRUqEoC7I4YUXdSieRpxAxtG37KiSFOyFOU59Som3gGOM2j1qlQIsID0QwRCeRs095SLoTtkA6YwZxtOETgvZAhbbpkmYwkXjTzgY85sS1JfMYj67cmfyz/Nt6yfORSJYEmWAfGCjQnvtOn9TjCazZvmoASUhsKZNZVWckAg+Md+ZKBPbl14/UUwLmWHQ7SDcJozHZtFeLFXySwvmBm3NhP1rK5vd/v+modsQY3M3DbqLQIDAQAB";
9262
+ var HELPER_MANIFEST = {
9263
+ manifest_version: 3,
9264
+ name: "cdp-toolkit tab groups",
9265
+ description: "Helper installed by cdp-toolkit's tab-group tools (list_tab_groups, group_tabs, ungroup_tabs). No UI, no state.",
9266
+ version: "1.0.0",
9267
+ key: HELPER_KEY,
9268
+ permissions: ["tabs", "tabGroups", "debugger"],
9269
+ background: { service_worker: "sw.js" }
9270
+ };
9271
+ function extensionIdFromKey(keyBase64) {
9272
+ const hex = createHash("sha256").update(Buffer.from(keyBase64, "base64")).digest("hex").slice(0, 32);
9273
+ return [...hex].map((c) => String.fromCharCode(97 + parseInt(c, 16))).join("");
9274
+ }
9275
+ var HELPER_EXTENSION_ID = extensionIdFromKey(HELPER_KEY);
9276
+ var HELPER_SW_BODY = String.raw`
9277
+ const NONE = -1;
9278
+
9279
+ async function targetIdsByTab() {
9280
+ const m = new Map();
9281
+ try {
9282
+ for (const t of await chrome.debugger.getTargets()) {
9283
+ if (t.type === "page" && typeof t.tabId === "number") m.set(t.tabId, t.id);
9284
+ }
9285
+ } catch (e) {
9286
+ // No mapping is a degraded answer (rows lack targetId), not a failure of the listing.
9287
+ }
9288
+ return m;
9289
+ }
9290
+
9291
+ function row(t, m) {
9292
+ return { tabId: t.id, targetId: m.get(t.id), index: t.index, url: t.url || t.pendingUrl || "", title: t.title || "" };
9293
+ }
9294
+
9295
+ const byPlace = (a, b) => a.windowId - b.windowId || a.index - b.index;
9296
+
9297
+ async function list(args) {
9298
+ const q = args && args.windowId !== undefined ? { windowId: args.windowId } : {};
9299
+ const [tabs, groups, m] = await Promise.all([chrome.tabs.query(q), chrome.tabGroups.query(q), targetIdsByTab()]);
9300
+ const wins = new Map();
9301
+ for (const t of tabs.slice().sort(byPlace)) {
9302
+ let w = wins.get(t.windowId);
9303
+ if (!w) wins.set(t.windowId, (w = { windowId: t.windowId, tabCount: 0, ungrouped: 0, groups: [] }));
9304
+ w.tabCount++;
9305
+ if (t.groupId === NONE || t.groupId === undefined) {
9306
+ w.ungrouped++;
9307
+ if (args && args.includeUngrouped) (w.ungroupedTabs || (w.ungroupedTabs = [])).push(row(t, m));
9308
+ continue;
9309
+ }
9310
+ let g = w.groups.find((x) => x.groupId === t.groupId);
9311
+ if (!g) {
9312
+ const info = groups.find((x) => x.id === t.groupId) || {};
9313
+ g = { groupId: t.groupId, title: info.title || "", color: info.color, collapsed: !!info.collapsed, tabs: [] };
9314
+ w.groups.push(g);
9315
+ }
9316
+ g.tabs.push(row(t, m));
9317
+ }
9318
+ const windows = [...wins.values()];
9319
+ return {
9320
+ windows,
9321
+ groupCount: windows.reduce((n, w) => n + w.groups.length, 0),
9322
+ tabCount: tabs.length,
9323
+ };
9324
+ }
9325
+
9326
+ async function selectTabs(args, m) {
9327
+ if (Array.isArray(args.tabIds)) {
9328
+ const out = [];
9329
+ for (const id of args.tabIds) {
9330
+ try { out.push(await chrome.tabs.get(id)); }
9331
+ catch (e) { throw new Error("no tab with tabId " + id + " (tab ids come from list_tab_groups)"); }
9332
+ }
9333
+ return out;
9334
+ }
9335
+ if (Array.isArray(args.targetIds)) {
9336
+ const byTarget = new Map([...m].map(([tabId, targetId]) => [targetId, tabId]));
9337
+ const out = [];
9338
+ for (const tid of args.targetIds) {
9339
+ const id = byTarget.get(tid);
9340
+ if (id === undefined) throw new Error("no tab with targetId " + tid + " (a page's CDP target id, as list_pages shows it)");
9341
+ out.push(await chrome.tabs.get(id));
9342
+ }
9343
+ return out;
9344
+ }
9345
+ const all = (await chrome.tabs.query({})).sort(byPlace);
9346
+ if (typeof args.urlMatch === "string") {
9347
+ const hit = all.filter((t) => (t.url || "").includes(args.urlMatch) || (t.pendingUrl || "").includes(args.urlMatch));
9348
+ if (!hit.length) throw new Error("urlMatch " + JSON.stringify(args.urlMatch) + " matched no tab");
9349
+ return hit;
9350
+ }
9351
+ if (typeof args.groupId === "number") {
9352
+ await chrome.tabGroups.get(args.groupId).catch(() => { throw new Error("no tab group with groupId " + args.groupId); });
9353
+ return all.filter((t) => t.groupId === args.groupId);
9354
+ }
9355
+ throw new Error("no tab selector given");
9356
+ }
9357
+
9358
+ async function group(args) {
9359
+ const m = await targetIdsByTab();
9360
+ const tabs = await selectTabs(args, m);
9361
+ let win;
9362
+ if (args.groupId !== undefined) {
9363
+ win = (await chrome.tabGroups.get(args.groupId).catch(() => { throw new Error("no tab group with groupId " + args.groupId); })).windowId;
9364
+ } else if (args.windowId !== undefined) {
9365
+ win = args.windowId;
9366
+ } else {
9367
+ const ws = [...new Set(tabs.map((t) => t.windowId))];
9368
+ if (ws.length > 1) {
9369
+ throw new Error(
9370
+ "the selected tabs are in " + ws.length + " windows (" + ws.join(", ") + "); pass windowId to name the window the group goes in " +
9371
+ "(tabs from other windows are moved there). Without it Chrome would move them all into the last-focused window.",
9372
+ );
9373
+ }
9374
+ win = ws[0];
9375
+ }
9376
+ const moved = tabs.filter((t) => t.windowId !== win).map((t) => ({ tabId: t.id, fromWindowId: t.windowId }));
9377
+ const opts = { tabIds: tabs.map((t) => t.id) };
9378
+ if (args.groupId !== undefined) opts.groupId = args.groupId;
9379
+ else opts.createProperties = { windowId: win };
9380
+ const gid = await chrome.tabs.group(opts);
9381
+ const upd = {};
9382
+ if (args.title !== undefined) upd.title = args.title;
9383
+ if (args.color !== undefined) upd.color = args.color;
9384
+ if (args.collapsed !== undefined) upd.collapsed = args.collapsed;
9385
+ const g = Object.keys(upd).length ? await chrome.tabGroups.update(gid, upd) : await chrome.tabGroups.get(gid);
9386
+ const members = g.windowId > 0 ? (await chrome.tabs.query({ windowId: g.windowId })).filter((t) => t.groupId === gid).sort(byPlace) : [];
9387
+ if (members.length === 0) {
9388
+ // Vivaldi answers chrome.tabs.group with an id but keeps its own tab stacks: the "group" has
9389
+ // windowId -1 and no tabs. Fail loudly rather than report a group that does not exist.
9390
+ throw new Error("the browser accepted chrome.tabs.group but created no visible group (windowId " + g.windowId + ", 0 tabs); this browser does not support Chrome tab groups (Vivaldi uses its own tab stacks)");
9391
+ }
9392
+ return { groupId: gid, windowId: g.windowId, title: g.title || "", color: g.color, collapsed: !!g.collapsed, tabs: members.map((t) => row(t, m)), moved };
9393
+ }
9394
+
9395
+ async function ungroup(args) {
9396
+ const m = await targetIdsByTab();
9397
+ const tabs = await selectTabs(args, m);
9398
+ const grouped = tabs.filter((t) => t.groupId !== NONE && t.groupId !== undefined);
9399
+ if (grouped.length) await chrome.tabs.ungroup(grouped.map((t) => t.id));
9400
+ return {
9401
+ ungrouped: grouped.map((t) => Object.assign(row(t, m), { fromGroupId: t.groupId })),
9402
+ alreadyUngrouped: tabs.filter((t) => !grouped.includes(t)).map((t) => t.id),
9403
+ };
9404
+ }
9405
+
9406
+ self.cdpToolkitTabGroups = { version: VERSION, list, group, ungroup };
9407
+ `;
9408
+ var HELPER_VERSION = createHash("sha256").update(HELPER_SW_BODY).digest("hex").slice(0, 12);
9409
+ var HELPER_SW_SOURCE = `"use strict";
9410
+ const VERSION = ${JSON.stringify(HELPER_VERSION)};
9411
+ ${HELPER_SW_BODY}`;
9412
+ var isInt = (v) => typeof v === "number" && Number.isInteger(v);
9413
+ function checkInt(tool, name, v) {
9414
+ if (v !== undefined && !isInt(v))
9415
+ throw new Error(`${tool}: '${name}' must be an integer (got ${JSON.stringify(v)})`);
9416
+ }
9417
+ function checkSelector(tool, a, withGroupId) {
9418
+ const given = [
9419
+ a.tabIds !== undefined && "tabIds",
9420
+ a.targetIds !== undefined && "targetIds",
9421
+ typeof a.urlMatch === "string" && a.urlMatch !== "" && "urlMatch",
9422
+ withGroupId && a.groupId !== undefined && "groupId"
9423
+ ].filter(Boolean);
9424
+ const names = withGroupId ? "tabIds, targetIds, urlMatch or groupId" : "tabIds, targetIds or urlMatch";
9425
+ if (given.length !== 1)
9426
+ throw new Error(`${tool}: give exactly one of ${names} (got ${given.length ? given.join(" + ") : "none"})`);
9427
+ if (a.tabIds !== undefined) {
9428
+ if (!Array.isArray(a.tabIds) || a.tabIds.length === 0 || !a.tabIds.every(isInt)) {
9429
+ throw new Error(`${tool}: 'tabIds' must be a non-empty array of integer chrome tab ids (got ${JSON.stringify(a.tabIds)})`);
9430
+ }
9431
+ }
9432
+ if (a.targetIds !== undefined) {
9433
+ if (!Array.isArray(a.targetIds) || a.targetIds.length === 0 || !a.targetIds.every((t) => typeof t === "string" && t !== "")) {
9434
+ throw new Error(`${tool}: 'targetIds' must be a non-empty array of CDP target id strings (got ${JSON.stringify(a.targetIds)})`);
9435
+ }
9436
+ }
9437
+ }
9438
+ function validateListTabGroupsArgs(a) {
9439
+ checkInt("list_tab_groups", "windowId", a.windowId);
9440
+ if (a.includeUngrouped !== undefined && typeof a.includeUngrouped !== "boolean") {
9441
+ throw new Error("list_tab_groups: 'includeUngrouped' must be a boolean");
9442
+ }
9443
+ }
9444
+ function validateGroupTabsArgs(a) {
9445
+ const tool = "group_tabs";
9446
+ checkSelector(tool, a, false);
9447
+ checkInt(tool, "groupId", a.groupId);
9448
+ checkInt(tool, "windowId", a.windowId);
9449
+ if (a.groupId !== undefined && a.windowId !== undefined) {
9450
+ throw new Error(`${tool}: give groupId (add to that group, in its window) or windowId (new group in that window), not both`);
9451
+ }
9452
+ if (a.title !== undefined && typeof a.title !== "string")
9453
+ throw new Error(`${tool}: 'title' must be a string`);
9454
+ if (a.collapsed !== undefined && typeof a.collapsed !== "boolean")
9455
+ throw new Error(`${tool}: 'collapsed' must be a boolean`);
9456
+ if (a.color !== undefined && !TAB_GROUP_COLORS.includes(a.color)) {
9457
+ throw new Error(`${tool}: 'color' must be one of ${TAB_GROUP_COLORS.join(", ")} (got ${JSON.stringify(a.color)})`);
9458
+ }
9459
+ }
9460
+ function validateUngroupTabsArgs(a) {
9461
+ checkSelector("ungroup_tabs", a, true);
9462
+ checkInt("ungroup_tabs", "groupId", a.groupId);
9463
+ }
9464
+ var SW_URL_PREFIX = `chrome-extension://${HELPER_EXTENSION_ID}/`;
9465
+ var WORKER_WAIT_MS = 5000;
9466
+ async function helperWorker() {
9467
+ return (await listTargets()).find((t) => t.type === "service_worker" && t.url.startsWith(SW_URL_PREFIX));
9468
+ }
9469
+ async function writeHelper() {
9470
+ await mkdir12(HELPER_DIR, { recursive: true });
9471
+ const files = {
9472
+ "manifest.json": JSON.stringify(HELPER_MANIFEST, null, 2),
9473
+ "sw.js": HELPER_SW_SOURCE
9474
+ };
9475
+ for (const [name, body] of Object.entries(files)) {
9476
+ const path = join11(HELPER_DIR, name);
9477
+ const current = await readFile9(path, "utf8").catch(() => {
9478
+ return;
9479
+ });
9480
+ if (current !== body)
9481
+ await writeFile9(path, body);
9482
+ }
9483
+ }
9484
+ async function evalIn(workerId, expression) {
9485
+ return withPage(workerId, async (conn) => {
9486
+ const r = await conn.send("Runtime.evaluate", { expression, awaitPromise: true, returnByValue: true });
9487
+ if (r.exceptionDetails) {
9488
+ const d = r.exceptionDetails.exception?.description ?? r.exceptionDetails.text ?? "error";
9489
+ throw new Error(d.split(`
9490
+ `)[0].replace(/^Error: /, ""));
9491
+ }
9492
+ return r.result?.value;
9493
+ });
9494
+ }
9495
+ async function currentHelperWorker() {
9496
+ const w = await helperWorker();
9497
+ if (!w)
9498
+ return;
9499
+ const v = await evalIn(w.id, "self.cdpToolkitTabGroups && self.cdpToolkitTabGroups.version").catch(() => {
9500
+ return;
9501
+ });
9502
+ return v === HELPER_VERSION ? w.id : undefined;
9503
+ }
9504
+ async function ensureHelper() {
9505
+ const existing = await currentHelperWorker();
9506
+ if (existing)
9507
+ return existing;
9508
+ await writeHelper();
9509
+ const conn = await openBrowser();
9510
+ try {
9511
+ await conn.send("Extensions.loadUnpacked", { path: HELPER_DIR });
9512
+ } catch (e) {
9513
+ const msg = e instanceof Error ? e.message : String(e);
9514
+ throw new CdpError(`tab-group tools could not install their helper extension (Extensions.loadUnpacked: ${msg}). ` + `They need a Chromium that allows loadUnpacked over CDP, with ${HELPER_DIR} on the browser's own machine.`);
9515
+ } finally {
9516
+ conn.close();
9517
+ }
9518
+ const deadline = Date.now() + WORKER_WAIT_MS;
9519
+ while (Date.now() < deadline) {
9520
+ const id = await currentHelperWorker();
9521
+ if (id)
9522
+ return id;
9523
+ await new Promise((r) => setTimeout(r, 100));
9524
+ }
9525
+ throw new CdpError(`the tab-groups helper extension installed but its service worker did not start within ${WORKER_WAIT_MS} ms`);
9526
+ }
9527
+ async function callHelper(op, args) {
9528
+ const id = await ensureHelper();
9529
+ return await evalIn(id, `self.cdpToolkitTabGroups.${op}(${JSON.stringify(args)})`);
9530
+ }
9531
+ async function listTabGroups(args = {}) {
9532
+ validateListTabGroupsArgs(args);
9533
+ return callHelper("list", { windowId: args.windowId, includeUngrouped: args.includeUngrouped });
9534
+ }
9535
+ async function groupTabs(args = {}) {
9536
+ validateGroupTabsArgs(args);
9537
+ return callHelper("group", args);
9538
+ }
9539
+ async function ungroupTabs(args = {}) {
9540
+ validateUngroupTabsArgs(args);
9541
+ return callHelper("ungroup", args);
9542
+ }
9543
+
9544
+ // src/tools/extract.ts
9545
+ init_client();
9546
+ import { mkdir as mkdir13, writeFile as writeFile10 } from "node:fs/promises";
9547
+ import { dirname as dirname3, join as join12 } from "node:path";
9548
+ var ARTIFACT_DIR8 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
9239
9549
  var DEFAULT_BASE_URL = "http://127.0.0.1:8090/v1";
9240
9550
  var DEFAULT_MODEL = "schematron";
9241
9551
  var DEFAULT_TIMEOUT_MS2 = 90000;
@@ -9635,10 +9945,10 @@ async function extractPage(driver, args) {
9635
9945
  };
9636
9946
  if (args.savePath === undefined || args.savePath === "")
9637
9947
  return result;
9638
- const path = args.savePath.startsWith("/") ? args.savePath : join11(ARTIFACT_DIR7, args.savePath);
9639
- await mkdir12(dirname3(path), { recursive: true });
9948
+ const path = args.savePath.startsWith("/") ? args.savePath : join12(ARTIFACT_DIR8, args.savePath);
9949
+ await mkdir13(dirname3(path), { recursive: true });
9640
9950
  const json = JSON.stringify(result, null, 2);
9641
- await writeFile9(path, json, "utf8");
9951
+ await writeFile10(path, json, "utf8");
9642
9952
  const saved = {
9643
9953
  path,
9644
9954
  bytes: Buffer.byteLength(json, "utf8"),
@@ -9701,6 +10011,9 @@ var TOOLS = {
9701
10011
  click_focus_gated: clickFocusGated,
9702
10012
  wait_for_download: waitForDownload,
9703
10013
  grant_permissions: grantPermissions,
10014
+ list_tab_groups: listTabGroups,
10015
+ group_tabs: groupTabs,
10016
+ ungroup_tabs: ungroupTabs,
9704
10017
  extract_page: onCdp(extractPage),
9705
10018
  claim_page: onCdp(LEASE_TOOLS.claim_page),
9706
10019
  release_page: onCdp(LEASE_TOOLS.release_page),
@@ -10506,6 +10819,130 @@ var MANIFEST = [
10506
10819
  additionalProperties: false
10507
10820
  }
10508
10821
  },
10822
+ {
10823
+ name: "list_tab_groups",
10824
+ description: "List tab groups per window with member tabs (Chrome only, via a helper extension).",
10825
+ inputSchema: {
10826
+ type: "object",
10827
+ properties: {
10828
+ endpoint: {
10829
+ type: "string",
10830
+ description: "Named CDP endpoint (CDP_ENDPOINTS); default endpoint when omitted."
10831
+ },
10832
+ windowId: {
10833
+ type: "integer",
10834
+ description: "Only this window."
10835
+ },
10836
+ includeUngrouped: {
10837
+ type: "boolean",
10838
+ description: "Also list ungrouped tabs per window."
10839
+ }
10840
+ },
10841
+ required: [],
10842
+ additionalProperties: false
10843
+ }
10844
+ },
10845
+ {
10846
+ name: "group_tabs",
10847
+ description: "Group tabs (new or existing group) and set title/color/collapsed (Chrome only).",
10848
+ inputSchema: {
10849
+ type: "object",
10850
+ properties: {
10851
+ endpoint: {
10852
+ type: "string",
10853
+ description: "Named CDP endpoint (CDP_ENDPOINTS); default endpoint when omitted."
10854
+ },
10855
+ tabIds: {
10856
+ type: "array",
10857
+ items: {
10858
+ type: "integer"
10859
+ },
10860
+ description: "Chrome tab ids (from list_tab_groups)."
10861
+ },
10862
+ targetIds: {
10863
+ type: "array",
10864
+ items: {
10865
+ type: "string"
10866
+ },
10867
+ description: "CDP target ids (list_pages ids)."
10868
+ },
10869
+ urlMatch: {
10870
+ type: "string",
10871
+ description: "URL substring; matches tabs in every window."
10872
+ },
10873
+ title: {
10874
+ type: "string",
10875
+ description: "Group title."
10876
+ },
10877
+ color: {
10878
+ type: "string",
10879
+ enum: [
10880
+ "grey",
10881
+ "blue",
10882
+ "red",
10883
+ "yellow",
10884
+ "green",
10885
+ "pink",
10886
+ "purple",
10887
+ "cyan",
10888
+ "orange"
10889
+ ],
10890
+ description: "Group color."
10891
+ },
10892
+ collapsed: {
10893
+ type: "boolean",
10894
+ description: "Collapse the group."
10895
+ },
10896
+ groupId: {
10897
+ type: "integer",
10898
+ description: "Add to this existing group."
10899
+ },
10900
+ windowId: {
10901
+ type: "integer",
10902
+ description: "Window for the new group; tabs elsewhere move there."
10903
+ }
10904
+ },
10905
+ required: [],
10906
+ additionalProperties: false
10907
+ }
10908
+ },
10909
+ {
10910
+ name: "ungroup_tabs",
10911
+ description: "Remove tabs from their tab groups (Chrome only).",
10912
+ inputSchema: {
10913
+ type: "object",
10914
+ properties: {
10915
+ endpoint: {
10916
+ type: "string",
10917
+ description: "Named CDP endpoint (CDP_ENDPOINTS); default endpoint when omitted."
10918
+ },
10919
+ tabIds: {
10920
+ type: "array",
10921
+ items: {
10922
+ type: "integer"
10923
+ },
10924
+ description: "Chrome tab ids (from list_tab_groups)."
10925
+ },
10926
+ targetIds: {
10927
+ type: "array",
10928
+ items: {
10929
+ type: "string"
10930
+ },
10931
+ description: "CDP target ids (list_pages ids)."
10932
+ },
10933
+ urlMatch: {
10934
+ type: "string",
10935
+ description: "URL substring; matches tabs in every window."
10936
+ },
10937
+ groupId: {
10938
+ type: "integer",
10939
+ description: "Ungroup every tab of this group."
10940
+ }
10941
+ },
10942
+ required: [],
10943
+ additionalProperties: false
10944
+ }
10945
+ },
10509
10946
  {
10510
10947
  name: "fill",
10511
10948
  description: "Replace an element contents; provide exactly one of UID or selector.",
@@ -11559,7 +11996,7 @@ import { spawn as spawn4 } from "node:child_process";
11559
11996
  import { existsSync as existsSync2, mkdtempSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "node:fs";
11560
11997
  import { createConnection, createServer as createServer2 } from "node:net";
11561
11998
  import { tmpdir } from "node:os";
11562
- import { join as join13 } from "node:path";
11999
+ import { join as join14 } from "node:path";
11563
12000
  function resolveBinary() {
11564
12001
  const candidates = [
11565
12002
  process.env.FIREFOX_BIN,
@@ -11639,7 +12076,7 @@ var LAUNCH_USER_JS_PREFS = {
11639
12076
  "dom.file.createInChild": true
11640
12077
  };
11641
12078
  function writeLaunchUserJs(profilePath) {
11642
- const target = join13(profilePath, "user.js");
12079
+ const target = join14(profilePath, "user.js");
11643
12080
  const existing = existsSync2(target) ? readFileSync2(target, "utf8") : "";
11644
12081
  const present = new Set;
11645
12082
  for (const line of existing.split(`
@@ -11661,7 +12098,7 @@ async function launchFirefox(opts = {}) {
11661
12098
  const binary = resolveBinary();
11662
12099
  const port = await pickPort(opts.port);
11663
12100
  const isThrowaway = opts.profilePath === undefined;
11664
- const profilePath = opts.profilePath ?? mkdtempSync(join13(tmpdir(), "cdp-toolkit-ff-profile-"));
12101
+ const profilePath = opts.profilePath ?? mkdtempSync(join14(tmpdir(), "cdp-toolkit-ff-profile-"));
11665
12102
  if (isThrowaway)
11666
12103
  writeLaunchUserJs(profilePath);
11667
12104
  const args = ["--profile", profilePath, "--remote-debugging-port", String(port), "--no-remote"];
@@ -12034,8 +12471,8 @@ var BIDI_ONLY_TOOLS = {
12034
12471
 
12035
12472
  // src/bidi-browser-tools.ts
12036
12473
  init_driver2();
12037
- import { mkdir as mkdir14, readdir as readdir4, realpath, rename as rename4, stat as stat5 } from "node:fs/promises";
12038
- import { basename as basename2, dirname as dirname4, join as join14, resolve } from "node:path";
12474
+ import { mkdir as mkdir15, readdir as readdir4, realpath, rename as rename4, stat as stat5 } from "node:fs/promises";
12475
+ import { basename as basename2, dirname as dirname4, join as join15, resolve } from "node:path";
12039
12476
  function unsupported(message) {
12040
12477
  return Object.assign(new Error(message), { code: "unsupported" });
12041
12478
  }
@@ -12054,7 +12491,7 @@ async function targetOf(driver, target) {
12054
12491
  await page.release();
12055
12492
  }
12056
12493
  }
12057
- var FIREFOX_DOWNLOAD_STAGING_DIR = join14(dirname4(DOWNLOADS_DIR), "downloads-firefox-staging");
12494
+ var FIREFOX_DOWNLOAD_STAGING_DIR = join15(dirname4(DOWNLOADS_DIR), "downloads-firefox-staging");
12058
12495
  var downloadStates = new WeakMap;
12059
12496
  function downloadId(p) {
12060
12497
  const v = p.download ?? p.navigation;
@@ -12098,7 +12535,7 @@ function downloadStateFor(conn) {
12098
12535
  if (!state.stagingDirs.has(resolve(dirname4(p.filepath))))
12099
12536
  return;
12100
12537
  rec.url ??= p.url;
12101
- const held = join14(dirname4(p.filepath), `${id.replace(/[^A-Za-z0-9-]/g, "_")}.download`);
12538
+ const held = join15(dirname4(p.filepath), `${id.replace(/[^A-Za-z0-9-]/g, "_")}.download`);
12102
12539
  rename4(p.filepath, held).then(() => {
12103
12540
  rec.filePath = held;
12104
12541
  }, () => {
@@ -12108,8 +12545,8 @@ function downloadStateFor(conn) {
12108
12545
  return state;
12109
12546
  }
12110
12547
  async function armFirefoxDownloads(conn, s, scope) {
12111
- await mkdir14(FIREFOX_DOWNLOAD_STAGING_DIR, { recursive: true });
12112
- await mkdir14(DOWNLOADS_DIR, { recursive: true });
12548
+ await mkdir15(FIREFOX_DOWNLOAD_STAGING_DIR, { recursive: true });
12549
+ await mkdir15(DOWNLOADS_DIR, { recursive: true });
12113
12550
  s.stagingDirs.add(resolve(await realpath(FIREFOX_DOWNLOAD_STAGING_DIR)));
12114
12551
  scope.setDisposeHook("browser.downloads", async (c) => {
12115
12552
  await c.send("browser.setDownloadBehavior", { downloadBehavior: null });
@@ -12167,7 +12604,7 @@ async function waitForDownloadFirefox(driver, args = {}) {
12167
12604
  const taken = new Set(await readdir4(DOWNLOADS_DIR).catch(() => []));
12168
12605
  taken.delete(basename2(rec.filePath));
12169
12606
  const finalName = nextFreeName(suggestedFilename, taken);
12170
- const path = join14(DOWNLOADS_DIR, finalName);
12607
+ const path = join15(DOWNLOADS_DIR, finalName);
12171
12608
  await rename4(rec.filePath, path);
12172
12609
  const bytes = (await stat5(path)).size;
12173
12610
  return { path, suggestedFilename, bytes, ...rec.url ? { url: rec.url } : {}, target };
@@ -12284,7 +12721,8 @@ var TOOL_GROUPS = [
12284
12721
  "permissions",
12285
12722
  "dialogs",
12286
12723
  "downloads",
12287
- "extraction"
12724
+ "extraction",
12725
+ "tabs"
12288
12726
  ];
12289
12727
  var GROUP_TOOLS = {
12290
12728
  core: [
@@ -12330,7 +12768,8 @@ var GROUP_TOOLS = {
12330
12768
  permissions: ["grant_permissions"],
12331
12769
  dialogs: ["handle_dialog"],
12332
12770
  downloads: ["wait_for_download"],
12333
- extraction: ["extract_page"]
12771
+ extraction: ["extract_page"],
12772
+ tabs: ["list_tab_groups", "group_tabs", "ungroup_tabs"]
12334
12773
  };
12335
12774
  var TOOL_GROUP = {};
12336
12775
  for (const group of TOOL_GROUPS) {
@@ -12596,6 +13035,38 @@ var TOOL_DOCS = {
12596
13035
  reset: "Clear this server's previous permission grants (Browser.resetPermissions). With 'permissions' it resets FIRST and then grants, so the result is exactly the listed permissions; on its own it is a reset-only call answering {reset:true}. Not scoped to 'origin': CDP resets every origin at once."
12597
13036
  }
12598
13037
  },
13038
+ list_tab_groups: {
13039
+ description: "Lists the browser's tab groups, per window: {windows:[{windowId,tabCount,ungrouped,groups:[{groupId,title,color,collapsed,tabs:[{tabId,targetId,index,url,title}]}]}],groupCount,tabCount}; includeUngrouped:true adds each window's ungroupedTabs rows. targetId is the tab's CDP target id (the id list_pages shows), so a row can be driven by the other tools directly. CDP has no tab-group domain, so the three tab-group tools run chrome.tabGroups inside a tiny helper extension: the first call writes it under the artifact dir (tab-groups-helper/) and installs it with Extensions.loadUnpacked, and it stays installed in the profile afterwards (no UI, no state). That needs the helper directory on the browser's own machine and a Chromium that allows loadUnpacked over CDP (measured: Chromium 156-158, Helium, Vivaldi). Classified as changing state for read-only endpoints because of that install. Chrome only (capability 'browser.tabGroups'): absent under Firefox, whose BiDi cannot reach an extension background context.",
13040
+ params: {
13041
+ endpoint: "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only); acts on that browser instead of the default. These tools take no target.",
13042
+ windowId: "Only this chrome window id (from an earlier listing).",
13043
+ includeUngrouped: "Also return each window's ungrouped tabs as ungroupedTabs rows (same shape as group members), not just the ungrouped count. Default false."
13044
+ }
13045
+ },
13046
+ group_tabs: {
13047
+ description: "Puts tabs in a tab group and names it. Select tabs with EXACTLY ONE of tabIds (chrome tab ids from list_tab_groups), targetIds (CDP target ids, as list_pages shows them) or urlMatch (URL substring, matched in every window); a selection that matches nothing, or an unknown id, is an error and nothing is grouped. Without groupId a NEW group is created; with groupId the tabs join that existing group (its title/color are kept unless given). WINDOWS: a group lives in one window. If the selected tabs span several windows the call is REFUSED unless windowId names the destination, because Chrome would otherwise move them all into the last-focused window; with windowId, tabs from other windows are moved there and listed in 'moved'. groupId and windowId are mutually exclusive. title, color (grey|blue|red|yellow|green|pink|purple|cyan|orange) and collapsed are applied after grouping. Returns {groupId,windowId,title,color,collapsed,tabs,moved}. Never raises or focuses a window. Does not consult tab leases: grouping moves a tab in the tab strip, not the page. Helper-extension install and limits: see list_tab_groups. Chrome only (capability 'browser.tabGroups').",
13048
+ params: {
13049
+ endpoint: "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only). These tools take no target.",
13050
+ tabIds: "Chrome tab ids to group, from list_tab_groups. Non-empty.",
13051
+ targetIds: "CDP target ids to group (the ids list_pages shows). Non-empty.",
13052
+ urlMatch: "Substring of the tab URL; every matching tab in every window is selected.",
13053
+ title: "Group title shown on the tab strip.",
13054
+ color: "One of grey, blue, red, yellow, green, pink, purple, cyan, orange.",
13055
+ collapsed: "Collapse (true) or expand (false) the group.",
13056
+ groupId: "Add the tabs to this existing group instead of creating one. Not with windowId.",
13057
+ windowId: "Window the new group goes in; selected tabs in other windows are moved there. Required when the selection spans windows. Not with groupId."
13058
+ }
13059
+ },
13060
+ ungroup_tabs: {
13061
+ description: "Removes tabs from their tab groups; a group left with no tabs disappears. Select with EXACTLY ONE of tabIds, targetIds, urlMatch (as group_tabs) or groupId (every tab of that group). Tabs stay where they are in the window. Returns {ungrouped:[{tabId,targetId,index,url,title,fromGroupId}],alreadyUngrouped:[tabId]}; selected tabs that were in no group are listed in alreadyUngrouped rather than treated as an error. Helper-extension install and limits: see list_tab_groups. Chrome only (capability 'browser.tabGroups').",
13062
+ params: {
13063
+ endpoint: "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only). These tools take no target.",
13064
+ tabIds: "Chrome tab ids to ungroup.",
13065
+ targetIds: "CDP target ids to ungroup.",
13066
+ urlMatch: "Substring of the tab URL; matching tabs in every window are ungrouped.",
13067
+ groupId: "Ungroup every tab of this group."
13068
+ }
13069
+ },
12599
13070
  fill: {
12600
13071
  description: `Fills an element by focusing it, clearing existing content, then inserting value via Input.insertText (atomic paste-like commit, not per-character keystrokes, so it won't fire per-keypress handlers). Give exactly one of uid or selector. Returns {filled,element,value}; element names the field (textbox "Email"). On a background tab (Chrome), which gets no trusted keyboard input, the commit is verified and falls back in-page (execCommand insertText, else the native value setter plus input/change events); the result then carries inputPath. The tab is never raised.`,
12601
13072
  params: {
@@ -12939,6 +13410,9 @@ var MUTATING_TOOLS = new Set([
12939
13410
  "click_focus_gated",
12940
13411
  "wait_for_download",
12941
13412
  "grant_permissions",
13413
+ "list_tab_groups",
13414
+ "group_tabs",
13415
+ "ungroup_tabs",
12942
13416
  "claim_page",
12943
13417
  "release_page"
12944
13418
  ]);
@@ -12986,7 +13460,7 @@ function toolAnnotations(name) {
12986
13460
  }
12987
13461
 
12988
13462
  // src/version.ts
12989
- var VERSION = "3.5.0";
13463
+ var VERSION = "3.6.0";
12990
13464
 
12991
13465
  // src/mcp.ts
12992
13466
  function isDirectRun() {