npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@budaknyenyel/emu-lab

v0.1.0

Published

Leased Android emulator testing, CLI and MCP server

Readme

emu-lab

Android emulator testing with leased devices, cached builds, device-state controls and evidence-based failure classification. The package provides a Node 24 TypeScript library, CLI and tools-only MCP server. See the implementation plan for the full intended behavior and the API guide for in-process use.

The library, CLI and MCP server route operations through the shared core, which coordinates emulator leases and test execution.

flowchart LR
    Library[Node library] --> Core[Core operations]
    CLI[CLI] --> Core
    MCP[MCP server] --> CLI
    Core --> Scheduler[Lease scheduler]
    Core --> Build[Build]
    Core --> Runners[Device runners]
    Core --> Classifier[Failure classifier]
    Scheduler --> Emulator[Android emulator]
    Runners --> Emulator

The scheduler stores a state per device, including devices in a group lease. A lease remains active until release or until both its expiry and heartbeat deadlines have passed; heartbeat renews both deadlines.

stateDiagram-v2
    [*] --> provisioning: reserve
    provisioning --> active: provision and liveness succeed
    provisioning --> quarantined: liveness fails or owner lost on recovery
    provisioning --> [*]: provisioning fails and cleanup succeeds
    active --> active: heartbeat
    active --> cleaning: release or both deadlines passed
    active --> quarantined: liveness fails or ownership unverified on recovery
    cleaning --> [*]: verified cleanup succeeds
    cleaning --> quarantined: ownership or cleanup cannot be verified
    quarantined --> [*]: dead process, owner marker and free ports verified

The failure classifier evaluates rules in descending precedence and returns the first match. The default rules distinguish environment, app and test failures; no match leaves the classification unset.

flowchart TD
    Input[Log, hierarchy, facts and artifacts] --> Rules[Rules in descending precedence]
    Rules --> Rerun{Isolated rerun passed?}
    Rerun -->|Yes| Flaky[Test: flaky]
    Rerun -->|No| Env{Environment rule matches?}
    Env -->|Yes| Environment[Environment: fail]
    Env -->|No| AppCrash{App ANR or crash matches?}
    AppCrash -->|Yes| App[App: fail]
    AppCrash -->|No| TestRule{Reset or changed-copy rule matches?}
    TestRule -->|Yes| Test[Test: fail]
    TestRule -->|No| Assertion{App assertion rule matches?}
    Assertion -->|Yes| App
    Assertion -->|No| Unknown[Fail: classification unset]

Install the published package with npm install @budaknyenyel/emu-lab, then run npx emu-lab --help or start emu-lab-mcp for MCP.

Install from source

Clone android-kit and emu-lab as sibling directories. In android-kit, run npm install && npm run build. In emu-lab, run npm install && npm run build. Android SDK tools, a compatible system image, JDK 21, hardware virtualization and Maestro 2.12.x are required for device workflows. JAVA_HOME must select JDK 21 for builds that target Java 21.

npx emu-lab doctor --json
npx emu-lab lab-status --json
npx emu-lab lease-device --profile software --json
npx emu-lab release-device --lease-id LEASE_ID --json

Options accept kebab-case flags; JSON objects and arrays can be passed as JSON strings. Each command returns the shared result envelope. Exit codes are 0 for pass, 1 for fail or flaky, and 2 for blocked, unsupported or error. Artifacts are stored below .android-kit/runs/<run-id>/emu-lab/. No telemetry is collected.

A generic MCP client can start the stdio server with an entry such as:

{
  "mcpServers": {
    "emu-lab": {
      "command": "node",
      "args": ["/path/to/emu-lab/dist/mcp/bin.js"]
    }
  }
}

Optional project configuration is read from android-kit.yaml:

emuLab:
  budget: 1
  denySerials: []
  allowInstall: false
  keepDiagnostics: false

Set keepDiagnostics: true to retain redacted emulator boot diagnostics in the run artifacts. Output is withheld if the console authentication token cannot be read.

Never use a lease to control an independently owned emulator. Host GPU support varies with drivers and headless environments; select the software profile explicitly if host GPU is unavailable. Linux requires accessible KVM, Windows requires supported WHPX/AEHD virtualization, and macOS requires HVF. Emulator console authentication must remain enabled. Use synthetic data only.

The default uses the API 36 Google Play x86-64 image, 2 GiB RAM, four cores, headless mode and host GPU. On one Windows host, headless host-GPU boots reached the locale check in 249 seconds and ready in 158 seconds on a later run; a windowed boot reached the locale check in 434 seconds. These cold-boot observations are host- and load-dependent, not a benchmark. The software profile explicitly requests SwiftShader; headless: false enables a window. Before each boot the scheduler samples CPU utilization and blocks above maxCpuLoad (default 0.85), reporting an environment result rather than booting into an overloaded host.

License

MIT