Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,33 @@ check_node() {
return 1
}

# Download broker binary (Rust broker for workflow/SDK agent spawning)
download_broker_binary() {
step "Downloading broker binary..."

local binary_name="agent-relay-broker-${PLATFORM}"
local download_url="https://github.com/$REPO_RELAY/releases/download/v${VERSION}/${binary_name}"
local target_path="$INSTALL_DIR/bin/agent-relay-broker"

mkdir -p "$INSTALL_DIR/bin"

if curl -fsSL "$download_url" -o "$target_path" 2>/dev/null; then
chmod +x "$target_path"
# Verify binary works (Rust clap binary supports --help)
if "$target_path" --help &>/dev/null; then
success "Downloaded broker binary (workflow agent spawning)"
return 0
else
warn "broker binary failed verification"
rm -f "$target_path"
return 1
fi
else
warn "No prebuilt broker binary for $PLATFORM"
return 1
fi
}

# Download relay-pty binary
download_relay_pty() {
step "Downloading relay-pty binary..."
Expand Down Expand Up @@ -602,6 +629,9 @@ Or use nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/instal
# Install ACP bridge for Zed editor integration
install_acp_bridge || true

# Download broker binary for workflow/SDK agent spawning
download_broker_binary || true

success "Installed via npm"
}

Expand Down Expand Up @@ -738,6 +768,8 @@ main() {
INSTALL_METHOD="binary"
# Also download relay-pty binary if available
download_relay_pty || true
# Download broker binary for workflow/SDK agent spawning
download_broker_binary || true
# Download dashboard-server binary if available
download_dashboard_binary || true
# Download dashboard UI files (required for standalone binary to serve the UI)
Expand Down
12 changes: 12 additions & 0 deletions packages/broker-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,22 @@ function isExplicitPath(binaryPath: string): boolean {

function resolveDefaultBinaryPath(): string {
const exe = process.platform === "win32" ? "agent-relay.exe" : "agent-relay";
const brokerExe = process.platform === "win32" ? "agent-relay-broker.exe" : "agent-relay-broker";

// 1. Check for bundled broker binary in SDK package (npm install)
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
const bundled = path.resolve(moduleDir, "..", "bin", exe);
if (fs.existsSync(bundled)) {
return bundled;
}

// 2. Check for standalone broker binary in ~/.agent-relay/bin/ (install.sh)
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
const standaloneBroker = path.join(homeDir, ".agent-relay", "bin", brokerExe);
if (fs.existsSync(standaloneBroker)) {
return standaloneBroker;
}

// 3. Fall back to agent-relay on PATH (may be Node CLI — will fail for broker ops)
return "agent-relay";
}
Loading