@sriinnu/runic 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +1 -1
- package/README.md +47 -29
- package/RuniciOS/Core/RunicTypographyiOS.swift +24 -0
- package/RuniciOS/Views/ProviderDetailView.swift +9 -9
- package/RuniciOS/Views/ProviderListView.swift +10 -10
- package/RuniciOS/Widgets/LargeWidget.swift +14 -14
- package/RuniciOS/Widgets/LiveActivity.swift +19 -19
- package/RuniciOS/Widgets/LockScreenWidget.swift +15 -15
- package/RuniciOS/Widgets/MediumWidget.swift +10 -10
- package/RuniciOS/Widgets/RunicWidget.swift +5 -5
- package/RuniciOS/Widgets/SmallWidget.swift +9 -9
- package/Scripts/package_app.sh +2 -2
- package/Sources/Runic/About.swift +3 -3
- package/Sources/Runic/AppNotifications.swift +5 -3
- package/Sources/Runic/Controllers/StatusItemController+Actions.swift +17 -4
- package/Sources/Runic/Controllers/StatusItemController+Animation.swift +5 -4
- package/Sources/Runic/Controllers/StatusItemController+ChartSubmenus.swift +30 -16
- package/Sources/Runic/Controllers/StatusItemController+CustomProviders.swift +6 -3
- package/Sources/Runic/Controllers/StatusItemController+Menu.swift +47 -14
- package/Sources/Runic/Controllers/StatusItemController+MenuCards.swift +6 -4
- package/Sources/Runic/Controllers/StatusItemController+MenuHelpers.swift +40 -12
- package/Sources/Runic/Controllers/StatusItemController.swift +43 -43
- package/Sources/Runic/Core/BudgetNotificationManager.swift +2 -1
- package/Sources/Runic/Core/Login/ClaudeLoginRunner.swift +2 -2
- package/Sources/Runic/Core/Login/CodexLoginRunner.swift +1 -1
- package/Sources/Runic/Core/Login/CursorLoginRunner.swift +4 -4
- package/Sources/Runic/Core/Login/GeminiLoginRunner.swift +3 -6
- package/Sources/Runic/Core/Rendering/IconRenderer.swift +91 -85
- package/Sources/Runic/Core/Rendering/IconView.swift +3 -1
- package/Sources/Runic/Core/RunicColors.swift +6 -6
- package/Sources/Runic/Core/RunicSpacing.swift +7 -7
- package/Sources/Runic/Core/RunicTypography.swift +206 -0
- package/Sources/Runic/Core/Stores/AuggieTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/AzureOpenAITokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/CerebrasTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/CohereTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/CopilotTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/CustomProviderStore.swift +10 -10
- package/Sources/Runic/Core/Stores/DeepSeekTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/FireworksTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/GroqTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/KimiTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/MiniMaxCookieHeaderStore.swift +10 -36
- package/Sources/Runic/Core/Stores/MiniMaxGroupIDStore.swift +10 -36
- package/Sources/Runic/Core/Stores/MiniMaxTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/MistralTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/OpenRouterTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/PerplexityTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/ProviderToggleStore.swift +1 -1
- package/Sources/Runic/Core/Stores/QwenTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/SambaNovaTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/SettingsStore.swift +99 -52
- package/Sources/Runic/Core/Stores/TogetherTokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/UsageStore+Accessors.swift +19 -6
- package/Sources/Runic/Core/Stores/UsageStore+TokenCost.swift +1 -1
- package/Sources/Runic/Core/Stores/UsageStore+WidgetSnapshot.swift +1 -1
- package/Sources/Runic/Core/Stores/UsageStore.swift +234 -167
- package/Sources/Runic/Core/Stores/XAITokenStore.swift +10 -36
- package/Sources/Runic/Core/Stores/ZaiTokenStore.swift +10 -36
- package/Sources/Runic/Core/UsageExporter.swift +8 -4
- package/Sources/Runic/ProviderRegistry.swift +1 -1
- package/Sources/Runic/Providers/Antigravity/AntigravityProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Auggie/AuggieProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Azure/AzureProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Bedrock/BedrockProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Cerebras/CerebrasProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Codex/CodexProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Cohere/CohereProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Cursor/CursorProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/DeepSeek/DeepSeekProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Factory/FactoryProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Fireworks/FireworksProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Gemini/GeminiProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Groq/GroqProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Kimi/KimiProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/MiniMax/MiniMaxProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Mistral/MistralProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/OpenRouter/OpenRouterProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Perplexity/PerplexityProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/SambaNova/SambaNovaProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Shared/ProviderImplementation.swift +5 -2
- package/Sources/Runic/Providers/Shared/ProviderImplementationRegistry.swift +1 -1
- package/Sources/Runic/Providers/Shared/ProviderSettingsDescriptors.swift +1 -1
- package/Sources/Runic/Providers/Together/TogetherProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/XAI/XAIProviderImplementation.swift +1 -1
- package/Sources/Runic/Providers/Zai/ZaiProviderImplementation.swift +1 -1
- package/Sources/Runic/Resources/Fonts/Caveat-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/Caveat-Regular.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/FiraCode-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/FiraCode-Light.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/FiraCode-Medium.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/FiraCode-Regular.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/FiraCode-SemiBold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/IBMPlexMono-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/IBMPlexMono-Medium.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/IBMPlexMono-Regular.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/Inconsolata-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/Inconsolata-Medium.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/Inconsolata-Regular.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/Inconsolata-SemiBold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/JetBrainsMono-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/JetBrainsMono-Medium.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/JetBrainsMono-Regular.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/JetBrainsMono-SemiBold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/SpaceMono-Bold.ttf +0 -0
- package/Sources/Runic/Resources/Fonts/SpaceMono-Regular.ttf +0 -0
- package/Sources/Runic/Resources/provider-context-windows.json +20 -0
- package/Sources/Runic/RunicApp.swift +46 -36
- package/Sources/Runic/SessionQuotaNotifications.swift +2 -2
- package/Sources/Runic/UsagePaceText.swift +1 -1
- package/Sources/Runic/UsageProgressBar.swift +13 -9
- package/Sources/Runic/Utilities/LoadingPattern.swift +4 -2
- package/Sources/Runic/Utilities/PerformanceConstants.swift +28 -28
- package/Sources/Runic/Views/Menu/AlertsMenuView.swift +19 -21
- package/Sources/Runic/Views/Menu/CostComparativeChartMenuView.swift +19 -19
- package/Sources/Runic/Views/Menu/CostHistoryChartMenuView.swift +7 -7
- package/Sources/Runic/Views/Menu/CreditsHistoryChartMenuView.swift +5 -5
- package/Sources/Runic/Views/Menu/EfficiencyMetricsMenuView.swift +29 -30
- package/Sources/Runic/Views/Menu/HeroStatCardsMenuView.swift +20 -17
- package/Sources/Runic/Views/Menu/HourlyActivityChartMenuView.swift +14 -14
- package/Sources/Runic/Views/Menu/InlineUsageChartView.swift +15 -20
- package/Sources/Runic/Views/Menu/MenuCardEntranceModifier.swift +3 -4
- package/Sources/Runic/Views/Menu/MenuCardSidebarView.swift +5 -25
- package/Sources/Runic/Views/Menu/MenuCardSkeletonView.swift +1 -1
- package/Sources/Runic/Views/Menu/MenuCardView.swift +120 -131
- package/Sources/Runic/Views/Menu/MenuContent.swift +11 -8
- package/Sources/Runic/Views/Menu/MenuDescriptor.swift +4 -2
- package/Sources/Runic/Views/Menu/MenuHighlightStyle.swift +1 -8
- package/Sources/Runic/Views/Menu/ModelBreakdownMenuView.swift +20 -14
- package/Sources/Runic/Views/Menu/OverviewMenuView.swift +198 -58
- package/Sources/Runic/Views/Menu/ProjectBreakdownMenuView.swift +16 -11
- package/Sources/Runic/Views/Menu/ProjectBudgetMenuView.swift +27 -27
- package/Sources/Runic/Views/Menu/ProviderTabBarView.swift +4 -6
- package/Sources/Runic/Views/Menu/SubscriptionUtilizationChartMenuView.swift +24 -11
- package/Sources/Runic/Views/Menu/UsageBreakdownChartMenuView.swift +5 -5
- package/Sources/Runic/Views/Menu/UsageHeatmapMenuView.swift +7 -8
- package/Sources/Runic/Views/Menu/UsageTimelineChartMenuView.swift +28 -76
- package/Sources/Runic/Views/Menu/UsageWindowComparisonChartMenuView.swift +8 -7
- package/Sources/Runic/Views/Menu/WeeklyActivityChartMenuView.swift +7 -7
- package/Sources/Runic/Views/Performance/PerformanceDashboardView.swift +50 -47
- package/Sources/Runic/Views/Preferences/LiquidComponents.swift +15 -14
- package/Sources/Runic/Views/Preferences/PreferencesAboutPane.swift +7 -7
- package/Sources/Runic/Views/Preferences/PreferencesAdvancedPane.swift +27 -27
- package/Sources/Runic/Views/Preferences/PreferencesAlertsPane.swift +38 -42
- package/Sources/Runic/Views/Preferences/PreferencesAnalyticsPane.swift +39 -43
- package/Sources/Runic/Views/Preferences/PreferencesBudgetsPane.swift +21 -21
- package/Sources/Runic/Views/Preferences/PreferencesComponents.swift +7 -7
- package/Sources/Runic/Views/Preferences/PreferencesCustomProvidersPane.swift +49 -50
- package/Sources/Runic/Views/Preferences/PreferencesDebugPane.swift +10 -10
- package/Sources/Runic/Views/Preferences/PreferencesGeneralPane.swift +40 -21
- package/Sources/Runic/Views/Preferences/PreferencesHelpPane.swift +7 -7
- package/Sources/Runic/Views/Preferences/PreferencesIntegrationsPane.swift +108 -33
- package/Sources/Runic/Views/Preferences/PreferencesPerformancePane.swift +26 -23
- package/Sources/Runic/Views/Preferences/PreferencesProvidersPane.swift +271 -226
- package/Sources/Runic/Views/Preferences/PreferencesSelection.swift +6 -2
- package/Sources/Runic/Views/Preferences/PreferencesSyncPane.swift +7 -5
- package/Sources/Runic/Views/Preferences/PreferencesView.swift +38 -31
- package/Sources/Runic/Views/Rating/QualityRatingView.swift +11 -11
- package/Sources/Runic/Views/Team/TeamDashboardView.swift +29 -24
- package/Sources/Runic/Views/Team/TeamInviteSheet.swift +16 -16
- package/Sources/Runic/Views/Team/TeamManagementView.swift +50 -49
- package/Sources/Runic/Views/Team/TeamMemberRow.swift +8 -8
- package/Sources/RunicCLI/CLIEntry.swift +83 -42
- package/Sources/RunicCLI/CLIRenderer.swift +1 -1
- package/Sources/RunicCLI/Commands/EnhancedUsageCommand.swift +60 -60
- package/Sources/RunicCLI/Commands/ModelsCommand.swift +45 -44
- package/Sources/RunicCLI/Commands/ProjectsCommand.swift +83 -69
- package/Sources/RunicCLI/Commands/ResetCommand.swift +50 -49
- package/Sources/RunicCLI/Commands/UsageLedgerSourceFactory.swift +31 -32
- package/Sources/RunicClaudeWebProbe/main.swift +1 -1
- package/Sources/RunicCore/AlertRuleStore.swift +20 -20
- package/Sources/RunicCore/BrowserCookieImportOrder.swift +3 -3
- package/Sources/RunicCore/CostUsageModels.swift +1 -1
- package/Sources/RunicCore/CustomProviders/CustomProviderModels.swift +29 -30
- package/Sources/RunicCore/CustomProviders/GenericProviderFetcher.swift +80 -71
- package/Sources/RunicCore/CustomProviders/ProviderTemplates.swift +53 -109
- package/Sources/RunicCore/Host/PTY/TTYCommandRunner.swift +3 -3
- package/Sources/RunicCore/Integrations/GitHubIntegration.swift +3 -3
- package/Sources/RunicCore/Logging/OSLogLogHandler.swift +6 -6
- package/Sources/RunicCore/Models/EnhancedUsageModels.swift +47 -48
- package/Sources/RunicCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift +1 -1
- package/Sources/RunicCore/OpenAIWeb/OpenAIDashboardFetcher.swift +1 -1
- package/Sources/RunicCore/Performance/PerformanceModels.swift +4 -4
- package/Sources/RunicCore/Performance/PerformanceStorageImpl.swift +81 -64
- package/Sources/RunicCore/Policy/UsagePolicyEngine.swift +2 -2
- package/Sources/RunicCore/ProjectBudgetStore.swift +15 -12
- package/Sources/RunicCore/Providers/Antigravity/AntigravityProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Antigravity/AntigravityStatusProbe.swift +2 -2
- package/Sources/RunicCore/Providers/Auggie/AuggieProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Auggie/AuggieUsageFetcher.swift +3 -3
- package/Sources/RunicCore/Providers/Azure/AzureProviderDescriptor.swift +8 -8
- package/Sources/RunicCore/Providers/Azure/AzureUsageFetcher.swift +5 -3
- package/Sources/RunicCore/Providers/Bedrock/BedrockProviderDescriptor.swift +6 -6
- package/Sources/RunicCore/Providers/Bedrock/BedrockUsageFetcher.swift +3 -7
- package/Sources/RunicCore/Providers/Cerebras/CerebrasProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Cerebras/CerebrasUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthUsageFetcher.swift +3 -3
- package/Sources/RunicCore/Providers/Claude/ClaudeProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Claude/ClaudeStatusProbe.swift +4 -4
- package/Sources/RunicCore/Providers/Claude/ClaudeUsageDataSource.swift +3 -1
- package/Sources/RunicCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift +1 -1
- package/Sources/RunicCore/Providers/Codex/CodexOAuth/CodexOAuthCredentials.swift +1 -0
- package/Sources/RunicCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift +12 -1
- package/Sources/RunicCore/Providers/Codex/CodexProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Codex/CodexUsageDataSource.swift +3 -1
- package/Sources/RunicCore/Providers/Codex/CodexWebDashboardStrategy.swift +5 -3
- package/Sources/RunicCore/Providers/Cohere/CohereProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Cohere/CohereUsageFetcher.swift +3 -3
- package/Sources/RunicCore/Providers/Copilot/CopilotGitHubCLITokenReader.swift +7 -4
- package/Sources/RunicCore/Providers/Copilot/CopilotProviderDescriptor.swift +4 -4
- package/Sources/RunicCore/Providers/Copilot/CopilotUsageFetcher.swift +5 -3
- package/Sources/RunicCore/Providers/Copilot/CopilotVSCodeTokenReader.swift +9 -10
- package/Sources/RunicCore/Providers/Cursor/CursorProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Cursor/CursorStatusProbe.swift +1 -0
- package/Sources/RunicCore/Providers/DeepSeek/DeepSeekProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Factory/FactoryLocalStorageImporter.swift +4 -4
- package/Sources/RunicCore/Providers/Factory/FactoryProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Factory/FactoryStatusProbe.swift +3 -2
- package/Sources/RunicCore/Providers/Fireworks/FireworksProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Fireworks/FireworksUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Gemini/GeminiProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Gemini/GeminiStatusProbe.swift +6 -2
- package/Sources/RunicCore/Providers/Groq/GroqProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Groq/GroqUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Kimi/KimiProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Kimi/KimiUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift +10 -5
- package/Sources/RunicCore/Providers/MiniMax/MiniMaxUsageFetcher.swift +8 -11
- package/Sources/RunicCore/Providers/MiniMax/MiniMaxWebUsageFetcher.swift +10 -10
- package/Sources/RunicCore/Providers/Mistral/MistralProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Mistral/MistralUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/OpenRouter/OpenRouterProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/OpenRouter/OpenRouterUsageFetcher.swift +25 -16
- package/Sources/RunicCore/Providers/Perplexity/PerplexityProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Perplexity/PerplexityUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/ProviderFetchPlan.swift +2 -2
- package/Sources/RunicCore/Providers/ProviderTokenResolver.swift +2 -2
- package/Sources/RunicCore/Providers/Qwen/QwenProviderDescriptor.swift +5 -3
- package/Sources/RunicCore/Providers/Qwen/QwenUsageStats.swift +27 -16
- package/Sources/RunicCore/Providers/SambaNova/SambaNovaProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/SambaNova/SambaNovaUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Together/TogetherProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/Together/TogetherUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/VertexAI/VertexAIProviderDescriptor.swift +5 -5
- package/Sources/RunicCore/Providers/VertexAI/VertexAISettingsReader.swift +1 -1
- package/Sources/RunicCore/Providers/VertexAI/VertexAIUsageFetcher.swift +3 -3
- package/Sources/RunicCore/Providers/XAI/XAIProviderDescriptor.swift +2 -2
- package/Sources/RunicCore/Providers/XAI/XAIUsageFetcher.swift +2 -2
- package/Sources/RunicCore/Providers/Zai/ZaiProviderDescriptor.swift +4 -2
- package/Sources/RunicCore/Providers/Zai/ZaiUsageStats.swift +51 -30
- package/Sources/RunicCore/Sync/BackgroundSyncManager.swift +76 -77
- package/Sources/RunicCore/Sync/SyncConflictResolver.swift +55 -58
- package/Sources/RunicCore/Sync/SyncProtocol.swift +21 -22
- package/Sources/RunicCore/Sync/SyncRecord.swift +46 -49
- package/Sources/RunicCore/Sync/SyncUsageExample.swift +44 -50
- package/Sources/RunicCore/Sync/TeamSyncRecords.swift +94 -101
- package/Sources/RunicCore/Sync/iCloudSyncEngine.swift +51 -46
- package/Sources/RunicCore/Team/TeamModels.swift +111 -110
- package/Sources/RunicCore/Team/TeamStore.swift +126 -109
- package/Sources/RunicCore/UsageFetcher.swift +2 -2
- package/Sources/RunicCore/UsageFormatter.swift +25 -25
- package/Sources/RunicCore/UsageLedger/ClaudeUsageLogSource.swift +141 -29
- package/Sources/RunicCore/UsageLedger/CodexUsageLogSource.swift +59 -5
- package/Sources/RunicCore/UsageLedger/LedgerCache.swift +161 -0
- package/Sources/RunicCore/UsageLedger/OTelGenAILedgerAdapter.swift +1 -1
- package/Sources/RunicCore/UsageLedger/UsageLedgerAggregator.swift +40 -25
- package/Sources/RunicCore/UsageLedger/UsageLedgerInsightsAdvisor.swift +1 -1
- package/Sources/RunicCore/UsageLedger/UsageLedgerProjectIdentity.swift +55 -16
- package/Sources/RunicCore/Vendored/CostUsage/CostUsageCache.swift +6 -6
- package/Sources/RunicCore/Vendored/CostUsage/CostUsageJsonl.swift +1 -1
- package/Sources/RunicCore/Vendored/CostUsage/CostUsagePricing.swift +2 -2
- package/Sources/RunicCore/Vendored/CostUsage/CostUsageScanner.swift +5 -5
- package/Tests/RunicTests/AppDelegateTests.swift +8 -3
- package/Tests/RunicTests/BrowserCookieOrderLabelTests.swift +2 -3
- package/Tests/RunicTests/CLIArgumentParsingTests.swift +3 -4
- package/Tests/RunicTests/CLICostTests.swift +6 -7
- package/Tests/RunicTests/CLIProviderSelectionTests.swift +2 -3
- package/Tests/RunicTests/CLISnapshotTests.swift +3 -4
- package/Tests/RunicTests/CLIWebFallbackTests.swift +3 -4
- package/Tests/RunicTests/ClaudeOAuthTests.swift +11 -12
- package/Tests/RunicTests/ClaudeResilienceTests.swift +3 -4
- package/Tests/RunicTests/ClaudeUsageTests.swift +20 -21
- package/Tests/RunicTests/CodexOAuthTests.swift +7 -8
- package/Tests/RunicTests/CodexUsageLogSourceTests.swift +1 -3
- package/Tests/RunicTests/CopilotTokenResolverTests.swift +5 -6
- package/Tests/RunicTests/CopilotVSCodeTokenReaderTests.swift +4 -5
- package/Tests/RunicTests/CostUsageDecodingTests.swift +15 -17
- package/Tests/RunicTests/CostUsagePricingTests.swift +5 -7
- package/Tests/RunicTests/CostUsageScannerTests.swift +10 -12
- package/Tests/RunicTests/CursorStatusProbeTests.swift +15 -16
- package/Tests/RunicTests/FactoryStatusProbeTests.swift +3 -5
- package/Tests/RunicTests/GeminiLoginAlertTests.swift +3 -4
- package/Tests/RunicTests/GeminiStatusProbeAPITests.swift +11 -11
- package/Tests/RunicTests/GeminiStatusProbePlanTests.swift +8 -8
- package/Tests/RunicTests/GeminiStatusProbeTests.swift +20 -21
- package/Tests/RunicTests/GoogleWorkspaceStatusTests.swift +2 -3
- package/Tests/RunicTests/InstallOriginTests.swift +1 -2
- package/Tests/RunicTests/KeyboardShortcutsBundleTests.swift +2 -2
- package/Tests/RunicTests/LiveAccountTests.swift +3 -3
- package/Tests/RunicTests/LoadingPatternTests.swift +3 -4
- package/Tests/RunicTests/MenuCardModelTests.swift +33 -34
- package/Tests/RunicTests/MiniMaxCookieHeaderStoreTestSupport.swift +4 -1
- package/Tests/RunicTests/MiniMaxGroupIDStoreTestSupport.swift +4 -1
- package/Tests/RunicTests/MiniMaxParsingTests.swift +4 -5
- package/Tests/RunicTests/MiniMaxTokenStoreTestSupport.swift +4 -1
- package/Tests/RunicTests/OTelGenAILedgerAdapterTests.swift +4 -6
- package/Tests/RunicTests/OpenAIDashboardBrowserCookieImporterTests.swift +1 -2
- package/Tests/RunicTests/OpenAIDashboardFetcherCreditsWaitTests.swift +5 -6
- package/Tests/RunicTests/OpenAIDashboardOffscreenHostTests.swift +2 -3
- package/Tests/RunicTests/OpenAIDashboardParserTests.swift +12 -13
- package/Tests/RunicTests/OpenAIWebAccountSwitchTests.swift +17 -6
- package/Tests/RunicTests/OpenRouterTokenStoreTestSupport.swift +52 -13
- package/Tests/RunicTests/PathBuilderTests.swift +14 -15
- package/Tests/RunicTests/ProviderFetchPipelineTests.swift +3 -4
- package/Tests/RunicTests/ProviderIconResourcesTests.swift +1 -2
- package/Tests/RunicTests/ProviderMetadataStatusLinkTests.swift +1 -2
- package/Tests/RunicTests/ProviderSettingsDescriptorTests.swift +53 -19
- package/Tests/RunicTests/ProviderToggleStoreTests.swift +10 -11
- package/Tests/RunicTests/RunicTests.swift +6 -7
- package/Tests/RunicTests/SessionQuotaNotificationLogicTests.swift +5 -6
- package/Tests/RunicTests/SettingsStoreTests.swift +149 -45
- package/Tests/RunicTests/StatusItemAnimationTests.swift +8 -3
- package/Tests/RunicTests/StatusMenuTests.swift +63 -22
- package/Tests/RunicTests/StatusProbeTests.swift +28 -29
- package/Tests/RunicTests/SubprocessRunnerTests.swift +1 -3
- package/Tests/RunicTests/SubscriptionDetectionTests.swift +8 -9
- package/Tests/RunicTests/TTYCommandRunnerTests.swift +8 -9
- package/Tests/RunicTests/TeamShowbackExporterTests.swift +2 -4
- package/Tests/RunicTests/TextParsingTests.swift +1 -2
- package/Tests/RunicTests/UsageFormatterTests.swift +15 -16
- package/Tests/RunicTests/UsageLedgerAnomalyDetectionTests.swift +12 -14
- package/Tests/RunicTests/UsageLedgerForecastTests.swift +4 -6
- package/Tests/RunicTests/UsageLedgerInsightsAdvisorTests.swift +7 -9
- package/Tests/RunicTests/UsageLedgerProjectNameTests.swift +6 -8
- package/Tests/RunicTests/UsagePaceTests.swift +5 -6
- package/Tests/RunicTests/UsagePaceTextTests.swift +8 -9
- package/Tests/RunicTests/UsagePolicyEngineTests.swift +3 -5
- package/Tests/RunicTests/WidgetSnapshotTests.swift +1 -3
- package/Tests/RunicTests/ZaiProviderTests.swift +3 -5
- package/Tests/RunicTests/ZaiTokenStoreTestSupport.swift +4 -1
- package/appcast.xml +36 -37
- package/package.json +1 -1
- package/runic.png +0 -0
- package/runic.svg +15 -0
- package/version.env +2 -2
|
@@ -7,7 +7,6 @@ import Foundation
|
|
|
7
7
|
/// Each template includes accurate endpoint URLs, authentication methods,
|
|
8
8
|
/// and response field mappings based on official API documentation.
|
|
9
9
|
public enum ProviderTemplates {
|
|
10
|
-
|
|
11
10
|
// MARK: - Template Collection
|
|
12
11
|
|
|
13
12
|
/// All available provider templates
|
|
@@ -21,12 +20,12 @@ public enum ProviderTemplates {
|
|
|
21
20
|
cohere,
|
|
22
21
|
huggingface,
|
|
23
22
|
replicate,
|
|
24
|
-
runway
|
|
23
|
+
runway,
|
|
25
24
|
]
|
|
26
25
|
|
|
27
26
|
/// Get a template by provider ID
|
|
28
27
|
public static func template(for id: String) -> CustomProviderConfig? {
|
|
29
|
-
|
|
28
|
+
self.all.first { $0.id == id }
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
// MARK: - ElevenLabs
|
|
@@ -45,8 +44,7 @@ public enum ProviderTemplates {
|
|
|
45
44
|
headerName: "xi-api-key",
|
|
46
45
|
headerPrefix: nil,
|
|
47
46
|
tokenKeychain: "elevenlabs-api-token",
|
|
48
|
-
additionalHeaders: nil
|
|
49
|
-
),
|
|
47
|
+
additionalHeaders: nil),
|
|
50
48
|
endpoints: EndpointConfig(
|
|
51
49
|
usage: UsageEndpoint(
|
|
52
50
|
url: "https://api.elevenlabs.io/v1/user/subscription",
|
|
@@ -58,16 +56,12 @@ public enum ProviderTemplates {
|
|
|
58
56
|
cost: nil,
|
|
59
57
|
resetDate: "next_character_count_reset_unix",
|
|
60
58
|
tokens: "character_count",
|
|
61
|
-
nestedPaths: false
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
balance: nil
|
|
66
|
-
),
|
|
59
|
+
nestedPaths: false),
|
|
60
|
+
queryParams: nil),
|
|
61
|
+
balance: nil),
|
|
67
62
|
colorHex: "#7C3AED",
|
|
68
63
|
createdAt: Date(),
|
|
69
|
-
updatedAt: Date()
|
|
70
|
-
)
|
|
64
|
+
updatedAt: Date())
|
|
71
65
|
|
|
72
66
|
// MARK: - OpenAI
|
|
73
67
|
|
|
@@ -85,8 +79,7 @@ public enum ProviderTemplates {
|
|
|
85
79
|
headerName: "Authorization",
|
|
86
80
|
headerPrefix: "Bearer ",
|
|
87
81
|
tokenKeychain: "openai-api-token",
|
|
88
|
-
additionalHeaders: nil
|
|
89
|
-
),
|
|
82
|
+
additionalHeaders: nil),
|
|
90
83
|
endpoints: EndpointConfig(
|
|
91
84
|
usage: UsageEndpoint(
|
|
92
85
|
url: "https://api.openai.com/v1/organization/usage/completions",
|
|
@@ -98,16 +91,12 @@ public enum ProviderTemplates {
|
|
|
98
91
|
cost: nil,
|
|
99
92
|
resetDate: nil,
|
|
100
93
|
tokens: "data.0.n_requests",
|
|
101
|
-
nestedPaths: true
|
|
102
|
-
),
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
-
balance: nil
|
|
106
|
-
),
|
|
94
|
+
nestedPaths: true),
|
|
95
|
+
queryParams: nil),
|
|
96
|
+
balance: nil),
|
|
107
97
|
colorHex: "#10A37F",
|
|
108
98
|
createdAt: Date(),
|
|
109
|
-
updatedAt: Date()
|
|
110
|
-
)
|
|
99
|
+
updatedAt: Date())
|
|
111
100
|
|
|
112
101
|
// MARK: - Anthropic Claude
|
|
113
102
|
|
|
@@ -126,8 +115,7 @@ public enum ProviderTemplates {
|
|
|
126
115
|
headerName: "x-api-key",
|
|
127
116
|
headerPrefix: nil,
|
|
128
117
|
tokenKeychain: "anthropic-admin-api-token",
|
|
129
|
-
additionalHeaders: ["anthropic-version": "2023-06-01"]
|
|
130
|
-
),
|
|
118
|
+
additionalHeaders: ["anthropic-version": "2023-06-01"]),
|
|
131
119
|
endpoints: EndpointConfig(
|
|
132
120
|
usage: UsageEndpoint(
|
|
133
121
|
url: "https://api.anthropic.com/v1/organizations/usage_report/messages",
|
|
@@ -139,10 +127,8 @@ public enum ProviderTemplates {
|
|
|
139
127
|
cost: nil,
|
|
140
128
|
resetDate: nil,
|
|
141
129
|
tokens: "data.0.output_tokens",
|
|
142
|
-
nestedPaths: true
|
|
143
|
-
),
|
|
144
|
-
queryParams: nil
|
|
145
|
-
),
|
|
130
|
+
nestedPaths: true),
|
|
131
|
+
queryParams: nil),
|
|
146
132
|
balance: BalanceEndpoint(
|
|
147
133
|
url: "https://api.anthropic.com/v1/organizations/cost_report",
|
|
148
134
|
method: .GET,
|
|
@@ -153,14 +139,10 @@ public enum ProviderTemplates {
|
|
|
153
139
|
cost: "data.0.cost_usd",
|
|
154
140
|
resetDate: nil,
|
|
155
141
|
tokens: nil,
|
|
156
|
-
nestedPaths: true
|
|
157
|
-
)
|
|
158
|
-
)
|
|
159
|
-
),
|
|
142
|
+
nestedPaths: true))),
|
|
160
143
|
colorHex: "#D4A574",
|
|
161
144
|
createdAt: Date(),
|
|
162
|
-
updatedAt: Date()
|
|
163
|
-
)
|
|
145
|
+
updatedAt: Date())
|
|
164
146
|
|
|
165
147
|
// MARK: - Stability AI
|
|
166
148
|
|
|
@@ -178,8 +160,7 @@ public enum ProviderTemplates {
|
|
|
178
160
|
headerName: "Authorization",
|
|
179
161
|
headerPrefix: "Bearer ",
|
|
180
162
|
tokenKeychain: "stability-ai-token",
|
|
181
|
-
additionalHeaders: nil
|
|
182
|
-
),
|
|
163
|
+
additionalHeaders: nil),
|
|
183
164
|
endpoints: EndpointConfig(
|
|
184
165
|
usage: nil,
|
|
185
166
|
balance: BalanceEndpoint(
|
|
@@ -192,14 +173,10 @@ public enum ProviderTemplates {
|
|
|
192
173
|
cost: nil,
|
|
193
174
|
resetDate: nil,
|
|
194
175
|
tokens: nil,
|
|
195
|
-
nestedPaths: false
|
|
196
|
-
)
|
|
197
|
-
)
|
|
198
|
-
),
|
|
176
|
+
nestedPaths: false))),
|
|
199
177
|
colorHex: "#FF6F61",
|
|
200
178
|
createdAt: Date(),
|
|
201
|
-
updatedAt: Date()
|
|
202
|
-
)
|
|
179
|
+
updatedAt: Date())
|
|
203
180
|
|
|
204
181
|
// MARK: - Together AI
|
|
205
182
|
|
|
@@ -217,8 +194,7 @@ public enum ProviderTemplates {
|
|
|
217
194
|
headerName: "Authorization",
|
|
218
195
|
headerPrefix: "Bearer ",
|
|
219
196
|
tokenKeychain: "together-ai-token",
|
|
220
|
-
additionalHeaders: nil
|
|
221
|
-
),
|
|
197
|
+
additionalHeaders: nil),
|
|
222
198
|
endpoints: EndpointConfig(
|
|
223
199
|
usage: UsageEndpoint(
|
|
224
200
|
url: "https://api.together.xyz/v1/usage",
|
|
@@ -230,16 +206,12 @@ public enum ProviderTemplates {
|
|
|
230
206
|
cost: "total_cost",
|
|
231
207
|
resetDate: nil,
|
|
232
208
|
tokens: "total_tokens",
|
|
233
|
-
nestedPaths: true
|
|
234
|
-
),
|
|
235
|
-
|
|
236
|
-
),
|
|
237
|
-
balance: nil
|
|
238
|
-
),
|
|
209
|
+
nestedPaths: true),
|
|
210
|
+
queryParams: nil),
|
|
211
|
+
balance: nil),
|
|
239
212
|
colorHex: "#00D4FF",
|
|
240
213
|
createdAt: Date(),
|
|
241
|
-
updatedAt: Date()
|
|
242
|
-
)
|
|
214
|
+
updatedAt: Date())
|
|
243
215
|
|
|
244
216
|
// MARK: - Perplexity
|
|
245
217
|
|
|
@@ -257,8 +229,7 @@ public enum ProviderTemplates {
|
|
|
257
229
|
headerName: "Authorization",
|
|
258
230
|
headerPrefix: "Bearer ",
|
|
259
231
|
tokenKeychain: "perplexity-api-token",
|
|
260
|
-
additionalHeaders: nil
|
|
261
|
-
),
|
|
232
|
+
additionalHeaders: nil),
|
|
262
233
|
endpoints: EndpointConfig(
|
|
263
234
|
usage: UsageEndpoint(
|
|
264
235
|
url: "https://api.perplexity.ai/usage",
|
|
@@ -270,16 +241,12 @@ public enum ProviderTemplates {
|
|
|
270
241
|
cost: "total_cost",
|
|
271
242
|
resetDate: nil,
|
|
272
243
|
tokens: "total_tokens",
|
|
273
|
-
nestedPaths: true
|
|
274
|
-
),
|
|
275
|
-
|
|
276
|
-
),
|
|
277
|
-
balance: nil
|
|
278
|
-
),
|
|
244
|
+
nestedPaths: true),
|
|
245
|
+
queryParams: nil),
|
|
246
|
+
balance: nil),
|
|
279
247
|
colorHex: "#2EAADC",
|
|
280
248
|
createdAt: Date(),
|
|
281
|
-
updatedAt: Date()
|
|
282
|
-
)
|
|
249
|
+
updatedAt: Date())
|
|
283
250
|
|
|
284
251
|
// MARK: - Cohere
|
|
285
252
|
|
|
@@ -298,8 +265,7 @@ public enum ProviderTemplates {
|
|
|
298
265
|
headerName: "Authorization",
|
|
299
266
|
headerPrefix: "Bearer ",
|
|
300
267
|
tokenKeychain: "cohere-api-token",
|
|
301
|
-
additionalHeaders: nil
|
|
302
|
-
),
|
|
268
|
+
additionalHeaders: nil),
|
|
303
269
|
endpoints: EndpointConfig(
|
|
304
270
|
usage: UsageEndpoint(
|
|
305
271
|
url: "https://api.cohere.ai/v1/usage",
|
|
@@ -311,16 +277,12 @@ public enum ProviderTemplates {
|
|
|
311
277
|
cost: "total_cost",
|
|
312
278
|
resetDate: nil,
|
|
313
279
|
tokens: "tokens_used",
|
|
314
|
-
nestedPaths: true
|
|
315
|
-
),
|
|
316
|
-
|
|
317
|
-
),
|
|
318
|
-
balance: nil
|
|
319
|
-
),
|
|
280
|
+
nestedPaths: true),
|
|
281
|
+
queryParams: nil),
|
|
282
|
+
balance: nil),
|
|
320
283
|
colorHex: "#39594D",
|
|
321
284
|
createdAt: Date(),
|
|
322
|
-
updatedAt: Date()
|
|
323
|
-
)
|
|
285
|
+
updatedAt: Date())
|
|
324
286
|
|
|
325
287
|
// MARK: - Hugging Face
|
|
326
288
|
|
|
@@ -339,8 +301,7 @@ public enum ProviderTemplates {
|
|
|
339
301
|
headerName: "Authorization",
|
|
340
302
|
headerPrefix: "Bearer ",
|
|
341
303
|
tokenKeychain: "huggingface-token",
|
|
342
|
-
additionalHeaders: nil
|
|
343
|
-
),
|
|
304
|
+
additionalHeaders: nil),
|
|
344
305
|
endpoints: EndpointConfig(
|
|
345
306
|
usage: UsageEndpoint(
|
|
346
307
|
url: "https://api-inference.huggingface.co/status",
|
|
@@ -352,16 +313,12 @@ public enum ProviderTemplates {
|
|
|
352
313
|
cost: nil,
|
|
353
314
|
resetDate: nil,
|
|
354
315
|
tokens: "compute_time",
|
|
355
|
-
nestedPaths: true
|
|
356
|
-
),
|
|
357
|
-
|
|
358
|
-
),
|
|
359
|
-
balance: nil
|
|
360
|
-
),
|
|
316
|
+
nestedPaths: true),
|
|
317
|
+
queryParams: nil),
|
|
318
|
+
balance: nil),
|
|
361
319
|
colorHex: "#FFD21E",
|
|
362
320
|
createdAt: Date(),
|
|
363
|
-
updatedAt: Date()
|
|
364
|
-
)
|
|
321
|
+
updatedAt: Date())
|
|
365
322
|
|
|
366
323
|
// MARK: - Replicate
|
|
367
324
|
|
|
@@ -380,8 +337,7 @@ public enum ProviderTemplates {
|
|
|
380
337
|
headerName: "Authorization",
|
|
381
338
|
headerPrefix: "Token ",
|
|
382
339
|
tokenKeychain: "replicate-token",
|
|
383
|
-
additionalHeaders: nil
|
|
384
|
-
),
|
|
340
|
+
additionalHeaders: nil),
|
|
385
341
|
endpoints: EndpointConfig(
|
|
386
342
|
usage: UsageEndpoint(
|
|
387
343
|
url: "https://api.replicate.com/v1/account/usage",
|
|
@@ -393,16 +349,12 @@ public enum ProviderTemplates {
|
|
|
393
349
|
cost: "total_spend",
|
|
394
350
|
resetDate: nil,
|
|
395
351
|
tokens: "prediction_count",
|
|
396
|
-
nestedPaths: true
|
|
397
|
-
),
|
|
398
|
-
|
|
399
|
-
),
|
|
400
|
-
balance: nil
|
|
401
|
-
),
|
|
352
|
+
nestedPaths: true),
|
|
353
|
+
queryParams: nil),
|
|
354
|
+
balance: nil),
|
|
402
355
|
colorHex: "#000000",
|
|
403
356
|
createdAt: Date(),
|
|
404
|
-
updatedAt: Date()
|
|
405
|
-
)
|
|
357
|
+
updatedAt: Date())
|
|
406
358
|
|
|
407
359
|
// MARK: - Runway ML
|
|
408
360
|
|
|
@@ -420,8 +372,7 @@ public enum ProviderTemplates {
|
|
|
420
372
|
headerName: "Authorization",
|
|
421
373
|
headerPrefix: "Bearer ",
|
|
422
374
|
tokenKeychain: "runway-token",
|
|
423
|
-
additionalHeaders: ["X-Runway-Version": "2024-11-06"]
|
|
424
|
-
),
|
|
375
|
+
additionalHeaders: ["X-Runway-Version": "2024-11-06"]),
|
|
425
376
|
endpoints: EndpointConfig(
|
|
426
377
|
usage: UsageEndpoint(
|
|
427
378
|
url: "https://api.dev.runwayml.com/v1/usage",
|
|
@@ -433,22 +384,17 @@ public enum ProviderTemplates {
|
|
|
433
384
|
cost: "total_cost",
|
|
434
385
|
resetDate: nil,
|
|
435
386
|
tokens: "generation_count",
|
|
436
|
-
nestedPaths: true
|
|
437
|
-
),
|
|
438
|
-
|
|
439
|
-
),
|
|
440
|
-
balance: nil
|
|
441
|
-
),
|
|
387
|
+
nestedPaths: true),
|
|
388
|
+
queryParams: nil),
|
|
389
|
+
balance: nil),
|
|
442
390
|
colorHex: "#00FFA3",
|
|
443
391
|
createdAt: Date(),
|
|
444
|
-
updatedAt: Date()
|
|
445
|
-
)
|
|
392
|
+
updatedAt: Date())
|
|
446
393
|
}
|
|
447
394
|
|
|
448
395
|
// MARK: - Template Categories
|
|
449
396
|
|
|
450
397
|
extension ProviderTemplates {
|
|
451
|
-
|
|
452
398
|
/// Text generation and LLM providers
|
|
453
399
|
public static var textProviders: [CustomProviderConfig] {
|
|
454
400
|
[openai, anthropic, cohere, perplexity, togetherAI, huggingface]
|
|
@@ -473,13 +419,12 @@ extension ProviderTemplates {
|
|
|
473
419
|
// MARK: - Template Helpers
|
|
474
420
|
|
|
475
421
|
extension ProviderTemplates {
|
|
476
|
-
|
|
477
422
|
/// Create a new provider from a template with custom settings
|
|
478
423
|
public static func createFromTemplate(
|
|
479
424
|
_ template: CustomProviderConfig,
|
|
480
425
|
name: String? = nil,
|
|
481
|
-
enabled: Bool = true
|
|
482
|
-
|
|
426
|
+
enabled: Bool = true) -> CustomProviderConfig
|
|
427
|
+
{
|
|
483
428
|
var config = template
|
|
484
429
|
|
|
485
430
|
// Generate new ID to avoid conflicts
|
|
@@ -492,8 +437,7 @@ extension ProviderTemplates {
|
|
|
492
437
|
endpoints: template.endpoints,
|
|
493
438
|
colorHex: template.colorHex,
|
|
494
439
|
createdAt: Date(),
|
|
495
|
-
updatedAt: Date()
|
|
496
|
-
)
|
|
440
|
+
updatedAt: Date())
|
|
497
441
|
|
|
498
442
|
return config
|
|
499
443
|
}
|
|
@@ -74,7 +74,7 @@ public struct TTYCommandRunner {
|
|
|
74
74
|
|
|
75
75
|
public init() {}
|
|
76
76
|
|
|
77
|
-
struct RollingBuffer
|
|
77
|
+
struct RollingBuffer {
|
|
78
78
|
private let maxNeedle: Int
|
|
79
79
|
private var tail = Data()
|
|
80
80
|
|
|
@@ -250,8 +250,8 @@ public struct TTYCommandRunner {
|
|
|
250
250
|
var cleanedUp = false
|
|
251
251
|
var didLaunch = false
|
|
252
252
|
var processGroup: pid_t?
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
/// Always tear down the PTY child (and its process group) even if we throw early
|
|
254
|
+
/// while bootstrapping the CLI (e.g. when it prompts for login/telemetry).
|
|
255
255
|
func cleanup() {
|
|
256
256
|
guard !cleanedUp else { return }
|
|
257
257
|
cleanedUp = true
|
|
@@ -36,8 +36,8 @@ public enum GitHubIntegration {
|
|
|
36
36
|
{
|
|
37
37
|
guard !entries.isEmpty else { return [] }
|
|
38
38
|
|
|
39
|
-
let gitDir = gitDirectory ?? defaultGitDirectory()
|
|
40
|
-
let commits = loadCommits(from: gitDir)
|
|
39
|
+
let gitDir = gitDirectory ?? self.defaultGitDirectory()
|
|
40
|
+
let commits = self.loadCommits(from: gitDir)
|
|
41
41
|
|
|
42
42
|
guard !commits.isEmpty else {
|
|
43
43
|
self.logger.debug("No git commits found, returning entries without commit info")
|
|
@@ -47,7 +47,7 @@ public enum GitHubIntegration {
|
|
|
47
47
|
self.logger.debug("Linking \(entries.count) usage entries with \(commits.count) commits")
|
|
48
48
|
|
|
49
49
|
return entries.map { entry in
|
|
50
|
-
let matchedCommit = findClosestCommit(for: entry, in: commits)
|
|
50
|
+
let matchedCommit = self.findClosestCommit(for: entry, in: commits)
|
|
51
51
|
return UsageWithCommit(entry: entry, commit: matchedCommit)
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -42,17 +42,17 @@ struct OSLogLogHandler: LogHandler {
|
|
|
42
42
|
|
|
43
43
|
switch level {
|
|
44
44
|
case .trace:
|
|
45
|
-
self.logger.debug("\(msg, privacy: .
|
|
45
|
+
self.logger.debug("\(msg, privacy: .auto)")
|
|
46
46
|
case .debug:
|
|
47
|
-
self.logger.debug("\(msg, privacy: .
|
|
47
|
+
self.logger.debug("\(msg, privacy: .auto)")
|
|
48
48
|
case .info, .notice:
|
|
49
|
-
self.logger.info("\(msg, privacy: .
|
|
49
|
+
self.logger.info("\(msg, privacy: .auto)")
|
|
50
50
|
case .warning:
|
|
51
|
-
self.logger.warning("\(msg, privacy: .
|
|
51
|
+
self.logger.warning("\(msg, privacy: .auto)")
|
|
52
52
|
case .error:
|
|
53
|
-
self.logger.error("\(msg, privacy: .
|
|
53
|
+
self.logger.error("\(msg, privacy: .auto)")
|
|
54
54
|
case .critical:
|
|
55
|
-
self.logger.fault("\(msg, privacy: .
|
|
55
|
+
self.logger.fault("\(msg, privacy: .auto)")
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -8,10 +8,10 @@ import Foundation
|
|
|
8
8
|
/// Distinguishes between usage-based and subscription-based users
|
|
9
9
|
public enum AccountType: String, Codable, Sendable {
|
|
10
10
|
case usageBased = "usage_based"
|
|
11
|
-
case subscription
|
|
11
|
+
case subscription
|
|
12
12
|
case freeTier = "free_tier"
|
|
13
|
-
case enterprise
|
|
14
|
-
case unknown
|
|
13
|
+
case enterprise
|
|
14
|
+
case unknown
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// MARK: - Usage Reset Information
|
|
@@ -24,21 +24,21 @@ public struct UsageResetInfo: Codable, Sendable, Hashable {
|
|
|
24
24
|
public let resetsAutomatically: Bool
|
|
25
25
|
|
|
26
26
|
public enum ResetType: String, Codable, Sendable {
|
|
27
|
-
case hourly
|
|
28
|
-
case daily
|
|
29
|
-
case weekly
|
|
30
|
-
case monthly
|
|
27
|
+
case hourly
|
|
28
|
+
case daily
|
|
29
|
+
case weekly
|
|
30
|
+
case monthly
|
|
31
31
|
case sessionBased = "session" // 5-hour windows, etc.
|
|
32
|
-
case manual
|
|
33
|
-
case never
|
|
32
|
+
case manual
|
|
33
|
+
case never
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public init(
|
|
37
37
|
resetType: ResetType,
|
|
38
38
|
resetAt: Date? = nil,
|
|
39
39
|
windowDuration: TimeInterval? = nil,
|
|
40
|
-
resetsAutomatically: Bool = true
|
|
41
|
-
|
|
40
|
+
resetsAutomatically: Bool = true)
|
|
41
|
+
{
|
|
42
42
|
self.resetType = resetType
|
|
43
43
|
self.resetAt = resetAt
|
|
44
44
|
self.windowDuration = windowDuration
|
|
@@ -67,7 +67,7 @@ public struct UsageResetInfo: Codable, Sendable, Hashable {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
switch resetType {
|
|
70
|
+
switch self.resetType {
|
|
71
71
|
case .hourly: return "Resets every hour"
|
|
72
72
|
case .daily: return "Resets daily"
|
|
73
73
|
case .weekly: return "Resets weekly"
|
|
@@ -93,26 +93,26 @@ public struct ModelUsageInfo: Codable, Sendable, Hashable {
|
|
|
93
93
|
case gpt35 = "gpt-3.5"
|
|
94
94
|
case claude3 = "claude-3"
|
|
95
95
|
case claude4 = "claude-4"
|
|
96
|
-
case gemini
|
|
97
|
-
case codex
|
|
98
|
-
case other
|
|
96
|
+
case gemini
|
|
97
|
+
case codex
|
|
98
|
+
case other
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
public enum ModelTier: String, Codable, Sendable {
|
|
102
|
-
case opus
|
|
103
|
-
case sonnet
|
|
104
|
-
case haiku
|
|
105
|
-
case turbo
|
|
106
|
-
case standard
|
|
107
|
-
case unknown
|
|
102
|
+
case opus // Highest tier
|
|
103
|
+
case sonnet // Mid tier
|
|
104
|
+
case haiku // Fast/cheap tier
|
|
105
|
+
case turbo
|
|
106
|
+
case standard
|
|
107
|
+
case unknown
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
public init(
|
|
111
111
|
modelName: String,
|
|
112
112
|
modelFamily: ModelFamily = .other,
|
|
113
113
|
version: String? = nil,
|
|
114
|
-
tier: ModelTier = .unknown
|
|
115
|
-
|
|
114
|
+
tier: ModelTier = .unknown)
|
|
115
|
+
{
|
|
116
116
|
self.modelName = modelName
|
|
117
117
|
self.modelFamily = modelFamily
|
|
118
118
|
self.version = version
|
|
@@ -121,9 +121,9 @@ public struct ModelUsageInfo: Codable, Sendable, Hashable {
|
|
|
121
121
|
|
|
122
122
|
public var displayName: String {
|
|
123
123
|
if let version {
|
|
124
|
-
return "\(modelName) (\(version))"
|
|
124
|
+
return "\(self.modelName) (\(version))"
|
|
125
125
|
}
|
|
126
|
-
return modelName
|
|
126
|
+
return self.modelName
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -142,8 +142,8 @@ public struct ProjectInfo: Codable, Sendable, Hashable {
|
|
|
142
142
|
projectName: String? = nil,
|
|
143
143
|
workspacePath: String? = nil,
|
|
144
144
|
repository: String? = nil,
|
|
145
|
-
tags: [String] = []
|
|
146
|
-
|
|
145
|
+
tags: [String] = [])
|
|
146
|
+
{
|
|
147
147
|
self.projectID = projectID
|
|
148
148
|
self.projectName = projectName
|
|
149
149
|
self.workspacePath = workspacePath
|
|
@@ -152,7 +152,7 @@ public struct ProjectInfo: Codable, Sendable, Hashable {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
public var displayName: String {
|
|
155
|
-
projectName ?? projectID
|
|
155
|
+
self.projectName ?? self.projectID
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -187,7 +187,7 @@ public struct EnhancedUsageSnapshot: Codable, Sendable {
|
|
|
187
187
|
public let sessionID: String?
|
|
188
188
|
public let sessionStartedAt: Date?
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
/// Token usage breakdown
|
|
191
191
|
public let tokenUsage: DetailedTokenUsage?
|
|
192
192
|
|
|
193
193
|
// Cost information
|
|
@@ -218,8 +218,8 @@ public struct EnhancedUsageSnapshot: Codable, Sendable {
|
|
|
218
218
|
estimatedCost: Double? = nil,
|
|
219
219
|
costCurrency: String = "USD",
|
|
220
220
|
updatedAt: Date = Date(),
|
|
221
|
-
fetchSource: String = "unknown"
|
|
222
|
-
|
|
221
|
+
fetchSource: String = "unknown")
|
|
222
|
+
{
|
|
223
223
|
self.provider = provider
|
|
224
224
|
self.primary = primary
|
|
225
225
|
self.secondary = secondary
|
|
@@ -251,8 +251,7 @@ public struct EnhancedUsageSnapshot: Codable, Sendable {
|
|
|
251
251
|
tertiary: legacy.tertiary,
|
|
252
252
|
accountEmail: legacy.identity?.accountEmail,
|
|
253
253
|
accountOrganization: legacy.identity?.accountOrganization,
|
|
254
|
-
updatedAt: legacy.updatedAt
|
|
255
|
-
)
|
|
254
|
+
updatedAt: legacy.updatedAt)
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
257
|
|
|
@@ -266,10 +265,10 @@ public struct DetailedTokenUsage: Codable, Sendable, Hashable {
|
|
|
266
265
|
public let cacheReadTokens: Int
|
|
267
266
|
public let totalTokens: Int
|
|
268
267
|
|
|
269
|
-
|
|
268
|
+
/// Per-model breakdown
|
|
270
269
|
public let modelBreakdown: [String: Int] // modelName -> token count
|
|
271
270
|
|
|
272
|
-
|
|
271
|
+
/// Per-project breakdown
|
|
273
272
|
public let projectBreakdown: [String: Int] // projectID -> token count
|
|
274
273
|
|
|
275
274
|
public init(
|
|
@@ -278,8 +277,8 @@ public struct DetailedTokenUsage: Codable, Sendable, Hashable {
|
|
|
278
277
|
cacheCreationTokens: Int = 0,
|
|
279
278
|
cacheReadTokens: Int = 0,
|
|
280
279
|
modelBreakdown: [String: Int] = [:],
|
|
281
|
-
projectBreakdown: [String: Int] = [:]
|
|
282
|
-
|
|
280
|
+
projectBreakdown: [String: Int] = [:])
|
|
281
|
+
{
|
|
283
282
|
self.inputTokens = inputTokens
|
|
284
283
|
self.outputTokens = outputTokens
|
|
285
284
|
self.cacheCreationTokens = cacheCreationTokens
|
|
@@ -306,10 +305,10 @@ public struct UsageAlert: Codable, Sendable, Identifiable {
|
|
|
306
305
|
public let createdAt: Date
|
|
307
306
|
|
|
308
307
|
public enum Severity: String, Codable, Sendable {
|
|
309
|
-
case info
|
|
310
|
-
case warning
|
|
311
|
-
case critical
|
|
312
|
-
case urgent
|
|
308
|
+
case info
|
|
309
|
+
case warning
|
|
310
|
+
case critical
|
|
311
|
+
case urgent
|
|
313
312
|
}
|
|
314
313
|
|
|
315
314
|
public init(
|
|
@@ -322,8 +321,8 @@ public struct UsageAlert: Codable, Sendable, Identifiable {
|
|
|
322
321
|
currentUsage: Double,
|
|
323
322
|
estimatedTimeToLimit: TimeInterval? = nil,
|
|
324
323
|
recommendation: String,
|
|
325
|
-
createdAt: Date = Date()
|
|
326
|
-
|
|
324
|
+
createdAt: Date = Date())
|
|
325
|
+
{
|
|
327
326
|
self.id = id
|
|
328
327
|
self.provider = provider
|
|
329
328
|
self.severity = severity
|
|
@@ -350,9 +349,9 @@ public struct SyncState: Codable, Sendable {
|
|
|
350
349
|
public enum Platform: String, Codable, Sendable {
|
|
351
350
|
case macOS = "macos"
|
|
352
351
|
case iOS = "ios"
|
|
353
|
-
case android
|
|
354
|
-
case windows
|
|
355
|
-
case cli
|
|
352
|
+
case android
|
|
353
|
+
case windows
|
|
354
|
+
case cli
|
|
356
355
|
}
|
|
357
356
|
|
|
358
357
|
public init(
|
|
@@ -360,8 +359,8 @@ public struct SyncState: Codable, Sendable {
|
|
|
360
359
|
deviceName: String,
|
|
361
360
|
platform: Platform,
|
|
362
361
|
lastSync: Date = Date(),
|
|
363
|
-
snapshots: [String: EnhancedUsageSnapshot] = [:]
|
|
364
|
-
|
|
362
|
+
snapshots: [String: EnhancedUsageSnapshot] = [:])
|
|
363
|
+
{
|
|
365
364
|
self.deviceID = deviceID
|
|
366
365
|
self.deviceName = deviceName
|
|
367
366
|
self.platform = platform
|
|
@@ -241,7 +241,7 @@ public struct OpenAIDashboardFetcher {
|
|
|
241
241
|
throw FetchError.noDashboardData(body: lastBody ?? "")
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
struct CreditsHistoryWaitContext
|
|
244
|
+
struct CreditsHistoryWaitContext {
|
|
245
245
|
let now: Date
|
|
246
246
|
let anyDashboardSignalAt: Date?
|
|
247
247
|
let creditsHeaderVisibleAt: Date?
|