@molecule/app-ide-react 1.10.2 → 1.11.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAY3C,OAAO,KAAK,EAAa,WAAW,EAAmB,MAAM,uBAAuB,CAAA;AAuCpF,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAevD,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,oBAAoB,CAAA;AAY3B,OAAO,KAAK,EAAsB,SAAS,EAAE,MAAM,gCAAgC,CAAA;AA6LnF,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AA+ND,UAAU,WAAW;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;
|
|
1
|
+
{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAY3C,OAAO,KAAK,EAAa,WAAW,EAAmB,MAAM,uBAAuB,CAAA;AAuCpF,OAAO,KAAK,EAAE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B,EACxC,OAAO,EAAE,iBAAiB,EAC1B,gBAAgB,EAAE,0BAA0B,EAC5C,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,sBAAsB,EACxC,kBAAkB,EAAE,wBAAwB,EAC5C,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,OAAc,EACd,QAAQ,EACR,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,SAAS,EACT,WAAW,EACX,OAAO,EACP,aAAa,EACb,WAAW,EACX,SAAS,GACV,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CA2c9B;yBApgBe,SAAS"}
|
|
@@ -280,7 +280,13 @@ function relativeTimeLong(ms) {
|
|
|
280
280
|
/**
|
|
281
281
|
* Format an AI-allowance window reset (epoch ms) as a short countdown phrase for
|
|
282
282
|
* the /cost used-up line ("refreshes in about 3 hours"). Under an hour reads "in
|
|
283
|
-
* under an hour"; ≥ 6h out on a later local calendar day reads "tomorrow"
|
|
283
|
+
* under an hour"; ≥ 6h out on a later local calendar day reads "tomorrow"; a day
|
|
284
|
+
* or more out reads "in about N days".
|
|
285
|
+
*
|
|
286
|
+
* The day scale is what makes this usable on a BILLING-PERIOD allowance, which
|
|
287
|
+
* can be weeks out — an hours-only formatter capped at "tomorrow", so a window
|
|
288
|
+
* ending in 18 days told the user it came back in the morning.
|
|
289
|
+
*
|
|
284
290
|
* @param resetAt - Epoch ms of the window end (always in the future from the API).
|
|
285
291
|
* @returns A localized human countdown phrase.
|
|
286
292
|
*/
|
|
@@ -293,6 +299,13 @@ function allowanceResetCountdown(resetAt) {
|
|
|
293
299
|
if (hours < 1) {
|
|
294
300
|
return t('ide.chat.resetUnderHour', undefined, { defaultValue: 'in under an hour' });
|
|
295
301
|
}
|
|
302
|
+
if (hours >= 24) {
|
|
303
|
+
const days = Math.round(hours / 24);
|
|
304
|
+
if (days <= 1) {
|
|
305
|
+
return t('ide.chat.resetTomorrow', undefined, { defaultValue: 'tomorrow' });
|
|
306
|
+
}
|
|
307
|
+
return t('ide.chat.resetInDays', { days }, { defaultValue: `in about ${days} ${days === 1 ? 'day' : 'days'}` });
|
|
308
|
+
}
|
|
296
309
|
const rounded = Math.round(hours);
|
|
297
310
|
const laterLocalDay = new Date(resetAt).toDateString() !== new Date().toDateString();
|
|
298
311
|
if (laterLocalDay && rounded >= 6) {
|
|
@@ -3956,23 +3969,40 @@ function ChatInner({ projectId, endpoint, initialMessage, onInitialMessageSent,
|
|
|
3956
3969
|
const res = await http.get(usageUrl);
|
|
3957
3970
|
const d = res.data;
|
|
3958
3971
|
const fmt = formatTokenTotal;
|
|
3959
|
-
// AI usage is shown as a UNITLESS share of
|
|
3960
|
-
//
|
|
3961
|
-
//
|
|
3972
|
+
// AI usage is shown as a UNITLESS share of the allowance — currency
|
|
3973
|
+
// never appears on AI-usage surfaces. The percent is the owner's
|
|
3974
|
+
// spend in their CURRENT window (the number the chat gate actually
|
|
3962
3975
|
// enforces), so 100% here IS the block point; at/above it the card
|
|
3963
3976
|
// switches to the used-up line with the window's reset countdown.
|
|
3977
|
+
//
|
|
3978
|
+
// `allowanceWindow` says which span that is: the unpaid tiers meter
|
|
3979
|
+
// over a rolling day, the paid ones over their billing period, which
|
|
3980
|
+
// refreshes monthly (a yearly subscriber included). Naming the wrong
|
|
3981
|
+
// one is not cosmetic — this card said "today's" to a Pro user whose
|
|
3982
|
+
// allowance is monthly, so the plan read as day-capped. An older API
|
|
3983
|
+
// omits the field; fall back to the daily framing that shipped with it
|
|
3984
|
+
// rather than promising a month we cannot confirm.
|
|
3985
|
+
const isMonthlyAllowance = d.allowanceWindow === 'billing-period';
|
|
3964
3986
|
const allowanceLine = typeof d.allowancePercent === 'number'
|
|
3965
3987
|
? '\n' +
|
|
3966
3988
|
(d.allowancePercent >= 100 && typeof d.allowanceResetAt === 'number'
|
|
3967
|
-
?
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3989
|
+
? isMonthlyAllowance
|
|
3990
|
+
? t('ide.chat.usageAllowanceUsedUpMonthlyLine', { when: allowanceResetCountdown(d.allowanceResetAt) }, {
|
|
3991
|
+
defaultValue: 'This month’s AI allowance is used up — refreshes {{when}}.',
|
|
3992
|
+
})
|
|
3993
|
+
: t('ide.chat.usageAllowanceUsedUpLine', { when: allowanceResetCountdown(d.allowanceResetAt) }, {
|
|
3994
|
+
defaultValue: "Today's AI allowance is used up — refreshes {{when}}.",
|
|
3995
|
+
})
|
|
3996
|
+
: // Neutral phrasing on purpose in both: the allowance belongs
|
|
3997
|
+
// to the PROJECT (its owner's plan window) — "you've used"
|
|
3973
3998
|
// misattributed it to whichever teammate ran /cost.
|
|
3974
|
-
|
|
3975
|
-
|
|
3999
|
+
isMonthlyAllowance
|
|
4000
|
+
? t('ide.chat.usageAllowanceMonthlyLine', { percent: d.allowancePercent }, {
|
|
4001
|
+
defaultValue: '~{{percent}}% of this month’s AI allowance used.',
|
|
4002
|
+
})
|
|
4003
|
+
: t('ide.chat.usageAllowanceTodayLine', { percent: d.allowancePercent }, {
|
|
4004
|
+
defaultValue: "~{{percent}}% of today's AI allowance used.",
|
|
4005
|
+
}))
|
|
3976
4006
|
: '';
|
|
3977
4007
|
// `inputTokens` counts only the UNCACHED prompt: every bond normalizes
|
|
3978
4008
|
// cache hits into their own bucket (on OpenAI-compatible APIs like
|