The Runtime
The Runtime is the authoritative entry point for all application functionality in an FDK client.
Responsibilities
- Global Entry Point: Handles all high-level commands, such as opening projects or connecting to the cloud.
- State Management: Owns the versioned state storage and provides the only path to access or mutate it.
- Async Coordination: Manages the execution of all asynchronous work to prevent race conditions.
- Undo/Redo: Orchestrates the undo and redo stack, ensuring consistency even during active async operations.
- Tool Lifecycle: Manages the starting and stopping of tools, ensuring only one tool is active at a time to prevent state conflicts.
Exclusive Execution
To ensure robustness and prevent race conditions, all calls into the runtime are executed exclusively. Only one asynchronous Statement can be running at a given time.
UI and Extensions Integration
The Runtime’s statement-based architecture enables several key features:
- Action Search: Since every action the user can perform through the UI is a callable Statement, features like search-based action menus can be built easily.
- Runtime Extensions: Runtime Extensions are built directly on top of the Runtime, allowing third-party WASM scripts to execute Statements and interact with the project state in a sandboxed environment.
- Macros and Scripting: Because the Runtime coordinates serializable Statements, user actions can be recorded into macros or manually scripted for automation.