Skip to content

feat(vphone): add attach-only iOS provider - #4793

Closed
bytemain wants to merge 3 commits into
callstack:mainfrom
bytemain:jony/vphone-provider
Closed

bytemain wants to merge 3 commits into
callstack:mainfrom
bytemain:jony/vphone-provider

Conversation

@bytemain

@bytemain bytemain commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add an attach-only vphone provider plugin (40 files) so agent-device can use an existing running vphone VM through the normal provider connection path.

  • API-v2 plugin plus manifest packaging, machine/RPC preflight, bounded transport and stable lease identity.
  • open/close, exact semantic and point taps, long press, type, scroll, screenshot, and flat AX snapshots with truthful vphone-ios-tree provenance.
  • No VM create/start/stop, recording, install, launch arguments, fill/clear, or unsupported compatibility shims.

Task: Raft #raft-mobile-reconcile:#236.

Validation

Current head: 2466b635cb4f2935a773adc1b370812a5ac634a8.

  • 68 focused tests passed; independent follow-up review found no remaining blocker.
  • R89 layering passed with zero reason-literal growth; Fallow, typecheck, build, lint, format, frozen install, and both provider package smokes passed.
  • Added plain launch, launchConsole/activity, and deep-link tests to close the open CRAP branch gaps.

Earlier 7961fd9c validation: 32 focused files / 285 tests, 42 affected checks, and real raft-iphone connect/open/snapshot/scroll/input/PNG/close/disconnect all passed (run-SPfZ3t).

Local full Coverage is blocked by an existing upload-http-deadline timing case that also fails on unmodified base 854bba6c under Node 22.12 and 24.16; CI Coverage remains the authoritative validation for the new branch tests. No test was skipped or deleted.

Not covered: long-duration live boundaries, recording, provisioning, install/uninstall, multi-touch, launch args, and full nested AX/hittability. PID-less A→B→A foreground transitions remain a documented snapshot-identity risk.

@thymikee

Copy link
Copy Markdown
Member

Thanks for the provider. At 7961fd9 there is one problem to fix before merge, plus a placement question.

This is a new device-facing provider (dispatch, capture, interaction and app lifecycle on a live vphone guest), but the only live evidence is one prose line in the PR body. Nobody can confirm that the packed plugin loads and drives a real guest through the daemon. The unit tests use a fake execFile and a stub CLI that returns empty trees. Please attach a remotely accessible transcript (gist or PR comment) at this SHA. It should show: plugins add <packed tgz>, then connect vphone --platform ios --device <machine> with the verification JSON, open com.apple.Preferences, snapshot --json with producer vphone-ios-tree and non-empty nodes, click 'label=General' with the dispatched point in the response, type into a focused field, scroll down, screenshot <abs path> with a valid PNG, close, disconnect, and finally vm list showing the machine still running.

CI is failing on checks tied to this PR's code. Repo Guards & Compatibility fails R89 (untyped reason literals) with 23 violations, all in packages/provider-vphone/src. R89 landed on main in #4779 after the merge base, but every flagged site is code this PR adds. The cause is that AppError reasons are spelled at the call sites (for example vphone_invalid_response at four sites) instead of coming from one typed table. Please declare the vphone reasons once in an as const satisfies table, document them in the provider's user doc, and reuse existing shared reasons where the meaning is the same, such as provider-session-unavailable and unsupported-provider-mode. check:coverage-crap also fails on interactor.ts open (CRAP 32.4, complexity 16, 60% covered).

The PR also adds no user doc page, no CLI help entry (cli-help.ts lists the other plugins) and no provider-plugin-catalog row. VPHONE_CLI, the default binary vphone-launchpad-cli, the requirement that the daemon runs on the Mac hosting the VM, and the reduced command set are documented nowhere. A page like Revyl's, a catalog row, a help line and a homepage field would cover it.

