dsh-cost-meter 1.9.47 → 1.9.48
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/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/plugin-compatibility-watch.md +4 -0
- package/docs/update-notes-1.9.48.md +26 -0
- package/lib/client.billing-storage.js +1 -1
- package/lib/client.codex.js +1 -1
- package/lib/client.community.js +1 -1
- package/lib/client.display.js +2 -2
- package/lib/client.js +8 -6
- package/lib/client.notices.js +1 -1
- package/lib/client.openrouter.js +2 -2
- package/lib/client.peak.js +3 -3
- package/lib/client.plan-settings.js +1 -1
- package/lib/client.pricing.js +1 -1
- package/lib/client.session-list.js +2 -2
- package/lib/client.settings-overview.js +1 -1
- package/lib/client.sidebar-order.js +3 -3
- package/lib/client.statistics.js +8 -8
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**Session cost tracking plugin for the DeepSeek Harness web GUI (bilingual UI)**
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
|
|
12
12
|
[](LICENSE)
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
**v1.9.
|
|
19
|
+
**v1.9.48** fixes client chunk registration when dsh-loader is active, adds Codex quota reset times to the input-bar tooltip, and validates billion-context 0.1.210–0.1.211.
|
|
20
20
|
|
|
21
21
|
**Host floor: DSH 0.2.0** · Adaptation target: **0.2.1-rc.2** (npm `next`). Expand the compatibility notes below for exact declarations, host records and troubleshooting.
|
|
22
22
|
|
|
23
|
-
Release notes: [v1.9.
|
|
23
|
+
Release notes: [v1.9.48](docs/update-notes-1.9.48.md#english). Fully restart DSH after updating.
|
|
24
24
|
|
|
25
25
|

|
|
26
26
|
|
|
@@ -356,22 +356,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
|
|
|
356
356
|
dsh plugin --profile web add dsh-cost-meter
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.
|
|
359
|
+
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.48`** — review the script before running):
|
|
360
360
|
|
|
361
361
|
```powershell
|
|
362
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.
|
|
362
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.48/install.ps1 | iex
|
|
363
363
|
```
|
|
364
364
|
|
|
365
365
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
366
366
|
|
|
367
367
|
```sh
|
|
368
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.
|
|
368
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.48
|
|
369
369
|
```
|
|
370
370
|
|
|
371
371
|
Without git, use the GitHub tag archive:
|
|
372
372
|
|
|
373
373
|
```sh
|
|
374
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.
|
|
374
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.48.tar.gz
|
|
375
375
|
```
|
|
376
376
|
|
|
377
377
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
|
@@ -436,7 +436,7 @@ Workarounds:
|
|
|
436
436
|
|
|
437
437
|
```yaml
|
|
438
438
|
minimumReleaseAgeExclude:
|
|
439
|
-
- dsh-cost-meter@1.9.
|
|
439
|
+
- dsh-cost-meter@1.9.48
|
|
440
440
|
```
|
|
441
441
|
|
|
442
442
|
3. For a one-off CLI operation, forward the pnpm flag: `dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0` (or add `--trust-lockfile` when only lockfile verification fails). Both flags were verified against pnpm 11.28.5 in a temporary profile.
|
package/README.zh-CN.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**DeepSeek Harness 会话费用统计插件(界面中英双语)**
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
|
|
12
12
|
[](LICENSE)
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
**v1.9.
|
|
19
|
+
**v1.9.48** 修复 dsh-loader 环境下的界面模块重复注册,Codex 输入栏额度悬停提示新增 5 小时/7 天重置时间,并验证 billion-context 0.1.210–0.1.211。
|
|
20
20
|
|
|
21
21
|
**宿主要求:DSH 0.2.0 起支持** · 适配目标 **0.2.1-rc.2**(npm `next`)。完整声明、历史记录与安装排障见下方展开项。
|
|
22
22
|
|
|
23
|
-
更新说明:[v1.9.
|
|
23
|
+
更新说明:[v1.9.48](docs/update-notes-1.9.48.md#中文)。更新后完全重启 DSH。
|
|
24
24
|
|
|
25
25
|

|
|
26
26
|
|
|
@@ -356,22 +356,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
|
|
|
356
356
|
dsh plugin --profile web add dsh-cost-meter
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.
|
|
359
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.48`**,建议先下载审阅再运行):
|
|
360
360
|
|
|
361
361
|
```powershell
|
|
362
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.
|
|
362
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.48/install.ps1 | iex
|
|
363
363
|
```
|
|
364
364
|
|
|
365
365
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
366
366
|
|
|
367
367
|
```sh
|
|
368
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.
|
|
368
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.48
|
|
369
369
|
```
|
|
370
370
|
|
|
371
371
|
没有 git 时可用 GitHub tag 打包直链:
|
|
372
372
|
|
|
373
373
|
```sh
|
|
374
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.
|
|
374
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.48.tar.gz
|
|
375
375
|
```
|
|
376
376
|
|
|
377
377
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
|
@@ -436,7 +436,7 @@ DSH **0.2.1-rc.1 / 0.2.1-rc.2** 宿主自带 pnpm **11.28.5**,默认启用内
|
|
|
436
436
|
|
|
437
437
|
```yaml
|
|
438
438
|
minimumReleaseAgeExclude:
|
|
439
|
-
- dsh-cost-meter@1.9.
|
|
439
|
+
- dsh-cost-meter@1.9.48
|
|
440
440
|
```
|
|
441
441
|
|
|
442
442
|
3. 仅本次操作用 CLI 透传 pnpm 参数:`dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0`;若只是 lockfile 校验阶段失败,可改用 `--trust-lockfile`。这两个参数已在本机 pnpm 11.28.5 临时 Profile 上实测可用。
|
|
@@ -70,3 +70,7 @@ node test/codex-subscription-published.mjs
|
|
|
70
70
|
### 2026-11-01:Codex Subscription 3.2.2 / 3.2.3
|
|
71
71
|
|
|
72
72
|
针对 `github-actions[bot]` 的 [#444](https://github.com/Han-1413141/dsh-cost-meter/issues/444),验证两个实际 npm 发布包的额度解析、单周/双窗口、缓存、强制刷新、账号切换、共享请求取消和宿主传输拒绝。两版通过,外部请求数为 0;基线更新至处理时的 latest 3.2.3,并保存官方包完整性值,CI 保留两版。未改变其他插件基线。
|
|
73
|
+
|
|
74
|
+
### 2026-11-01:billion-context 0.1.210 / 0.1.211
|
|
75
|
+
|
|
76
|
+
响应 github-actions[bot] 的 [#451](https://github.com/Han-1413141/dsh-cost-meter/issues/451)。两个实际 npm 发布包通过代理/原生计费、四协议、压缩、重试、缓存、父子会话、API/Plan、历史回放、重启及原版 CLI 自动接入检查;仅使用合成数据与本机服务,外部模型请求为 0。无需修改运行时代码,基线更新至处理时的 0.1.211,CI 保留两版并继续验证旧版。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# v1.9.48:模块注册兼容与 Codex 重置时间
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
- 修复启用 dsh-loader 时的客户端重复注册及异步模块加载失败:为费用插件保留原生 `chunk` 与 `require.async`,继续使用按需加载和宿主热更新。感谢 [@3-yanyupingsheng](https://github.com/3-yanyupingsheng) 在 [#452](https://github.com/Han-1413141/dsh-cost-meter/issues/452) 提供桌面环境、错误日志、重启复现及跨版本对照。
|
|
6
|
+
- Codex 输入栏额度的悬停提示按窗口显示剩余百分比与完整重置时间,并显示更新时间;有 5 小时窗口时与 7 天窗口一起展示,缺少时间时保留额度、不生成日期。
|
|
7
|
+
- 验证 billion-context 0.1.210、0.1.211 实际发布包的计费与原版 CLI 自动接入,更新兼容基线和 CI,处理 github-actions[bot] 的 [#451](https://github.com/Han-1413141/dsh-cost-meter/issues/451)。
|
|
8
|
+
- Preserve native chunk registration under dsh-loader, display Codex reset dates in the input-bar tooltip, and verify published billion-context 0.1.210–0.1.211 packages.
|
|
9
|
+
|
|
10
|
+
### Codex 使用方式
|
|
11
|
+
|
|
12
|
+
升级后,鼠标移到输入栏的 **Codex** 额度上即可查看。每个窗口独立显示剩余百分比与本地时间的完整重置日期,底部显示更新时间和点击刷新提示。上游仅提供周额度时只显示周窗口;返回 5 小时额度时自动一起显示,无需新增设置。
|
|
13
|
+
|
|
14
|
+
### 桌面端重复注册
|
|
15
|
+
|
|
16
|
+
[#452](https://github.com/Han-1413141/dsh-cost-meter/issues/452) 的报错栈包含 `dshloaderLoad`。核对 [dsh-loader 1.3.5 源码](https://github.com/dsh-plugins/dsh-loader/blob/v1.3.5/src/client.ts) 和实际 npm 包,发现其包装器只转发 `id`、`factory`,丢失 `chunk`;传给工厂的函数还丢失 `require.async`。官方模块系统本身按“包 ID + 分块文件”区分模块。
|
|
17
|
+
|
|
18
|
+
本版本在检测到该包装器仍生效时,使用其保存的原生注册函数注册费用插件自身模块。全局加载器与其他插件的别名映射保持原样,真正的重复执行仍由宿主报错。主入口和 13 个分块统一使用该处理。
|
|
19
|
+
|
|
20
|
+
如果曾按 issue 中的临时办法禁用了 `cost-meter`,升级后可恢复启用并完全退出、重启桌面端。桌面壳 2.0.20-next 对应核心 0.2.1-rc.3,具体验证范围见[宿主兼容记录](host-compatibility.md#2026-11-01模块加载兼容452)。
|
|
21
|
+
|
|
22
|
+
## English
|
|
23
|
+
|
|
24
|
+
The input-bar Codex tooltip now shows each available quota window's remaining percentage and full local reset date, followed by the last update time. Weekly-only accounts remain weekly-only; a supplied five-hour window appears automatically. Missing reset dates are omitted without hiding valid quota values.
|
|
25
|
+
|
|
26
|
+
The dsh-loader 1.3.5 wrapper drops both chunk metadata and `require.async`. This release registers only cost-meter's own modules through the wrapper's saved native function, preserving the global loader, other plugins' aliases, duplicate-execution errors and host invalidation. Published host module systems 0.2.0-rc.2, 0.2.1-rc.3 and 0.2.1-rc.5 are covered with native and wrapped loading over Web and desktop URLs. This is module integration coverage, not a full Electron desktop run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:"dsh-cost-meter",chunk:"client.billing-storage.js",factory:
|
|
1
|
+
;(function(e){const n=window.__ModuleLoader__,d=n[Symbol.for("@dsh-plugin/dsh-loader:load-wrap")];return(e.id==="dsh-cost-meter"&&n.load===d?.ours&&typeof d.original=="function"?d.original:n.load).call(n,e)})({id:"dsh-cost-meter",chunk:"client.billing-storage.js",factory:h=>{const{createElement:e,useEffect:n,useRef:d,useState:i}=h("react");function D({state:k,api:b,draft:A,setDraft:R,locale:N,disabled:$}){const v=A??k.config,o=v.billingStorageRetentionDays??7,t=(s,g)=>N==="en"?g:s,[a,y]=i(null),[c,C]=i(!1),[M,p]=i(!1),[S,w]=i(""),[B,F]=i(""),m=d(0),u=s=>s<1024?s+" B":s<1048576?(s/1024).toFixed(1)+" KiB":(s/1048576).toFixed(1)+" MiB",x=s=>s==null?"—":new Date(s).toLocaleString(N==="en"?"en-US":"zh-CN"),f=async(s=!1,g=!1)=>{const l=++m.current;C(!0),w(""),p(!1),F("");try{const r=await b.billingStorage({retentionDays:o,apply:s});if(l!==m.current)return;if(s){F(t(`已归档 ${r.archivedStreams} 条记录,移除 ${r.removedFiles} 个文件,释放 ${u(r.releasedBytes)}。`,`Archived ${r.archivedStreams} streams, removed ${r.removedFiles} files and released ${u(r.releasedBytes)}.`));const q=await b.billingStorage({retentionDays:o,apply:!1});l===m.current&&y(q)}else y(r),p(g)}catch(r){l===m.current&&w(String(r?.message??r))}finally{l===m.current&&C(!1)}};n(()=>(y(null),f(),()=>{m.current++}),[o,b]);const _=a&&a.retentionDays===o&&a.streams.eligibleFiles+a.groups.eligibleFiles>0;return e("section",{className:"cm-budget","data-billing-storage":!0},e("h3",{className:"cm-h"},t("计费历史存储","Billing history storage")),e("p",{className:"cm-note"},t("自动维护每小时检查一次:旧的已完成计费流合并压缩,过期请求回执删除。账本、调用记录和历史费用明细保留。","Hourly maintenance compresses completed streams and removes expired request receipts. The ledger, call records and historical cost details are retained.")),e("label",{className:"cm-field"},t("原始辅助文件保留时间","Keep original auxiliary files"),e("select",{value:o,disabled:c,onChange:s=>{p(!1),R({...v,billingStorageRetentionDays:Number(s.target.value)})}},[7,30,0].map(s=>e("option",{key:s,value:s},s?t(`${s} 天`,`${s} days`):t("全部保留(关闭自动清理)","Keep all (disable cleanup)"))))),a?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(min(100%,180px),1fr))",gap:"12px",margin:"12px 0"}},[["streams",t("计费流","Streams")],["groups",t("请求回执","Request receipts")],["archives",t("压缩归档","Compressed archives")]].map(([s,g])=>{const l=a[s];return e("div",{key:s,className:"cm-card"},e("strong",null,g),e("p",{className:"cm-num"},t(`${l.files} 个文件`,`${l.files} files`)+" · "+u(l.bytes)),e("p",{className:"cm-note"},t("最早:","Oldest: ")+x(l.oldestAt)),e("p",{className:"cm-note"},t("最新:","Newest: ")+x(l.newestAt)))})):null,S?e("p",{className:"cm-msg err",role:"alert"},S):null,B?e("p",{className:"cm-msg",role:"status"},B):null,c?e("p",{role:"status"},t("正在处理…","Working…")):null,M&&a?e("div",{role:"group","aria-label":t("确认清理","Confirm cleanup")},e("p",null,t(`将归档 ${a.streams.eligibleFiles} 条计费流、删除 ${a.groups.eligibleFiles} 个回执文件,涉及 ${a.sessions} 个会话,预计释放 ${u(a.reclaimableBytes)}。`,`Archive ${a.streams.eligibleFiles} streams and remove ${a.groups.eligibleFiles} receipt files across ${a.sessions} sessions; estimated release: ${u(a.reclaimableBytes)}.`)),e("p",{className:"cm-note"},t("正在使用或无法确认完成的文件会保留;实际数量以执行结果为准。","Active files and records without a completion receipt are retained; final counts may differ.")),e("div",{className:"cm-buttons"},e("button",{type:"button",className:"cm-btn",disabled:$||c||!_,onClick:()=>f(!0)},t("确认清理","Confirm cleanup")),e("button",{type:"button",className:"cm-btn",disabled:c,onClick:()=>p(!1)},t("取消","Cancel")))):e("div",{className:"cm-buttons"},e("button",{type:"button",className:"cm-btn",disabled:$||c||o===0,onClick:()=>f(!1,!0)},t("预览清理","Preview cleanup")),e("button",{type:"button",className:"cm-btn",disabled:c,onClick:()=>f()},t("刷新统计","Refresh storage"))))}return{mount:()=>D}}});
|
package/lib/client.codex.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:"dsh-cost-meter",chunk:"client.codex.js",factory:
|
|
1
|
+
;(function(g){const e=window.__ModuleLoader__,m=e[Symbol.for("@dsh-plugin/dsh-loader:load-wrap")];return(g.id==="dsh-cost-meter"&&e.load===m?.ours&&typeof m.original=="function"?m.original:e.load).call(e,g)})({id:"dsh-cost-meter",chunk:"client.codex.js",factory:w=>{const g=w("react"),{createElement:e,useState:m,useEffect:h,useRef:v}=g;async function D(t=!1){try{const u=await fetch("/api/dsh-chatgpt-subscription/"+(t?"quota/refresh":"status"),{credentials:"same-origin",signal:AbortSignal.timeout(8e3),headers:{accept:"application/json",...t?{"content-type":"application/json"}:{}},...t?{method:"POST",body:"{}"}:{}});if(!u.ok)return null;const s=await u.json();if(s?.ok!==!0)return null;const l=t?s.value:s.value?.quota;if(!t&&s.value?.authenticated!==!0||!["ready","stale"].includes(l?.state))return null;const c=Array.isArray(l.buckets)?l.buckets.find(a=>a?.id==="codex"):null;if(!Array.isArray(c?.windows))return null;const o={};for(const a of c.windows){const i=a?.windowDurationMins===300?"five":a?.windowDurationMins===10080?"weekly":null,r=a?.usedPercent;if(!i||typeof r!="number"||!Number.isFinite(r)||r<0||r>100)continue;const n=new Date(typeof a.resetsAt=="number"&&a.resetsAt>0?a.resetsAt*1e3:NaN);o[i]={percent:Math.round(r*10)/10,resetsAt:Number.isFinite(n.getTime())?n.toISOString():""}}return o}catch{return null}}async function I(t){try{const u=await fetch("/_dsh/dsh-chatgpt-sub/getCodexBridgeStatus",{credentials:"same-origin",redirect:"error",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});if(!u.ok)return null;const s=await u.json();if(s?.ok!==!0||s.bound!==!0||s.routeConfigured!==!0)return null;const l=await t?.();return l?.ok===!0?l.value:null}catch{return null}}const _="cm-stat-dialog cm-codex-compat-dialog";if(typeof document<"u"){const t=document.createElement("style");t.textContent=".cm-codex-compat-dialog{width:min(560px,94vw)}.cm-codex-compat{display:flex;flex-direction:column;gap:8px;font-size:13px}.cm-codex-compat :is(h3,p){margin:0}.cm-codex-compat h3{font-size:14px;font-weight:600}",t.textContent+='@media (max-width:1023px){.cm-codex-compat-dialog{width:calc(100vw - 32px)}.cm-codex-compat{padding:0 2px}}body[data-dsh-pocket-layout="mobile"] .cm-codex-compat-dialog{width:calc(100vw - 32px)}',document.head.appendChild(t)}const N="dsh-cost-meter:codex-compat-prompt-dismissed",x=new Set;let A=!1;function j(){if(A)return!0;try{return window.localStorage.getItem(N)==="1"}catch{return!1}}function M(){A=!0;try{window.localStorage.setItem(N,"1")}catch{}for(const t of x)t(!0)}function S(){const[t,u]=m(!1),[s,l]=m(null),c=v(!1);return[t,s,a=>{c.current||(c.current=!0,u(!0),l(null),Promise.resolve().then(a).catch(i=>l(i?.message??String(i))).finally(()=>{c.current=!1,u(!1)}))}]}function k(t){const s=t.state?.codexCompat,l=t.api,c=t.locale==="en",o=(C,E)=>c?E:C,a=v(null),[i,r,n]=S(),[d,p]=m(j),f=s?.enabled===!0&&s?.promptDue===!0&&!d;if(h(()=>(x.add(p),()=>x.delete(p)),[]),h(()=>{f&&a.current&&!a.current.open&&a.current.showModal()},[f]),!f)return null;const y=s.usage??{},b=()=>{a.current?.close(),p(!0),M(),Promise.resolve().then(()=>l.dismissCodexCompat()).catch(()=>{})};return e("dialog",{ref:a,className:_,"aria-label":o("兼容修复","Compatibility fix"),onCancel:C=>{C.preventDefault(),b()}},e("header",{className:"cm-stat-dialog-head"},o("兼容修复","Compatibility fix"),e("button",{type:"button",className:"cm-btn","aria-label":o("关闭","Close"),onClick:b},"×")),e("div",{className:"cm-stat-dialog-body"},e("p",null,o("检测到 dsh-codex-subscription {version}。Codex 订阅用量不计入 API 费用;为兼容本插件,新产生的 Codex 用量已自动归类为 Plan。是否将历史 codex 类模型的计费统一归类为 Plan(订阅额度,不计入 API 费用)?","Detected dsh-codex-subscription {version}. Codex subscription usage is not billed as API usage; for compatibility this plugin now defaults new Codex usage to Plan. Reclassify the billing of historical codex-class models as Plan (subscription quota, excluded from API usage)?").replace("{version}","v"+(s.version??""))),y.calls>0?e("p",{className:"cm-note"},o("历史 Codex 用量:{calls} 次调用 · {cost} · {days} 天","Historical Codex usage: {calls} calls · {cost} · {days} days").replace("{calls}",y.calls).replace("{cost}","$"+Number(y.cost??0).toFixed(2)).replace("{days}",y.days)):null,r?e("div",{className:"cm-msg err"},o("失败:","Failed: ")+r):null,e("div",{className:"cm-buttons"},e("button",{type:"button",className:"cm-btn",onClick:b},o("保持现状","Keep status quo")),e("button",{type:"button",className:"cm-btn primary",disabled:i,onClick:()=>n(l.applyCodexCompatHistory)},o("统一归类为 Plan","Reclassify as Plan"))),e("p",{className:"cm-note"},o("之后可在 设置 → 费用 → Codex 订阅兼容 中处理。","You can change this later in Settings → Cost → Codex subscription compatibility."))))}function P(t){const s=t.state?.codexCompat,[l,c,o]=S();if(s?.installed!==!0||s?.enabled!==!0)return null;const a=t.api,i=t.t,r=t.locale==="en",n=(y,b)=>r?b:y,d=s.usage??{},p=s.historyAppliedAt>0,f=s.planClass==="plan"?i("billingClassPlan"):s.planClass==="api"?i("billingClassApi"):i("billingClassAuto");return e("div",{className:"cm-codex-compat"},e("h3",null,n("Codex 订阅兼容","Codex subscription compatibility")),e("p",null,n("检测版本:{version}","Detected version: {version}").replace("{version}","v"+(s.version??""))),e("p",null,n("当前计费方式:{planClass}","Current billing class: {planClass}").replace("{planClass}",f)),e("p",null,n("历史用量:{calls} 次调用 · {cost} · {tokens} tokens · {days} 天","Historical usage: {calls} calls · {cost} · {tokens} tokens · {days} days").replace("{calls}",d.calls).replace("{cost}","$"+Number(d.cost??0).toFixed(2)).replace("{tokens}",Number(d.tokens??0).toLocaleString(r?"en-US":"zh-CN")).replace("{days}",d.days)),c?e("div",{className:"cm-msg err",role:"alert"},n("失败:","Failed: ")+c):null,p?e("p",{className:"cm-note"},n("已归类于 {time}","Reclassified at {time}").replace("{time}",new Date(s.historyAppliedAt).toLocaleString())):e("p",null,n("历史用量未归类。","Historical usage is not reclassified yet.")),!p&&d.providers?.length?e("p",{className:"cm-note"},n("来源:{providers}","Sources: {providers}").replace("{providers}",d.providers.join(", "))):null,p?null:e("div",{className:"cm-buttons"},e("button",{type:"button",className:"cm-btn primary",disabled:l,onClick:()=>o(a.applyCodexCompatHistory)},n("统一归类为 Plan","Reclassify as Plan"))),!p&&s.promptDismissed===!0?e("p",{className:"cm-note"},n("此前选择保持现状,可随时统一归类。","You chose Keep status quo earlier; you can reclassify anytime.")):null)}function q(){return t=>e(t.view==="prompt"?k:P,t)}return{mount:q,CodexCompatPrompt:k,CodexCompatPanel:P,readChatgptQuota:D,readChatgptSubQuota:I}}});
|
package/lib/client.community.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:"dsh-cost-meter",chunk:"client.community.js",factory:
|
|
1
|
+
;(function(a){const e=window.__ModuleLoader__,o=e[Symbol.for("@dsh-plugin/dsh-loader:load-wrap")];return(a.id==="dsh-cost-meter"&&e.load===o?.ours&&typeof o.original=="function"?o.original:e.load).call(e,a)})({id:"dsh-cost-meter",chunk:"client.community.js",factory:d=>{const a=d("react"),{createElement:e,useState:o,useEffect:u}=a,c="dsh-cost-meter:community-notice-seen",s=new Set;let m=!1;function b(){if(m)return!0;try{return window.localStorage.getItem(c)==="1"}catch{return!1}}function w({locale:i,footer:t=!1}){const[p,l]=o(b),n=i==="en",h="https://github.com/Han-1413141/dsh-cost-meter/blob/master/"+(n?"README.md#community":"README.zh-CN.md#交流与反馈"),g=()=>{m=!0;try{window.localStorage.setItem(c,"1")}catch{}l(!0);for(const r of s)r(!0)};u(()=>{s.add(l);const r=f=>{if(f.key===c&&f.newValue==="1"){m=!0;for(const v of s)v(!0)}};return window.addEventListener("storage",r),()=>{s.delete(l),window.removeEventListener("storage",r)}},[]);const y={href:h,target:"_blank",rel:"noopener noreferrer"};return t?p?e("footer",{className:"cm-community-entry"},e("a",y,n?"Community & feedback ↗":"交流与反馈 ↗")):null:p?null:e("aside",{className:"cm-community-notice",role:"status"},e("span",null,n?"The plugin WeChat group is open":"插件交流群已开放"),e("a",y,n?"View QR code ↗":"查看二维码 ↗"),e("button",{type:"button",className:"cm-btn small","aria-label":n?"Dismiss community notice":"关闭交流群提示",onClick:g},"×"))}function x(i){const t=document.createElement("style");return t.textContent=".cm-community-notice{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 12px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1);font-size:12px;color:var(--dsw-alias-label-secondary)}.cm-community-notice button{margin-left:auto;flex:none;min-width:28px;min-height:28px}.cm-community-notice a,.cm-community-entry a{color:var(--dsw-alias-state-business-primary,var(--dsw-alias-brand-primary,#4d6bfe));text-decoration:none}.cm-community-notice a:hover,.cm-community-entry a:hover{text-decoration:underline}.cm-community-entry{display:flex;border-top:1px solid var(--dsw-alias-border-l1);padding-top:12px;font-size:12px}.cm-community-notice :focus-visible,.cm-community-entry a:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4d6bfe);outline-offset:3px;border-radius:4px}",t.textContent+='@media (max-width:1023px){.cm-community-notice{padding:8px 10px;gap:8px}}body[data-dsh-pocket-layout="mobile"] .cm-community-notice{flex-wrap:wrap}',document.head.appendChild(t),i.effect(()=>()=>t.remove(),"cost-meter: community styles"),w}return{mount:x}}});
|