Skip to content

API Reference

Jim Daley edited this page May 1, 2026 · 3 revisions

API Reference

This page summarizes the public runtime surface. It is not a replacement for source-level API documentation, but it is the fastest way to find the right type.

Core Runtime

Type Purpose
ForsettiRuntime Top-level runtime facade for boot, shutdown, routing, event bus, UI surface manager, and module manager access.
ModuleManager Discovers, activates, deactivates, restores, persists, and manages the active UI module.
ManifestLoader Loads and validates bundled manifest JSON files.
CompatibilityChecker Produces compatibility reports from manifest, platform, version, and capability policy.
ModuleRegistry Registers entryPoint factories and creates module instances.
UISurfaceManager Publishes merged toolbar items, view injections, overlay schema, and theme mask state.

Module Contracts

Type Purpose
ForsettiModule Base lifecycle protocol for all modules.
ForsettiUIModule UI module protocol with uiContributions.
ForsettiAppModule Specialized UI module for complete single-app modules.
ModuleDescriptor Runtime identity snapshot for a module.
ModuleManifest JSON-backed activation contract.
ModuleType service, ui, or app.

Policy and Entitlements

Type Purpose
CapabilityPolicy Evaluates requested capabilities.
AllowAllCapabilityPolicy Allows capabilities except runtime-reserved denials.
FixedCapabilityPolicy Allows only configured capabilities.
CapabilityScopedServiceProvider Wraps host services so modules can resolve only services covered by granted capabilities.
ForsettiEntitlementProvider Asynchronous unlock, refresh, restore, and change-stream contract.
AllowAllEntitlementProvider Unlocks all modules.
StaticEntitlementProvider Unlocks configured module or product IDs.
StoreKit2EntitlementProvider StoreKit-backed entitlement provider where StoreKit is available.

UI Contribution Types

Type Purpose
UIContributions Container for theme mask, toolbar items, view injections, and overlay schema.
ToolbarItemDescriptor Toolbar item title/icon/action.
ToolbarAction Navigate, open overlay, or publish event.
ViewInjectionDescriptor Slot, view ID, and priority for injected UI.
OverlaySchema Pointer and route collection.
NavigationPointer Named pointer to a base destination.
OverlayRoute Route path and destination.
OverlayDestination Base destination or module overlay destination.

Services, Events, and Diagnostics

Type Purpose
ForsettiContext Module access point for services, events, logging, and routing.
ForsettiServiceProviding Service resolver protocol.
ForsettiServiceContainer Type-keyed service registry.
ForsettiEventBus Publish/subscribe event contract.
InMemoryEventBus In-memory event implementation.
ForsettiEvent Event type, payload, source module ID, and timestamp.
SubscriptionToken Event subscription cancellation token.
ForsettiLogger Logging abstraction.
ConsoleForsettiLogger Debug console logger.
ModuleCommunicationGuard Policy gate for module-to-module messaging.
KeychainSecureStorageService Platform secure storage default backed by Keychain where available.
OSLogForsettiLogger Platform logger backed by OSLog where available.
LocalFileExportService Local export service that sanitizes suggested filenames and writes inside its configured directory.

Host Template Types

Type Purpose
ForsettiHostController Observable controller for boot, module lists, activation, selection, purchase restore, toolbar actions, and errors.
ForsettiLaunchActivationStrategy Explicit launch policy: restore only, activate all eligible for development, or activate specific module IDs.
ForsettiHostRootView Reusable SwiftUI host shell.
ForsettiHostTemplateBootstrap Factory helpers for host controller/runtime wiring.
ForsettiHostOverlayRouter Overlay route and pointer resolver for host template surfaces.
ForsettiViewInjectionRegistry Maps viewID strings to SwiftUI AnyView builders.

Activation Call Graph

flowchart TD
    Runtime["ForsettiRuntime.boot"] --> Loader["ManifestLoader"]
    Runtime --> Manager["ModuleManager"]
    Manager --> Checker["CompatibilityChecker"]
    Manager --> Entitlements["ForsettiEntitlementProvider"]
    Manager --> Registry["ModuleRegistry"]
    Registry --> Module["ForsettiModule"]
    Module --> Context["ForsettiContext"]
    Manager --> Surface["UISurfaceManager"]
Loading

Clone this wiki locally