Skip to content

feat(polkavm): run computer applications in browser hosts - #201

Merged
replghost merged 77 commits into
feat/pvm-wasmfrom
feat/pvm-computer
Sep 8, 2026
Merged

feat(polkavm): run computer applications in browser hosts#201
replghost merged 77 commits into
feat/pvm-wasmfrom
feat/pvm-computer

Conversation

@replghost

@replghost replghost commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #185. Adds the second App Manifest v2 PolkaVM execution model for applications requiring the versioned polkadot-host/0.1 core, fs, tty, process, and net interfaces.

  • Keeps runtime.kind = "polkavm"; declared capability interface IDs select the computer contract.
  • Runs the supervisor and child machines in polkavm-computer-worker.js with bounded TTY, /home persistence, spawn, pipes, and workspace panes.
  • Resolves published child packages through the Host bridge and propagates live seed mounts.
  • Fails closed before execution when a required Host interface is unavailable.
  • Gates TCP behind user permission and the explicitly configured VITE_POLKAVM_TCP_RELAY_URL; the relay is loopback-bound with origin/port policy.
  • Removes the former public pvm file, script, environment-variable, fixture, and DOM aliases. Protocol entry points such as _pvm_start remain unchanged.
  • Pins browser distribution source paritytech/useragent-kit@3a351b4cc563b341eea39f736156eb357c8621de, runtime paritytech/polkavm-host-runtime@72c9ded03add6b973f61778da7245d30a1e5a635, and PolkaVM c160c13c3c29bf3219ce1404ec95976000235a94.

Verification

  • bun run check:polkavm-runtime
  • bun run typecheck — 13 tasks
  • sandbox PolkaVM tests — 36 passed
  • resolver manifest tests — 30 passed
  • bun run format:check
  • sandbox and Host production builds
  • Chromium functional suite — 9 passed, 1 external Doom fixture skipped; the two relay-dependent HTTPS cases initially ran against a relay-disabled build, then passed with the local polkavm-tcp relay enabled

No deployment performed.

@replghost
replghost force-pushed the feat/pvm-wasm branch 2 times, most recently from ea06865 to 154e4fe Compare September 3, 2026 18:24
@replghost replghost changed the title feat(computer): experimental polkadot-host-computer/0.1 app kind [WIP] feat(computer): experimental polkadot-host computer app (contract under TruAPI RFC discussion) Sep 3, 2026
@replghost
replghost force-pushed the feat/pvm-wasm branch 2 times, most recently from 8612156 to 7aa1046 Compare September 3, 2026 19:04
@replghost

Copy link
Copy Markdown
Collaborator Author

Design review outcomes now implemented:

  • No manifest kindcapabilities.host.requires interface declaration (fail closed on unknown ids).
  • Open spawn: spawn(name) resolves any published app through the host bridge (dotli:computer-resolve-app); the child is authorized by its own signed manifest + grant clamp, not by parent enumeration. packages pins are now optional (lockfile semantics). Functional spec proves kilo spawning as its own published app, absent from the computer's manifest.
  • Virtual resources codified: guests can never name host-side resources; /home is a host-owned namespace (RFC Host rule 5).
  • Declaration/contract shape remains prototype-frozen pending the TruAPI RFC (pvm-host-runtime docs/runtime/host-interface-declaration.md @ 065d2d3).

@replghost
replghost changed the base branch from feat/pvm-wasm to main September 3, 2026 20:07
@replghost
replghost changed the base branch from main to feat/pvm-wasm September 3, 2026 20:26
@replghost

Copy link
Copy Markdown
Collaborator Author

