This repository was archived by the owner on Mar 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
184 lines (154 loc) · 6.07 KB
/
install.ps1
File metadata and controls
184 lines (154 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#Requires -Version 5.1
<#
.SYNOPSIS
AgentsMesh Runner Installation Script for Windows
.DESCRIPTION
Downloads and installs the AgentsMesh Runner on Windows.
.PARAMETER Version
Specific version to install (e.g., "v0.1.1"). If not specified, installs the latest version.
.PARAMETER InstallDir
Installation directory. Defaults to "$env:LOCALAPPDATA\AgentsMesh\bin"
.EXAMPLE
# Install latest version
irm https://raw.githubusercontent.com/AgentsMesh/AgentsMeshRunner/main/install.ps1 | iex
.EXAMPLE
# Install specific version
$env:VERSION = "v0.1.1"; irm https://raw.githubusercontent.com/AgentsMesh/AgentsMeshRunner/main/install.ps1 | iex
#>
param(
[string]$Version = $env:VERSION,
[string]$InstallDir = "$env:LOCALAPPDATA\AgentsMesh\bin"
)
$ErrorActionPreference = "Stop"
# Configuration
$GitHubRepo = "AgentsMesh/AgentsMeshRunner"
$BinaryName = "agentsmesh-runner.exe"
function Write-Info { param($Message) Write-Host "[INFO] $Message" -ForegroundColor Blue }
function Write-Success { param($Message) Write-Host "[SUCCESS] $Message" -ForegroundColor Green }
function Write-Warn { param($Message) Write-Host "[WARN] $Message" -ForegroundColor Yellow }
function Write-Err { param($Message) Write-Host "[ERROR] $Message" -ForegroundColor Red; exit 1 }
function Get-Architecture {
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
switch ($arch) {
"X64" { return "amd64" }
"Arm64" { return "arm64" }
default { Write-Err "Unsupported architecture: $arch" }
}
}
function Get-LatestVersion {
if ($Version) {
Write-Info "Using specified version: $Version"
return $Version
}
Write-Info "Fetching latest version..."
try {
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$GitHubRepo/releases/latest"
$Version = $release.tag_name
Write-Info "Latest version: $Version"
return $Version
}
catch {
Write-Err "Failed to get latest version: $_"
}
}
function Install-Runner {
param($Version, $Arch)
$versionNumber = $Version.TrimStart("v")
$filename = "agentsmesh-runner_${versionNumber}_windows_${Arch}.zip"
$downloadUrl = "https://github.com/$GitHubRepo/releases/download/$Version/$filename"
Write-Info "Downloading $filename..."
# Create temp directory
$tempDir = Join-Path $env:TEMP "agentsmesh-install-$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
$zipPath = Join-Path $tempDir "runner.zip"
# Download
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath -UseBasicParsing
# Extract
Write-Info "Extracting..."
Expand-Archive -Path $zipPath -DestinationPath $tempDir -Force
# Create install directory if it doesn't exist
if (-not (Test-Path $InstallDir)) {
Write-Info "Creating install directory: $InstallDir"
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
}
# Install
Write-Info "Installing to $InstallDir..."
$sourcePath = Join-Path $tempDir $BinaryName
$destPath = Join-Path $InstallDir $BinaryName
Copy-Item -Path $sourcePath -Destination $destPath -Force
Write-Success "Installed $BinaryName to $InstallDir"
}
finally {
# Cleanup
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
function Add-ToPath {
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$InstallDir*") {
Write-Info "Adding $InstallDir to user PATH..."
[Environment]::SetEnvironmentVariable(
"Path",
"$currentPath;$InstallDir",
"User"
)
$env:Path = "$env:Path;$InstallDir"
Write-Success "Added to PATH. You may need to restart your terminal."
}
else {
Write-Info "$InstallDir is already in PATH"
}
}
function Test-Installation {
$runnerPath = Join-Path $InstallDir $BinaryName
if (Test-Path $runnerPath) {
Write-Success "Installation verified!"
Write-Host ""
& $runnerPath version
return $true
}
return $false
}
function Show-NextSteps {
Write-Host ""
Write-Host "============================================" -ForegroundColor Green
Write-Host " AgentsMesh Runner installed successfully!" -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:"
Write-Host ""
Write-Host " 1. Register the runner with your AgentsMesh server:"
Write-Host " # Global: https://api.agentsmesh.ai (or your own server address)"
Write-Host " agentsmesh-runner register --server <SERVER_URL> --token YOUR_TOKEN" -ForegroundColor Blue
Write-Host ""
Write-Host " 2. Start the runner:"
Write-Host " agentsmesh-runner run" -ForegroundColor Blue
Write-Host ""
Write-Host " Or install as a Windows service:"
Write-Host " agentsmesh-runner service install" -ForegroundColor Blue
Write-Host " agentsmesh-runner service start" -ForegroundColor Blue
Write-Host ""
Write-Host "For more information, visit: https://agentsmesh.ai/docs/runner"
Write-Host ""
}
# Main
function Main {
Write-Host ""
Write-Host " ___ _ __ __ _ " -ForegroundColor Cyan
Write-Host " / _ \ __ _ ___ _ _ | |_ ___|| \/ | ___ __| |_ " -ForegroundColor Cyan
Write-Host "| |_| / _`` |/ -_) ' \| _(_-<|| |\/| |/ -_)(_-<| ' \ " -ForegroundColor Cyan
Write-Host " \__,_\__, |\___|_||_|\__/__/||_| |_|\___|/__/|_||_| " -ForegroundColor Cyan
Write-Host " |___/ " -ForegroundColor Cyan
Write-Host " Runner Installer (Windows)"
Write-Host ""
$arch = Get-Architecture
Write-Info "Detected architecture: $arch"
$Version = Get-LatestVersion
Install-Runner -Version $Version -Arch $arch
Add-ToPath
if (Test-Installation) {
Show-NextSteps
}
}
Main