native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
Swift
1234567891011121314151617181920212223242526272829303132333435363738394041424344import SwiftUI
/// The persisted override and its runtime fallback. Keeping this value separate/// from `TabIconSource` leaves `AgentProfile` free of terminal-view concerns.struct AgentProfileIconSource: Equatable, Hashable, Sendable { let overrideSymbol: String? let runtime: AgentProfileRuntime
init(profile: AgentProfile) { overrideSymbol = profile.icon runtime = profile.runtime }}
extension AgentProfile { var iconSource: AgentProfileIconSource { AgentProfileIconSource(profile: self) }}enum AgentProfileIconResolver { static func source(for iconSource: AgentProfileIconSource) -> TabIconSource { if let overrideSymbol = iconSource.overrideSymbol?.trimmingCharacters(in: .whitespacesAndNewlines), !overrideSymbol.isEmpty { return TabIconSource(systemSymbol: overrideSymbol) }
return CommandIconMap.iconForFirstToken(iconSource.runtime.iconLookupToken) ?? TabIconSource(systemSymbol: "sparkles") }}
struct AgentProfileIconImage: View { let source: AgentProfileIconSource let pointSize: CGFloat
var body: some View { TabIconImage( rawName: AgentProfileIconResolver.source(for: source).storageString, pointSize: pointSize ) }}