@corbat-tech/coco 2.25.1 → 2.25.3

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
@@ -5948,10 +5948,9 @@ var init_gemini = __esm({
5948
5948
  });
5949
5949
  }
5950
5950
  }
5951
+ history.push({ role: "function", parts: functionResponses });
5951
5952
  if (isLastMessage) {
5952
- lastUserMessage = functionResponses;
5953
- } else {
5954
- history.push({ role: "user", parts: functionResponses });
5953
+ lastUserMessage = "";
5955
5954
  }
5956
5955
  } else {
5957
5956
  const parts = this.convertContent(msg.content);
@@ -20886,18 +20885,42 @@ async function openBrowser2(url) {
20886
20885
  } catch {
20887
20886
  return false;
20888
20887
  }
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]);
20888
+ 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);
20889
+ const commands2 = [];
20890
+ if (process.platform === "darwin") {
20891
+ commands2.push(
20892
+ { cmd: "open", args: [safeUrl] },
20893
+ { cmd: "open", args: ["-a", "Safari", safeUrl] },
20894
+ { cmd: "open", args: ["-a", "Google Chrome", safeUrl] }
20895
+ );
20896
+ } else if (process.platform === "win32") {
20897
+ commands2.push({ cmd: "rundll32", args: ["url.dll,FileProtocolHandler", safeUrl] });
20898
+ } else if (isWSL2) {
20899
+ commands2.push(
20900
+ { cmd: "cmd.exe", args: ["/c", "start", "", safeUrl] },
20901
+ { cmd: "powershell.exe", args: ["-Command", `Start-Process '${safeUrl}'`] },
20902
+ { cmd: "wslview", args: [safeUrl] }
20903
+ );
20904
+ } else {
20905
+ commands2.push(
20906
+ { cmd: "xdg-open", args: [safeUrl] },
20907
+ { cmd: "sensible-browser", args: [safeUrl] },
20908
+ { cmd: "x-www-browser", args: [safeUrl] },
20909
+ { cmd: "gnome-open", args: [safeUrl] },
20910
+ { cmd: "firefox", args: [safeUrl] },
20911
+ { cmd: "chromium-browser", args: [safeUrl] },
20912
+ { cmd: "google-chrome", args: [safeUrl] }
20913
+ );
20914
+ }
20915
+ for (const { cmd, args } of commands2) {
20916
+ try {
20917
+ await execFileAsync2(cmd, args);
20918
+ return true;
20919
+ } catch {
20920
+ continue;
20896
20921
  }
20897
- return true;
20898
- } catch {
20899
- return false;
20900
20922
  }
20923
+ return false;
20901
20924
  }
20902
20925
  function maskUrlForLogs(rawUrl) {
20903
20926
  try {
@@ -21086,7 +21109,7 @@ async function authenticateMcpOAuth(params) {
21086
21109
  }
21087
21110
  if (!process.stdout.isTTY) {
21088
21111
  throw new Error(
21089
- `MCP server '${params.serverName}' requires interactive OAuth in a TTY session. Run Coco in a terminal to authenticate.`
21112
+ `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
21113
  );
21091
21114
  }
21092
21115
  const protectedMetadata = await discoverProtectedResourceMetadata(
@@ -21235,9 +21258,12 @@ var init_http = __esm({
21235
21258
  return headers;
21236
21259
  }
21237
21260
  shouldAttemptOAuth() {
21238
- if (this.config.auth?.type === "apikey" || this.config.auth?.type === "bearer") {
21261
+ if (this.config.auth?.type === "apikey") {
21239
21262
  return false;
21240
21263
  }
21264
+ if (this.config.auth?.type === "bearer") {
21265
+ return !this.getAuthToken();
21266
+ }
21241
21267
  return true;
21242
21268
  }
21243
21269
  async ensureOAuthToken(wwwAuthenticateHeader) {