agi 0.2.0 → 0.2.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/LICENSE.pdf ADDED
Binary file
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # AGI Browser
2
+
3
+ AGI - Your intelligent browser worker
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install agi
9
+ ```
10
+
11
+ **Note:** This package is currently only supported on macOS (darwin).
12
+
13
+ ## What it does
14
+
15
+ The AGI app provides an intelligent browser automation assistant that can help you navigate and interact with web pages.
16
+
17
+ ## Requirements
18
+
19
+ - macOS (darwin)
20
+ - Node.js >= 14.0.0
21
+
22
+ ## Post-install
23
+
24
+ Install the AGI app
25
+
26
+ ## License
27
+
28
+ MIT
29
+
30
+ ## Author
31
+
32
+ AGI, Inc.
package/package.json CHANGED
@@ -1,9 +1,35 @@
1
1
  {
2
- "name": "agi",
3
- "version": "0.2.0",
4
- "description": "AGI",
5
- "license": "MIT",
6
- "scripts": {
7
- "postinstall": "node -e \"const { exec } = require('child_process'); const url='https://agi.app/'; const cmd = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open'; exec(cmd + ' ' + url);\""
8
- }
2
+ "name": "agi",
3
+ "version": "0.2.2",
4
+ "description": "AGI - Your intelligent browser worker",
5
+ "keywords": [
6
+ "agi",
7
+ "browser",
8
+ "agent",
9
+ "automation",
10
+ "assistant",
11
+ "worker"
12
+ ],
13
+ "homepage": "https://agi.app",
14
+ "license": "MIT",
15
+ "author": "AGI, Inc.",
16
+ "type": "commonjs",
17
+ "main": "index.js",
18
+ "files": [
19
+ "scripts/",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "postinstall": "node scripts/install-dmg.js"
25
+ },
26
+ "engines": {
27
+ "node": ">=18.0.0"
28
+ },
29
+ "os": [
30
+ "darwin"
31
+ ],
32
+ "dependencies": {
33
+ "path": "^0.12.7"
34
+ }
9
35
  }
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ const fs = require("fs");
3
+ const { pipeline } = require("stream");
4
+ const { promisify } = require("util");
5
+ const { execSync } = require("child_process");
6
+ const path = require("path");
7
+ const os = require("os");
8
+
9
+ const DMG_URL = "https://agi-app.s3.us-east-1.amazonaws.com/agi-app/AGI-latest-mac.dmg";
10
+ const dmgPath = path.join(os.tmpdir(), "AGI.dmg");
11
+
12
+ (async () => {
13
+ try {
14
+ console.log(`• Downloading ${DMG_URL}`);
15
+ const res = await fetch(DMG_URL);
16
+ if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
17
+ await promisify(pipeline)(res.body, fs.createWriteStream(dmgPath));
18
+
19
+ console.log("• Mounting DMG …");
20
+ const attachOut = execSync(`hdiutil attach "${dmgPath}" -nobrowse`).toString();
21
+
22
+ // Look for /Volumes path in the output - it's usually on the last line
23
+ const lines = attachOut.split('\n').filter(line => line.trim());
24
+ const mountLine = lines.find(line => line.includes('/Volumes/'));
25
+ const mount = mountLine ? mountLine.split('\t').pop().trim() : null;
26
+
27
+ if (!mount) {
28
+ console.error("Full hdiutil output:", attachOut);
29
+ throw new Error("Failed to find mount point");
30
+ }
31
+
32
+ console.log("• Copying to /Applications …");
33
+ const systemAppsDir = "/Applications";
34
+ const appSrc = path.join(mount, "AGI.app");
35
+ const appDest = path.join(systemAppsDir, "AGI.app");
36
+
37
+ // Use ditto for robust app bundle copy. Try without admin first, then prompt via AppleScript.
38
+ const dittoCmd = `ditto "${appSrc}" "${appDest}"`;
39
+ try {
40
+ execSync(dittoCmd, { stdio: "inherit" });
41
+ } catch (err) {
42
+ console.log("• Admin permission required. Prompting…");
43
+ const escapedCmd = dittoCmd.replace(/"/g, '\\"');
44
+ execSync(`osascript -e 'do shell script "${escapedCmd}" with administrator privileges'`, { stdio: "inherit" });
45
+ }
46
+
47
+ // Best-effort: remove quarantine to avoid gatekeeper warnings on first launch
48
+ try {
49
+ execSync(`xattr -dr com.apple.quarantine "${appDest}"`, { stdio: "ignore" });
50
+ } catch {}
51
+
52
+ // Remove any duplicate in the user's Applications folder to avoid confusion
53
+ try {
54
+ const userAppsDir = path.join(os.homedir(), 'Applications');
55
+ const userApp = path.join(userAppsDir, 'AGI.app');
56
+ if (fs.existsSync(userApp)) {
57
+ console.log("• Removing duplicate from ~/Applications …");
58
+ fs.rmSync(userApp, { recursive: true, force: true });
59
+ }
60
+ } catch {}
61
+
62
+ console.log("• Detaching …");
63
+ execSync(`hdiutil detach "${mount}"`);
64
+ fs.unlinkSync(dmgPath);
65
+
66
+ console.log("✅ AGI installed!");
67
+
68
+ console.log("• Opening AGI …");
69
+ execSync(`open "${appDest}"`);
70
+ } catch (e) {
71
+ console.error("⚠️ DMG install failed:", e.message);
72
+ process.exit(1);
73
+ }
74
+ })();