switchyard-ai 1.0.0 → 1.0.1
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/README.md +2 -2
- package/bin/switchyard-darwin-arm64 +0 -0
- package/bin/switchyard-linux-amd64 +0 -0
- package/bin/switchyard-windows-amd64.exe +0 -0
- package/bin/switchyard.js +26 -15
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Switchyard eliminates AI model routing inefficiencies, prevents destructive code modifications with pre-task Git Checkpoints, and enables Bring Your Own Key (BYOK) for zero server costs.
|
|
6
6
|
|
|
7
7
|
- Official Documentation: https://switchyard-docs--lukasdesouza.replit.app/
|
|
8
|
-
- GitHub Repository: https://github.com/LukasdeSouza/
|
|
8
|
+
- GitHub Repository: https://github.com/LukasdeSouza/switchyard-ai
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -140,7 +140,7 @@ switchyard daemon
|
|
|
140
140
|
## Links & Community
|
|
141
141
|
|
|
142
142
|
- Documentation: https://switchyard-docs--lukasdesouza.replit.app/
|
|
143
|
-
- GitHub: https://github.com/LukasdeSouza/
|
|
143
|
+
- GitHub: https://github.com/LukasdeSouza/switchyard-ai
|
|
144
144
|
- Node.js SDK: `npm install switchyard-sdk`
|
|
145
145
|
|
|
146
146
|
---
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/switchyard.js
CHANGED
|
@@ -9,11 +9,33 @@ function getBinaryPath() {
|
|
|
9
9
|
const platform = os.platform();
|
|
10
10
|
const arch = os.arch();
|
|
11
11
|
|
|
12
|
+
// 1. Try optional platform-specific npm package (smaller installs)
|
|
13
|
+
const platformPkgMap = {
|
|
14
|
+
'darwin-arm64': ['switchyard-ai-darwin-arm64', 'switchyard'],
|
|
15
|
+
'darwin-x64': ['switchyard-ai-darwin-arm64', 'switchyard'], // fallback
|
|
16
|
+
'linux-x64': ['switchyard-ai-linux-x64', 'switchyard'],
|
|
17
|
+
'win32-x64': ['switchyard-ai-win32-x64', 'switchyard.exe'],
|
|
18
|
+
};
|
|
19
|
+
const key = `${platform}-${arch}`;
|
|
20
|
+
const pkgEntry = platformPkgMap[key];
|
|
21
|
+
if (pkgEntry) {
|
|
22
|
+
try {
|
|
23
|
+
const optBin = require.resolve(`${pkgEntry[0]}/bin/${pkgEntry[1]}`);
|
|
24
|
+
if (fs.existsSync(optBin)) {
|
|
25
|
+
if (platform !== 'win32') {
|
|
26
|
+
try { fs.chmodSync(optBin, 0o755); } catch (_) {}
|
|
27
|
+
}
|
|
28
|
+
return optBin;
|
|
29
|
+
}
|
|
30
|
+
} catch (_) {}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 2. Fallback: bundled binary inside this package
|
|
12
34
|
let binaryName = '';
|
|
13
35
|
if (platform === 'win32') {
|
|
14
36
|
binaryName = 'switchyard-windows-amd64.exe';
|
|
15
37
|
} else if (platform === 'darwin') {
|
|
16
|
-
binaryName =
|
|
38
|
+
binaryName = 'switchyard-darwin-arm64';
|
|
17
39
|
} else if (platform === 'linux') {
|
|
18
40
|
binaryName = 'switchyard-linux-amd64';
|
|
19
41
|
} else {
|
|
@@ -22,41 +44,30 @@ function getBinaryPath() {
|
|
|
22
44
|
}
|
|
23
45
|
|
|
24
46
|
const binaryPath = path.join(__dirname, binaryName);
|
|
25
|
-
|
|
26
47
|
if (!fs.existsSync(binaryPath)) {
|
|
27
|
-
// Check fallback for local switchyard.exe or switchyard
|
|
28
48
|
const localFallback = path.join(__dirname, platform === 'win32' ? 'switchyard.exe' : 'switchyard');
|
|
29
|
-
if (fs.existsSync(localFallback))
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
console.error(`[Switchyard] Error: Binary not found for ${platform}-${arch} at ${binaryPath}`);
|
|
49
|
+
if (fs.existsSync(localFallback)) return localFallback;
|
|
50
|
+
console.error(`[Switchyard] Binary not found for ${platform}-${arch} at ${binaryPath}`);
|
|
33
51
|
process.exit(1);
|
|
34
52
|
}
|
|
35
53
|
|
|
36
|
-
// Ensure execution permissions on Unix
|
|
37
54
|
if (platform !== 'win32') {
|
|
38
|
-
try {
|
|
39
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
40
|
-
} catch (_) {}
|
|
55
|
+
try { fs.chmodSync(binaryPath, 0o755); } catch (_) {}
|
|
41
56
|
}
|
|
42
|
-
|
|
43
57
|
return binaryPath;
|
|
44
58
|
}
|
|
45
59
|
|
|
46
60
|
function run() {
|
|
47
61
|
const binary = getBinaryPath();
|
|
48
62
|
const args = process.argv.slice(2);
|
|
49
|
-
|
|
50
63
|
const result = spawnSync(binary, args, {
|
|
51
64
|
stdio: 'inherit',
|
|
52
65
|
windowsHide: false,
|
|
53
66
|
});
|
|
54
|
-
|
|
55
67
|
if (result.error) {
|
|
56
68
|
console.error(`[Switchyard] Failed to execute process: ${result.error.message}`);
|
|
57
69
|
process.exit(1);
|
|
58
70
|
}
|
|
59
|
-
|
|
60
71
|
process.exit(result.status ?? 0);
|
|
61
72
|
}
|
|
62
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "switchyard-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Switchyard - The Routing, Cost & Safety Layer for AI Coding Agents",
|
|
5
5
|
"main": "./bin/switchyard.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"bin",
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"switchyard-ai-darwin-arm64": "1.0.1",
|
|
16
|
+
"switchyard-ai-linux-x64": "1.0.1",
|
|
17
|
+
"switchyard-ai-win32-x64": "1.0.1"
|
|
18
|
+
},
|
|
14
19
|
"keywords": [
|
|
15
20
|
"switchyard",
|
|
16
21
|
"ai",
|
|
@@ -27,6 +32,6 @@
|
|
|
27
32
|
"license": "MIT",
|
|
28
33
|
"repository": {
|
|
29
34
|
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/LukasdeSouza/
|
|
35
|
+
"url": "git+https://github.com/LukasdeSouza/switchyard-ai.git"
|
|
31
36
|
}
|
|
32
37
|
}
|