dsh-thinking-levels 4.3.2 → 4.3.3

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/CHANGELOG.ja.md CHANGED
@@ -19,21 +19,21 @@
19
19
  - devDependencies の `@deepseek-ai/dsh-client-*` を 0.2.0-rc.1 → 0.2.1-rc.1 に更新し、ビルドと全テスト(140 件)を対象ラインで検証。
20
20
  - README の互換記述(en/zh/ja/ko/de/es/fr/it/ru)を列挙に同期。動作変更なし。
21
21
 
22
- ## [4.3.0] — 2026-10-17
23
-
24
- ### 追加
25
- - 価格カタログ(src/price-catalog.ts):29 モデル x 地域。DeepSeek V4.1-Flash / V4-Flash / V4-Pro は公式のピーク/オフピーク2段(北京 09-12・14-18 がピーク、2026-08-17 施行)、GLM / Kimi / Qwen / Doubao / MiniMax / Ernie は一律価格。各項目は百万トークンあたりの3価格(非キャッシュ入力 / キャッシュヒット入力 / 出力)を保持し、asOf と出典を明記。海外(USD)枠は構造上予約するも公式確認まで意図的に空(数値の捏造なし)。
26
- - defaultPricing 設定(cn / global / custom / off、既定 off):カタログ外モデルは Flash 価格で估算せず「未計価」と表示。
27
- - 2026 国務院祝日/振替修正表(39 エントリ、dsh-session-guard と同源):振替出勤の週末は平日としてピーク判定、法定祝日は終日オフピーク。表外年は週末のみの劣化動作。
28
-
29
- ### 変更
30
- - プロジェクション stateVersion 1 -> 2:usage サンプルごとに確定時の計価レシートを state に永続化、同一 step 置換は記録値を減算(费率混在再計算と負値を排除)、会話/ターン集計は通貨別バケット。アップグレード直後に旧セッションは現行カタログで再折りたたみされ総額が一度変動、以降の設定変更は新規サンプルのみ影响。
31
- - 請求ポップオーバー:通貨別記号(¥ / $、不明は ISO コード)、flat/-null の正直な表示、「<model> で計価」はカタログ名から、混合通貨会話は合計せず通貨別行。
32
-
33
- ### 修正
34
- - settings.describe() の形状正規化(進程内配列 vs RPC エンベロープ {namespaces:[...]}):想定外形状は例外を投げず欠扱い(静默冻结クラスを解消)。
35
- - プロジェクション登録を try/catch で保護:請求单元的失败不再毒化插件整体或冷会话历史加载。
36
-
22
+ ## [4.3.0] — 2026-10-17
23
+
24
+ ### 追加
25
+ - 価格カタログ(src/price-catalog.ts):29 モデル x 地域。DeepSeek V4.1-Flash / V4-Flash / V4-Pro は公式のピーク/オフピーク2段(北京 09-12・14-18 がピーク、2026-08-17 施行)、GLM / Kimi / Qwen / Doubao / MiniMax / Ernie は一律価格。各項目は百万トークンあたりの3価格(非キャッシュ入力 / キャッシュヒット入力 / 出力)を保持し、asOf と出典を明記。海外(USD)枠は構造上予約するも公式確認まで意図的に空(数値の捏造なし)。
26
+ - defaultPricing 設定(cn / global / custom / off、既定 off):カタログ外モデルは Flash 価格で估算せず「未計価」と表示。
27
+ - 2026 国務院祝日/振替修正表(39 エントリ、dsh-session-guard と同源):振替出勤の週末は平日としてピーク判定、法定祝日は終日オフピーク。表外年は週末のみの劣化動作。
28
+
29
+ ### 変更
30
+ - プロジェクション stateVersion 1 -> 2:usage サンプルごとに確定時の計価レシートを state に永続化、同一 step 置換は記録値を減算(费率混在再計算と負値を排除)、会話/ターン集計は通貨別バケット。アップグレード直後に旧セッションは現行カタログで再折りたたみされ総額が一度変動、以降の設定変更は新規サンプルのみ影响。
31
+ - 請求ポップオーバー:通貨別記号(¥ / $、不明は ISO コード)、flat/-null の正直な表示、「<model> で計価」はカタログ名から、混合通貨会話は合計せず通貨別行。
32
+
33
+ ### 修正
34
+ - settings.describe() の形状正規化(進程内配列 vs RPC エンベロープ {namespaces:[...]}):想定外形状は例外を投げず欠扱い(静默冻结クラスを解消)。
35
+ - プロジェクション登録を try/catch で保護:請求单元的失败不再毒化插件整体或冷会话历史加载。
36
+
37
37
  ## [4.2.1] — 2026-10-12
38
38
 
39
39
  ### 変更 — stable への昇格(4.2.0-beta.29 からコード変更なし)
package/CHANGELOG.ko.md CHANGED
@@ -19,21 +19,21 @@
19
19
  - devDependencies `@deepseek-ai/dsh-client-*`를 0.2.0-rc.1 → 0.2.1-rc.1로 전환, 빌드·전체 테스트(140건) 대상 라인에서 검증.
20
20
  - README 호환 서술(en/zh/ja/ko/de/es/fr/it/ru)을 열거와 동기화. 동작 변경 없음.
21
21
 
