Skip to content

refactor(vega): ship Vega OS as a platform plugin - #4828

Merged
thymikee merged 3 commits into
0.22from
refactor/0.22-vega-platform-plugin
Nov 20, 2026
Merged

thymikee merged 3 commits into
0.22from
refactor/0.22-vega-platform-plugin

Conversation

@thymikee

@thymikee thymikee commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Ships Vega OS as the managed platform plugin @agent-device/vega, the same shape #4792 gave web.

  • packages/platform-vega now publishes as @agent-device/vega ("private": true, apiVersion: 3, platform: "vega", single ./agent-device export) and contributes one { kind: 'platform', family: 'vega', setup(host) }: inventory + runtime modules, the host-bound interactor factory, request-scoped provider entry, and the named operation toolchainCheck (doctor). App lifecycle and the TV remote stay in the package's runtime/interactor; core keeps family identity, the TV remote vocabulary and toVegaTvRemoteKey, the vegaToolProvider resolver key, help/schema text, and the daemon tv-remote handler.
  • The Vega provider contract type moves to @agent-device/contracts/vega-tool-provider (contracts may not import host-kit or platform packages), mirroring @agent-device/contracts/web-provider.
  • Core no longer imports the package at all: no inline fallback, no dynamic import. Vega is dropped from the builtin platform set, the root devDependency, and bundling. An absent plugin answers through the one absence reporter with typed plugin-not-installed and agent-device plugins add @agent-device/vega; unfiltered devices skips Vega silently; help renders without it.
  • Gates: vega joins the forbidden list in scripts/check-package.ts (packed paths + implementation markers) and MANAGED_PLATFORMS in the platform-package layering policy; the managed-platform policy test gained a case that only the plugin scope resolves the managed Vega entry. Package tests moved with the package; core/daemon tests supply Vega as a plugin fixture (src/platform-runtime-vega-provider.fixtures.ts); the vega-tv-remote provider scenario now composes Vega through the plugin; packages/platform-vega/test/package-smoke.mjs proves the packed-install behavior (absent → typed hint, silent skip, install → active plugin) on any host.
  • Docs: installation, TV targets, and the client API gained the one install step; help tv names it in its loop.

Live verification ran on a Vega Virtual Device on a macOS host with Vega CLI 1.3.2 / SDK 0.23.9221: typed plugin absence, install, discovery, open of the SDK sample app, a tv-remote press, the designed screenshot refusal, close, and the plugin-supplied doctor toolchain check all behave as specified. See the "Live run: Vega Virtual Device" comment for the per-step table and JSON.

Closes #4672. Follows #4591 / #4792.

Validation

  • head 0a4f6f3609, base origin/0.22 (db5f1225e3). The review follow-up refactor(vega): keep absent-family request scope and doctor row honest is included.
  • receipt .tmp/validation/run-GsVwxc/receipt.json: [passed] exactCommit=true — 42 checks passed, 28 skipped (no device lanes). unit 21,464 passed / 10 skipped / 0 failed; vitest-related 441; provider-integration 309; plus format, lint, typecheck, layering, package, docs, capability-matrix, mutation-model.
  • pnpm typecheck, pnpm check:layering (499 pass), pnpm run check:package (tarball lint + installed-CLI probes), pnpm format, fallow audit --base origin/0.22 (0 issues in 41 changed files) — all green.
  • Review fixes (Sentinel): vegaToolProvider is gated on the active Vega selection, so a request for an unserved family never calls its resolver (resolverAsked === false is pinned); doctor --platform vega now reports a failing toolchain row built from the composition's own absence report, naming agent-device plugins add @agent-device/vega, while an unfiltered doctor keeps no Vega toolchain row and its unscoped inventory sweep skips an uninstalled optional family. Verified on the device again at this head (typed absence, doctor absent row, unfiltered silence, discovery/open/tv-remote/screenshot refusal/close, plugin doctor pass).
  • At the review-fix head: pnpm typecheck and the focused suites (host diagnostics, doctor device inventory, optional-family and provider-routing registries, the whole Vega package) are green locally; hosted CI backs the rest.
  • Live device run on a Vega Virtual Device (manual; CI has no Vega lane): see the "Live run: Vega Virtual Device" comment for each command, exit code, and JSON.

Core tarball size

Same toolchain on both trees, measured at head 42129a867d (the review follow-up changes behaviour only, not the packed file set):

