@qinghuangniao/heron-ai 0.0.1-beta
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/bin/heron +31 -0
- package/install.js +85 -0
- package/package.json +28 -0
package/bin/heron
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bin/heron - cross-platform entry script for heron-ai
|
|
3
|
+
// Calls the platform-specific Go binary, passing through all arguments
|
|
4
|
+
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const PLATFORM_MAP = {
|
|
10
|
+
'linux-x64': 'heron-linux-amd64',
|
|
11
|
+
'linux-arm64': 'heron-linux-arm64',
|
|
12
|
+
'darwin-x64': 'heron-darwin-amd64',
|
|
13
|
+
'darwin-arm64': 'heron-darwin-arm64',
|
|
14
|
+
'win32-x64': 'heron-windows-amd64.exe',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const key = `${os.platform()}-${os.arch() === 'x64' ? 'x64' : os.arch()}`;
|
|
18
|
+
const binaryName = PLATFORM_MAP[key];
|
|
19
|
+
|
|
20
|
+
if (!binaryName) {
|
|
21
|
+
console.error(`Unsupported platform: ${key}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
26
|
+
|
|
27
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
28
|
+
stdio: 'inherit',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
process.exit(result.status !== null ? result.status : 1);
|
package/install.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// install.js - postinstall script for heron-ai
|
|
3
|
+
// Auto-detects platform and downloads the correct Go binary from GitHub Releases
|
|
4
|
+
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
|
|
10
|
+
const VERSION = 'v' + require('./package.json').version;
|
|
11
|
+
const REPO = 'janostudio/heron-ai';
|
|
12
|
+
const MAX_RETRIES = 3;
|
|
13
|
+
|
|
14
|
+
const PLATFORM_MAP = {
|
|
15
|
+
'linux-x64': { binary: 'heron-linux-amd64', ext: '' },
|
|
16
|
+
'linux-arm64': { binary: 'heron-linux-arm64', ext: '' },
|
|
17
|
+
'darwin-x64': { binary: 'heron-darwin-amd64', ext: '' },
|
|
18
|
+
'darwin-arm64': { binary: 'heron-darwin-arm64', ext: '' },
|
|
19
|
+
'win32-x64': { binary: 'heron-windows-amd64', ext: '.exe' },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getPlatformKey() {
|
|
23
|
+
const platform = os.platform();
|
|
24
|
+
const arch = os.arch() === 'x64' ? 'x64' : os.arch();
|
|
25
|
+
return `${platform}-${arch}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function downloadWithRetry(url, dest, retries) {
|
|
29
|
+
for (let i = 0; i < retries; i++) {
|
|
30
|
+
try {
|
|
31
|
+
console.log(`Downloading heron binary (attempt ${i + 1}/${retries})...`);
|
|
32
|
+
execSync(`curl -fsSL --retry 3 -o "${dest}" "${url}"`, { stdio: 'inherit' });
|
|
33
|
+
return true;
|
|
34
|
+
} catch (err) {
|
|
35
|
+
if (i === retries - 1) {
|
|
36
|
+
console.error(`Failed to download after ${retries} attempts: ${err.message}`);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const delay = Math.pow(2, i) * 1000;
|
|
40
|
+
console.log(`Retrying in ${delay / 1000}s...`);
|
|
41
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, delay);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function install() {
|
|
48
|
+
const key = getPlatformKey();
|
|
49
|
+
const target = PLATFORM_MAP[key];
|
|
50
|
+
|
|
51
|
+
if (!target) {
|
|
52
|
+
console.error(`Unsupported platform: ${key}`);
|
|
53
|
+
console.error('Supported platforms: ' + Object.keys(PLATFORM_MAP).join(', '));
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const binaryName = target.binary + target.ext;
|
|
58
|
+
const url = `https://github.com/${REPO}/releases/download/${VERSION}/${binaryName}`;
|
|
59
|
+
const dest = path.join(__dirname, 'bin', binaryName);
|
|
60
|
+
|
|
61
|
+
// Create bin directory if not exists
|
|
62
|
+
const binDir = path.join(__dirname, 'bin');
|
|
63
|
+
if (!fs.existsSync(binDir)) {
|
|
64
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check if binary already exists (skip download)
|
|
68
|
+
if (fs.existsSync(dest)) {
|
|
69
|
+
console.log(`Binary already exists: ${binaryName}`);
|
|
70
|
+
fs.chmodSync(dest, 0o755);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!downloadWithRetry(url, dest, MAX_RETRIES)) {
|
|
75
|
+
console.error('\nManual installation:');
|
|
76
|
+
console.error(` Download from: https://github.com/${REPO}/releases`);
|
|
77
|
+
console.error(` Place binary at: ${dest}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
fs.chmodSync(dest, 0o755);
|
|
82
|
+
console.log(`Heron installed successfully! (${binaryName})`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qinghuangniao/heron-ai",
|
|
3
|
+
"version": "0.0.1-beta",
|
|
4
|
+
"description": "Heron AI - Multi-Agent Generic Engine. Build, orchestrate, and evaluate AI agents.",
|
|
5
|
+
"keywords": ["heron", "ai", "agent", "multi-agent", "cli", "llm"],
|
|
6
|
+
"bin": {
|
|
7
|
+
"heron": "bin/heron"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node install.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"install.js",
|
|
14
|
+
"bin/heron",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/janostudio/heron-ai"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18.0.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|