22
- ## [4.3.0] — 2026-10-17
23
-
24
- ### 추가
25
- - 가격 카탈로그(src/price-catalog.ts): 29개 모델 x 지역 — DeepSeek V4.1-Flash / V4-Flash / V4-Pro는 공식 봉우/곡선 2단(베이징 09-12, 14-18 봉우리; 2026-08-17 시행), GLM / Kimi / Qwen / Doubao / MiniMax / Ernie는 평일 가격. 각 항목은 백만 토큰당 3개 슬롯(비캐시 입력 / 캐시 히트 입력 / 출력)과 asOf + 출처 표기를 가짐. 해외(USD) 항목은 구조만 확보, 공식 페이지 검증 전까지 의도적 비움(날조 없음).
26
- - defaultPricing 설정(cn / global / custom / off, 기본 off): 카탈로그 밖 모델은 더 이상 Flash 가격으로 추정하지 않고 "미과금"으로 표시.
27
- - 2026 국무원 공휴/보근 수정표(39항목, dsh-session-guard 와 동일 출처): 보근 주말은 평일처럼 봉우리의 대상, 법정 공휴는 종일 곡선. 표 밖 연도는 주말 규칙으로 축퇴.
28
-
29
- ### 변경
30
- - 프로젝션 stateVersion 1 -> 2: 사용 샘플에 절입 시점 계산 전표를 영속화, 동일 단계 교체는 기록값 차감(혼합 요율 재계산·음수 제거), 합계는 통화별 버킷. 업그레이드 후 옛 세션은 현재 카탈로그로 재절입되어 총액이 한 번 변동, 이후 설정 변경은 신규 샘플에만 반영.
31
- - 과금 팝오버: 통화별 기호(¥ / $, 미지는 ISO 코드), flat/null 정직한 표시, "모댔 기반 과금", 혼통화 세션은 합산 대신 통화별 행.
32
-
33
- ### 수정
34
- - settings.describe() 모양 정규화(프로세스 내 배열 vs RPC ​​{namespaces:[...]} 봉투): 이상 모양은 예외 대신 결측 처리(조용한 동결 classe 해소).
35
- - 프로젝션 등록 try/catch 보호: 과금 단위 실패가 플러그인 전체/콜드 세션 히스토리를 오염시키지 않음.
36
-
22
+ ## [4.3.0] — 2026-10-17
23
+
24
+ ### 추가
25
+ - 가격 카탈로그(src/price-catalog.ts): 29개 모델 x 지역 — DeepSeek V4.1-Flash / V4-Flash / V4-Pro는 공식 봉우/곡선 2단(베이징 09-12, 14-18 봉우리; 2026-08-17 시행), GLM / Kimi / Qwen / Doubao / MiniMax / Ernie는 평일 가격. 각 항목은 백만 토큰당 3개 슬롯(비캐시 입력 / 캐시 히트 입력 / 출력)과 asOf + 출처 표기를 가짐. 해외(USD) 항목은 구조만 확보, 공식 페이지 검증 전까지 의도적 비움(날조 없음).
26
+ - defaultPricing 설정(cn / global / custom / off, 기본 off): 카탈로그 밖 모델은 더 이상 Flash 가격으로 추정하지 않고 "미과금"으로 표시.
27
+ - 2026 국무원 공휴/보근 수정표(39항목, dsh-session-guard 와 동일 출처): 보근 주말은 평일처럼 봉우리의 대상, 법정 공휴는 종일 곡선. 표 밖 연도는 주말 규칙으로 축퇴.
28
+
29
+ ### 변경
30
+ - 프로젝션 stateVersion 1 -> 2: 사용 샘플에 절입 시점 계산 전표를 영속화, 동일 단계 교체는 기록값 차감(혼합 요율 재계산·음수 제거), 합계는 통화별 버킷. 업그레이드 후 옛 세션은 현재 카탈로그로 재절입되어 총액이 한 번 변동, 이후 설정 변경은 신규 샘플에만 반영.
31
+ - 과금 팝오버: 통화별 기호(¥ / $, 미지는 ISO 코드), flat/null 정직한 표시, "모댔 기반 과금", 혼통화 세션은 합산 대신 통화별 행.
32
+
33
+ ### 수정
34
+ - settings.describe() 모양 정규화(프로세스 내 배열 vs RPC ​​{namespaces:[...]} 봉투): 이상 모양은 예외 대신 결측 처리(조용한 동결 classe 해소).
35
+ - 프로젝션 등록 try/catch 보호: 과금 단위 실패가 플러그인 전체/콜드 세션 히스토리를 오염시키지 않음.
36
+
37
37
  ## [4.2.1] — 2026-10-12
38
38
 
39
39
  ### 변경 — 안정 버전 승격 (4.2.0-beta.29 이후 코드 변경 없음)
package/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 4.3.2 (2026-10-18)
3
+ ## 4.3.3 (2026-10-18)
4
4
 
