mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
56 lines
2.0 KiB
Swift
56 lines
2.0 KiB
Swift
extension OnboardingAISetupModel {
|
|
enum ConfiguredGatewayBlocker: Equatable {
|
|
case unavailable
|
|
case authentication(RemoteGatewayAuthIssue)
|
|
}
|
|
|
|
var configuredGatewayProbeUnavailable: Bool {
|
|
self.configuredGatewayBlocker == .unavailable
|
|
}
|
|
|
|
var configuredGatewayAuthIssue: RemoteGatewayAuthIssue? {
|
|
guard case let .authentication(issue) = self.configuredGatewayBlocker else { return nil }
|
|
return issue
|
|
}
|
|
|
|
func showConfiguredGatewayProbeUnavailable(
|
|
summary: String = "The Gateway did not answer the inference check. Nothing was changed.")
|
|
{
|
|
guard !self.ownsInferenceTransition ||
|
|
self.configuredGatewayBlocker != nil ||
|
|
self.waitingForPendingActivationDeadline
|
|
else { return }
|
|
// Retire stale candidates and `started` state. A later successful
|
|
// missing-model probe must be able to run a fresh detect/activate flow.
|
|
self.resetForGatewayChange(clearPendingHandoff: false)
|
|
self.updateConfiguredGatewayBlockerState(
|
|
.unavailable,
|
|
phase: .ready,
|
|
detectError: Failure(summary: summary, detail: nil))
|
|
}
|
|
|
|
func showConfiguredGatewayAuthIssue(_ issue: RemoteGatewayAuthIssue) {
|
|
guard !self.ownsInferenceTransition ||
|
|
self.configuredGatewayBlocker != nil ||
|
|
self.waitingForPendingActivationDeadline
|
|
else { return }
|
|
self.enterGatewayAuthBlocker(issue)
|
|
}
|
|
|
|
func beginConfiguredGatewayProbeRetry() {
|
|
guard self.configuredGatewayBlocker != nil else { return }
|
|
self.updateConfiguredGatewayBlockerState(
|
|
self.configuredGatewayBlocker,
|
|
phase: .detecting,
|
|
detectError: nil)
|
|
}
|
|
|
|
func enterGatewayAuthBlocker(_ issue: RemoteGatewayAuthIssue) {
|
|
self.resetForGatewayChange(clearPendingHandoff: false)
|
|
self.updateConfiguredGatewayBlockerState(
|
|
.authentication(issue),
|
|
phase: .ready,
|
|
detectError: nil)
|
|
}
|
|
}
|