Skip to content

feat(vega): drive Vega OS TV hardware over a persistent vda shell - #5251

Draft
krozniata wants to merge 7 commits into
callstack:mainfrom
krozniata:feat/vega-hardware
Draft

krozniata wants to merge 7 commits into
callstack:mainfrom
krozniata:feat/vega-hardware

Conversation

@krozniata

@krozniata krozniata commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds Vega OS TV hardware in developer mode, such as a Fire TV running Vega OS, next to the Vega Virtual Device. Hardware connected over vda is listed, and both targets support snapshot, tap, fill, type and keyboard dismiss through the on-device Automation Toolkit. fill refuses with vega_fill_target_moved when the field at the point is not the one the selector resolved, as Android does. Device commands run over one persistent vda shell per device, so a screen read takes about 0.1 s instead of 1.2 s through vega device run-cmd. Without vda, commands fall back to run-cmd, and a diagnostic names the reason.

Before / after

agent-device devices --platform vega
# before: DEVICE_NOT_FOUND "Vega CLI found devices, but no supported Vega Virtual Device is running." (only TV hardware connected)
# after:  Vega TV (SERIAL0000000001) (vega device target=tv) booted=true

agent-device snapshot --platform vega --serial VirtualDevice
# before: UNSUPPORTED_OPERATION
# after:  the app's accessibility tree, siblings in screen order

agent-device fill @e3 "text" --platform vega --serial 192.168.0.10:5555
# before: UNSUPPORTED_OPERATION
# after:  focuses that field, opens the system keyboard if needed, types

Validation

Tested at a1bf88ccc:

  • pnpm check:affected --run --head a1bf88ccc: every gate it ran passes except unit.
  • unit: upload-http-deadline.test.ts fails the same way on main (a4b31e34d) on this machine and touches no file this change does.
  • The gates after unit, run directly: provider integrat doc prose, production exports, capability matrix, agentguidance.
  • A Fire TV running Vega OS and the Vega Virtual Device, end-to-end suite: listing, snapshot, tap, fill,type, keyboard dismiss, remote navigation.

Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

@krozniata
krozniata marked this pull request as draft November 30, 2026 13:19

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

View guided diff | Re-trigger cubic

Comment thread packages/platform-vega/src/runtime.ts Resolved
Comment thread packages/platform-vega/src/snapshot.ts Resolved
Comment thread packages/platform-vega/src/runtime.ts Resolved
@thymikee

Copy link
Copy Markdown
Member

Thanks for the contribution. At 16ff252, fill on Vega appends text instead of replacing it, and no live device run is recorded for this commit.

The answers to these questions decide whether the change fits the project:

  • Which users or partners need Vega hardware rather than the VVD, and is there an issue or request to link?
  • Does vda always ship with the Vega SDK? If so, can device commands use only the vda shell and drop the run-cmd fallback and hostname matching?
  • Would you split this into hardware listing, the shell transport, snapshot and tap, and text entry, so each can merge with its own device evidence?
  • How should fill replace existing text and clear on an empty value on Vega, given that inputd-cli send_text only appends?

Could this land in smaller steps? First, hardware support alone in about 40 lines (inventory rows, isVegaTv and docs), which lists hardware and gives it the existing open, close and remote commands on the run-cmd route. Next, one transport change where a VegaShellPool, opened and closed by the Vega platform runtime and reopened at dequeue, replaces run-cmd for device commands, with the VVD serial found by probing only emulator-* serials. Then snapshot with its own vega backend, then text entry whose fill clears before typing. If vda always ships with the SDK, dropping the fallback would also remove the fallback reasons, the 30 s retry timer and the text-carrying refusal branch. This first needs a decision on who owns the shell lifecycle, and whether Vega gets its own channel in SNAPSHOT_BACKENDS instead of reusing linux-atspi.

fillVegaPoint focuses the field and types without clearing it. A field holding abc and filled with xyz ends as abcxyz. fill @e3 "" types nothing and leaves the field unchanged. Both are reported as a confirmed success, so an agent cannot tell. The fill metadata and CLI help say that fill replaces text and that an empty value clears it. The rule: on every Vega fill route, the field value must equal the requested text afterwards, and an empty value must clear it. Clear the focused field before typing (select-all and delete, or a toolkit clear or set-text call). When the value cannot be confirmed, return an unconfirmed result with the requested, before and after values. Otherwise, keep fill unavailable on Vega until replace works.

