@ricsam/browser-mcp 0.3.13 → 0.3.15

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.
@@ -22,12 +22,13 @@ async function readCapability(path) {
22
22
  }
23
23
  const cap = JSON.parse(text);
24
24
  const u = new URL(cap.url);
25
- if (u.protocol !== "https:" || u.username || u.password || u.search || u.hash || !/^\/api\/native-data\/[a-zA-Z0-9-]+$/.test(u.pathname) || !["GET", "PUT"].includes(cap.method) || !/^Bearer [A-Za-z0-9_-]{43}$/.test(cap.headers.Authorization) || !Number.isFinite(cap.expiresAt) || cap.expiresAt <= Date.now() || cap.limits.maxAttempts !== 1 || cap.limits.resumable !== false || cap.size !== undefined && (!Number.isSafeInteger(cap.size) || cap.size !== cap.limits.maxBytes) || cap.sha256 !== undefined && !/^[a-f0-9]{64}$/.test(cap.sha256) || !Number.isSafeInteger(cap.limits.maxBytes) || cap.limits.maxBytes < 0 || cap.limits.maxBytes > 256 * 1024 * 1024)
25
+ const link = cap.method === "GET" && /^\/api\/native-data\/[a-zA-Z0-9-]+\/download\/[A-Za-z0-9_-]{43}$/.test(u.pathname);
26
+ if (u.protocol !== "https:" || u.username || u.password || u.search || u.hash || !link && !/^\/api\/native-data\/[a-zA-Z0-9-]+$/.test(u.pathname) || !["GET", "PUT"].includes(cap.method) || !link && !/^Bearer [A-Za-z0-9_-]{43}$/.test(cap.headers?.Authorization ?? "") || !Number.isFinite(cap.expiresAt) || cap.expiresAt <= Date.now() || cap.limits.maxAttempts !== 1 || cap.limits.resumable !== false || cap.size !== undefined && (!Number.isSafeInteger(cap.size) || cap.size !== cap.limits.maxBytes) || cap.sha256 !== undefined && !/^[a-f0-9]{64}$/.test(cap.sha256) || !Number.isSafeInteger(cap.limits.maxBytes) || cap.limits.maxBytes < 0 || cap.limits.maxBytes > 256 * 1024 * 1024)
26
27
  throw new Error("Invalid capability");
27
28
  return cap;
28
29
  }
29
30
  async function capabilityFetch(cap, body) {
30
- const response = await fetch(cap.url, { method: cap.method, headers: { Authorization: cap.headers.Authorization }, body: body ? Readable.toWeb(body) : undefined, duplex: "half", redirect: "error", signal: AbortSignal.timeout(120000) });
31
+ const response = await fetch(cap.url, { method: cap.method, headers: cap.url.includes("/download/") ? {} : { Authorization: cap.headers.Authorization }, body: body ? Readable.toWeb(body) : undefined, duplex: "half", redirect: "error", signal: AbortSignal.timeout(120000) });
31
32
  if (!response.ok)
32
33
  throw new Error("Capability transfer failed; do not automatically retry");
33
34
  return response;
@@ -2,7 +2,7 @@ import {
2
2
  capabilityFetch,
3
3
  exclusiveOutput,
4
4
  readCapability
5
- } from "./chunk-k9cpr8vk.js";
5
+ } from "./chunk-v483gpt7.js";
6
6
  import"./chunk-1sjcwr28.js";
7
7
 
8
8
  // cli/src/agent/files.ts
package/dist/main.js CHANGED
@@ -8,7 +8,7 @@ var args = process.argv.slice(2);
8
8
  var command = args.shift();
9
9
  async function main() {
10
10
  if (!command || command === "--help" || command === "help") {
11
- console.log(`@ricsam/browser-mcp 0.3.13
11
+ console.log(`@ricsam/browser-mcp 0.3.15
12
12
  Usage: browser-mcp browser start|status|pause|resume|stop|recover [options]
13
13
  browser-mcp files upload|download [options]
14
14
  browser-mcp secrets export|exec [options]
@@ -18,15 +18,15 @@ Browser dependencies load only for browser commands. No automatic Chrome downloa
18
18
  return;
19
19
  }
20
20
  if (command === "--version") {
21
- console.log("0.3.13");
21
+ console.log("0.3.15");
22
22
  return;
23
23
  }
24
24
  if (command === "browser")
25
- return (await import("./chunk-vw3wanmm.js")).runBrowser(args);
25
+ return (await import("./chunk-ts4nynm9.js")).runBrowser(args);
26
26
  if (command === "files")
27
- return (await import("./chunk-6dypb4ga.js")).runFilesCommand(args);
27
+ return (await import("./chunk-zv1900tw.js")).runFilesCommand(args);
28
28
  if (command === "secrets")
29
- return (await import("./chunk-6kc5yfp5.js")).runSecretsCommand(args);
29
+ return (await import("./chunk-g3yyvtve.js")).runSecretsCommand(args);
30
30
  if (command === "forward")
31
31
  return (await import("./chunk-swy0qtx0.js")).runForward(args);
32
32
  throw new Error("Unknown command. Use --help.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/browser-mcp",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "description": "Dedicated native Chrome companion for Browser MCP",
5
5
  "type": "module",
6
6
  "bin": { "browser-mcp": "dist/main.js" },