@kenz1117/dsh-ui-usage-billing 1.8.2 → 1.8.3-alpha.2

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
@@ -641,14 +641,16 @@ function isPriced(key) {
641
641
  }
642
642
  /**
643
643
  * 促销在 nowMs 是否生效:factor 必须落在 [0,1) 区间(0 = 活动期免费,issue #86),
644
- * 截止时刻及之后视为过期;endsAtMs 缺省表示长期活动,在 factor 合法期间持续生效。
644
+ * 截止时刻及之后视为过期;endsAtMs 缺省表示长期活动,在 factor 合法期间持续生效;
645
+ * startsAtMs 给出时,该时刻之前尚未开始(按刊例价计,不套折扣)。
645
646
  * 导出供测试:纯函数。
646
647
  * @param promo - 待判定的促销窗口。
647
648
  * @param nowMs - 判定时刻(epoch ms)。
648
649
  */
649
650
  function isPromoActive(promo, nowMs) {
650
651
  const expired = promo.endsAtMs !== void 0 && nowMs >= promo.endsAtMs;
651
- return Number.isFinite(nowMs) && !expired && promo.factor >= 0 && promo.factor < 1;
652
+ const notStarted = promo.startsAtMs !== void 0 && nowMs < promo.startsAtMs;
653
+ return Number.isFinite(nowMs) && !expired && !notStarted && promo.factor >= 0 && promo.factor < 1;
652
654
  }
653
655
  /**
654
656
  * 把限时促销折入条目单价:生效期内返回 price 主档与 offPeak 逐档乘折扣系数的
@@ -802,6 +804,14 @@ function formatTokens(value) {
802
804
  * (models.dev 的 -cn 目录),该目录缺项时按 USD 价 × 汇率折算。既有条目一律
803
805
  * 不动——存量价格的更正走独立的调价节点,不与扩容混在一起。
804
806
  *
807
+ * 2026-11-04 扩容:补录腾讯混元 TokenHub 官方在售的 6 条新条目——Hy4 正式版
808
+ * (2026-11-03 上线,刊例价 ¥6/¥0.3/¥18,与 Preview 同价;官方同期公布「按
809
+ * 目录价格 5 折结算至 2026-12-31 23:59:59(北京时间)」的限时折扣,按 promo
810
+ * 建模:刊例价留在 price 表,折扣只在计价/显示出口折算)与混元 MT2-Pro/Plus/
811
+ * Lite、Role-Latest/Role 两个系列(翻译与角色扮演专用模型,无缓存命中档)。
812
+ * 价源 = 腾讯云 TokenHub「模型价格」页(2026-11-04 更新)的官方 CN 价。
813
+ * Hy4 preview 条目与其价格一律不动——同 id 不同模型的收录不构成调价。
814
+ *
805
815
  * Time-of-day billing (peak/off-peak) is now real: DeepSeek V4 officially
806
816
  * splits peak (09:00-12:00 / 14:00-18:00 Beijing) at 2x the off-peak rate
807
817
  * from 2026-08-17, and Gemini's Flex tier discounts spare-capacity traffic.
@@ -1548,6 +1558,84 @@ const BUILTIN_MODEL_CATALOG = [
1548
1558
  output: 18
1549
1559
  }
1550
1560
  },
1561
+ {
1562
+ key: "hunyuan-hy4",
1563
+ name: "混元 Hy4",
1564
+ provider: "腾讯混元",
1565
+ colorVar: "dsw-static-amber-400",
1566
+ price: {
1567
+ currency: "CNY",
1568
+ input: 6,
1569
+ cacheHit: .3,
1570
+ output: 18
1571
+ },
1572
+ promo: {
1573
+ factor: .5,
1574
+ startsAtMs: Date.UTC(2026, 10, 2, 16, 0, 0),
1575
+ endsAtMs: Date.UTC(2026, 11, 31, 15, 59, 59),
1576
+ note: "限时 5 折至 2026-12-31"
1577
+ }
1578
+ },
1579
+ {
1580
+ key: "hy-mt2-pro",
1581
+ name: "混元 MT2-Pro",
1582
+ provider: "腾讯混元",
1583
+ colorVar: "dsw-static-amber-300",
1584
+ price: {
1585
+ currency: "CNY",
1586
+ input: .5,
1587
+ cacheHit: 0,
1588
+ output: 2
1589
+ }
1590
+ },
1591
+ {
1592
+ key: "hy-mt2-plus",
1593
+ name: "混元 MT2-Plus",
1594
+ provider: "腾讯混元",
1595
+ colorVar: "dsw-static-amber-300",
1596
+ price: {
1597
+ currency: "CNY",
1598
+ input: .5,
1599
+ cacheHit: 0,
1600
+ output: 2
1601
+ }
1602
+ },
1603
+ {
1604
+ key: "hy-mt2-lite",
1605
+ name: "混元 MT2-Lite",
1606
+ provider: "腾讯混元",
1607
+ colorVar: "dsw-static-amber-300",
1608
+ price: {
1609
+ currency: "CNY",
1610
+ input: .3,
1611
+ cacheHit: 0,
1612
+ output: 1.2
1613
+ }
1614
+ },
1615
+ {
1616
+ key: "hunyuan-role-latest",
1617
+ name: "混元 Role-Latest",
1618
+ provider: "腾讯混元",
1619
+ colorVar: "dsw-static-amber-300",
1620
+ price: {
1621
+ currency: "CNY",
1622
+ input: 2.4,
1623
+ cacheHit: 0,
1624
+ output: 9.6
1625
+ }
1626
+ },
1627
+ {
1628
+ key: "hy-role",
1629
+ name: "混元 Role",
1630
+ provider: "腾讯混元",
1631
+ colorVar: "dsw-static-amber-300",
1632
+ price: {
1633
+ currency: "CNY",
1634
+ input: 2.4,
1635
+ cacheHit: 0,
1636
+ output: 9.6
1637
+ }
1638
+ },
1551
1639
  {
1552
1640
  key: "hunyuan-t1",
1553
1641
  name: "混元 T1",
@@ -4024,10 +4112,10 @@ const BUILTIN_MODEL_KEY_ALIASES = {
4024
4112
  "command-r-08-2024": "command-r-08-2024",
4025
4113
  "command-r": "command-r-08-2024",
4026
4114
  "hy3": "hunyuan",
4115
+ "hy4": "hunyuan-hy4",
4116
+ "hunyuan-hy4": "hunyuan-hy4",
4027
4117
  "hy4-preview": "hunyuan-hy4-preview",
4028
- "hy4": "hunyuan-hy4-preview",
4029
4118
  "hunyuan-hy4-preview": "hunyuan-hy4-preview",
4030
- "hunyuan-hy4": "hunyuan-hy4-preview",
4031
4119
  "longcat-2.0": "longcat-2.0",
4032
4120
  "longcat-2": "longcat-2.0",
4033
4121
  "minicpm-v-4.5": "minicpm-v-4.5",
@@ -280,6 +280,14 @@ export interface ModelPrice extends PriceBand {
280
280
  export interface PricePromo {
281
281
  /** 折扣系数(0.5 = 五折,0 = 活动期免费);仅 [0,1) 区间有效,非法值视为无促销。 */
