Public Access
1
0

feat: add billing foundation and entitlement enforcement

- add workspace-scoped billing storage, usage tracking, and add-on catalog
- enforce plan entitlements for search and deep research routes
- expand pricing and account UI around billing state, usage, and upgrades
This commit is contained in:
pguerrerox
2026-05-22 17:50:28 +00:00
parent f1a46c79f2
commit 94b8c357b4
21 changed files with 2269 additions and 151 deletions
+22 -1
View File
@@ -1,4 +1,5 @@
import type { BillingInterval, PlanCode } from './billing/plans.js';
import type { AddonCode, BillingInterval, PlanCode } from './billing/plans.js';
import type { UsageAllowanceAvailability, UsageResource } from './billing/entitlements.js';
export type JobStatus = 'pending' | 'running' | 'completed' | 'failed' | 'stopped';
@@ -34,10 +35,30 @@ export interface AccountSummary {
export type AccountBillingStatus = 'not_configured' | 'inactive' | 'active' | 'past_due' | 'canceled';
export interface BillingUsageResourceSummary {
resource: UsageResource;
availability: UsageAllowanceAvailability;
included: number | null;
consumed: number;
remaining: number | null;
}
export interface BillingAddonBalanceSummary {
addonCode: AddonCode;
resource: UsageResource;
remainingQuantity: number;
expiresAt: string | null;
}
export interface AccountBillingState {
status: AccountBillingStatus;
planCode: PlanCode | null;
billingInterval: BillingInterval | null;
currentPeriodStartsAt: string | null;
currentPeriodEndsAt: string | null;
cancelAtPeriodEnd: boolean;
usage: BillingUsageResourceSummary[];
addonBalances: BillingAddonBalanceSummary[];
message: string;
}