agentroam 0.2.0-preview.36 → 0.2.0-preview.38

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.
@@ -28,6 +28,47 @@ fi
28
28
  TEMP_ROOT=""
29
29
  OWN_NODE_LOCK=0
30
30
  OWN_LAUNCHER_LOCK=0
31
+ PROGRESS_PID=""
32
+
33
+ # Works before Node exists and never reads stdin (curl | sh owns it).
34
+ stop_progress() {
35
+ if [ -n "$PROGRESS_PID" ]; then
36
+ kill "$PROGRESS_PID" 2>/dev/null || true
37
+ wait "$PROGRESS_PID" 2>/dev/null || true
38
+ PROGRESS_PID=""
39
+ fi
40
+ }
41
+
42
+ start_progress() {
43
+ stop_progress
44
+ [ "${AGENTROAM_NO_PROGRESS:-}" != "1" ] || return 0
45
+ printf '… %s(已等待 0 秒)\n' "$1" >&2
46
+ (
47
+ progress_label=$1
48
+ progress_started=$(date +%s)
49
+ progress_sleep_pid=""
50
+ trap 'if [ -n "$progress_sleep_pid" ]; then kill "$progress_sleep_pid" 2>/dev/null || true; wait "$progress_sleep_pid" 2>/dev/null || true; fi' EXIT
51
+ trap 'exit 0' HUP INT TERM
52
+ while :; do
53
+ sleep 5 &
54
+ progress_sleep_pid=$!
55
+ wait "$progress_sleep_pid" || exit 0
56
+ progress_sleep_pid=""
57
+ progress_now=$(date +%s)
58
+ printf '… %s(已等待 %s 秒)\n' "$progress_label" "$((progress_now - progress_started))" >&2
59
+ done
60
+ ) </dev/null &
61
+ PROGRESS_PID=$!
62
+ }
63
+
64
+ run_with_progress() {
65
+ progress_command_label=$1
66
+ shift
67
+ start_progress "$progress_command_label"
68
+ if "$@"; then progress_command_status=0; else progress_command_status=$?; fi
69
+ stop_progress
70
+ return "$progress_command_status"
71
+ }
31
72
 
