-
Notifications
You must be signed in to change notification settings - Fork 48
feat: [TBB] Implement quota warning handling and UI updates for TBB #186
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
99de690
feat: Refactor quota usage menu and UI updates
ethanyhou 3116cfd
Address comments.
ethanyhou a3bc574
feat: Implement TBB quota warning notifications and related UI compon…
ethanyhou ab9a6c5
Merge branch 'ethan/tbb-plan-usage' into ethan/tbb-notification
ethanyhou 60dd17b
Merge branch 'main' into ethan/tbb-notification
ethanyhou 9536b05
feat: Implement quota warning handling and UI updates for TBB
ethanyhou 89a9b43
Removed redundant code.
ethanyhou 7c5ce0e
Address comments.
ethanyhou 464a817
refactor: Clean up unused imports and update warning widget layout
ethanyhou 828fd5c
feat: updated quota warning msg with overage support
ethanyhou fbafcd2
Address comments.
ethanyhou 0576d73
Merge branch 'main' into ethan/tbb-notification
ethanyhou 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
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
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
17 changes: 17 additions & 0 deletions
17
...eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/IntervalQuota.java
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,17 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package com.microsoft.copilot.eclipse.core.lsp.protocol.quota; | ||
|
|
||
| /** | ||
| * Interval-based quota information, used for immediateUsageInterval and extendedUsageInterval. | ||
| */ | ||
| public record IntervalQuota( | ||
| double percentRemaining, | ||
| boolean unlimited, | ||
| boolean overagePermitted, | ||
| Integer entitlement, | ||
| Integer quotaRemaining, | ||
| String timeStamp, | ||
| String resetAt) { | ||
| } |
20 changes: 20 additions & 0 deletions
20
...pse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/QuotaChangeParams.java
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,20 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package com.microsoft.copilot.eclipse.core.lsp.protocol.quota; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
|
|
||
| /** | ||
| * Parameters for the {@code copilot/quotaChange} notification, sent by the language server | ||
| * whenever the user's quota usage changes. | ||
| * | ||
| * @param chat current chat quota snapshot, when available | ||
| * @param completions current completions quota snapshot, when available | ||
| * @param premiumInteractions current premium interactions quota snapshot, when available | ||
| * @param copilotPlan the user's Copilot plan (e.g. free, individual, individual_pro, individual_max, | ||
| * business, enterprise) | ||
| */ | ||
| public record QuotaChangeParams(QuotaSnapshotParams chat, QuotaSnapshotParams completions, | ||
| @SerializedName("premium_interactions") QuotaSnapshotParams premiumInteractions, String copilotPlan) { | ||
| } |
48 changes: 48 additions & 0 deletions
48
...e/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/QuotaWarningNotification.java
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,48 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package com.microsoft.copilot.eclipse.core.lsp.protocol.quota; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
|
|
||
| /** | ||
| * Parameters for the {@code copilot/quotaWarning} notification. Sent by the language server when the user's AI quota | ||
| * exceeds a warning threshold. | ||
| * | ||
| * @param title the popup title supplied by the language server | ||
| * @param message the popup body message | ||
| * @param severity the language-server severity hint (e.g. {@code "info"} or {@code "warning"}); used by the client to | ||
| * decide which icon to render on the banner. May be {@code null}. | ||
| * @param copilotPlan the user's Copilot plan | ||
| * @param premiumInteractions the premium-interactions snapshot for the warning, or {@code null} when the language | ||
| * server does not include it | ||
| */ | ||
| public record QuotaWarningNotification( | ||
| String title, | ||
| String message, | ||
| String severity, | ||
| CopilotPlan copilotPlan, | ||
| @SerializedName("premium_interactions") PremiumInteractions premiumInteractions) { | ||
|
|
||
| /** | ||
| * Premium-interactions snapshot embedded in a {@link QuotaWarningNotification}. The shape is dictated by the | ||
| * language server and differs from {@link Quota}. | ||
| * | ||
| * @param quota total monthly premium-interactions allowance | ||
| * @param used premium interactions consumed so far this period | ||
| * @param percentRemaining percentage of the allowance remaining | ||
| * @param overageUsed additional paid interactions consumed beyond the allowance | ||
| * @param overageEnabled whether the user has enabled paid overage | ||
| * @param resetDate ISO-8601 instant when the monthly allowance resets, or {@code null} | ||
| * @param unlimited whether this quota has no monthly limit | ||
| */ | ||
| public record PremiumInteractions( | ||
| double quota, | ||
| double used, | ||
| double percentRemaining, | ||
| double overageUsed, | ||
| boolean overageEnabled, | ||
| String resetDate, | ||
| boolean unlimited) { | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
...se.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/QuotaWarningParams.java
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,23 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| package com.microsoft.copilot.eclipse.core.lsp.protocol.quota; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
|
|
||
| /** | ||
| * Parameters for the {@code copilot/quotaWarning} notification, sent by the language server when | ||
| * the user crosses a quota usage threshold or starts consuming overages. | ||
| * | ||
| * @param title warning title (e.g. "Copilot Quota Usage Alert") | ||
| * @param message human-readable warning message | ||
| * @param severity severity level, either {@code "warning"} or {@code "info"} | ||
| * @param chat current chat quota snapshot, when available | ||
| * @param completions current completions quota snapshot, when available | ||
| * @param premiumInteractions current premium interactions quota snapshot, when available | ||
| * @param copilotPlan the user's Copilot plan | ||
| */ | ||
| public record QuotaWarningParams(String title, String message, String severity, QuotaSnapshotParams chat, | ||
|
ethanyhou marked this conversation as resolved.
|
||
| QuotaSnapshotParams completions, | ||
| @SerializedName("premium_interactions") QuotaSnapshotParams premiumInteractions, String copilotPlan) { | ||
| } | ||
|
ethanyhou marked this conversation as resolved.
|
||
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
Oops, something went wrong.
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.