adb-ready 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -1
- package/COMPATIBILITY.md +6 -0
- package/README.md +84 -39
- package/dist/cli.js +43066 -5950
- package/dist/cli.js.map +95 -17
- package/docs/agent-integration.md +204 -0
- package/docs/apps-and-evidence.md +157 -0
- package/docs/automation.md +6 -0
- package/docs/threat-model.md +85 -0
- package/docs/ui-automation.md +99 -0
- package/llms.txt +37 -0
- package/package.json +10 -1
- package/schema/agent-tools-v1.json +522 -0
- package/schema/config-v1.schema.json +22 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# AI agent integration
|
|
2
|
+
|
|
3
|
+
ADB Ready exposes Android workflows to local AI agents through a typed Model
|
|
4
|
+
Context Protocol (MCP) server. The agent works with the same deterministic
|
|
5
|
+
target, application identity, verification rules, and structured problems as
|
|
6
|
+
the CLI—without receiving a generic shell or raw ADB command.
|
|
7
|
+
|
|
8
|
+
## Install and verify
|
|
9
|
+
|
|
10
|
+
Pin ADB Ready in the Android project the agent will work on:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save-dev --save-exact adb-ready
|
|
14
|
+
node ./node_modules/adb-ready/dist/cli.js doctor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The MCP server uses standard input/output and must be started from the project
|
|
18
|
+
root:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node ./node_modules/adb-ready/dist/cli.js mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Do not run that command by hand for normal use; the MCP client starts and stops
|
|
25
|
+
it. ADB Ready does not open an MCP network listener.
|
|
26
|
+
|
|
27
|
+
## Connect an agent
|
|
28
|
+
|
|
29
|
+
Preview the exact project change first, then apply it:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
adb-ready agent setup codex --dry-run
|
|
33
|
+
adb-ready agent setup codex
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Replace `codex` with `claude-code`, `cursor`, or `vscode`. Existing unrelated
|
|
37
|
+
configuration is preserved. An existing `adb-ready` entry with different
|
|
38
|
+
settings is reported as a conflict and is never replaced automatically.
|
|
39
|
+
|
|
40
|
+
### Codex
|
|
41
|
+
|
|
42
|
+
Create a project-scoped `.codex/config.toml`:
|
|
43
|
+
|
|
44
|
+
```toml
|
|
45
|
+
[mcp_servers.adb_ready]
|
|
46
|
+
command = "node"
|
|
47
|
+
args = ["./node_modules/adb-ready/dist/cli.js", "mcp"]
|
|
48
|
+
default_tools_approval_mode = "writes"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Codex CLI, the Codex IDE extension, and the ChatGPT desktop app share Codex MCP
|
|
52
|
+
configuration. See the [official Codex MCP guide](https://learn.chatgpt.com/docs/extend/mcp).
|
|
53
|
+
|
|
54
|
+
### Claude Code
|
|
55
|
+
|
|
56
|
+
Run this from the project root:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
claude mcp add --scope project adb-ready -- node ./node_modules/adb-ready/dist/cli.js mcp
|
|
60
|
+
claude mcp get adb-ready
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Claude Code stores project-scoped servers in `.mcp.json` and asks users to
|
|
64
|
+
approve them. See the [official Claude Code MCP guide](https://docs.anthropic.com/en/docs/claude-code/mcp).
|
|
65
|
+
|
|
66
|
+
### Cursor
|
|
67
|
+
|
|
68
|
+
Create `.cursor/mcp.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"adb-ready": {
|
|
74
|
+
"command": "node",
|
|
75
|
+
"args": ["./node_modules/adb-ready/dist/cli.js", "mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See the [official Cursor MCP guide](https://docs.cursor.com/context/model-context-protocol).
|
|
82
|
+
|
|
83
|
+
### VS Code and GitHub Copilot
|
|
84
|
+
|
|
85
|
+
Create `.vscode/mcp.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"servers": {
|
|
90
|
+
"adb-ready": {
|
|
91
|
+
"type": "stdio",
|
|
92
|
+
"command": "node",
|
|
93
|
+
"args": ["${workspaceFolder}/node_modules/adb-ready/dist/cli.js", "mcp"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See the [official VS Code MCP guide](https://code.visualstudio.com/docs/agent-customization/mcp-servers).
|
|
100
|
+
|
|
101
|
+
### Windsurf
|
|
102
|
+
|
|
103
|
+
Windsurf currently keeps MCP configuration in a user-scoped file. Generate a
|
|
104
|
+
project-bound snippet and merge it through Windsurf MCP settings:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
adb-ready agent setup windsurf
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
ADB Ready deliberately does not edit this global file. The generated entry
|
|
111
|
+
uses an absolute local package path and `ADB_READY_MCP_PROJECT_ROOT` so Cascade
|
|
112
|
+
still resolves the intended project. See the [official Windsurf MCP guide](https://docs.windsurf.com/windsurf/cascade/mcp).
|
|
113
|
+
|
|
114
|
+
### Other MCP clients
|
|
115
|
+
|
|
116
|
+
Generate a standard `mcpServers` entry:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
adb-ready agent setup generic
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Merge the result at the location required by the client and ensure the server
|
|
123
|
+
starts in the Android project root.
|
|
124
|
+
|
|
125
|
+
## Recommended agent workflow
|
|
126
|
+
|
|
127
|
+
Ask the agent to follow this sequence:
|
|
128
|
+
|
|
129
|
+
1. Call `doctor` when host or ADB health is unknown.
|
|
130
|
+
2. Call `ensure_ready`; provide an exact device serial, configured alias, or
|
|
131
|
+
transport ID when more than one ready target exists.
|
|
132
|
+
3. Resolve the project app with `resolve_app`.
|
|
133
|
+
4. Use `inspect_app` or `inspect_ui` for bounded current evidence.
|
|
134
|
+
5. Perform one typed action, then inspect again instead of assuming success.
|
|
135
|
+
6. Use `get_session_problems` or `compile_debug_context` for an existing
|
|
136
|
+
development session.
|
|
137
|
+
|
|
138
|
+
The first successful `ensure_ready` binds one target to that MCP connection.
|
|
139
|
+
Later tools cannot silently switch to another target.
|
|
140
|
+
|
|
141
|
+
Tool calls within one MCP connection are executed in submission order. This
|
|
142
|
+
prevents parallel agent requests from interleaving target binding, UI snapshots,
|
|
143
|
+
or device mutations. Separate MCP connections remain independent.
|
|
144
|
+
|
|
145
|
+
## Tool surface
|
|
146
|
+
|
|
147
|
+
| Capability | MCP tools |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| Host and target readiness | `doctor`, `list_targets`, `ensure_ready` |
|
|
150
|
+
| App identity and lifecycle | `resolve_app`, `install_app`, `launch_app`, `restart_app`, `open_url` |
|
|
151
|
+
| Current evidence | `inspect_app`, `inspect_ui`, `capture_screenshot` |
|
|
152
|
+
| Safe UI actions | `tap_ui`, `long_press_ui`, `swipe_ui`, `type_text_ui`, `press_key_ui`, `wait_for_ui` |
|
|
153
|
+
| Saved diagnostics | `get_session_problems`, `compile_debug_context` |
|
|
154
|
+
|
|
155
|
+
MCP resources keep larger read-only context outside tool calls:
|
|
156
|
+
|
|
157
|
+
| Resource | Content |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| `adb-ready://targets` | current target inventory and this connection's bound target |
|
|
160
|
+
| `adb-ready://sessions` | bounded saved-session manifests |
|
|
161
|
+
| `adb-ready://sessions/{sessionId}` | one session manifest |
|
|
162
|
+
| `adb-ready://sessions/{sessionId}/events/{offset}/{limit}` | a page of up to 200 redacted events |
|
|
163
|
+
| `adb-ready://sessions/{sessionId}/context` | a bounded redacted Markdown context document |
|
|
164
|
+
|
|
165
|
+
Tool results contain the same structured success, problem, evidence, and
|
|
166
|
+
verification data used by CLI JSON output.
|
|
167
|
+
|
|
168
|
+
The npm package also ships `schema/agent-tools-v1.json`, generated from the
|
|
169
|
+
server's real `tools/list` response during every build. Integrations can inspect
|
|
170
|
+
version-matched input schemas and safety annotations without starting ADB.
|
|
171
|
+
|
|
172
|
+
## Safety boundary
|
|
173
|
+
|
|
174
|
+
- There is no arbitrary command, shell, or raw ADB tool.
|
|
175
|
+
- MCP tool arguments are schema-validated before execution.
|
|
176
|
+
- Local APK installation accepts only a real path inside the project.
|
|
177
|
+
- Screenshots require an explicit tool call and are stored as project files.
|
|
178
|
+
- UI hierarchy and app inspection are marked sensitive and remain bounded.
|
|
179
|
+
- UI references are checked against a fresh hierarchy digest before mutation;
|
|
180
|
+
stale references are rejected.
|
|
181
|
+
- Data clearing and uninstall are intentionally absent from the agent surface.
|
|
182
|
+
- Tool annotations help clients request approval, but ADB Ready enforces its
|
|
183
|
+
own target, path, and destructive-action rules.
|
|
184
|
+
- Nothing is uploaded by ADB Ready. The selected AI client controls what tool
|
|
185
|
+
results it sends to its model provider.
|
|
186
|
+
|
|
187
|
+
Review the client configuration before approving it and keep write-capable
|
|
188
|
+
tools behind the client's approval policy. See [Security](../SECURITY.md) for
|
|
189
|
+
the complete trust model.
|
|
190
|
+
|
|
191
|
+
## Runtime alternatives
|
|
192
|
+
|
|
193
|
+
The published bundle is smoke-tested as an MCP stdio server under Node.js, Bun,
|
|
194
|
+
and Deno. Replace the command and arguments when Node.js is not your chosen
|
|
195
|
+
runtime:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
Bun: bun ./node_modules/adb-ready/dist/cli.js mcp
|
|
199
|
+
Deno: deno run -A ./node_modules/adb-ready/dist/cli.js mcp
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Deno's `-A` grants the local server the filesystem, process, environment, and
|
|
203
|
+
network access required to find project metadata and invoke ADB. Use the
|
|
204
|
+
client's sandbox controls when a narrower host boundary is required.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Apps and evidence
|
|
2
|
+
|
|
3
|
+
ADB Ready resolves project identity locally when possible, then binds
|
|
4
|
+
target-based app operations and evidence to one deterministic Android target.
|
|
5
|
+
It reports success only after the requested postcondition is observed.
|
|
6
|
+
|
|
7
|
+
## App identity
|
|
8
|
+
|
|
9
|
+
Inspect the project app without hard-coding its package name:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
adb-ready app resolve
|
|
13
|
+
adb-ready app info
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Resolution prefers an explicit `APP_ID`, then project configuration and
|
|
17
|
+
detected Android project metadata. Every resolved result includes provenance.
|
|
18
|
+
If equally valid candidates remain, ADB Ready asks for an explicit choice
|
|
19
|
+
instead of selecting the first package.
|
|
20
|
+
|
|
21
|
+
Explicit, configured, Gradle, Expo, and manifest identity can be resolved with
|
|
22
|
+
no running emulator, connected phone, or ADB binary. Only the final
|
|
23
|
+
installed-package fallback requires a target.
|
|
24
|
+
|
|
25
|
+
Set a stable project value when detection is not sufficient:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"app": {
|
|
30
|
+
"android": {
|
|
31
|
+
"package": "com.example.app"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
List installed packages when investigating a target:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
adb-ready apps list
|
|
41
|
+
adb-ready apps list --system --filter google
|
|
42
|
+
adb-ready apps list --all --json --non-interactive
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
User packages are the default. Enumeration and machine output are bounded.
|
|
46
|
+
|
|
47
|
+
## App lifecycle
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
adb-ready app install ./android/app/build/outputs/apk/debug/app-debug.apk --replace
|
|
51
|
+
adb-ready app launch
|
|
52
|
+
adb-ready app restart
|
|
53
|
+
adb-ready app stop
|
|
54
|
+
adb-ready open 'myapp://orders/42' --package com.example.app
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Installation currently accepts one ordinary APK. Split APK sets, `.apks`,
|
|
58
|
+
`.aab`, and implicit downloads are not accepted.
|
|
59
|
+
- Install, launch, stop, restart, and explicit deep-link handlers are checked
|
|
60
|
+
after ADB accepts the request.
|
|
61
|
+
- `restart` is a verified stop followed by a verified launch.
|
|
62
|
+
- Add `--activity .MainActivity` only when Android cannot resolve a launchable
|
|
63
|
+
activity.
|
|
64
|
+
- Add `--grant-runtime-permissions` to an install only when that behavior is
|
|
65
|
+
intended.
|
|
66
|
+
|
|
67
|
+
Preview exact target-scoped ADB operations without changing the device:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
adb-ready app restart --dry-run --json
|
|
71
|
+
adb-ready app clear-data --dry-run
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`clear-data` and `uninstall` are destructive. Interactive use requires a
|
|
75
|
+
confirmation; automation must pass `--allow-destructive`. A dry run never asks
|
|
76
|
+
for destructive approval because it performs no mutation.
|
|
77
|
+
|
|
78
|
+
## Structured inspection
|
|
79
|
+
|
|
80
|
+
Build a compact snapshot of the project app, foreground state, and a small
|
|
81
|
+
classified log window:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
adb-ready inspect app
|
|
85
|
+
adb-ready inspect app com.example.app --json --non-interactive
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Screenshots are deliberately not captured by this read-only command. The
|
|
89
|
+
result reports `adb-ready capture screenshot` as the explicit next action so
|
|
90
|
+
sensitive pixels never enter evidence or AI context implicitly.
|
|
91
|
+
|
|
92
|
+
Read the current Android accessibility hierarchy:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
adb-ready inspect ui --interactive-only
|
|
96
|
+
adb-ready inspect ui --max-depth 20 --json --non-interactive
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The snapshot is capped at 2,000 nodes and includes a SHA-256 digest. Each node
|
|
100
|
+
reference contains a prefix of that digest, so callers can distinguish stale
|
|
101
|
+
references after the UI changes. `--interactive-only` keeps enabled actionable
|
|
102
|
+
nodes; `--max-depth` accepts 1–100. Secure windows and missing accessibility
|
|
103
|
+
data are reported as unavailable rather than as an empty successful snapshot.
|
|
104
|
+
|
|
105
|
+
UI text and hierarchy data are marked `sensitive: true`. They are returned only
|
|
106
|
+
by the explicit inspect command and are never included in diagnostic AI context
|
|
107
|
+
automatically.
|
|
108
|
+
|
|
109
|
+
## Evidence capture
|
|
110
|
+
|
|
111
|
+
Capture a PNG directly from the selected target:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
adb-ready capture screenshot
|
|
115
|
+
adb-ready capture screenshot --out artifacts/login.png
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Capture a bounded MP4 recording:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
adb-ready capture screen-record --duration 15s
|
|
122
|
+
adb-ready capture screen-record --duration 30s --out artifacts/repro.mp4
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Evidence paths are relative to the current project. A capture never follows a
|
|
126
|
+
symlink outside that root and never replaces an existing file unless `--force`
|
|
127
|
+
is explicit. Files are written through a private temporary path and published
|
|
128
|
+
only after validation.
|
|
129
|
+
|
|
130
|
+
Some multi-display Android builds, including foldables, emit a short textual
|
|
131
|
+
warning before the screenshot bytes. ADB Ready removes only a bounded text
|
|
132
|
+
preamble and still requires a valid PNG signature before publishing the file.
|
|
133
|
+
|
|
134
|
+
The result contains:
|
|
135
|
+
|
|
136
|
+
- a project-relative path;
|
|
137
|
+
- media type and byte size;
|
|
138
|
+
- SHA-256 digest;
|
|
139
|
+
- selected target and capture-command provenance.
|
|
140
|
+
|
|
141
|
+
Binary data is stored as a file rather than embedded into JSON or AI context.
|
|
142
|
+
Screenshots and recordings can contain private information; ADB Ready does not
|
|
143
|
+
upload or implicitly attach them to diagnostic context.
|
|
144
|
+
|
|
145
|
+
## Target selection and automation
|
|
146
|
+
|
|
147
|
+
All commands accept the standard target selectors:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
adb-ready app info --device SERIAL
|
|
151
|
+
adb-ready capture screenshot --transport-id ID
|
|
152
|
+
adb-ready app restart --last
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Use `--json --non-interactive` for one versioned result on `stdout`, or
|
|
156
|
+
`--format ndjson` for structured progress plus the final result. Human progress
|
|
157
|
+
and errors remain on `stderr`.
|
package/docs/automation.md
CHANGED
|
@@ -43,6 +43,12 @@ JSON commands return this top-level shape:
|
|
|
43
43
|
Consumers must ignore unknown additive fields and event types within the same
|
|
44
44
|
schema version.
|
|
45
45
|
|
|
46
|
+
The npm package includes two versioned public artifacts:
|
|
47
|
+
|
|
48
|
+
- `schema/config-v1.schema.json` validates project configuration; and
|
|
49
|
+
- `schema/agent-tools-v1.json` catalogs every MCP tool's generated input schema
|
|
50
|
+
and safety annotations for the matching package version.
|
|
51
|
+
|
|
46
52
|
## Event envelope
|
|
47
53
|
|
|
48
54
|
NDJSON events include:
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Threat model
|
|
2
|
+
|
|
3
|
+
ADB Ready runs locally with the same Android access as the selected ADB server.
|
|
4
|
+
Its security goal is to make that authority explicit, narrow, target-bound, and
|
|
5
|
+
observable; it cannot sandbox ADB, the Android device, a project command, or an
|
|
6
|
+
AI client that already has broader host access.
|
|
7
|
+
|
|
8
|
+
## Trust boundaries
|
|
9
|
+
|
|
10
|
+
| Boundary | ADB Ready assumes | ADB Ready enforces |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| CLI caller | arguments may be malformed or automated | strict parsing, no implicit shell, bounded values, explicit destructive approval |
|
|
13
|
+
| ADB server and device | may be remote, stale, unavailable, or return hostile text | exact target selection, postcondition checks, output bounds, terminal sanitization |
|
|
14
|
+
| Project filesystem | may contain symlinks, existing files, or untrusted config | root containment, schema validation, atomic writes, no overwrite by default |
|
|
15
|
+
| Session storage | contains sensitive diagnostics | per-user location, bounded retention, redaction, restrictive file modes |
|
|
16
|
+
| MCP client | chooses what reaches a model provider | local stdio only, typed tools, one bound target, no generic shell/raw ADB |
|
|
17
|
+
| npm and CI | dependencies and release credentials can be attacked | pinned lockfile, package allowlist, short-lived OIDC publishing, provenance |
|
|
18
|
+
|
|
19
|
+
## Protected assets
|
|
20
|
+
|
|
21
|
+
- pairing codes, environment secrets, logs, screenshots, and UI text;
|
|
22
|
+
- the identity and state of the intended Android target and app;
|
|
23
|
+
- project files and existing ADB port mappings;
|
|
24
|
+
- the integrity of the published npm package and its command/tool contracts.
|
|
25
|
+
|
|
26
|
+
## Main threats and controls
|
|
27
|
+
|
|
28
|
+
### Command and input injection
|
|
29
|
+
|
|
30
|
+
Child commands use an executable plus argument array without an implicit shell.
|
|
31
|
+
MCP exposes allowlisted workflows rather than command execution. Android text
|
|
32
|
+
input accepts only a conservative character set; key actions map to numeric
|
|
33
|
+
allowlisted keycodes.
|
|
34
|
+
|
|
35
|
+
### Wrong-target mutation
|
|
36
|
+
|
|
37
|
+
Every target-aware operation uses an exact ADB serial or transport ID. Ambiguous
|
|
38
|
+
selection fails. An MCP connection binds one target and refuses a silent
|
|
39
|
+
switch. UI references include the current hierarchy digest and are revalidated
|
|
40
|
+
immediately before mutation.
|
|
41
|
+
|
|
42
|
+
### Unsafe file mutation
|
|
43
|
+
|
|
44
|
+
Capture and setup paths are constrained to the project, checked for unsafe
|
|
45
|
+
symlinks, written atomically, and not replaced without an explicit policy. MCP
|
|
46
|
+
APK installation accepts only an existing project-local file.
|
|
47
|
+
|
|
48
|
+
### Secret or terminal escape disclosure
|
|
49
|
+
|
|
50
|
+
Human output is terminal-sanitized. Stored diagnostic events are bounded and
|
|
51
|
+
redacted. Pairing codes use protected input or stdin and never enter process
|
|
52
|
+
arguments. Screenshots and UI hierarchies require explicit calls and never join
|
|
53
|
+
AI context automatically.
|
|
54
|
+
|
|
55
|
+
### Unbounded or misleading automation
|
|
56
|
+
|
|
57
|
+
Process output, recordings, UI trees, session storage, context, retries, and
|
|
58
|
+
waits are bounded. Results distinguish process acceptance (`ok`) from observed
|
|
59
|
+
postconditions (`verified`). An unchanged UI is reported as a verification gap,
|
|
60
|
+
not silently upgraded to verified success.
|
|
61
|
+
|
|
62
|
+
### Network exposure
|
|
63
|
+
|
|
64
|
+
The 0.2 MCP server uses stdio and opens no listener. ADB itself may connect to a
|
|
65
|
+
local or remote server selected by the user; that existing authority is outside
|
|
66
|
+
ADB Ready's isolation boundary.
|
|
67
|
+
|
|
68
|
+
## Intentionally absent
|
|
69
|
+
|
|
70
|
+
- arbitrary shell or raw ADB MCP tools;
|
|
71
|
+
- automatic downloads, mutable `latest` execution, or implicit tool installs;
|
|
72
|
+
- MCP data clearing and uninstall operations;
|
|
73
|
+
- autonomous destructive recovery;
|
|
74
|
+
- automatic screenshot or UI-text upload.
|
|
75
|
+
|
|
76
|
+
## Residual risk
|
|
77
|
+
|
|
78
|
+
A trusted ADB server can control connected Android targets, and an approved AI
|
|
79
|
+
client may transmit tool results under its own provider policy. Accessibility
|
|
80
|
+
hierarchies can expose on-screen personal data. Project commands and installed
|
|
81
|
+
APKs execute with their normal platform authority. Users must review targets,
|
|
82
|
+
MCP approvals, artifacts, and captured evidence accordingly.
|
|
83
|
+
|
|
84
|
+
Report a vulnerability through the private channel in the
|
|
85
|
+
[Security Policy](../SECURITY.md).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Safe UI automation
|
|
2
|
+
|
|
3
|
+
ADB Ready can inspect and operate the current Android UI without exposing a
|
|
4
|
+
generic shell. Every mutation reads the accessibility hierarchy first, sends
|
|
5
|
+
one allowlisted Android input action, and reads the hierarchy again.
|
|
6
|
+
|
|
7
|
+
## Inspect before acting
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
adb-ready inspect ui --interactive-only
|
|
11
|
+
adb-ready inspect ui --interactive-only --json --non-interactive
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Each node has a reference such as `ui:7c4a31b8d2ef:14`. The middle value is a
|
|
15
|
+
prefix of the current hierarchy digest. A reference is accepted only while the
|
|
16
|
+
device still returns that same UI digest; after any screen change, inspect
|
|
17
|
+
again. Hierarchies and UI text are sensitive and are not persisted
|
|
18
|
+
automatically.
|
|
19
|
+
|
|
20
|
+
## Tap and long-press
|
|
21
|
+
|
|
22
|
+
Prefer a current reference because it ties the action to observed UI state:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
adb-ready ui tap ui:7c4a31b8d2ef:14
|
|
26
|
+
adb-ready ui long-press ui:7c4a31b8d2ef:21
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Explicit coordinates are available when the accessibility tree has no usable
|
|
30
|
+
node. They must be integers inside the current display:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
adb-ready ui tap 540 1200
|
|
34
|
+
adb-ready ui long-press 540 1200
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
ADB Ready rejects stale, disabled, non-actionable, missing-bounds, and
|
|
38
|
+
out-of-display targets before input is sent.
|
|
39
|
+
|
|
40
|
+
## Swipe, type, and keys
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
adb-ready ui swipe up
|
|
44
|
+
adb-ready ui swipe 900 1200 180 1200
|
|
45
|
+
adb-ready ui type "person@example.com" --submit
|
|
46
|
+
adb-ready ui press back
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Direction swipes use screen-relative points, so they work across display
|
|
50
|
+
sizes. Supported keys are `back`, `home`, `enter`, `menu`, `volume-up`, and
|
|
51
|
+
`volume-down`.
|
|
52
|
+
|
|
53
|
+
Android's text-input command passes through a device shell. ADB Ready therefore
|
|
54
|
+
accepts only 1–256 ASCII letters, numbers, spaces, and `._@+,:/-`. Unsupported
|
|
55
|
+
characters are rejected instead of being reinterpreted by a shell.
|
|
56
|
+
|
|
57
|
+
## Wait for a postcondition
|
|
58
|
+
|
|
59
|
+
Waits use exact, explicit selectors:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
adb-ready ui wait 'id=com.example:id/submit' --state visible --timeout 5s
|
|
63
|
+
adb-ready ui wait 'text=Loading' --state gone --timeout 10s
|
|
64
|
+
adb-ready ui wait 'desc=Open settings'
|
|
65
|
+
adb-ready ui wait 'package=com.example.app'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Selector prefixes are `id=`, `text=`, `desc=`, and `package=`. The default
|
|
69
|
+
state is `visible`; timeouts are bounded from 100 ms to 2 minutes. Structured
|
|
70
|
+
results include the attempt count and the matched node summary.
|
|
71
|
+
|
|
72
|
+
## Verification contract
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
adb-ready ui tap ui:7c4a31b8d2ef:14 --dry-run --json
|
|
76
|
+
adb-ready ui press back --json --non-interactive
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- `ok: true` means Android accepted the allowlisted input operation.
|
|
80
|
+
- `verified: true` with `verification: "ui-changed"` means the hierarchy digest
|
|
81
|
+
changed afterward.
|
|
82
|
+
- `verified: false` with `verificationGap: "ui-unchanged"` means the command
|
|
83
|
+
succeeded but the accessibility hierarchy did not prove a visible change.
|
|
84
|
+
- A successful `ui wait` is independently verified by its selector
|
|
85
|
+
postcondition.
|
|
86
|
+
- `--dry-run` returns the exact ADB plan without sending input.
|
|
87
|
+
|
|
88
|
+
An unchanged hierarchy is not treated as a false failure: volume changes,
|
|
89
|
+
cursor movement, and actions outside UI Automator can succeed without changing
|
|
90
|
+
the tree. Automation should use `ui wait` for the expected postcondition when
|
|
91
|
+
the next state is known.
|
|
92
|
+
|
|
93
|
+
## AI agents
|
|
94
|
+
|
|
95
|
+
The MCP server exposes `tap_ui`, `long_press_ui`, `swipe_ui`, `type_text_ui`,
|
|
96
|
+
`press_key_ui`, and `wait_for_ui`. Arguments are schema-validated, each MCP
|
|
97
|
+
connection stays bound to one target, and no raw ADB or shell tool is exposed.
|
|
98
|
+
|
|
99
|
+
[Connect an agent →](./agent-integration.md)
|
package/llms.txt
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ADB Ready
|
|
2
|
+
|
|
3
|
+
> Local-first Android target readiness, development sessions, diagnostics, app control, evidence, and typed AI-agent workflows.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
- Install: `npm install --save-dev --save-exact adb-ready`
|
|
8
|
+
- Diagnose: `adb-ready doctor`
|
|
9
|
+
- Start a session: `adb-ready dev`
|
|
10
|
+
- Machine output: `adb-ready COMMAND --json --non-interactive`
|
|
11
|
+
- MCP stdio server: `node ./node_modules/adb-ready/dist/cli.js mcp`
|
|
12
|
+
- Agent setup: `adb-ready agent setup CLIENT --dry-run`
|
|
13
|
+
- MCP resources: `adb-ready://targets` and `adb-ready://sessions`
|
|
14
|
+
|
|
15
|
+
## Agent contract
|
|
16
|
+
|
|
17
|
+
1. Call `ensure_ready` before target-bound MCP tools.
|
|
18
|
+
2. Keep the bound target for the whole connection.
|
|
19
|
+
3. Inspect after mutation; do not infer success from process exit alone.
|
|
20
|
+
4. Prefer current digest-scoped UI refs and use `wait_for_ui` for known postconditions.
|
|
21
|
+
5. Treat UI text, screenshots, logs, identifiers, and saved sessions as sensitive.
|
|
22
|
+
6. Never substitute a raw shell or ADB call for a missing typed tool.
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
- Product and quick start: `README.md`
|
|
27
|
+
- Agent and MCP setup: `docs/agent-integration.md`
|
|
28
|
+
- Apps, inspection, and capture: `docs/apps-and-evidence.md`
|
|
29
|
+
- Safe UI automation: `docs/ui-automation.md`
|
|
30
|
+
- Development sessions: `docs/dev-sessions.md`
|
|
31
|
+
- Targets and wireless debugging: `docs/targets-and-wireless.md`
|
|
32
|
+
- Logs and diagnostic context: `docs/logs-and-context.md`
|
|
33
|
+
- Configuration: `docs/configuration.md`
|
|
34
|
+
- Automation contract: `docs/automation.md`
|
|
35
|
+
- Compatibility: `COMPATIBILITY.md`
|
|
36
|
+
- Security: `SECURITY.md`
|
|
37
|
+
- Threat model: `docs/threat-model.md`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adb-ready",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Make an Android target ready, then keep the development session working.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"docs",
|
|
16
16
|
"examples",
|
|
17
17
|
"LICENSE",
|
|
18
|
+
"llms.txt",
|
|
18
19
|
"schema",
|
|
19
20
|
"README.md"
|
|
20
21
|
],
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
"test:commands": "bun run build && bun run scripts/command-matrix.mjs",
|
|
36
37
|
"test:package-managers": "bun run build && bun run scripts/package-manager-smoke.mjs",
|
|
37
38
|
"test:integration": "bun test tests/integration",
|
|
39
|
+
"test:mcp": "bun run build && node scripts/mcp-smoke.mjs",
|
|
38
40
|
"smoke": "bun run build && bun run scripts/runtime-smoke.mjs",
|
|
39
41
|
"pack:check": "bun run build && bun run scripts/package-check.mjs",
|
|
40
42
|
"pack:release": "bun run scripts/create-release-artifact.mjs",
|
|
@@ -55,7 +57,9 @@
|
|
|
55
57
|
"homepage": "https://github.com/Adam014/adb-ready#readme",
|
|
56
58
|
"keywords": [
|
|
57
59
|
"adb",
|
|
60
|
+
"ai-agents",
|
|
58
61
|
"android",
|
|
62
|
+
"android-automation",
|
|
59
63
|
"adb-forward",
|
|
60
64
|
"adb-reverse",
|
|
61
65
|
"android-debugging",
|
|
@@ -65,6 +69,7 @@
|
|
|
65
69
|
"logcat",
|
|
66
70
|
"localhost",
|
|
67
71
|
"metro",
|
|
72
|
+
"mcp",
|
|
68
73
|
"port-forwarding",
|
|
69
74
|
"react-native",
|
|
70
75
|
"wireless-adb",
|
|
@@ -86,5 +91,9 @@
|
|
|
86
91
|
"tinyexec": "1.3.1",
|
|
87
92
|
"typescript": "7.0.2",
|
|
88
93
|
"yarn": "1.22.22"
|
|
94
|
+
},
|
|
95
|
+
"dependencies": {
|
|
96
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
97
|
+
"zod": "4.5.4"
|
|
89
98
|
}
|
|
90
99
|
}
|