32
73
  fail() {
33
74
  printf 'agentroam installer: %s\n' "$*" >&2
@@ -35,6 +76,7 @@ fail() {
35
76
  }
36
77
 
37
78
  cleanup() {
79
+ stop_progress
38
80
  if [ -n "$TEMP_ROOT" ] && [ -d "$TEMP_ROOT" ]; then
39
81
  rm -rf "$TEMP_ROOT"
40
82
  fi
@@ -121,6 +163,7 @@ acquire_directory_lock() {
121
163
  done
122
164
  }
123
165
 
166
+ start_progress "正在检查可用的 Node.js"
124
167
  SYSTEM_NODE=$(command -v node 2>/dev/null || true)
125
168
  if [ "${AGENTROAM_BOOTSTRAP_TEST:-}" = "1" ] && [ "${AGENTROAM_FORCE_PRIVATE_NODE:-}" = "1" ]; then
126
169
  SYSTEM_NODE=""
@@ -138,7 +181,9 @@ else
138
181
  printf 'Using Node.js %s from NVM: %s\n' "$("$NODE_BIN" --version)" "$NODE_BIN"
139
182
  else
140
183
  if ! runtime_is_valid; then
184
+ start_progress "正在等待 Node.js 安装锁"
141
185
  acquire_directory_lock "$NODE_LOCK"
186
+ stop_progress
142
187
  OWN_NODE_LOCK=1
143
188
  if ! runtime_is_valid; then
144
189
  TEMP_ROOT=$(mktemp -d "$NODE_PARENT/.node-$NODE_VERSION.XXXXXX")
@@ -146,6 +191,7 @@ else
146
191
  extract_path="$TEMP_ROOT/extract"
147
192
  mkdir "$extract_path"
148
193
  printf 'Downloading Node.js %s...\n' "$NODE_VERSION"
194
+ start_progress "正在下载 Node.js $NODE_VERSION"
149
195
  if [ -n "${AGENTROAM_NODE_ARCHIVE_FILE:-}" ]; then
150
196
  cp "$AGENTROAM_NODE_ARCHIVE_FILE" "$archive_path"
151
197
  else
@@ -156,8 +202,10 @@ else
156
202
  sleep "$download_attempt"
157
203
  done
158
204
  fi
205
+ start_progress "正在校验 Node.js 安装包"
159
206
  actual_sha=$(shasum -a 256 "$archive_path" | awk '{print $1}')
160
207
  [ "$actual_sha" = "$NODE_SHA256" ] || fail "Node.js archive checksum mismatch"
208
+ start_progress "正在解压并验证 Node.js"
161
209
  /usr/bin/tar -xJf "$archive_path" -C "$extract_path"
162
210
  entry_count=$(find "$extract_path" -mindepth 1 -maxdepth 1 | wc -l | tr -d ' ')
163
211
  [ "$entry_count" = "1" ] || fail "unexpected Node.js archive layout"
@@ -177,6 +225,7 @@ else
177
225
  NODE_BIN="$NODE_ROOT/bin/node"
178
226
  fi
179
227
  fi
228
+ stop_progress
180
229
 
181
230
  if [ "${AGENTROAM_BOOTSTRAP_TEST:-}" = "1" ] && [ "${AGENTROAM_BOOTSTRAP_NODE_DISCOVERY_ONLY:-}" = "1" ]; then
182
231
  printf '%s\n' "$NODE_BIN"
@@ -205,7 +254,9 @@ case "$AGENTROAM_VERSION_REQUEST" in
205
254
  *)
206
255
  # A dist-tag (default "preview") — resolve to the newest published version
207
256
  # so installs always pick up the latest release without touching this file.
257
+ start_progress "正在查询 AgentRoam $AGENTROAM_VERSION_REQUEST 最新版本"
208
258
  resolved_version="$("$NODE_BIN" "$NPM_CLI" view "agentroam@$AGENTROAM_VERSION_REQUEST" version --registry "$NPM_REGISTRY" 2>/dev/null | tail -1 | tr -d '[:space:]')"
259
+ stop_progress
209
260
  [ -n "$resolved_version" ] || fail "could not resolve agentroam@$AGENTROAM_VERSION_REQUEST from $NPM_REGISTRY"
210
261
  AGENTROAM_VERSION="$resolved_version"
211
262
  printf 'Installing AgentRoam %s (resolved from %s)\n' "$AGENTROAM_VERSION" "$AGENTROAM_VERSION_REQUEST"
@@ -225,14 +276,18 @@ launcher_is_valid() {
225
276
  && [ "$("$NODE_BIN" "$LAUNCHER_ROOT/node_modules/agentroam/bin/agentroam.mjs" version 2>/dev/null | awk '{print $2}' || true)" = "$AGENTROAM_VERSION" ]
226
277
  }
227
278
 
279
+ start_progress "正在检查已安装的 CLI"
228
280
  if ! launcher_is_valid; then
281
+ start_progress "正在等待 CLI 安装锁"
229
282
  acquire_directory_lock "$LAUNCHER_LOCK"
283
+ stop_progress
230
284
  OWN_LAUNCHER_LOCK=1
231
285
  if ! launcher_is_valid; then
232
286
  TEMP_ROOT=$(mktemp -d "$LAUNCHER_PARENT/.launcher-$AGENTROAM_VERSION.XXXXXX")
233
287
  # Test-only extra specs are whitespace-delimited artifact paths in isolated CI directories.
234
288
  # shellcheck disable=SC2086
235
- "$NODE_BIN" "$NPM_CLI" install --no-audit --no-fund --registry "$NPM_REGISTRY" --prefix "$TEMP_ROOT" $EXTRA_PACKAGE_SPECS "$PACKAGE_SPEC"
289
+ run_with_progress "正在下载和安装 CLI 及平台组件" "$NODE_BIN" "$NPM_CLI" install --no-audit --no-fund --registry "$NPM_REGISTRY" --prefix "$TEMP_ROOT" $EXTRA_PACKAGE_SPECS "$PACKAGE_SPEC"
290
+ start_progress "正在验证并启用 CLI"
236
291
  entry="$TEMP_ROOT/node_modules/agentroam/bin/agentroam.mjs"
237
292
  [ -f "$entry" ] || fail "AgentRoam launcher is missing after npm install"
238
293
  [ "$("$NODE_BIN" "$entry" version | awk '{print $2}')" = "$AGENTROAM_VERSION" ] || fail "AgentRoam version validation failed"
@@ -243,6 +298,7 @@ if ! launcher_is_valid; then
243
298
  rmdir "$LAUNCHER_LOCK" 2>/dev/null || true
244
299
  OWN_LAUNCHER_LOCK=0
245
300
  fi
301
+ stop_progress
246
302
 
247
303
  entry="$LAUNCHER_ROOT/node_modules/agentroam/bin/agentroam.mjs"
248
304
  wrapper_temp=$(mktemp "$WRAPPER_DIR/.agentroam.XXXXXX")
@@ -253,18 +309,26 @@ wrapper_temp=$(mktemp "$WRAPPER_DIR/.agentroam.XXXXXX")
253
309
  chmod 755 "$wrapper_temp"
254
310
  mv "$wrapper_temp" "$WRAPPER_PATH"
255
311
 
256
- if ! "$NODE_BIN" "$entry" doctor --data-dir "$DATA_DIR"; then
312
+ if ! run_with_progress "正在检查运行组件" env AGENTROAM_NO_PROGRESS=1 "$NODE_BIN" "$entry" doctor --data-dir "$DATA_DIR"; then
257
313
  printf 'Warning: some component checks failed; continuing background service installation. Affected features may be unavailable. Run agentroam doctor to retry.\n' >&2
258
314
  fi
259
315
  if [ "${AGENTROAM_INSTALL_SKIP_SERVICE:-}" = "1" ]; then
260
316
  printf 'AgentRoam service registration skipped for isolated verification.\n'
261
317
  else
318
+ # The CLI owns progress here so it can pause for confirmations and print QR intact.
319
+ printf '… 正在安装后台服务;随后检查远程桌面授权并生成手机连接二维码\n' >&2
262
320
  codex_setup_module="$(dirname "$entry")/../dist/codex-desktop-setup.js"
263
- if [ -f "$codex_setup_module" ]; then
264
- "$NODE_BIN" "$entry" service install --root "$SERVICE_ROOT" --data-dir "$DATA_DIR" --setup-codex-desktop
265
- else
266
- printf '当前发布的 CLI 尚未包含官方 Codex 桌面共享配置;扫码可连接 AgentRoam,原桌面会话暂未共享,请升级 CLI 后重试。\n'
267
- "$NODE_BIN" "$entry" service install --root "$SERVICE_ROOT" --data-dir "$DATA_DIR"
321
+ install_background_service() {
322
+ if [ -f "$codex_setup_module" ]; then
323
+ "$NODE_BIN" "$entry" service install --root "$SERVICE_ROOT" --data-dir "$DATA_DIR" --setup-codex-desktop
324
+ else
325
+ printf '当前发布的 CLI 尚未包含官方 Codex 桌面共享配置;扫码可连接 AgentRoam,原桌面会话暂未共享,请升级 CLI 后重试。\n'
326
+ "$NODE_BIN" "$entry" service install --root "$SERVICE_ROOT" --data-dir "$DATA_DIR"
327
+ fi
328
+ }
329
+ if ! install_background_service; then
330
+ printf 'CLI 已安装,但后台服务安装或启动失败,尚不能扫码连接。请运行 agentroam service logs 查看原因,修复后运行 agentroam service start,再执行 agentroam pair。\n' >&2
331
+ exit 1
268
332
  fi
269
333
  fi
270
334
  printf '\nAgentRoam %s installed: %s\n' "$AGENTROAM_VERSION" "$WRAPPER_PATH"
@@ -288,7 +352,7 @@ case "$desktop_choice" in
288
352
  y|Y|yes|YES|是)
