Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import CodexBarCore
import Foundation

/// Closed first-party bootstrap list. Runtime/plugin registrations remain owned by
/// `ProviderImplementationRegistry.register(_:)`.
enum ProviderImplementationManifest {
static let makeImplementations: [@Sendable () -> any ProviderImplementation] = [
{ CodexProviderImplementation() },
{ OpenAIAPIProviderImplementation() },
{ AzureOpenAIProviderImplementation() },
{ ClaudeProviderImplementation() },
{ ClinePassProviderImplementation() },
{ CursorProviderImplementation() },
{ OpenCodeProviderImplementation() },
{ OpenCodeGoProviderImplementation() },
{ AlibabaCodingPlanProviderImplementation() },
{ AlibabaTokenPlanProviderImplementation() },
{ QwenCloudProviderImplementation() },
{ FactoryProviderImplementation() },
{ GeminiProviderImplementation() },
{ AntigravityProviderImplementation() },
{ CopilotProviderImplementation() },
{ DevinProviderImplementation() },
{ ZaiProviderImplementation() },
{ MiniMaxProviderImplementation() },
{ ManusProviderImplementation() },
{ KimiProviderImplementation() },
{ KiloProviderImplementation() },
{ KiroProviderImplementation() },
{ VertexAIProviderImplementation() },
{ AugmentProviderImplementation() },
{ JetBrainsProviderImplementation() },
{ MoonshotProviderImplementation() },
{ AmpProviderImplementation() },
{ T3ChatProviderImplementation() },
{ OllamaProviderImplementation() },
{ SyntheticProviderImplementation() },
{ OpenRouterProviderImplementation() },
{ ElevenLabsProviderImplementation() },
{ WarpProviderImplementation() },
{ WindsurfProviderImplementation() },
{ ZedProviderImplementation() },
{ PerplexityProviderImplementation() },
{ MiMoProviderImplementation() },
{ DoubaoProviderImplementation() },
{ SakanaProviderImplementation() },
{ AbacusProviderImplementation() },
{ MistralProviderImplementation() },
{ DeepSeekProviderImplementation() },
{ DeepInfraProviderImplementation() },
{ CodebuffProviderImplementation() },
{ CrofProviderImplementation() },
{ VeniceProviderImplementation() },
{ CommandCodeProviderImplementation() },
{ QoderProviderImplementation() },
{ StepFunProviderImplementation() },
{ BedrockProviderImplementation() },
{ GrokProviderImplementation() },
{ GroqProviderImplementation() },
{ LLMProxyProviderImplementation() },
{ LiteLLMProviderImplementation() },
{ DeepgramProviderImplementation() },
{ PoeProviderImplementation() },
{ ChutesProviderImplementation() },
{ NeuralWattProviderImplementation() },
{ ClawRouterProviderImplementation() },
{ LongCatProviderImplementation() },
{ Sub2APIProviderImplementation() },
{ WayfinderProviderImplementation() },
{ ZenMuxProviderImplementation() },
{ AiAndProviderImplementation() },
{ ZoomMateProviderImplementation() },
{ XAIProviderImplementation() },
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,81 +10,9 @@ enum ProviderImplementationRegistry {
private static let lock = NSLock()
private static let store = Store()

// swiftlint:disable:next cyclomatic_complexity
private static func makeImplementation(for provider: UsageProvider) -> (any ProviderImplementation) {
switch provider {
case .codex: CodexProviderImplementation()
case .openai: OpenAIAPIProviderImplementation()
case .azureopenai: AzureOpenAIProviderImplementation()
case .claude: ClaudeProviderImplementation()
case .clinepass: ClinePassProviderImplementation()
case .cursor: CursorProviderImplementation()
case .opencode: OpenCodeProviderImplementation()
case .opencodego: OpenCodeGoProviderImplementation()
case .alibaba: AlibabaCodingPlanProviderImplementation()
case .alibabatokenplan: AlibabaTokenPlanProviderImplementation()
case .qwencloud: QwenCloudProviderImplementation()
case .factory: FactoryProviderImplementation()
case .gemini: GeminiProviderImplementation()
case .antigravity: AntigravityProviderImplementation()
case .copilot: CopilotProviderImplementation()
case .devin: DevinProviderImplementation()
case .zai: ZaiProviderImplementation()
case .minimax: MiniMaxProviderImplementation()
case .manus: ManusProviderImplementation()
case .kimi: KimiProviderImplementation()
case .kilo: KiloProviderImplementation()
case .kiro: KiroProviderImplementation()
case .vertexai: VertexAIProviderImplementation()
case .augment: AugmentProviderImplementation()
case .jetbrains: JetBrainsProviderImplementation()
case .moonshot: MoonshotProviderImplementation()
case .amp: AmpProviderImplementation()
case .t3chat: T3ChatProviderImplementation()
case .ollama: OllamaProviderImplementation()
case .synthetic: SyntheticProviderImplementation()
case .openrouter: OpenRouterProviderImplementation()
case .elevenlabs: ElevenLabsProviderImplementation()
case .warp: WarpProviderImplementation()
case .windsurf: WindsurfProviderImplementation()
case .zed: ZedProviderImplementation()
case .perplexity: PerplexityProviderImplementation()
case .mimo: MiMoProviderImplementation()
case .doubao: DoubaoProviderImplementation()
case .sakana: SakanaProviderImplementation()
case .abacus: AbacusProviderImplementation()
case .mistral: MistralProviderImplementation()
case .deepseek: DeepSeekProviderImplementation()
case .deepinfra: DeepInfraProviderImplementation()
case .codebuff: CodebuffProviderImplementation()
case .crof: CrofProviderImplementation()
case .venice: VeniceProviderImplementation()
case .commandcode: CommandCodeProviderImplementation()
case .qoder: QoderProviderImplementation()
case .stepfun: StepFunProviderImplementation()
case .bedrock: BedrockProviderImplementation()
case .grok: GrokProviderImplementation()
case .groq: GroqProviderImplementation()
case .llmproxy: LLMProxyProviderImplementation()
case .litellm: LiteLLMProviderImplementation()
case .deepgram: DeepgramProviderImplementation()
case .poe: PoeProviderImplementation()
case .chutes: ChutesProviderImplementation()
case .neuralwatt: NeuralWattProviderImplementation()
case .clawrouter: ClawRouterProviderImplementation()
case .longcat: LongCatProviderImplementation()
case .sub2api: Sub2APIProviderImplementation()
case .wayfinder: WayfinderProviderImplementation()
case .zenmux: ZenMuxProviderImplementation()
case .aiand: AiAndProviderImplementation()
case .zoommate: ZoomMateProviderImplementation()
case .xai: XAIProviderImplementation()
}
}

private static let bootstrap: Void = {
for provider in UsageProvider.allCases {
_ = ProviderImplementationRegistry.register(makeImplementation(for: provider))
for makeImplementation in ProviderImplementationManifest.makeImplementations {
_ = ProviderImplementationRegistry.register(makeImplementation())
}
}()

Expand Down Expand Up @@ -112,7 +40,9 @@ enum ProviderImplementationRegistry {

static func implementation(for id: UsageProvider) -> (any ProviderImplementation)? {
self.ensureBootstrapped()
if let found = self.store.byID[id] { return found }
if let found = self.store.byID[id] {
return found
}
return self.all.first(where: { $0.id == id })
}
}
7 changes: 1 addition & 6 deletions Sources/CodexBar/UsageStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1139,12 +1139,7 @@ extension UsageStore {
configToken: nil,
hasEnvToken: deepSeekHasEnvToken,
hasTokenAccount: deepSeekHasTokenAccount)
case .clinepass, .gemini, .antigravity, .opencode, .opencodego, .alibabatokenplan, .qwencloud, .factory,
.copilot, .devin, .vertexai, .kilo, .kiro, .kimi, .moonshot, .jetbrains, .perplexity,
.mimo, .doubao, .sakana, .abacus, .mistral, .deepinfra, .codebuff, .crof, .windsurf,
.venice, .manus, .commandcode, .qoder, .stepfun, .bedrock, .grok, .groq, .t3chat, .llmproxy,
.litellm, .zed, .deepgram, .poe, .chutes, .neuralwatt, .clawrouter, .longcat, .wayfinder,
.sub2api, .zenmux, .aiand, .zoommate, .xai:
default:
return unimplementedDebugLogMessages[provider] ?? "Debug log not yet implemented"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by Scripts/regenerate-codex-parser-hash.sh. Do not edit by hand.

enum CodexParserHash {
static let value = "dcab8c067490a89e"
static let value = "a72389ecaa16bc9a"
}
137 changes: 71 additions & 66 deletions Sources/CodexBarCore/Logging/LogCategories.swift
Original file line number Diff line number Diff line change
@@ -1,100 +1,105 @@
public enum LogCategories {
public static let abacusCookie = "abacus-cookie"
public static let abacusUsage = "abacus-usage"
public static func provider(_ provider: UsageProvider, scope: String? = nil) -> String {
let base = provider == .opencodego ? "opencode-go" : provider.rawValue
return scope.map { "\(base)-\($0)" } ?? base
}

public static let abacusCookie = Self.provider(.abacus, scope: "cookie")
public static let abacusUsage = Self.provider(.abacus, scope: "usage")
public static let adaptiveRefresh = "adaptive-refresh"
public static let amp = "amp"
public static let antigravity = "antigravity"
public static let amp = Self.provider(.amp)
public static let antigravity = Self.provider(.antigravity)
public static let app = "app"
public static let auggieCLI = "auggie-cli"
public static let augment = "augment"
public static let augmentKeepalive = "augment-keepalive"
public static let bedrockUsage = "bedrock-usage"
public static let augment = Self.provider(.augment)
public static let augmentKeepalive = Self.provider(.augment, scope: "keepalive")
public static let bedrockUsage = Self.provider(.bedrock, scope: "usage")
public static let browserCookieGate = "browser-cookie-gate"
public static let claudeCLI = "claude-cli"
public static let claudeProbe = "claude-probe"
public static let claudeUsage = "claude-usage"
public static let codexRPC = "codex-rpc"
public static let commandcodeCookie = "commandcode-cookie"
public static let commandcodeUsage = "commandcode-usage"
public static let claudeCLI = Self.provider(.claude, scope: "cli")
public static let claudeProbe = Self.provider(.claude, scope: "probe")
public static let claudeUsage = Self.provider(.claude, scope: "usage")
public static let codexRPC = Self.provider(.codex, scope: "rpc")
public static let commandcodeCookie = Self.provider(.commandcode, scope: "cookie")
public static let commandcodeUsage = Self.provider(.commandcode, scope: "usage")
public static let configMigration = "config-migration"
public static let configStore = "config-store"
public static let confetti = "confetti"
public static let cookieCache = "cookie-cache"
public static let cookieHeaderStore = "cookie-header-store"
public static let copilotTokenStore = "copilot-token-store"
public static let copilotTokenStore = Self.provider(.copilot, scope: "token-store")
public static let creditsPurchase = "creditsPurchase"
public static let cursorLogin = "cursor-login"
public static let deepSeekSettings = "deepseek-settings"
public static let deepSeekUsage = "deepseek-usage"
public static let deepgramUsage = "deepgram-usage"
public static let devin = "devin"
public static let doubaoUsage = "doubao-usage"
public static let elevenLabsUsage = "elevenlabs-usage"
public static let geminiProbe = "gemini-probe"
public static let grok = "grok"
public static let cursorLogin = Self.provider(.cursor, scope: "login")
public static let deepSeekSettings = Self.provider(.deepseek, scope: "settings")
public static let deepSeekUsage = Self.provider(.deepseek, scope: "usage")
public static let deepgramUsage = Self.provider(.deepgram, scope: "usage")
public static let devin = Self.provider(.devin)
public static let doubaoUsage = Self.provider(.doubao, scope: "usage")
public static let elevenLabsUsage = Self.provider(.elevenlabs, scope: "usage")
public static let geminiProbe = Self.provider(.gemini, scope: "probe")
public static let grok = Self.provider(.grok)
public static let hooks = "hooks"
public static let keychainCache = "keychain-cache"
public static let keychainMigration = "keychain-migration"
public static let keychainPreflight = "keychain-preflight"
public static let keychainPrompt = "keychain-prompt"
public static let kimiAPI = "kimi-api"
public static let kimiCookie = "kimi-cookie"
public static let kimiTokenStore = "kimi-token-store"
public static let kimiWeb = "kimi-web"
public static let kiro = "kiro"
public static let longcatAPI = "longcat-api"
public static let longcatCookie = "longcat-cookie"
public static let longcatWeb = "longcat-web"
public static let kimiAPI = Self.provider(.kimi, scope: "api")
public static let kimiCookie = Self.provider(.kimi, scope: "cookie")
public static let kimiTokenStore = Self.provider(.kimi, scope: "token-store")
public static let kimiWeb = Self.provider(.kimi, scope: "web")
public static let kiro = Self.provider(.kiro)
public static let longcatAPI = Self.provider(.longcat, scope: "api")
public static let longcatCookie = Self.provider(.longcat, scope: "cookie")
public static let longcatWeb = Self.provider(.longcat, scope: "web")
public static let launchAtLogin = "launch-at-login"
public static let login = "login"
public static let logging = "logging"
public static let manusAPI = "manus-api"
public static let manusCookie = "manus-cookie"
public static let manusWeb = "manus-web"
public static let manusAPI = Self.provider(.manus, scope: "api")
public static let manusCookie = Self.provider(.manus, scope: "cookie")
public static let manusWeb = Self.provider(.manus, scope: "web")
public static let memoryPressure = "memory-pressure"
public static let minimaxAPITokenStore = "minimax-api-token-store"
public static let minimaxCookie = "minimax-cookie"
public static let minimaxCookieStore = "minimax-cookie-store"
public static let minimaxUsage = "minimax-usage"
public static let minimaxWeb = "minimax-web"
public static let mimoCookie = "mimo-cookie"
public static let moonshotUsage = "moonshot-usage"
public static let neuralWattUsage = "neuralwatt-usage"
public static let minimaxAPITokenStore = Self.provider(.minimax, scope: "api-token-store")
public static let minimaxCookie = Self.provider(.minimax, scope: "cookie")
public static let minimaxCookieStore = Self.provider(.minimax, scope: "cookie-store")
public static let minimaxUsage = Self.provider(.minimax, scope: "usage")
public static let minimaxWeb = Self.provider(.minimax, scope: "web")
public static let mimoCookie = Self.provider(.mimo, scope: "cookie")
public static let moonshotUsage = Self.provider(.moonshot, scope: "usage")
public static let neuralWattUsage = Self.provider(.neuralwatt, scope: "usage")
public static let notifications = "notifications"
public static let openAIWeb = "openai-web"
public static let openAIWebview = "openai-webview"
public static let ollama = "ollama"
public static let opencodeUsage = "opencode-usage"
public static let opencodeGoUsage = "opencode-go-usage"
public static let openRouterUsage = "openrouter-usage"
public static let perplexityAPI = "perplexity-api"
public static let perplexityCookie = "perplexity-cookie"
public static let perplexityWeb = "perplexity-web"
public static let poeUsage = "poe-usage"
public static let openAIWeb = Self.provider(.openai, scope: "web")
public static let openAIWebview = Self.provider(.openai, scope: "webview")
public static let ollama = Self.provider(.ollama)
public static let opencodeUsage = Self.provider(.opencode, scope: "usage")
public static let opencodeGoUsage = Self.provider(.opencodego, scope: "usage")
public static let openRouterUsage = Self.provider(.openrouter, scope: "usage")
public static let perplexityAPI = Self.provider(.perplexity, scope: "api")
public static let perplexityCookie = Self.provider(.perplexity, scope: "cookie")
public static let perplexityWeb = Self.provider(.perplexity, scope: "web")
public static let poeUsage = Self.provider(.poe, scope: "usage")
public static let providerDetection = "provider-detection"
public static let providers = "providers"
public static let qoderCookie = "qoder-cookie"
public static let qoderUsage = "qoder-usage"
public static let qoderCookie = Self.provider(.qoder, scope: "cookie")
public static let qoderUsage = Self.provider(.qoder, scope: "usage")
public static let quotaWarningNotifications = "quotaWarningNotifications"
public static let sessionQuota = "sessionQuota"
public static let sessionQuotaNotifications = "sessionQuotaNotifications"
public static let settings = "settings"
public static let subprocess = "subprocess"
public static let syntheticTokenStore = "synthetic-token-store"
public static let syntheticUsage = "synthetic-usage"
public static let t3chat = "t3chat"
public static let syntheticTokenStore = Self.provider(.synthetic, scope: "token-store")
public static let syntheticUsage = Self.provider(.synthetic, scope: "usage")
public static let t3chat = Self.provider(.t3chat)
public static let terminal = "terminal"
public static let tokenAccounts = "token-accounts"
public static let tokenCost = "token-cost"
public static let ttyRunner = "tty-runner"
public static let veniceUsage = "venice-usage"
public static let vertexAIFetcher = "vertexai-fetcher"
public static let warpUsage = "warp-usage"
public static let zed = "zed"
public static let veniceUsage = Self.provider(.venice, scope: "usage")
public static let vertexAIFetcher = Self.provider(.vertexai, scope: "fetcher")
public static let warpUsage = Self.provider(.warp, scope: "usage")
public static let zed = Self.provider(.zed)
public static let webkitTeardown = "webkit-teardown"
public static let zaiSettings = "zai-settings"
public static let zaiTokenStore = "zai-token-store"
public static let zaiUsage = "zai-usage"
public static let stepfunUsage = "stepfun-usage"
public static let zoommate = "zoommate"
public static let zaiSettings = Self.provider(.zai, scope: "settings")
public static let zaiTokenStore = Self.provider(.zai, scope: "token-store")
public static let zaiUsage = Self.provider(.zai, scope: "usage")
public static let stepfunUsage = Self.provider(.stepfun, scope: "usage")
public static let zoommate = Self.provider(.zoommate)
}
Loading