openowl 0.3.8 → 0.3.10

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/install.js +78 -17
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -7,20 +7,26 @@ const path = require("path");
7
7
  const https = require("https");
8
8
  const http = require("http");
9
9
  const { execSync } = require("child_process");
10
+ const zlib = require("zlib");
10
11
 
11
- const VERSION = "0.3.8";
12
+ const VERSION = "0.3.10";
12
13
  const BASE_URL =
13
- "https://dedjlsvrwafhyznaazbm.supabase.co/storage/v1/object/public/releases";
14
+ `https://github.com/mihir-kanzariya/openowl-releases/releases/download/v${VERSION}`;
14
15
 
15
16
  const PLATFORMS = {
16
17
  "darwin-arm64": {
17
- url: `${BASE_URL}/v${VERSION}/owl-darwin-arm64.tar.gz`,
18
+ url: `${BASE_URL}/owl-darwin-arm64.tar.gz`,
18
19
  binary: "owl-darwin-arm64",
19
20
  },
20
21
  "darwin-x64": {
21
- url: `${BASE_URL}/v${VERSION}/owl-darwin-x64.tar.gz`,
22
+ url: `${BASE_URL}/owl-darwin-x64.tar.gz`,
22
23
  binary: "owl-darwin-x86_64",
23
24
  },
25
+ "win32-x64": {
26
+ url: `${BASE_URL}/owl-win32-x64.zip`,
27
+ binary: "owl-windows-x86_64.exe",
28
+ isZip: true,
29
+ },
24
30
  };
25
31
 
26
32
  function getPlatformKey() {
@@ -33,6 +39,7 @@ function download(url) {
33
39
  return new Promise((resolve, reject) => {
34
40
  const get = url.startsWith("https") ? https.get : http.get;
35
41
  get(url, (res) => {
42
+ // Follow redirects (GitHub releases redirect to S3)
36
43
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
37
44
  return download(res.headers.location).then(resolve).catch(reject);
38
45
  }
@@ -47,6 +54,42 @@ function download(url) {
47
54
  });
48
55
  }
49
56
 
57
+ /**
58
+ * Extract a zip file using pure Node.js (no PowerShell dependency).
59
+ */
60
+ function extractZip(zipBuffer, destDir) {
61
+ let offset = 0;
62
+ while (offset < zipBuffer.length - 4) {
63
+ const sig = zipBuffer.readUInt32LE(offset);
64
+ if (sig !== 0x04034b50) break;
65
+
66
+ const compressionMethod = zipBuffer.readUInt16LE(offset + 8);
67
+ const compressedSize = zipBuffer.readUInt32LE(offset + 18);
68
+ const nameLen = zipBuffer.readUInt16LE(offset + 26);
69
+ const extraLen = zipBuffer.readUInt16LE(offset + 28);
70
+ const nameStart = offset + 30;
71
+ const fileName = zipBuffer.toString("utf8", nameStart, nameStart + nameLen);
72
+ const dataStart = nameStart + nameLen + extraLen;
73
+
74
+ const destPath = path.join(destDir, fileName);
75
+
76
+ if (fileName.endsWith("/")) {
77
+ fs.mkdirSync(destPath, { recursive: true });
78
+ } else {
79
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
80
+ const rawData = zipBuffer.slice(dataStart, dataStart + compressedSize);
81
+
82
+ if (compressionMethod === 0) {
83
+ fs.writeFileSync(destPath, rawData);
84
+ } else if (compressionMethod === 8) {
85
+ const inflated = zlib.inflateRawSync(rawData);
86
+ fs.writeFileSync(destPath, inflated);
87
+ }
88
+ }
89
+
90
+ offset = dataStart + compressedSize;
91
+ }
92
+ }
50
93
 
51
94
  async function install() {
52
95
  const platformKey = getPlatformKey();
@@ -59,12 +102,17 @@ async function install() {
59
102
  }
60
103
 
61
104
  const installDir = path.join(__dirname, ".owl");
62
-
63
- // Skip if already installed
105
+ const versionFile = path.join(installDir, ".version");
64
106
  const binaryPath = path.join(installDir, info.binary);
65
- if (fs.existsSync(binaryPath)) {
66
- console.log("[OpenOwl] Already installed.");
67
- return;
107
+
108
+ // Skip if correct version already installed
109
+ if (fs.existsSync(binaryPath) && fs.existsSync(versionFile)) {
110
+ const installed = fs.readFileSync(versionFile, "utf8").trim();
111
+ if (installed === VERSION) {
112
+ console.log(`[OpenOwl] v${VERSION} already installed.`);
113
+ return;
114
+ }
115
+ console.log(`[OpenOwl] Updating from v${installed} to v${VERSION}...`);
68
116
  }
69
117
 
70
118
  console.log(`[OpenOwl] Downloading for ${platformKey}...`);
@@ -74,20 +122,33 @@ async function install() {
74
122
 
75
123
  fs.mkdirSync(installDir, { recursive: true });
76
124
 
77
- const tmpFile = path.join(os.tmpdir(), `owl-${VERSION}.tar.gz`);
78
- fs.writeFileSync(tmpFile, archive);
79
- execSync(`tar -xzf "${tmpFile}" -C "${installDir}"`, { stdio: "pipe" });
80
- fs.unlinkSync(tmpFile);
125
+ if (info.isZip) {
126
+ // Pure Node.js zip extraction — no PowerShell needed
127
+ extractZip(archive, installDir);
128
+ } else {
129
+ // macOS/Linux: use tar
130
+ const tmpFile = path.join(os.tmpdir(), `owl-${VERSION}.tar.gz`);
131
+ fs.writeFileSync(tmpFile, archive);
132
+ execSync(`tar -xzf "${tmpFile}" -C "${installDir}"`, { stdio: "pipe" });
133
+ fs.unlinkSync(tmpFile);
134
+ }
81
135
 
82
- // Make binary executable
83
- if (fs.existsSync(binaryPath)) {
136
+ // Make binary executable (no-op on Windows)
137
+ if (fs.existsSync(binaryPath) && os.platform() !== "win32") {
84
138
  fs.chmodSync(binaryPath, 0o755);
85
139
  }
86
140
 
87
- console.log(`[OpenOwl] Installed successfully (${(archive.length / 1024 / 1024).toFixed(1)} MB)`);
141
+ // Write version marker so future installs can detect upgrades
142
+ fs.writeFileSync(versionFile, VERSION);
143
+
144
+ console.log(`[OpenOwl] Installed v${VERSION} successfully (${(archive.length / 1024 / 1024).toFixed(1)} MB)`);
88
145
  } catch (err) {
89
146
  console.error(`[OpenOwl] Installation failed: ${err.message}`);
90
- console.error("[OpenOwl] Try: brew install owl");
147
+ if (os.platform() === "win32") {
148
+ console.error("[OpenOwl] Try downloading manually from: https://openowl.dev/quick-setup");
149
+ } else {
150
+ console.error("[OpenOwl] Try: brew install owl");
151
+ }
91
152
  process.exit(1);
92
153
  }
93
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openowl",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "AI desktop automation MCP server — give your AI eyes and hands",
5
5
  "homepage": "https://openowl.dev",
6
6
  "repository": {