@corbat-tech/coco 2.25.1 → 2.25.2

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/cli/index.js CHANGED
@@ -20886,18 +20886,42 @@ async function openBrowser2(url) {
20886
20886
  } catch {
20887
20887
  return false;
20888
20888
  }
20889
- try {
20890
- if (process.platform === "darwin") {
20891
- await execFileAsync2("open", [safeUrl]);
20892
- } else if (process.platform === "win32") {
20893
- await execFileAsync2("rundll32", ["url.dll,FileProtocolHandler", safeUrl]);
20894
- } else {
20895
- await execFileAsync2("xdg-open", [safeUrl]);
20889
+ const isWSL2 = process.platform === "linux" && (process.env["WSL_DISTRO_NAME"] !== void 0 || process.env["WSL_INTEROP"] !== void 0 || process.env["TERM_PROGRAM"]?.toLowerCase().includes("wsl") === true);
20890
+ const commands2 = [];
20891
+ if (process.platform === "darwin") {
20892
+ commands2.push(
20893
+ { cmd: "open", args: [safeUrl] },
20894
+ { cmd: "open", args: ["-a", "Safari", safeUrl] },
20895
+ { cmd: "open", args: ["-a", "Google Chrome", safeUrl] }
20896
+ );
20897
+ } else if (process.platform === "win32") {
20898
+ commands2.push({ cmd: "rundll32", args: ["url.dll,FileProtocolHandler", safeUrl] });
20899
+ } else if (isWSL2) {
20900
+ commands2.push(
20901
+ { cmd: "cmd.exe", args: ["/c", "start", "", safeUrl] },
20902
+ { cmd: "powershell.exe", args: ["-Command", `Start-Process '${safeUrl}'`] },
20903
+ { cmd: "wslview", args: [safeUrl] }
20904
+ );
20905
+ } else {
20906
+ commands2.push(
20907
+ { cmd: "xdg-open", args: [safeUrl] },
20908
+ { cmd: "sensible-browser", args: [safeUrl] },
20909
+ { cmd: "x-www-browser", args: [safeUrl] },
20910
+ { cmd: "gnome-open", args: [safeUrl] },
20911
+ { cmd: "firefox", args: [safeUrl] },
20912
+ { cmd: "chromium-browser", args: [safeUrl] },
20913
+ { cmd: "google-chrome", args: [safeUrl] }
20914
+ );
20915
+ }
20916
+ for (const { cmd, args } of commands2) {
20917
+ try {
20918
+ await execFileAsync2(cmd, args);
20919
+ return true;
20920
+ } catch {
20921
+ continue;
20896
20922
  }
20897
- return true;
20898
- } catch {
20899
- return false;
20900
20923
  }
20924
+ return false;
20901
20925
  }
20902
20926
  function maskUrlForLogs(rawUrl) {
20903
20927
  try {
@@ -21086,7 +21110,7 @@ async function authenticateMcpOAuth(params) {
21086
21110
  }
21087
21111
  if (!process.stdout.isTTY) {
21088
21112
  throw new Error(
21089
- `MCP server '${params.serverName}' requires interactive OAuth in a TTY session. Run Coco in a terminal to authenticate.`
21113
+ `MCP server '${params.serverName}' requires interactive OAuth in a TTY session. Run Coco in a terminal, or use mcp-remote (e.g. npx -y mcp-remote@latest ${resource}) for IDE bridge workflows.`
21090
21114
  );
21091
21115
  }
21092
21116
  const protectedMetadata = await discoverProtectedResourceMetadata(
@@ -21235,9 +21259,12 @@ var init_http = __esm({
21235
21259
  return headers;
21236
21260
  }
21237
21261
  shouldAttemptOAuth() {
21238
- if (this.config.auth?.type === "apikey" || this.config.auth?.type === "bearer") {
21262
+ if (this.config.auth?.type === "apikey") {
21239
21263
  return false;
21240
21264
  }
21265
+ if (this.config.auth?.type === "bearer") {
21266
+ return !this.getAuthToken();
21267
+ }
21241
21268
  return true;
21242
21269
  }
21243
21270
  async ensureOAuthToken(wwwAuthenticateHeader) {