tosijs-native — plan
Status: the contract and web fallback exist; hello world runs natively on macOS (Swift and Tauri), iOS and iPadOS (Swift, Simulator), Android (Kotlin, emulator) and Linux arm64 (Tauri), each passing the contract in its own web view (see SHELLS.md). The contract now also covers the capabilities in CAPABILITIES.md. On real devices (2026-12-03): the contract passes on a Samsung Galaxy A17, and the examples install and open on it and on two iPhones; the contract has not yet run on an iPhone.
Adopt one package, get a working native project for each store you target — App Store, Mac App Store, Steam, direct download — whether the shell underneath is Tauri, Electron, a Swift WKWebView shell or Capacitor. The consumer never picks a shell and never edits one.
The contract is the product
- One JS API, with a web fallback so the plain web build keeps working:
- entitlements (manta's
hasFullGame(), generalised); - purchase and restore;
- achievements;
- saves (and what survives a reinstall);
- lifecycle (pause and resume);
- splash and first frame;
- capabilities, declared in the config or absent: cloud saves, files, share, links,
keep awake, notifications, device permissions (
CAPABILITIES.md).
- entitlements (manta's
- One config (
tosijs-native.config.ts): app id, name, icons, products and entitlements, achievements, targets. - One contract test suite. Every shell passes it, and so does the web fallback. That suite is what makes "whether it uses Tauri or not" true: swapping a shell is a config change backed by a green run.
- CLI:
tosijs-native build --target <t>,runanddoctor(BUILDING.md). They exist for iOS, macOS and Android. Doctor checks the tools a target needs and says what is missing; signing certificates, notarisation credentials and the Steamworks SDK are still to come.
Shells are generated and managed
- Native projects are regenerated from config, not handed to the consumer to own (the
Capacitor
ios/folder model). A fix here then reaches every consumer. - There is one deliberate escape hatch for extra entitlements or a custom plugin.
- The native bridge is a trust boundary from day one. Declare it in
releaseDoctor.securityEntries, and keep the shell's permissions closed by default.
Per-target defaults (set by spikes, not by preference)
| Target | Starting default | What could change it |
|---|---|---|
| iOS / Mac App Store | Swift WKWebView shell (decided by spike 3: spikes/storekit.md) |
— |
| Mac direct | Swift WKWebView shell, the same app as the Mac App Store's. It was Tauri; on the Mac the Swift shell has share, notifications, permissions, purchases and the pause hold, where Tauri's answers unavailable, at a fifteenth of the size (CAPABILITIES.md, SHELLS.md) |
the owner preferring one desktop shell for all three systems |
| Windows direct, Linux | Tauri | — |
| Steam (Windows, Mac, Steam Deck) | Tauri + steamworks-rs |
The Linux Tauri shell cannot start inside Steam's Linux runtimes (no WebKitGTK: spikes/platforms-desktop.md), so a Steam Deck needs bundled WebKitGTK, the Windows build under Proton, or Electron. Spike 1 decides |
| Android | Kotlin WebView shell (decided by the Android spike: spikes/android.md) |
— |
| Apple TV | out of scope (no web view on tvOS); the contract stays implementable by a host with none (spikes/platforms-apple-xr.md) |
— |
| Vision Pro | the iOS build runs there as it is; a visionOS build of the Swift shell compiles | a visionOS simulator runtime, to run it |
Spikes (each answers a go/no-go question; all use manta-recon's web build)
- Tauri on Mac, Windows and Steam Deck: frame rate, and whether it runs offline.
- Steam:
steamworks-rsinit, one achievement, and whether the overlay draws over the web view. - iOS: one sandbox purchase and one restore with StoreKit 2, through Tauri and through a
Swift shell. Which one is less code and fewer surprises? Answered: Swift, and its
purchase path is tested with no person (
spikes/storekit.md). A purchase in Apple's real sandbox still needs the owner's account and a device. - Mac App Store: a dry run of sandbox signing and submission.
Sequence
- Contract: API, config schema and contract tests, plus a web fallback that passes them. Done (#3578).
- Hello world, native, on macOS (owner, 2026-10-31): a
.appthat loads the hello page (shells/hello), answers the bridge natively, and passes the contract suite inside its own web view (bun run contract:tauri). In Tauri first, then a Swift WKWebView shell built to compare with it and offered as an option. Swift is the one that could reach visionOS, and Apple TV in some form (tvOS has no WKWebView, so it would not be this web build). - Then the same hello world on iOS → Android → Windows → Linux, in that order. Done but for Windows, which now comes after the capabilities work (owner, 2026-11-24: Mac, iOS and Android first).
- Capabilities (
CAPABILITIES.md, #4236): what an app needs beyond a paid game's basics, designed for every target and built for Mac, iOS and Android first. - Building from an app's own config (
BUILDING.md, #4247): one description of an app that every shell's build reads, behindtosijs-native build. Done for the Swift and Kotlin shells; the hello app is built this way, and so isexamples/notes. - Spikes 1, 2 and 4, then shells that run manta's build. A shell lands when it passes the contract and manta's build runs in it.
Fewest viable targets. Each OS gets the smallest set of distribution formats that reaches its players, chosen deliberately rather than by what a bundler can emit. Linux is the sharpest case.
- Linux must install on two of the owner's machines (2026-10-31): a Raspberry Pi 5 (arm64, Raspberry Pi OS, i.e. Debian) and a gaming PC's Linux partition (x86_64). So Steam alone is not enough: Steam has no native arm64 Linux client, and the Pi is the second architecture.
- Starting recommendation (#3607): one
.debper architecture (arm64, x86_64). It covers Raspberry Pi OS and the Debian/Ubuntu family. Add Steam for x86_64 players. Add a second direct format (Flatpak or AppImage) only when a real machine off the Debian family needs it. Which distro the gaming PC runs decides that. - Linux is built on Linux, in a container on the Mac (
bun run linux contract|deb). Tauri doesn't usefully cross-compile from macOS to WebKitGTK. A Debian trixie container (Apple'scontainer) runs arm64 at native speed. There the contract passes in WebKitGTK under Xvfb, and the arm64.debis 2.1 MB, built in about a minute. x86_64 needs Rosetta for Linux (not installed yet), or an x86_64 CI runner. The Pi and the PC are for install and performance checks, not builds. - For manta, WebKitGTK on the Pi 5's GPU is a spike question (WebGL frame rate). It joins spike 1.
Scope
- First adopter: manta-recon. Grow only as fast as manta needs, but don't let one game's internals shape the contract.
- Out of scope: ariosto. It is a component for other projects, not a product.
- Prior art in the ecosystem: kith-email and lukko (Tauri: sign, notarise, version sync
into
tauri.conf.json, abun build --compilesidecar). See deployment.md "Tauri desktop apps".