289
353
  desktop_helper="$LAUNCHER_ROOT/node_modules/agentroam/bin/desktop-download.mjs"
290
354
  if [ -f "$desktop_helper" ]; then
291
- "$NODE_BIN" "$desktop_helper" "$AGENTROAM_VERSION" || printf 'CLI 安装已完成,桌面端可稍后重新下载。\n'
355
+ run_with_progress "正在下载并校验桌面端安装包" env AGENTROAM_NO_PROGRESS=1 "$NODE_BIN" "$desktop_helper" "$AGENTROAM_VERSION" || printf 'CLI 安装已完成,桌面端可稍后重新下载。\n'
292
356
  else
293
357
  printf '当前发布的 CLI 尚未包含桌面下载功能,请在新版发布后重试。CLI 安装已完成。\n'
294
358
  fi
@@ -3,13 +3,13 @@
3
3
  "installers": {
4
4
  "darwin-arm64": {
5
5
  "fileName": "install-agentroam.sh",
6
- "sha256": "8ae51c123a05aa32f1483baf6d80ff7c5dbe0cc638578402e2a65c5e314f90de",
7
- "size": 12028
6
+ "sha256": "9fad4cb6528e0b71224c40c4eece94881a67191b165ccb673b980498b8646487",
7
+ "size": 14575
8
8
  },
9
9
  "windows-amd64": {
10
10
  "fileName": "install-agentroam.ps1",
11
- "sha256": "4a3683a3e6027e15356dab7a5c7d02a81ad1be3f4bad61a6119328ed2ab89298",
12
- "size": 13155
11
+ "sha256": "5df75c9a139997cfee382ef824216b92bf4a68eba679fbc5be01102019ce1652",
12
+ "size": 13309
13
13
  }
14
14
  }