Live deployment status (WIP)

  • Gateway deployed successfully to westendli.dev from head 30490fb8d89b26f9960a944f88e7875a342e0bad: Deploy run 33800452518. Live runtime asset verified at https://computer.app.westendli.dev/pvm-runtime/pvm-computer.js.
  • Real Chromium coverage is green for: computer shell open-spawning published Kilo, standalone Vim root app, standalone Kilo root app, editor saves, and /home persistence across reloads.
  • Reproducible Paseo artifacts are built on polkavm-app-kit@981cd3b:
    • computer.paseobafybeiaavmhcyiyaguw57cllbyzkmf4gttrhelp2skyz3ixthnivfgj3qm
    • kilo.paseobafybeibfxp6qcypveq3gzgosuizizzdlkbp4vgqd26fgouuxoqd25k4ilm
    • vim.paseobafybeidhfdmrmgw5kcwhfwccew6qukcvx3rj2i355vk23aiteng4j4ukmm
  • Name publication is blocked before any chain write: both mnemonics under ~/.config/epoca resolve to NoStatus on post-re-genesis paseo-next-v2; new root labels require ProofOfPersonhoodFull. Need the provisioned derivation path/key or PoP bootstrap. No substitute labels/environment used.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

⚡ Performance Report

⚠️ No baseline found on main. This PR's results are recorded but cannot be compared.
Merge to main to establish a baseline.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

Chunks over 500 KB:

