@slaveoftime/oly 0.0.4
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/oly.js +23 -0
- package/install.js +85 -0
- package/package.json +31 -0
package/bin/oly.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Thin launcher: finds the downloaded oly binary and exec's it.
|
|
3
|
+
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const { spawnSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const binaryName = process.platform === "win32" ? "oly.exe" : "oly";
|
|
9
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
10
|
+
|
|
11
|
+
if (!fs.existsSync(binaryPath)) {
|
|
12
|
+
console.error(
|
|
13
|
+
"oly: binary not found. Try reinstalling: npm install -g oly"
|
|
14
|
+
);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
env: process.env,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
process.exit(result.status ?? 1);
|
package/install.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Downloads the correct oly binary for the current platform from GitHub Releases.
|
|
3
|
+
|
|
4
|
+
const https = require("https");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const { execSync } = require("child_process");
|
|
8
|
+
const os = require("os");
|
|
9
|
+
|
|
10
|
+
const pkg = require("./package.json");
|
|
11
|
+
const version = pkg.version;
|
|
12
|
+
const repo = "slaveOftime/open-relay";
|
|
13
|
+
|
|
14
|
+
function getPlatformAsset() {
|
|
15
|
+
const platform = process.platform;
|
|
16
|
+
const arch = process.arch;
|
|
17
|
+
|
|
18
|
+
if (platform === "linux" && arch === "x64") return "oly-linux-amd64.zip";
|
|
19
|
+
if (platform === "darwin" && arch === "arm64") return "oly-macos-arm64.zip";
|
|
20
|
+
if (platform === "win32" && arch === "x64") return "oly-windows-amd64.zip";
|
|
21
|
+
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Unsupported platform/arch: ${platform}/${arch}. ` +
|
|
24
|
+
"Please download the binary manually from https://github.com/" +
|
|
25
|
+
repo +
|
|
26
|
+
"/releases"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getBinaryName() {
|
|
31
|
+
return process.platform === "win32" ? "oly.exe" : "oly";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function download(url, dest) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const file = fs.createWriteStream(dest);
|
|
37
|
+
const request = (u) => {
|
|
38
|
+
https.get(u, (res) => {
|
|
39
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
40
|
+
return request(res.headers.location);
|
|
41
|
+
}
|
|
42
|
+
if (res.statusCode !== 200) {
|
|
43
|
+
reject(new Error(`Failed to download ${u}: HTTP ${res.statusCode}`));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
res.pipe(file);
|
|
47
|
+
file.on("finish", () => file.close(resolve));
|
|
48
|
+
}).on("error", reject);
|
|
49
|
+
};
|
|
50
|
+
request(url);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function install() {
|
|
55
|
+
const asset = getPlatformAsset();
|
|
56
|
+
const url = `https://github.com/${repo}/releases/download/v${version}/${asset}`;
|
|
57
|
+
const binDir = path.join(__dirname, "bin");
|
|
58
|
+
const zipPath = path.join(os.tmpdir(), asset);
|
|
59
|
+
const binaryName = getBinaryName();
|
|
60
|
+
const binaryDest = path.join(binDir, binaryName);
|
|
61
|
+
|
|
62
|
+
if (!fs.existsSync(binDir)) fs.mkdirSync(binDir, { recursive: true });
|
|
63
|
+
|
|
64
|
+
console.log(`oly: downloading ${url}`);
|
|
65
|
+
await download(url, zipPath);
|
|
66
|
+
|
|
67
|
+
// Unzip
|
|
68
|
+
if (process.platform === "win32") {
|
|
69
|
+
execSync(
|
|
70
|
+
`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${binDir}' -Force"`,
|
|
71
|
+
{ stdio: "inherit" }
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
execSync(`unzip -o "${zipPath}" -d "${binDir}"`, { stdio: "inherit" });
|
|
75
|
+
fs.chmodSync(binaryDest, 0o755);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
fs.unlinkSync(zipPath);
|
|
79
|
+
console.log(`oly: installed to ${binaryDest}`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
install().catch((err) => {
|
|
83
|
+
console.error("oly install failed:", err.message);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@slaveoftime/oly",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Session-persistent PTY daemon for long-running CLI agents — keep agents alive, get notified when they need input, intervene from anywhere.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"agent",
|
|
8
|
+
"pty",
|
|
9
|
+
"daemon",
|
|
10
|
+
"terminal"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/slaveOftime/open-relay",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/slaveOftime/open-relay.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bin": {
|
|
19
|
+
"oly": "./bin/oly.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"postinstall": "node install.js"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/",
|
|
29
|
+
"install.js"
|
|
30
|
+
]
|
|
31
|
+
}
|