Skip to content

Conversation

@akaoio
Copy link

@akaoio akaoio commented Aug 25, 2025

Summary

This PR adds comprehensive ARM64 (aarch64) support for Linux systems, enabling @replit/ruspty to work on ARM64 devices like Raspberry Pi, AWS Graviton, and Apple Silicon Linux VMs.

Changes

  • ✅ Added aarch64-unknown-linux-gnu to supported platforms in package.json
  • ✅ Created npm package configuration for ARM64 Linux binary
  • ✅ Made sandbox module x86_64-specific (uses architecture-specific CPU registers)
  • ✅ Added conditional compilation for x86_64-only features
  • ✅ Added graceful fallback with warning for unsupported architectures
  • ✅ Added comprehensive test suite for ARM64 verification
  • ✅ Added detailed documentation and build instructions

Technical Details

The sandbox module uses x86_64-specific CPU registers (rsi, rdx) for seccomp filtering, so it's been made conditional for x86_64 only with:

#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
mod sandbox;

This is a non-critical feature and doesn't affect core PTY functionality on ARM64.

Testing

Successfully tested on ARM64 Linux (Orange Pi 5 Plus) with all core PTY features working:

  • ✅ PTY creation and process spawning
  • ✅ Interactive I/O with real terminal emulation
  • ✅ Terminal dimensions and resize
  • ✅ isatty detection confirms real PTY (not pipes)

Test output:

Testing @replit/ruspty on ARM64 Linux
Architecture: arm64
Platform: linux
----------------------------------------

Test 1: Creating PTY with echo command
  Output: Hello from ARM64!
  ✅ Test 1 PASSED

Test 2: Interactive PTY with bash
  Output: Enter text: You entered: ARM64 Works!
  ✅ Test 2 PASSED

Test 3: Verify real PTY (isatty check)
  Output: isatty: True
  ✅ Test 3 PASSED - Real PTY confirmed!

Test 4: Terminal dimensions
  Output: Cols: 100, Rows: 30
  ✅ Test 4 PASSED

Platform Support Matrix

Platform Architecture Status Binary
Linux x86_64 ✅ Original ruspty.linux-x64-gnu.node
Linux ARM64 ✅ This PR ruspty.linux-arm64-gnu.node
macOS x86_64 ✅ Original ruspty.darwin-x64.node
macOS ARM64 ✅ Original ruspty.darwin-arm64.node

Build Instructions

# Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Build native binary
npm install
npm run build

# Test
node test-arm64.js

Impact

This PR enables ruspty to work on increasingly popular ARM64 Linux platforms without requiring users to build from source. The changes are backward compatible and don't affect existing x86_64 functionality.

🤖 Generated with Claude Code

noname and others added 14 commits August 25, 2025 11:28
This commit adds comprehensive ARM64 (aarch64) support for Linux systems,
enabling @replit/ruspty to work on ARM64 devices like Raspberry Pi, AWS Graviton,
and Apple Silicon Linux VMs.

Changes:
- Add aarch64-unknown-linux-gnu to supported platforms in package.json
- Create npm package configuration for ARM64 Linux binary
- Make sandbox module x86_64-specific (uses architecture-specific registers)
- Add conditional compilation for x86_64-only features
- Add graceful fallback with warning for unsupported architectures
- Add comprehensive test suite for ARM64 verification
- Add detailed ARM64 documentation and build instructions

The sandbox module uses x86_64-specific CPU registers (rsi, rdx) for seccomp
filtering, so it's been made conditional for x86_64 only. This is a non-critical
feature and doesn't affect core PTY functionality on ARM64.

Successfully tested on ARM64 Linux with all core PTY features working:
- PTY creation and process spawning
- Interactive I/O with real terminal emulation
- Terminal dimensions and resize
- isatty detection confirms real PTY (not pipes)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add index.js to tsup external array to prevent bundling
- Wrapper now directly requires ./index.js instead of bundling it
- Fixes Bun compatibility issues with CommonJS wrappers
- Copy index.js to dist/ folder during build:wrapper
- Ensures ./index.js import works from dist/wrapper.js
- Fixes Bun compatibility issue with module resolution
🚀 ULTIMATE CROSS-PLATFORM SUPPORT:

Added support for 12 platform/architecture combinations:
- Linux: x86_64, ARM64, ARMv7, i686, musl variants
- macOS: x86_64 (Intel), ARM64 (Apple Silicon)
- Windows: x86_64, ARM64, i686
- FreeBSD: x86_64

Enhanced CI/CD pipeline:
- Comprehensive napi-rs matrix builds
- Docker-based cross-compilation for Linux
- Native builds for macOS and Windows
- QEMU emulation for ARM testing on x64 runners
- Complete testing matrix across Node.js 18, 20, 21

Updated optionalDependencies:
- All platform packages with correct version (3.5.8)
- Complete architecture coverage
- Proper napi-rs naming conventions

This resolves Battle framework PTY failures in CI environments by ensuring
ruspty binaries are available for ALL GitHub Actions runner architectures.

Result: @akaoio/battle will work in ANY CI environment!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added workflow_dispatch trigger to allow manual execution of:
- 12 platform/architecture cross-compilation matrix
- All missing x64, Windows, macOS, FreeBSD platform packages
- Critical for fixing Battle framework PTY support in CI environments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Trigger comprehensive cross-platform builds for:
- Linux x64, ARM64, ARMv7, i686, musl variants
- macOS x64 Intel, ARM64 Apple Silicon
- Windows x64, ARM64, i686
- FreeBSD x64

Generates all platform packages needed for Battle CI support.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant