feat(android): support observe-only snapshots
Summary
An IDE panel's Android snapshot can stop the agent's helper. Separate uiautomator dump calls compete for Android's sole UiAutomation connection.
Android ADB --observe-only returns geometry and preserves the agent's refs, baseline, journal and idle timer. The dispatcher supplies lifetime-scoped authority and exact claim coverage. All captures release only helpers they start.
This uses 0.22's ADR 0040 interfaces. #4729 already landed the Java disconnect fix. Fixes #4646.
Before / after
agent-device snapshot --platform android --serial emulator-5556 --observe-only --json
Base 58c76a620 returns UNSUPPORTED_OPERATION. Head 4afee81b1 returns 37 nodes and a 1080×2400 viewport without refs. The standalone read leaves an empty session list and no helper process.
Validation
Tested 4afee81b1 on Android 16/API 36 with helper 0.22.0-dev/API 2.
Observation preserved PID 7021, and the original pinned @e11~s758323 resolved exactly and opened Network & internet.
Cancelling the CLI after the helper request flushed, before any response bytes, preserved that PID. The next agent snapshot returned 29 nodes with helperSessionReused=true.
pnpm check:affected --run --base 58c76a620 --head 4afee81b1 is blocked by three help-size failures reproduced on base (22,789 tests passed). All 319 provider tests, smoke and documentation checks pass. CI pending.
Selected verification output
[
{
"message": "standalone",
"nodes": 37,
"viewport": {
"width": 1080,
"height": 2400
},
"sessions": [],
"helperPid": null
},
{
"message": "active",
"pidBefore": "7021",
"pidAfter": "7021",
"pinnedRef": "@e11~s758323",
"pressResolution": {
"source": "ref",
"phase": "pre-action",
"kind": "exact"
}
},
{
"message": "cancelled",
"responseBytes": 0,
"socketClosed": true,
"pidBeforeAbort": "7021",
"pidAfterAbort": "7021"
}
]
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.