Skip to content

feat: use @cldmv/droidsock instead of @devicefarmer/adbkit - #95

Merged
Shinrai merged 2 commits into
nextfrom
feat/droidsock
Nov 8, 2026
Merged

Shinrai merged 2 commits into
nextfrom
feat/droidsock

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Swaps @devicefarmer/adbkit for @cldmv/droidsock, so the adb binary and server are no longer needed and the postinstall adb check is gone. maintainConnection now uses droidsock's heartbeat and auto-reconnect; connectionCheckInterval is ignored. engines.node goes to >=22.15.0 to match droidsock.

Rebased onto next after #96, and the new tests import the package by name so test:dist covers them.

slothlet is pinned to 3.22.1 through overrides because 3.24.0 breaks real sockets (CLDMV/slothlet#708). That only affects this repo's install, but the release has to wait for 3.24.1 and a follow-up PR that drops the override.

@cldmv-bot cldmv-bot Bot added ! feature → next v4 flow: contributor PR targeting the next integration branch type: feature Implements new functionality — a PR or issue that adds a feature area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 7, 2026
The remote now talks to the device through droidsock's own ADB client, so the adb command-line tool and its server are no longer needed, and the postinstall check for adb is gone. Connection upkeep moves to droidsock: maintainConnection turns on its heartbeat and automatic reconnect with backoff, replacing the hand-rolled heartbeat and the periodic "adb devices" check (connectionCheckInterval is now ignored). Its lifecycle events keep the connected state and the log channel in step with the socket.

Calls droidsock has no equivalent for are built on shell: screencap captures the PNG in memory through a latin1 round trip, and waitBootComplete polls sys.boot_completed, passing the time left to each shell call so a hung device can't outlast the timeout. With autoConnect off, a command on a remote that never connected now rejects with "Device not connected". getConnectionStatus no longer returns "unknown".

engines.node moves to >=22.15.0 to match droidsock. The dev-only adb-response tool, which used adbkit, is removed. The adb-client tests are ported to the droidsock mock, and a new test runs the real droidsock against a fake device on a local socket.

@cldmv/slothlet is held at 3.22.1 through overrides because 3.24.0 breaks real sockets with "Illegal invocation" (CLDMV/slothlet#708). The override only affects this repo's own install: this must not ship until slothlet 3.24.1 is on npm.
@Shinrai
Shinrai merged commit 7716818 into next Nov 8, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the feat/droidsock branch November 8, 2026 21:51
cldmv-bot Bot added a commit that referenced this pull request Nov 22, 2026
# `@cldmv/node-android-tv-remote` v2.3.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `release/2.3.0`

---

## Overview

Version 2.3.0 replaces `@devicefarmer/adbkit` with `@cldmv/droidsock`, which speaks the ADB protocol itself. The `adb` command-line tool and its server are no longer needed to drive a device, and the install-time check for `adb` is gone. Keeping the connection alive also moves to droidsock: `maintainConnection` now turns on its heartbeat and its automatic reconnect with backoff, in place of the remote's own heartbeat timer and periodic `adb devices` check.

The exported API (`createRemote`, `createAndroidTVRemote` and the default export, from both `import` and `require()`) is unchanged. `engines.node` rises from `>=22.12.0` to `>=22.15.0`, the floor droidsock declares. See [Requirements](#-requirements) and the upgrade notes.

---

## 📦 Requirements

### Node.js `>=22.15.0` is now required ([#95](#95))

`engines.node` goes from `>=22.12.0` to `>=22.15.0`, matching `@cldmv/droidsock` 2. `require()` loads the ESM build through Node's `require(esm)`, which runs without warnings on that floor, so the message `require()` throws on an older Node.js now names `>=22.15.0`.

### The `adb` binary is optional ([#95](#95))

The remote no longer shells out to `adb` or needs its server running. Install `adb` only for your own use, such as the `setup-device` steps in the README. The `postinstall` script that printed install instructions when `adb` was missing has been removed, along with `scripts/postinstall.mjs` in the published package.

---

## ⚠️ Behavior changes

### Connection upkeep comes from droidsock ([#95](#95))

With `maintainConnection` on (the default), the remote enables droidsock's heartbeat (every `heartbeatInterval` ms, 20 seconds by default) and its automatic reconnect with backoff. A dropped connection is noticed by the socket and the heartbeat and reconnected without waiting for a polling interval. Reconnect attempts, successful reconnects and giving up are reported through the `log` channel, and the connected state follows the socket.

- `connectionCheckInterval` is deprecated and ignored.
- `getConnectionStatus()` returns `"connected"` or `"disconnected"`; it no longer returns `"unknown"`.
- With `autoConnect` off, a command on a remote that never connected rejects with `Device not connected`.

### Calls without a droidsock equivalent run through `shell` ([#95](#95))

`screencap()` captures the PNG in memory over `shell`, and `waitBootComplete()` polls `sys.boot_completed`. Each poll gets only the time left before the timeout, so a hung device can't keep `waitBootComplete()` waiting past it.

---

## 🧪 Tests

- The adb-client and event tests use a droidsock mock, and a new test runs the real droidsock against a fake device on a local socket ([#95](#95)).
- `npm run test:dist` builds the package and runs the suite against `dist/`; `npm test` now includes it. The tests import the package by name, and a resolve test checks each run loaded the tree it meant to ([#96](#96)).
- The vitest config sets the `node-android-tv-remote-dev` condition with `devCondition()` from `@cldmv/configs`. The `test.nodeOptions` it used before isn't a Vitest option, so the condition never reached the test workers ([#93](#93)).

## 🔧 CI & tooling

- The dev-only `dev/tools/adb-response.mjs` tool, which was built on adbkit, has been removed ([#95](#95)).

## 📚 Documentation

- The README requirements list Node.js 22.15.0, and the ADB install section is marked optional ([#95](#95)).
- The README describes `npm run test:dist` ([#96](#96)).
- The `heartbeatInterval` JSDoc gives the real 20-second default ([#95](#95)).
- **NEW:** [docs/changelog/v2/v2.3.0.md](https://github.com/CLDMV/node-android-tv-remote/blob/v2.3.0/docs/changelog/v2/v2.3.0.md) — this changelog.

## 🔧 Dependencies

Runtime:

- `@devicefarmer/adbkit` `^4.0.1` removed, `@cldmv/droidsock` added ([#95](#95)). adbkit's `commander`, `node-forge`, `split`, `adbkit-logcat` and `adbkit-monkey` are no longer installed.
- `@cldmv/droidsock` `^2.2.0` → `^2.2.1` ([#111](#111)). droidsock 2.2.1 keeps `@cldmv/slothlet` below 3.24.0, whose stand-ins for sockets made `connect()` throw `Illegal invocation` ([CLDMV/slothlet#708](CLDMV/slothlet#708)). The `@cldmv/slothlet` override this repository carried for its own install is removed.

Development only:

- `@cldmv/configs` `^1.3.0` → `^1.4.0`, for `devCondition()` ([#93](#93)).

---

## Upgrade notes

- **Node.js `>=22.15.0` is required.** On Node.js 22.12 to 22.14, stay on [v2.2.1](https://github.com/CLDMV/node-android-tv-remote/blob/v2.3.0/docs/changelog/v2/v2.2.1.md).
- You can uninstall `adb` if nothing else needs it.
- Drop `connectionCheckInterval` from your config; it has no effect. Use `heartbeatInterval` to tune how fast a dead connection is noticed.
- Code that checked `getConnectionStatus()` for `"unknown"` can drop that branch.



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-93.4%25-brightgreen?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 95.3% |
| Branches   | 85.3% |
| Functions  | 97.6% |
| Lines      | 95.4% |

*Avg: **93.4%** · `00d3d51` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! feature → next v4 flow: contributor PR targeting the next integration branch type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant