mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-01-31 19:37:45 +01:00
16 lines
533 B
Swift
16 lines
533 B
Swift
import Foundation
|
|
|
|
enum SessionKey {
|
|
static func normalizeMainKey(_ raw: String?) -> String {
|
|
let trimmed = (raw ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
|
|
return trimmed.isEmpty ? "main" : trimmed
|
|
}
|
|
|
|
static func isCanonicalMainSessionKey(_ value: String?) -> Bool {
|
|
let trimmed = (value ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if trimmed.isEmpty { return false }
|
|
if trimmed == "global" { return true }
|
|
return trimmed.hasPrefix("agent:")
|
|
}
|
|
}
|