This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.
Run an app from a terminal on macOS
Terminal
bun scripts/exact.mjs list # the apps here, and their commands
bun scripts/exact.mjs run markdown README.md # build and launch, log on this terminal
bun scripts/exact.mjs install markdown # ~/Applications/Markdown.app + `mdview`
mdview README.md # from anywhere, reusing a running copy
bun link (or a symlink into a directory on PATH) makes it plain exact.
Both verbs launch the executable inside <Name>.app, so the process has the
app's bundle identity: its name in the menu bar, its Dock tile, and the
document types Finder's Open With reads. install also writes a shim named by
the manifest's app.command into the first of ~/.local/bin, /usr/local/bin,
~/bin that is already on PATH (EXACT_BIN_DIR overrides), and prints the
line to add when none is. It replaces only this app's own: a bundle with
another bundle identifier, a command it did not write, or a link at either
path is refused, and nothing is changed. exact uninstall leaves them too.
A standalone macOS app treats kill -TERM <pid> as an orderly quit: its
beforeunload handlers can cancel, pending storage gets the same five-second
hold, and each session's native module is destroyed before exit. Repeated SIGTERM
requests share that hold's original deadline. SIGKILL cannot run this cleanup.
app.json's preload maps names to requests of shape { url: string, method?: string, headers?: { [name]: string }, body?: string, timeoutMs?: integer, when?: "start" | "foreground" } (LLP 1162.000 D2).
method defaults to GET, when to "start". URL, header values and body may
reference a kept secret as {secret:NAME}, except in a URL’s scheme or authority;
write {{ for a literal brace. {env:NAME} references a setting declared in the
manifest's env, including in a URL's origin. It must have a build value (a
module's ?? default counts). The bake writes a fixed setting's value into the
request. A setting marked launch: true uses the same process-wide nonempty
launch value as import.meta.env.NAME, falling back to the build's value
(LLP 1153.002 D2). Android keeps the launch part and reads its build fallback;
the web folds it at bake.
A backend selection (EXACT_BACKEND_ORIGIN, --backend or a saved selection)
rewrites the module's origin literal, not its setting. The build refuses a
preload that names a setting at the origin the selection replaces. Filled URLs remain
subject to the binary's grants; invalid filled headers send nothing. The journal
names the filled origin, without the path, query, headers or body.
The bake checks at most eight entries against fetch and secret.keep grants.
Hosts that support preloads send them at process start; the app's own reads take
a preload's reply, and a read made for a tool is sent. A Rust data source may
implement launch() -> Option<exact_runner::request::Launch> and register its
launch function with Launch::new(env!("CARGO_PKG_NAME"), launch). The function
takes &mut dyn LaunchContext and returns nothing. Hand each named LaunchRequest
to context.preload(request): it returns Result<(), String> with a refusal reason,
else starts it immediately (Foreground waits for Opened). when defaults to
Start; the request's timeout_ms is its exchange deadline.
The context offers secret, durable set_secret and forget_secret, and blocking
fetch under the binary's grants, without the cache. secret returns the value
from when the function began, or the value the function last wrote; it does not
observe intervening app writes. A secret write succeeds only if nobody else has
written that secret since the function began or since its own last successful
write. A changed version returns a refusal reason. If set_secret or
forget_secret fails, the function cannot write that secret again during this
launch, and each request it hands over afterwards is refused: what is stored is
then unknown.
The context exposes no app storage.
On hosts that start preloads, it runs before the app's module, after the manifest's
start requests reach the client. Its requests share the eight-entry bound.
A handoff is refused if the app has since written any secret the function read
or wrote, even if the function read its snapshot again. Each accepted request
depends on all those secrets: a later write by either writer cancels it and drops
its reply.
While the function runs, a read waits only if it names a preload with no definition
yet. It proceeds when that name is handed over, the function returns, or five
seconds pass, then uses the ordinary holding rule. Unnamed reads and reads under
an update selection wait only for existing holds. The manifest's definitions may
hold unnamed reads for one second; a missing name waits through the handoff to the
function, or until the manifest's definitions are handed if there is no function.
The function's deadline also aborts its blocking fetch. Requests handed over
before it stand; later handoffs are refused.
A panic cancels the function's requests where the build unwinds (a development
build); a release build aborts on a panic there as anywhere in the crate.
A read may name its preload: fetch(url, { exactPreload: "feed" }), or
Request::get(url).preload("feed")? in Rust. Names must match ^[a-z][a-z0-9-]*$.
The held reply must have the same method and URL; headers and body may differ.
With an update selected, including a plan-only update, only full request equality
can take a preload. Only a name with no definition yet waits while the launch can
still define it; when that wait ends, the read falls back to equality. A name
already defined for another method or URL falls back to equality at once.
Names are unique across the manifest and launch function: a second handover with
the same name is refused and leaves the first definition in place.
A refresh drops both the preload it names at an equal method and URL and any
fully equal hold; under an update selection only equality applies.
On the web the option is accepted and ignored. A TypeScript bundle naming it needs
runtime 13 (LLP 1162.000 D1, D2).
For a read the next screen will make, use fetch(url, { exactPrefetch: true })
or Request::get(url).prefetch() in Rust. On Apple, Linux, Windows and Android hosts,
the option starts a preload only when the app's own read would go to the network
now as an unconditional request and could take its hold; otherwise it is the plain read.
For example, a read waiting for earlier work or launch definitions, one taking a
hold or using an HTTP-cache entry, an only-if-cached miss, and a request with a
body over 64 KiB start none.
A forced ask, reload or no-cache cannot take a hold. A full worker lane alone
does not stop a preload. A skipped preload is never started later.
The caller's fetch and the app's own later equal reads wait for that preload and
take its reply; if it fails, is refused or is dropped, each read is sent itself. The preload uses
the asking source's grants at every redirect and is speculative, so Low Data Mode
may refuse it while the caller's read still runs. Forgetting or aborting the caller
leaves the preload running.
A reply is held for ten seconds after completion, within the cache's byte limits.
A refresh of the same request or a send to its URL drops it. Eight prefetch preloads
fit beside the launch's eight: a ninth evicts the oldest complete one; with eight
in flight it starts no preload. Prefetches have no name; exactPreload keeps its
usual meaning on the caller's read. These native executors hold replies
also when they adopted no launch preloads. The render host, the web and an executor
without an HTTP cache make an ordinary fetch. A tool's, wake's or device's plain read
starts no preload and never waits for or takes a hold. A send, a mutation, a stream,
a file-bodied or an independent request, or native work, refuses the option.
In TypeScript the value must be a boolean.
A TypeScript bundle naming it needs runtime 13; the Rust module seam needs ABI 9
or later (LLP 1162.000 D5).
A one-window Mac app ends when its window closes. An app with work the person
expects to go on without the window (a server, a sync), as Mail and Messages
have, sets "keepRunning": true in app.json's host.macos.window. ⌘W,
File ▸ Close Window and the red button then hide the window without asking
beforeunload, and the app keeps running with its session and native module
alive. A Dock click or open -a shows the window again as it was, and a
document routed to the app shows it too. While the window is hidden,
exactPage().visibilityState is hidden, as for a minimized window, and it
is visible again when the window shows. The close and the reopen are also the
web's back/forward cache: exactPage().persisted is true from the close (a
pagehide with persisted) until the reopen, and exactPage().restores
counts the reopens (each a pageshow with persisted). A minimize, ⌘H, a
covering window or a locked screen changes neither. So an app that opens
something new on a reopen, as a Mac app makes a new window there, keys a task
on the count: task fresh when page.restores > 0 key=page.restores. The app
puts its own window away the same way with hideWindow(), as a menu-bar
utility does once its work is done; bare focus() or the status item's press
shows it again, as a restore. Where the app would end without its window (no
keepRunning and no status item placed), hideWindow() is refused in the
journal and the window stays. ⌘Q quits as before, and the app's own
close() still closes the window and ends the app. A navigate-new app
(launch_handler) already outlives its last window, and the key changes
nothing there. The agent's state.documents.windows[].visible says whether
the window is showing.
A Windows app ends when its window closes too, after beforeunload, unless
"keepRunning": true is in host.windows.window. Its close button, Alt+F4 and the taskbar's
Close window then hide the window, and the session keeps running, its timers, streams and
global shortcuts with it; visibilityState, persisted and restores read
as on the Mac. A Windows app is one process, with keepRunning or without:
launching it again (Start, its taskbar pin, a shortcut) shows the window it
has, and a launch with a location (a jump-list task) shows it and opens the
location there. A bare focus() shows it too, hideWindow() hides it as
the close button does (refused in the journal without keepRunning), and
the app's own close() ends the app. A login item
registered hidden (@exact/login-item) opens no window at that launch:
the app runs, and shows its window when launched again or when it calls
focus(). A -exact-menu="status" button is the app's notification-area
icon (LLP 1133.025 D4). It does not change what closing the window does:
without keepRunning the app still ends, since Windows' guidelines advise
against Close putting a program in the notification area
(notification area).
The icon's menu ends with Exit, which asks beforeunload and ends the app.
A native module whose work must finish before the app exits (a child process
to stop, a socket to flush) overrides willQuit(done:). On every orderly
quit (⌘Q, the app menu, an Apple Event, SIGTERM, the last window closing),
once no beforeunload has kept the app, the host calls it once, on the main
thread (a module first made during the hold, when it is made); start the work off the main thread and call done from any thread
when it has finished. The quit waits for every module's done and for
pending storage, five seconds at most for all of it together, and the window
stays responsive meanwhile; then destroy() runs, whether or not the work
finished. A repeated quit neither asks again nor extends the deadline. Letting
done go uncalled counts as calling it. iOS and tvOS have no quit and never
call it. destroy() runs synchronously on the main thread with no deadline,
so do not wait in it: force-end there whatever the deadline cut short, or a
child process outlives the app.
swift
override func willQuit(done: @escaping () -> Void) {
helper.terminationHandler = { _ in done() }
guard helper.isRunning else { return done() } // a second `done` is ignored
helper.terminate() // SIGTERM; it exits in its own time
}
override func destroy() {
// After the deadline, finished or not: end a helper that ignored SIGTERM.
if helper.isRunning { kill(helper.processIdentifier, SIGKILL) }
}
An app says what it opens with file_handlers in app.json — the W3C Web App
Manifest's own key — and the macOS bake derives CFBundleDocumentTypes from
it. Linux and Windows binaries carry the same declarations into their Open and
Save dialogs; a directory pick remains a directory pick rather than a file-type
filter. Each handler is one file type in the document pickers, labelled with its
name, so an app that wants a "Documents" choice showing only PDFs declares
{ "action": "/", "name": "Documents", "accept": { "application/pdf": [".pdf"] } }
(below, "Documents the person chose"). Each MIME type it accepts must be one the Apple hosts map to
a system type (DOCUMENT_UTIS in scripts/app.mjs; application/octet-stream
is public.data), which the app views (Viewer, rank Alternate), or the
app's own format: a vendor or unregistered type (application/vnd.studio.board+json,
application/x-studio-board+json) with its extensions ([".board"]), which the
bake exports as <app id>.<subtype> (UTExportedTypeDeclarations, conforming to
JSON for +json, XML for +xml, else data) with the app as its Editor and
Owner (studio diary R13). Every build refuses any other type when it reads the
manifest, the web's included. An extension another app already owns on a Mac
(Freeform has .board) can still resolve to that app's type there; the open
panels and drops take a declared extension whichever type the Mac gives it.
For URL schemes, protocol_handlers in app.json uses the Web App Manifest's
{ "protocol": "web+notes", "url": "/open?u=%s" } entries. A native Apple
bundle registers each declared scheme, and an Android APK each custom one (a
browsable VIEW intent filter on its singleTask activity, so a link from
another app reaches the running app). %s is the complete incoming URL
encoded as a URI component, so the scheme, query, and fragment survive;
searchParam(top(nav), "u") recovers it in the /open route. A cold link is
the launch location; warm links arrive one at a time at the navigation root's
navigate handler. The app must declare that root and an accepting route.
The web manifest carries the same entries; browser registration is subject to
the browser's supported schemes and installation behavior. Linux's CLI URL
argument retains the ordinary location conversion because it does not
register OS protocol handlers.
A scheme in host.ios.urlSchemes, host.macos.urlSchemes or host.android.urlSchemes
alone delivers its link as a location, cold as the launch location and warm
as one navigation, with no /open route. A non-empty authority is the first
segment and an empty one is none: notes://post/42?x=1,
notes:///post/42?x=1 and notes:/post/42?x=1 are all /post/42?x=1, the
fragment kept (LLP 1038 §3). Expo's Linking.createURL("/post/42") writes
the three-slash form. Android matches the declared spelling and its lowercase form,
and refuses a scheme declared in both urlSchemes and protocol_handlers.
For packaged-only Apple registration, add "distribution_only": true to an
entry, for example {"protocol":"notes","url":"/open?u=%s","distribution_only":true}.
Archives and --distribution builds include it; local builds, including
--bundle and --release alone, omit it from both the registered schemes and
native handler templates. On Android, a production build (--bundle, or
EXACT_UPDATE_TRUST=production) includes it and a development build omits it.
The default is false. This option does not filter
the web manifest or explicit host.<platform>.urlSchemes.
http and https are the web's own schemes. An app declares both or
neither: each once, with the same url and the same distribution_only.
readManifest refuses any other form, so every build does, and
all three hosts refuse both in urlSchemes. The pair makes
the app a web browser:
host | what the pair does |
|---|---|
macOS | a second URL type, Web site URL, role Viewer, and a Web page document type (public.html, public.xhtml; Viewer, rank Alternate), without which macOS lists no browser. The person chooses the app in System Settings › Desktop & Dock › Default web browser; the app never asks to become the default. A link arrives at the template. An HTML file that Finder opens in the app arrives there too, as its file: URL (/open?u=file%3A%2F%2F%2F…), unless the app's own file_handlers accept it. The web-page type is not offered by the app's pickers and does not widen what drop accepts. |
iOS | With host.ios.webBrowser: true, registers the pair and signs Apple's managed com.apple.developer.web-browser entitlement. Apple must approve it for the app's ID; the selected provisioning profile must grant it. Without the opt-in, registers neither and says so. App Clips, widget extensions and the sample host never inherit the browser role. |
tvOS | Registers neither, regardless of the iOS opt-in. |
web | dropped from manifest.json: HTML's protocol handler safelist has neither. |
Linux, Windows | not registered, as no protocol handler is there. |
Android | not registered: an APK registers custom schemes only. |
With "distribution_only": true on both entries, only an archive or a
--distribution build is a browser. A local Mac or opted-in iOS build then registers neither
scheme, writes no Web page type, and does not join this Mac's browser list.
Verified https links (LLP 1038 D8). Whether the app's web addresses open
the installed app is one declaration in Web App Manifest vocabulary:
json
"app": { "origin": "https://notes.example" },
"start_url": "/notes/", "scope": "/notes/", "handle_links": "preferred",
"scope_extensions": [{ "type": "origin", "origin": "https://share.example" }]
handle_links: "preferred" claims app.origin narrowed to scope (absent:
start_url's directory, / for most apps) and each scope_extensions origin
whole. "auto" (what an absent member means) and "not-preferred" claim
nothing natively. These navigation claims exclude Exact's own paths under
/.exact/ and HTTPS auth callbacks. Android registers a separate exact-path
App Link for a native auth.callback, so a browser without Auth Tab can return
to the app. The web popup's /.exact/auth/callback stays in the browser.
A link that opens the app arrives as any incoming URL does: its path is the
launch location, or one navigate event while the app runs.
host | what "preferred" does |
|---|---|
iOS, iPadOS | signs applinks:<host> for each claimed origin beside host.ios.associatedDomains, and an App Clip's appclips: for each concrete one |
macOS | the same entries, signed through the Mac's provisioning profile; a build whose profile cannot sign associated domains says links open in the browser |
Android | one autoVerify https filter per claimed host on the app's activity, pathPrefix the scope; from Android 15 uri-relative-filter-groups leave the excluded paths to the browser (under a scope other than /, only with host.android.minimumOS "15"), and where they cannot, the build of an app that signs in names the excluded paths that open the app |
web | manifest.json copies the three members as written |
tvOS, watchOS, Windows, Linux | nothing; the build says so in one line |
The web build (either target) writes app.origin's files into the build:
/.well-known/apple-app-site-association, whose applinks components
exclude /.exact/* and each callback path before <scope>*, and
/.well-known/assetlinks.json with a delegate_permission/common.handle_all_urls
statement beside any passkeys' get_login_creds. A JavaScript build without a
bake writes webcredentials for an HTTPS auth callback on app.origin, but no
passkey get_login_creds. A production JavaScript build that copies a bake keeps
the bake's credential entries. The files need host.ios.team and host.android.certificates;
the build line names a missing one. For every other origin a claim names, the
build prints the files it must serve, including each extension origin's
/.well-known/web-app-origin-association, keyed by the manifest's processed
id. The files name the base app, never a variant. Serve each from the path
itself over HTTPS as application/json, with no redirect.
host.ios.associatedDomains is the raw Apple list, for what has no web name:
webcredentials:, appclips:, a wildcard applinks:*.example.com, an
applinks: host outside the claims. An entry that covers a claimed host is
refused, as is "not-preferred" beside any raw applinks:. Matching is the
platforms': Android matches the decoded path and any port, Apple and the web
the encoded path. Verification itself needs the live domain; without one,
adb shell pm set-app-links --package <id> 1 <host> marks a host verified on
an emulator.
A file chosen in the app's own picker (showOpenFilePicker,
showSaveFilePicker) joins File ▸ Open Recent — a save once it is written —
and becomes the window's document, as a routed one does. A path from the command line, from Finder, from ⌘O, or from a link inside
a document all arrive at the same place: the app's open-file node
(LLP 1033 D3). In a Mac browser, an HTML file from the command line or Finder
that file_handlers do not accept is a link instead, at the https template. One handed over at launch arrives before first pixel, before
app storage is ready and before a TypeScript data module has loaded: a send its
change makes waits for both and then runs, pending meanwhile, rather than being
refused (studio diary R14; notes diary). When nothing takes the path, the
host says why — no open-file field, or the change the app refused, and the
refusal — on stderr and in the journal. exact uninstall <app> takes both halves away.
On Windows, pass local files to the executable to open them in the app's
window. A cold launch and a later launch both deliver a change to the one
mounted field with testId="open-file" and a change handler, once per file
in argument order. Relative filenames resolve in the launching process's
working directory. An app that reads filenames in its Rust startup code can
move that logic into the handler to receive cold and warm opens once each.
Widget entries are top-level app.json widgets rows. For example:
json
{"kind":"next-trains","families":["systemSmall","systemMedium","accessoryRectangular"],
"component":"NextTrains","props":"NextTrainsProps","refresh":"nextTrains",
"preview":{"station":"Mountain View","departures":[]}}
Optional title and description strings supply the widget gallery's labels;
each defaults to the humanised kind when omitted.
On Android 12 and later a row with a system* family is a home-screen widget
(LLP 1126.003): systemSmall is two cells square, systemMedium four by two,
systemLarge, systemExtraLarge and systemExtraLargePortrait four square, and it resizes from there. The
same component is laid out at the launcher's size in the system's colours, and
the same refresh keeps its timeline. Accessory families have no Android
counterpart. What the launcher's views cannot draw yet (a gradient, a rounded or
styled border, clip-path, an image, letter spacing) fails
the widget's render, which then shows its last good entry. A tap follows the
entry's link (one at the root takes the whole widget), else opens the app, and
the app asks its widgets to refresh whenever it leaves the foreground.
On iOS and macOS, an optional configuration lets the person choose in Edit Widget
(LLP 1126; LLP 1133.023). The
entry becomes WidgetKit's
AppIntentConfiguration,
its WidgetConfigurationIntent
generated with one parameter per row, and the build extracts the extension's
App Intents metadata, through which the sheet shows them:
json
"configuration": {"title":"Next trains","description":"Choose how many departures.",
"parameters":[{"name":"rows","type":"enum","title":"Rows","default":"automatic",
"values":[{"value":"automatic","title":"Automatic"},{"value":"one","title":"1"},{"value":"three","title":"3"}]}]}
On Android the same enum parameters are the widget's settings, one list of choices
each: a placed widget starts with the defaults, and the launcher's long-press
menu opens the settings. A choice there changes that widget's render alone:
Android keeps one timeline for a kind, and its refresh receives each parameter's
default (LLP 1126.003 D5).
On watchOS, the complication picker offers
recommendations
instead of a parameter form. Exact generates one per combination of declared
values, with the default combination first and parameter/value titles as labels.
Repeated value titles include their identifiers. If complete labels still collide,
each label also includes the choices' UTF-8 hex identifiers to distinguish them. A widget
with watch families may declare at most 64 combinations (the product of its
parameter value counts); the bake refuses more and asks for fewer values or
parameters. This Exact bound keeps the watch picker and generated bundle small.
Entity parameters, below, take no part: only enum values combine and count.
title and description (defaulting to the title) are the intent's; the sheet itself
is headed by the widget's own title and description, as on iOS 27. Each
parameter's name is a lowerCamelCase field name, its title the row's label and
its type: "enum" a fixed list, and its values the menu, in order: value is what the render reads, title what the
menu shows. default is one of the values, the first when omitted; it is the choice
before the person makes one, and the gallery's. A component reads the chosen values
as it reads the family's size, through the reserved inject snapshot_configuration:
text
shape Rows
rows: enum<"automatic", "one", "three">
component NextTrains
inject
snapshot_viewport: Viewport
snapshot_configuration: Rows
The shape has one field per parameter, typed string or an enum of exactly its
values; every injecting component names one shape. A configuration that no component
reads, or an inject without one, fails the bake with an edit.
A parameter of type: "entity" offers the app's own content in place of a fixed
list (LLP 1126; LLP 1133.023 D2):
json
"intents": {"entities": {"book": {"title": "Book"}}},
"widgets": [{"kind": "library", "configuration": {"title": "Your Shelf",
"parameters": [{"name": "book", "type": "entity", "title": "Book", "entity": "book"}]}}]
entity names a key of intents.entities, whose title names the type in the
sheet. The row takes no values and no default. Its choices are the entries of
that kind that the app last published with setContentIndex
(@exact/search-index): Edit Widget lists each entry's title, with its
description beneath, in the app's order, and searches both. No app code runs
when the sheet opens, so the list is as fresh as the app's last publication.
Publish again when the content changes, and publish an empty list when the
person signs out. The entries are in the system's search too, as every
content-index entry is.
In the shape the field is option<string>: none until the person chooses, then
the entry's id. The refresh receives the same field (string | null in
TypeScript) and decides what to show for none and for an id it does not know.
Exact keeps a saved id when the published list no longer has it, so a list
cleared at sign-out does not turn a chosen widget into an unchosen one.
Edit Widget on iOS and macOS offers the entries. watchOS and Android offer none:
the field is none there, and a widget whose parameters are all entities has no
choices on those hosts.
A configured widget's refresh receives the configuration too, as its second
argument: a record with one field per parameter, in the order the injected shape
declares them, each one of that parameter's values or, for an entity parameter,
the chosen id or none. In TypeScript it is
nextTrains: ([date, { rows }]) => …. On iOS, macOS and watchOS the refresh runs
for each configuration a person has placed, with that placement's values, so it
can fetch different data for each. The timeline it returns serves that
configuration's placements in every family, and each render still reads its own
values. On Android the argument is the defaults, as above, so a render there must
not rely on the refresh having read its choice.
The configuration, labels included, is generated Swift and so a binary
compatibility input; Live Activities have none. Keep kind, parameter and value
identifiers stable across updates; changing a title does not change a choice.
A removed or renamed parameter is ignored, and a missing or removed value uses
that parameter's current default. Other valid choices are retained. Reordering
entries, parameters or values does not reassign a saved choice. The refresh
receives a saved choice by the same rules. Not supported: choices computed when
Edit Widget opens, entities that are not content-index entries, an image for an
entry, and a parameter whose choices depend on another's.
component and the props shape are declared or imported by app.contract;
every component prop must match a field of that shape. preview supplies all
fields, with their declared types. refresh names a data-source function taking
an epoch-millisecond number and, for a widget with a configuration, that
configuration's record, and returning a timeline: records with date (epoch
milliseconds) and props (the declared shape), in that field order. Widgets that
name one refresh share its signature, so they declare the same configuration
and props; the bake refuses a difference. The plan's
snapshot_refresh header selects its typed source row; the render has no resource
for it. A data bake checks an immediate refresh answer against that signature at epoch
zero with the configuration's defaults; pending answers are checked by the source declarations. TypeScript checks
the generated Sources type, including async refreshes. Compile entries once
with contract::snapshot::entries(app), then pass that map to source_plan,
check_refreshes and receipt generation. snapshot::bake_app takes separate
data instances for the app and refresh, so refresh state cannot affect the app
first frame. The TypeScript and replaceable Rust producers use the same check.
On iOS, a TypeScript refresh runs under Hermes from the module bytes in the
app's pinned App Group generation (or the extension's embedded cohort before
the app first publishes it). The receipt admits both the entry plan and bytecode.
It can return immediately or await fetch
and storage.fs reads from app:/. File writes, SQLite, document handles and
native modules are unavailable in stage 1; secret.keep values are read from
the shared Keychain only during refresh. Because SQLite is unavailable in a
refresh, apps backed by SQLite should mirror widget-needed fields into a small
JSON file under app:/data/ with storage.fs.atomicWriteFile alongside
mutations so the refresh reads it directly. The extension never persists store
writes. The app reloads widget timelines after a successful write readable by a refresh, once the store has been quiet for half a second, so a burst of writes asks once.
Successful refreshes return a WidgetKit timeline with reload policy
.after(max(now + 15 min, lastEntry + 1 s)). Widget views take literal colors
only (not runtime-computed color bindings).
Refresh has a 900 ms deadline starting when it begins, including boot. Each JS
turn gets the time remaining to that deadline, rather than the app's 100 ms
per-call budget. This leaves 100 ms below LLP 1126 D8's one-second
line for completion and teardown. A store write during a refresh restarts it under
the new store while the deadline allows. Failure or timeout uses the last good timeline
cached in the App Group for this kind, generation and configuration, only while the app's store
has not changed since it was cached (a store write, such as an account switch,
expires it), or else an “Open app” placeholder,
and schedules a retry no sooner than 15 minutes later. A kind keeps the last good
timelines of the eight configurations refreshed most recently. Rendering and gallery
previews do not load Hermes or read the store.
Live Activity entries are top-level live_activities rows, each with a kind
(LLP 1126 D9). The packaging reads two flags: push: true for an activity the
app's own server advances, which signs aps-environment into the app (never
the extension, which reads no token), and frequent: true for one that needs
the frequent-update budget (NSSupportsLiveActivitiesFrequentUpdates). An
entry of either kind, a widget or an activity, gives the iOS build its WidgetKit
extension, the shared ExactCore framework, the App Group and the Keychain
group; an activity entry alone adds NSSupportsLiveActivities to the app's
Info.plist (a widget-only app has no such key). An app with activities alone
ships the extension with an empty widget bundle until its activity
configuration lands (LLP 1126.001 WP10). The entry's root, state shape and
preview are stage 2's bake (WP8).
A device build of an app with entries embeds two profiles, the app's and the
extension's (<id>.widgets), of one team, App ID prefix and distribution
method (development, Ad Hoc, enterprise or App Store), each granting the App
Group group.<id> and the Keychain group <prefix>.<id> (Keychain Sharing;
the team wildcard <prefix>.* grants it), the app's also aps-environment
(development on a development profile, production on the others) when an
activity takes pushes. A team wildcard profile grants no App Group, so each is
a profile for its exact App ID; build.mjs --device refuses before building
anything, naming for each App ID the profile that was close and the condition
it failed (expired, not this phone, another team or prefix, the other method),
and the capabilities to register and profiles to install. EXACT_PROFILE names
the app's, under the same conditions; the extension's is found among the
installed profiles by its id. An archive (--archive) matches the extension's
profile to the named one's method, and an Ad Hoc pair must cover the same
devices.
On macOS, bun host/apple/build.mjs --run packages the app's widgets in
Contents/PlugIns. The Mac keeps systemSmall, systemMedium, systemLarge,
systemExtraLarge and systemExtraLargePortrait; if no families remain it builds no extension. Live
Activities do not create a Mac extension. The extension uses the same runtime
framework and snapshot driver, in its own sandbox with outbound network access.
The app keeps its existing sandbox policy and loads the reload arm on demand.
Development Mac widgets need an Apple Development identity (EXACT_IDENTITY
can name its SHA-1 or full certificate name). Without one, the build prints a
notice and builds the ordinary app ad hoc, with no extension; agent drives,
smokes and metrics remain available. Selecting a Developer ID identity for a
development build takes the same ad hoc path. Distribution widgets use the
Developer ID Application identity selected for release.
Their container is <TEAMID>.<app id>.widgets, separate from iOS's group.
Shared secrets additionally need matching macOS profiles for the app and
<app id>.widgets, granting that container (or <TEAMID>.*) and the restricted
Keychain group <prefix>.<app id> (or <prefix>.*). EXACT_PROFILE can name
the app's profile; an iOS profile is ignored with a notice. Both are embedded
when available. Without them, entries marked "requiresSecrets": true show
the “Open app” placeholder;
set this on each refresh that reads account data, leaving public entries false.
Those entries neither read the app's login Keychain nor reuse cached account content.
The first provisioned app launch moves its login-Keychain items to the shared
data-protection Keychain, deleting each old item only after the copy succeeds.
The move is one-way: an unprovisioned build cannot read the moved items.
Unreadable items remain for the next launch; a migration error leaves I/O bound.
Caltrain and Shelf need no shared secrets. See LLP 1126.001 WP16 and §5 Q5.
The render's props slot is named snapshot_props; find it by name, since a
path(...) link also needs a router slot. Its initial value is the preview; reached bindings cannot use that reserved name.
The bake writes plans/<kind>.plan beside app.plan. The asset index's plans
map indexes these authenticated assets in the app's compatibility cohort.
Kinds, families and gallery labels are binary compatibility inputs; views and preview props
are plan contents. A running host refuses a snapshot plan at decode, and a
snapshot reader requires its exact kind. A widget also requires a refresh
signature; an activity has named placements and no refresh source.
Live Activities are top-level app.json live_activities rows:
json
{"kind":"departure","component":"DepartureActivity","state":"DepartureState",
"preview":{"station":"Mountain View","at":1787915700000},"push":true}
The root's props match every field of state. Optional title and description
follow the widget label rule; push and frequent are Booleans, defaulting to
false. Kinds are unique across both entry lists, ignoring case. Unknown keys fail
the bake with an edit. Capability flags and labels require a new binary; state
shapes, previews and views ride the bundle.
On Android an activity is an ongoing notification that asks to be promoted to a
Live Update:
at the top of the shade and on the lock screen, with a chip in the status bar.
Android allows no custom view there, so the placements are not drawn; a row's
android object names the state fields the system's template shows, and only a
row with one is shown (Android refuses the sends of the others):
json
"android":{"channel":"patrol","title":"headline","text":"detail","chip":"short","when":"at","progress":"done"}
title (required) names a string field. text and chip name string or
option<string> fields; chip is the chip's text (setShortCriticalText),
which Android shows whole only under seven characters, and which takes the chip
from the time. when names a number (or option<number>) field of Unix
milliseconds, the notification's time: one at least two minutes ahead when it is
posted, the chip counts down to ("5min"); one already past, the notification
counts up from as a chronometer, in the chip too. progress names a number (or
option<number>) field from 0 to 1, as HTML's progress without max: Android
16's ProgressStyle, a plain progress bar before it. An option that is none
shows nothing. Each send's state must have the mapped fields with those types,
or it is refused; the rest of it stays in the app's private storage, not in the
notification, which other apps with notification access can read. channel is a channel
host.android.notificationChannels declares, not of importance min, or
default when absent. The bake refuses a field the shape lacks or of another
type, an undeclared or min channel, and a mapping in an app that does not grant
device.notifications. A mapping adds POST_PROMOTED_NOTIFICATIONS (a normal
permission) to the manifest.
Starting one needs the notification permission, which the app asks for first
(requestNotificationPermission(), Notifications); without it, or on a
channel the person turned off, startActivity is refused. The system promotes
the notification where it supports Live Updates and the person allows them for
the app; otherwise it stays an ordinary ongoing notification. Each activity in
exactActivities() says which with promoted: bool, the system's
FLAG_PROMOTED_ONGOING (false on iOS); openURL("app-settings:") opens the app's
Settings page, where the person allows them. The activity's id is its notification's
tag, so a relaunched process lists it again. If the person dismisses it (Android
14 and later let them swipe away an ongoing notification the system has not
promoted), it leaves the list when the app is next in front, and a later send to
it is refused. A send is answered once the system shows its notification.
Several activities stay separate notifications where Android would bundle an
app's notifications into one whose collapsed rows show only titles: each is a
notification group of its own (LLP 1126 D13). Android 16 still bundles six or
more activities it has not promoted, and those left stay in that bundle; a
manufacturer's shade may group differently.
An updateActivity with an alert alerts again, with its text as the
accessibility ticker; a stale date is listed as stale once past.
endActivity with "immediate" removes the notification; "default" leaves an
ordinary, dismissable one for four hours, and Unix milliseconds until then.
Declare the placements in that one component's view with view slot="lockScreen",
view slot="compactLeading", view slot="compactTrailing", view slot="minimal"
and view slot="expanded". Under expanded, declare four view children with
slot="leading", slot="trailing", slot="center" and slot="bottom". Each slot
is required once. Put its layout attributes and content on that slot's view;
expanded only groups its regions. See apps/caltrain/activities.contract.
The activity plan has one snapshot_state slot and an activity_slots table
mapping each placement name to a node site under a synthetic container. One
session serves the activity. For each slot, the driver sets the session's viewport
to the region's proposed content size, lays out, takes that slot's subtree and
measures its fit_content_height. snapshot_viewport thus reads the current
region's size; no app-visible slot selector is injected. The other slots' frames
are not a shared surface layout. Rendering remains read-only, with the same
clock, request, input and handler refusals as widgets. time and progress
remain platform live views.
A development build with --widget-gallery also answers activity addresses:
bun scripts/agent.mjs ios activity departure --placement expanded --state '<json>' tree "screenshot activity.png" state.
The same command works on macos. Placements are lockScreen, compactLeading,
compactTrailing, minimal and expanded (all four expanded regions together).
Omit --state to use the entry's preview; --scheme light|dark selects its scheme.
clock advances the app's agent clock and the next read renders at that time.
These are gallery renders; the async simulator test checks the system's archive.
The extension renders every activity through one ActivityConfiguration for
the envelope type (host/apple/widget/Activity.swift, LLP 1126.001 WP10), a
thin adapter over ExactSnapshot's ActivityResolver: the attributes' kind
names the plan, plans/<kind>.plan in the generation the attributes name,
which is the one published under that name in the installed cohort or the
bundle's embedded plans when their identity (ExactWidgetGeneration) makes
that generation; any other generation is refused, the activity shows "Open
<app>" until the app publishes again, and nothing is rendered in its place.
The state is the envelope's when its shape digest is the registry's and the
plan decodes it (then kept as the activity's last good state), else the last
decodable state kept for the activity id (shown dimmed, the driver's outdated
presentation; the system's isStale is the system's own), else the preview,
redacted as a placeholder. A render is keyed by the activity, its generation,
the state's bytes and every fact the session reads (the text size, Bold Text,
contrast, transparency, the scheme, the display scale, the locale and time
zone); the eight placements of one push share it. A placement's view answers
the system's size proposals from the kernel (ActivityRender): the bake
positions each placement's root absolutely at its region's top left, so in
the region's viewport CSS 2.1 §10.3.7 gives a width: auto root the
shrink-to-fit width (an authored width or min-width is kept, past the
region too; a percentage resolves against the region; margin: auto is
nothing; flex-basis does not apply, the root being no flex item), and the
Lock Screen and expanded bottom roots, which the system sizes, take the
region through right: 0. That one layout is measured and drawn: the region
reports the root's margin box, a paragraph the region wrapped settles to its
widest ink line, a content the region cannot hold is cut at the region, and
each view draws the layout its size was measured from, whatever region's
proposal last laid the session out. The Lock Screen placement sits inside the
system's content margins or, where the system gives none, the standard
layout margin for Live Activities on the Lock Screen, 14 points (Human
Interface Guidelines, Live Activities: "The standard layout margin for Live
Activities on the Lock Screen is 14 points"); its root's background-color
is the activityBackgroundTint, its background-image's gradient layers
paint full bleed behind the margins over that tint, and both unsaid leave the
system's material. A Live Activity's content is account content as a
widget's is (D8): private on a locked phone but for a node that says
data-privacy="public", which Caltrain's placements do, a train's departure
being nobody's account. A link in the Lock Screen or an expanded region is a
Link; the first link of any placement is its URL. The development gallery
shows the eight placements with the Island's geometry of one device (the
iPhone 17 Pro's, IslandGeometry), its expanded regions allocated together
as ActivityKit arranges them.
The sends that start, update and end an activity are LLP 1126.001 WP9.
The bake writes plans/activities.json and activities/<kind>.schema.json plus
activities/<kind>.d.ts (exporting State, Attributes and ContentState). The
state uses JSON Schema 2020-12 with required fields and no additional properties.
The shape digest hashes its canonical schema, including each record's field
order. The universal envelope's attributes are {kind, generation, shape};
its content state is {shape, state}, where state is a JSON value, not an
encoded JSON string. generation names the immutable publication digest. The
preview and sends share a conservative 4096-byte JSON budget, including both
shape digests. Numbers reserve the longer of serde_json's and Foundation's
shortest Double spellings, capped at 24 bytes; the bake also covers a preview's
original integer spelling before Double decoding. Both reserve two bytes for
\b, \t, \n, \f, \r and slashes, and six for the other U+0000–U+001F
characters and U+2028/U+2029. Other characters and JSON punctuation use their
compact UTF-8 size. A refusal reports the budgeted bytes and asks for shorter
state. Shared Rust/Swift fixtures pin encoder spellings, escape counts, admission
of a 60-point route and 150 small integers, and refusal at 4097 bytes.
An activity pins its named generation within the installed compatibility cohort,
even after current moves. Publications currently keep every generation. The
cache has one file per activity id. The caller supplies the pinned plan's decoder:
a state it cannot decode falls back to its last decodable state with the driver's
outdated flag. Without a decodable kept state the placeholder has no outdated
flag. A failed write returns an error to the caller. ActivityKit's isStale is a separate system
fact. Rendering across a compatibility-changing binary update remains subject
to LLP 1126.001 §5 Q6's pending ruling.
bun host/apple/build.mjs --watchos --no-install builds a watch simulator
companion inside the iOS bundle. --watchos --run --sim <iPhone udid> --watch-sim <watch udid> installs it on an existing, booted pair and opens it.
A device build of the iPhone app (--device, --archive, --unsigned) embeds
the watch app in its Watch/ folder, built for arm64 from watchOS 26: it runs
on Series 9 and later and Ultra 2 and later (LLP 1126.002 D7).
In development, install the watch app directly with
xcrun devicectl device install app --device <watch-udid> <watch-app-path>,
using the watch app bundle inside the iPhone app's Watch/ folder.
Installing the iPhone app may not install its watch companion.
--extensions without watch leaves it out. Signed, the watch app and its
complications each embed a profile of the iPhone app's team, App ID prefix and
method, for <id>.watchkitapp and <id>.watchkitapp.widgets, each granting the
App Group group.<id>.watchkitapp; the build names any that is missing.
An app whose app.json declares a watch entry ({"source", "component"}:
its own Contract file and root component, LLP 1126.002 D4) runs that entry live
on the watch; the bake refuses what the watch does not draw. An app with none
opens its complications' placeholders. Add a complication through the watch
face's editor.
The watch extension keeps the accessory families (accessoryCircular,
accessoryRectangular, accessoryInline, accessoryCorner); iOS drops
accessoryCorner. An optional watchFamilies on an entry overrides its watchOS
families; families still names its iOS families. An app with app.ts builds its
live watch entry when that plan reaches only Rust, runner-owned or native
module sources. The watch bake refuses a TypeScript dependency by name until
the watch Hermes gate passes (LLP 1126.001 §5 Q3); a mixed bake declares its
Rust ownership through build_mixed_with's source list. Such an app's complications are still omitted
with a message, including its Rust refreshes. Rust-only apps' complications
refresh against the watch's own App Group and store.
Select phone-owned values explicitly in watch.sync:
json
"watch": {
"source": "watch.contract", "component": "Watch",
"sync": { "state": ["liked"], "secrets": ["totp.entries"] }
}
State names must be root persist states with matching types in both entries.
Watch actions cannot assign them. Secrets require ordinary secret.keep grants;
presence policies, including optional ones, are refused. Watch data sources and complication processes cannot
write selected secrets or persisted states. Files, databases and kept resource answers do not transfer.
Changing the selection, or a selected state's type, requires a new binary. The watch rechecks a retained context
when its selection grows or shrinks, even at an already accepted revision. Removing a selection deletes only
previously imported names after accepting a snapshot under the new selection.
Removing the entire selection retires its state replicas the next time the watch app or
a complication runs, and its secrets the next time the watch app runs, even if the app no
longer uses storage or WatchConnectivity. Only the app reaches their Keychain group by then.
Open the watch app once to create its device-local Keychain key and send its
public key to the phone. The phone uses CryptoKit HPKE to seal the secrets before
placing them in WatchConnectivity's retained application context. State stays
plaintext; secret plaintext never enters that context. The watch imports secrets
into its Keychain with AfterFirstUnlockThisDeviceOnly accessibility. Reinstalling
the watch app generates a new key; a replacement pairing needs the new watch to
run and announce its key. Old encrypted contexts cannot initialize that watch.
The phone sends a complete snapshot at first pixel, after each durable change
(a session's write, or a launch function's set_secret or forget_secret) and
when a watch announces its key. Apple schedules delivery, so submission is not
acknowledgement and intermediate values may be skipped. A send WatchConnectivity
refuses is tried again while the app runs, after 1 s and then at doubling waits
up to 32 s, and at each foreground. A snapshot whose application context would
exceed 60,000 bytes is not sent: the session log says so once, the watch keeps
its last copy, and the next change that fits is sent. A snapshot's revision is
spent only when WatchConnectivity takes it.
At launch the watch opens readers on its last applied store without waiting for
WatchConnectivity activation, so stored state and secrets are available offline
at once. With no stored copy, readers see the app's initial state. When activation
completes, the watch imports the retained context and refreshes the live session;
a context for an old key or schema leaves the last applied store unchanged.
An unfinished import keeps new readers closed. The watch app tries a failed
import again while it is active, at the same waits, at each foreground and at
each later delivery, without restarting. A phone edit, deletion or logout
reaches it only after delivery and successful import.
A watch already holding a TOTP seed can keep generating codes until that seed is
replaced at the service; local logout does not revoke that copy remotely.
Imports and replica retirement invalidate cached complication timelines and request
a reload. A complication's refresh waits up to 100 ms for an import that overlaps
its store read. If the import is still unfinished the refresh is refused without
asking its source, and the import's end reloads the timeline. An app that selects nothing links
no WatchConnectivity session or replication crypto path.
See Apple's application context
and HPKE documentation.
For accessoryInline, emit exactly one text or time leaf plus at most one
optional image. Only that leaf and image survive the inline archive; a
container's background and layout do not. The bake evaluates the preview at
225 × 26, 168 × 11.5 and 13.5 × 13.5 pt; at runtime the driver checks the actual
size and props.
A violation refuses the bake with an edit, or logs the entry name and renders
“Open <app>” at runtime, including in the gallery (LLP 1126 D4). See
Apple's inline family.
The snapshot columns on the style and prop rows declare admission. Unsupported
rows, scrolling, sticky positioning, timers, requests, native modules and handlers
fail with an edit. The author declares no resource; the bake synthesizes the
exactViewport resource for the size inject. The one fact a render reads
is the family's size, through the reserved inject snapshot_viewport: write
inject with snapshot_viewport: <shape> on the entry's component (or one it
uses; every injecting component names one shape), and the entry's plan
declares exactViewport() for it and provides it. width and height are the
family's content size in points, inside the system margins, given at boot and
again when the family's size changes; the preference fields are a still page's.
Choose a layout by them as docs/recipes/responsive-columns.md does for a page
(a Lock Screen row is under 100 pt tall; a medium widget is over 250 wide), so
one entry serves every family it declares. The app's own plan is untouched: an
unused component's inject is not demanded by the app's view. A configured widget's
second fact is its configuration, the snapshot_configuration inject above. A performanceNow() call is refused everywhere, including
inside time and progress; pass instants from refresh for platform time
presentation. A variable's name imposes no restriction. A class is a style name
or class=(condition ? A : B). An entry uses only installed or generic font
families, such as system-ui: the system draws a widget or Live Activity in its
own process, which has none of the app's fonts, so the bake refuses a bundled
font the entry reaches (snapshot-font-bundled).
Images use a bundle-relative path, an app:/ path written by the app, or a
symbol: source. Computed paths need a fixed local prefix; refresh downloads
remote images. A live time (relative, timer, countdown) must own its
text paragraph, so the widget can reserve its width; calendar formats may be
inline. Links must be their own elements, not runs among other paragraph text.
Snapshot handlers are refused; use a link to open the app.
On Apple platforms a widget's first rendered root gives the widget its container
background: the root's background-color and gradient layers paint edge to
edge, behind the system's content margins, through SwiftUI's
containerBackground(for: .widget) (LLP 1126 D5). The system removes that
background where it shows widgets without one, such as StandBy and the Lock
Screen. With no background on the root, the widget takes the system's. A
background on a nested box paints that box alone, inside the margins: put it on
the root when it should fill the widget. A Live Activity's Lock Screen root
likewise gives the activity its activityBackgroundTint (above).
Snapshot accessibility admits labels, roles, hints, heading levels and hidden
content. Live announcements and control-state accessibility rows are refused.
Snapshot paint uses document order and the system colour scheme. Use a condition
or display: none to hide content; visibility and z-index are refused.
Borders have one width, colour and solid, dashed, dotted or none style on all sides.
Radii are px or percentages; percentages on non-square boxes produce ellipses.
Radius calculations are refused. Overflow is the same on both axes: visible,
hidden or clip. Raster images author both width and height, and object-fit is
fill, contain, cover or scale-down. An entry declaring
any small or accessory family has at most one link; entries declaring only
medium, large and extra large families may have several.
Text aligns start, center or end; use line-clamp for truncation. Give an inline
highlight its own box. Colours are sRGB, system roles or named assets; wide-gamut
and profiled colours are refused. Gradients are nonrepeating linear or radial,
interpolated in sRGB or srgb-linear, with strictly increasing stops. Stop order
must hold at every box size; use a single unit when mixed units could cross.
Restricted paint values are literals or choices of literals, so their admission
is checked at bake.
App icons come from app.json's Web App Manifest icons array, and in a dark
scheme from color_scheme_dark.icons, which replaces it there (LLP 1163). Each
host picks by purpose, then shape and size, and refuses a file smaller than
its slot. iOS and macOS take the smallest square maskable, else any, PNG of
at least 1024 px; iOS, watchOS and tvOS pass over one with transparent pixels,
and refuse it when no opaque file fits. iOS's dark icon is picked the same way
from color_scheme_dark.icons, and its tinted icon is a square monochrome
PNG, whose alpha iOS draws white on black. The web links each scheme's favicons
(the smallest square raster of at least 32 px, then an SVG when there is one)
and an Apple touch icon (the smallest opaque square PNG of at least 180 px, else
the largest). Android centres a square maskable PNG of at least 432 px at 82.5 dp on
a 108 dp layer. For fully opaque artwork, a low-resolution copy extends the local edge
colours into the margin. If any pixel has transparency, the background uses the light
launch colour, or the top-left pixel’s RGB when none is named. A square monochrome supplies the themed layer,
a square any of at least 192 px the legacy fallback, and a 16:9 any of at least
640×360 px the TV banner. tvOS takes the brand assets in the app's catalogs, else a 5:3 any of
at least 1280×768 px (an 8:3 and a 29:9 one give the Top Shelf images); the
watch app a square one of 1024 px, or host.ios.icon when its icon.json lists
watchOS; Windows takes for each frame size (16, 20, 24, 32, 40, 48, 64 and 256 px)
the smallest square any, else maskable, PNG of at least that size (requiring a
qualifying PNG of 256 px or larger), linked into the executable.
To select an
Icon Composer project,
set host.ios.icon or host.macos.icon to its app-relative .icon directory,
for example "host": { "ios": { "icon": "art/Primary.icon" }, "macos": { "icon": "art/Primary.icon" } }.
Each platform selects independently; tvOS keeps its asset catalogs and does
not inherit the iOS selection. There is no .icon discovery. The selected
project must be inside the app and cannot coexist with a primary
AppIcon.appiconset, or a set with the project's name, in that platform's
catalogs. Missing paths and paths that are not .icon directories fail by name.
The project and its layers compile in the same actool pass as the app's
catalogs; changing them requires a new native build. icons still supplies the
web and the native raster fallback when the platform has no icon selection.
A variant selects its own project with the same two keys under variants.<name>
(variants).
An app may ship icons the person chooses for the Home Screen instead
(LLP 1163.000). alternate_icons in app.json lists them in the order a
picker shows them, each a name (ASCII letters and digits, starting with a
letter, at most 32, unique regardless of case) and the icons it is made from,
written and picked as the app's own are: icons with at least one square any
or maskable, color_scheme_dark.icons, a monochrome glyph for the tinted
icon. iOS and iPadOS build each one: from its own host.ios.icon project, else
an .appiconset of its name in the app's catalogs, else its icons. It is the
only roster: a catalog .appiconset that no entry names, other than the
primary's, is refused, as is a name that is AppIcon, the primary project's
or another asset's in the catalogs. Alternates need a primary. The names are in
the iOS compatibility id, so adding, removing, renaming or reordering one needs
a new binary; other hosts build none. @exact/app-icon reads the choice and
asks for another:
text
use appIcon, setAppIcon, AppIconStatus from "@exact/app-icon"
resource shown = appIcon() as shape AppIconStatus else empty()
mutation chosen as shape AppIconStatus refreshes shown
action pick(name: string)
send chosen = setAppIcon(icon=name)
action pickPrimary
send chosen = setAppIcon()
appIcon() answers available (the platform switches icons, and the binary
ships an alternate or one still shows), icon (the alternate shown, none for
the primary; it may name one an update removed) and icons (the roster when
available). setAppIcon(icon=) is a request: call it only from the action a
person's choice runs, never from a timer, a resource's answer or launch, since
iOS shows its own alert for each change and the runner does not enforce this.
The icon already shown answers at once with no alert, and setAppIcon(), with
no icon, always restores the primary. It refuses NotAllowedError (person-required from a tool or a
wake, or the app not in the foreground), NotSupportedError where available
is false (every target but iOS and iPadOS), NotFoundError for a name the
binary does not ship, and UnknownError with apple: {domain, code} when iOS
refuses. Under the agent the roster is the word app-icon.icons (prefer),
and each change holds an app-icon ticket standing for iOS's alert
(docs/recipes/alternate-app-icons.md).
What shows before the first frame is the launch colour, which app.json names
per colour scheme (LLP 1163 D2):
app.json | Light | Dark |
|---|---|---|
"background_color": "#f4efe6" | #f4efe6 | #f4efe6 |
"color_scheme_light": { "background_color": "#f4efe6" } | #f4efe6 | Exact's |
"color_scheme_dark": { "background_color": "#14110d" } | Exact's | #14110d |
"background_color": "#f4efe6", "color_scheme_dark": { "background_color": "#14110d" } | #f4efe6 | #14110d |
none | Exact's | Exact's |
A scheme's own member wins over the top-level one, which holds in every scheme.
Name none unless the launch must differ from what Exact shows: on iOS the app's
own background where the build can read it, every route it can open on agrees
(each route's background-color, else its root's, written as a colour or a
theme's colour) and nothing may paint over it out to the screen's edges, else
systemBackground (its grouped background where every route scrolls a grouped
list or writes -exact-grouped-background); on Android the theme's surface; on
the web the page's own colour, as a native app starts there. Name the colour
where the launch must match a background of the app's own on Android or the
web, or on iOS where something the build cannot see covers it, such as boxes
sized in points that fill the screen or a scheme the app restores at launch.
A colour is #RGB, #RRGGBB, #RRGGBBAA, or Display P3 as
color(display-p3 r g b) (/ a for alpha), which iOS and the web's first paint
show in Display P3 and Android takes clipped to sRGB. A fixed
userInterfaceStyle shows its side in both on iOS and the web; Android follows
the device. The web page has the colour until the first frame, the iOS launch
screen centres host.ios.launchImage on it, and the Android launch window is
it, with the bars' icons dark over a light colour. theme_color takes the same
three places for the browser's toolbar. The manifest.json a browser reads has
only the W3C members, so a colour named for light alone is not in it.
From Android 12 the launch window (the starting window) shows the launcher icon
in its middle, as every app's does. host.android.launchImage replaces it:
{ "src": "<png>", "width": <dp> } is a picture width dp wide, which the
platform shows within a centred square 192 dp across and, on stock Android, cuts
to the circle in that square (a width above 192 is refused); before Android 12,
whose launch window has no icon, the picture is centred on the window. false
shows no icon in either appearance. Both hosts accept a dark PNG inside launchImage:
{ "src": "mark-light.png", "width": 128, "color_scheme_dark": { "src": "mark-dark.png" } }.
Each picture uses the parent's width and its own aspect ratio. Without a dark PNG the
same picture appears in both schemes. Changing a colour or picture requires a new native build.
On iOS the picture is in the app's asset catalog, and its light version also lies beside
the catalog as PNGs at 2x and 3x. The system service that draws launch screens keeps the
catalog it first read for an app until the service restarts, and finds a picture that
catalog lacks as a file.
categories in app.json is the W3C manifest's member, which the web manifest
carries: what the app is, for a store or catalog to file it under. A value is
one of the W3C's standardized categories or one of Apple's, written without
public.app-category. (developer-tools, graphics-design, reference,
video, and the game genres from action-games to word-games); the build
refuses any other. The iOS and macOS bundles' LSApplicationCategoryType is
the first that Apple has a category for: fitness and health are
healthcare-fitness, photo is photography, social is
social-networking, and books, food, government, kids, magazines,
navigation, personalization, politics, security and shopping have
none. App Store Connect requires a category of a Mac upload. A game the game
shell builds (game) with no category of Apple's is games.
json
{ "categories": ["dice-games", "games"], "host": { "ios": { "increasedMemoryLimit": true } } }
An app whose Apple category is games or a genre is a game, and Game Mode
(priority on the CPU and GPU, lower Bluetooth latency for controllers and
AirPods, less background work) is offered to it: the bundles carry
LSSupportsGameMode (iOS 18.6, macOS 26), and the iOS bundle also
GCSupportsGameMode, which iOS 18.0 to 18.5 read, when host.ios.minimumOS
is below 18.6. host.ios.gameMode and host.macos.gameMode set it per
platform: false keeps a game too light to need it out of Game Mode, and
true offers it to an app that is not a game. tvOS and an App Clip carry
neither key.
host.ios.increasedMemoryLimit: true signs the app with
com.apple.developer.kernel.increased-memory-limit: on the iPhone and iPad
models that allow it, the app may use more memory than the default limit. The
app must still work without it (os_proc_available_memory says what it has).
Increased Memory Limit is a capability of the App ID, so a device build takes
only a profile that grants it and otherwise is refused
(memory-device-profile); a simulator build signs it as is. Extensions, the
App Clip and tvOS never take it.
Apple products live under the resolved app's target directory, scoped by
canonical source directory, manifest id, destination, composition and trust
policy. The Swift host is compiled once per destination for every app, in
<target>/apple-swift/<destination>-<minimum OS>; each app only links there,
one at a time, and its executable is copied to its own products before the next
app links. Outside production trust, the iOS minimum in that name is 17.0
unless the app has launch modules: the SDK's Rust, C and Swift compile for it
whatever host.ios.minimumOS says, and the app's minimum goes only to its Info.plist, its executable's link
and its own Swift modules and packages, which Swift checks for availability as
it compiles. A development build compiles it file by file and incrementally, and
beside the app's Rust; the host's two Rust modules build in
<target>/apple-modules, and a checkout that has not built one takes it from
~/.cache/exact/apple-modules when another checkout of this machine compiled
it from the same bytes. A target directory that has compiled nothing starts
with the registry crates this machine has compiled, and an app's also with the
checkout's own crates (runner, kernel, hosts) another app naming that checkout
compiled, when the app builds in its own target/ (~/.cache/exact/apple-crates; Cargo decides which it can use, and a
crate edited, pulled or switched since compiles again). An app's own crates are
never kept; a checkout unused for 14 days, or gone, is forgotten, and
EXACT_APPLE_KEEP_CHECKOUT=0 keeps registry crates only. Delete either
directory to compile everything here. Every production Apple build (--release,
--archive, exact release, or EXACT_UPDATE_TRUST=production) uses the whole-module
Swift build and strips its executable, writing <executable>.dSYM beside the staged
build product. Development builds keep their symbols. iPhone and iPad device app executables
link SafariServices in development and production so dyld loads the libraries
UIKit would load at launch (LLP 1047.001.001). A device App Clip copies its parent’s
executable and carries the same link; a simulator links the same target with the Clip’s
own embedded entitlements. An IPA writes <name>.dSYM
beside its archive; exact release copies the build's matching dSYM beside its release.
Production iOS and tvOS bundles ship a small receipt and strip Swift frameworks, whether
archived or not. The whole receipt stays beside <name>.app or <name>.ipa as
<name>.receipt.json; framework dSYMs are in <name>.dSYMs/<Framework>.framework.dSYM.
Rust module and package frameworks keep their linker output because Xcode's strip
can make them unloadable. GPU frameworks keep the bytes the bake authenticated.
All keep matching dSYMs outside the bundle.
Production widget and share extension executables are stripped before signing; their
source dSYMs are kept in <name>.dSYMs/<Extension>.appex.dSYM, outside the app.
Watch builds keep the watch executable's, complication extension's and runtime
framework's dSYMs in <name>.dSYMs/Watch/. Mac builds keep module library and
framework dSYMs outside the app too, including the bare products' shared runtime
at <namespace>/ExactCore.framework.dSYM.
To keep Spotlight from indexing build intermediates on your Mac, add the checkout's
or app's target/ directory to Spotlight's Search Privacy settings. Keep the release
dSYMs for the executable, frameworks and extensions in an indexed archive so Xcode can
find the matching symbols for a crash report. Apple's guide to symbolication.
A production build links its Rust
with fat LTO and, when its plan is fixed, leaves out the loaded modules the
plan cannot reach (LLP 1036.000 §5–§10). --bundle prints the stable Mac bundle at
<target>/clients/<source-key>/<id>/macos/<Name>.app; scripts/exact.mjs,
agent --app and metrics use that same resolver. --host leaves both standalone
and sample products; simulator and device bundles have separate destinations.
On the Mac the sample host is a bundle beside the app's, <Name> Host.app, which
agent host launches. Under the app's macOS profile it embeds that profile and takes
the app's id and entitlements (iCloud, push, a keychain group), so its two sessions
keep what the app's do; with none it is <id>.host. It registers no document type or
link scheme, which stay the app's.
Two apps can build together. A second Apple build of the same source/app fails
with its owner's PID and lock path before baking; remove a stale lock only after
verifying that owner is no longer running. Failed packaging retains the previous
complete product. EXACT_MAC_BIN remains an explicit diagnostic override, checked
against the selected app's embedded identity before the driver launches it.
An app can ship macOS helper executables and resource trees separately from
its baked assets. Keep the tree in a dedicated directory beside app.json:
json
{"host":{"macos":{"resources":[{"from":"server","to":"Resources/server"}]}}}
mac --bundle copies it to Contents/Resources/server, preserving file modes,
names such as node_modules/@scope, and relative symlinks within the tree.
These files have no bake size cap and are excluded from TypeScript capture and
web assets. from cannot overlap source, asset or output roots: it is refused
under assets/, deck/, gpu/, fonts/, strings/, web/, apple/, linux/,
src/, data/, modules/, node_modules/, target/ or dist/ (a JSON file the
app ships goes in a directory of its own, such as data-files/); to must name
a private subtree of Resources/, Helpers/ or Frameworks/. Mach-O helpers
and libraries are signed before the outer bundle; exact release signs them
with its release identity. Resource changes require a new binary, not an asset
update. Find Resources/server through Bundle.main.resourceURL from a native
module. This field applies only to macOS bundles. A file written before the
build (a build stamp, a channel name) goes in such a tree under Resources/:
it is copied before the bundle is sealed, so it is inside the seal. Only code
goes under Helpers/, where codesign refuses a file that is not.
host.ios.resources (iOS, iPadOS and tvOS) takes the same entries for files a data
module reads by path (large, binary, or opened by a native module; data the app ships
and only reads is a JSON file app.ts imports, shipped data): to is under Resources/, and the tree lands in the bundle's
ExactResources/ folder, which holds nothing else and is what bundle:/ names there,
so fs.read bundle:/<to> (fs.read bundle:/Resources/server for the entry
above) reads it on both hosts. A tree holds no links (bundle: follows none)
and no Mach-O code; changing it requires a new binary, never an update. The
app reads it, not its extensions: a widget's refresh keeps only fs.read app:/
grants, so its bundle: read is refused as ungranted (an Error, code
denied), and a widget extension's process has no bundle: root besides.
A helper that needs a hardened-runtime exception (a JavaScript runtime's JIT,
say) declares it as a grant beside the app's others, naming the exception and
the one executable it is for, by its path under Contents (LLP 1069.008 D9):
ts
export const grants = `
runtime.allow-jit Helpers/node/bin/node
runtime.disable-library-validation Helpers/node/bin/node
`;
The exceptions are allow-jit, allow-unsigned-executable-memory and
disable-library-validation; exact release signs that executable with
com.apple.security.cs.<exception> and nothing else in the bundle with it.
Only helpers take an exception: a line naming app, the app's own executable,
is refused (deferred until it has a consumer). A target must be a Mach-O
executable inside a host.macos.resources destination, not reached through a
link; a nested .app's executable gives its grant to that
bundle. mac --bundle refuses one that is not, and other hosts ignore the
lines. Adding a line changes the grant ceiling, so the deploy classifier calls
for a binary release.
Mach-O code in content-addressed assets/, deck/ or shaders/ is refused
when assembling a Mac bundle: place helpers in host.macos.resources instead.
The release signs GPU modules before baking their digests and preserves those
signatures through packaging. iOS archives package primary and named GPU modules
as signed frameworks; development builds keep their loose dylibs.
Combining --device --archive out.ipa --embed produces both the IPA and the
embed directory without a connected phone. On iOS, --embed emits a complete
App Store-ready artifact directory (LLP 1031.000):
•
lib<crate>.a and include/*.h (embed.link.mode = "static-archive"), or
Frameworks/ExactCore.framework (embed.link.mode = "shared-core", replacing
lib<crate>.a so the Rust runtime is linked once across the app and its widget
extension) when the app declares widgets or Live Activities.
•
ExactEmbedComposition.swift, a deterministic generated Swift file importing
only the SwiftPM products in capabilities.json with zero build-environment
variables; add it to the Xcode target and call ExactEmbedComposition.install()
before creating sessions (or use ExactEmbedComposition.app).
•
Frameworks/<Name>.framework for every iOS dynamic library the app's baked
composition reaches: signed GPU frameworks (copy intact to preserve baked
digests), required host arms (ExactWeb, ExactVideo, ExactSound, ExactMIDI,
ExactSvg, ExactCanvasGpu), native modules (ExactModules, package frameworks,
ExactSwiftDependencies, launch service frameworks), and ExactWidgetReload /
ExactActivity when widgets or activities are declared.
•
PrivacyInfo.xcprivacy declaring ExactKit and the Rust runtime's
required-reason APIs (each wrapped .framework also carries its own manifest).
•
Resources/ carrying host.ios.resources, SwiftPM resource bundles, compiled
asset catalogs/icons when declared, and localized InfoPlist.strings.
•
intents/ (ExactIntents.swift and any LaunchParts/*.swift) compiled by the
Xcode target so Xcode merges Metadata.appintents with host intents; link flags
are in capabilities.json embed.intents.launchLink.
•
widgets/ (Sources/, plans/, typescript/, and widget fonts) compiled by a
consumer-owned WidgetKit extension target linking ExactCore.framework and
ExactSnapshot, with embed.widgets.infoPlist and embed.widgets.entitlements
(excluding applinks:).
•
compat.json, receipt.json, and capabilities.json (preserving top-level
products, install, optimize, swiftFlags, and frameworks alongside the
embed manifest). Static-only iOS apps compile no Swift during --embed.
An external Swift host links ExactKit plus each capability product its plans
use, then adds ExactEmbedComposition.swift (or calls each product's public
install() in capabilities.json order) before creating sessions. Implement
ExactSessionDelegate's exactSession(_:command:args:) on the embedding host
to handle openURL (for links and deep links) and setScheme (to apply the
app's appearance choice to the embedding window or scene).
Product | Capability | Installation |
|---|---|---|
ExactMarkdown | Markdown text and editing, and its atoms' icons in text | ExactMarkdown.install() |
ExactCollections | Windowed lists, swipe rows, reordering rows (grips and groups) and iOS list row cells | ExactCollections.install() |
ExactDrag | Height and transform drags | ExactDrag.install() |
ExactGroupedLists | Native grouped lists | ExactGroupedLists.install() |
ExactSurfaces | GPU and Canvas surfaces | ExactSurfaces.install(); links ExactImages, which Canvas 2D images read through |
ExactImages | Image files, animated images and package pictures; the files icons in text read | ExactImages.install() |
ExactPickers | File inputs' picker, saveFile and the File System Access pickers | ExactPickers.install() |
ExactMediaPicker | Native media picking (the composition links ExactPickers with it) | ExactMediaPicker.install() |
ExactAuthSession | Authentication sessions | ExactAuthSession.install() |
ExactNumerals | Numeric content transitions | ExactNumerals.install() |
ExactTips | Platform tips | ExactTips.install() |
ExactPresence | Native presence checks | ExactPresence.install() |
ExactEffects | CSS filter on a box | ExactEffects.install() |
ExactSvg | SVG elements, SVG images and icons (links ExactEffects too) | ExactSvg.install() |
ExactNativeViews | The app's native module, native views and hatches; links ExactFormaBinding, the public ExactForma | ExactNativeViews.install(), which installs Forma too |
ExactControls | Switches, checkboxes, radios, ranges, selects, dates, progress and segmented tablists | ExactControls.install() |
ExactFlights | Shared-element flights (sharedElement) | ExactFlights.install() |
ExactSticky | position: sticky | ExactSticky.install() |
ExactNotifications | Notifications, their actions and push registration | ExactNotifications.install(); the app delegate calls ExactApp.installNotificationClicks before launch completes |
ExactHostEventMailbox | Host events a package takes (an accepted iCloud share) | ExactHostEventMailbox.install(); the app delegate calls ExactApp.installHostEvents before any scene connects |
ExactActivities | Live Activities (links ExactWidgetPublication, whose generation their sends name) | ExactActivities.install() |
ExactActivities | Live Activities | ExactActivities.install() |
ExactToolDoor | The tool door: the system's calls of the plan's tools | ExactToolDoor.install(); the app delegate calls ExactApp.installToolDoor before launch completes |
ExactIndexMirror | The content index @exact/search-index writes: its mirror, Spotlight, entity queries | ExactIndexMirror.install(); the app delegate calls ExactApp.installContentIndex before launch completes |
ExactWakeCarriers | Wakes, background transfers and monitored regions | ExactWakeCarriers.install(); the app delegate calls ExactApp.installWakes before launch completes, and ExactApp.handleTransferEvents |
ExactGradients | CSS gradients: background-image and mask-image | ExactGradients.install() |
ExactTraces | The traces an app records, and ExactSession.startTrace() and stopTrace(maxBytes:) | ExactTraces.install() |
ExactWakeLock | wakelock="screen" | ExactWakeLock.install() |
ExactContentRegions | Content regions an entry registers (the Mac's region controller) | ExactContentRegions.install() |
ExactVideo | video and audio elements' players; an image's picture in picture | ExactVideo.install() |
ExactWebViews | iframe web views | ExactWebViews.install() |
ExactSound | Declared sounds, sequences and the voice-table commands | ExactSound.install() |
ExactMIDI | MIDI ports and a sequence's MIDI output | ExactMIDI.install() |
ExactAnimations | What Core Animation plays for a box: its CSS animations (animation, @keyframes), transitions, drags and spring motion, so any of animations, transitions, motion, drag or timelines links it; SVG's element animations play through it too | ExactAnimations.install() |
ExactNavigation | Route stacks, tabs and their bars, route modals; on the Mac route sheets, the list beside its detail, Back and Forward, the root tabs as the sidebar, and a route’s trailing full-height aside as the window inspector | ExactNavigation.install() |
ExactTextSelection | iOS's selection of text a user-select of text or all makes selectable (the Mac's is in ExactKit, and every Mac composition names it) | ExactTextSelection.install() |
ExactWidgetPublication | Widgets and Live Activities: the app's publication of its entries to the App Group and its observation of the store they write | ExactWidgetPublication.install() |
ExactDialogs | iOS and tvOS: a dialog shown by showModal() as UIKit's sheet, or as the author's box when it paints its surface; any dialog in the plan links it. On the Mac the core presents a dialog | ExactDialogs.install() |
ExactSharing | share(…)'s sheet, a link's context-menu Share item, and a received share's claim | ExactSharing.install() |
Development builds log a missing Markdown or drag installation once per session,
with the product and installation call. Without it, Markdown remains literal
text and drag gestures are unavailable.
ExactApp.apply and applyGeneration answer ExactApplyResult: .applied,
.held(reason) or .refused(error). AppKit keeps marked text when the replacement
keeps its native editor. A replacement that removes the field or changes its
native control waits for composition to end. Marked text in an embedder's
own editor also holds the replacement. Other macOS holds include a mouse
button down in the app, a trackpad
gesture's fingers, a tracking loop AppKit runs (a menu, a control's press, a
scroller) and a gesture recognizer that has begun in a session's window. On
iOS and tvOS it is a touch UIKit has not ended, a press of a remote's or a
game controller's button (tvOS's Select has no touch) and, in a session's
window, a first responder with marked text, a scroll view tracking or
dragging, a gesture recognizer that has begun and a view controller
transition. An embedder's own recognizers and scroll views in that window
hold it too. A row the keyboard lifted to reorder holds it until the drop or
the cancel.
Loading a candidate's data module and finishing the running module's
requests also hold it; the reason names which. The app keeps the held candidate as bytes, with its assets,
modules and commit closure, and prepares it once the hold clears, so it carries the state
of that moment. A newer candidate supersedes it. Do not poll or submit it
again.
ExactAppLifecycle.generationStarted reports that a candidate applied.
replacementEnded reports, once, with its token and reason, that a held
candidate was refused when prepared, superseded, or dropped because every
session it was held for was destroyed or, for a generation from connect's
URL, because disconnect or another connect closed that connection.
state.replacement.pending in the
agent's state names the hold. ExactSession.apply, which replaces one
session's plan, refuses instead of holding. The rule covers development saves
and immediate production updates (LLP 1029.000.002 D7, D9). The dev menu's
Reload is the person's own act: it ends a composition as a click elsewhere
does, keeping the marked text, and commits at once.
EXACT_IDENTITY=<certificate-sha1> selects a Keychain signing identity;
EXACT_IDENTITY=- selects ad hoc signing for a local build. Otherwise,
DEVELOPMENT_TEAM=<team-id> selects that team's Apple Development identity.
A build chooses the newest valid certificate of the selected team authorized by
the app’s profile and every embedded extension’s profile, when present. An explicit
identity excluded by any of those profiles is refused. With no team selected, certificates of one team select that team automatically. Certificates
of several teams require an installed macOS profile that resolves the team before
choosing widgets, a share extension or grant entitlements. If profiles do not
resolve it, the build refuses and names DEVELOPMENT_TEAM=<team-id>,
EXACT_IDENTITY=<sha1> and EXACT_IDENTITY=-. This applies to every app,
including an ordinary secret.keep app. With no identity at all, a build without
profile requirements or extensions can still sign ad hoc. Developer ID profile
ambiguity names EXACT_DEVELOPER_ID=<sha1>, the release identity selector.
Local builds made by mac --bundle omit the hardened runtime, so an ad hoc
host can load its ad hoc native modules. An external host signed ad hoc with
codesign --options runtime can start and pass strict signature verification,
but macOS library validation refuses its native modules because neither has a
Team ID. For a hardened host, sign the host and every native module with valid
certificates of the same team. A successful launch alone does not check module
loading; exercise the plan's native view or module call too.
Certificate signing keeps the app's login Keychain access stable across
rebuilds (LLP 1018 D7). Before each local development sign (--timestamp=none),
the build prints the identity and file on stderr. Each has a 30-second limit.
A failure retains the tool's error and explains how to allow access to the
signing key. Mac development failures also name EXACT_IDENTITY=- as a way
to build ad hoc; device failures never suggest it. Timestamped release signing
has no such limit. Ad hoc signing cannot authorize provisioning-profile
entitlements, Mac widgets or a share extension. Rebuilding an ad hoc app can
prompt again for stored login-keychain items, blocking the first frame.
Some entitlements hold on a Mac only under a provisioning profile that
authorizes them (Apple TN3125), and the Mac build signs them from one (LLP
1133.010 D7): push's com.apple.developer.aps-environment (device.push), App
Attest's environment (device.attestation), the Declared Age Range
(device.age-range), Group Activities (device.shareplay), CloudKit
(device.cloudkit), the iCloud key-value store (device.icloud-kv), Sensitive
Content Analysis (device.sensitive-content-analysis), the keychain group a locked secret is kept in
(secret.keep with a presence policy), and a passkey's associated domains
(auth.passkey). An app whose grants need any of them is built from the
newest installed macOS profile for its id (or the team's wildcard) that allows
them all, within DEVELOPMENT_TEAM when set: a development profile that names
this Mac for a development build, a Developer ID one for exact release.
An already resolved identity restricts automatic profile selection to its team.
EXACT_MAC_PROFILE=<path> names one, and
the build says why a named one does not fit. A named profile overrides
DEVELOPMENT_TEAM, as on devices. A team selected by DEVELOPMENT_TEAM
requires a suitable profile. An explicit EXACT_IDENTITY overrides that setting;
without a suitable profile for its certificate's team, a development build keeps
the certificate, signs no profile entitlements and logs each grant's effect.
With a profile, the build signs with its team's identity (Apple Development, or EXACT_DEVELOPER_ID for a
release; one EXACT_IDENTITY or EXACT_DEVELOPER_ID names must be of that
kind and team, or the build is refused), writes the application identifier,
the team and each entitlement (an environment development under a
development profile, production otherwise; CloudKit uses Development and
Production), embeds the profile as
Contents/embedded.provisionprofile, and always assembles the .app, where
the profile holds.
To prepare a native Mac app for a separate Developer ID signer, run
bun exact.mjs mac --distribution --unsigned --json. The ad-hoc .app keeps
production update trust and the baked HTTPS callback requirements in
Contents/Resources/receipt.json (build.compat), isolates its bake output,
capture, standalone products and .app under unsigned/ so signed or local
builds and publish receipts are untouched, and reports requiresResigning: true
in the --json output only (not inside receipt.json). The build embeds no
profile or restricted entitlements and refuses other profile requirements,
extensions, --run, EXACT_MAC_PROFILE, EXACT_PROFILE, and any
EXACT_DEVELOPER_ID other than -. Before distribution, the signer must verify
the receipt, embed a matching Developer ID profile, sign inside out with
hardened runtime, a secure timestamp and the derived entitlements (including
re-signing Contents/MacOS/libexact_gpu*.dylib in place, whose code_digest
excludes the signature blob), and notarize. Any whole-file-verified
Contents/Resources/rust/*.dylib companions must arrive already signed for the
final app's team (for example via EXACT_RUST_SIGN_IDENTITY) and remain
untouched, because re-signing them changes the verified bytes.
With no profile that fits, a development build signs none of them and says,
for each grant, what the app then reports (available: false,
NotSupportedError). A release build is refused (grant-needs-profile) for
App Attest, the age range, the iCloud key-value store, Sensitive Content
Analysis, a passkey or a locked secret that is not optional; one granting
push, SharePlay or CloudKit ships without it, the package reporting it unavailable.
An app with Mac widgets signs both under one profile, of the widgets' team,
chosen among the profiles that grant the widgets' App Group and shared
Keychain group and the grants' entitlements; with none that grants both, the
grants sign nothing. An ad hoc build (EXACT_IDENTITY=-) signs no profile's
entitlements.
device.cloudkit derives one container, iCloud.<bundle id>, or selects the one
written as device.cloudkit iCloud.<name>; it takes no purpose. A second container
is refused. On iOS and iPadOS, and under a Mac profile, it signs
com.apple.developer.icloud-services = ["CloudKit"],
com.apple.developer.icloud-container-identifiers = [<container>] and
com.apple.developer.icloud-container-environment = "Development" or "Production"
by the signature's kind. A distribution archive uses Production (ITMS-90046).
The profile's services must include CloudKit and its containers must allow the
selected identifier; a profile for another container is refused. No push or
remote-notification mode is derived, and no ubiquity-* entitlement. tvOS,
App Clips and extensions sign none. A bound package declaring
"hostEvents": ["cloudkit-share"] receives shares and gets CKSharingSupported
and ExactHostEvents only where the grant is signed; a Mac build without a
profile claims neither.
For a website's web-build and test web on Linux, check out Exact at the path the
app's exact.mjs uses and install Bun at the version in Exact's package.json.
Install rustup if the app or SDK tools will build from source. Run these commands from the app directory.
Terminal
bun <exact2>/scripts/exact.mjs setup --platform web
bun install --frozen-lockfile
bun exact.mjs test web
A Contract and TypeScript site can use matching prebuilt tools for its web build and browser tests.
Web setup checks the tools and their recorded Cargo metadata against this checkout, then installs
the JavaScript dependencies and browser. --check uses the local cache. Setup can also fetch
from a tools origin when the checkout pins its producer key. Native builds, games, Rust data or
GPU crates, custom web build scripts and Rust page renderers require Rust.
The tools origin is a public bucket that bun scripts/tools.mjs publish --watch keeps from
the producer's Mac, which holds the signing key. A checkout reads it at the public https URL
that scripts/tools.mjs pins with the producer's public key; EXACT_TOOLS_ORIGIN names a
mirror of it. Until both are pinned, nothing is downloaded, and a machine without Rust uses a
set bun scripts/tools.mjs keep built. The origin keeps each commit's lookup for 90 days; an
older checkout finds a set only among the newest, and only if its inputs are that set's.
For a source build, the scoped setup installs the pinned stable and nightly Rust, the nightly's rust-src,
llvm-tools, clippy and wasm32-unknown-unknown target, its standard-library dependencies,
wasm-bindgen, Binaryen, Exact's node_modules, Playwright's Chromium and headless shell,
and Exact's locked crates. The wasm tools serve Markdown, motion, the markup editor,
text flow, Rust data modules and GPU modules as well as --wasm builds. CHROME may
name an installed browser instead. Setup reports the same required rows as
setup --check --platform web. It skips native targets, Hermes, game preparation and
the native-build disk warning. Games need the full setup. On a minimal Linux image,
bun <exact2>/node_modules/playwright-core/cli.js install-deps chromium installs
Chromium's system libraries.
The EAS iOS and EAS Android
recipes use the ordinary native builders (LLP 1030.003 D6, D8). Exact does
not manage an EAS account, credentials, build counters or store submissions.
These examples describe a single-target app; extensions need their own
matching profiles, as described in the widget signing sections.
Keep Exact's app.json. Add a separate app.config.js for EAS, returning
only Expo's configuration rather than merging Exact's manifest:
js
module.exports = {
name: 'My app', slug: 'my-app', version: process.env.EXACT_VERSION || '1.0.0',
ios: { bundleIdentifier: 'com.example.myapp' },
android: { package: 'com.example.myapp' },
extra: { eas: { projectId: 'YOUR-EAS-PROJECT-ID' } },
};
Match ios.bundleIdentifier to Exact's app.id and android.package to
host.android.id (default: app.id with hyphens replaced by underscores).
Link the EAS project and install
expo-modules-autolinking as a development dependency for EAS's config
resolver (bun add --dev expo-modules-autolinking; commit the lockfile).
EAS CLI reads it from the app's node_modules on the machine that runs
eas build, so run bun install there first: without it, eas build -p ios
fails in its entitlements step, before anything is sent to EAS.
Exact does not need Expo or React Native at run time. Pin EAS CLI in the app's
dev dependencies too (bun add --dev --exact eas-cli). This eas.json uses file secrets for signing; set
EXACT_REF to the immutable Exact commit used by the app:
json
{
"cli": { "appVersionSource": "remote" },
"build": {
"exact": {
"environment": "production",
"distribution": "store",
"withoutCredentials": true,
"autoIncrement": true,
"bun": "1.4.2",
"env": { "EXACT_REF": "FULL-EXACT-COMMIT", "EXACT_VERSION": "1.0.0" },
"ios": { "config": "eas-ios.yml", "image": "macos-tahoe-26.6-xcode-27.2" },
"android": { "config": "eas-android.yml", "image": "ubuntu-26.04-jdk-17-ndk-r27b-sdk-58" }
}
}
}
Image names above are the reporter's working choices; choose an available
image with Xcode 27.1+ for iOS, or JDK 17+ and Android command-line tools for
Android. Bun must satisfy Exact's package.json engines range. Initialize
EAS's remote build counters above any number already uploaded; do not assume
the first remote build increments an existing store number. Resolve the
build config before reading eas.job.version.buildNumber or versionCode.
See EAS custom builds and
build configuration.
Save the following as .ci/prepare-native.sh in the app repository. The
recipes run it with ios or android. It installs only that platform's
Rust targets and Hermes bundles, with no simulator, and fetches the crates
Exact's lock names: Exact's tools build offline, and a worker's empty Cargo
registry stops the first of them. Bun, git, curl and unzip come from the
selected image. For a clean local worker, install Bun
1.4.2 first and omit the final two EAS set-env calls.
Terminal
#!/bin/sh
set -eu
export EXACT="$PWD/../exact"
git clone https://github.com/expo/exact.git "$EXACT"
git -C "$EXACT" checkout --detach "$EXACT_REF"
bun install --frozen-lockfile --cwd "$EXACT"
if ! command -v rustup >/dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/exact-rustup.sh
sh /tmp/exact-rustup.sh -y --profile minimal --default-toolchain none --no-modify-path
fi
export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH"
pin=$(bun -e 'console.log(Bun.TOML.parse(await Bun.file(process.env.EXACT + "/rust-toolchain.toml").text()).toolchain.channel)')
case "$1" in
ios) triple=aarch64-apple-ios ;;
android) triple=aarch64-linux-android ;;
*) exit 2 ;;
esac
rustup toolchain install "$pin" --profile minimal --target "$triple"
cargo +"$pin" run --locked --manifest-path "$EXACT/vendor/ibex/crates/hermes-lean-sys-installer/Cargo.toml" -- --target "$triple"
cargo +"$pin" fetch --locked --manifest-path "$EXACT/Cargo.toml"
set-env EXACT "$EXACT"
set-env PATH "$PATH"
The installer also installs the host Hermes bundle used to bake TypeScript.
setup --check reports a registry that lacks any of Exact's locked crates
on its Cargo crates row.
If the launcher or Cargo manifests still name a developer's checkout, run
EXACT=../exact bun exact.mjs update locally and commit its changes before
submitting the job. An app's host.ios and host.android entries must be
present; exact new --with ios,android creates both. Native shells are
generated by the build. A native-view dependency must supply a roster that
can be read without a simulator; see the CI archive path.
Cache Cargo's registry and git downloads, $CARGO_HOME/hermes-lean-sys,
Gradle's GRADLE_USER_HOME (default ~/.gradle), and ~/.cache/exact when
useful. Restore app and Exact target/ only under keys that distinguish
OS/architecture, toolchain, lockfiles and build mode, and keep both
checkouts at the same absolute paths between runs: Cargo's fingerprints
include the location of a path crate outside the app's workspace. A cache
hit does not promise reuse; production Apple builds do not use the
development module cache, and
CARGO_LOG=cargo::core::compiler::fingerprint=info explains rebuilds. A
clean build must work without these caches. Do not cache signing keys or
provisioning profiles.
Cargo rebuilds a path crate when one of its source files is newer than its
last build, and a fresh clone dates every file at the clone, so a restored
target/ alone still rebuilds every Exact crate. Dating the clone's files
at its commit's time lets Cargo reuse the restored output. Add these lines
to .ci/prepare-native.sh directly after the git checkout:
Terminal
when=$(TZ=UTC git -C "$EXACT" log -1 --date=format-local:%Y-%m-%dT%H:%M:%SZ --format=%cd)
git -C "$EXACT" ls-files -z | (cd "$EXACT" && xargs -0 touch -h -d "$when")
This is sound only while each file so dated has the bytes it had when the
cache was saved, because Cargo then compares nothing but times: a changed
file with an old time is not rebuilt, and the build ships its stale output.
So restore that target/ only under a key that names the Exact commit
(EXACT_REF), with no fallback key that restores another commit's cache,
and date only the files the checkout wrote, before any step changes the
clone. Leave the app's own files their checkout times unless the key names
the app's commit too.
On macOS and Linux, run bun <exact>/scripts/sweep.mjs clean <app-dir> --dry-run --json
to list an outside app’s rebuildable output. Omit --dry-run to remove it.
Exact keeps saved traces, the receipts that the run history points to,
production bundles and their symbols, build locks, and unrecognized paths.
A build, dev server or driver using the app’s output keeps it busy. A cleanup
that starts first holds off new Exact builds until the files have moved.
The app must own its target directory.
The JSON object has version: 1, status, dryRun, target and three lists.
remove gives absolute paths, kept gives a path and a reason (record,
lock or unlisted), and held names busy locks or leases. The exit code is
0 for ok, 2 for refused, and 1 for busy or failed. On failure,
error gives the cause and remove lists the paths already moved.
For the iOS recipe, save this as .ci/sign-ios.sh. Source it in the build
step so the exported identity reaches Exact. In the EAS production
environment, create secret file variables CI_IOS_P12 and EXACT_PROFILE,
and a secret string CI_IOS_P12_PASSWORD. The files are a distribution
certificate with its private key and a matching App Store provisioning
profile. EAS supplies file variables as paths; see its
file-variable documentation.
Use only on an ephemeral worker: this selects a temporary keychain for the
step. Do not turn on shell tracing around credentials.
Terminal
set -eu
CI_SIGN_DIR=$(mktemp -d)
CI_KEYCHAIN="$CI_SIGN_DIR/build.keychain-db"
CI_KEYCHAIN_PASSWORD=$(openssl rand -hex 24)
trap 'security delete-keychain "$CI_KEYCHAIN"; rm -rf "$CI_SIGN_DIR"' EXIT
security create-keychain -p "$CI_KEYCHAIN_PASSWORD" "$CI_KEYCHAIN"
security set-keychain-settings -lut 21600 "$CI_KEYCHAIN"
security unlock-keychain -p "$CI_KEYCHAIN_PASSWORD" "$CI_KEYCHAIN"
security import "$CI_IOS_P12" -k "$CI_KEYCHAIN" -P "$CI_IOS_P12_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$CI_KEYCHAIN_PASSWORD" "$CI_KEYCHAIN"
security list-keychains -d user -s "$CI_KEYCHAIN"
EXACT_IDENTITY=$(security find-identity -v -p codesigning "$CI_KEYCHAIN" | awk '/[0-9A-F]{40}/ {print $2}')
test "$(printf '%s\n' "$EXACT_IDENTITY" | wc -l | tr -d ' ')" = 1
test -n "$EXACT_IDENTITY"
export EXACT_IDENTITY
If EAS already manages the credentials, download them through eas credentials for these secret files, or adapt the step to decode
eas.job.secrets.buildCredentials: iOS uses the chosen target's
distributionCertificate.dataBase64 (base64), its password, and
provisioningProfileBase64; Android uses keystore.dataBase64,
keystorePassword, keyAlias and keyPassword. When using EAS-managed
job credentials, remove withoutCredentials. Select the intended iOS
target explicitly when there are several. Do not use
eas/configure_ios_credentials: it expects an Xcode project. Exact signs
the app directly with EXACT_IDENTITY and EXACT_PROFILE.
From the app's directory, bun exact.mjs android --release --no-install --json builds an APK without querying adb. bun exact.mjs android --bundle --json builds a production App Bundle (.aab) without installing. Both report the
artifact's absolute path. An outside app's outputs are target/android/app/outputs/apk/release/app-release.apk and target/android/app/outputs/bundle/release/app-release.aab.
An app’s Kotlin can call registerScreenCaptureCallback on its front activity on Android 14 and later. Declare its install-time permission in host.android with "permissions": ["android.permission.DETECT_SCREEN_CAPTURE"]. The APK merges the app’s and packages’ allow-listed install-time permissions with grant-derived names, writing each permission once. A runtime permission comes from its grant line. Only a package declaring a POI car service may request androidx.car.app.MAP_TEMPLATES.
For Android package visibility, put "queries": [{"action": "android.intent.action.TTS_SERVICE"}] in host.android. Entries take {package}, {action} or {action, scheme} under the same allow-list as a bound package's manifest.queries. The APK merges matching entries once. A package with a Kotlin POI car service declares manifest.carAppService in its Android implementation. Android module implementations
Exact owns Android's backup rules (@xml/exact_backup and @xml/exact_data_extraction, with tools:replace on <application>) so a third-party AAR's backup rule cannot break the manifest merge or drop the built-in file/exact-presence/ exclusion (LLP 1133.010 D6). To exclude additional files or preferences from both Auto Backup and Android 12+ cloud backup / device transfer, add "backupExclude": [{"domain": "sharedpref", "path": "appsflyer-data.xml"}] in host.android (allowed domains: root, file, database, sharedpref, external). To suppress an AAR's auto-initializing ContentProvider (such as io.sentry.android.core.SentryInitProvider) so your code initializes the SDK after startup, add its fully-qualified class name to "removeProviders" in host.android (LLP 1133.030 D9). Exact's own providers (dev.exact.*), platform providers (android.*), androidx.startup.InitializationProvider, and bound packages' own classes cannot be removed. Both keys are binary inputs.
EXACT_BUILD_NUMBER sets Android's versionCode (1 by default, an integer
from 1 through 2100000000); EXACT_VERSION sets versionName (0.1.0 by
default). The app reads their baked strings as buildNumber and version
through exactDelivery(); over-the-air updates keep both values.
Set all four of EXACT_KEYSTORE (a file path),
EXACT_KEYSTORE_PASSWORD, EXACT_KEY_ALIAS and EXACT_KEY_PASSWORD to sign
with your upload key. Partial credentials fail before compiling. A bundle
requires them; an APK without them uses Android's debug key and cannot be
submitted to Play. Passwords are passed through the environment, never as
Gradle command arguments (LLP 1030.003 D6, D8).
--release selects optimization. For an APK you will distribute, also set
EXACT_UPDATE_TRUST=production; --bundle sets it itself. With
deploy.store.android absent or "0" the APK has no update store, so every
change ships as a new build and a production build needs no update signing
keys or receipt. At "A" it takes signed plans, assets and TypeScript
modules, never native code (LLP 1030.006), and a production build needs
deploy.signing.keys and EXACT_UPDATE_RECEIPT or EXACT_UPDATE_GENESIS=1,
as iOS does. The over-the-air updates recipe
covers the key, app.json, the first build, publishing and an in-app banner.
A Mac runner needs no phone. An app with native view tags has its build read
their roster by trying three routes in order: a Mac Catalyst executable, an
iOS simulator, then a macOS library. A route whose xcframework has no slice
for it, or whose probe does not compile, load or run, falls through to the
next. The simulator route uses the simulator --sim or EXACT_SIM names,
else a booted one, else boots one and shuts it down again, which needs an
installed iOS runtime. When every route fails, an archive or a --release
build stops; a development build warns and keeps the manifest's
roster. From the app's directory:
Terminal
bun exact.mjs ios --device --release --unsigned --json # an ad-hoc device .app, no phone, profile, identity, icon or install
bun exact.mjs ios --device --archive out.ipa --unsigned # an ad-hoc signed .ipa, for a service that re-signs it
bun exact.mjs ios --no-install # a development simulator .app; the build prints its path
bun exact.mjs ios --no-install --json # the same, its path in one JSON object on stdout
With --json, ios, mac, web-build, linux, android and windows
print one JSON object on stdout, its last and only line, however they end, and
send the build's own output to stderr. The object names the artifact's
absolute path (the .app, the .ipa of --archive, --embed's directory,
target/web-dist or --out's directory, the executable, the APK or AAB), its
target (ios-simulator, ios, tvos-simulator, tvos, macos, web,
linux, windows or android) and its trust (development or
production: what the build baked; the JS target's web-build is
production only with --out, and a game's reports the trust it baked). The Apple builds add signing, the signing identity's SHA-1 or
ad-hoc. ios without --no-install, --unsigned or --archive adds installed, the simulator's or
phone's name and udid (with --watchos, the paired phone's), and
android adds installed, the device's serial, or null when no device was
ready; its object is printed once the install has succeeded:
Terminal
app=$(bun exact.mjs ios --no-install --json | jq -r .path)
A failure prints {"code": …, "error": …} instead, as share --json does,
and exits non-zero: build_failed (the build failed, an install after it
failed, or it named no artifact), before_build (app.json's before_build
failed), app_json (app.json does not parse, or a command of its own takes a
verb's name), platform_refused (the platform's setup is missing, or an Apple
build asked for on Windows), unknown_flag (a flag the verb does not take,
refused before anything builds), or json_flags (--json takes none of
--run, --prebuild and --test).
--unsigned requires --device and refuses --run: a stock device cannot
launch an ad-hoc signed bundle. It builds a .app, or an .ipa with --archive.
For a signed device .app, DEVELOPMENT_TEAM=<team-id> restricts the installed
development profile and Apple Development identity to that team. EXACT_PROFILE
and EXACT_IDENTITY override this selection. If none of that team's profiles covers
the bundle id and phone, the build refuses: unset DEVELOPMENT_TEAM to take any
team's, or run a project in Xcode with that bundle id and team on that phone with
Automatically manage signing enabled, then retry.
EXACT_IDENTITY and EXACT_PROFILE in place of --unsigned sign the .ipa
on the runner. The runner needs Xcode 27.1 or later selected (DEVELOPER_DIR,
or xcode-select -s); the build checks its destination’s SDK before compiling.
It also needs rustup and Bun 1.4.2; then bun <exact2>/scripts/exact.mjs setup installs the
pinned Rust with its iOS targets and the Hermes bundles, and setup --check
names what is still missing. An archive needs a square icon of at least
1024 px in icons (or host.ios.icon), which the build checks before it
compiles. An archive, and a simulator build with --release (the build that
ships), bake production trust: with an update store (deploy.store.ios not
"0") each needs EXACT_UPDATE_RECEIPT or EXACT_UPDATE_GENESIS=1. A cold
build compiles Rust and the Swift host. Cache reuse depends on the source,
toolchain, paths and build mode; see native CI preparation.
Export compliance is the developer's answer, so a production iOS or tvOS build
(--release, --archive, --distribution) writes ITSAppUsesNonExemptEncryption
into Info.plist only when EXACT_NON_EXEMPT_ENCRYPTION is true or false in its
environment (false when the app's only encryption is HTTPS and the system's);
without it App Store Connect asks at each upload. A development build never writes it.
Every Apple app bundle, including development and macOS builds, takes its version
and build number from EXACT_VERSION and EXACT_BUILD_NUMBER (0.1.0 and 1
when unset; an explicitly empty value stays empty). App Store Connect takes a
build number once for a version, so each upload needs a higher one.
Read both at runtime as the string fields version and buildNumber of
exactDelivery(), also mirrored in state.delivery. Native hosts read the
binary's baked values: an over-the-air update leaves them unchanged, and neither
enters the compatibility id. An older bake without the fields answers "".
The web JS build uses these variables at build time and answers "" for each
unset variable. No app.json version key is defined. exactDelivery().production
is true in a binary baked with production trust (for example, Apple's
--release, --distribution, or exact release) and false in a development
build.
A URL-backed video uses the page commands requestPictureInPicture(id)
and exitPictureInPicture(). Read exactPage().pictureInPictureEnabled
to decide whether to show a custom button. The element reports a successful
presentation with enterpictureinpicture and leavepictureinpicture.
A failed request reports its reason through pictureinpictureerror.
Host | Command and verification |
|---|---|
Web JS | Reads document.pictureInPictureEnabled. Headed Chromium ran the Contract button, the element events, repeat entry, exit and removal with a bundled MP4. Its own controls delivered one enter and one leave. A request from a task without user activation received NotAllowedError. |
Web wasm | Reads false and reports a request error. |
Android reader | An enabled APK reads the device’s picture-in-picture feature. On API 35 and 36 emulators the button pinned the player. Expansion, system close, command exit and removal each delivered one leave. Rotation kept the activity pinned. A request followed immediately by exit delivered one enter and one leave. A video removed while Android is entering picture in picture receives no events, and the activity returns to its normal mode. |
iOS | Reads false and reports that the command is unavailable on iOS. AVKit’s control reports enter, leave and failure. Delegate callbacks passed on iOS 27.2 and 26.5 simulators. The iOS events have not been run on a physical iPhone. |
macOS | The fixture received the named command refusal. The Mac’s ordinary video uses AVPlayerView. |
tvOS | The host declares the command unavailable. No tvOS drive was run. |
Painted Linux host, terminal | Both delivered the element error when driven headless on macOS. |
Windows | Uses the painted refusal. No Windows drive was run. |
Android supplies its system controls for expanding and closing the pinned
activity. The existing player and its media session continue. Exact adds no
remote actions or automatic entry. A release APK declares PiP support when
its plan includes a video and a request command. An unlocked development
APK also declares support so a live edit can add the command. The flag
allows the activity to enter PiP when asked. An app that never requests
it stays in its ordinary window.
Is this helpful
Last updated November 30, 2026