Sogon architecture — layers and call direction

Sogon architecture — layers and call direction An architecture diagram generated by Archify. SogonAppDelegate · owns surfaces · wiring · Architecture component SogonAppDelegate owns surfaces · wiring Views · popover · settings · Voice Bar · glyph · Architecture component Views popover · settings · Voice Bar · glyph AppState · @MainActor central state · Architecture component AppState @MainActor central state RecordingCoordinator · single orchestrator · Architecture component RecordingCoordinator single orchestrator Audio · shared mic · segments · Services — they do not know the order Audio shared mic · segments STT · LLM · swapped by protocol · Services — they do not know the order STT · LLM swapped by protocol Recording · sessions · assembly · speakers · Services — they do not know the order Recording sessions · assembly · speakers TextInsertion · accessibility · context restore · Services — they do not know the order TextInsertion accessibility · context restore Models · pure decisions · no side effects · Architecture component Models pure decisions · no side effects observes wires projects state delegates the decision Services — they do not know the order Legend Frontend Backend Database Security External

Three principles

  • • State lives in AppState alone and every surface observes it — views read, and side effects go to injected closures
  • • RecordingCoordinator orchestrates the pipeline — a service does one job and does not know which stage follows it
  • • Whatever is swappable is a protocol — tests put a mock behind the same one

Isolation rules

  • • @MainActor is the default everywhere
  • • Only code running on a real-time thread, such as an audio callback, is pulled out as a nonisolated static pure function
  • • Apply the target state every time rather than comparing with the previous value — coalesced notifications make the comparison miss a real change

What the pure models hold

  • • SpeakerAlignment — anchor matching · speaker per sentence · line break on a pause
  • • SpeakerAttributionResult — speaker names, valid only inside their session
  • • TextChunking — splits long text by line
  • • UpdateCheckSchedule — decides on time since the last check, not a timer
  • • AppSettings — persists in UserDefaults and AppState propagates it