Architecture & Action Coordinator
Architecture & InternalsArchitecture & Action Coordinator

Architecture & Action Coordinator

Pure Core domain framework separation, ActionCoordinator composition root, and 3-tier sorting.

Pure Core Boundary (Sources/Core)

OpenClip enforces a clean architectural separation between domain logic and platform presentations:

Sources/Core (Domain Framework)

Pure Swift

Pure Swift domain models, validation engine, action interfaces, and settings store. Zero AppKit or SwiftUI imports.

Sources/OpenClip (App Target)

AppKit / SwiftUI

Presentation layer, floating HUD panels, SwiftUI views, macOS runtimes, Accessibility monitors, and side-effects.

ActionCoordinator Composition Root

ActionCoordinator.swift is the application composition root. It registers built-in actions, subscribes to ExtensionManager file events, loads app rules from ~/.openclip/rules.json, and keeps the reactive ActionRegistry synchronized.

ActionRegistry & 3-Tier Sort Algorithm

The registry maintains an ordered action catalog using a deterministic 3-tier algorithm:

  • Tier 0 (User Customized): Explicit order defined in Preferences drag-and-drop reordering.
  • Tier 1 (Built-in Actions): Unordered core actions maintaining stable default order.
  • Tier 2 (Extension Actions): Unordered extensions maintaining discovery order.

Result Delivery Pipeline (Select → Probe → Toast)

When an action runs, ActionResultDelivery.resolve processes the outcome in three steps:

1. Select (Click Intent)

Secondary clicks (Right-click or Shift-click) automatically convert paste outcomes to copy operations.

2. Probe (Paste Availability)

If the destination application cannot accept paste input (via AX probe or app rule), the paste operation is downgraded safely to a copy.

3. Toast (Companion Feedback)

Emits a "Copied" checkmark toast whenever a paste was delivered as a copy or when definitions are extracted.