Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GooseSwift/CodexEmbeddedAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ actor CodexSelfContainedAuthClient {
try await Task.sleep(for: .seconds(max(deviceCode.interval, 1)))
}
}
throw CodexSelfContainedAuthError.invalidResponse("Device code login timed out after 15 minutes.")
throw CodexSelfContainedAuthError.invalidResponse("Device code login timed out after \(maxDeviceCodeWaitSeconds / 60) minutes.")
}

private func exchangeCodeForTokens(_ code: CodexDeviceTokenPollResponse) async throws -> CodexTokenExchangeResponse {
Expand Down
99 changes: 39 additions & 60 deletions GooseSwift/GooseAppModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,66 +192,26 @@ final class GooseAppModel: ObservableObject {
return processInfo.arguments.contains("--goose-start-respiratory-packet-watch")
|| processInfo.environment["GOOSE_START_RESPIRATORY_PACKET_WATCH"] == "1"
}()
let autoStartHealthPacketCaptureDuration: TimeInterval = {
let processInfo = ProcessInfo.processInfo
if let value = processInfo.environment["GOOSE_HEALTH_PACKET_CAPTURE_DURATION_SECONDS"],
let seconds = Double(value),
seconds > 0 {
return seconds
}
let prefix = "--goose-health-packet-capture-duration="
if let argument = processInfo.arguments.first(where: { $0.hasPrefix(prefix) }),
let seconds = Double(argument.dropFirst(prefix.count)),
seconds > 0 {
return seconds
}
return 30 * 60
}()
let autoStartTemperaturePacketCaptureDuration: TimeInterval = {
let processInfo = ProcessInfo.processInfo
if let value = processInfo.environment["GOOSE_TEMPERATURE_PACKET_CAPTURE_DURATION_SECONDS"],
let seconds = Double(value),
seconds > 0 {
return seconds
}
let prefix = "--goose-temperature-packet-capture-duration="
if let argument = processInfo.arguments.first(where: { $0.hasPrefix(prefix) }),
let seconds = Double(argument.dropFirst(prefix.count)),
seconds > 0 {
return seconds
}
return 10 * 60
}()
let autoStartPhysiologyPacketCaptureDuration: TimeInterval = {
let processInfo = ProcessInfo.processInfo
if let value = processInfo.environment["GOOSE_PHYSIOLOGY_PACKET_CAPTURE_DURATION_SECONDS"],
let seconds = Double(value),
seconds > 0 {
return seconds
}
let prefix = "--goose-physiology-packet-capture-duration="
if let argument = processInfo.arguments.first(where: { $0.hasPrefix(prefix) }),
let seconds = Double(argument.dropFirst(prefix.count)),
seconds > 0 {
return seconds
}
return 30 * 60
}()
let autoStartRespiratoryPacketWatchDuration: TimeInterval = {
let processInfo = ProcessInfo.processInfo
if let value = processInfo.environment["GOOSE_RESPIRATORY_PACKET_WATCH_DURATION_SECONDS"],
let seconds = Double(value),
seconds > 0 {
return seconds
}
let prefix = "--goose-respiratory-packet-watch-duration="
if let argument = processInfo.arguments.first(where: { $0.hasPrefix(prefix) }),
let seconds = Double(argument.dropFirst(prefix.count)),
seconds > 0 {
return seconds
}
return 10 * 60
}()
let autoStartHealthPacketCaptureDuration: TimeInterval = GooseAppModel.durationFromEnvironment(
envVar: "GOOSE_HEALTH_PACKET_CAPTURE_DURATION_SECONDS",
cliPrefix: "--goose-health-packet-capture-duration=",
fallback: 30 * 60
)
let autoStartTemperaturePacketCaptureDuration: TimeInterval = GooseAppModel.durationFromEnvironment(
envVar: "GOOSE_TEMPERATURE_PACKET_CAPTURE_DURATION_SECONDS",
cliPrefix: "--goose-temperature-packet-capture-duration=",
fallback: 10 * 60
)
let autoStartPhysiologyPacketCaptureDuration: TimeInterval = GooseAppModel.durationFromEnvironment(
envVar: "GOOSE_PHYSIOLOGY_PACKET_CAPTURE_DURATION_SECONDS",
cliPrefix: "--goose-physiology-packet-capture-duration=",
fallback: 30 * 60
)
let autoStartRespiratoryPacketWatchDuration: TimeInterval = GooseAppModel.durationFromEnvironment(
envVar: "GOOSE_RESPIRATORY_PACKET_WATCH_DURATION_SECONDS",
cliPrefix: "--goose-respiratory-packet-watch-duration=",
fallback: 10 * 60
)
let autoSyncHistoryDuringPhysiologyCapture: Bool = {
let processInfo = ProcessInfo.processInfo
return processInfo.arguments.contains("--goose-sync-history-during-physiology-capture")
Expand Down Expand Up @@ -440,4 +400,23 @@ final class GooseAppModel: ObservableObject {
}
}

private nonisolated static func durationFromEnvironment(
envVar: String,
cliPrefix: String,
fallback: TimeInterval
) -> TimeInterval {
let processInfo = ProcessInfo.processInfo
if let value = processInfo.environment[envVar],
let seconds = Double(value),
seconds > 0 {
return seconds
}
if let argument = processInfo.arguments.first(where: { $0.hasPrefix(cliPrefix) }),
let seconds = Double(argument.dropFirst(cliPrefix.count)),
seconds > 0 {
return seconds
}
return fallback
}

}