refactor(macos): dedupe UI, pairing, and runtime helpers

This commit is contained in:
Peter Steinberger
2026-03-02 11:32:04 +00:00
parent cd011897d0
commit cf67e374c0
92 changed files with 1769 additions and 1802 deletions

View File

@@ -113,17 +113,15 @@ final class WorkActivityStore {
private func setJobActive(_ activity: Activity) {
self.jobs[activity.sessionKey] = activity
// Main session preempts immediately.
if activity.role == .main {
self.currentSessionKey = activity.sessionKey
} else if self.currentSessionKey == nil || !self.isActive(sessionKey: self.currentSessionKey!) {
self.currentSessionKey = activity.sessionKey
}
self.refreshDerivedState()
self.updateCurrentSession(with: activity)
}
private func setToolActive(_ activity: Activity) {
self.tools[activity.sessionKey] = activity
self.updateCurrentSession(with: activity)
}
private func updateCurrentSession(with activity: Activity) {
// Main session preempts immediately.
if activity.role == .main {
self.currentSessionKey = activity.sessionKey