Application Layer
Application Layer
Section titled “Application Layer”rim-application sits between pure editor logic and runtime adapters.
Responsibilities
Section titled “Responsibilities”- dispatch
AppAction - coordinate domain transitions and port calls
- own
WorkbenchState - manage config application
- handle save, reload, session, undo-history, and swap workflows
- translate domain outcomes into user-visible messages
State Split
Section titled “State Split”RimState is now an explicit aggregate:
editor: EditorStateworkbench: WorkbenchState
WorkbenchState owns:
- overlays
- command line and palette state
- picker state and caches
- status bar
- notifications
- config-driven command registry
- pending save/reload/swap/session workflow flags
flowchart TD RimState["RimState"] --> Editor["EditorState (domain)"] RimState --> Workbench["WorkbenchState (application)"] Workbench --> Overlay["overlays"] Workbench --> Picker["picker state"] Workbench --> Notifications["notifications"] Workbench --> Status["status bar"] Workbench --> Registry["command registry"]How Use Cases Work
Section titled “How Use Cases Work”Typical application logic follows this pattern:
- receive an
AppAction - call a pure domain transition if needed
- update workbench state
- enqueue external work through a port
- convert async callbacks back into
AppAction
That shape is deliberate. It makes side effects visible without pushing them into the domain.
What Should Stay Here
Section titled “What Should Stay Here”- command handling
- overlay/picker behavior
- config loading and reload responses
- status message policy
- swap and history orchestration
- file-open and workspace-file-preview flows
What Should Move Down If Added Here By Accident
Section titled “What Should Move Down If Added Here By Accident”- buffer mutation rules
- cursor/selection math
- tab/window layout transitions that do not need viewport decisions
- session reconstruction logic
Anti-Patterns
Section titled “Anti-Patterns”- duplicating domain transitions in action handlers
- storing business rules in notification logic
- letting workbench flags become a second editor model