5
- - hosts: 追加 0.2.1-rc.2 声明面枚举(宿主 peer 逐包 npm 实测 rc.2 在版;不触 ctx.web provider 与 model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
5
+ - 计价目录化上线:price-catalog 41 条(国内 30 CNY 峰谷/平价 + 海外 11 USD:Claude 4 官方页一手、GPT 4/Gemini 3 Copilot 计费文档×公告交叉核实),注入型号按目录实价入账、目录外走 estimate 典型价兜底并标「未校准·仅供参考」(免费档调用=按标准价折算的花费/白嫖额度感知)。
6
+ - 凭证入账 stateVersion 2→3;设置卡目录外定价五档选择器(9 语);CATALOG_VERSION 1→2;golden 150/150 绿。
7
+
8
+ ## 4.3.2 (2026-10-18)
9
+
10
+ - hosts: 追加 0.2.1-rc.2 声明面枚举(宿主 peer 逐包 npm 实测 rc.2 在版;不触 ctx.web provider 与 model.label 槽,代码零改动,纯元数据发版;农场 rc.2 格挂账待命)
6
11
 
7
12
  All notable changes to `dsh-thinking-levels` are documented here.
8
13
 
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 drscrewdriver
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 drscrewdriver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/cordis.patch.yml CHANGED
@@ -1,3 +1,3 @@
1
- - insert:
2
- - id: dsh-thinking-levels
3
- name: dsh-thinking-levels
1
+ - insert:
2
+ - id: dsh-thinking-levels
3
+ name: dsh-thinking-levels
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-thinking-levels",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "main": "./lib/index.js",
5
5
  "description": "thinking-level (reasoning_effort) control — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
6
6
  "engines": {
@@ -11,9 +11,11 @@
11
11
  * 元只做记账。计价在**折入时刻**结算并作为凭证(`Sample.billed`)持久进 state:
12
12
  * - 同 step 替换「减记录值、加新算值」——杜绝按新费率重算旧账的混口径负数路径;
13
13
  * - 金额按币种分桶(CNY/USD),跨币种会话不再相加失真;
14
- * - `view` 只读凭证不重算,设置改价不会漂移已展示的读数。
14
+ * - `view` 只读凭证不重算,设置改价不会漂移已展示的读数;
15
+ * - 目录外模型的兜底典型价估算带 `estimated` 凭证位(未校准仅供参考)。
15
16
  * 语义边界:改价只影响在线增量新账;冷重放(checkpoint 废弃后整段重折)必然
16
- * 按当前目录重算——stateVersion 2 即为此声明(宿主对旧 ver 行整行废弃重折)。
17
+ * 按当前目录重算——stateVersion 3 即为此声明(宿主对旧 ver 行整行废弃重折,
18
+ * ver 2 凭证缺 estimated 字段,不可原样过新 schema)。
17
19
  *
18
20
  * 计价快照经 `buildBillingDefinition(getPricing)` 闭包注入,按事件时刻现读;
19
21
  * **热路径绝不走 describeSettings**(宿主 describe 非轻量且会 emit 事件)。
@@ -38,12 +40,14 @@ export interface Billed {
38
40
  tier: Tier | null;
39
41
  source: PricingSource;
40
42
  priced: boolean;
43
+ /** priced 且金额为兜底典型价估算(未校准,仅供参考)。 */
44
+ estimated: boolean;
41
45
  catalogKey: string | null;
42
46
  catalogLabel: string | null;
43
47
  priceRow: PriceRow | null;
44
48
  }
45
49
  /** 目录外模型的兜底档位(设置面 defaultPricing 的值域)。 */
46
- declare const POLICY_VALUES: readonly ["cn", "global", "custom", "off"];
50
+ declare const POLICY_VALUES: readonly ["estimate", "cn", "global", "custom", "off"];
47
51
  /** 一个 usage 样本:state.last 只存最新一轮。 */
48
52
  export interface Sample {
49
53
  turn: number;
@@ -129,6 +133,7 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
129
133
  flat: "flat";
130
134
  }>>;
131
135
  source: z.ZodEnum<{
136
+ estimate: "estimate";
132
137
  cn: "cn";
133
138
  global: "global";
134
139
  custom: "custom";
@@ -136,6 +141,7 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
136
141
  "catalog-miss": "catalog-miss";
137
142
  }>;
138
143
  priced: z.ZodBoolean;
144
+ estimated: z.ZodBoolean;
139
145
  catalogKey: z.ZodNullable<z.ZodString>;
140
146
  catalogLabel: z.ZodNullable<z.ZodString>;
141
147
  priceRow: z.ZodNullable<z.ZodObject<{
@@ -206,8 +212,9 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
206
212
  output: number;
207
213
  currency: "CNY" | "USD";
208
214
  tier: "peak" | "offPeak" | "flat" | null;
209
- source: "cn" | "global" | "custom" | "off" | "catalog-miss";
215
+ source: "estimate" | "cn" | "global" | "custom" | "off" | "catalog-miss";
210
216
  priced: boolean;
217
+ estimated: boolean;
211
218
  catalogKey: string | null;
212
219
  catalogLabel: string | null;
213
220
  priceRow: {
@@ -282,8 +289,9 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
282
289
  output: number;
283
290
  currency: "CNY" | "USD";
284
291
  tier: "peak" | "offPeak" | "flat" | null;
285
- source: "cn" | "global" | "custom" | "off" | "catalog-miss";
292
+ source: "estimate" | "cn" | "global" | "custom" | "off" | "catalog-miss";
286
293
  priced: boolean;
294
+ estimated: boolean;
287
295
  catalogKey: string | null;
288
296
  catalogLabel: string | null;
289
297
  priceRow: {
@@ -357,8 +365,9 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
357
365
  output: number;
358
366
  currency: "CNY" | "USD";
359
367
  tier: "peak" | "offPeak" | "flat" | null;
360
- source: "cn" | "global" | "custom" | "off" | "catalog-miss";
368
+ source: "estimate" | "cn" | "global" | "custom" | "off" | "catalog-miss";
361
369
  priced: boolean;
370
+ estimated: boolean;
362
371
  catalogKey: string | null;
363
372
  catalogLabel: string | null;
364
373
  priceRow: {
@@ -451,12 +460,14 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
451
460
  step: z.ZodNullable<z.ZodNumber>;
452
461
  priced: z.ZodBoolean;
453
462
  pricingSource: z.ZodNullable<z.ZodEnum<{
463
+ estimate: "estimate";
454
464
  cn: "cn";
455
465
  global: "global";
456
466
  custom: "custom";
457
467
  off: "off";
458
468
  "catalog-miss": "catalog-miss";
459
469
  }>>;
470
+ estimated: z.ZodBoolean;
460
471
  catalogKey: z.ZodNullable<z.ZodString>;
461
472
  catalogLabel: z.ZodNullable<z.ZodString>;
462
473
  priceRow: z.ZodNullable<z.ZodObject<{
@@ -503,8 +514,9 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
503
514
  output: number;
504
515
  currency: "CNY" | "USD";
505
516
  tier: "peak" | "offPeak" | "flat" | null;
506
- source: "cn" | "global" | "custom" | "off" | "catalog-miss";
517
+ source: "estimate" | "cn" | "global" | "custom" | "off" | "catalog-miss";
507
518
  priced: boolean;
519
+ estimated: boolean;
508
520
  catalogKey: string | null;
509
521
  catalogLabel: string | null;
510
522
  priceRow: {
@@ -588,6 +600,7 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
588
600
  step: null;
589
601
  priced: boolean;
590
602
  pricingSource: null;
603
+ estimated: boolean;
591
604
  catalogKey: null;
592
605
  catalogLabel: null;
593
606
  priceRow: null;
@@ -631,7 +644,8 @@ export declare function buildBillingDefinition(getPricing: () => PricingSnapshot
631
644
  turn: number;
632
645
  step: number;
633
646
  priced: boolean;
634
- pricingSource: "cn" | "global" | "custom" | "off" | "catalog-miss";
647
+ pricingSource: "estimate" | "cn" | "global" | "custom" | "off" | "catalog-miss";
648
+ estimated: boolean;
635
649
  catalogKey: string | null;
636
650
  catalogLabel: string | null;
637
651
  priceRow: ({
@@ -11,9 +11,11 @@
11
11
  * 元只做记账。计价在**折入时刻**结算并作为凭证(`Sample.billed`)持久进 state:
12
12
  * - 同 step 替换「减记录值、加新算值」——杜绝按新费率重算旧账的混口径负数路径;
13
13
  * - 金额按币种分桶(CNY/USD),跨币种会话不再相加失真;
14
- * - `view` 只读凭证不重算,设置改价不会漂移已展示的读数。
14
+ * - `view` 只读凭证不重算,设置改价不会漂移已展示的读数;
15
+ * - 目录外模型的兜底典型价估算带 `estimated` 凭证位(未校准仅供参考)。
15
16
  * 语义边界:改价只影响在线增量新账;冷重放(checkpoint 废弃后整段重折)必然
16
- * 按当前目录重算——stateVersion 2 即为此声明(宿主对旧 ver 行整行废弃重折)。
17
+ * 按当前目录重算——stateVersion 3 即为此声明(宿主对旧 ver 行整行废弃重折,
18
+ * ver 2 凭证缺 estimated 字段,不可原样过新 schema)。
17
19
  *
18
20
  * 计价快照经 `buildBillingDefinition(getPricing)` 闭包注入,按事件时刻现读;
19
21
  * **热路径绝不走 describeSettings**(宿主 describe 非轻量且会 emit 事件)。
@@ -30,7 +32,7 @@ import { resolveRate, } from "./price-catalog.js";
30
32
  export { isPeakBeijing, HOLIDAY_TABLE_2026, HOLIDAY_TABLES } from "./price-catalog.js";
31
33
  export { PRICE_CATALOG, CATALOG_VERSION } from "./price-catalog.js";
32
34
  /** 目录外模型的兜底档位(设置面 defaultPricing 的值域)。 */
33
- const POLICY_VALUES = ['cn', 'global', 'custom', 'off'];
35
+ const POLICY_VALUES = ['estimate', 'cn', 'global', 'custom', 'off'];
34
36
  const round9 = (n) => Math.round(n * 1e9) / 1e9;
35
37
  /** 写失效:发生过缓存写入(官方不报,恒 false,个别中转有值)。 */
36
38
  export const isWriteMiss = (s) => s.cacheWriteTokens > 0;
@@ -57,7 +59,7 @@ export function billFor(sample, snapshot) {
57
59
  return {
58
60
  hit: 0, miss: 0, output: 0,
59
61
  currency: resolved.currency ?? 'CNY',
60
- tier: resolved.tier, source: resolved.source, priced: false,
62
+ tier: resolved.tier, source: resolved.source, priced: false, estimated: false,
61
63
  catalogKey: resolved.entry?.key ?? null,
62
64
  catalogLabel: resolved.entry?.label ?? null,
63
65
  priceRow: null,
@@ -69,6 +71,7 @@ export function billFor(sample, snapshot) {
69
71
  output: round9((sample.outputTokens * row.output) / 1e6),
70
72
  currency: resolved.currency ?? 'CNY',
71
73
  tier: resolved.tier, source: resolved.source, priced: true,
74
+ estimated: resolved.estimated,
72
75
  catalogKey: resolved.entry?.key ?? null,
73
76
  catalogLabel: resolved.entry?.label ?? null,
74
77
  priceRow: { ...row },
@@ -80,8 +83,9 @@ const billedShape = z.object({
80
83
  output: z.number(),
81
84
  currency: z.enum(['CNY', 'USD']),
82
85
  tier: z.enum(['peak', 'offPeak', 'flat']).nullable(),
83
- source: z.enum(['cn', 'global', 'custom', 'off', 'catalog-miss']),
86
+ source: z.enum(['estimate', 'cn', 'global', 'custom', 'off', 'catalog-miss']),
84
87
  priced: z.boolean(),
88
+ estimated: z.boolean(),
85
89
  catalogKey: z.string().nullable(),
86
90
  catalogLabel: z.string().nullable(),
87
91
  priceRow: z.object({ inputMiss: z.number(), inputCacheHit: z.number(), output: z.number() }).nullable(),
@@ -189,7 +193,7 @@ export function buildBillingDefinition(getPricing) {
189
193
  provider: sourceProvider ?? state.provider,
190
194
  time: typeof event.time === 'number' ? event.time : Date.now(),
191
195
  // 凭证在折入时刻结算(事件时刻的费率 + 当时的计价快照)
192
- billed: { hit: 0, miss: 0, output: 0, currency: 'CNY', tier: null, source: 'off', priced: false, catalogKey: null, catalogLabel: null, priceRow: null },
196
+ billed: { hit: 0, miss: 0, output: 0, currency: 'CNY', tier: null, source: 'off', priced: false, estimated: false, catalogKey: null, catalogLabel: null, priceRow: null },
193
197
  };
194
198
  sample.billed = billFor(sample, getPricing());
195
199
  const prev = state.last;
@@ -203,6 +207,7 @@ export function buildBillingDefinition(getPricing) {
203
207
  prev.billed.hit === sample.billed.hit &&
204
208
  prev.billed.miss === sample.billed.miss &&
205
209
  prev.billed.output === sample.billed.output &&
210
+ prev.billed.estimated === sample.billed.estimated &&
206
211
  prev.billed.currency === sample.billed.currency) {
207
212
  return state;
208
213
  }
@@ -297,7 +302,7 @@ export function buildBillingDefinition(getPricing) {
297
302
  cacheReadTokens: 0, totalInputTokens: 0, outputTokens: 0, hitRate: null,
298
303
  model: state.model, provider: state.provider, matchedModel: null, modelMatched: false,
299
304
  tier: null, unitPricePerM: null, turn: null, step: null,
300
- priced: false, pricingSource: null, catalogKey: null, catalogLabel: null, priceRow: null,
305
+ priced: false, pricingSource: null, estimated: false, catalogKey: null, catalogLabel: null, priceRow: null,
301
306
  turnCost: 0, turnHitCost: 0, turnMissCost: 0, turnOutputCost: 0,
302
307
  turnTokens: 0, turnCacheReadTokens: 0, turnInputTokens: 0, turnOutputTokens: 0,
303
308
  sessionCacheHitCost: 0, sessionMissCost: 0, sessionOutputCost: 0,
@@ -332,6 +337,7 @@ export function buildBillingDefinition(getPricing) {
332
337
  step: s.step,
333
338
  priced: b.priced,
334
339
  pricingSource: b.source,
340
+ estimated: b.estimated,
335
341
  catalogKey: b.catalogKey,
336
342
  catalogLabel: b.catalogLabel,
337
343
  priceRow: b.priceRow,
@@ -376,7 +382,8 @@ export function buildBillingDefinition(getPricing) {
376
382
  turn: z.number().int().nullable(),
377
383
  step: z.number().int().nullable(),
378
384
  priced: z.boolean(),
379
- pricingSource: z.enum(['cn', 'global', 'custom', 'off', 'catalog-miss']).nullable(),
385
+ pricingSource: z.enum(['estimate', 'cn', 'global', 'custom', 'off', 'catalog-miss']).nullable(),
386
+ estimated: z.boolean(),
380
387
  catalogKey: z.string().nullable(),
381
388
  catalogLabel: z.string().nullable(),
382
389
  priceRow: z.object({ inputMiss: z.number(), inputCacheHit: z.number(), output: z.number() }).nullable(),
@@ -403,7 +410,7 @@ export function buildBillingDefinition(getPricing) {
403
410
  });
404
411
  return {
405
412
  key: 'tlCacheBilling',
406
- stateVersion: 2,
413
+ stateVersion: 3,
407
414
  stateSchema,
408
415
  init,
409
416
  apply,
package/lib/client.js CHANGED
@@ -28,6 +28,13 @@ window.__ModuleLoader__.load({
28
28
  "card.enabled": "启用",
29
29
  "card.allowDowngrade": "允许降档(auto 可降至 low)",
30
30
  "card.allowUpgrade": "允许升档(auto 可升至 max)",
31
+ "card.defaultPricing": "目录外定价",
32
+ "card.defaultPricingHint": "定价目录未收录的模型(含其他插件接入的网关型号)如何计价;目录内模型始终按自己的目录价。改价只影响后续新账。",
33
+ "card.defaultPricing.estimate": "estimate — 典型价兜底估算(未校准·仅供参考,默认)",
34
+ "card.defaultPricing.cn": "cn — 人民币校准档(目录外仍按典型价估算)",
35
+ "card.defaultPricing.global": "global — 美元校准档(USD 目录补录前目录外仍为估算)",
36
+ "card.defaultPricing.custom": "custom — 自填价(未提供整行价时不计价)",
37
+ "card.defaultPricing.off": "off — 不计价(目录外显示「未计价」)",
31
38
  "card.unavailable": "设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。",
32
39
  "card.readonly": "只读",
33
40
  "card.capabilities": "模型能力(llm-pi-ai 自定义提供方)",
@@ -114,6 +121,13 @@ window.__ModuleLoader__.load({
114
121
  "card.enabled": "Enabled",
115
122
  "card.allowDowngrade": "Allow downgrade (auto may drop to low)",
116
123
  "card.allowUpgrade": "Allow upgrade (auto may lift to max)",
124
+ "card.defaultPricing": "Off-catalog pricing",
125
+ "card.defaultPricingHint": "How to price models the catalog does not list (including gateway models brought in by other plugins); catalogued models always use their own rates. Pricing changes only affect new accounting from now on.",
126
+ "card.defaultPricing.estimate": "estimate — typical-price fallback (uncalibrated, reference only; default)",
127
+ "card.defaultPricing.cn": "cn — CNY calibration tier (off-catalog still falls back to the typical price)",
128
+ "card.defaultPricing.global": "global — USD calibration tier (off-catalog stays estimated until USD rows land)",
129
+ "card.defaultPricing.custom": "custom — self-entered rates (unpriced without a full row)",
130
+ "card.defaultPricing.off": "off — do not bill (off-catalog shows \"not billed\")",
117
131
  "card.unavailable": "Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.",
118
132
  "card.readonly": "Read-only",
119
133
  "card.capabilities": "Model capabilities (llm-pi-ai custom providers)",
@@ -200,6 +214,13 @@ window.__ModuleLoader__.load({
200
214
  "card.enabled": "有効",
201
215
  "card.allowDowngrade": "降格を許可(auto は low まで下げられる)",
202
216
  "card.allowUpgrade": "昇格を許可(auto は max まで上げられる)",
217
+ "card.defaultPricing": "カタログ外モデルの価格",
218
+ "card.defaultPricingHint": "価格カタログに未登録のモデル(他プラグイン経由のゲートウェイモデル含む)の計算方法。登録済みモデルは常にカタログ価格を使用。価格変更は以降の新規記録のみ影響。",
219
+ "card.defaultPricing.estimate": "estimate — 典型価格でフォールバック見積り(未校正・参考値、デフォルト)",
220
+ "card.defaultPricing.cn": "cn — 人民元キャリブレーション(カタログ外は典型価格の見積りのまま)",
221
+ "card.defaultPricing.global": "global — ドルキャリブレーション(USD 行の補録前はカタログ外から見積り)",
222
+ "card.defaultPricing.custom": "custom — 手入力価格(行が不完全なら未計算)",
223
+ "card.defaultPricing.off": "off — 計算しない(カタログ外は「未計算」と表示)",
203
224
  "card.unavailable": "設定名前空間が利用できません:dsh-thinking-levels が profile に組み込まれているか確認してください。",
204
225
  "card.readonly": "読み取り専用",
205
226
  "card.capabilities": "モデル能力(llm-pi-ai カスタムプロバイダー)",
@@ -286,6 +307,13 @@ window.__ModuleLoader__.load({
286
307
  "card.enabled": "활성화",
287
308
  "card.allowDowngrade": "다운그레이드 허용(auto가 low까지 내릴 수 있음)",
288
309
  "card.allowUpgrade": "업그레이드 허용(auto가 max까지 올릴 수 있음)",
310
+ "card.defaultPricing": "카탈로그 외 과금",
311
+ "card.defaultPricingHint": "가격 카탈로그에 없는 모델(다른 플러그인으로 유입된 게이트웨이 모델 포함)의 과금 방식. 카탈로그 등재 모델은 항상 자체 등재가 사용. 가격 변경은 이후 신규 기록에만 반영.",
312
+ "card.defaultPricing.estimate": "estimate — 전형가 폴백 추정(미교정·참고용, 기본)",
313
+ "card.defaultPricing.cn": "cn — 위안화 보정 등급(카탈로그 외는 여전히 전형가 추정)",
314
+ "card.defaultPricing.global": "global — 달러 보정 등급(USD 행 보충 전 카탈로그 외는 추정)",
315
+ "card.defaultPricing.custom": "custom — 직접 입력 가격(행이 불완전하면 미과금)",
316
+ "card.defaultPricing.off": "off — 미과금(카탈로그 외는 \"미과금\" 표시)",
289
317
  "card.unavailable": "설정 네임스페이스를 사용할 수 없습니다: dsh-thinking-levels가 이 profile에 조립되었는지 확인하세요.",
290
318
  "card.readonly": "읽기 전용",
291
319
  "card.capabilities": "모델 기능(llm-pi-ai 사용자 지정 제공자)",
@@ -372,6 +400,13 @@ window.__ModuleLoader__.load({
372
400
  "card.enabled": "Activé",
373
401
  "card.allowDowngrade": "Autoriser la rétrogradation (auto peut descendre à low)",
374
402
  "card.allowUpgrade": "Autoriser la montée (auto peut monter à max)",
403
+ "card.defaultPricing": "Tarification hors catalogue",
404
+ "card.defaultPricingHint": "Comment tarifer les modèles absents du catalogue (y compris les modèles de passerelle apportés par d'autres plugins) ; les modèles catalogués gardent leurs tarifs. Les changements ne touchent que les nouvelles lignes.",
405
+ "card.defaultPricing.estimate": "estimate — estimation par prix type (non calibrée, à titre indicatif ; par défaut)",
406
+ "card.defaultPricing.cn": "cn — palier calibré CNY (hors catalogue : estimation au prix type)",
407
+ "card.defaultPricing.global": "global — palier calibré USD (hors catalogue estimé tant que les lignes USD manquent)",
408
+ "card.defaultPricing.custom": "custom — tarifs saisis (non facturé sans ligne complète)",
409
+ "card.defaultPricing.off": "off — ne pas facturer (hors catalogue affiche « non facturé »)",
375
410
  "card.unavailable": "Espace de noms des paramètres indisponible : assurez-vous que dsh-thinking-levels est assemblé dans ce profil.",
376
411
  "card.readonly": "Lecture seule",
377
412
  "card.capabilities": "Capacités du modèle (fournisseurs personnalisés llm-pi-ai)",
@@ -458,6 +493,13 @@ window.__ModuleLoader__.load({
458
493
  "card.enabled": "Aktiviert",
459
494
  "card.allowDowngrade": "Herabstufung erlauben (auto kann auf low fallen)",
460
495
  "card.allowUpgrade": "Hochstufung erlauben (auto kann auf max steigen)",
496
+ "card.defaultPricing": "Preis außerhalb des Katalogs",
497
+ "card.defaultPricingHint": "Bepreisung von Modellen ohne Katalogeintrag (inkl. Gateway-Modelle anderer Plugins); katalogisierte Modelle nutzen immer ihre Katalogpreise. Änderungen wirken nur auf neue Buchungen.",
498
+ "card.defaultPricing.estimate": "estimate — Schätzung über Typicalpreis (unkalibriert, nur Referenz; Standard)",
499
+ "card.defaultPricing.cn": "cn — Kalibrierungsstufe CNY (ohne Katalogeintrag weiterhin Typicalpreis-Schätzung)",
500
+ "card.defaultPricing.global": "global — Kalibrierungsstufe USD (ohne Katalogeintrag geschätzt, bis USD-Zeilen ergänzt sind)",
501
+ "card.defaultPricing.custom": "custom — eigene Preise (ohne vollständige Zeile unbestückt)",
502
+ "card.defaultPricing.off": "off — nicht abrechnen (ohne Katalogeintrag „nicht abgerechnet“)",
461
503
  "card.unavailable": "Einstellungs-Namensraum nicht verfügbar: Stellen Sie sicher, dass dsh-thinking-levels in diesem Profil eingebunden ist.",
462
504
  "card.readonly": "Schreibgeschützt",
463
505
  "card.capabilities": "Modellfähigkeiten (llm-pi-ai benutzerdefinierte Anbieter)",
@@ -544,6 +586,13 @@ window.__ModuleLoader__.load({
544
586
  "card.enabled": "Abilitato",
545
587
  "card.allowDowngrade": "Consenti declassamento (auto può scendere a low)",
546
588
  "card.allowUpgrade": "Consenti avanzamento (auto può salire a max)",
589
+ "card.defaultPricing": "Prezzi fuori catalogo",
590
+ "card.defaultPricingHint": "Come fatturare i modelli assenti dal catalogo (inclusi i modelli gateway di altri plugin); i modelli in catalogo usano sempre i propri prezzi. Le modifiche valgono solo per le nuove registrazioni.",
591
+ "card.defaultPricing.estimate": "estimate — stima a prezzo tipico (non calibrata, solo indicativa; predefinito)",
592
+ "card.defaultPricing.cn": "cn — livello calibrato CNY (fuori catalogo resta la stima a prezzo tipico)",
593
+ "card.defaultPricing.global": "global — livello calibrato USD (fuori catalogo stimato finché mancano le righe USD)",
594
+ "card.defaultPricing.custom": "custom — prezzi inseriti a mano (non fatturato senza riga completa)",
595
+ "card.defaultPricing.off": "off — non fatturare (fuori catalogo mostra \"non fatturato\")",
547
596
  "card.unavailable": "Namespace delle impostazioni non disponibile: assicurati che dsh-thinking-levels sia integrato in questo profilo.",
548
597
  "card.readonly": "Sola lettura",
549
598
  "card.capabilities": "Capacità del modello (provider personalizzati llm-pi-ai)",
@@ -630,6 +679,13 @@ window.__ModuleLoader__.load({
630
679
  "card.enabled": "Включено",
631
680
  "card.allowDowngrade": "Разрешить понижение (auto может снизить до low)",
632
681
  "card.allowUpgrade": "Разрешить повышение (auto может поднять до max)",
682
+ "card.defaultPricing": "Внекаталожное ценообразование",
683
+ "card.defaultPricingHint": "Как считать модели, которых нет в каталоге цен (включая шлюзовые модели из других плагинов); каталожные модели всегда считаются по своему прайсу. Изменения влияют только на новые записи.",
684
+ "card.defaultPricing.estimate": "estimate — оценка по типовой цене (не откалибровано, справочно; по умолчанию)",
685
+ "card.defaultPricing.cn": "cn — калибровка CNY (вне каталога всё равно оценка по типовой цене)",
686
+ "card.defaultPricing.global": "global — калибровка USD (вне каталога оценивается, пока строки USD не добавлены)",
687
+ "card.defaultPricing.custom": "custom — свои цены (без полной строки — без расчёта)",
688
+ "card.defaultPricing.off": "off — не считать (вне каталога показ «не оплачено»)",
633
689
  "card.unavailable": "Пространство имён настроек недоступно: убедитесь, что dsh-thinking-levels подключён к этому профилю.",
634
690
  "card.readonly": "Только чтение",
635
691
  "card.capabilities": "Возможности модели (пользовательские провайдеры llm-pi-ai)",
@@ -716,6 +772,13 @@ window.__ModuleLoader__.load({
716
772
  "card.enabled": "Activado",
717
773
  "card.allowDowngrade": "Permitir degradación (auto puede bajar a low)",
718
774
  "card.allowUpgrade": "Permitir mejora (auto puede subir a max)",
775
+ "card.defaultPricing": "Precio fuera del catálogo",
776
+ "card.defaultPricingHint": "Cómo facturar los modelos sin entrada en el catálogo (incluidos modelos de puerta de enlace de otros plugins); los modelos catalogados usan siempre sus precios. Los cambios solo afectan a registros nuevos.",
777
+ "card.defaultPricing.estimate": "estimate — estimación a precio típico (sin calibrar, solo referencia; predeterminado)",
778
+ "card.defaultPricing.cn": "cn — nivel calibrado en CNY (fuera del catálogo sigue siendo estimación a precio típico)",
779
+ "card.defaultPricing.global": "global — nivel calibrado en USD (fuera del catálogo estimado hasta que lleguen las filas USD)",
780
+ "card.defaultPricing.custom": "custom — precios introducidos (sin factura si falta la fila completa)",
781
+ "card.defaultPricing.off": "off — no facturar (fuera del catálogo muestra «sin facturar»)",
719
782
  "card.unavailable": "Espacio de nombres de configuración no disponible: asegúrate de que dsh-thinking-levels esté ensamblado en este perfil.",
720
783
  "card.readonly": "Solo lectura",
721
784
  "card.capabilities": "Capacidades del modelo (proveedores personalizados llm-pi-ai)",
@@ -843,7 +906,8 @@ window.__ModuleLoader__.load({
843
906
  billCustom: "自填价计价",
844
907
  billPricedAs: (label) => `按 ${label} 计价`,
845
908
  billPriced: "按目录价计价",
846
- billEstimate: "目录外估算价"
909
+ billEstimate: "目录外估算价",
910
+ billUncalibratedHint: "未校准·仅供参考"
847
911
  },
848
912
  en: {
849
913
  title: "Context check",
@@ -873,7 +937,8 @@ window.__ModuleLoader__.load({
873
937
  billCustom: "priced at custom rates",
874
938
  billPricedAs: (label) => `priced as ${label}`,
875
939
  billPriced: "priced at catalog rates",
876
- billEstimate: "estimated off-catalog"
940
+ billEstimate: "estimated off-catalog",
941
+ billUncalibratedHint: "uncalibrated — reference only"
877
942
  }
878
943
  };
879
944
  const copy = () => typeof document !== "undefined" && document.documentElement.lang?.toLowerCase().startsWith("zh") ? COPY.zh : COPY.en;
@@ -1397,7 +1462,7 @@ window.__ModuleLoader__.load({
1397
1462
  c.window,
1398
1463
  ": ",
1399
1464
  hasReading ? window_.toLocaleString() : c.unset,
1400
- billing?.available === true ? ` · ${billing.tier === "peak" ? c.billPeak : billing.tier === "offPeak" ? c.billOffPeak : billing.tier === "flat" ? c.billFlat : c.billUnpriced} · ${billing.priced === false ? c.billUnpriced : typeof billing.catalogLabel === "string" ? c.billPricedAs(billing.catalogLabel) : billing.pricingSource === "custom" ? c.billCustom : billing.modelMatched === false ? c.billEstimate : c.billPriced}` : ""
1465
+ billing?.available === true ? ` · ${billing.tier === "peak" ? c.billPeak : billing.tier === "offPeak" ? c.billOffPeak : billing.tier === "flat" ? c.billFlat : c.billUnpriced} · ${billing.priced === false ? c.billUnpriced : billing.estimated === true ? c.billUncalibratedHint : typeof billing.catalogLabel === "string" ? c.billPricedAs(billing.catalogLabel) : billing.pricingSource === "custom" ? c.billCustom : billing.modelMatched === false ? c.billEstimate : c.billPriced}` : ""
1401
1466
  ]
1402
1467
  })
1403
1468
  ]
@@ -2992,6 +3057,14 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
2992
3057
  "max",
2993
3058
  "auto"
2994
3059
  ];
3060
+ /** 计价兜底档,in picker order:缺省 estimate(典型价估算,未校准仅供参考)。 */
3061
+ const PRICING_OPTIONS = [
3062
+ "estimate",
3063
+ "cn",
3064
+ "global",
3065
+ "custom",
3066
+ "off"
3067
+ ];
2995
3068
  /**
2996
3069
  * The levels the capability editor offers. This is the llm-pi-ai
2997
3070
  * `reasoningEfforts` table-key space — pi-ai's fixed seven levels (schema
@@ -4175,6 +4248,7 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4175
4248
  ...pendingTl
4176
4249
  };
4177
4250
  const level = EFFORT_OPTIONS.includes(viewValue.level) ? viewValue.level : "auto";
4251
+ const defaultPricing = PRICING_OPTIONS.includes(viewValue.defaultPricing) ? viewValue.defaultPricing : "estimate";
4178
4252
  const writeTl = (field, v) => {
4179
4253
  setPendingTl((cur) => ({
4180
4254
  ...cur,
@@ -4355,6 +4429,27 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
4355
4429
  }
4356
4430
  })]
4357
4431
  }),
4432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4433
+ style: rowStyle,
4434
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
4435
+ htmlFor: "plugin-config-thinking-levels-default-pricing",
4436
+ style: labelStyle,
4437
+ title: t("card.defaultPricingHint"),
4438
+ children: t("card.defaultPricing")
4439
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
4440
+ id: "plugin-config-thinking-levels-default-pricing",
4441
+ value: defaultPricing,
4442
+ disabled: readonly,
4443
+ style: controlStyle,
4444
+ onChange: (event) => {
4445
+ writeTl("defaultPricing", event.currentTarget.value);
4446
+ },
4447
+ children: PRICING_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
4448
+ value: option,
4449
+ children: t(`card.defaultPricing.${option}`)
4450
+ }, option))
4451
+ })]
4452
+ }),
4358
4453
  writeErrorTl !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
4359
4454
  style: {
4360
4455
  margin: "8px 0 0",