---
title: "Host commands"
description: "The host commands an action runs as statements, such as focus, navigate, share and haptic, and a working implementation to start from."
modificationDate: "2026-11-30"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Host commands

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/reference/contract-grammar/host-commands: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

The command names are:

`blur`, `copyText`, `deliveryActivate`, `deliveryCheck`, `fastSeek`, `focus`, `format`,
`load`, `navigate`, `traverseHistory`, `stopLoading`, `captureScreenshot`, `openDevTools`,
`openURL`, `requestFullscreen`, `exitFullscreen`, `requestPictureInPicture`, `exitPictureInPicture`, `removeAllRanges`, `selectText`, `setSelectionRange`, `setRangeText`, `setScheme`, `setLocale`, `setMode`, `setRootFontSize`, `setPageZoom`, `setWindowOpacity`, `showPicker`, `share`, `saveFile`,
`showOpenFilePicker`, `showDirectoryPicker`, `showSaveFilePicker`, `requestPermission`, `cancelReorder`, `scrollIntoView`, `scrollBy`, `showModal`, `showPopover`, `hidePopover`, `togglePopover`,
`hideWindow`, `startViewTransition`,
`haptic`, `postMessage`, `reload`, `relaunch`, `close`,
`observe`, `observeAttributes`, `observeError`, `observeFeedback`, `playSound`, `playSounds`, `stopSounds`, `setSounds`, `requestMIDIAccess`, `sendMIDI`, `startTrace_EXPERIMENTAL`, `stopTrace_EXPERIMENTAL`,
`preventDefault` ([keys](https://exact.expo.dev/reference/contract-grammar/events.md#keys); [pointer](https://exact.expo.dev/reference/contract-grammar/events.md#pointer): a window's `beforeunload`) and
`stopPropagation` ([events](https://exact.expo.dev/reference/contract-grammar/events.md)).

These appear only as action statements. They are not ordinary value-returning
functions. Some have dedicated compiler checks while others also rely on host
argument validation. Use the working implementation when selecting arguments:

| Operation | Starting point |
| --- | --- |
| `observe(name)`, `observe(name, Attributes(...), severity)`, `observeAttributes(Attributes(...))`, `observeError(message)`, `observeError(message, type)` or `observeFeedback(id, message[, rating[, min, max]][, Attributes(...)])`: optional Observe events, attributes merged into later events, error reports and user feedback. Feedback's attributes come last; a rating without a scale is on 0 to 10. Attributes use a shape constructor. Event names contain 1–256 characters and do not start with `expo.`; severity recognizes `trace`, `debug`, `info`, `warn`, `error` and `fatal`, defaulting to `info`. Declare the `observe` launch module and its project configuration to dispatch them. | [Observe configuration](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/modules/observe/README.md), [compiler tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/observe_commands.rs) |
| `postMessage(text, target)`: ordered messages to a canvas by literal surface name, or string replies and host updates to a live iframe by `id` on Apple and both web executors; iframe targets may compute. Missing, ambiguous, replaced or navigation-revoked iframe targets are dropped without entering the canvas queue. A direct Apple iframe or a web iframe reports `close=` once when guest navigation revokes its message channel, including a reload of the same URL. To reopen the app’s original URL, put the iframe in `for mount in [generation] key=mount` and increment `generation` in its close action. The fresh mount can exchange messages after the guest announces it is ready. | LLP 1020 §11, [iframe fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/scripts/fixtures/iframe-post-messages.contract), [compiler tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/post_message.rs) |
| `navigate(id, url)`, `traverseHistory(id, delta)`, `reload(id)` or `reload(id, ignoreCache=true)`, `stopLoading(id)`: move the mounted `iframe` with that `id`, by the Navigation API's and WebDriver BiDi's names; bare `reload()` stays the development host's reboot. The frame reports with `navigate=`, `currententrychange=`, `navigatesuccess=` and `navigateerror=`, each with a `FrameNavigation` record as the action's optional last parameter. On Apple a frame with `partition=` is a top-level page in that partition's own storage (`persist:` names last across launches) and takes them all; an unpartitioned frame refuses the commands (`navigateerror`, `NotSupportedError`). Android keeps a `persist:` partition as a WebView profile where its WebView has profiles and a navigation listener (`exactPage().iframePartition` is then true), refuses every other partition (`navigateerror`, `NotSupportedError`), and there a kept partition takes the events and the commands as on Apple, but for `ignoreCache=true` (`NotSupportedError`: WebView has no reload from origin); a failed load shows Chromium's error page, and a document's title comes with its `navigatesuccess` (LLP 1020.002 §11). The web honours no `partition` (`exactPage().iframePartition` is false) and gives a same-origin frame what the browser lets a page see. A literal id no `iframe` carries is refused here; `partition` beside `sandbox` (`lower-iframe-partition-sandbox`), beside `message=` or a `postMessage` to it (`lower-iframe-partition-message`), or with a literal `src` that is not a web page (`lower-iframe-partition-src`) is refused. A partition is cleared with `clearSiteData` from `@exact/browser`: `send m = clearSiteData(partition=…, types=[…])`, or from data code `await clearSiteData({ partition, types })` once the Contract names the send (LLP 1133.002 D14); Android clears `"cookies"` or all of a partition (`"*"`), and refuses `"storage"` or `"cache"` without `"*"` (`NotSupportedError`). On Apple any frame that handles `newwindow=` asks for windows, with a `FrameNewWindow`: a `new-window` (`window.open` with features) from a partitioned frame has already opened as the platform's popup in the same partition; a `foreground-tab` or `background-tab` (`target=_blank`, ⌘-click), or a `new-window` from an unpartitioned frame (part of the app's page), opened nothing and is the app's; `download=` reports a download with a `FrameDownload`. Dialogs, file inputs, a download's destination and another app's scheme are the platform's sheets and panels, and `requests` under the agent (`dialog`, `open-file`, `save-file`). A guest's `window.print()` prints its own frame (a PDF frame the PDF's pages): on macOS the print panel, a sheet on the window, and the `print` request under the agent, for a web view's main frame or a PDF in a frame below it (another frame below it does not print: no public API prints it); the web prints as the browser does; iOS does not print yet. `captureScreenshot(id, "app:/tmp/shot.png")` writes a PNG of any frame's guest, and `clip=DOMRect(x=…, y=…, width=…, height=…)` a part of it in the guest's CSS pixels, as a pinch or pan leaves it; the frame answers with `capture=` and a `FrameCapture` (`path`, `width`, `height`, or `error` and `message`); a literal path outside `app:/data`, `app:/cache` and `app:/tmp` is refused here (`lower-frame-capture-path`); the web answers `NotSupportedError`. On Apple an unpartitioned, unsandboxed frame of a local PDF (`app:/` or `assets/`) shows it in PDFKit's `PDFView`, `#page=N` opening at that page. Data code that holds the grant `browser.automation` drives a partitioned frame with `@exact/browser-automation` (WebDriver BiDi's `evaluate`, `callFunction`, `addPreloadScript`, `performActions`, `handleUserPrompt`, `setDownloadBehavior`, `captureScreenshot`); while it drives one, the frame's dialogs fire `userpromptopened=` with a `FrameUserPrompt` instead of showing a sheet, until a person's input takes the frame back. On Android a kept partition takes `evaluate`, `callFunction` and `addPreloadScript`: a `sandbox` runs in a WebView execution world in the documents that start after the app first names it (`InvalidStateError` before), and without one a promise is not awaited and a preload script is refused (`NotSupportedError`, naming `sandbox`), since Exact puts nothing in the page's own world; input, prompts, downloads and pictures answer `NotSupportedError` there. `openDevTools(id)` opens the platform's inspector for a frame's guest, as Electron's `<webview>.openDevTools()`: on macOS Safari's Web Inspector in a window of its own (brought to the front when open), through WebKit's private `_inspector`; iOS makes the frame inspectable from a Mac's Safari › Develop; the web refuses it in the log | LLP 1020.002, [fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/scripts/fixtures/iframe-partition.contract), [windows](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/scripts/fixtures/iframe-windows.contract) |
| `focus(id)` | [Markdown Stress](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/markdown-stress/app.contract) |
| `format(id, command[, argument])`: a Markdown editor's toolbar command ([Markdown](https://exact.expo.dev/reference/contract-grammar/built-in-tags.md#markdown-markup-format-select)) | [Markdown Stress](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/markdown-stress/app.contract) |
| `blur()`, `blur(id)` | [Messages](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/messages/app.contract), [keyboard-bar corpus](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/corpus/keyboard-bar.contract) |
| `selectText(...)` | No app fixture; the hosts' field selection, such as [`FieldSelections.swift`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/Sources/ExactKit/FieldSelections.swift) |
| `setSelectionRange(id, start, end[, direction])`: a text field's or text's selection, by its `id` ([form controls](https://exact.expo.dev/reference/contract-grammar/events.md#form-controls-radio-inputevent-setselectionrange)) | [radios conformance](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/conformance/radios.contract), [control tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/controls.rs) |
| `setRangeText(id, text[, start, end[, selectionMode]])`: a field's range replacement, one `input`, preserve selection by default; one undo step on macOS, focused iOS fields and the Markdown editor ([form controls](https://exact.expo.dev/reference/contract-grammar/events.md#form-controls-radio-inputevent-setselectionrange)) | [Chrome comparison](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web/tests/field-range.test.mjs) |
| `copyText(text)` | [Messages](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/messages/app.contract) |
| `startTrace_EXPERIMENTAL()`, `stopTrace_EXPERIMENTAL()`: experimental, so named while the trace's fields may still change; a recording of each UI update UIKit makes, observed without asking for one or for a frame rate (iOS and tvOS 18 and later), elsewhere of each display-link callback, from which it estimates the frames the display showed again, from an app's own control and in any build, a production one included; `stopTrace_EXPERIMENTAL()` puts the trace on the clipboard as compact JSON and in a `trace-recording-*.json` file in the app's temporary directory; `stopTrace_EXPERIMENTAL(maxBytes)` copies it cut to that many bytes (its totals and scroll segments as rows, then the frames late the longest first, as many as fit), for a conversation that limits a message (a budget too small for its totals gets a note naming the size that fits them; that note can exceed the requested budget), and still saves the whole trace. On iOS it splits each scroll a person makes of an element's scroller, a route's page or the document into its drag and its glide, with its frame rate and delay relative to the display’s fastest rate; a Mac recording follows no scroller. It lists each late frame with its cause, its scroll offset, its update's phases, the main thread's busy time, its overrun and commit time, batches and host phases; [Frame trace fields](https://exact.expo.dev/reference/contract-grammar/host-commands.md#frame-trace-fields) says what each field means. Apple hosts (tvOS, with no clipboard, only saves the file); the web and Linux refuse it in the journal | [`TraceRecording.swift`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/Sources/ExactKit/TraceRecording.swift) |
| `openURL(url[, id][, target="_self" \| "_blank"])`: an absolute `http`, `https`, `mailto` or `tel` URL, or one of a scheme app.json's `open_url.schemes` declares (`"open_url": {"schemes": ["vscode", "zed"]}`, an editor's deep link), opened by whatever the system registered for it; the web's JS target, Android, macOS and iOS open declared schemes and journal one nothing could open. On the web the browser asks first. Under the agent these hosts journal the declared scheme instead (`openURL vscode: …`). With `target="_self"` (literal `"_self"` or `"_blank"`, default `"_blank"`), the web hosts accept only an absolute `http` or `https` URL and navigate the current tab via `location.assign` so Back returns to the app (for post-fetch redirects such as hosted checkouts or SAML/OAuth hand-backs; sign-in uses `@exact/oauth` / `openAuthSession`), and under the agent journal target and origin only (`openURL _self <origin> …`) without navigating; native hosts ignore `target` and open via the system handler as today. Under the agent an `http` or `https` URL with the default `"_blank"` opens in the driver's browser on the web, in a tab the drive does not control, while macOS and iOS journal it and open nothing, so a test cannot go on in the opened page. `openURL(url, id)` also says whether it opened, as Electron's `shell.openExternal` does: `change` at the element `id` names hears `opened` when the system took the URL, or `failed` when it was refused or nothing could open it (no app registered for its scheme, a host with no browser). The web hears `opened` for any URL it hands the browser, which does not say what opened it. Where the agent's drive journals an open instead, macOS answers whether an app is registered for the URL and the other hosts answer `opened`. A link's `href` of a declared scheme opens on macOS and iOS, which hand followed links to `openURL`; Android and the web keep inline links to the four ordinary schemes. `file`, `javascript`, `data` and the other schemes that run or read content cannot be declared. Any other scheme is refused in the journal (LLP 1133.000 §2) | No Contract fixture; the hosts' dispatch, such as [`host/web-js/commands.js`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/commands.js), [`OpenURL.swift`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/Sources/ExactKit/OpenURL.swift) |
| `setScheme(scheme)`: the app's scheme, `"light"`, `"dark"` or `"system"` (follow the system's appearance) | [Caltrain](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/caltrain/app.contract), [Markdown](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/markdown/app.contract) |
| `setLocale(tag)`: the language the app's strings read, over the host's locale: `t(…)` texts, `lang`, `dir` and `exactTime().resolvedLocale` follow the table `tag` resolves to, by the lookup the host's locale takes (`"de-AT"`, then `"de"`, then the base). `exactTime().locale` and `formatLocale` stay the device's. The choice is kept across launches and applies before the first frame of the next; `setLocale("")` forgets it and follows the host's locale. A literal tag is checked here (`type-set-locale`), a computed one in the log when it runs; an app with no strings tables is refused (`type-strings-missing`) | [strings tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/strings.rs) |
| `setMode(axis, value)`: sets one of the window's app modes, an axis of the app's design (`app.forma`) to one of its values, as `setMode("dark-style", "dim")`; a subtree pins its own with `-exact-mode` (LLP 1121 D5) | [Forma recipe](https://exact.expo.dev/recipes/forma.md), [compiler tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/forma.rs) |
| `setRootFontSize(px)`, `setRootFontSize("125%")`, `setRootFontSize("medium")`: CSS's `:root { font-size }`, the root font size every `rem` follows, in px above 0, laid out in the action's own commit; `px` lengths stay. It stands over the host's own size (the browser's setting, iOS Dynamic Type, 16 on macOS and Linux), as an author's `html { font-size: 20px }` stands over a browser's font-size setting, and `"medium"` hands the size back to the host. A percentage (CSS's number syntax, above 0) is that share of the host's size and follows it as the host's changes (LLP 1121 D6). A literal of 0 or less is refused here, a computed one in the log when it runs. Not kept across a launch: set it again from a mount task (LLP 1069.000 D3) | [rem tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/rem.rs) |
| `setPageZoom(factor)`: the window's page zoom, as View ▸ Zoom In sets it and Electron's `webContents.setZoomFactor`: a CSS px is `factor` points, so the viewport, media queries, `px` and `rem` all follow; `setPageZoom(1)` is Actual Size, and a factor is clamped to 0.25–5. For an app whose own ⌘0, ⌘= and ⌘- commands keep their own steps ([The Mac's menu bar](https://exact.expo.dev/reference/contract-grammar/events.md#keys)). The Mac's; iOS, Linux, Windows and the web refuse it in the journal (LLP 1021 §5.3.1) | [`PageZoomMacTests`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/tests/ExactKitTests/PageZoomMacTests.swift) |
| `exitFullscreen()`, `setWindowOpacity(opacity)`: what a quit the app holds does to its window before it quits, as Electron's `setFullScreen(false)` and `setOpacity(0)`. `exitFullscreen()` is the web's `document.exitFullscreen()`: on the Mac the session's window leaves its full-screen space (a video's own full screen is `requestFullscreen(id)`'s); nothing happens when nothing is full screen. `setWindowOpacity` draws the session's window at an opacity from 0 (unseen, still key and still hearing keys) to 1 (`NSWindow.alphaValue`); a literal outside 0–1 is refused here (`type-window-opacity`). The Mac's; the web refuses `setWindowOpacity`, and iOS and Linux refuse both, in the journal. The agent's `state.windows` shows each window's `fullScreen` and `opacity` (LLP 1069.010) | [calls tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/calls.rs), [`WindowCommandsMacTests`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/tests/ExactKitTests/WindowCommandsMacTests.swift) |
| `hideWindow()`: the session's window put away with the app still running, as Electron's `BrowserWindow.hide`, for a menu-bar utility whose window goes once its work is done. On the Mac it is what the person's ⌘W does under `host.macos.window.keepRunning` or while a status item is placed: the window is ordered out, its session kept, `exactPage().visibilityState` reads `hidden` and `persisted` `true`, and the next bare `focus()`, Dock click or status-item press shows it as a restore (`restores`). Where the app would end without its window (neither, or a `navigate-new` app), it is refused in the journal and the window stays; `close()` still closes the window and ends the app. On Windows it is what the close button does under `host.windows.window.keepRunning`, and refused in the journal without it. iOS, Linux, Android and the web refuse it in the journal (LLP 1133.025 D4) | [window command tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/window_commands.rs), [`WindowCommandsMacTests`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/tests/ExactKitTests/WindowCommandsMacTests.swift) |
| `startViewTransition()`: the action's commit cross-fades the whole window from how it looked before, as the web's `document.startViewTransition()` with the root's default animation, over 0.25 s. It takes no argument (`type-view-transition`). For a change that replaces most of the screen with no route of its own, such as a switch of the app's whole data set. The commit's own pushes and pops land without their own animation; a sheet or dialog it opens presents with its own. iOS runs `UIView.transition(with: window, options: .transitionCrossDissolve)`; a sheet the commit closes, or a dialog it closes with `close(id)`, slides out while what is beneath it cross-fades, and one that stays fades with the window. The Mac fades the window's content. iOS and the Mac fade under reduced motion too. The web (exact-web-js) runs the commit's tree update inside `document.startViewTransition` and cuts under reduced motion; the painted hosts (Linux, Android, Windows) draw the window's last frame over the commit and fade it out with CSS `ease`, the old look's share and the new look's adding up as the web's two images do; there the commit's own push or pop lands at once, a sheet keeps its own motion under the fade, and a plan that names `startViewTransition` keeps a drawing of each frame it shows to fade from. They cut under reduced motion, with a journal line, as the web does. The wasm web host cuts, with a journal line (LLP 1013.003) | [window command tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/window_commands.rs), [`ViewTransitionIOSTests`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/tests/ExactKitTests/ViewTransitionIOSTests.swift), [`ViewTransitionMacTests`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/tests/ExactKitTests/ViewTransitionMacTests.swift), [window transition test](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/window-transition.test.mjs) |
| `share(title=, text=, url=, files=)`: the system share sheet by the Web Share API's names, at least one of `text`, `url` and `files`, each its own item of the sheet (pass a picture alone to share only it, as a Share Card button does; `contract vocab share`); `url` absolute `http(s)`. `files=` lists `app:/` files, each behind the app's `fs.read` grant (on Apple a regular file of at most 64 MB, reached through no symbolic link), and `"#id"` entries: a PNG of that element as it is drawn now, at the display's scale, named by the share's `title` (else by the id) (iOS and macOS; the web refuses it, `share: refused: a picture of an element is not available on the web`, and Android refuses it, though it shares `app:/` files; Linux refuses files). A literal `#id` no element carries is refused here (`lower-share-picture`), a missing one at run time in the journal. Offer it where `exactPage()`'s `canShareFiles` and `canSharePictures` hold (LLP 1125 D12). The outcome is a journal line. A file the app opens as a database is not one to share: on Apple and Android the host opens and closes the file, which drops SQLite's locks on it ([How To Corrupt An SQLite Database File, §2.2](https://sqlite.org/howtocorrupt.html#_posix_advisory_locks_canceled_by_a_separate_thread_doing_close_)); share a copy made with `storage.fs` while the database is closed, or an export of its rows | [share corpus](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/corpus/share.contract), [Metronome](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/metronome/app.contract) |
| `showPicker(id)`, export `saveFile(id, from, suggestedName)`: the host copies the `app:/` file `from` to where the person chooses; `change` at `id` carries the chosen name, `cancel` a dismissal. As for `share`, a file the app opens as a database is not one to save: on Apple the copy's open and close drop SQLite's locks on it. `saveFile(id, text=…, suggestedName=…)` saves the text itself (UTF-8), no file written first and no grant, so "export what's on screen" is one press | [picker tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/picker.rs), [Fieldnotes](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/fieldnotes/app.contract), [Linux's save tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/painted/src/presenter/save_tests.rs) |
| `showOpenFilePicker(id[, multiple])` | [file-picker corpus](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/corpus/file-pickers.contract) |
| `showDirectoryPicker(id)` | Same corpus |
| `showSaveFilePicker(id, suggestedName)` | Same corpus |
| `apple.message=` on the three document pickers takes a string expression, for example `showDirectoryPicker("folder", apple.message=t("choose-project"))`. macOS shows it above the file list. The iOS picker has no message line and other hosts ignore the option. | [picker tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/picker.rs) |
| `startIn=` on the three pickers and `saveFile`: where the panel opens, the File System Access API's option. A well-known folder, `"desktop"`, `"documents"`, `"downloads"`, `"music"`, `"pictures"`, `"videos"` or `"screenshots"`, or a `doc:/` path the person chose earlier (its folder, or a chosen file's folder). A literal outside the names fails the build (`type-file-picker-argument`, `type-save-file-argument`); at run time a value that is neither, or a handle the session does not hold, is journalled (`<command>: startIn: refused: …`) and the panel opens where it would. macOS opens the folder each time, Linux's portal and Chromium likewise (Chromium's `screenshots` is `pictures`), and iOS opens a handle's folder and ignores a name (LLP 1173 D2) | Same corpus, [picker tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/picker.rs) |
| `requestPermission(id, path, mode)`: a kept document's access asked for again, `mode` `"read"` or `"readwrite"`, from a press (the web asks the browser under its activation; a native host answers `granted` for a document that resolves); `change` at `id` hears `granted` or `denied` ([documents kept across launches](https://exact.expo.dev/reference/developer/generate-typescript-data-source-types.md#documents-the-person-chose-doc)) | No app fixture; [the web's kept documents test](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web/documents-kept.test.mjs) |
| `cancelReorder(id)` cancels an active reorder from the list with that string id. The ghost springs home, the previews close, and the list receives no `reorderdrop`. With no active reorder from that list, or while a sent drop awaits its answer, the command does nothing. | LLP 1094 D8 |
| `scrollIntoView(id, block=, inline=, behavior=)`: `Element.scrollIntoView()` on any element by its `id` (a string, dynamic as `focus`'s): every scroll container above it, innermost first, then the page, align it by the web's `ScrollIntoViewOptions` (`block` default `start`, `inline` `nearest`). `scrollIntoView("list-id", key, …, row=, offset=)`: a virtualized list's row by key, built and measured first (LLP 1070.000). macOS, iOS and tvOS animate the element form with the platform's scroll animation unless `behavior="instant"` (LLP 1115.000 D8.4), landing immediately under reduced motion; `scrollend` comes once the animation ends. Linux and Android glide the element form the same way while the display owns the clock, and land it at once under the agent's (LLP 1070.000 §14). Either form owns its scrollers until it settles: `scrollFollowEnd` moves nothing meanwhile, and follows afterwards only where it rests at the end (LLP 1070.000 §15) | [collection tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/collection_into_view.rs) |
| `scrollBy(id, x, y)`: `Element.scrollBy(x, y)` on a scroll container by its `id`, in pixels (a terminal's row is 16, its column 8), clamped to its travel; an element that does not scroll does not move. A reader's `j` and `k`. The terminal, Linux and the web's JS target take it; Apple and the wasm web host do not yet | [the LLP terminal reader](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/llp/terminal.contract), [`reading.rs`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/terminal/tests/it/reading.rs) |
| `showPopover(id, source="trigger")`, `hidePopover(id)`, `togglePopover(id, source="trigger")`: HTML's methods by element id. `popover=(expanded ? some("manual") : none)` adds or removes that property on the same node; removing it closes the top layer and restores inline placement. `source=` is optional and explicit; it need not carry `popovertarget`, and the key handler's node is not inferred. Repeated show/hide is a no-op. Visibility changes immediately in command order, including hide then show during native dismissal. Bad targets or sources are refused in the journal. A popover's `toggle=changed` action may take `e: ToggleEvent`, with `oldState` and `newState` (`"open"` or `"closed"`); events follow logical visibility, coalescing changes in one turn. Without a source the popover has no invoker. A following `focus(id)` in the opening action selects a native menu row on macOS and windowed Linux; AppKit refuses changing the highlight once native tracking begins. A navigation-bar item's pull-down on iOS reports `open` as UIKit reads its rows, and `closed` at a pick, at a touch on the app's own views outside it, at `hidePopover` or another auto popover's showing, which dismiss it, and when its button leaves the bar; a close by a hardware keyboard's Escape or VoiceOver's escape gesture is reported only when the next pull-down opens, and the others as UIKit begins to dismiss the menu, not when it is gone (expo/exact#1462). A macOS toolbar or status item's menu reports both edges as AppKit tracks it. Desktop/headless Linux reports unsupported; windowed Linux uses its existing supported menu/alert shapes. | LLP 1021 |
| `showModal(id)`, `close(id)`: `HTMLDialogElement.showModal()` and `close()` on a dialog by its `id`, from an action (bare `close()` is the window's). The terminal takes them (LLP 1101.001 P5); iOS presents a `dialog` or `role="alertdialog"` popover by its id as its confirmation (an alert or action sheet, with no invoker) and any other `dialog` as a sheet as tall as its content (LLP 1115.000 D11.5), the web shows the dialog (or the alertdialog popover), macOS the dialog in its top layer, or a `role="alertdialog"` one in the alert's shape as `NSAlert`, a sheet on the window (LLP 1115 D6, LLP 1115.000 D7.6) | [the harness](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/harness/terminal.contract), [the native fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/native-fixture/app.contract) (`askClear`) |
| `fastSeek(id, seconds)`, `load(id)`: a `video` or `audio`, by HTML's method names (LLP 1042 §3). `fastSeek` seeks each time it runs, where a bound `currentTime` seeks only when its value changes; every host seeks to the exact time, which HTML's approximate-for-speed allows. `load` loads the source again, as a changed `src` does: the bound `currentTime` waits for its metadata and a bound `paused` false plays | [media tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/media.rs), [media conformance plan](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/conformance/media.contract) |
| `requestPictureInPicture(id)`, `exitPictureInPicture()`: the `image` with that `id` floats in the platform's picture-in-picture window, which shows each picture its `src` names next, live (HTML has it only on `video`; this stands for the canvas `captureStream()` and hidden video a page builds). The image hears `enterpictureinpicture`, `leavepictureinpicture` (the person closed the window, or `exitPictureInPicture()`), and `pictureinpictureerror` with the reason when the request fails, as HTML's promise rejects; an image that leaves the document closes it with no event. One image floats in that window at a time, so `exitPictureInPicture()` takes no id, as HTML's `document.exitPictureInPicture()`. macOS (AVKit's sample-buffer source) and the web's JS target (`captureStream()` into `requestPictureInPicture()`) float it; iOS, tvOS, the wasm target, Linux and Windows refuse it in the journal and with the event. `requestPictureInPicture(id, presentation="window", title=…, width=…, height=…)` asks for a window Exact draws instead, by name as `scrollIntoView` takes its options: `"window"` a browser's picture-in-picture window as Chromium draws it on the Mac (bottom right, its title, Minimize, Back to tab and Close shown while the pointer moves over it), `"panel"` a floating panel with the platform's title bar, one per image beside the picture-in-picture window, which `exitPictureInPicture()` leaves open (LLP 1042 §9.2); `title`, `width` and `height` go only with `presentation`. The web shows either in Document Picture-in-Picture's window where the browser has it, else floats the default way; iOS and tvOS refuse it. The agent reads each window in `tree` (`pictureInPicture` on its image's row), presses it with `tap <image> pictureinpicture minimize\|back\|close\|hover` and pictures it with `screenshot <png> window pictureinpicture [<image>]` | LLP 1042 §9 and §9.1, [compiler tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/picture_in_picture.rs), [web test](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/picture-in-picture.test.mjs), [window tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/apple/Tests/ExactKitTests/PictureInPictureWindowMacTests.swift) |
| `deliveryCheck`, `deliveryActivate` | [delivery corpus](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/corpus/delivery.contract) |
| `playSound(src, at=, gain=, group=, playbackRate=, pan=)`: a new voice of a declared sound (a literal `src` must be declared, `type-sound-undeclared`), starting at `at` on the runner's clock (`performanceNow()`'s milliseconds; the past and the default are the commit's time), at a linear `gain` 0–1 (default 1; a literal outside is refused, a computed one clamped), in a `group` that is monophonic by start time, read at `playbackRate` 0.25–4 (default 1; pitch and length move together, so the voice lasts its file's length divided by it) and placed at `pan` −1 to 1 (default 0, centred; Web Audio's equal-power `StereoPannerNode`), each refused as a literal outside its range and clamped when computed, as `gain` is (LLP 1125 D10). `playSounds(hits)`: one voice per item of a list of a shape whose fields are, in order, `src: string`, `at: number`, `gain: number`, `group: string`, then optionally `playbackRate: number` and then `pan: number`. `stopSounds()`, `stopSounds(group=)`: what sounds stops, what waits is cancelled. `setSounds(group=, gain=, playbackRate=, pan=, ramp=)`: what sounds and waits (in `group` when given; a sequence's next steps keep theirs) moves to each value given, at least one of the three, ranges and clamping as `playSound`'s, linearly over `ramp` ms from the commit's time (default 20, a literal below 0 refused, a computed one clamped); one not yet started, or made by the same commit, takes them outright (LLP 1096 D14). The runner keeps the voice table (`state sounds`); the web and Apple play it, Linux and Windows keep the record (LLP 1096) | [sound tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/sound.rs), [sounds conformance](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/conformance/sounds/app.contract) |
| `requestMIDIAccess()`, `sendMIDI(output, data, at=)`: ask for the MIDI ports `exactMIDI()` answers; send whole MIDI 1.0 messages to an output by `id` at `at` on the runner's clock. The runner keeps the queue (`state midi`); a host hands each message to its output 50 ms before it is due ([MIDI](https://exact.expo.dev/reference/contract-grammar/components-and-actions.md#midi-exactmidi-sendmidi-midimessage), LLP 1125 D6, D7) | [MIDI tests](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/cli/tests/it/midi.rs), [MIDI conformance](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/web-js/conformance/midi/app.contract), [Metronome](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/metronome/app.contract) |

The web (its JS target) and the Apple hosts carry every command whose row above
does not say otherwise. The
headless Linux host has no browser, clipboard, editor or dev menu: its
`openURL`, `copyText`, `format`, `reload`, `close`, `fastSeek` and `load` are
journaled as unsupported there (it has no media player), and `haptic` does nothing. Its `selectText` focuses the field
with its whole text selected, which the next typed key or Backspace replaces.
On Android the same host has the platform behind it (LLP 1115.001 D5): `openURL` and a
link out open the browser, the mail app or the dialer. `openURL` also opens declared schemes. `copyText` writes the clipboard,
`haptic` and `-exact-press-haptic` play, and `share` shows the Sharesheet; notifications
and the pickers are still refused there.
iOS closes no window either: its `close` is journaled as unsupported. On the web,
`reload()` is the page's own reload, and `deliveryCheck` and
`deliveryActivate` find nothing (a web build has no update store; the page is
the newest root).

`relaunch()` takes no arguments. In the standalone macOS app it asks the same
`beforeunload` handlers as Quit, waits for pending storage and each native
module's quit work (`willQuit`) for up to five seconds in all, destroys the sessions, then starts the same executable with the same arguments
and environment after the old process exits. A cancelled quit cancels the relaunch.
It works without the development menu. iOS/tvOS and Linux refuse it in the journal;
the web reloads the page, with the browser's usual storage and unload rules.
Native agent sessions refuse it explicitly: start another drive on the same
`--storage` instead. `reload()` and update activation keep their existing lifecycles.

Element-targeted commands use `id`, not `testId`. File pickers publish handles
through the target's `change` event; cancellation uses `cancel`. Permissions,
accepted file types, app identity, and platform support remain part of the app
integration. A recognized command name alone does not prove those prerequisites.

## Frame trace fields

`stopTrace_EXPERIMENTAL` writes its trace as data with no explanations; these are its fields. The compact copy writes the totals, segments and late frames as rows whose fields its `totalColumns`, `segmentColumns` and `lateColumns` name.

On iOS and tvOS 18 and later (not Mac Catalyst), with the session's view in a window scene, a recording's frames are the UI updates UIKit makes for it, seen by a passive `UIUpdateLink` that asks for no update and no frame rate, so a scroll runs at the rate the system gives it and a period at rest has no frames. Elsewhere they are the callbacks of a display link that asks for the display's full rate. A passive recording pauses while the app is inactive or its view is outside a window; the next active update starts a new timing baseline.

Presentation probe readings remain diagnostic until qualified on a physical device. They do not contribute to `hitchMs`, `hitchMsPerS` or `cause`.

| Field | Meaning |
|---|---|
| `source` | what the recording read: `ui-updates`, UI updates through a passive `UIUpdateLink`; `display-link`, the sampler's display-link callbacks (a Mac, a system before iOS or tvOS 18, or a view not yet in a window scene) |
| `t`, `from`, `to` | ms since the process started (the media clock): a UI update's expected presentation (`UIUpdateInfo.estimatedPresentationTime`), or a display-link callback's time |
| `interval` | ms between a frame's expected presentation and the one before's, or between a display-link callback and the one before |
| `period`, `periodMs` | the display's frame period in ms: for UI updates the fastest it runs (`maximumFramesPerSecond`), so a lower rate counts as missed frames; for a display link as the callback before announced it (`targetTimestamp − timestamp`). `periodMs` is the median |
| `hz`, `thermal` | a total's frames per second; the device's thermal state (`ProcessInfo.thermalState`) when the recording began and, when it changed, when it ended. A hot device and Low Power Mode (`lowPowerMode`) can lower a ProMotion display's rate |
| `phase` | `drag`: a finger moves the scroller (`isTracking` and `isDragging`); `glide`: it decelerates after release; `bounce`: it is past its content's edge; `moving`: it moves with no finger on it (an animation, the app's own scroll); `rest`: no scroll, and every frame on a Mac, which follows no scroller |
| `scroller` | the scroller a frame was read from: its node's test id, else `#` and its id, else `node` and the node's number, and `page` for the document's; a second scroller of one name is `name (2)` |
| `offset` | a late frame's scroller offset in points as its update committed it, along the scroller's axis (y, or x for a sideways one) |
| `missed` | frames the display showed again: `round(interval / period) − 1` |
| `quiet` | a gap between UI updates that owed no frame: no scroll continued through it, no batch was pending at its start, and the main thread was free for a period or more of it. A new batch or first scroll after rest does not owe earlier frames. It is not late, misses nothing, and counts one period of its total's `ms` |
| `cause` | what made a late frame late, by the part its `hitchMs` came from: `update`, its UI update's work ran past the completion deadline; `main`, the main thread was busy before the update began (its `start` longer than its `work`) or through all of a gap but one period; `rate`, a gap in which something moved, the main thread was free for a period or more of it, and UIKit made no update (the system's rate, as an animation at 80 Hz has, or the render server holding updates back). A display link's callback gap is `main`. `causes` counts them in a total |
| `start`, `events`, `links`, `work` | a UI update's phases (UIUpdateActionPhase.h), ms: from its `modelTime` to its event dispatch, which work the main thread was busy with before it delays (about 0.5 ms when nothing does); its touch and gesture handling; its display links' callbacks; and its work from event dispatch to the end of its Core Animation commit, the three before it included. `meanWorkMs` and `maxWorkMs` are a total's |
| `overrun` | how late the frame's commit was, ms: for UI updates, past their completion deadline (`UIUpdateInfo.completionDeadlineTime`), which delays the frame's presentation; for a display link on iOS and tvOS 18 and later, the same, or, when larger, how late an update that sampled no frame committed since the frame before; elsewhere, how long past the frame's target the main thread's turn ran |
| `commit` | how long Core Animation's commit took, ms, the layout and drawing of the layers that needed it included: from the update's `beforeCATransactionCommit` to its `afterCATransactionCommit`. `meanCommitMs` is a total's |
| `main` | ms of main-thread run-loop turns since the frame before: for UI updates, from the end of its commit to the end of this one's |
| `own`, `ownMeanMs`, `ownMaxMs` | the recorder's own main-thread time in a UI update, ms, its probe's presentation included, and a total's mean and most |
| `batches`, `apply` | the app's batches applied in the frame, and the ms applying them took |
| `phases`, `unattributed` | main-thread ms by Exact host phase in the interval (`runtime` is waiting on the runner and the kernel's layout); `unattributed` is the rest: idle, UIKit's layout, the commit |
| `hatches` | per frame, ms in each hatch call; in the report, `not timed in a production build` where the bake installs no diagnostics |
| `phasesCoverage`, `coverage` | `partial` when the host phases or hatch calls kept no longer reach back over the whole frame |
| `hitchMs`, `hitchMsPerS` | delay relative to the display’s fastest rate, and that delay per second. This includes lower system cadence (`rate`) and is not Apple’s scroll hitch ratio. A frame counts once, by the larger of its callback gap beyond one period and its commit delay rounded up to a whole period; a gap right after a late commit of the frame's own UI update counts only what that commit's delay did not. Each late frame carries its own part as `hitchMs`. Presentation probe readings are diagnostic and excluded from this estimate. |
| `frames`, `ms`, `lateFrames`, `worstIntervalMs`, `meanMainMs`, `maxMainMs` | a total's frames, its length, its frames late by any measure (including diagnostic probe readings), its longest interval, and its main-thread time per frame, mean and most |
| `screenLate` | ms a frame reached the screen after UIKit expected it (`UIUpdateInfo.estimatedPresentationTime`), when over half a period, as the presentation probe saw it: with UI updates, a recording keeps two transparent one-point Metal layers and, as each update for which a drawable of either is ready (cleared off the main thread) begins its commit, presents that drawable on its own; its `presentedTime` is when the composite holding it reached the screen. The simulator's Metal has no `presentedTime`: there the probe presents and hears nothing |
| `unshown` | a frame whose probe drawable was never shown (a `presentedTime` of 0, as for a frame the render server skipped for a later one), so the frame before stayed on screen in its place; in a total, how many |
| `probed` | in a total, the frames the probe reported, late or not |
| `render` | on iOS and tvOS, what in the window costs the render server work of its own each frame it composites it, read once as the recording stops (`ms`, how long that took), counted as the scroll-feel recorder's render inventory counts it (`host/apple/feel/README.md`, "Render inventories"): `mounted`, the layers neither hidden nor transparent with their ancestors nor masked by an empty mask; `layers`, those whose bounds, clipped by their `masksToBounds` ancestors and the window, are not empty, and `bounds`, those clipped bounds summed in device pixels; `features`, the `[count, pixels]` of those layers with each feature that can need an offscreen pass: `mask`, `group` (group opacity over sublayers), `shadow` (without a `shadowPath`), `corner` (a rounded corner that clips sublayers), `filter` (a filter, or a compositing filter that blends), `rasterize` and `material` (a `UIVisualEffectView`, counted once, its own layers as nothing else); and `private`, the `[count, pixels]` of `backdrop` layers (a `CABackdropLayer`, which UIKit's blur and glass use: it renders what lies behind it first) and `portal` layers (another part of the tree rendered again), Core Animation's private classes, told by name only in a development build and `unavailable` in a production one (LLP 1035.003). `rows` under `columns` place those kinds, and `metal` (a Metal layer, as MapKit's map, which the GPU draws itself), one per `kind`, `place` and `node` (the Exact node's test id, else `#` and its id, else `node` and its number), with the `top` and `height` its layers span and their `count`; a kind more than four nodes have in one place is one row, its `node` how many. A `content` row is in the followed scroller's content coordinates, wherever it lies in the content, so a late frame's `offset` to `offset` plus the viewport's height is what was on screen; a `fixed` row (bars, overlays) is in the window's, inside it. The `fixed` rows come first. A list that builds its rows as they scroll in has only those near the viewport then. The compact copy keeps the counts and the rows that fit after its 12 worst late frames, and `shown` counts them |
| `scrolledPt` | a segment's distance, from where its first interval began; none for the first segment of a scroller taken as it moved |
| `droppedFrames` | frames after the first 36,000 (five minutes at 120 Hz), which a recording does not keep |
| `lateShown`, `shown` | how many late frames (and in the compact copy, scroll segments) the trace reports of all there were. The full report keeps up to 200 late frames in time order, those late the longest by `hitchMs` when there are more; the compact copy lists the ones that fit, those late the longest first, and leaves out the segments at rest |
| `fields`, `presentation` | the field-reference path, and `diagnostic` to identify the unqualified presentation probe readings; both are present in full and compact reports |
| `full` | the whole trace's file in the app's temporary directory and its size, or `not saved` |
