agentroam 0.2.0-preview.15 → 0.2.0-preview.17

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.
@@ -2,7 +2,8 @@ $ErrorActionPreference = "Stop"
2
2
  $ProgressPreference = "SilentlyContinue"
3
3
 
4
4
  $NodeVersion = "22.22.0"
5
- $AgentRoamVersion = "0.2.0-preview.15"
5
+ $MinimumNodeVersion = "22.22.0"
6
+ $AgentRoamVersion = "0.2.0-preview.17"
6
7
  $NodeArchive = "node-v22.22.0-win-x64.zip"
7
8
  $NodeSha256 = "c97fa376d2becdc8863fcd3ca2dd9a83a9f3468ee7ccf7a6d076ec66a645c77a"
8
9
  $NodeUrl = "https://nodejs.org/dist/v22.22.0/$NodeArchive"
@@ -27,9 +28,14 @@ if (-not $ServiceRootExplicit -and $ServiceRoot -eq $HomeRoot) {
27
28
 
28
29
  New-Item -ItemType Directory -Force -Path $NodeParent, $LauncherParent, $WrapperDir | Out-Null
29
30
 
30
- function Test-Node22([string]$NodeBin) {
31
+ function Test-NodeVersion([string]$VersionText) {
32
+ if ($VersionText -notmatch '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$') { return $false }
33
+ try { return [Version]($VersionText.Split('+')[0]) -ge [Version]$MinimumNodeVersion } catch { return $false }
34
+ }
35
+
36
+ function Test-SupportedNode([string]$NodeBin) {
31
37
  if (-not (Test-Path -LiteralPath $NodeBin -PathType Leaf)) { return $false }
32
- try { return (& $NodeBin -p 'process.versions.node.split(".")[0]' 2>$null) -eq "22" } catch { return $false }
38
+ try { return Test-NodeVersion ((& $NodeBin -p 'process.versions.node' 2>$null).Trim()) } catch { return $false }
33
39
  }
34
40
 
35
41
  function Get-NvmRoots {
@@ -50,15 +56,15 @@ function Get-NvmRoots {
50
56
  @($Candidates | Where-Object { $_ -and (Test-Path -LiteralPath $_ -PathType Container) } | Select-Object -Unique)
51
57
  }
52
58
 
53
- function Find-NvmNode22 {
59
+ function Find-NvmNode {
54
60
  $VersionMatches = foreach ($NvmRoot in (Get-NvmRoots)) {
55
61
  foreach ($VersionDirectory in Get-ChildItem -LiteralPath $NvmRoot -Directory -ErrorAction SilentlyContinue) {
56
62
  $Candidate = Join-Path $VersionDirectory.FullName "node.exe"
57
63
  if (-not (Test-Path -LiteralPath $Candidate -PathType Leaf)) { continue }
58
64
  try {
59
65
  $VersionText = (& $Candidate -p 'process.versions.node' 2>$null).Trim()
60
- $Version = [Version]$VersionText
61
- if ($Version.Major -eq 22) {
66
+ if (Test-NodeVersion $VersionText) {
67
+ $Version = [Version]($VersionText.Split('+')[0])
62
68
  [pscustomobject]@{ Path = $Candidate; Version = $Version }
63
69
  }
64
70
  } catch {}
@@ -97,10 +103,10 @@ function Enter-InstallLock([string]$Path) {
97
103
 
98
104
  $SystemNode = Get-Command node.exe -ErrorAction SilentlyContinue
99
105
  if ($env:AGENTROAM_BOOTSTRAP_TEST -eq "1" -and $env:AGENTROAM_FORCE_PRIVATE_NODE -eq "1") { $SystemNode = $null }
100
- if ($SystemNode -and (Test-Node22 $SystemNode.Source)) {
106
+ if ($SystemNode -and (Test-SupportedNode $SystemNode.Source)) {
101
107
  $NodeBin = $SystemNode.Source
102
108
  } else {
103
- $NvmNode = if ($env:AGENTROAM_BOOTSTRAP_TEST -eq "1" -and $env:AGENTROAM_FORCE_PRIVATE_NODE -eq "1") { $null } else { Find-NvmNode22 }
109
+ $NvmNode = if ($env:AGENTROAM_BOOTSTRAP_TEST -eq "1" -and $env:AGENTROAM_FORCE_PRIVATE_NODE -eq "1") { $null } else { Find-NvmNode }
104
110
  if ($NvmNode) {
105
111
  $NodeBin = $NvmNode
106
112
  Write-Host "Using Node.js $(& $NodeBin --version) from NVM: $NodeBin"
@@ -2,7 +2,8 @@
2
2
  set -eu
3
3
 
4
4
  NODE_VERSION="22.22.0"
5
- AGENTROAM_VERSION="0.2.0-preview.15"
5
+ MINIMUM_NODE_VERSION="22.22.0"
6
+ AGENTROAM_VERSION="0.2.0-preview.17"
6
7
  NODE_ARCHIVE="node-v22.22.0-darwin-arm64.tar.xz"
7
8
  NODE_SHA256="2bd596bbfc4a275ceb8721a5954ee97daea5ebe673e96a185ebd732f6fb023ac"
8
9
  NODE_URL="https://nodejs.org/dist/v22.22.0/$NODE_ARCHIVE"
@@ -56,25 +57,40 @@ SERVICE_ROOT="$service_root_physical"
56
57
 
57
58
  mkdir -p "$NODE_PARENT" "$LAUNCHER_PARENT" "$WRAPPER_DIR"
58
59
 
59
- node_is_22() {
60
- [ -x "$1" ] && [ "$("$1" -p 'process.versions.node.split(".")[0]' 2>/dev/null || true)" = "22" ]
60
+ version_is_supported() {
61
+ awk -v version="$1" -v minimum="$MINIMUM_NODE_VERSION" 'BEGIN {
62
+ if (version !~ /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/) exit 1;
63
+ sub(/\+.*/, "", version);
64
+ split(version, actual, "."); split(minimum, required, ".");
65
+ for (component = 1; component <= 3; component++) {
66
+ if (actual[component] + 0 > required[component] + 0) exit 0;
67
+ if (actual[component] + 0 < required[component] + 0) exit 1;
68
+ }
69
+ exit 0;
70
+ }'
61
71
  }
62
72
 
63
- find_nvm_node_22() {
73
+ node_is_supported() {
74
+ [ -x "$1" ] && version_is_supported "$("$1" -p 'process.versions.node' 2>/dev/null || true)"
75
+ }
76
+
77
+ find_nvm_node() {
64
78
  best_bin=""
79
+ best_major=-1
65
80
  best_minor=-1
66
81
  best_patch=-1
67
82
  for nvm_root in "${NVM_DIR:-}" "$HOME/.nvm"; do
68
83
  [ -n "$nvm_root" ] || continue
69
- for candidate in "$nvm_root"/versions/node/v22*/bin/node; do
84
+ for candidate in "$nvm_root"/versions/node/v*/bin/node; do
70
85
  [ -x "$candidate" ] || continue
71
86
  version=$("$candidate" -p 'process.versions.node' 2>/dev/null || true)
87
+ version_is_supported "$version" || continue
72
88
  major=$(printf '%s\n' "$version" | awk -F. '{ print $1 + 0 }')
73
89
  minor=$(printf '%s\n' "$version" | awk -F. '{ print $2 + 0 }')
74
90
  patch=$(printf '%s\n' "$version" | awk -F. '{ sub(/[^0-9].*$/, "", $3); print $3 + 0 }')
75
- [ "$major" -eq 22 ] 2>/dev/null || continue
76
- if [ "$minor" -gt "$best_minor" ] || { [ "$minor" -eq "$best_minor" ] && [ "$patch" -gt "$best_patch" ]; }; then
91
+ if [ "$major" -gt "$best_major" ] || { [ "$major" -eq "$best_major" ] && { [ "$minor" -gt "$best_minor" ] || { [ "$minor" -eq "$best_minor" ] && [ "$patch" -gt "$best_patch" ]; }; }; }; then
77
92
  best_bin="$candidate"
93
+ best_major=$major
78
94
  best_minor=$minor
79
95
  best_patch=$patch
80
96
  fi
@@ -112,13 +128,13 @@ SYSTEM_NODE=$(command -v node 2>/dev/null || true)
112
128
  if [ "${AGENTROAM_BOOTSTRAP_TEST:-}" = "1" ] && [ "${AGENTROAM_FORCE_PRIVATE_NODE:-}" = "1" ]; then
113
129
  SYSTEM_NODE=""
114
130
  fi
115
- if [ -n "$SYSTEM_NODE" ] && node_is_22 "$SYSTEM_NODE"; then
131
+ if [ -n "$SYSTEM_NODE" ] && node_is_supported "$SYSTEM_NODE"; then
116
132
  NODE_BIN="$SYSTEM_NODE"
117
133
  else
118
134
  if [ "${AGENTROAM_BOOTSTRAP_TEST:-}" = "1" ] && [ "${AGENTROAM_FORCE_PRIVATE_NODE:-}" = "1" ]; then
119
135
  NVM_NODE=""
120
136
  else
121
- NVM_NODE=$(find_nvm_node_22 || true)
137
+ NVM_NODE=$(find_nvm_node || true)
122
138
  fi
123
139
  if [ -n "$NVM_NODE" ]; then
124
140
  NODE_BIN="$NVM_NODE"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentroam",
3
- "version": "0.2.0-preview.15",
3
+ "version": "0.2.0-preview.17",
4
4
  "description": "Zero-install mobile remote terminal and file console",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,7 @@
8
8
  "agent-tui": "./bin/agent-tui.mjs"
9
9
  },
10
10
  "engines": {
11
- "node": ">=22 <23"
11
+ "node": ">=22.22.0"
12
12
  },
13
13
  "files": [
14
14
  "bin",
@@ -26,12 +26,12 @@
26
26
  "undici": "^6.25.0"
27
27
  },
28
28
  "optionalDependencies": {
29
- "agentroam-runtime-darwin-arm64": "0.2.0-preview.15",
30
- "agentroam-runtime-win32-x64": "0.2.0-preview.15",
31
- "agentroam-cloudflared-darwin-arm64": "0.2.0-preview.15",
32
- "agentroam-cloudflared-win32-x64": "0.2.0-preview.15",
33
- "agentroam-tui-darwin-arm64": "0.2.0-preview.15",
34
- "@caoqu/agentroam-tui-win32-x64": "0.2.0-preview.15"
29
+ "agentroam-runtime-darwin-arm64": "0.2.0-preview.17",
30
+ "agentroam-runtime-win32-x64": "0.2.0-preview.17",
31
+ "agentroam-cloudflared-darwin-arm64": "0.2.0-preview.17",
32
+ "agentroam-cloudflared-win32-x64": "0.2.0-preview.17",
33
+ "agentroam-tui-darwin-arm64": "0.2.0-preview.17",
34
+ "@caoqu/agentroam-tui-win32-x64": "0.2.0-preview.17"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22.0.0",