packed unpacked files
base 5a9eb4252c 1,639,137 B 5,282,033 B 674
head 42129a867d 1,636,629 B 5,272,022 B 667
delta −2,508 B −10,011 B −7

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

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.20 MB 6.19 MB -9.9 kB
Package (unpacked) 6.20 MB 6.19 MB -9.9 kB
Package (download) 1.89 MB 1.89 MB -2.3 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.4 ms 27.1 ms -0.3 ms
CLI --help 50.2 ms 59.5 ms +9.3 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 2 new findings on 42129a8. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

Live run: Vega Virtual Device

Run 2026-11-20 on the macOS host with Vega CLI 1.3.2 / SDK 0.23.9221, from the branch worktree at head 42129a867d via node bin/agent-device.mjs, with an isolated AGENT_DEVICE_HOME / AGENT_DEVICE_STATE_DIR / AGENT_DEVICE_CLAIMS_DIR under .tmp/ (same shape as the packed-install smoke). The plugin was installed from pnpm pack of packages/platform-vega into that isolated store only; the host store was not touched.

# Step Command Result
1 Plugin absent devices --platform vega --json exit 1 — UNSUPPORTED_PLATFORM, details.reason: plugin-not-installed, package: @agent-device/vega, hint agent-device plugins add @agent-device/vega@nightly-0.22
2a Install plugins add ./vega.tgz --json exit 0 — installed @agent-device/vega 0.22.0-dev, restartRequired: true; after daemon stop, daemon status lists it state: active
2b Discovery devices --platform vega --json (VVD running) exit 0 — [{ platform: vega, id: VirtualDevice, kind: emulator, target: tv, booted: true }]
2c Open open com.amazondeveloper.keplersampleapp.main --platform vega --target tv --session vega-live exit 0 — session opened, startup.durationMs: 3329; vega device is-app-running confirms the app running
2d TV remote tv-remote press down --platform vega --target tv --session vega-live exit 0 — { action: tv-remote, button: down }
2e Screenshot screenshot ./vega-shot.png --platform vega --target tv --session vega-live exit 1 as designed — UNSUPPORTED_OPERATION / unsupported-platform-leaf, hint screenshot is not supported on Vega OS: the Vega runtime exposes remote navigation only (Vega exposes navigation only; snapshot/screenshot stay unsupported in this PR)
2f Close close com.amazondeveloper.keplersampleapp.main --session vega-live exit 0 — Closed: vega-live
3 Doctor doctor --platform vega --json exit 0 — toolchain: pass, summary: "Vega toolchain: Active SDK Version: 0.23.9221; VVD running.", evidence { vegaVersion: "Active SDK Version: 0.23.9221", deviceList: "VirtualDevice" } — the check comes from the plugin's toolchainCheck operation; device: pass (1 Vega device, 1 booted); overall No blockers found.
4 Teardown daemon stop --json, then vega virtual-device stop daemon stopped: true; vega virtual-device status → {"running":false,"process_ids":{"qemu":-1}}, no qemu process left

Key JSON from step 1 (typed absence):

{
  "success": false,
  "error": {
    "code": "UNSUPPORTED_PLATFORM",
    "message": "Vega platform requires the @agent-device/vega plugin.",
    "hint": "Install:\n  agent-device plugins add @agent-device/vega@nightly-0.22\n...",
    "details": {
      "reason": "plugin-not-installed",
      "family": "vega",
      "package": "@agent-device/vega",
      "installCommand": "agent-device plugins add @agent-device/vega@nightly-0.22"
    }
  }
}

Open app: the VVD image ships the Vega SDK sample app com.amazondeveloper.keplersampleapp.main (seen in vega device installed-apps), so no external package was needed.

Environment notes (not PR defects):

  • The first vega virtual-device start on this host reported Virtual device ready. but the qemu process exited ~40s later while still booting (vda devices showed emulator-5558 offline, then it disappeared). A second start was healthy and stayed up for the whole run. SDK/VVD-side, unrelated to this change.
  • Mid-boot, vega device list prints No devices found even while the VVD qemu process is alive; it only lists VirtualDevice : tv once the device fully attaches. vega device is-connected --device VirtualDevice is the accurate gate. Our inventory parses vega device list output and therefore reports "no running VVD" during that window, which matches the CLI's own answer.

@thymikee
thymikee marked this pull request as ready for review November 20, 2026 16:26
@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 42129a8. The plugin boundary holds, the live run at this head passed, all checks pass, and there are no conflicts.

Not blocking, take or leave:

  • packages/platform-vega/build.mjs copies packages/platform-web/build.mjs (the claim check and the tsdown config). One shared helper in @agent-device/build-config could serve both.
  • In packages/platform-vega/src/index.ts the host argument of setup is shadowed by the host parameter of createInteractor. Renaming one would make the two clear.

