smooth-operator-mcp 2.4.3 → 2.4.4

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.
@@ -1211,7 +1211,7 @@ async function runWizard(harness, opts) {
1211
1211
  });
1212
1212
  const session = tolerantQuestion(rl);
1213
1213
  try {
1214
- ui.banner("SmoothOperator Setup", `Give ${harness} a real Chrome it can drive`, opts.version ?? "2.4.3");
1214
+ ui.banner("SmoothOperator Setup", `Give ${harness} a real Chrome it can drive`, opts.version ?? "2.4.4");
1215
1215
  ui.note(`Configuring: ${harness}`);
1216
1216
  ui.note("Answer each question, or press Enter to accept the recommended default.");
1217
1217
  ui.note(`You can re-run \`smooth-operator install ${harness}\` at any time to change these.`);
@@ -2445,7 +2445,7 @@ init_errors();
2445
2445
  init_logger();
2446
2446
 
2447
2447
  // src/server/version.ts
2448
- var SERVER_VERSION = "2.4.3";
2448
+ var SERVER_VERSION = "2.4.4";
2449
2449
 
2450
2450
  // src/server/mcp.ts
2451
2451
  var EmptyInputSchema = z3.object({}).strict();
@@ -5736,17 +5736,14 @@ var BrowserService = class {
5736
5736
  }
5737
5737
  }
5738
5738
  targetGuardForPage(page) {
5739
- let sessionId;
5740
- try {
5741
- const target = page.target();
5742
- sessionId = target._session?.()?.id();
5743
- } catch {
5744
- sessionId = void 0;
5739
+ const identity = pageTargetIdentity(page);
5740
+ if (identity.sessionId) {
5741
+ return this.targetGuardSessions.get(identity.sessionId);
5745
5742
  }
5746
- if (!sessionId) {
5747
- return void 0;
5743
+ if (identity.targetId) {
5744
+ return [...this.targetGuardSessions.values()].find((guard) => guard.targetId === identity.targetId);
5748
5745
  }
5749
- return this.targetGuardSessions.get(sessionId);
5746
+ return void 0;
5750
5747
  }
5751
5748
  async waitForTargetGuardDrain(page, signal) {
5752
5749
  const guard = this.targetGuardForPage(page);
@@ -5755,18 +5752,12 @@ var BrowserService = class {
5755
5752
  }
5756
5753
  }
5757
5754
  async releaseTargetGuardForPage(page) {
5758
- let sessionId;
5759
- try {
5760
- const target = page.target();
5761
- sessionId = target._session?.()?.id();
5762
- } catch {
5763
- sessionId = void 0;
5764
- }
5765
- if (!sessionId) {
5766
- return;
5755
+ const identity = pageTargetIdentity(page);
5756
+ const guard = this.targetGuardForPage(page);
5757
+ if (!identity.sessionId && !guard) return;
5758
+ if (identity.sessionId) {
5759
+ this.unguardedTargetSessions.delete(identity.sessionId);
5767
5760
  }
5768
- this.unguardedTargetSessions.delete(sessionId);
5769
- const guard = this.targetGuardSessions.get(sessionId);
5770
5761
  if (!guard) {
5771
5762
  return;
5772
5763
  }
@@ -5777,7 +5768,7 @@ var BrowserService = class {
5777
5768
  removeCdpListener(guard.session, "Fetch.requestPaused", guard.requestPausedListener);
5778
5769
  removeCdpListener(guard.session, "disconnected", guard.disconnectedListener);
5779
5770
  restoreGuardSend(guard);
5780
- this.targetGuardSessions.delete(sessionId);
5771
+ this.targetGuardSessions.delete(guard.session.id());
5781
5772
  }
5782
5773
  async prepareTarget(target) {
5783
5774
  const generation = this.lifecycleGeneration;
@@ -5807,13 +5798,8 @@ var BrowserService = class {
5807
5798
  }
5808
5799
  }
5809
5800
  isUnguardedTargetPage(page) {
5810
- try {
5811
- const target = page.target();
5812
- const sessionId = target._session?.()?.id();
5813
- return Boolean(sessionId && this.unguardedTargetSessions.has(sessionId));
5814
- } catch {
5815
- return false;
5816
- }
5801
+ const identity = pageTargetIdentity(page);
5802
+ return Boolean(identity.sessionId && this.unguardedTargetSessions.has(identity.sessionId));
5817
5803
  }
5818
5804
  async newPageState(signal) {
5819
5805
  const generation = this.lifecycleGeneration;
@@ -7540,6 +7526,21 @@ function isPageClosed(page) {
7540
7526
  return true;
7541
7527
  }
7542
7528
  }
7529
+ function pageTargetIdentity(page) {
7530
+ try {
7531
+ const target = page.target();
7532
+ let sessionId;
7533
+ try {
7534
+ sessionId = target._session?.()?.id();
7535
+ } catch {
7536
+ sessionId = void 0;
7537
+ }
7538
+ const targetId = typeof target._targetId === "string" ? target._targetId : void 0;
7539
+ return { ...sessionId ? { sessionId } : {}, ...targetId ? { targetId } : {} };
7540
+ } catch {
7541
+ return {};
7542
+ }
7543
+ }
7543
7544
  async function rejectSymlink(path) {
7544
7545
  try {
7545
7546
  const file = await lstat(path);
@@ -8138,7 +8139,7 @@ function canonicalPath(path) {
8138
8139
  let current = path;
8139
8140
  while (true) {
8140
8141
  try {
8141
- const canonical = realpathSync(current);
8142
+ const canonical = realpathSync.native(current);
8142
8143
  return missingSegments.reduceRight((parent, segment) => join4(parent, segment), canonical);
8143
8144
  } catch {
8144
8145
  try {