agentswarm-cli 1.2.34 → 1.3.15
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 +6 -23
- package/bin/agency +3 -9
- package/package.json +13 -13
- package/postinstall.mjs +88 -30
package/README.md
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# js
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
If you use the Python framework, `agency.terminal_demo()` provisions this binary automatically. You do not need a separate npm install for that path.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
3
|
+
To install dependencies:
|
|
8
4
|
|
|
9
5
|
```bash
|
|
10
|
-
|
|
6
|
+
bun install
|
|
11
7
|
```
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
To run:
|
|
14
10
|
|
|
15
11
|
```bash
|
|
16
|
-
|
|
12
|
+
bun run index.ts
|
|
17
13
|
```
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- runs the Agent Swarm terminal UI
|
|
22
|
-
- supports local and remote model providers
|
|
23
|
-
- powers `agency-swarm` `terminal_demo()`
|
|
24
|
-
|
|
25
|
-
## Platform packages
|
|
26
|
-
|
|
27
|
-
This package installs a platform-specific binary package behind the scenes. That is the same pattern used by OpenCode's npm release.
|
|
28
|
-
|
|
29
|
-
## Source
|
|
30
|
-
|
|
31
|
-
- Framework: [VRSEN/agency-swarm](https://github.com/VRSEN/agency-swarm)
|
|
32
|
-
- CLI: [VRSEN/agentswarm-cli](https://github.com/VRSEN/agentswarm-cli)
|
|
15
|
+
This project was created using `bun init` in bun v1.2.12. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
package/bin/agency
CHANGED
|
@@ -25,8 +25,6 @@ if (envPath) {
|
|
|
25
25
|
|
|
26
26
|
const scriptPath = fs.realpathSync(fileURLToPath(import.meta.url))
|
|
27
27
|
const scriptDir = path.dirname(scriptPath)
|
|
28
|
-
|
|
29
|
-
//
|
|
30
28
|
const cached = path.join(scriptDir, ".agentswarm")
|
|
31
29
|
if (fs.existsSync(cached)) {
|
|
32
30
|
run(cached)
|
|
@@ -112,17 +110,13 @@ const names = (() => {
|
|
|
112
110
|
const musl = (() => {
|
|
113
111
|
try {
|
|
114
112
|
if (fs.existsSync("/etc/alpine-release")) return true
|
|
115
|
-
} catch {
|
|
116
|
-
// ignore
|
|
117
|
-
}
|
|
113
|
+
} catch {}
|
|
118
114
|
|
|
119
115
|
try {
|
|
120
116
|
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
121
117
|
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
122
118
|
if (text.includes("musl")) return true
|
|
123
|
-
} catch {
|
|
124
|
-
// ignore
|
|
125
|
-
}
|
|
119
|
+
} catch {}
|
|
126
120
|
|
|
127
121
|
return false
|
|
128
122
|
})()
|
|
@@ -171,7 +165,7 @@ const resolved = findBinary(scriptDir)
|
|
|
171
165
|
if (!resolved) {
|
|
172
166
|
console.error(
|
|
173
167
|
"It seems that your package manager failed to install the right version of the agentswarm-cli package for your platform. You can try manually installing " +
|
|
174
|
-
names.map((
|
|
168
|
+
names.map((name) => `"${name}"`).join(" or ") +
|
|
175
169
|
" package",
|
|
176
170
|
)
|
|
177
171
|
process.exit(1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentswarm-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Agent Swarm CLI for the terminal.",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
24
24
|
},
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"agent-swarm-cli-windows-x64": "1.
|
|
27
|
-
"agent-swarm-cli-darwin-x64-baseline": "1.
|
|
28
|
-
"agent-swarm-cli-windows-x64-baseline": "1.
|
|
29
|
-
"agent-swarm-cli-linux-x64": "1.
|
|
30
|
-
"agent-swarm-cli-linux-x64-baseline": "1.
|
|
31
|
-
"agent-swarm-cli-windows-arm64": "1.
|
|
32
|
-
"agent-swarm-cli-linux-arm64": "1.
|
|
33
|
-
"agent-swarm-cli-linux-x64-musl": "1.
|
|
34
|
-
"agent-swarm-cli-darwin-arm64": "1.
|
|
35
|
-
"agent-swarm-cli-linux-x64-baseline-musl": "1.
|
|
36
|
-
"agent-swarm-cli-darwin-x64": "1.
|
|
37
|
-
"agent-swarm-cli-linux-arm64-musl": "1.
|
|
26
|
+
"agent-swarm-cli-windows-x64": "1.3.15",
|
|
27
|
+
"agent-swarm-cli-darwin-x64-baseline": "1.3.15",
|
|
28
|
+
"agent-swarm-cli-windows-x64-baseline": "1.3.15",
|
|
29
|
+
"agent-swarm-cli-linux-x64": "1.3.15",
|
|
30
|
+
"agent-swarm-cli-linux-x64-baseline": "1.3.15",
|
|
31
|
+
"agent-swarm-cli-windows-arm64": "1.3.15",
|
|
32
|
+
"agent-swarm-cli-linux-arm64": "1.3.15",
|
|
33
|
+
"agent-swarm-cli-linux-x64-musl": "1.3.15",
|
|
34
|
+
"agent-swarm-cli-darwin-arm64": "1.3.15",
|
|
35
|
+
"agent-swarm-cli-linux-x64-baseline-musl": "1.3.15",
|
|
36
|
+
"agent-swarm-cli-darwin-x64": "1.3.15",
|
|
37
|
+
"agent-swarm-cli-linux-arm64-musl": "1.3.15"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
package/postinstall.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import fs from "fs"
|
|
4
4
|
import path from "path"
|
|
5
5
|
import os from "os"
|
|
6
|
+
import childProcess from "child_process"
|
|
6
7
|
import { fileURLToPath } from "url"
|
|
7
8
|
import { createRequire } from "module"
|
|
8
9
|
|
|
@@ -49,51 +50,108 @@ function detectPlatformAndArch() {
|
|
|
49
50
|
|
|
50
51
|
function findBinary() {
|
|
51
52
|
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
-
const packageName = `agent-swarm-cli-${platform}-${arch}`
|
|
53
53
|
const binaryName = platform === "windows" ? "agency.exe" : "agency"
|
|
54
|
+
const base = `agent-swarm-cli-${platform}-${arch}`
|
|
55
|
+
const baseline = arch === "x64" && !supportsAvx2(platform, arch)
|
|
56
|
+
const names = packageNames(platform, arch, base, baseline)
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
for (const name of names) {
|
|
59
|
+
try {
|
|
60
|
+
const packageJsonPath = require.resolve(`${name}/package.json`)
|
|
61
|
+
const packageDir = path.dirname(packageJsonPath)
|
|
62
|
+
const binaryPath = path.join(packageDir, "bin", binaryName)
|
|
63
|
+
if (!fs.existsSync(binaryPath)) continue
|
|
64
|
+
return { binaryPath, binaryName }
|
|
65
|
+
} catch {
|
|
66
|
+
continue
|
|
63
67
|
}
|
|
64
|
-
|
|
65
|
-
return { binaryPath, binaryName }
|
|
66
|
-
} catch (error) {
|
|
67
|
-
throw new Error(`Could not find package ${packageName}: ${error.message}`)
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
throw new Error(`Could not find package ${names.join(", ")}`)
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
function supportsAvx2(platform, arch) {
|
|
74
|
+
if (arch !== "x64") return false
|
|
75
|
+
|
|
76
|
+
if (platform === "linux") {
|
|
77
|
+
try {
|
|
78
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
79
|
+
} catch {
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
if (platform === "darwin") {
|
|
85
|
+
try {
|
|
86
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
87
|
+
encoding: "utf8",
|
|
88
|
+
timeout: 1500,
|
|
89
|
+
})
|
|
90
|
+
if (result.status !== 0) return false
|
|
91
|
+
return (result.stdout || "").trim() === "1"
|
|
92
|
+
} catch {
|
|
93
|
+
return false
|
|
94
|
+
}
|
|
78
95
|
}
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
if (platform === "windows") {
|
|
98
|
+
const cmd =
|
|
99
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
100
|
+
|
|
101
|
+
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
102
|
+
try {
|
|
103
|
+
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
104
|
+
encoding: "utf8",
|
|
105
|
+
timeout: 3000,
|
|
106
|
+
windowsHide: true,
|
|
107
|
+
})
|
|
108
|
+
if (result.status !== 0) continue
|
|
109
|
+
const out = (result.stdout || "").trim().toLowerCase()
|
|
110
|
+
if (out === "true" || out === "1") return true
|
|
111
|
+
if (out === "false" || out === "0") return false
|
|
112
|
+
} catch {
|
|
113
|
+
continue
|
|
114
|
+
}
|
|
115
|
+
}
|
|
83
116
|
}
|
|
84
117
|
|
|
85
|
-
return
|
|
118
|
+
return false
|
|
86
119
|
}
|
|
87
120
|
|
|
88
|
-
function
|
|
89
|
-
|
|
121
|
+
function packageNames(platform, arch, base, baseline) {
|
|
122
|
+
if (platform === "linux") {
|
|
123
|
+
const musl = isMusl()
|
|
124
|
+
if (arch === "x64") {
|
|
125
|
+
if (musl) {
|
|
126
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
127
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
128
|
+
}
|
|
129
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
130
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
131
|
+
}
|
|
132
|
+
if (musl) return [`${base}-musl`, base]
|
|
133
|
+
return [base, `${base}-musl`]
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (arch === "x64") {
|
|
137
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
138
|
+
return [base, `${base}-baseline`]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return [base]
|
|
142
|
+
}
|
|
90
143
|
|
|
91
|
-
|
|
92
|
-
|
|
144
|
+
function isMusl() {
|
|
145
|
+
try {
|
|
146
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
147
|
+
} catch {}
|
|
93
148
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
149
|
+
try {
|
|
150
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
151
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
152
|
+
return text.includes("musl")
|
|
153
|
+
} catch {
|
|
154
|
+
return false
|
|
97
155
|
}
|
|
98
156
|
}
|
|
99
157
|
|