@ai-setting/roy-agent-standalone 1.5.26 → 1.5.29
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/roy-agent-linux-x64 +0 -0
- package/bin/run.js +54 -0
- package/package.json +1 -1
package/bin/roy-agent-linux-x64
CHANGED
|
Binary file
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Platform detection and binary runner for @ai-setting/roy-agent-standalone
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { dirname, resolve } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import { existsSync } from 'fs';
|
|
10
|
+
|
|
11
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
|
|
13
|
+
// Platform mapping - map current platform to binary name
|
|
14
|
+
const binaryMap = {
|
|
15
|
+
'linux-x64': 'roy-agent-linux-x64',
|
|
16
|
+
'linux-arm64': 'roy-agent-linux-arm64',
|
|
17
|
+
'darwin-x64': 'roy-agent-darwin-x64',
|
|
18
|
+
'darwin-arm64': 'roy-agent-darwin-arm64',
|
|
19
|
+
'win32-x64': 'roy-agent-windows-x64.exe',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const key = `${process.platform}-${process.arch}`;
|
|
23
|
+
let binary = binaryMap[key];
|
|
24
|
+
|
|
25
|
+
// Fallback: if platform-specific binary not found, try any available binary
|
|
26
|
+
if (!binary || !existsSync(resolve(__dirname, binary))) {
|
|
27
|
+
// Try to find any available binary
|
|
28
|
+
const candidates = ['roy-agent-linux-x64', 'roy-agent', 'roy-agent-darwin-x64', 'roy-agent-darwin-arm64'];
|
|
29
|
+
for (const candidate of candidates) {
|
|
30
|
+
const candidatePath = resolve(__dirname, candidate);
|
|
31
|
+
if (existsSync(candidatePath)) {
|
|
32
|
+
binary = candidate;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!binary || !existsSync(resolve(__dirname, binary))) {
|
|
39
|
+
console.error(`❌ Unsupported platform: ${key}`);
|
|
40
|
+
console.error('No binary found for this platform.');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const binaryPath = resolve(__dirname, binary);
|
|
45
|
+
const args = process.argv.slice(2);
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
execSync(`"${binaryPath}" ${args.join(' ')}`, {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
cwd: process.cwd(),
|
|
51
|
+
});
|
|
52
|
+
} catch (error) {
|
|
53
|
+
process.exit(error.status || 1);
|
|
54
|
+
}
|