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 CHANGED
@@ -1,32 +1,15 @@
1
- # Agent Swarm CLI
1
+ # js
2
2
 
3
- Agent Swarm CLI is the terminal client for Agent Swarm.
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
- npm i -g agentswarm-cli
6
+ bun install
11
7
  ```
12
8
 
13
- ## Command
9
+ To run:
14
10
 
15
11
  ```bash
16
- agentswarm
12
+ bun run index.ts
17
13
  ```
18
14
 
19
- ## What it does
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((n) => `\"${n}\"`).join(" or ") +
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.2.34",
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.2.34",
27
- "agent-swarm-cli-darwin-x64-baseline": "1.2.34",
28
- "agent-swarm-cli-windows-x64-baseline": "1.2.34",
29
- "agent-swarm-cli-linux-x64": "1.2.34",
30
- "agent-swarm-cli-linux-x64-baseline": "1.2.34",
31
- "agent-swarm-cli-windows-arm64": "1.2.34",
32
- "agent-swarm-cli-linux-arm64": "1.2.34",
33
- "agent-swarm-cli-linux-x64-musl": "1.2.34",
34
- "agent-swarm-cli-darwin-arm64": "1.2.34",
35
- "agent-swarm-cli-linux-x64-baseline-musl": "1.2.34",
36
- "agent-swarm-cli-darwin-x64": "1.2.34",
37
- "agent-swarm-cli-linux-arm64-musl": "1.2.34"
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
- try {
56
- // Use require.resolve to find the package
57
- const packageJsonPath = require.resolve(`${packageName}/package.json`)
58
- const packageDir = path.dirname(packageJsonPath)
59
- const binaryPath = path.join(packageDir, "bin", binaryName)
60
-
61
- if (!fs.existsSync(binaryPath)) {
62
- throw new Error(`Binary not found at ${binaryPath}`)
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 prepareBinDirectory(binaryName) {
72
- const binDir = path.join(__dirname, "bin")
73
- const targetPath = path.join(binDir, binaryName)
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
- // Ensure bin directory exists
76
- if (!fs.existsSync(binDir)) {
77
- fs.mkdirSync(binDir, { recursive: true })
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
- // Remove existing binary/symlink if it exists
81
- if (fs.existsSync(targetPath)) {
82
- fs.unlinkSync(targetPath)
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 { binDir, targetPath }
118
+ return false
86
119
  }
87
120
 
88
- function symlinkBinary(sourcePath, binaryName) {
89
- const { targetPath } = prepareBinDirectory(binaryName)
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
- fs.symlinkSync(sourcePath, targetPath)
92
- console.log(`agentswarm binary symlinked: ${targetPath} -> ${sourcePath}`)
144
+ function isMusl() {
145
+ try {
146
+ if (fs.existsSync("/etc/alpine-release")) return true
147
+ } catch {}
93
148
 
94
- // Verify the file exists after operation
95
- if (!fs.existsSync(targetPath)) {
96
- throw new Error(`Failed to symlink binary to ${targetPath}`)
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