15
15
  }
@@ -99,12 +99,19 @@ if [[ -n "$codex_desktop_running_pid" && "$codex_desktop_restart" != true ]]; th
99
99
  fi
100
100
 
101
101
  # Check daemon availability before asking the existing Desktop to quit.
102
- "$codex_shared_cli" app-server daemon start
102
+ (cd "$HOME" && "$codex_shared_cli" app-server daemon start)
103
103
  if [[ ! -S "$codex_shared_socket" ]]; then
104
104
  echo "Shared app-server socket not found: $codex_shared_socket" >&2
105
105
  exit 1
106
106
  fi
107
107
  "$codex_shared_cli" app-server daemon version >/dev/null
108
+ codex_desktop_preflight_node="${AGENTROAM_CODEX_DESKTOP_PREFLIGHT_NODE:-$(command -v node || true)}"
109
+ codex_desktop_preflight="${AGENTROAM_CODEX_DESKTOP_PREFLIGHT:-$(dirname "$0")/../dist/codex-desktop-preflight.js}"
110
+ if [[ -z "$codex_desktop_preflight_node" || ! -f "$codex_desktop_preflight" ]]; then
111
+ echo "Shared backend configuration check unavailable; Desktop was preserved." >&2
112
+ exit 1
113
+ fi
114
+ "$codex_desktop_preflight_node" "$codex_desktop_preflight" "$codex_shared_url" "$codex_shared_cli"
108
115
 
109
116
  # Recheck after daemon preflight; never quit a different Desktop instance.
110
117
  codex_desktop_preflight_pid="$codex_desktop_running_pid"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentroam",
3
- "version": "0.2.0-preview.36",
3
+ "version": "0.2.0-preview.38",
4
4
  "description": "Zero-install mobile remote terminal and file console",
5
5
  "type": "module",
6
6
  "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.36",
30
- "agentroam-runtime-win32-x64": "0.2.0-preview.36",
29
+ "agentroam-runtime-darwin-arm64": "0.2.0-preview.38",
30
+ "agentroam-runtime-win32-x64": "0.2.0-preview.38",
31
31
  "agentroam-cloudflared-darwin-arm64": "0.2.0-preview.36",
32
32
  "agentroam-cloudflared-win32-x64": "0.2.0-preview.36",
33
- "agentroam-tui-darwin-arm64": "0.2.0-preview.36",
34
- "@caoqu/agentroam-tui-win32-x64": "0.2.0-preview.36"
33
+ "agentroam-tui-darwin-arm64": "0.2.0-preview.38",
34
+ "@caoqu/agentroam-tui-win32-x64": "0.2.0-preview.38"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22.0.0",