@kenz1117/dsh-ui-usage-billing 1.1.13 → 1.1.14

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/lib/index.js CHANGED
@@ -316,6 +316,7 @@ function isBeijingWeekend(timeMs) {
316
316
  */
317
317
  /** DeepSeek 官方高峰时段说明(峰谷分时计费目录条目共用)。 */
318
318
  const DEEPSEEK_PEAK_HOURS = "09:00-12:00 / 14:00-18:00";
319
+ const GEMINI_PEAK_HOURS = "Standard / Flex";
319
320
  const MODEL_CATALOG = [
320
321
  {
321
322
  key: "flash",
@@ -974,7 +975,7 @@ const MODEL_CATALOG = [
974
975
  output: 6
975
976
  }
976
977
  },
977
- peakHours: "Standard / Flex",
978
+ peakHours: GEMINI_PEAK_HOURS,
978
979
  tierSemantics: "latency"
979
980
  },
980
981
  {
@@ -993,7 +994,7 @@ const MODEL_CATALOG = [
993
994
  output: 3.75
994
995
  }
995
996
  },
996
- peakHours: "Standard / Flex",
997
+ peakHours: GEMINI_PEAK_HOURS,
997
998
  tierSemantics: "latency"
998
999
  },
999
1000
  {
@@ -1405,6 +1406,7 @@ const MODEL_KEY_ALIASES = {
1405
1406
  "deepseek-v4-flash": "flash",
1406
1407
  "deepseek-v4-flash-vision-exp": "flash-vision-exp",
1407
1408
  "deepseek-v4.1-flash": "flash",
1409
+ "deepseek-v4.1-flash-expires-on-0910": "flash",
1408
1410
  "deepseek-v4-pro": "pro",
1409
1411
  "glm-5.2": "glm",
1410
1412
  "glm-4.5-air": "glm-4.5-air",
@@ -2368,7 +2370,7 @@ function createUsageAggregator(persistence, options = {}) {
2368
2370
  id,
2369
2371
  ...cwd === void 0 ? {} : { cwd },
2370
2372
  ...stamp === null ? {} : { stamp },
2371
- foldVersion: 8,
2373
+ foldVersion: 9,
2372
2374
  fold: serializeFold(fold)
2373
2375
  };
2374
2376
  const row = ledger.get(id);
@@ -2458,7 +2460,7 @@ function createUsageAggregator(persistence, options = {}) {
2458
2460
  try {
2459
2461
  const cwd = meta.cwd;
2460
2462
  const ledgerRow = ledger.get(id);
2461
- if (ledgerRow !== void 0 && ledgerRow.stamp !== void 0 && stamp !== null && ledgerRow.stamp === stamp && (ledgerRow.foldVersion ?? 1) === 8) {
2463
+ if (ledgerRow !== void 0 && ledgerRow.stamp !== void 0 && stamp !== null && ledgerRow.stamp === stamp && (ledgerRow.foldVersion ?? 1) === 9) {
2462
2464
  const fold = deserializeFold(ledgerRow.fold);
2463
2465
  folds.push({
2464
2466
  id,
@@ -2541,7 +2543,7 @@ function createUsageAggregator(persistence, options = {}) {
2541
2543
  for (const entry of ledger.values()) {
2542
2544
  if (included.has(entry.id)) continue;
2543
2545
  try {
2544
- const stale = (entry.foldVersion ?? 1) < 8;
2546
+ const stale = (entry.foldVersion ?? 1) < 9;
2545
2547
  folds.push({
2546
2548
  id: entry.id,
2547
2549
  ...entry.cwd === void 0 ? {} : { cwd: entry.cwd },
@@ -431,8 +431,11 @@ export interface UsageLedgerDocument {
431
431
  * 单价计费(V4.1 Pro 上线前)——pro 目录价改写为 Flash 价、V4 Pro 刊例(峰
432
432
  * 9/0.3/27、谷 4.5/0.15/13.5)进 FLASH_REPRICED_OFFPEAK 供分界前回算;v7 及更早
433
433
  * 的行把分界后的 pro 全部按 V4 Pro 刊例折算(高估数倍),bump 全量重折对齐时间线。
434
+ * 9:V4.1 Flash 内测端点 id(expires-on-0910)收录进别名表——此前该 id 落目录兜底
435
+ * 条目(Custom),费用按 0 计且把「主力消耗模型余额」挤成「未配置」(issue #40
436
+ * 反馈);bump 让存量账单的内测用量按 flash 时间线重折归并。
434
437
  */
435
- export declare const FOLD_VERSION = 8;
438
+ export declare const FOLD_VERSION = 9;
436
439
  /**
437
440
  * 一次性账本迁移:id 唯一,apply 在加载边界对原始文档执行,已应用过的跳过。
438
441
  * 未来账本/schema 字段变更(重命名、拆桶、语义调整)时,在此追加一条迁移并
@@ -7,6 +7,7 @@
7
7
  * 4. 工具调用排行(byTool 计次;token 无法按工具归因)。
8
8
  */
9
9
  import type { UsageBillingKey } from './locales.ts';
10
+ import type { TrendSeriesModel } from './TrendChart.tsx';
10
11
  import type { UsageStats } from './UsageBilling.tsx';
11
12
  /**
12
13
  * Token 洞察面板。
@@ -18,6 +19,9 @@ export declare function TokenPanel(props: {
18
19
  stats: UsageStats;
19
20
  trendDays: 7 | 30;
20
21
  onTrendDays: (d: 7 | 30) => void;
22
+ models?: readonly TrendSeriesModel[];
23
+ /** 金额格式化(跟随仪表盘币种切换):费用构成区块展示用。 */
24
+ money: (cny: number) => string;
21
25
  t: (key: UsageBillingKey) => string;
22
26
  }): React.ReactNode;
23
27
  //# sourceMappingURL=TokenPanel.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** Locale dictionaries for the usage billing surface. */
2
- export type UsageBillingKey = 'title' | 'subtitle' | 'cost' | 'todayCost' | 'monthCost' | 'yearCost' | 'monthProjected' | 'liveTurn' | 'liveSession' | 'totalCost' | 'calls' | 'cacheHitRate' | 'tokens' | 'inputTokens' | 'outputTokens' | 'avgCost' | 'trend' | 'trend7d' | 'trend30d' | 'trendMetric' | 'trendMetricCost' | 'trendMetricTokens' | 'trendEmpty' | 'budget' | 'budgetAmount' | 'budgetSummary' | 'sessions' | 'sessionTitle' | 'project' | 'lastActive' | 'sessionOverflow' | 'budgetTierBody' | 'models' | 'providerBilling' | 'estimated' | 'actual' | 'pricing' | 'showPricing' | 'hidePricing' | 'pricePerM' | 'input' | 'output' | 'cacheHit' | 'peak' | 'offPeak' | 'flat' | 'peakHours' | 'band' | 'openDashboard' | 'close' | 'footer' | 'footerCredit' | 'lastUpdated' | 'noData' | 'todayRate' | 'rateLive' | 'rateBuiltin' | 'promoBadge' | 'promoUntil' | 'promoOpenEnded' | 'pricingTip' | 'pricingUnit' | 'pricingNotes' | 'ubPeak' | 'ubOff' | 'ubStd' | 'peakBand' | 'pricingSource' | 'noteCache' | 'noteBand' | 'noteSource' | 'balance' | 'balanceUnconfigured' | 'balanceUnauthorized' | 'balanceUnreachable' | 'uncatalogued' | 'estimatedPricing' | 'balanceDays' | 'balanceLowBody' | 'reconcileDrift' | 'reconcileDismiss' | 'subscriptions' | 'subscriptionNotConfigured' | 'subscriptionUnauthorized' | 'subscriptionUnavailable' | 'subscriptionInvalid' | 'subscriptionRateLimited' | 'subscriptionSession' | 'subscriptionWeekly' | 'subscriptionMonthly' | 'subscriptionBilling' | 'subscriptionRemaining' | 'subscriptionExhausted' | 'subscriptionReset' | 'subscriptionNoApi' | 'floatWindow' | 'floatModeCombined' | 'floatModeSubscription' | 'floatMode' | 'floatTargets' | 'floatWindowHint' | 'floatNoTargets' | 'floatNoTargetsHint' | 'cardDisplay' | 'cardDisplayHint' | 'cardMetric' | 'cardMetricMoney' | 'cardMetricTokens' | 'triggerMonthTokens' | 'floatPrev' | 'floatNext' | 'subscriptionsStale' | 'staleLedgerNotice' | 'tokenCacheWrite' | 'toolRank' | 'toolName' | 'userPrices' | 'userPricesHint' | 'userPriceSave' | 'userPriceModel' | 'userPriceSource' | 'userPriceSourceHint' | 'userPriceCurrency' | 'userPriceAdd' | 'userPriceRemove' | 'sessionStaleBadge' | 'sessionUntitled' | 'heatmapLess' | 'heatmapMore' | 'currency' | 'currencyCny' | 'currencyUsd' | 'heatmap' | 'rounds' | 'roundsHint' | 'anomaly' | 'workspaces' | 'workspacesHint' | 'plan' | 'remaining' | 'unknownModel' | 'model' | 'thModel' | 'thInputMiss' | 'thInputHit' | 'currentRound' | 'costAbbr' | 'tabOverview' | 'tabTrends' | 'tabProviders' | 'tabDetails' | 'tabPricing' | 'tabSettings' | 'settingsHead' | 'settingsHint' | 'budgetHint' | 'peakAlertHint' | 'peakAlertDescPeak' | 'peakAlertDescOff' | 'export' | 'exportCsvDay' | 'exportCsvSession' | 'exportJson' | 'peakShare' | 'peakSharePerCall' | 'offPeakSavings' | 'perfMax' | 'weekCost' | 'roleCost' | 'roleUser' | 'roleAssistant' | 'roleTool' | 'roleHint' | 'tierPeak' | 'tierOff' | 'tierToPeak' | 'tierToOff' | 'tierAlertEnterPeak' | 'tierAlertEnterOff' | 'peakAlertTitlePeak' | 'peakAlertTitleOff' | 'peakAlert' | 'peakAlertLeadMin' | 'peakAlertPos' | 'peakAlertMode' | 'peakAlertPosCorner' | 'peakAlertPosCenter' | 'peakAlertModePeak' | 'peakAlertModeOff' | 'peakAlertModeBoth' | 'peakAlertWebNotify' | 'peakAlertPreview' | 'planTypeCode' | 'planTypeToken' | 'subscriptionFeePerMonth' | 'triggerToday' | 'triggerMonth' | 'subscriptionIncluded' | 'free' | 'official' | 'thirdParty' | 'officialCost' | 'thirdPartyCost' | 'perfSamples' | 'perfTtft' | 'perfP50' | 'perfP90' | 'perfTps' | 'perfLatency' | 'perfEstimated' | 'perfEmpty' | 'perfTpsUnit' | 'perfTitle' | 'perfHint' | 'heatmapYear' | 'heatmapMonth' | 'activeDays' | 'streakDays' | 'subscriptionAutoDetect' | 'pluginInfo' | 'pluginName' | 'pluginDescription' | 'pluginVersion' | 'pluginAuthor' | 'pluginRepository' | 'pluginNpm' | 'pluginLicense' | 'tabToken' | 'tokenExport' | 'tokenExportCsv' | 'tokenCacheHitRate' | 'tokenReasoningShare' | 'tokenReasoningShort' | 'tokenIo' | 'tokenPeak' | 'tokenDaily' | 'tokenByModel' | 'tokenMiss' | 'tokenHit' | 'tokenOutput' | 'tokenTotal' | 'tokenShare' | 'usageStatsTool' | 'usageStatsToolHint' | 'balanceGranted' | 'balanceTopped' | 'balanceDaily' | 'balanceDaysLong' | 'balanceDaysUnit' | 'popTodayModel' | 'popNoConsumption' | 'popQuotaAlert' | 'popRiskNone' | 'popTitle' | 'popDirectLead' | 'popSubLead' | 'popBalanceNormal' | 'popBalanceLow' | 'popQuotaNormal' | 'popQuotaLow' | 'alertBalanceLow' | 'alertQuotaLow' | 'unpricedHint' | 'searchEstimateHint' | 'siteListDisplay' | 'siteListDisplayHint' | 'exportCsvSite' | 'panelRelay' | 'relaySite' | 'relayDirect' | 'relayUnknown' | 'panelRelayQuota' | 'relayBalance' | 'relayNoQuota' | 'relayWindowUsed' | 'relayKindNewApi' | 'relayKindSub2Api' | 'relayKindUnknown' | 'relayCalls';
2
+ export type UsageBillingKey = 'title' | 'subtitle' | 'cost' | 'todayCost' | 'monthCost' | 'yearCost' | 'monthProjected' | 'liveTurn' | 'liveSession' | 'totalCost' | 'calls' | 'cacheHitRate' | 'tokens' | 'inputTokens' | 'outputTokens' | 'avgCost' | 'trend' | 'trend7d' | 'trend30d' | 'trendMetric' | 'trendMetricCost' | 'trendMetricTokens' | 'trendEmpty' | 'budget' | 'budgetAmount' | 'budgetSummary' | 'sessions' | 'sessionTitle' | 'project' | 'lastActive' | 'sessionOverflow' | 'budgetTierBody' | 'models' | 'providerBilling' | 'estimated' | 'actual' | 'pricing' | 'showPricing' | 'hidePricing' | 'pricePerM' | 'input' | 'output' | 'cacheHit' | 'peak' | 'offPeak' | 'flat' | 'peakHours' | 'band' | 'openDashboard' | 'close' | 'footer' | 'footerCredit' | 'lastUpdated' | 'noData' | 'todayRate' | 'rateLive' | 'rateBuiltin' | 'promoBadge' | 'promoUntil' | 'promoOpenEnded' | 'pricingTip' | 'pricingUnit' | 'pricingNotes' | 'ubPeak' | 'ubOff' | 'ubStd' | 'peakBand' | 'pricingSource' | 'noteCache' | 'noteBand' | 'noteSource' | 'balance' | 'balanceUnconfigured' | 'balanceUnauthorized' | 'balanceUnreachable' | 'uncatalogued' | 'estimatedPricing' | 'balanceDays' | 'balanceLowBody' | 'reconcileDrift' | 'reconcileDismiss' | 'subscriptions' | 'subscriptionNotConfigured' | 'subscriptionUnauthorized' | 'subscriptionUnavailable' | 'subscriptionInvalid' | 'subscriptionRateLimited' | 'subscriptionSession' | 'subscriptionWeekly' | 'subscriptionMonthly' | 'subscriptionBilling' | 'subscriptionRemaining' | 'subscriptionExhausted' | 'subscriptionReset' | 'subscriptionNoApi' | 'floatWindow' | 'floatModeCombined' | 'floatModeSubscription' | 'floatMode' | 'floatTargets' | 'floatWindowHint' | 'floatNoTargets' | 'floatNoTargetsHint' | 'cardDisplay' | 'cardDisplayHint' | 'cardMetric' | 'cardMetricMoney' | 'cardMetricTokens' | 'triggerMonthTokens' | 'floatPrev' | 'floatNext' | 'subscriptionsStale' | 'staleLedgerNotice' | 'tokenCacheWrite' | 'toolRank' | 'toolName' | 'userPrices' | 'userPricesHint' | 'userPriceSave' | 'userPriceModel' | 'userPriceSource' | 'userPriceSourceHint' | 'userPriceCurrency' | 'userPriceAdd' | 'userPriceRemove' | 'sessionStaleBadge' | 'sessionUntitled' | 'heatmapLess' | 'heatmapMore' | 'currency' | 'currencyCny' | 'currencyUsd' | 'heatmap' | 'rounds' | 'roundsHint' | 'anomaly' | 'workspaces' | 'workspacesHint' | 'plan' | 'remaining' | 'unknownModel' | 'model' | 'thModel' | 'thInputMiss' | 'thInputHit' | 'currentRound' | 'costAbbr' | 'tabOverview' | 'tabTrends' | 'tabProviders' | 'tabDetails' | 'tabPricing' | 'tabSettings' | 'settingsHead' | 'settingsHint' | 'budgetHint' | 'peakAlertHint' | 'peakAlertDescPeak' | 'peakAlertDescOff' | 'export' | 'exportCsvDay' | 'exportCsvSession' | 'exportJson' | 'peakShare' | 'peakSharePerCall' | 'offPeakSavings' | 'perfMax' | 'weekCost' | 'roleCost' | 'roleUser' | 'roleAssistant' | 'roleTool' | 'roleHint' | 'tierPeak' | 'tierOff' | 'tierToPeak' | 'tierToOff' | 'tierAlertEnterPeak' | 'tierAlertEnterOff' | 'peakAlertTitlePeak' | 'peakAlertTitleOff' | 'peakAlert' | 'peakAlertLeadMin' | 'peakAlertPos' | 'peakAlertMode' | 'peakAlertPosCorner' | 'peakAlertPosCenter' | 'peakAlertModePeak' | 'peakAlertModeOff' | 'peakAlertModeBoth' | 'peakAlertWebNotify' | 'peakAlertPreview' | 'planTypeCode' | 'planTypeToken' | 'subscriptionFeePerMonth' | 'triggerToday' | 'triggerMonth' | 'subscriptionIncluded' | 'free' | 'perfSamples' | 'perfTtft' | 'perfP50' | 'perfP90' | 'perfTps' | 'perfLatency' | 'perfEstimated' | 'perfEmpty' | 'perfTpsUnit' | 'perfTitle' | 'perfHint' | 'heatmapYear' | 'heatmapMonth' | 'activeDays' | 'streakDays' | 'subscriptionAutoDetect' | 'pluginInfo' | 'pluginName' | 'pluginDescription' | 'pluginVersion' | 'pluginAuthor' | 'pluginRepository' | 'pluginNpm' | 'pluginLicense' | 'tabToken' | 'tokenExport' | 'tokenExportCsv' | 'tokenCacheHitRate' | 'tokenReasoningShare' | 'tokenReasoningShort' | 'tokenIo' | 'tokenPeak' | 'tokenDaily' | 'tokenByModel' | 'tokenMiss' | 'tokenHit' | 'tokenOutput' | 'tokenTotal' | 'tokenShare' | 'usageStatsTool' | 'usageStatsToolHint' | 'balanceGranted' | 'balanceTopped' | 'balanceDaily' | 'balanceDaysLong' | 'balanceDaysUnit' | 'popTodayModel' | 'popNoConsumption' | 'popQuotaAlert' | 'popRiskNone' | 'popTitle' | 'popDirectLead' | 'popSubLead' | 'popBalanceNormal' | 'popBalanceLow' | 'popQuotaNormal' | 'popQuotaLow' | 'alertBalanceLow' | 'alertQuotaLow' | 'unpricedHint' | 'searchEstimateHint' | 'siteListDisplay' | 'siteListDisplayHint' | 'exportCsvSite' | 'panelRelay' | 'relaySite' | 'relayDirect' | 'relayUnknown' | 'panelRelayQuota' | 'relayBalance' | 'relayNoQuota' | 'relayWindowUsed' | 'relayKindNewApi' | 'relayKindSub2Api' | 'relayKindUnknown' | 'relayCalls';
3
3
  export declare const NS = "usageBilling";
4
4
  export declare const zh: Record<UsageBillingKey, string>;
5
5
  export declare const en: Record<UsageBillingKey, string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kenz1117/dsh-ui-usage-billing",
3
3
  "description": "Usage billing dashboard for DeepSeek Harness: sidebar cost metrics plus a full dashboard modal, priced from a current multi-provider catalog with real usage aggregated from session logs.",
4
- "version": "1.1.13",
4
+ "version": "1.1.14",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },