Move connection policy out of ProAccess, keep terminal uploads with their session, and share question interaction and highlight editing operations. Consolidate CPU usage and settings snapshot handling, and remove obsolete terminal selection, theme helpers, and hard-coded latest-schema assertions. Fix draining connection-pool recovery and stale pane upload bindings. Keep screenshot matrices opt-in and retain behavioral migration coverage. Validation: 2468 macOS tests passed serially, 31 iOS tests passed, and both SSH forwarding regressions passed against the local OpenSSH fixture. Both app builds, Swift formatting, AppStrings, and Chinese localization checks passed. Parallel test runs still exhibit intermittent timeouts.
44 lines
1.5 KiB
Swift
44 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
/// Coordinates one question surface without duplicating the conversation's answers or request queue.
|
|
@Observable
|
|
@MainActor
|
|
public final class UserInputInteractionModel {
|
|
public let speech: UserInputSpeechSession
|
|
|
|
public init(speech: UserInputSpeechSession = UserInputSpeechSession()) {
|
|
self.speech = speech
|
|
}
|
|
|
|
public func canAdvance(in conversation: ConversationModel) -> Bool {
|
|
conversation.canAdvanceUserInput && !speech.isActive
|
|
}
|
|
|
|
public func advance(in conversation: ConversationModel, questionID: String? = nil) {
|
|
guard canAdvance(in: conversation),
|
|
questionID == nil || conversation.currentUserInputQuestion?.id == questionID
|
|
else { return }
|
|
conversation.advanceUserInputQuestion()
|
|
}
|
|
|
|
public func selectOption(_ optionID: String, in questionID: String, conversation: ConversationModel) {
|
|
guard !speech.isActive, conversation.currentUserInputQuestion?.id == questionID else { return }
|
|
conversation.answerUserInputOption(optionID, in: questionID)
|
|
}
|
|
|
|
public func previous(in conversation: ConversationModel) {
|
|
speech.cancel()
|
|
conversation.previousUserInputQuestion()
|
|
}
|
|
|
|
public func skip(in conversation: ConversationModel) {
|
|
speech.cancel()
|
|
conversation.skipUserInputQuestion()
|
|
}
|
|
|
|
public func cancelRequest(in conversation: ConversationModel) {
|
|
speech.cancel()
|
|
conversation.cancelUserInput()
|
|
}
|
|
}
|