The two inline threads on request-providers.ts and on doctor --platform vega without the plugin do not apply and can be resolved: the first uses the same gate as web and has no production caller without the plugin (#4828 (comment)), and the second still prints the install hint through the device inventory error (#4828 (comment)).

Not verified here: doctor --platform vega with the plugin absent was traced in code and not run live. @agent-device/vega is private, so the registry install was not exercised; the live run and package smoke used a local tarball, the same as web after #4792. The exact tarball byte deltas were not reproduced, though the CI size report agrees in magnitude. The tests were not run locally.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
@thymikee
thymikee force-pushed the 0.22 branch 2 times, most recently from 3803b69 to db5f122 Compare November 20, 2026 17:18
Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References #4672, #4591.
Two review findings on #4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References #4672, #4591.
@thymikee
thymikee force-pushed the refactor/0.22-vega-platform-plugin branch from 42129a8 to 0a4f6f3 Compare November 20, 2026 17:20
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 0a4f6f3

Since the review of 42129a8: 1 new · 0 still open · 2 no longer raised (2 marked fixed)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/daemon/src/sessions/handlers/session-doctor-device.ts:178 🆕 Doctor's plugin-absence filter matches the reason as a raw string, not the typed constant
Not in the reviewers' prompt (1 file)
  • pnpm-lock.yaml: generated or a lockfile, so its lines were left out

Reviewed with this repository's own Sentinel configuration (faa3c82ec103).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 1 new finding on 0a4f6f3. The verdict and the full list are in the summary comment.

@thymikee
thymikee merged commit 7216f2a into 0.22 Nov 20, 2026
30 of 31 checks passed
@thymikee
thymikee deleted the refactor/0.22-vega-platform-plugin branch November 20, 2026 17:44
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(vega): ship Vega OS as a platform plugin

Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References #4672, #4591.

* refactor(vega): keep absent-family request scope and doctor row honest

Two review findings on #4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References #4672, #4591.

* refactor(doctor): read the plugin-not-installed reason from its typed table
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(vega): ship Vega OS as a platform plugin

Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References #4672, #4591.

* refactor(vega): keep absent-family request scope and doctor row honest

Two review findings on #4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References #4672, #4591.

* refactor(doctor): read the plugin-not-installed reason from its typed table
thymikee added a commit that referenced this pull request Nov 23, 2026
* refactor(vega): ship Vega OS as a platform plugin

Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References #4672, #4591.

* refactor(vega): keep absent-family request scope and doctor row honest

Two review findings on #4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References #4672, #4591.

* refactor(doctor): read the plugin-not-installed reason from its typed table
hannojg pushed a commit to hannojg/agent-device that referenced this pull request Nov 23, 2026
* refactor(vega): ship Vega OS as a platform plugin

Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References callstack#4672, callstack#4591.

* refactor(vega): keep absent-family request scope and doctor row honest

Two review findings on callstack#4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References callstack#4672, callstack#4591.

* refactor(doctor): read the plugin-not-installed reason from its typed table
thymikee added a commit that referenced this pull request Nov 24, 2026
* refactor(vega): ship Vega OS as a platform plugin

Move the Vega family out of packed core into the managed platform plugin
@agent-device/vega, mirroring what the web plugin did. The package
contributes one platform setup that supplies the inventory and runtime
modules, the host-bound interactor factory, request-scoped provider
entry, and the doctor's toolchainCheck operation.

Core keeps family identity, the TV remote vocabulary and key mapping, the
vegaToolProvider resolver key, help and schema text, and the daemon
tv-remote handler. Absent plugin answers through the one absence reporter
with the install hint; unfiltered discovery skips Vega silently.

References #4672, #4591.

* refactor(vega): keep absent-family request scope and doctor row honest

Two review findings on #4828:

- request-providers: the vegaToolProvider descriptor now gates on the Vega
  selection before calling the resolver, so a request for a family this
  process does not serve never opens a provider it cannot scope or close.
  The request still ends in the typed plugin-not-installed outcome at the
  runtime and interactor lookups it then performs. The parity table and the
  optional-family test now pin resolverAsked === false.
- host diagnostics: doctor --platform vega reports a failing toolchain row
  built from the composition's own absence report when the plugin is absent
  or failed to load, so the row names the install command; a store plugin
  whose load failed reports its own code, message, and reason. Unfiltered
  doctor keeps no Vega toolchain row.
- doctor inventory: the unscoped per-family sweep drops a typed
  plugin-not-installed failure instead of reporting a device-vega warn row,
  matching how unscoped devices skips an optional family the user did not
  install. An explicitly selected family keeps its typed outcome.

References #4672, #4591.

* refactor(doctor): read the plugin-not-installed reason from its typed table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant