Skip to content

Commit f25d405

Browse files
Sync public snapshot from freebuff-private
Source: CodebuffAI/freebuff-private@dc4f78662fd4c699e74baeaae4f865de34fec9ee
1 parent 6e53c6d commit f25d405

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

cli/src/components/freebuff-landing-screen.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,12 @@ export const FreebuffLandingScreen: React.FC<FreebuffLandingScreenProps> = ({
803803
{formatSessionUnits(session.recentCount)} of {session.limit}
804804
</span>{' '}
805805
sessions{' '}
806-
{session.period === 'pacific_week' ? 'this week' : 'today'}. Try
806+
{session.period === 'pacific_month'
807+
? 'this month'
808+
: session.period === 'pacific_week'
809+
? 'this week'
810+
: 'today'}
811+
. Try
807812
again in{' '}
808813
<span fg={theme.foreground}>
809814
{formatRetryAfter(session.retryAfterMs)}

common/src/types/freebuff-session.ts

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,36 @@ export interface FreebuffFreebucksSpendCeiling {
186186
resetAt: string
187187
}
188188

189+
/**
190+
* The MONTHLY dollar allowance: what this account may draw in provider spend
191+
* over the period, what it has drawn, and what is left.
192+
*
193+
* Unlike the daily ceiling above, this one IS shown — as "$N left" beside the
194+
* Freebucks balances — because the two answer different questions. The daily
195+
* figure is an abuse backstop nobody should ever meet, and showing it invited
196+
* the reading that the dollars run out before the Freebucks do. This one is
197+
* the honest size of the gift: it is what the plan card advertises, it is what
198+
* the server enforces, and a user who wants to know how much they are being
199+
* given can read it directly instead of inferring it from a session price.
200+
*
201+
* `spentUsd` lags live traffic by up to an hour: it is summed from the hourly
202+
* spend rollup rather than the hot `message` table, deliberately, because a
203+
* SUM over that table on every session response is the shape of the
204+
* 2026-08-17 saturation. For a monthly bound an hour of lag is noise.
205+
*/
206+
export interface FreebuffFreebucksMonthlyAllowance {
207+
/** Provider spend for the period at which fresh sessions stop. */
208+
limitUsd: number
209+
/** Settled spend so far this period, from the hourly rollup. */
210+
spentUsd: number
211+
/** `limitUsd - spentUsd`, floored at zero so an overshoot reads as spent
212+
* rather than as a negative allowance. */
213+
remainingUsd: number
214+
/** ISO instant the period rolls: the Stripe period end for a subscriber,
215+
* else the first of next month. */
216+
resetAt: string
217+
}
218+
189219
/**
190220
* The caller's Freebucks position, present on every authenticated session
191221
* response inside the rollout audience. Distinct from Trust: Freebucks are a
@@ -202,6 +232,10 @@ export interface FreebuffFreebucksInfo {
202232
daily: FreebuffFreebucksWindow
203233
wallet: FreebuffFreebucksWallet
204234
spend: FreebuffFreebucksSpendCeiling
235+
/** The monthly dollar allowance, shown to the user and enforced. Absent
236+
* from a server that predates it, so clients render nothing rather than
237+
* a zero that would read as "you have nothing left". */
238+
monthly?: FreebuffFreebucksMonthlyAllowance
205239
/** The plan the daily pool and bonus were sized from; null on free. */
206240
planId: string | null
207241
/** Session price per model id. Only models on the meter appear here. */
@@ -311,8 +345,17 @@ export interface FreebuffSessionRateLimit {
311345
limit: number
312346
/** 'pacific_day' for the daily pools (premium/limited, and the reward
313347
* referral pool since 2026-07-29). 'pacific_week' is kept for wire compat
314-
* with servers from when the GLM pool reset weekly. */
315-
period: 'pacific_day' | 'pacific_week'
348+
* with servers from when the GLM pool reset weekly.
349+
*
350+
* 'pacific_month' arrived with the monthly dollar allowance. EVERY RELEASED
351+
* CLIENT renders an unrecognised value as "today" (`period === 'pacific_week'
352+
* ? 'this week' : 'today'`), which is wrong copy rather than a crash — it
353+
* invites a user to retry in the morning for an allowance that returns on
354+
* the 1st. Harmless today because only Freebuff Web is on the meter and its
355+
* copy is updated in step; a widening of the Freebucks audience has to
356+
* carry a client release with it, or accept that wording. `resetAt` is
357+
* correct on every client either way, so anything reading THAT is safe. */
358+
period: 'pacific_day' | 'pacific_week' | 'pacific_month'
316359
resetTimeZone: string
317360
resetAt: string
318361
/** Deprecated wire field kept for older clients. Session usage now follows
@@ -834,7 +877,7 @@ export type FreebuffSessionAdmissionResponse = (
834877
limit: number
835878
/** Additive detail for `limit`; absent on older servers. */
836879
entitlementBreakdown?: FreebuffSessionEntitlementBreakdown
837-
period: 'pacific_day' | 'pacific_week'
880+
period: 'pacific_day' | 'pacific_week' | 'pacific_month'
838881
resetTimeZone: string
839882
resetAt: string
840883
/** Deprecated wire field kept for older clients. */

0 commit comments

Comments
 (0)