This change adds device-facing dispatch, capture, interaction and transport, including for the existing remote route. The description reports a run at an earlier commit only, and later changes touch the snapshot producer identity and the read after select. Device verification requires the commands, device, source SHA and observed results. Before merge, please record a run with node bin/agent-device.mjs at the final head on both a Vega OS Fire TV and the VVD:

  • devices --platform vega --json lists the hardware serial and the VVD.
  • snapshot -i --json shows the tree and its backend and producer.
  • tap @ref activates an element.
  • fill @ref <text> on a field that already holds text, then snapshot, shows the value replaced.
  • fill @ref "" shows the field cleared.
  • type <text> enters text into a focused field.
  • keyboard dismiss --json returns dismissed: true with a keyboard open. Also record its output with no keyboard open.
  • tv-remote press up, tv-remote press select and back still work on the VVD, because the hold duration changed.
  • Diagnostics show the vda shell route with no vega_vda_fallback.
  • One run on a host without vda shows the fallback diagnostic and the vega-text-needs-vda-shell refusal.

These open high-priority inline threads still apply: fill appends text, provider cache key, help test wording, success-only entry test, carriesText never asserted, keyboard close result, focus-only text test, refusal dispatch detail, runtime matrix test, client API list, dead message branch, vda lookup reason, timeout partial output, snapshot row ordering, parse error cause, empty toolkit reply, null toolkit error, queued timer start. 9 lower-priority threads also still apply.

Not verified here: behavior on a live Vega device or VVD, including the hardware inventory output format, toolkit behavior, inputd-cli hold timing and the enable-file requirement. Not verified here: the run reported in the description for the earlier commit, and the React Native overlay dismissal route on Vega.

All 20 checks pass. The PR is a draft, so device lanes are skipped and CI covers Vega only through mocked tests.

Before merge, fill must replace and clear correctly (or stay unavailable on Vega), and the live run above must be recorded.

@thymikee

thymikee commented Dec 1, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution.

At 012dd56, fill now has a clear step before typing, but it can empty a field and then refuse the text. The live device run requested in the earlier review is also still missing.

fillVegaPoint clears the field before the text route is checked. The clear step (a Clear key touch or 64 KEY_DELETE presses) can run on the vda run-cmd fallback, but sending text there throws vega-text-needs-vda-shell. On a host where no vda shell reaches the device, fill @e3 "xyz" on a field holding abc empties it and then reports UNSUPPORTED_OPERATION with no dispatched marker. A caller reads that as "nothing happened", but the content is gone. The rule: fill must refuse before any device mutation when its text cannot be delivered. Could fillVegaPoint decide the text route once, before focus and clear, for any non-empty text, so the refusal comes first with dispatched: 'no'? Please add a scenario with no vda target that asserts no touch or pressDelete happens before the refusal.

The new clear and type path depends on real device behavior: the key_Clear touch by coordinates in the keyboard window, the inputd-cli button_press KEY_DELETE shell loop, and stopping the shell on timeout. The description reports a run at an earlier commit (a1bf88c) only, and scripted tests cannot show that fill replaces or clears on hardware. Before merge, please record a run with node bin/agent-device.mjs at this commit or the final head, on both a Vega OS Fire TV and the VVD:

  • devices --platform vega --json and snapshot -i --json (with backend and producer).
  • tap @ref, then fill @ref <text> on a field that already holds text, then snapshot showing the value replaced.
  • fill @ref "", then snapshot showing the field empty.
  • Whether each keyboard shows key_Clear, and which clear route ran.
  • type <text>, and keyboard dismiss --json both with and without a keyboard open.
  • tv-remote press up, tv-remote press select and back on the VVD.
  • Diagnostics showing the vda shell route.
  • One run on a host without vda, showing the fallback diagnostic and fill refusing with vega-text-needs-vda-shell while the field stays unchanged.

One high-priority thread still applies, although marked resolved: clear before typing. No lower-priority threads are confirmed as still applying. These no longer apply and can be resolved: toolchain key now includes the adb server selectors, help test pins the full sentence, focus and keyboard failure scenarios added, carriesText: true asserted, close result asserted, clear touch and text asserted after focus, refusal check requires dispatched: 'no', reason and hint asserted for non-TV cells, per the reply and diff, client API docs list the actions, entry failure now throws first, lookup errors now propagate, timed-out commands reject with a timeout error, row band fixed and tested, parse error drops the cause, missing result now fails, error: null counts as absent, aborted reads keep the hold, abort and deadline start at the call, docs bullet split, refusal message updated, vega-back carries only dismissed, serial fallback removed, serial listing requires success, per the reply and diff, unreadable hostname has a reason, app-without-window reason asserted. Not verified here: whether the comment and hint wording changes settle the runtime comment and refusal hint threads.

Not verified here: behavior on a live Vega device or VVD, including whether shipped keyboards expose key_Clear as a test_id, whether touching it clears the field, and whether KEY_DELETE deletes in the keyboard dialog. Not verified here: the selector runtime behind the client API sentence about find, get, is and wait on Vega, and upstream changes that arrived with the base update.

All 22 checks pass. The PR is a draft, so device lanes are skipped and Vega is covered only by scripted unit and provider-scenario tests.

Before merge, fill must refuse before clearing when no vda shell can carry the text, and the live Fire TV and VVD run above must be recorded at the final head.

This branch has not been deployed

No deployments
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