Not blocking, take or leave: tapElementSelector is never reached, because the daemon calls it only on the Maestro direct-selector route and readSimpleIosSelectorTarget returns null for provider-owned devices. If it were reached, it returns center:{x,y} where the caller reads data.x/data.y (the tap would report at 0,0) and it ignores allowNonHittableCoordinateFallback and expectedPoint. A provider should declare a touch capability only when a daemon route dispatches to it, so delete it, vphoneSelectorMatches, their tests, and set the facts cell to unsupported. The new public @agent-device/selectors/normalize-match-text subpath re-exports an internal normalizer and vphoneSelectorMatches hand-copies matchesTerm, while AGENTS.md says to use @agent-device/selectors for matching, so the subpath and its R11 entry can go with it. diagnosticText hand-rolls redaction that is narrower than redactDiagnosticData in @agent-device/kernel/redaction (it misses api_key, secret, authorization and credentials in URLs, and it hides every code= value), so using the kernel helper would be safer. The public VphoneOptions exposes the test seams execFile and env, plugin.ts takes an options parameter no v1 host passes, and the smoke fixture lists ui.tap_element, which nothing requires.

The PR adds 1414 net production lines, above the 700-line threshold, with a new @agent-device package, a core SnapshotProducer and a new selectors subpath, and no agent-device issue records the need. The #236 in the body also auto-links an unrelated merged PR. Could a maintainer decide whether this should live in-tree at all? vphone needs the daemon on the same Apple Silicon Mac as the research VM and has no remote lease, credentials or endpoint. The public agent-device/plugins API and scripts/check-provider-plugin.mjs already support an out-of-tree package, so would a third-party plugin be the smaller design, with core changing only for the snapshot producer? That would need a generic provider iOS AX-tree producer, or open producer registration, so a third-party provider does not edit the closed SnapshotProducer union. Either way, the deletions above would leave a provider with only transport, preflight, lease map, interactor and flat snapshot mapping.

Before merge: fix the R89 reason literals and the CRAP gate on interactor.open, attach the live transcript, and get a maintainer decision on in-tree versus out-of-tree placement.

@bytemain
bytemain force-pushed the jony/vphone-provider branch from 7961fd9 to 2466b63 Compare November 20, 2026 10:52
@thymikee

Copy link
Copy Markdown
Member

Thanks for the update. At 2466b63 the code changes since 7961fd9 look fine, but one item from the earlier review is still open: live evidence.

This provider drives dispatch, capture, interaction and app lifecycle on a live vphone guest (platform-runtime.ts#L183). The only live evidence is still a run id in the PR body (run-SPfZ3t), and nobody else can open it. The unit tests use a fake execFile and a stub CLI that returns empty trees. So nobody can confirm that the packed plugin loads through plugins add and drives a real guest through the daemon. Please attach a transcript as a gist or PR comment. A run at 7961fd9, f3f2ff6 or 2466b63 all count, because the range-diff shows f3f2ff6 = 7961fd9 and the delta changes no behavior. It should show, in order: plugins add <packed tgz>; connect vphone --platform ios --device <machine> with the verification JSON; open com.apple.Preferences; snapshot --json with producer vphone-ios-tree and non-empty nodes; click 'label=General' with the dispatched point in the response; type into a focused field; scroll down; screenshot <abs path> with a valid PNG; close; disconnect; and last vm list showing the machine still running.

Not blocking, take or leave: every reason the vphone package publishes could be a VPHONE_ERROR_REASONS value, but interactor.ts#L230 and interactor.ts#L45 still publish vphone_operation_unsupported and vphone_launch_args_unsupported as untyped literals. Adding both to the table and restoring type VphoneErrorReason for the unsupported helper would close that.

The Coverage check failed in the unit-ci step. The only test failure is at packages/daemon/src/server/__tests__/upload-http-deadline.test.ts:910 (an empty response where HTTP/1.1 400 was expected), and this PR touches no daemon, upload or HTTP code, so it is unrelated: it is a known timing race that #4800 removes. The changed-line coverage and CRAP steps were skipped as a result, so the interactor.open CRAP fix is not yet confirmed. Please rerun Coverage until it is green.

There are no conflicts. Before merge, the live transcript and a green Coverage run are needed, and the in-tree versus out-of-tree placement is still the maintainer's call.

@bytemain

Copy link
Copy Markdown
Contributor Author

Superseded by the out-of-tree implementation chosen by the requester:

The standalone transcript includes packed plugins add, connect verification, a non-empty vphone-ios-tree snapshot, the General dispatched point, focused input, scroll, valid PNGs, close/disconnect, and the VM still running. The zero-delay input anomaly is disclosed rather than hidden.

Closing this in-tree variant without merge. No npm publication or Testbed production change.

@bytemain bytemain closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants