The data module runtime (Hermes)
Where app.ts runs on each host, how it is built, which web APIs exist and which are missing, and how the app's code adapts to each constraint.

The app's TypeScript, app.ts and everything under src/, is the data module. On an iPhone it runs inside a lean Hermes virtual machine that Exact embeds. That engine is not a browser and not Node, and the differences explain many choices in the code. For what the module contains, see The data module.

Where it runs

Host

Engine

Notes

iOS (simulator and device)

Hermes, bytecode only

Loaded after the first pixel. "Until then every answer is Unavailable" (js/src/lib.rs), so resources show their else empty() value first

Web host

The browser's own engine

Used for development and tests only, see The web host for development

bun test

Bun

Unit tests import the sources directly, see Bun unit tests

Build

Exact type-checks app.ts in strict mode (ES2023 target, WebWorker web APIs, never the DOM's UI types), bundles it with Rolldown into one script and compiles it with hermesc to bytecode (reference, producer). The heap ceiling is DEFAULT_MAX_HEAP = 64 << 20, 64 MiB (js/src/lib.rs). A module load over 50 ms is journalled, so top-level work should stay cheap.

What exists and what is missing

From Exact's table of what a data module can use:

Available

Missing or refused

fetch, Headers, Response, grant-checked

The DOM (document, window)

TextEncoder, TextDecoder, URL, URLSearchParams, atob, btoa

WebAssembly, so no Argon2id

crypto.getRandomValues, crypto.randomUUID, inside an answer

Most of crypto.subtle: only SHA digests and ECDSA P-256

setTimeout, AbortController, inside an answer

An ambient clock: Date.now(), new Date() and Math.random() refuse

scheduler.yield()

scheduler.postTask, Node built-ins (fs, Buffer)

Intl.NumberFormat, Intl.DateTimeFormat with an explicit timestamp

Intl.PluralRules, RelativeTimeFormat, ListFormat

console, read through the driver's logs

Dynamic code (new Function), per the app's own finding below

How the app adapts

Constraint

What the code does

Source

No Ed25519, HKDF or XChaCha20 in crypto.subtle

Pure JavaScript @noble and @scure libraries

primitives.ts L1-L9, Crypto primitives

No WASM

Password-protected .seedkey files are refused and there is no master password: "needs Argon2id (WASM), which Hermes cannot run"

seedkey.ts L9-L11

No ambient clock

Time is a source argument. The contract passes time.epochAtZero + performanceNow(). That value is fractional, so wireTimestamp floors it before signing

app.contract L343, primitives.ts L192-L199

Hardened prototypes

"Exact hardens Error.prototype; define an own property rather than assigning through it." Error subclasses set name with Object.defineProperty

vault/api.ts L19-L27, test at vault.test.ts L85-L98

Timers wait for fetch

"Source timers only run after native fetch settles", so every request passes exactTimeout (milliseconds, real time, enforced by the host) instead of racing a setTimeout

me/sources.ts L23-L29, read/client.ts L10-L15, vault/api.ts L76-L81

Long-lived connections

A source returns fetch(wsUrl, {exactStream: map}). The mapper turns each socket event into the resource's next value

agents/sources.ts L134-L136, Agents streams

Dynamic code refused

"Exact rejects superjson's is-what dependency (dynamic Function constructor)", so the superjson envelope is decoded by hand

superjson.ts L1-L3, Read client

Node fast paths in codecs

CBOR and gzip are a vendored browser-only bundle

Vendored codecs

100 ms per turn

Yields between crypto steps

The 100 ms turn budget

Quadratic work is costly

"Linear traversal accepts newest-first histories without recursion or quadratic work on Hermes"

profile/load.ts L47

Timeouts in use: 15 s for site reads, publishing and notify, 5 s for unauthenticated vault calls, 20 s for authenticated ones (vault/api.ts L12-L14). The signed POST to the agents server passes no exactTimeout (agents/sources.ts L71-L79).

Answers must match their shape exactly

"An answer is held to its shape exactly: a field the shape does not declare, at any depth, fails the resource as a thrown error does" (guide). TypeScript lets a spread through, so sources build replies field by field. A failed read should throw so Exact keeps the previous answer on screen. A mutation may instead return a shaped refusal such as {ok: false, error, value: ''} (me/sources.ts L19-L21).

npm import rules

The module "imports its own .ts/.js and pure-JS npm packages (ESM or CommonJS, a browser build first); one needing Node (fs, Buffer), the DOM or a native addon is refused by name" (start-here). grants must be literal because "the build reads them without running the module" (app.ts L3). The runtime also proves itself: crypto.test.contract runs a signing and encryption self-test inside the host engine, see Parity vectors.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Attributes
name
The data module runtime (Hermes)
summary
Where app.ts runs on each host, how it is built, which web APIs exist and which are missing, and how the app's code adapts to each constraint.