@helm-protocol/helm 0.1.0
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/helm +0 -0
- package/install.js +150 -0
- package/package.json +81 -0
package/bin/helm
ADDED
|
Binary file
|
package/install.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helm Protocol — post-install binary fetcher.
|
|
5
|
+
*
|
|
6
|
+
* Downloads the pre-built helm binary for the current platform.
|
|
7
|
+
* Falls back to building from source if no pre-built binary is available.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const { execSync } = require("child_process");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const os = require("os");
|
|
14
|
+
const https = require("https");
|
|
15
|
+
|
|
16
|
+
const PACKAGE_VERSION = require("./package.json").version;
|
|
17
|
+
const REPO = "Helm-Protocol/Helm";
|
|
18
|
+
const BIN_DIR = path.join(__dirname, "bin");
|
|
19
|
+
const BIN_NAME = os.platform() === "win32" ? "helm.exe" : "helm";
|
|
20
|
+
|
|
21
|
+
function getPlatformKey() {
|
|
22
|
+
const platform = os.platform();
|
|
23
|
+
const arch = os.arch();
|
|
24
|
+
|
|
25
|
+
const platformMap = {
|
|
26
|
+
darwin: "apple-darwin",
|
|
27
|
+
linux: "unknown-linux-gnu",
|
|
28
|
+
win32: "pc-windows-msvc",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const archMap = {
|
|
32
|
+
x64: "x86_64",
|
|
33
|
+
arm64: "aarch64",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const p = platformMap[platform];
|
|
37
|
+
const a = archMap[arch];
|
|
38
|
+
|
|
39
|
+
if (!p || !a) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Unsupported platform: ${platform}-${arch}. ` +
|
|
42
|
+
"Please build from source: cargo install --path crates/helm-node"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return `${a}-${p}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function downloadUrl() {
|
|
50
|
+
const key = getPlatformKey();
|
|
51
|
+
return `https://github.com/${REPO}/releases/download/v${PACKAGE_VERSION}/helm-${key}.tar.gz`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function download(url) {
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
https
|
|
57
|
+
.get(url, (res) => {
|
|
58
|
+
if (res.statusCode === 302 || res.statusCode === 301) {
|
|
59
|
+
return download(res.headers.location).then(resolve, reject);
|
|
60
|
+
}
|
|
61
|
+
if (res.statusCode !== 200) {
|
|
62
|
+
reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const chunks = [];
|
|
66
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
67
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
68
|
+
res.on("error", reject);
|
|
69
|
+
})
|
|
70
|
+
.on("error", reject);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function installFromRelease() {
|
|
75
|
+
const url = downloadUrl();
|
|
76
|
+
console.log(`Downloading helm binary from: ${url}`);
|
|
77
|
+
|
|
78
|
+
const data = await download(url);
|
|
79
|
+
|
|
80
|
+
if (!fs.existsSync(BIN_DIR)) {
|
|
81
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const tarPath = path.join(BIN_DIR, "helm.tar.gz");
|
|
85
|
+
fs.writeFileSync(tarPath, data);
|
|
86
|
+
|
|
87
|
+
execSync(`tar -xzf helm.tar.gz`, { cwd: BIN_DIR });
|
|
88
|
+
fs.unlinkSync(tarPath);
|
|
89
|
+
|
|
90
|
+
const binPath = path.join(BIN_DIR, BIN_NAME);
|
|
91
|
+
if (fs.existsSync(binPath)) {
|
|
92
|
+
fs.chmodSync(binPath, 0o755);
|
|
93
|
+
console.log(`Helm binary installed: ${binPath}`);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function installFromSource() {
|
|
101
|
+
console.log("No pre-built binary available. Building from source...");
|
|
102
|
+
console.log("This requires Rust toolchain (rustup.rs)");
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
execSync("cargo --version", { stdio: "pipe" });
|
|
106
|
+
} catch {
|
|
107
|
+
console.error(
|
|
108
|
+
"ERROR: Rust toolchain not found. Install from https://rustup.rs"
|
|
109
|
+
);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const root = path.resolve(__dirname, "..");
|
|
114
|
+
execSync("cargo build --release -p helm-node", {
|
|
115
|
+
cwd: root,
|
|
116
|
+
stdio: "inherit",
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (!fs.existsSync(BIN_DIR)) {
|
|
120
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const srcBin = path.join(root, "target", "release", BIN_NAME);
|
|
124
|
+
const destBin = path.join(BIN_DIR, BIN_NAME);
|
|
125
|
+
fs.copyFileSync(srcBin, destBin);
|
|
126
|
+
fs.chmodSync(destBin, 0o755);
|
|
127
|
+
console.log(`Helm binary built and installed: ${destBin}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function main() {
|
|
131
|
+
console.log(`\nHelm Protocol v${PACKAGE_VERSION}`);
|
|
132
|
+
console.log("The Sovereign Agent Protocol\n");
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
const success = await installFromRelease();
|
|
136
|
+
if (success) return;
|
|
137
|
+
} catch (err) {
|
|
138
|
+
console.log(`Pre-built binary not available: ${err.message}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
installFromSource();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
main().catch((err) => {
|
|
145
|
+
console.error(`Installation failed: ${err.message}`);
|
|
146
|
+
console.error(
|
|
147
|
+
"Manual install: cargo install --path crates/helm-node"
|
|
148
|
+
);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@helm-protocol/helm",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Helm Protocol — The Sovereign Agent Protocol. A decentralized P2P network for autonomous agents with Helm Conscious attention, DID identity, on-chain governance, and token economics.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"helm",
|
|
7
|
+
"helm-protocol",
|
|
8
|
+
"helm-engine",
|
|
9
|
+
"helm-conscious",
|
|
10
|
+
"p2p",
|
|
11
|
+
"decentralized",
|
|
12
|
+
"autonomous-agent",
|
|
13
|
+
"sovereign-agent",
|
|
14
|
+
"crdt",
|
|
15
|
+
"distributed-systems",
|
|
16
|
+
"libp2p",
|
|
17
|
+
"did",
|
|
18
|
+
"helm-mother",
|
|
19
|
+
"gossipsub",
|
|
20
|
+
"kademlia",
|
|
21
|
+
"socratic-claw",
|
|
22
|
+
"agent-womb"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/Helm-Protocol/Helm"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"helm": "bin/helm"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "node install.js"
|
|
34
|
+
},
|
|
35
|
+
"os": [
|
|
36
|
+
"darwin",
|
|
37
|
+
"linux",
|
|
38
|
+
"win32"
|
|
39
|
+
],
|
|
40
|
+
"cpu": [
|
|
41
|
+
"x64",
|
|
42
|
+
"arm64"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=16"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"install.js",
|
|
49
|
+
"bin/"
|
|
50
|
+
],
|
|
51
|
+
"helm": {
|
|
52
|
+
"crates": [
|
|
53
|
+
"helm-core",
|
|
54
|
+
"helm-net",
|
|
55
|
+
"helm-engine",
|
|
56
|
+
"helm-store",
|
|
57
|
+
"helm-agent",
|
|
58
|
+
"helm-token",
|
|
59
|
+
"helm-identity",
|
|
60
|
+
"helm-governance",
|
|
61
|
+
"helm-api",
|
|
62
|
+
"helm-marketplace",
|
|
63
|
+
"helm-sandbox",
|
|
64
|
+
"helm-bridge",
|
|
65
|
+
"helm-gateway",
|
|
66
|
+
"helm-node"
|
|
67
|
+
],
|
|
68
|
+
"plugins": [
|
|
69
|
+
"helm-store",
|
|
70
|
+
"helm-agent",
|
|
71
|
+
"helm-token",
|
|
72
|
+
"helm-identity",
|
|
73
|
+
"helm-governance",
|
|
74
|
+
"helm-womb",
|
|
75
|
+
"helm-core-api",
|
|
76
|
+
"helm-sandbox",
|
|
77
|
+
"helm-bridge",
|
|
78
|
+
"helm-marketplace"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|