ACL persistence (save/load ACL state).
Auth state and signing.
NIP-5D path: getUserPubkey() provides the shell user's identity (not napplet's). getSigner() is the primary concern — used for proxied signing operations from napplets.
OptionalcacheLocal event cache (worker relay). Optional when a 'cache' or 'relay' (coordinated) service is registered. If neither adapter nor service are provided, cache functionality is unavailable.
Runtime configuration.
Crypto operations (signature verification, random UUID).
OptionaldmDM sending (optional).
OptionalfirewallFirewall config persistence (save/load firewall config). When absent, firewall config is in-memory only and resets on reload. Only the config is persisted; ephemeral counters are never stored.
OptionalgetReturns the current focus state for a napplet window.
When absent, defaults to { focused: true } — a host without a window
manager treats everything as focused, so focus never tightens rate budgets.
Focus alone never hard-blocks; it only scales token refill rates.
The napplet window to query focus state for.
Current focus state and optional milliseconds since last focus gain.
OptionalguidGUID persistence for iframe instance tracking (optional — if absent, GUIDs are in-memory only).
OptionalhashHash verification (optional — if absent, hash verification is skipped).
Hotkey dispatch.
Manifest cache persistence.
OptionalonCalled on every ACL enforcement check (audit).
OptionalonCalled when a napplet's required services are not fully available. Receives a CompatibilityReport with available/missing services. In strict mode, the runtime blocks the napplet from loading. In permissive mode (default), the napplet loads and the host decides UX.
OptionalonCalled on every firewall evaluation that results in an audit-level decision (flag, block, or prompt). When absent, firewall decisions are not audited.
OptionalonCalled when aggregate hash verification fails (computed != declared). Host app should display a user-visible warning.
OptionalonCalled when a pending napp update is set or cleared.
Relay configuration.
OptionalrelayRelay pool operations. Optional when a 'relay' or 'relay-pool' service is registered via RuntimeAdapter.services or runtime.registerService(). If neither adapter nor service are provided, relay functionality is unavailable.
Send a NIP-01 message to a napplet by windowId.
OptionalservicesOptional service extensions. Shell/host registers service handlers here for static initialization. Services can also be added dynamically via runtime.registerService(). Each key is a service name (e.g., 'audio').
OptionalshellShell secret persistence (for deterministic keypair derivation).
Napplet state storage.
OptionalstrictWhen true, missing required services block napplet loading. When false or omitted (default), napplets load with a warning.
Window management.
OptionalgetOptional runtime behavior overrides — demo/debug use only. Called lazily on each relevant operation (replay check, buffer push), so changes take effect immediately without runtime recreation.
All adapters that the runtime requires from the host environment.
This is the primary integration point. A browser shell implements these by wrapping postMessage, localStorage, and relay pool libraries. A CLI or server shell could implement them with host bridge channels, file storage, and direct WebSocket connections.
Example