lilith/redroid-client/README.md
Natalie d700a28b3b feat(redroid): add shared redroid-client (py) + redroid-mcp (ts) packages
Extracted from the duplicated @mr-number / @whatsapp screening tools:
- redroid-client (PyPI lilith-redroid-client): RedroidDevice adb base, batch-SDK
  vision harness, quinn.my screening recorder, phone helpers. 12 tests.
- redroid-mcp (Verdaccio @lilith/redroid-mcp): createRedroidServer/runRedroidMcp
  factory — generic spawn/token/dispatch/devices, parametrized by script + tool defs.

Both published to cocotte-forge (Verdaccio + Forgejo PyPI). The two screening apps
now subclass/call these instead of carrying duplicate copies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 15:04:24 -04:00

1.7 KiB

@lilith/redroid-client (lilith-redroid-client)

Shared client base for the lilith Android screening tools (@mr-number, @whatsapp). One implementation of the device automation, vision extraction, and screening-record plumbing; each app subclasses it and adds only its app-specific navigation + vision prompts.

What it provides

Symbol Purpose
RedroidDevice adb base: adb/adb_tap/adb_text/adb_keyevent/adb_swipe/screen_size, get_ui_dump, parse_bounds, find_and_tap_text, find_edit_text_and_input, launch_app, take_screenshot. Subclass it; override package, ui_dump_*, screenshot_*.
extract_screenshot(...) Batch-SDK vision: app supplies system + prompt, gets back a parsed JSON dict (never raises).
load_sdk() Boots claude-code-batch-sdk from disk (CLAUDE_CODE_BATCH_SDK_PATH).
post_screening(...) POST /api/clients/{id}/screening with the canonical wire body; service discriminates the tool.
clean_phone / digits_only The two phone forms (keep-+ vs digits-only).
log / set_json_mode Progress to stdout, or stderr in --json mode.

Usage

from redroid_client import RedroidDevice, extract_screenshot, post_screening, clean_phone

class WhatsAppDevice(RedroidDevice):
    ui_dump_remote = "/sdcard/wa_ui.xml"
    screenshot_prefix = "whatsapp"
    def open_chat(self, digits): ...   # app-specific nav

Install

pip install -i http://134.199.243.61:3000/api/packages/platform/pypi/simple lilith-redroid-client

Test

PYTHONPATH=src python3 -m unittest discover -s tests -v

Published to the cocotte-forge (Forgejo) PyPI registry, platform org.