File Raw Brotli Gzip
host/assets/paseo.smol-DboPaEh1.json 1.84 MB 941.7 KB 1.05 MB
host/assets/paseo-people-next.smol.json 3.36 MB 1.68 MB 1.92 MB
host/assets/smoldot.js 3.05 MB 2.27 MB (+201 B) 2.34 MB (-2 B)
host/assets/smoldot_worker.js 3.02 MB 2.26 MB 2.33 MB
host/assets/truapi_server_bg.wasm 7.20 MB 5.29 MB 5.56 MB
host/assets/wasm/web/truapi_server_bg.wasm 7.20 MB 5.29 MB 5.56 MB
sandbox/polkavm-runtime/polkavm-browser-runtime.wasm 1.04 MB 179.9 KB 241.6 KB
Total 28.30 MB (+1.48 MB) 18.35 MB (+292.6 KB) (-35%) 19.52 MB (+370.2 KB)
All files
File Raw Brotli Gzip
host/.well-known/apple-app-site-association 505 B 505 B 505 B
host/.well-known/assetlinks.json 2.1 KB 343 B 427 B
host/assets/_md.js 6.3 KB 2.6 KB 2.8 KB
host/assets/blake2.js 11.7 KB 4.1 KB 4.7 KB
host/assets/bridge.js 130.1 KB (+5.2 KB) 31.5 KB (+1.4 KB) 37.6 KB (+1.6 KB)
host/assets/browser.js 22.9 KB 7.6 KB 8.6 KB
host/assets/client.js 10.6 KB (+379 B) 3.4 KB (+126 B) 3.9 KB (+149 B)
host/assets/dotli-debug-bus.js 708 B 708 B 708 B
host/assets/get-sync-provider.js 2.7 KB 1.1 KB 1.2 KB (+1 B)
host/assets/hex.js 160 B 160 B 160 B
host/assets/index.css 55.2 KB (+200 B) 8.6 KB (+60 B) 9.9 KB (+74 B)
host/assets/index.js 166.9 KB (+9.1 KB) 43.8 KB (+2.4 KB) 52.6 KB (+2.9 KB)
host/assets/manifest.js 21.5 KB (-1.8 KB) 7.0 KB (-409 B) 7.7 KB (-424 B)
host/assets/network.js 6.3 KB 2.2 KB 2.5 KB
host/assets/panel.js 76.6 KB (+316 B) 20.7 KB (+140 B) 23.4 KB (+132 B)
host/assets/paseo.smol-DboPaEh1.json 1.84 MB 941.7 KB 1.05 MB
host/assets/paseo-people-next.smol.json 3.36 MB 1.68 MB 1.92 MB
host/assets/paseo.smol.json 25.2 KB 5.6 KB 7.2 KB
host/assets/previewnet.smol.json 63.7 KB 7.6 KB 13.4 KB
host/assets/proofs.js 29.3 KB 8.6 KB (-5 B) 9.5 KB (+2 B)
host/assets/resolve.js 158 B 158 B 158 B
host/assets/rolldown-runtime.js 716 B 716 B 716 B
host/assets/rpc-resolve.js 2.8 KB (+98 B) 1.2 KB (+45 B) 1.3 KB (+39 B)
host/assets/scale-ts.js 4.8 KB 2.0 KB 2.2 KB
host/assets/smoldot.js 3.05 MB 2.27 MB (+201 B) 2.34 MB (-2 B)
host/assets/smoldot_worker.js 3.02 MB 2.26 MB 2.33 MB
host/assets/spans.js 2.7 KB (+232 B) 1.1 KB (+85 B) 1.3 KB (+112 B)
host/assets/src.js 84.2 KB 26.5 KB (+13 B) 29.6 KB (-1 B)
host/assets/styles.css 15.8 KB (+483 B) 3.4 KB (+165 B) 4.0 KB (+193 B)
host/assets/substrate-client.js 5.8 KB 2.2 KB (-1 B) 2.5 KB
host/assets/truapi_server_bg.wasm 7.20 MB 5.29 MB 5.56 MB
host/assets/twoX.js 2.8 KB 1022 B 1.1 KB
host/assets/utils.js 3.5 KB 1.4 KB 1.5 KB
host/assets/wasm/web/README.md 13.4 KB 13.4 KB 13.4 KB
host/assets/wasm/web/package.json 371 B 371 B 371 B
host/assets/wasm/web/truapi_server.d.ts 12.6 KB 12.6 KB 12.6 KB
host/assets/wasm/web/truapi_server.js 49.7 KB 7.9 KB 9.3 KB
host/assets/wasm/web/truapi_server_bg.wasm 7.20 MB 5.29 MB 5.56 MB
host/assets/wasm/web/truapi_server_bg.wasm.d.ts 4.0 KB 4.0 KB 4.0 KB
host/assets/web.js 18.2 KB 4.6 KB (-11 B) 5.1 KB (-6 B)
host/assets/worker-runtime.js 28.9 KB (+28.8 KB) 6.8 KB (+6.7 KB) 7.8 KB (+7.7 KB)
host/assets/worker-runtime.js 106 B 106 B 106 B
host/assets/ws.js 23.1 KB 7.5 KB (-3 B) 8.3 KB (+1 B)
host/dotli.png 11.5 KB 11.5 KB 11.5 KB
host/favicon.svg 1.8 KB 1.8 KB 1.8 KB
host/host-sw.js 3.1 KB 1.2 KB (-6 B) 1.4 KB (-5 B)
host/icon-192.png 12.5 KB 12.5 KB 12.5 KB
host/icon-512.png 42.8 KB 42.8 KB 42.8 KB
host/index.html 29.5 KB (-4.3 KB) 5.5 KB (-1.5 KB) 6.8 KB (-1.7 KB)
host/manifest.webmanifest 441 B 441 B 441 B
host/workbox.js 14.8 KB 4.6 KB 5.1 KB
sandbox/app-sw.js 11.1 KB (+1.1 KB) 3.5 KB (+274 B) 4.0 KB (+323 B)
sandbox/assets/bitswap-bridge.js 840 B 840 B 840 B
sandbox/assets/fetch.js 3.4 KB 1.2 KB (+1 B) 1.4 KB (+2 B)
sandbox/assets/index.js 261.0 KB (+137.6 KB) 69.3 KB (+34.4 KB) 82.5 KB (+41.8 KB)
sandbox/assets/index.css 55.2 KB (+200 B) 8.6 KB (+60 B) 9.9 KB (+74 B)
sandbox/favicon.svg 1.8 KB 1.8 KB 1.8 KB
sandbox/index.html 1.7 KB (+20 B) 588 B (+6 B) 796 B (+8 B)
sandbox/polkavm-runtime/LICENSE-MPL-2.0 16.3 KB 16.3 KB 16.3 KB
sandbox/polkavm-runtime/PolkaVM-LICENSE-APACHE 10.6 KB 10.6 KB 10.6 KB
sandbox/polkavm-runtime/PolkaVM-LICENSE-MIT 1023 B 1023 B 1023 B
sandbox/polkavm-runtime/SHA256SUMS 631 B 631 B 631 B
sandbox/polkavm-runtime/SOURCE.json 561 B 561 B 561 B
sandbox/polkavm-runtime/polkavm-browser-runtime.wasm 1.04 MB 179.9 KB 241.6 KB
sandbox/polkavm-runtime/polkavm.js 88.0 KB 14.9 KB 17.5 KB
sandbox/polkavm-runtime/polkavm-gpu-worker.js 63.6 KB 10.9 KB 12.6 KB
sandbox/polkavm-runtime/polkavm-worker.js 85.1 KB 13.8 KB 16.4 KB
Total 28.30 MB (+1.48 MB) 18.35 MB (+292.6 KB) (-35%) 19.52 MB (+370.2 KB)