282
282
  factor: number;
283
+ /**
284
+ * 生效起始时刻(epoch ms):该时刻起才按折扣计价。缺省表示自模型上线起
285
+ * 持续生效(多数厂商的「限时折扣」只公布截止日)。给出起点时,早于该
286
+ * 时刻的历史事件按刊例价计——与「按事件发生时刻适用当时的官方规则」
287
+ * 同一口径(如 Hy4 正式版:2026-11-03 上线,官方价目页同日挂出 5 折说明,
288
+ * 上线前不存在的流量不受折扣影响)。
289
+ */
290
+ startsAtMs?: number;
283
291
  /**
284
292
  * 分档折扣覆盖:厂商对不同档位给不同折扣时逐档指定(如 GPT-5.6 Sol 促销为
285
293
  * 缓存 0.8 / 输入 0.8 / 输出 2/3)。缺省档位沿用 {@link factor};单档取值
@@ -383,7 +391,8 @@ export declare function modelOf(key: string): ModelEntry;
383
391
  export declare function isPriced(key: string): boolean;
384
392
  /**
385
393
  * 促销在 nowMs 是否生效:factor 必须落在 [0,1) 区间(0 = 活动期免费,issue #86),
386
- * 截止时刻及之后视为过期;endsAtMs 缺省表示长期活动,在 factor 合法期间持续生效。
394
+ * 截止时刻及之后视为过期;endsAtMs 缺省表示长期活动,在 factor 合法期间持续生效;
395
+ * startsAtMs 给出时,该时刻之前尚未开始(按刊例价计,不套折扣)。
387
396
  * 导出供测试:纯函数。
388
397
  * @param promo - 待判定的促销窗口。
389
398
  * @param nowMs - 判定时刻(epoch ms)。
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.8.2",
4
+ "version": "1.8.3-alpha.2",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "deepseek",
@@ -86,7 +86,8 @@
86
86
  "0.2.1-rc.4": "compatible",
87
87
  "0.2.1-rc.5": "compatible",
88
88
  "0.2.2-alpha.2": "compatible",
89
- "0.2.2-alpha.3": "compatible"
89
+ "0.2.2-alpha.3": "compatible",
90
+ "0.2.2-rc.1": "compatible"
90
91
  }
91
92
  }
92
93
  },
@@ -135,68 +136,68 @@
135
136
  "clsx": "^2.1.1"
136
137
  },
137
138
  "devDependencies": {
138
- "@deepseek-ai/cordis": "4.0.6-alpha.2",
139
- "@deepseek-ai/cordis-plugin-include": "1.0.11-alpha.2",
140
- "@deepseek-ai/cordis-plugin-loader": "1.0.7-alpha.2",
141
- "@deepseek-ai/cordis-plugin-group": "1.0.6-alpha.2",
142
- "@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
143
- "@deepseek-ai/dsh-agent-default-model": "0.2.2-alpha.3",
144
- "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-alpha.3",
145
- "@deepseek-ai/dsh-api-gateway": "0.2.2-alpha.3",
146
- "@deepseek-ai/dsh-api-remotes": "0.2.2-alpha.3",
147
- "@deepseek-ai/dsh-api-session-controller": "0.2.2-alpha.3",
148
- "@deepseek-ai/dsh-app-boot": "0.2.2-alpha.3",
149
- "@deepseek-ai/dsh-atomic-write": "0.2.2-alpha.3",
150
- "@deepseek-ai/dsh-attachment": "0.2.2-alpha.3",
151
- "@deepseek-ai/dsh-client-connection": "0.2.2-alpha.3",
152
- "@deepseek-ai/dsh-client-file-upload": "0.2.2-alpha.3",
153
- "@deepseek-ai/dsh-client-locale": "0.2.2-alpha.3",
154
- "@deepseek-ai/dsh-client-store": "0.2.2-alpha.3",
155
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-alpha.3",
156
- "@deepseek-ai/dsh-client-ui-commands": "0.2.2-alpha.3",
157
- "@deepseek-ai/dsh-client-ui-workspace": "0.2.2-alpha.3",
158
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-alpha.3",
159
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-alpha.3",
160
- "@deepseek-ai/dsh-client-ui-settings": "0.2.2-alpha.3",
161
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.2-alpha.3",
162
- "@deepseek-ai/dsh-client-ui-slots": "0.2.2-alpha.3",
163
- "@deepseek-ai/dsh-commands": "0.2.2-alpha.3",
164
- "@deepseek-ai/dsh-credentials": "0.2.2-alpha.3",
165
- "@deepseek-ai/dsh-file-reference": "0.2.2-alpha.3",
166
- "@deepseek-ai/dsh-fs": "0.2.2-alpha.3",
167
- "@deepseek-ai/dsh-home-paths": "0.2.2-alpha.3",
168
- "@deepseek-ai/dsh-host-webserver": "0.2.2-alpha.3",
139
+ "@deepseek-ai/cordis": "4.1.0",
140
+ "@deepseek-ai/cordis-plugin-include": "1.1.0",
141
+ "@deepseek-ai/cordis-plugin-loader": "1.1.0",
142
+ "@deepseek-ai/cordis-plugin-group": "1.1.0",
143
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
144
+ "@deepseek-ai/dsh-agent-default-model": "0.2.2-rc.1",
145
+ "@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
146
+ "@deepseek-ai/dsh-api-gateway": "0.2.2-rc.1",
147
+ "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
148
+ "@deepseek-ai/dsh-api-session-controller": "0.2.2-rc.1",
149
+ "@deepseek-ai/dsh-app-boot": "0.2.2-rc.1",
150
+ "@deepseek-ai/dsh-atomic-write": "0.2.2-rc.1",
151
+ "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
152
+ "@deepseek-ai/dsh-client-connection": "0.2.2-rc.1",
153
+ "@deepseek-ai/dsh-client-file-upload": "0.2.2-rc.1",
154
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
155
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
156
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.2-rc.1",
157
+ "@deepseek-ai/dsh-client-ui-commands": "0.2.2-rc.1",
158
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.2-rc.1",
159
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.1",
160
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
161
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
162
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.2-rc.1",
163
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
164
+ "@deepseek-ai/dsh-commands": "0.2.2-rc.1",
165
+ "@deepseek-ai/dsh-credentials": "0.2.2-rc.1",
166
+ "@deepseek-ai/dsh-file-reference": "0.2.2-rc.1",
167
+ "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
168
+ "@deepseek-ai/dsh-home-paths": "0.2.2-rc.1",
169
+ "@deepseek-ai/dsh-host-webserver": "0.2.2-rc.1",
169
170
  "@deepseek-ai/dsh-invariants": "0.2.0-rc.2",
170
- "@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
171
- "@deepseek-ai/dsh-native-command": "0.2.2-alpha.3",
172
- "@deepseek-ai/dsh-ptc-runtime": "0.2.2-alpha.3",
173
- "@deepseek-ai/dsh-sandbox": "0.2.2-alpha.3",
174
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-alpha.3",
175
- "@deepseek-ai/dsh-scope": "0.2.2-alpha.3",
176
- "@deepseek-ai/dsh-session": "0.2.2-alpha.3",
177
- "@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.3",
178
- "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
179
- "@deepseek-ai/dsh-session-query": "0.2.2-alpha.3",
180
- "@deepseek-ai/dsh-session-title": "0.2.2-alpha.3",
181
- "@deepseek-ai/dsh-settings": "0.2.2-alpha.3",
182
- "@deepseek-ai/dsh-skill": "0.2.2-alpha.3",
183
- "@deepseek-ai/dsh-subagent": "0.2.2-alpha.3",
184
- "@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
185
- "@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
186
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-alpha.3",
187
- "@deepseek-ai/dsh-typert-registry": "0.2.2-alpha.3",
188
- "@deepseek-ai/dsh-user-approval": "0.2.2-alpha.3",
189
- "@deepseek-ai/dsh-util-code-language": "0.2.2-alpha.3",
190
- "@deepseek-ai/dsh-util-time": "0.2.2-alpha.3",
191
- "@deepseek-ai/dsh-util-workspace-path": "0.2.2-alpha.3",
192
- "@deepseek-ai/dsh-working-directory": "0.2.2-alpha.3",
193
- "@deepseek-ai/dsh-workspace": "0.2.2-alpha.3",
194
- "@deepseek-ai/dsh-compaction": "0.2.2-alpha.3",
195
- "@deepseek-ai/dsh-launch-environment": "0.2.2-alpha.3",
196
- "@deepseek-ai/dsh-storage": "0.2.2-alpha.3",
197
- "@deepseek-ai/dsh-storage-domain": "0.2.2-alpha.3",
198
- "@deepseek-ai/dsh-tool-todo": "0.2.2-alpha.3",
199
- "@deepseek-ai/schemastery": "3.18.6-alpha.1",
171
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
172
+ "@deepseek-ai/dsh-native-command": "0.2.2-rc.1",
173
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.1",
174
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
175
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
176
+ "@deepseek-ai/dsh-scope": "0.2.2-rc.1",
177
+ "@deepseek-ai/dsh-session": "0.2.2-rc.1",
178
+ "@deepseek-ai/dsh-session-persistence": "0.2.2-rc.1",
179
+ "@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
180
+ "@deepseek-ai/dsh-session-query": "0.2.2-rc.1",
181
+ "@deepseek-ai/dsh-session-title": "0.2.2-rc.1",
182
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.1",
183
+ "@deepseek-ai/dsh-skill": "0.2.2-rc.1",
184
+ "@deepseek-ai/dsh-subagent": "0.2.2-rc.1",
185
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
186
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
187
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
188
+ "@deepseek-ai/dsh-typert-registry": "0.2.2-rc.1",
189
+ "@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
190
+ "@deepseek-ai/dsh-util-code-language": "0.2.2-rc.1",
191
+ "@deepseek-ai/dsh-util-time": "0.2.2-rc.1",
192
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.2-rc.1",
193
+ "@deepseek-ai/dsh-working-directory": "0.2.2-rc.1",
194
+ "@deepseek-ai/dsh-workspace": "0.2.2-rc.1",
195
+ "@deepseek-ai/dsh-compaction": "0.2.2-rc.1",
196
+ "@deepseek-ai/dsh-launch-environment": "0.2.2-rc.1",
197
+ "@deepseek-ai/dsh-storage": "0.2.2-rc.1",
198
+ "@deepseek-ai/dsh-storage-domain": "0.2.2-rc.1",
199
+ "@deepseek-ai/dsh-tool-todo": "0.2.2-rc.1",
200
+ "@deepseek-ai/schemastery": "3.19.0",
200
201
  "@playwright/test": "^1.64.1",
201
202
  "@shikijs/langs": "^4.3.1",
202
203
  "@testing-library/dom": "^10.4.1",