@agenticmail/core 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +26 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5583,12 +5583,11 @@ var DependencyInstaller = class {
5583
5583
  await mkdir2(binDir, { recursive: true });
5584
5584
  const os = platform2();
5585
5585
  const cpu = arch2();
5586
- let downloadUrl;
5587
- if (os === "darwin") {
5588
- downloadUrl = cpu === "arm64" ? "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-arm64" : "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-amd64";
5589
- } else if (os === "linux") {
5590
- downloadUrl = cpu === "arm64" ? "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64" : "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64";
5591
- } else {
5586
+ const archName = cpu === "arm64" ? "arm64" : "amd64";
5587
+ const isTgz = os === "darwin";
5588
+ const ext = isTgz ? ".tgz" : "";
5589
+ const downloadUrl = `https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-${os}-${archName}${ext}`;
5590
+ if (os !== "darwin" && os !== "linux") {
5592
5591
  throw new Error(`Unsupported platform: ${os}/${cpu}`);
5593
5592
  }
5594
5593
  const response = await fetch(downloadUrl);
@@ -5596,10 +5595,27 @@ var DependencyInstaller = class {
5596
5595
  throw new Error(`Failed to download cloudflared: ${response.statusText}`);
5597
5596
  }
5598
5597
  const buffer = Buffer.from(await response.arrayBuffer());
5599
- const tmpPath = binPath + ".tmp";
5600
- await writeFile(tmpPath, buffer);
5601
- await chmod2(tmpPath, 493);
5602
- await rename(tmpPath, binPath);
5598
+ if (isTgz) {
5599
+ const tgzPath = join6(binDir, "cloudflared.tgz");
5600
+ await writeFile(tgzPath, buffer);
5601
+ try {
5602
+ execSync2(`tar -xzf "${tgzPath}" -C "${binDir}" cloudflared`, { timeout: 15e3, stdio: "ignore" });
5603
+ await chmod2(binPath, 493);
5604
+ } finally {
5605
+ try {
5606
+ execSync2(`rm -f "${tgzPath}"`, { stdio: "ignore" });
5607
+ } catch {
5608
+ }
5609
+ }
5610
+ } else {
5611
+ const tmpPath = binPath + ".tmp";
5612
+ await writeFile(tmpPath, buffer);
5613
+ await chmod2(tmpPath, 493);
5614
+ await rename(tmpPath, binPath);
5615
+ }
5616
+ if (!existsSync4(binPath)) {
5617
+ throw new Error("cloudflared download succeeded but binary not found after extraction");
5618
+ }
5603
5619
  this.onProgress("cloudflared installed");
5604
5620
  return binPath;
5605
5621
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Core SDK for AgenticMail — programmatic email for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",