<!--{ "pin": "top", "order": 3, "description": "What the contract covers beyond purchases, achievements and saves, how each capability is designed, and where it stands in each shell." }-->

# Capabilities: design and status

**Status (2026-12-04, 0.5.0):** in the contract and passing in every shell, except where the
table under "Where each stands" says otherwise. On real devices: the contract passes in the
Kotlin shell on a Samsung Galaxy A17, and the owner has checked the capabilities listed under
"What needs the owner" on two iPhones, the A17 and a Mac. Not run yet: the contract itself on an
iPhone, and cloud saves with a signed-in iCloud account. The evidence behind each decision is
in [`spikes/`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/README.md).

The first contract covered what a paid game needs to exist: entitlements, purchases,
achievements, saves, pause and resume, the splash. This adds what an app needs to be a good
citizen of its platform:

| capability | what the app gets |
|---|---|
| `cloudSaves` | saves that survive a reinstall and follow the player to their other devices |
| `files` | a folder of the player's own documents |
| `settings` | the app's settings, declared as a schema, shown where the platform shows them |
| `share` | the system share sheet |
| `reviews` | the store's own rating prompt, and its write-a-review page |
| `tasks` | one background task (a mail check, a feed refresh), run at most once per interval: certainly when the app is next open, and in the background where the platform allows |
| `backgroundAudio` | audio the player started plays on in the background, with the system's media controls (lock screen, notification, headset) |
| `openExternal` | opening a link in the system browser or mail app |
| `keepAwake` | the screen stays on while the player plays without touching it |
| `notifications` | a local notification at a time the app chooses |
| `location` | where the device is, while the app is in use, and with `background` a route the player starts that keeps recording when they leave the app |
| `camera`, `microphone`, `motion` | the web build may use that device permission, and nothing else |
| `downloads` | files the shell fetches straight to disk (the caches folder) from what `network` allows, whole or a byte range, and serves back to the page at their own address with byte ranges, a few megabytes per answer: audio Apple's web view will not play from the page's own storage (the reason it exists: a podcast player's episodes offline on an iPhone), and files too big for a page to keep |
| `network` | the page may load data from the https addresses the config lists: `fetch`, a WebSocket, images, media, fonts. Never scripts. And `net.text` reads text from them in the shell itself, past the page's CORS rules, for the many servers (podcast feeds) that send no CORS header |
| purchases (already in the contract) | made real on Apple platforms: StoreKit 2 in the Swift shell |
| lifecycle (always on) | `pause` and `resume` that are true after a sleep, and time to finish saving before the app is stopped |
| closed by default (always on) | the page cannot reach the network, leave its own origin, or use a device permission unless the config says so |
| orientation and the launch screen (config) | how a phone or tablet is held; a launch screen of a colour and an image (centred, fitted or filling), the same from the system's screen to the page's first frame |

Mac, iOS and Android come first. Windows and Linux follow. tvOS and the XR platforms are not
targets, but no decision here shuts them out.

## Decisions

### 1. A capability is declared in the config, or it does not exist

Three gates, each closed by default:

1. **The config declares it.** `capabilities` in `tosijs-native.config.ts` lists what the app
   uses. A shell is built with only those entitlements, usage strings and manifest
   permissions, and its bridge refuses the methods of anything else.
2. **The install has it.** The shell reports what it can do here (`info.capabilities`): the
   declared set, less what this platform or this install lacks (no share sheet on Linux, no
   iCloud account on this Mac). It is decided at run time, not from the target's name: one
   iPhone build also runs on a Vision Pro, and one Android build on a headset.
3. **The player grants it**, where the platform asks them (`permissions`).

The config travels into the shell as a file in the app bundle that the page cannot change
(`tosijs-native.config.json`, written at build time). The shell reads what it may do from
that file, never from anything the page says. On the web there is no boundary to defend (the
page is the app), and the web fallback takes the same list as an option so it behaves the same.

### 2. Absent is an answer; undeclared is a bug

- Calling a capability the **config does not declare** throws, naming it, as an unknown
  product id does. It is a mistake in the app, and it fails in development.
- Calling a declared capability the **install lacks** is not an error. The call resolves
  with an `unavailable` outcome (or `false`, `null`, `[]`), and `native.can('share')` answers
  synchronously beforehand. A game writes one code path, with no platform checks, and
  branches on `can()`, never on `target`.

### 3. The contract promises the portable part; a target may do better

The contract states what holds on every target, and that is what the suite tests.
`durability` says honestly what saves survive on this install, and can change while the app
runs. A notification's time is approximate everywhere. A pause may be held open, where the
platform sells that time.

### 4. JS decides once; the shell enforces what is a matter of trust

Mapping, validation and bookkeeping stay in `createNative`, written once: ids, limits, file
names, the pause and resume state. A shell re-checks only what a hostile page could abuse:
whether a capability is declared, which links may be opened, and that a file name is not a
path. Those rules are plain string work, the same few lines in JS, Swift, Rust and Kotlin,
so four parsers cannot disagree. The contract suite runs each of them against a list of
hostile inputs inside every shell.

### 5. Nothing assumes a browser

The bridge stays `call(method, args)` and `on(event, listener)` with JSON payloads, and the
JS half needs the language and nothing else: no DOM, no `URL`, no `fetch`. A host with no web
view (a TV) or no durable local storage could implement it. `src/headless.test.ts` runs the
whole suite in a context holding the language and `setTimeout`. Every method that needs a
person has an outcome for "nobody answered", so the suite runs unattended.

### 6. One limit, and one naming rule, everywhere

With `cloudSaves` declared, `saves` enforces the limits of the smallest cloud store on every
target (256 keys, 64-byte keys, 1,000,000 bytes in all), so a game that saves on the desktop
saves on the phone and would on a TV. A file name follows the strictest platform's rule on
all of them. Bigger, user-visible data goes in `files`.

### 7. One policy for what the page may load, made once

The page is served from the app, and what else it may reach is a Content-Security-Policy
served with every page. The policy is made from the config in one place
(`contentSecurityPolicy`, in JS) and each shell serves the string it was built with, so
three shells cannot hold three policies. `network` entries open data (`fetch`, WebSocket,
images, media, fonts) and never code: scripts, stylesheets and frames are always the app's
own, because a remote script would run with the bridge. Android adds a second lock: an app
that declares no network is not given the `INTERNET` permission.

### 8. Reviews: the store's prompt, asked of everyone or no one

`native.reviews.request()` asks the store for its own rating prompt, and the store decides
whether to show it and never says. There is no way to ask the player's opinion first and
send only the happy ones to the store, because both stores forbid exactly that ("review
gating"): Apple allows no review prompt but its own, and Google says an app should not ask
the player anything before or while it shows the review card. Apple's prompt already does
what gating is for: the player taps a star, and can then write a review. Play's review
library is built only into an Android app that declares `reviews` (12 KB).

### 9. Android gets its own Kotlin shell

Decided by a spike that built both: every Android feature here is a Kotlin API, so under
Tauri each one crossed Rust only to come back, at twenty times the size and four times the
build time. `shells/kotlin` is to Android what `shells/swift` is to Apple platforms. Tauri
stays for the desktop. ([`spikes/android.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/android.md))

### 10. Background tasks: one task per app, promised only "by the next time the app is open"

An email client checking for mail, a feed refreshing, polling that ends in a notification:
the app gives one handler, `native.tasks.onRun`, and an interval of at least 15 minutes, and
the handler runs **at most once per interval**:

- **when the app starts or comes back** and the last run is older than the interval
  (catch-up), on every target;
- **while the app is open**, when the interval passes;
- **in the background**, where the platform allows it, at a time the system chooses:
  iOS (a refresh task), Android (a JobScheduler job), and macOS while the app is running.

Only the first is a promise. The spikes found no platform that promises when, or whether, a
background run happens: iOS decides by how the player uses the app, Android defers to Doze
and standby buckets (once a day in the lowest), and a force-quit stops both until the next
launch ([`spikes/background-apple.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/background-apple.md),
[`spikes/background-android.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/background-android.md)). A run has a deadline
(`run.deadline`), and on iOS a background run is short: plan to finish in 15 seconds.
Results reach the player through `notifications`; push, which needs a server, is a
separate question.

One task, not many, because that is what iOS gives an app (one refresh request), and an app
can do several things in one run. Its handler gets the page's whole API, so a run is the
app's own code, not a second, smaller program. In the background the shell runs the page
**headless**: Android starts a web view with no window from the job, and iOS a web view in
no window from a background launch (one put in a window is suspended), which the scene then
adopts if the player opens the app. `native.headless` says so, so a game does not start its
music for nobody. Where the page is already alive, the run is sent to it instead.

What it costs: iOS needs the background fetch mode and a registered task identifier;
Android a job service and two permissions (boot, network state), and no library (WorkManager
would add 226 KB and 50 ms to every launch). The web and the Tauri desktop get the catch-up
and the timer, which is the promise.

### 11. Background audio: a separate capability, for players the player started

A media player that keeps playing with the screen locked is a different mechanism from a
task: the page keeps running while hidden. `backgroundAudio` declares it: the page tells
the system what is playing (`native.media.update`) and hears its buttons
(`native.media.onCommand`).
Android needs a `mediaPlayback` foreground service, which the system lets the app start only
from the foreground or from its own media buttons, and Play allows only for playback the
player started ("background game soundtracks" do not qualify). iOS needs the audio
background mode, and whether page audio keeps a third-party app's page alive on a device is
the open question (WebKit's own playback assertion needs an Apple-only entitlement). Media
controls are native on both: the WebView on Android has no `navigator.mediaSession`, and on
iOS the lock screen's buttons did not reach the page's handlers. So the page will report
what is playing and hear the system's buttons through the bridge. A game's music is not
background audio: it stops on `pause`, as it should.

### 12. Location goes through the shell, and background means a route the player started

The system web views cannot gate geolocation per request before OS 27 (iOS prompts twice,
naming the page; macOS 26 always refuses), so `location` is CoreLocation and Android's
platform `LocationManager`, over the bridge. Only `permissions.request('location')` asks:
`current()` answers `null` and `watch()` `denied` until then. On iOS that rule is not free:
creating a `CLBackgroundActivitySession` before permission raises the prompt itself, so the
shell checks first.

`background: true` is a watch the player starts while the app is in front, which both
platforms allow on "while using" permission alone: iOS's background location updates (the
`location` mode, `allowsBackgroundLocationUpdates`, which is what keeps the app running; a
background session alone let it be suspended at 32 s), and an Android foreground service of
type `location` (refused if started after the player left). So no "always" prompt and no
ACCESS_BACKGROUND_LOCATION, which Play reviews on its own. Location while the app is closed
(geofences, a background task run) is left out for that reason.

A hidden page cannot be trusted to run: WebKit suspends it about a second after the app is
backgrounded, and on Android its own timers stop at about 60 s even under the service. What
does run is JS the shell drives: each nudge resumed the page within milliseconds on both
(the RunningBoard and WebKit logs, and the Android emulator). So the shell keeps every fix in
a file, in order, and nudges; the page takes the file with `location.fixes`. A page that
missed a nudge, or an app that was ended, gets the fixes when it next runs, each once.
`approximate` is coarse only on Android and reduced accuracy on Apple platforms; a
background watch with it records about one point every ten minutes on Android, which holds
coarse requests to that. ([`spikes/location-android.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/location-android.md),
[`spikes/location-apple.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/location-apple.md))

### 13. One launch screen, drawn twice

What the player sees between the icon and the page is the config's `launch`: a colour and
an image, `center`ed at a width, fitted (`contain`) or filling (`cover`). The system's own
launch screen shows first and cannot wait for a web page, and a web view paints white until
its page does (about 1.6 s with a page held back), so each shell also covers the web view
with the same colour and image until `native.ready()`, or three seconds after the page
loaded. On iOS the system's screen is a storyboard compiled with `ibtool` (the
`UILaunchScreen` dictionary can only centre an image at its own size). On Android 12 and
later the system's splash can only show a colour and an icon, masked to a circle, so it
shows the colour and the image comes with the shell's view, a moment later. Seen on both:
no white or black frame. An SVG is drawn at the sizes each needs, with AppKit, on the Mac
that builds. `orientation` is the Info.plist keys and Android's `screenOrientation`; iPadOS
letterboxes an app that will not rotate, and Android 16 ignores it on large screens for apps
that are not games.

## The config

```typescript
export default defineConfig({
  appId: 'net.tosijs.manta',
  name: 'Manta',
  products: [{ id: 'full_game', grants: ['full_game'] }],
  achievements: [{ id: 'first_flight', name: 'First flight' }],
  targets: ['web', 'ios', 'mac', 'steam'],
  capabilities: {
    cloudSaves: true,
    files: true,
    keepAwake: true,
    notifications: true,
    share: true,
    // links the app may open outside itself: 'mailto:' or an https prefix with a path
    openExternal: ['https://tosijs.net/', 'mailto:'],
    // where the page may load data from; without it, only the app's own files
    network: ['https://cdn.tosijs.net/'],
    // a device permission is declared by the reason the player is shown
    microphone: 'Talk to your wingman.',
    // location too, and a route the player starts may go on in the background
    location: { reason: 'Mark the wrecks you find.', background: true },
  },
  orientation: 'landscape',
  launch: { background: '#101820', image: 'splash.svg', fit: 'cover' },
})
```

`capabilities` is optional, and a config without it gets none.

## The protocol

Every shell answers every method. One for a capability the install lacks answers
`unavailable`; one for a capability the config does not declare is refused, naming it. The
full table is in [`src/bridge.tjs`](https://github.com/tonioloewald/tosijs-native/blob/main/src/bridge.tjs) (the bridge page on the site); these
are the additions.

| method | answers |
|---|---|
| `info` | adds `capabilities`, and `durability` may be `backup` |
| `lifecycle.settled` | the page has finished its pause work |
| `awake.set` | `{ on }`, the state the system is really in |
| `links.open` | `{}`, or refuses a link the config does not allow |
| `share.open` | `{ status }`: `shared`, `cancelled`, `unavailable` |
| `reviews.request`, `reviews.open` | `{ status }`: `requested` or `unavailable`, never whether the prompt showed; `{ opened }` |
| `tasks.schedule`, `.cancel`, `.info`, `.due`, `.done` | `{ status }`: `background`, `foreground` or `unavailable`; the record (`every`, `lastRun`); a run waiting for the page; the run is over |
| `media.update`, `media.stop` | `{ status }`: `background`, `foreground` or `unavailable`; `{}` |
| `location.current`, `.watch`, `.stop`, `.fixes` | `{ fix }` or `null`; `{ status }`: `background`, `foreground`, `denied`, `off` (the device's location switched off) or `unavailable`; `{}`; the fixes kept since the page last asked |
| `permissions.query`, `permissions.request` | `{ state }`: `granted`, `denied`, `prompt`, `unavailable` |
| `permissions.settings` | `{ opened }`: the system's page where the player can change it (Android: the device's Location page while location is off, else the app's; iOS: the app's page in Settings; Mac: the Privacy & Security pane); `false` on the web and Linux |
| `notifications.schedule`, `.cancel`, `.pending`, `.opened` | `{ status }`: `scheduled`, `denied`, `unavailable`; the ids pending; the ids the player opened |
| `files.info`, `.list`, `.read`, `.write`, `.remove` | one flat folder; bytes as base64 |

| event | means |
|---|---|
| `pause`, `resume` | a shell may also send them itself; a `pause` listener may return a promise for its work |
| `store.changed` | saves changed from outside this run, or what survives changed |
| `notification` | the player opened the app through a notification |
| `files.changed` | the app's folder changed from outside |
| `task` | the system woke the app for a run of its task (`deadline`); a pending call holds the page on Apple platforms |
| `media` | one of the system's media buttons (`command`: play, pause, next, previous, seek with `position`, stop) |
| `location` | the shell has fixes for the page (a nudge: the page takes them) |

## What was learned the hard way

Each of these overturned something that looked finished, and is now a contract case, a
shell check or a test.

- **On iOS a background task does not keep the page running; a pending call to the page
  does.** WebKit suspends the page about 1.2 s after the app is backgrounded whatever the
  app holds, and the Simulator never shows it. The hold is a `callAsyncJavaScript` that
  awaits the page's pause work. ([`spikes/lifecycle-apple.md`](https://github.com/tonioloewald/tosijs-native/blob/main/spikes/lifecycle-apple.md))
- **A plain link could take the web view to another site, and that site could then call the
  bridge.** The web view may not leave the app's origin, and the bridge answers only that
  origin's main frame. Checked in every shell by the hello page.
- **Tauri's Mac web view grants the page the camera and microphone when nobody answers.**
  The shell now refuses every permission request.
- **Declaring only one of camera and microphone makes the other a crash** on Apple
  platforms: the system terminates an app that asks without a usage string, whatever the
  shell answers. The page is stopped before it asks.
- **The capabilities work made the JS half need a browser**, the same day decision 5 was
  written. A bare JavaScriptCore run caught it; the headless test now guards it.
- **iCloud's key-value store drops an over-quota write silently**, keeps counting removed
  keys, and terminates the app on an over-long key. The save store reads back every push.
- **An unentitled, non-sandboxed Mac app is handed an iCloud Drive container just for
  asking**, and asking creates it. A build that does not want iCloud must never make the call.
- **Each shell served a web build's files differently, and each was wrong somewhere.** The
  Swift shell knew seven file types and called the rest unknown (no JPEG, no audio, no
  fonts). Android's packager left out every folder whose name starts with `_`, as many web
  builds' do, so the page got a 404 for its own files. Tauri calls any file it does not
  recognise an HTML page, so a `.mjs` script would not run. One check in the hello page
  (a sample of each kind, in a `_` folder) found all three; all three are fixed.
- **The Swift shell could not play a sound from the app's own files at all.** Apple's media
  stack reads audio and video in pieces (Range requests), and the shell answered every
  request with the whole file, so a sound failed to load (MediaError 4) on macOS and iOS.
  All three shells now answer ranges, by the same plain rule, and the hello page checks a
  range, a sound loading, and a sound looping. Two gaps remain, each skipped with its reason
  rather than passed: on the Android emulator a loop stalls after its first time round
  (#4304), and on Linux WebKitGTK does not load media from the app at all (#4305).
- **The app's own sound plays without a tap first** in every shell (iOS required one), as a
  native app's does. A game that should go quiet with the ring/silent switch sets
  `navigator.audioSession.type = 'ambient'`.
- **On the Mac, WebKit suspends a hidden page once it stops talking to the shell**, after a
  few seconds, and silent audio does not keep it awake (`spikes/background-apple.md`). A
  check that waited on the page's own timers hung the run.
- **A fused location provider asked at its default quality never turns GPS on**, and gave
  the emulator's GPS no fix at all: the shell's first background watch recorded nothing. A
  watch now asks for high accuracy. Found by the trail example's end-to-end check.
- **Under a location service a hidden Android page's own timers stop at about 60 s**, unlike
  a playing page's. The shell's nudges still run it, so fixes arrive; a check that used the
  page's heartbeat as proof of life would have failed a working shell.
- **The Linux Tauri shell cannot start inside Steam's Linux runtimes** (no WebKitGTK), which
  is a question for spike 1, not for this work.

## Where each stands

"Contract" means its cases pass in that shell's own web view, unattended. "Seen" means I
watched it work in a screenshot. Real devices so far (2026-12-03): the Kotlin shell passes
the contract on a Samsung Galaxy A17, 62 passed and 7 skipped, the same cases as on the
emulator. The examples are installed on it and on an iPhone 14 Pro and 17 Pro Max, for the
checks only a person can make; the contract has not run on an iPhone (a contract run reads
its report back through the Simulator). The owner checked on those phones and this Mac: the
share sheet opens with the note's text on both iPhones and the A17, a note saved on an
iPhone is a file in the Files app under On My iPhone, and the Mac app saves its notes (then
in a private folder, which Finder does not show; files are not shared between devices yet).
On 2026-12-04 (checklist mx84vpzp), the owner also checked:
- The Mac app's notes are files in `~/Documents/Notes Example`, seen in Finder. macOS did not
  ask first, which it should for a new build; why is not known, possibly a grant already on
  record.
- On the Mac, the radio example is in Control Center's Now Playing, and the keyboard's
  play/pause key pauses it.
- On the A17, the feed example checks by itself in the background.
- Settings show in each platform's own place: the iPhone's Settings app, the A17's App info,
  and the Mac's Settings… menu.

| | Swift, macOS | Swift, iOS | Kotlin, Android | Tauri, desktop | web |
|---|---|---|---|---|---|
| declared-or-refused gate | contract | contract | contract | contract | contract |
| pause, resume, time away, heartbeat | contract | contract | contract | contract | contract |
| pause held until the page settles | contract (also on quit and before sleep) | contract | not held (a silent page runs on for 60 s at best, 21 s if the player opens another app, with no warning) | not held | cannot |
| `keepAwake` | contract; checked from outside with `pmset` | contract | contract; checked from outside with `dumpsys` | contract on macOS; needs a session service on Linux | contract (the wake lock) |
| `openExternal` | contract | contract; seen opening Safari | contract; seen opening Chrome | contract | contract |
| `share` | contract; the picker not seen | contract; the sheet seen | contract; the sheet seen | unavailable | contract (`navigator.share`) |
| `reviews` | contract; only a Mac App Store install has it (none here), so `unavailable` | contract; the prompt seen | contract; needs the Play Store, which the emulator lacks, so `unavailable`; the card not seen | unavailable | unavailable |
| `backgroundAudio` | contract; Now Playing and the media keys (MPRemoteCommandCenter), seen on this Mac by the owner (2026-12-04); page audio plays on hidden (the spike) | contract; the audio background mode, Now Playing and the lock screen's commands; on an iPhone (the owner, 2026-12-03) the lock screen shows it and its buttons reach the page; whether a locked phone starts the next track is not seen | contract; a mediaPlayback service and a media notification; end to end on the emulator: 90 s after leaving the app the page still ran, never frozen, and the system's pause reached it; the media card seen (`bin/media-android.ts`), and on a Galaxy A17 it pauses and skips the page (the owner) | unavailable | contract (`navigator.mediaSession`) |
| `tasks` | contract; `NSBackgroundActivityScheduler` while the app runs | contract; a refresh task; end to end in the Simulator by a silent push (the Simulator cannot run refresh tasks): headless after a cold background launch, and the suspended app's own page (`bin/tasks-ios.ts`) | contract; a JobScheduler job; end to end on the emulator: a forced job ran the page headless with the app's process killed (`bin/tasks-android.ts`); on a Galaxy A17 the system runs it by itself (the owner, 2026-12-04) | contract; catch-up and the timer while open | contract; catch-up and the timer while open |
| `location` | not in the unbundled debug binary (no usage string), so `unavailable` there; CoreLocation, compiled | contract, through CoreLocation (the run allows location and places the Simulator); end to end: 28 fixes recorded while in another app, in order, each once, and a fix kept on disk reaching the next launch (`bin/location-ios.ts`) | contract, through the platform LocationManager; end to end on the emulator: 44 fixes over the 90 s after HOME, never frozen, and a kept fix reaching the next launch (`bin/location-android.ts`) | unavailable | contract (`navigator.geolocation`, only while the page is open) |
| Back, safe area | no system Back; the window's own insets | no system Back (a page's edge swipe, in the examples' controls); `env(safe-area-inset-*)` | Back goes back in the page's history before it leaves the app, the callback registered only while there is history (a tapped push then Back, by hand on the emulator; the examples check Back is left to the system with no history); the system bars' insets as `--tosi-safe-*`, since WebView gives `env()` only the cutout before 136 | not applicable | the browser's back; `env()` |
| launch screen, orientation | the overlay (no system launch screen) | a storyboard and the overlay, seen with no white frame, also on an iPhone (the owner); orientation keys read back | the theme's colour and the overlay, seen with no white frame, also on a Galaxy A17 (the owner); `screenOrientation` read back | the window's own (not yet from the config) | the app's own page |
| `settings` | contract; `UserDefaults`; Settings… (⌘,) in a menu bar the app now has, which asks the page to show them | contract; `UserDefaults`, and the app's own page in the Settings app (a Settings bundle the build makes from the schema); on an iPhone (the owner, 2026-12-04) the page shows and a change there reaches the app | contract; `SharedPreferences`; the entry on App info opens the app at its settings, on the emulator ("Additional settings in the app") and on a Galaxy A17 (the owner; Samsung words it "Configure in …") | contract; its save file; no system page | contract; the page's storage |
| `files` | contract; an app's folder is `~/Documents/<name>/`, made on first use, when macOS's prompt is answered (a private folder if refused, and for the contract's unbundled binary) | contract, the app's Documents, shown in Files | contract, a private folder | contract, a private folder | contract, the browser's private file system |
| `cloudSaves` | the merge, against a stand-in cloud | the merge, against a stand-in cloud | Auto Backup rules written, restore not run in this shell | no cloud store | another tab's writes |
| `notifications` | unavailable in the unbundled debug binary | contract, real scheduling | contract; one seen to fire with the process killed, and a tap on it to start the app | unavailable | contract (only while the page is open) |
| `permissions` | contract | contract | contract; the system dialog seen | answers `unavailable` | contract |
| purchases | StoreKit 2, compiled but not run (the debug binary has no bundle, so no store) | contract: buy, restore, refund, against a local test store | needs a Play Console app | no store | approve, cancel or fail |
| `network` | contract; a real request seen to load | contract; a real request seen to load | contract; a real request seen to load | contract (also on Linux); no real request made | not applicable: a browser page reaches what it likes |
| `net.text` | contract; reads a page with no CORS header | contract; reads a page with no CORS header | contract; reads a page with no CORS header (off the main thread) | `unavailable`: no HTTP client yet | `fetch`, so only what CORS allows |
| `downloads` | contract; downloads whole and in part, serves byte ranges (debug builds answer 1 KB at a time, which the media checks pass) | contract; the same | `unavailable` (the page keeps audio itself, which Android's WebView plays) | `unavailable` | `unavailable` (the page keeps files itself) |
| closed in (frames, network, navigation) | checked | checked | checked | checked (also on Linux) | not applicable |

The numbers, on the final tree: Swift on iOS 69 passed and none skipped; Swift on macOS 60
passed, 9 skipped; Kotlin on Android 62 passed, 7 skipped; Tauri on macOS 58 passed, 11
skipped; none failed. Linux was last run before location (53 passed, 12 skipped). Each run is two launches of the
app: the second checks that a save, a file and an achievement the first left are still
there, so a shell that kept them only in memory would fail. A skip is a case the shell cannot
run (no store, no bundle, nothing to hold), never a pass. One iOS run in sixteen failed a
case I did not catch the name of, on the first launch after a rebuild.

Windows is not built yet. The Tauri Android app still exists as the comparison it was
measured against, and is superseded: it fails two of the window checks (`SHELLS.md`).

## Not built yet

- **The iCloud Drive folder on both Apple platforms**, so a player's files are on all their
  devices: it needs an iCloud container, an entitlement and a profile for each. Open and save
  dialogs, and bundled assets served at the URLs an app already uses. (#3741)
- **Location while the app is closed**: "always" permission, geofences, location in a
  background task run. Each costs a second prompt and a store review of its own.
- **A launch screen for dark mode**, and the Tauri shell's launch screen and orientation.
- **A `category` (game or app)**, which would let Android 16 honour a game's orientation on
  tablets (`android:appCategory`) and give the Mac App Store build its category.
- **Windows**, and the pause hold and share sheet for the Tauri desktop shell.
- **The Tauri shell from an app's own config.** `tosijs-native build` makes the Swift and
  Kotlin shells for any app (`BUILDING.md`); the Tauri shell is still built for the hello
  app only.

## What needs the owner

Checks only a person can make are posted as a test checklist, not asked in chat. These need
an account, a device or a decision:

1. **iCloud saves syncing for real.** Enable iCloud key-value storage on the App IDs and
   make the profiles; sign two Simulators in to one Apple account and run
   `spikes/icloud/owner-sync-test.sh`. Nobody has seen a save cross devices yet.
2. **Background tasks on an iPhone.** Schedule the feed example's task, leave it, and
   trigger a run with lldb's `_simulateLaunchForTaskWithIdentifier:`, once with the app
   suspended and once with it killed: does the page run (the suspended case rests on
   throttling instead of suspending, seen only in the Simulator's log)? Then leave it a day:
   does iOS run it by itself?
3. **Location on a phone.** Record a walk with the trail example on an iPhone and an
   Android phone, with the screen locked for part of it: is every point there afterwards?
   Do iOS's blue location pill and Android's notification show while it records? Then try
   approximate. On Android, Play asks for a declaration of the location service, with a
   video of the player starting it.
4. **Background audio on an iPhone.** Play the radio example, leave it and lock the phone for
   a few minutes: does the next track start (the page still running)? (The lock screen's
   buttons reach it, seen on an iPhone and on the A17's media card, 2026-12-03.) And on Android, a phone with sound and a Play Console declaration for
   the foreground service (Play asks for one, with a video).
5. **The pause hold on an iPhone.** Background the app during a save and see that it
   finishes. Every device claim about the hold rests on the Simulator and WebKit's source.
6. **A real purchase.** An app record and one product in App Store Connect, a signed build on
   a device and a sandbox account. For Android, a Play Console app and a licence tester.
7. **What a spike left on this Mac.** An empty `~/Library/Mobile Documents/
   iCloud~net~tosijs~spike~files`, in the iCloud account: keep or remove.
8. **Location on the Mac** has not been asked for (it prompts on this Mac), so whether an
   ad hoc build gets it is not seen. (The Mac files folder is decided: `~/Documents/<App
   name>/`, 2026-12-03.)
