@pinkbanana/dsh-balance 0.10.0 → 0.10.1
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 +2 -0
- package/README_EN.md +2 -0
- package/lib/client.js +8 -0
- package/lib/client.js.map +1 -1
- package/lib/index.js +26 -14
- package/lib/index.js.map +1 -1
- package/lib/types/billing.d.ts +5 -0
- package/lib/types/client/locales.d.ts +1 -0
- package/lib/types/client/styles.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ pnpm pack
|
|
|
39
39
|
|
|
40
40
|
消费统计通过新版只读会话句柄读取,以 `inheritedEventCount` 排除分叉继承的记录;会话页在 token 用量变化或一轮运行结束后刷新;统计页面每 15 秒检查更新,重新聚焦或返回页面时刷新,隐藏页面暂停查询。兼容 `assistant/message` 和重试/取消请求的 `assistant/attempt`,读取最后一条 stream usage,并以重试边界区分独立请求,同一次请求的重复结算仅计一次。
|
|
41
41
|
|
|
42
|
+
全局统计会跳过当前 dsh 无法读取的旧格式或损坏会话,并显示未纳入统计的会话数量;其余会话仍正常统计。部分读取结果不缓存,下次刷新会重试。单个会话无法读取或所有会话都读取失败时,仍明确显示读取错误,不将失败记录当作零消费。
|
|
43
|
+
|
|
42
44
|
## 安装
|
|
43
45
|
|
|
44
46
|
```bash
|
package/README_EN.md
CHANGED
|
@@ -37,6 +37,8 @@ pnpm pack
|
|
|
37
37
|
|
|
38
38
|
Usage reads the current read-only session handles and excludes fork-inherited events using `inheritedEventCount`. The conversation tab refreshes when token usage changes or a turn finishes.
|
|
39
39
|
|
|
40
|
+
Global statistics skip sessions that the current dsh cannot read, such as unsupported historical formats or damaged logs, and show how many sessions were excluded. Partial results are retried on the next refresh without caching. An unreadable selected session, or a collection where every session fails to read, still reports an error instead of showing zero usage.
|
|
41
|
+
|
|
40
42
|
## Install
|
|
41
43
|
|
|
42
44
|
```bash
|
package/lib/client.js
CHANGED
|
@@ -774,6 +774,11 @@ window.__ModuleLoader__.load({
|
|
|
774
774
|
result,
|
|
775
775
|
t
|
|
776
776
|
}) : null,
|
|
777
|
+
result?.ok === true && result.scope === "all" && (result.coverage?.skippedSessions ?? 0) > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
778
|
+
className: "dsh-balance-status dsh-billing-coverage",
|
|
779
|
+
role: "status",
|
|
780
|
+
children: t("billing.skippedSessions", { count: result.coverage.skippedSessions })
|
|
781
|
+
}) : null,
|
|
777
782
|
result?.ok === true && result.scope === "all" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
778
783
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SummaryCards, {
|
|
779
784
|
summary: result.summary,
|
|
@@ -1212,6 +1217,7 @@ window.__ModuleLoader__.load({
|
|
|
1212
1217
|
"billing.partial": "仅包含已知价格的请求",
|
|
1213
1218
|
"billing.nativeCny": "人民币计价",
|
|
1214
1219
|
"billing.estimate": "费用按公开标准价估算,实际账单可能包含套餐、折扣或历史价格调整。",
|
|
1220
|
+
"billing.skippedSessions": "有 {count} 个会话暂无法读取,以下统计不包含这些会话。",
|
|
1215
1221
|
"billing.reason.missing-usage": "缺少 provider usage",
|
|
1216
1222
|
"billing.reason.unknown-provider": "未知 provider",
|
|
1217
1223
|
"billing.reason.unknown-model": "未知模型价格",
|
|
@@ -1327,6 +1333,7 @@ window.__ModuleLoader__.load({
|
|
|
1327
1333
|
"billing.partial": "Requests with known pricing only",
|
|
1328
1334
|
"billing.nativeCny": "Billed in CNY",
|
|
1329
1335
|
"billing.estimate": "Costs use published standard rates; actual bills may include plans, discounts or historical price changes.",
|
|
1336
|
+
"billing.skippedSessions": "{count} sessions could not be read. The statistics below exclude these sessions.",
|
|
1330
1337
|
"billing.reason.missing-usage": "Provider usage is missing",
|
|
1331
1338
|
"billing.reason.unknown-provider": "Unknown provider",
|
|
1332
1339
|
"billing.reason.unknown-model": "Unknown model pricing",
|
|
@@ -1701,6 +1708,7 @@ window.__ModuleLoader__.load({
|
|
|
1701
1708
|
.dsh-balance-refresh:focus-visible, .dsh-provider-switch button:focus-visible, .dsh-usage-select:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #4d6bfe); outline-offset: 2px; }
|
|
1702
1709
|
.dsh-balance-status, .dsh-balance-error { margin: 0; border: 1px solid var(--ledger-line); border-radius: var(--dsw-radius-lg, 12px); padding: 20px; background: var(--ledger-paper); color: var(--ledger-muted); font-size: 13px; line-height: 1.6; }
|
|
1703
1710
|
.dsh-balance-error { border-left: 3px solid var(--dsw-alias-state-error-primary, #c33); }
|
|
1711
|
+
.dsh-billing-coverage { border-left: 3px solid var(--dsw-alias-state-warn-primary, #d99525); }
|
|
1704
1712
|
.dsh-balance-error strong { color: var(--dsw-alias-state-error-primary, #c33); }
|
|
1705
1713
|
.dsh-balance-error p { margin: 10px 0 0; }
|
|
1706
1714
|
.dsh-balance-availability { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ledger-muted); }
|