@@ -33,6 +33,10 @@ final class CommandModeService: ObservableObject {
3333 self . loadCurrentChatFromStore ( )
3434 }
3535
36+ private var shouldSyncCommandNotchState : Bool {
37+ self . enableNotchOutput && NotchOverlayManager . shared. shouldSyncCommandConversationToNotch
38+ }
39+
3640 private func loadCurrentChatFromStore( ) {
3741 if let session = chatStore. currentSession {
3842 self . currentChatID = session. id
@@ -278,6 +282,10 @@ final class CommandModeService: ObservableObject {
278282
279283 /// Sync conversation history to NotchContentState
280284 private func syncToNotchState( ) {
285+ guard self . shouldSyncCommandNotchState else {
286+ return
287+ }
288+
281289 NotchContentState . shared. clearCommandOutput ( )
282290
283291 for msg in self . conversationHistory {
@@ -308,7 +316,7 @@ final class CommandModeService: ObservableObject {
308316 self . saveCurrentChat ( )
309317
310318 // Push to notch
311- if self . enableNotchOutput {
319+ if self . shouldSyncCommandNotchState {
312320 NotchContentState . shared. addCommandMessage ( role: . user, content: text)
313321 NotchContentState . shared. setCommandProcessing ( true )
314322 }
@@ -322,14 +330,18 @@ final class CommandModeService: ObservableObject {
322330
323331 // Add to both histories
324332 self . conversationHistory. append ( Message ( role: . user, content: text) )
325- NotchContentState . shared. addCommandMessage ( role: . user, content: text)
333+ if self . shouldSyncCommandNotchState {
334+ NotchContentState . shared. addCommandMessage ( role: . user, content: text)
335+ }
326336
327337 // Auto-save after adding user message
328338 self . saveCurrentChat ( )
329339
330340 self . isProcessing = true
331341 self . didRequireConfirmationThisRun = false
332- NotchContentState . shared. setCommandProcessing ( true )
342+ if self . shouldSyncCommandNotchState {
343+ NotchContentState . shared. setCommandProcessing ( true )
344+ }
333345
334346 await self . processNextTurn ( )
335347 }
@@ -374,7 +386,7 @@ final class CommandModeService: ObservableObject {
374386 self . captureCommandRunCompleted ( success: false )
375387
376388 // Push to notch
377- if self . enableNotchOutput {
389+ if self . shouldSyncCommandNotchState {
378390 NotchContentState . shared. addCommandMessage ( role: . assistant, content: errorMsg)
379391 NotchContentState . shared. setCommandProcessing ( false )
380392 self . showExpandedNotchIfNeeded ( )
@@ -386,7 +398,7 @@ final class CommandModeService: ObservableObject {
386398 self . currentStep = . thinking( " Analyzing... " )
387399
388400 // Push status to notch
389- if self . enableNotchOutput {
401+ if self . shouldSyncCommandNotchState {
390402 NotchContentState . shared. addCommandMessage ( role: . status, content: " Thinking... " )
391403 }
392404
@@ -414,7 +426,7 @@ final class CommandModeService: ObservableObject {
414426 ) )
415427
416428 // Push step to notch
417- if self . enableNotchOutput {
429+ if self . shouldSyncCommandNotchState {
418430 let statusText = tc. purpose ?? self . stepDescription ( for: stepType)
419431 NotchContentState . shared. addCommandMessage ( role: . status, content: statusText)
420432 }
@@ -432,7 +444,7 @@ final class CommandModeService: ObservableObject {
432444 self . currentStep = nil
433445
434446 // Push confirmation needed to notch
435- if self . enableNotchOutput {
447+ if self . shouldSyncCommandNotchState {
436448 NotchContentState . shared. addCommandMessage ( role: . status, content: " ⚠️ Confirmation needed in Command Mode window " )
437449 NotchContentState . shared. setCommandProcessing ( false )
438450 }
@@ -464,7 +476,7 @@ final class CommandModeService: ObservableObject {
464476 self . captureCommandRunCompleted ( success: isFinal)
465477
466478 // Push final response to notch and show expanded view
467- if self . enableNotchOutput {
479+ if self . shouldSyncCommandNotchState {
468480 NotchContentState . shared. updateCommandStreamingText ( " " ) // Clear streaming
469481 NotchContentState . shared. addCommandMessage ( role: . assistant, content: response. content)
470482 NotchContentState . shared. setCommandProcessing ( false )
@@ -488,7 +500,7 @@ final class CommandModeService: ObservableObject {
488500 self . captureCommandRunCompleted ( success: false )
489501
490502 // Push error to notch
491- if self . enableNotchOutput {
503+ if self . shouldSyncCommandNotchState {
492504 NotchContentState . shared. addCommandMessage ( role: . assistant, content: errorMsg)
493505 NotchContentState . shared. setCommandProcessing ( false )
494506 self . showExpandedNotchIfNeeded ( )
@@ -530,7 +542,8 @@ final class CommandModeService: ObservableObject {
530542
531543 /// Show expanded notch output if there's content to display
532544 private func showExpandedNotchIfNeeded( ) {
533- guard self . enableNotchOutput else { return }
545+ guard self . shouldSyncCommandNotchState else { return }
546+ guard NotchOverlayManager . shared. canShowExpandedCommandOutput else { return }
534547 guard !NotchContentState. shared. commandConversationHistory. isEmpty else { return }
535548
536549 // Show the expanded notch
@@ -913,7 +926,7 @@ final class CommandModeService: ObservableObject {
913926 self . streamingText = fullContent
914927
915928 // Push to notch for real-time display
916- if self . enableNotchOutput {
929+ if self . shouldSyncCommandNotchState {
917930 NotchContentState . shared. updateCommandStreamingText ( fullContent)
918931 }
919932 }
@@ -929,7 +942,7 @@ final class CommandModeService: ObservableObject {
929942 let fullContent = self . streamingBuffer. joined ( )
930943 if !fullContent. isEmpty {
931944 self . streamingText = fullContent
932- if self . enableNotchOutput {
945+ if self . shouldSyncCommandNotchState {
933946 NotchContentState . shared. updateCommandStreamingText ( fullContent)
934947 }
935948 }
@@ -946,7 +959,7 @@ final class CommandModeService: ObservableObject {
946959 self . thinkingBuffer = [ ] // Clear thinking buffer
947960
948961 // Clear notch streaming text as well
949- if self . enableNotchOutput {
962+ if self . shouldSyncCommandNotchState {
950963 NotchContentState . shared. updateCommandStreamingText ( " " )
951964 }
952965
0 commit comments