Repository navigation
feat(providers): add OMP provider with multi-account aggregation and subprovider selection #4610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b821f23
feat(omp): add OMP provider with combined capacity and subprovider se…
renan-brasilio d6dc20e
fix(omp): align rate windows, account labels, and limit breakdowns wi…
renan-brasilio d9fd3f1
security(omp): sanitize PII, harden arithmetic safety, and remove har…
renan-brasilio ec95b3a
fix(review): address ClawSweeper feedback on capacity calculation, li…
renan-brasilio fc7f656
fix(omp): preserve Anthropic quota durations and infer monthly fallba…
renan-brasilio f8a4d4e
fix(omp): derive usage from remaining fields, preserve full emails, a…
renan-brasilio 1c89918
feat(omp): dynamically compute total capacity and labels from active …
renan-brasilio 1a00210
fix(omp): scope history as unavailable, uniquely identify xAI limits,…
renan-brasilio c34ba87
fix(omp): redact non-email account IDs, preserve partial xAI visibili…
renan-brasilio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Sources/CodexBar/Providers/OMP/OMPProviderImplementation.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import CodexBarCore | ||
| import Foundation | ||
| import SwiftUI | ||
|
|
||
| struct OMPProviderImplementation: ProviderImplementation { | ||
| let id: UsageProvider = .omp | ||
|
|
||
| @MainActor | ||
| func settingsSnapshot(context: ProviderSettingsSnapshotContext) -> ProviderSettingsSnapshotContribution? { | ||
| .omp(context.settings.ompSettingsSnapshot()) | ||
| } | ||
|
|
||
| @MainActor | ||
| func settingsPickers(context: ProviderSettingsContext) -> [ProviderSettingsPickerDescriptor] { | ||
| [ | ||
| ProviderSettingsPickerDescriptor( | ||
| id: "omp-subprovider", | ||
| title: "Subprovider", | ||
| subtitle: "Select which provider limits to display from OMP, or Combined for all aggregated limits.", | ||
| binding: context.binding(\.ompSubprovider), | ||
| options: [ | ||
| ProviderSettingsPickerOption(id: "all", title: "Combined (All Limits)"), | ||
| ProviderSettingsPickerOption(id: "google-antigravity", title: "Google Antigravity (agy)"), | ||
| ProviderSettingsPickerOption(id: "openai-codex", title: "OpenAI Codex"), | ||
| ProviderSettingsPickerOption(id: "anthropic", title: "Anthropic Claude"), | ||
| ProviderSettingsPickerOption(id: "github-copilot", title: "GitHub Copilot"), | ||
| ProviderSettingsPickerOption(id: "xai-oauth", title: "xAI Grok"), | ||
| ProviderSettingsPickerOption(id: "custom", title: "Custom Subprovider…"), | ||
| ], | ||
| isVisible: nil, | ||
| onChange: { _ in | ||
| await context.store.refreshProvider(.omp) | ||
| }), | ||
| ] | ||
| } | ||
|
|
||
| @MainActor | ||
| func settingsFields(context: ProviderSettingsContext) -> [ProviderSettingsFieldDescriptor] { | ||
| [ | ||
| ProviderSettingsFieldDescriptor( | ||
| id: "omp-custom-subprovider", | ||
| title: "Custom Subprovider ID", | ||
| subtitle: "Specify a custom subprovider ID (e.g. for new providers added to OMP).", | ||
| kind: .plain, | ||
| placeholder: "e.g. google-antigravity", | ||
| binding: context.binding(\.ompCustomSubprovider), | ||
| actions: [], | ||
| isVisible: { context.settings.ompSubprovider == "custom" }), | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import CodexBarCore | ||
| import Foundation | ||
|
|
||
| extension SettingsStore { | ||
| public var ompSubprovider: String { | ||
| get { self.configSnapshot.providerConfig(for: .omp)?.ompSubprovider ?? "all" } | ||
| set { | ||
| self.updateProviderConfig(provider: .omp) { $0.ompSubprovider = newValue } | ||
| } | ||
| } | ||
|
|
||
| public var ompCustomSubprovider: String { | ||
| get { self.configSnapshot.providerConfig(for: .omp)?.ompCustomSubprovider ?? "" } | ||
| set { | ||
| self.updateProviderConfig(provider: .omp) { $0.ompCustomSubprovider = newValue } | ||
| } | ||
| } | ||
|
|
||
| public func ompSettingsSnapshot() -> OMPProviderSettings { | ||
| let hidden = self.configSnapshot.providerConfig(for: .omp)?.hiddenUsageItemIDs ?? [] | ||
| return OMPProviderSettings( | ||
| subprovider: self.ompSubprovider, | ||
| customSubprovider: self.ompCustomSubprovider, | ||
| hiddenUsageItemIDs: hidden) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.