@muthuishere/aos 0.5.0 → 0.7.0

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/install.sh CHANGED
@@ -11,7 +11,10 @@
11
11
  # sh install.sh --dir ~/bin
12
12
  #
13
13
  # Environment equivalents: AOS_FROM, AOS_VERSION, AOS_INSTALL_DIR
14
- # (AOS_NO_PATH=1 skips the PATH hint)
14
+ # (AOS_NO_PATH=1 skips the PATH hint; AOS_NO_WINDOWS_HOST=1 skips the WSL step)
15
+ #
16
+ # Inside WSL it also installs the Windows build into %LOCALAPPDATA%\aos, because
17
+ # screen commands run there: the screen you see is the Windows one.
15
18
  # (AOS_DOWNLOAD_BASE is accepted as an alias of AOS_FROM).
16
19
  #
17
20
  # Read it first if you like -- the right instinct for anything piped to a shell:
@@ -153,6 +156,45 @@ else
153
156
  fi
154
157
 
155
158
  say " ${DIR}/aos"
159
+
160
+ # --- WSL: screen commands run on Windows (ADR 0001), so put aos.exe in
161
+ # %LOCALAPPDATA%\aos where the Linux aos looks for it.
162
+ is_wsl() {
163
+ [ -n "${WSL_DISTRO_NAME:-}" ] || [ -n "${WSL_INTEROP:-}" ] || [ -e /proc/sys/fs/binfmt_misc/WSLInterop ]
164
+ }
165
+ install_windows_host() {
166
+ local_app=$( (cd /mnt/c 2>/dev/null; cmd.exe /c 'echo %LOCALAPPDATA%') 2>/dev/null | tr -d '\r')
167
+ case "$local_app" in ""|*%*) warn "WSL: cannot run cmd.exe, so aos.exe was not installed on Windows; run install.cmd there"; return 0 ;; esac
168
+ win_dir="$(wslpath -u "$local_app")/aos"
169
+ zip=""
170
+ if [ "${have_sums:-0}" = 1 ]; then
171
+ zip=$(awk '{print $2}' "$tmp/checksums.txt" | grep "^aos_.*_windows_${arch}\.zip\$" | { [ -n "$VERSION" ] && grep "_${VERSION#v}_" || cat; } | head -n1 || true)
172
+ elif [ -n "$VERSION" ]; then
173
+ zip="aos_${VERSION#v}_windows_${arch}.zip"
174
+ fi
175
+ if [ -z "$zip" ] || ! fetch "$zip" "$tmp/$zip"; then
176
+ warn "WSL: no Windows build at $base, so aos.exe was not installed; run install.cmd on Windows"
177
+ return 0
178
+ fi
179
+ if [ "${have_sums:-0}" = 1 ]; then
180
+ want=$(awk -v f="$zip" '$2 == f {print $1}' "$tmp/checksums.txt")
181
+ [ -n "$want" ] && [ "$want" = "$(sha256 "$tmp/$zip")" ] || die "checksum mismatch for $zip -- refusing to install"
182
+ fi
183
+ mkdir -p "$tmp/w" "$win_dir"
184
+ if command -v unzip >/dev/null 2>&1; then
185
+ unzip -oq "$tmp/$zip" -d "$tmp/w"
186
+ else
187
+ powershell.exe -NoProfile -Command "Expand-Archive -Force -LiteralPath '$(wslpath -w "$tmp/$zip")' -DestinationPath '$(wslpath -w "$tmp/w")'" >/dev/null
188
+ fi
189
+ [ -f "$tmp/w/aos.exe" ] || die "$zip does not contain aos.exe"
190
+ cp "$tmp/w/aos.exe" "$win_dir/aos.exe"
191
+ say " $win_dir/aos.exe (the Windows host: screen commands run there)"
192
+ }
193
+ if [ "$os" = linux ] && [ -z "${AOS_NO_WINDOWS_HOST:-}" ] && [ -n "${base:-}" ] && is_wsl; then
194
+ step "WSL detected: installing the Windows build too"
195
+ install_windows_host
196
+ fi
197
+
156
198
  case "${AOS_NO_PATH:+skip}:$PATH:" in
157
199
  skip*|*":$DIR:"*) ;;
158
200
  *) say ""
package/lib/install.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Installs the aos binary INTO this package (vendor/), using the same
2
2
  // install.sh / install.cmd the curl one-liners use, so `npm uninstall`
3
- // removes it and nothing is put on the global PATH.
3
+ // removes it and nothing is put on the global PATH. Inside WSL, install.sh also
4
+ // puts the Windows build in %LOCALAPPDATA%\aos, where screen commands run.
4
5
  'use strict';
5
6
  const fs = require('fs');
6
7
  const path = require('path');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muthuishere/aos",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Hands for your AI agent: one CLI to drive macOS, Windows and Linux (windows, mouse, keyboard, screenshots, files, processes, services).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://muthuishere.github.io/aos/",