Commit: 81b2085

…puter

# Conflicts:
#	apps/sandbox/public/polkavm-runtime/SHA256SUMS
#	apps/sandbox/public/polkavm-runtime/SOURCE.json
#	apps/sandbox/public/polkavm-runtime/polkavm-browser-runtime.wasm
#	scripts/polkavm-runtime.lock.json
#	scripts/sync-polkavm-runtime-assets.mjs
…puter

# Conflicts:
#	packages/resolver/src/manifest-types.ts
#	packages/resolver/tests/manifest-types.test.ts
…puter

# Conflicts:
#	packages/resolver/src/manifest-types.ts
#	packages/resolver/tests/manifest-types.test.ts
#	scripts/polkavm-runtime.lock.json
@replghost

Copy link
Copy Markdown
Collaborator Author

Updated PR head c258bd5 and redeployed it to westendli.dev via successful workflow run https://github.com/paritytech/dotli-community/actions/runs/34138758069. The App v2 runtime now requires ABI 2, so I migrated and republished Chinpokomon 0.1.12 (runtime ABI 2) at CID bafybeia26pviq4ffm263mlrdlaiggtvnpbu4xdqualud5p2xb5hqzrhny4. Fresh-profile live verification at https://chinpokomon-pvm.westendli.dev/ resolved through smoldot/Bitswap without the cold-start No connected peers failure, mounted the PolkaVM JIT canvas with data-polkavm-ready=true, and advanced from frame 2178 to 2298 over 2 seconds at ~57 FPS.

…puter

# Conflicts:
#	packages/resolver/src/manifest-types.ts
#	packages/resolver/tests/manifest-types.test.ts
#	scripts/polkavm-runtime.lock.json
Reverts f24d3dc. ABI 1 was never released, so a breaking change is spent inside it rather than on a version no product has shipped against. ADR 0001 records the decision and the migration this Host would need before any move to 2.
Reverts f286e61. @useragent-kit/polkavm-runtime 0.6.28 packages polkavm-host-runtime cc9940b6 and declares abi.runtime 2; the App contract this Host implements is ABI 1, published from polkavm-host-runtime itself, and 0.1.15 also carries the safe-area and virtual-keyboard inset ABI that 0.6.28 predates.
…puter

# Conflicts:
#	docs/adr/0001-polkavm-application-runtime-abi-version.md
…puter

# Conflicts:
#	.github/workflows/deploy.yml
#	apps/host/tests/smoke/playwright.config.ts
#	apps/host/tests/smoke/polkavm-products.spec.ts
Repin the Host to the useragent-kit distribution of host-runtime 0.2.0 at a9156ad. Consume its canonical polkavm-prefixed artifact names directly, retain exact package checksums, publish ABI 1 provenance, and pick up inset input plus bounded WebGPU device restoration.
@replghost

Copy link
Copy Markdown
Collaborator Author

Scope correction: the computer contract has been removed from #185 and rebuilt as draft stacked PR #215. #185 now remains limited to the runtime-aware App work tracked by host-rust-core #507/#540/#550. Although GitHub records this PR as merged, its squash commit is no longer reachable from the rewritten #185 head; #215 is the authoritative computer stack and must remain unmerged pending the host-interface RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant