Skip to content

Research: WebAssembly (Wasm) Build Support #141

@kshivang

Description

@kshivang

Overview

Investigate feasibility of building BossTerm for WebAssembly (Wasm) target.

Current State

  • All code is JVM-specific (desktopMain/jvmMain)
  • No commonMain source sets exist
  • Heavy dependencies on JVM-only libraries (pty4j, AWT, java.io)

Blockers

Critical (Cannot be resolved in Wasm)

  • PTY/process spawning - Wasm sandbox prevents local shell access
  • Compose Desktop - No Wasm rendering equivalent

Major (Requires significant refactoring)

  • java.io dependencies throughout codebase
  • ScheduledExecutorService for threading
  • Blocking I/O patterns incompatible with JS async model
  • ICU4J for grapheme clustering

Proposed Approach

Rather than a full Wasm port, extract terminal emulation core as a reusable library:

  1. Phase 1: Create commonMain structure

    • Extract platform-agnostic terminal logic
    • Abstract I/O behind interfaces (expect/actual)
  2. Phase 2: Wasm terminal library

    • BossEmulator, TerminalLine, ANSI parsing
    • Buffer management, text styling
    • Result: bossterm-core-wasm library
  3. Phase 3: Web terminal client (optional)

    • Pair with xterm.js for rendering
    • WebSocket connection to SSH server
    • No local PTY (server-side only)

Use Cases for Wasm Library

  • Embedded terminal widgets in web apps
  • Browser-based SSH clients
  • Online IDE terminal panels
  • Documentation with interactive examples

Effort Estimate

  • Phase 1: 2-4 weeks
  • Phase 2: 8-12 weeks
  • Phase 3: 4-6 weeks (optional)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions