@rayadesu/dsh-client-ui-billing 0.2.0 → 0.2.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.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js +85 -190
- package/lib/invariant.js +3 -3
- package/lib/types/client/BalanceBadge.d.ts +4 -8
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/invariant.d.ts +2 -2
- package/package.json +3 -3
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority; after
|
|
3
3
|
# editing either side, bring the other along and re-record both hashes with:
|
|
4
4
|
# git hash-object README.md README.zh.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 0856ee1b93e49f34da5f534ce189568b8157d157
|
|
6
|
+
README.zh.md: 80a4334b4eaf79636fbdad0ce9484f07dfb1f8e0
|
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ The badge is account-level even though the slot is session-scoped: the header ut
|
|
|
12
12
|
|
|
13
13
|
The spends follow the conversation and the balance stays a manual snapshot:
|
|
14
14
|
|
|
15
|
-
- **Spends follow
|
|
15
|
+
- **Spends follow settled turns, debounced** — the component subscribes to the current session's running flag through the framework `useSession` seat. When a prompt turn settles (the flag flips back to idle), it recomputes this session's spend (`billing/getSessionSpend`) and today's spend (`billing/getTodaySpend`), local pricing passes with no network request, so the spend lines stay live during an ongoing conversation. The recompute is debounced for two seconds, so a burst of turns (an agent continuing across turns) prices once instead of once per turn; the host-side cache (see `dsh-llm-billing`) then serves the first miss for the rest of the minute.
|
|
16
16
|
- **Balance is manual** — the account balance is fetched on mount, on session switch, and on the explicit refresh action (`billing/getBalance`). There is no polling and no automatic refetch: the balance line only changes when one of those events happens.
|
|
17
|
-
- **Refresh keeps the last values** — an in-flight refresh leaves the previous values on screen, and a failed refresh retains the last good value instead of blanking it. The refresh action calls `billing/getTodaySpend(true)`, which bypasses the host-side cache; the
|
|
17
|
+
- **Refresh keeps the last values** — an in-flight refresh leaves the previous values on screen, and a failed refresh retains the last good value instead of blanking it. The refresh action calls `billing/getTodaySpend(true)`, which bypasses the host-side cache; the turn-triggered recompute and the mount/session-switch read use the cached path.
|
|
18
18
|
|
|
19
19
|
## Model Experience
|
|
20
20
|
|
package/README.zh.md
CHANGED
|
@@ -12,9 +12,9 @@ Web 额度特性的归属方:向 `conversation.session.header.utilities` 贡
|
|
|
12
12
|
|
|
13
13
|
花费跟随会话、额度保持手动快照:
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- **花费随回合结束自动更新(去抖)** —— 组件通过框架 `useSession` 座位订阅当前会话的「运行中」标志。每当一轮 prompt 回合结束(标志翻回空闲),就只重算**本会话的花费**(`billing/getSessionSpend`)与**今日共花费**(`billing/getTodaySpend`,纯本地计价、不发网络请求),连续对话时花费行实时跟随。重算有 2 秒去抖,回合突发(agent 连续多轮)只计价一次;宿主侧缓存(见 `dsh-llm-billing`)随后在一分钟内服务首次未命中。
|
|
16
16
|
- **额度保持手动** —— 账户余额在挂载、切换会话、点刷新按钮时拉取(`billing/getBalance`)。**没有轮询、不会自动重拉**:余额行只在这几个时机变化。
|
|
17
|
-
- **刷新保留旧值** —— 刷新在途时旧值留在屏幕上,刷新失败保留上一次有效值,不清空。刷新按钮调用 `billing/getTodaySpend(true)
|
|
17
|
+
- **刷新保留旧值** —— 刷新在途时旧值留在屏幕上,刷新失败保留上一次有效值,不清空。刷新按钮调用 `billing/getTodaySpend(true)`,绕过宿主侧缓存;回合结束触发的重算与挂载/切换会话的读取走缓存路径。
|
|
18
18
|
|
|
19
19
|
## 模型体验
|
|
20
20
|
|
package/lib/client.js
CHANGED
|
@@ -4,9 +4,9 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
let react = require("react");
|
|
9
8
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
//#region ../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
11
11
|
var _a$1;
|
|
12
12
|
function $constructor(name, initializer, params) {
|
|
@@ -613,7 +613,6 @@ window.__ModuleLoader__.load({
|
|
|
613
613
|
const integer = /^-?\d+$/;
|
|
614
614
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
615
615
|
const boolean$1 = /^(?:true|false)$/i;
|
|
616
|
-
const _undefined$2 = /^undefined$/i;
|
|
617
616
|
const lowercase = /^[^A-Z]*$/;
|
|
618
617
|
const uppercase = /^[^a-z]*$/;
|
|
619
618
|
//#endregion
|
|
@@ -1426,22 +1425,6 @@ window.__ModuleLoader__.load({
|
|
|
1426
1425
|
return payload;
|
|
1427
1426
|
};
|
|
1428
1427
|
});
|
|
1429
|
-
const $ZodUndefined = /*@__PURE__*/ $constructor("$ZodUndefined", (inst, def) => {
|
|
1430
|
-
$ZodType.init(inst, def);
|
|
1431
|
-
inst._zod.pattern = _undefined$2;
|
|
1432
|
-
inst._zod.values = new Set([void 0]);
|
|
1433
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1434
|
-
const input = payload.value;
|
|
1435
|
-
if (typeof input === "undefined") return payload;
|
|
1436
|
-
payload.issues.push({
|
|
1437
|
-
expected: "undefined",
|
|
1438
|
-
code: "invalid_type",
|
|
1439
|
-
input,
|
|
1440
|
-
inst
|
|
1441
|
-
});
|
|
1442
|
-
return payload;
|
|
1443
|
-
};
|
|
1444
|
-
});
|
|
1445
1428
|
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
1446
1429
|
$ZodType.init(inst, def);
|
|
1447
1430
|
inst._zod.parse = (payload) => payload;
|
|
@@ -1903,24 +1886,6 @@ window.__ModuleLoader__.load({
|
|
|
1903
1886
|
return payload;
|
|
1904
1887
|
};
|
|
1905
1888
|
});
|
|
1906
|
-
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
1907
|
-
$ZodType.init(inst, def);
|
|
1908
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
1909
|
-
const values = new Set(def.values);
|
|
1910
|
-
inst._zod.values = values;
|
|
1911
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
1912
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1913
|
-
const input = payload.value;
|
|
1914
|
-
if (values.has(input)) return payload;
|
|
1915
|
-
payload.issues.push({
|
|
1916
|
-
code: "invalid_value",
|
|
1917
|
-
values: def.values,
|
|
1918
|
-
input,
|
|
1919
|
-
inst
|
|
1920
|
-
});
|
|
1921
|
-
return payload;
|
|
1922
|
-
};
|
|
1923
|
-
});
|
|
1924
1889
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
1925
1890
|
$ZodType.init(inst, def);
|
|
1926
1891
|
inst._zod.optin = "optional";
|
|
@@ -2499,13 +2464,6 @@ window.__ModuleLoader__.load({
|
|
|
2499
2464
|
});
|
|
2500
2465
|
}
|
|
2501
2466
|
// @__NO_SIDE_EFFECTS__
|
|
2502
|
-
function _undefined$1(Class, params) {
|
|
2503
|
-
return new Class({
|
|
2504
|
-
type: "undefined",
|
|
2505
|
-
...normalizeParams(params)
|
|
2506
|
-
});
|
|
2507
|
-
}
|
|
2508
|
-
// @__NO_SIDE_EFFECTS__
|
|
2509
2467
|
function _unknown(Class) {
|
|
2510
2468
|
return new Class({ type: "unknown" });
|
|
2511
2469
|
}
|
|
@@ -3054,9 +3012,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3054
3012
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3055
3013
|
json.type = "boolean";
|
|
3056
3014
|
};
|
|
3057
|
-
const undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
3058
|
-
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
3059
|
-
};
|
|
3060
3015
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3061
3016
|
json.not = {};
|
|
3062
3017
|
};
|
|
@@ -3067,27 +3022,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3067
3022
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3068
3023
|
json.enum = values;
|
|
3069
3024
|
};
|
|
3070
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3071
|
-
const def = schema._zod.def;
|
|
3072
|
-
const vals = [];
|
|
3073
|
-
for (const val of def.values) if (val === void 0) {
|
|
3074
|
-
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3075
|
-
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3076
|
-
else vals.push(Number(val));
|
|
3077
|
-
else vals.push(val);
|
|
3078
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3079
|
-
const val = vals[0];
|
|
3080
|
-
json.type = val === null ? "null" : typeof val;
|
|
3081
|
-
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
3082
|
-
else json.const = val;
|
|
3083
|
-
} else {
|
|
3084
|
-
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
3085
|
-
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
3086
|
-
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
3087
|
-
if (vals.every((v) => v === null)) json.type = "null";
|
|
3088
|
-
json.enum = vals;
|
|
3089
|
-
}
|
|
3090
|
-
};
|
|
3091
3025
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3092
3026
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3093
3027
|
};
|
|
@@ -3714,14 +3648,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3714
3648
|
function boolean(params) {
|
|
3715
3649
|
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
3716
3650
|
}
|
|
3717
|
-
const ZodUndefined = /*@__PURE__*/ $constructor("ZodUndefined", (inst, def) => {
|
|
3718
|
-
$ZodUndefined.init(inst, def);
|
|
3719
|
-
ZodType.init(inst, def);
|
|
3720
|
-
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
3721
|
-
});
|
|
3722
|
-
function _undefined(params) {
|
|
3723
|
-
return /* @__PURE__ */ _undefined$1(ZodUndefined, params);
|
|
3724
|
-
}
|
|
3725
3651
|
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
3726
3652
|
$ZodUnknown.init(inst, def);
|
|
3727
3653
|
ZodType.init(inst, def);
|
|
@@ -3897,23 +3823,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3897
3823
|
...normalizeParams(params)
|
|
3898
3824
|
});
|
|
3899
3825
|
}
|
|
3900
|
-
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
3901
|
-
$ZodLiteral.init(inst, def);
|
|
3902
|
-
ZodType.init(inst, def);
|
|
3903
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
3904
|
-
inst.values = new Set(def.values);
|
|
3905
|
-
Object.defineProperty(inst, "value", { get() {
|
|
3906
|
-
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
3907
|
-
return def.values[0];
|
|
3908
|
-
} });
|
|
3909
|
-
});
|
|
3910
|
-
function literal(value, params) {
|
|
3911
|
-
return new ZodLiteral({
|
|
3912
|
-
type: "literal",
|
|
3913
|
-
values: Array.isArray(value) ? value : [value],
|
|
3914
|
-
...normalizeParams(params)
|
|
3915
|
-
});
|
|
3916
|
-
}
|
|
3917
3826
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
3918
3827
|
$ZodTransform.init(inst, def);
|
|
3919
3828
|
ZodType.init(inst, def);
|
|
@@ -4081,7 +3990,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4081
3990
|
}
|
|
4082
3991
|
//#endregion
|
|
4083
3992
|
//#region ../../llm/llm-billing/lib/typert.remote-client.js
|
|
4084
|
-
const
|
|
3993
|
+
const _deepseek_ai_dsh_llm_billing_billing_getBalance_result$schema = object({
|
|
4085
3994
|
"isAvailable": boolean(),
|
|
4086
3995
|
"lines": array(object({
|
|
4087
3996
|
"currency": string(),
|
|
@@ -4090,8 +3999,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4090
3999
|
"toppedUp": string()
|
|
4091
4000
|
}))
|
|
4092
4001
|
});
|
|
4093
|
-
const
|
|
4094
|
-
const
|
|
4002
|
+
const _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema = intersection(string(), unknown());
|
|
4003
|
+
const _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_result$schema = object({
|
|
4095
4004
|
"total": number(),
|
|
4096
4005
|
"models": array(object({
|
|
4097
4006
|
"model": string(),
|
|
@@ -4107,12 +4016,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4107
4016
|
"outputCost": number()
|
|
4108
4017
|
}))
|
|
4109
4018
|
});
|
|
4110
|
-
const
|
|
4111
|
-
_undefined(),
|
|
4112
|
-
literal(false),
|
|
4113
|
-
literal(true)
|
|
4114
|
-
]);
|
|
4115
|
-
const _rayadesu_dsh_llm_billing_billing_getTodaySpend_result$schema = object({
|
|
4019
|
+
const _deepseek_ai_dsh_llm_billing_billing_getTodaySpend_result$schema = object({
|
|
4116
4020
|
"total": number(),
|
|
4117
4021
|
"models": array(object({
|
|
4118
4022
|
"model": string(),
|
|
@@ -4129,10 +4033,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4129
4033
|
}))
|
|
4130
4034
|
});
|
|
4131
4035
|
const TYPERT_REMOTE = {
|
|
4132
|
-
package: "@
|
|
4036
|
+
package: "@deepseek-ai/dsh-llm-billing",
|
|
4133
4037
|
descriptors: [
|
|
4134
4038
|
{
|
|
4135
|
-
id: "@
|
|
4039
|
+
id: "@deepseek-ai/dsh-llm-billing#billing/getBalance",
|
|
4136
4040
|
service: "billing",
|
|
4137
4041
|
namespace: "billing",
|
|
4138
4042
|
method: "getBalance",
|
|
@@ -4140,17 +4044,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4140
4044
|
parameters: [],
|
|
4141
4045
|
result: {
|
|
4142
4046
|
mode: "strict",
|
|
4143
|
-
typeSymbol: "@
|
|
4144
|
-
schema:
|
|
4047
|
+
typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekBalance",
|
|
4048
|
+
schema: _deepseek_ai_dsh_llm_billing_billing_getBalance_result$schema
|
|
4145
4049
|
},
|
|
4146
4050
|
sourceLocation: {
|
|
4147
4051
|
"file": "packages/llm/llm-billing/src/balance.ts",
|
|
4148
|
-
"line":
|
|
4052
|
+
"line": 139,
|
|
4149
4053
|
"column": 3
|
|
4150
4054
|
}
|
|
4151
4055
|
},
|
|
4152
4056
|
{
|
|
4153
|
-
id: "@
|
|
4057
|
+
id: "@deepseek-ai/dsh-llm-billing#billing/getSessionSpend",
|
|
4154
4058
|
service: "billing",
|
|
4155
4059
|
namespace: "billing",
|
|
4156
4060
|
method: "getSessionSpend",
|
|
@@ -4162,53 +4066,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4162
4066
|
codec: {
|
|
4163
4067
|
mode: "strict",
|
|
4164
4068
|
typeSymbol: "@deepseek-ai/dsh-session/types#SessionId",
|
|
4165
|
-
schema:
|
|
4069
|
+
schema: _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_parameter_0$schema
|
|
4166
4070
|
}
|
|
4167
4071
|
}],
|
|
4168
4072
|
result: {
|
|
4169
4073
|
mode: "strict",
|
|
4170
|
-
typeSymbol: "@
|
|
4171
|
-
schema:
|
|
4074
|
+
typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekSessionSpend",
|
|
4075
|
+
schema: _deepseek_ai_dsh_llm_billing_billing_getSessionSpend_result$schema
|
|
4172
4076
|
},
|
|
4173
4077
|
sourceLocation: {
|
|
4174
4078
|
"file": "packages/llm/llm-billing/src/balance.ts",
|
|
4175
|
-
"line":
|
|
4079
|
+
"line": 149,
|
|
4176
4080
|
"column": 3
|
|
4177
4081
|
}
|
|
4178
4082
|
},
|
|
4179
4083
|
{
|
|
4180
|
-
id: "@
|
|
4084
|
+
id: "@deepseek-ai/dsh-llm-billing#billing/getTodaySpend",
|
|
4181
4085
|
service: "billing",
|
|
4182
4086
|
namespace: "billing",
|
|
4183
4087
|
method: "getTodaySpend",
|
|
4184
4088
|
invocation: { kind: "direct" },
|
|
4185
|
-
parameters: [
|
|
4186
|
-
name: "force",
|
|
4187
|
-
wire: "force",
|
|
4188
|
-
source: "json",
|
|
4189
|
-
acceptsUndefined: true,
|
|
4190
|
-
codec: {
|
|
4191
|
-
mode: "strict",
|
|
4192
|
-
typeSymbol: "@rayadesu/dsh-llm-billing#billing/getTodaySpend:force",
|
|
4193
|
-
schema: _rayadesu_dsh_llm_billing_billing_getTodaySpend_parameter_0$schema
|
|
4194
|
-
}
|
|
4195
|
-
}],
|
|
4089
|
+
parameters: [],
|
|
4196
4090
|
result: {
|
|
4197
4091
|
mode: "strict",
|
|
4198
|
-
typeSymbol: "@
|
|
4199
|
-
schema:
|
|
4092
|
+
typeSymbol: "@deepseek-ai/dsh-llm-billing/types#DeepSeekTodaySpend",
|
|
4093
|
+
schema: _deepseek_ai_dsh_llm_billing_billing_getTodaySpend_result$schema
|
|
4200
4094
|
},
|
|
4201
4095
|
sourceLocation: {
|
|
4202
4096
|
"file": "packages/llm/llm-billing/src/balance.ts",
|
|
4203
|
-
"line":
|
|
4097
|
+
"line": 159,
|
|
4204
4098
|
"column": 3
|
|
4205
4099
|
}
|
|
4206
4100
|
}
|
|
4207
4101
|
]
|
|
4208
4102
|
};
|
|
4209
4103
|
//#endregion
|
|
4210
|
-
//#region \0dsh-css
|
|
4211
|
-
const css = ".
|
|
4104
|
+
//#region \0dsh-css:/Users/raya/Developer/deepseek-harness/packages/client/ui-billing/src/client/BalanceBadge.module.css.mjs
|
|
4105
|
+
const css = ".EFxmGG_root{position:relative}.EFxmGG_trigger{background:var(--dsw-alias-fill-l2);min-height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;border:0;border-radius:8px;align-items:center;gap:4px;padding:4px 8px;display:inline-flex}.EFxmGG_trigger:hover,.EFxmGG_trigger:focus-visible{color:var(--dsw-alias-label-primary)}.EFxmGG_trigger svg{transition:transform .12s}.EFxmGG_chevronOpen{transform:rotate(180deg)}.EFxmGG_triggerLines{text-align:left;flex-direction:column;align-items:flex-start;gap:0;display:flex}.EFxmGG_linePrimary{font-variant-numeric:tabular-nums;font-size:12px;line-height:16px}.EFxmGG_lineSecondary{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:15px}.EFxmGG_unavailable{color:var(--dsw-alias-label-tertiary)}.EFxmGG_inlineIcon{color:var(--dsw-alias-label-tertiary);flex:none}.EFxmGG_spinning{color:var(--dsw-alias-label-tertiary);flex:none;animation:.8s linear infinite EFxmGG_spin}@keyframes EFxmGG_spin{to{transform:rotate(360deg)}}.EFxmGG_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-menu);width:336px;max-width:min(360px,100vw - 32px);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;flex-direction:column;gap:2px;padding:6px;display:flex;position:absolute;top:calc(100% + 6px);right:0}.EFxmGG_amountRow{border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}.EFxmGG_amountLabel{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-size:13px;line-height:18px}.EFxmGG_spendRow{border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;justify-content:space-between;align-items:center;gap:8px;padding:6px 8px;display:flex}.EFxmGG_costRow{align-items:center;padding:2px 8px 6px;display:flex}.EFxmGG_costBreakdown{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:11px;line-height:16px}.EFxmGG_amountActions{align-items:center;gap:2px;display:inline-flex}.EFxmGG_infoButton,.EFxmGG_refreshButton{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.EFxmGG_infoButton:hover,.EFxmGG_infoButton:focus-visible,.EFxmGG_refreshButton:hover,.EFxmGG_refreshButton:focus-visible{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-fill-l2)}.EFxmGG_modelRow{border-radius:8px;justify-content:space-between;align-items:baseline;gap:8px;padding:6px 8px;display:flex}.EFxmGG_modelName{color:var(--dsw-alias-label-secondary);flex:none;font-size:12px;line-height:18px}.EFxmGG_tasks{text-align:right;min-width:0;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;overflow-wrap:anywhere;font-size:12px;line-height:18px}";
|
|
4212
4106
|
const tagId = "@rayadesu/dsh-client-ui-billing/BalanceBadge.module.css";
|
|
4213
4107
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
4214
4108
|
const tag = document.createElement("style");
|
|
@@ -4218,31 +4112,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4218
4112
|
document.head.appendChild(tag);
|
|
4219
4113
|
}
|
|
4220
4114
|
var BalanceBadge_module_css_default = {
|
|
4221
|
-
"amountActions": "
|
|
4222
|
-
"amountLabel": "
|
|
4223
|
-
"amountRow": "
|
|
4224
|
-
"chevronOpen": "
|
|
4225
|
-
"costBreakdown": "
|
|
4226
|
-
"costRow": "
|
|
4227
|
-
"infoButton": "
|
|
4228
|
-
"inlineIcon": "
|
|
4229
|
-
"linePrimary": "
|
|
4230
|
-
"lineSecondary": "
|
|
4231
|
-
"modelName": "
|
|
4232
|
-
"modelRow": "
|
|
4233
|
-
"panel": "
|
|
4234
|
-
"refreshButton": "
|
|
4235
|
-
"root": "
|
|
4236
|
-
"spendRow": "
|
|
4237
|
-
"spin": "
|
|
4238
|
-
"spinning": "
|
|
4239
|
-
"tasks": "
|
|
4240
|
-
"trigger": "
|
|
4241
|
-
"triggerLines": "
|
|
4242
|
-
"unavailable": "
|
|
4115
|
+
"amountActions": "EFxmGG_amountActions",
|
|
4116
|
+
"amountLabel": "EFxmGG_amountLabel",
|
|
4117
|
+
"amountRow": "EFxmGG_amountRow",
|
|
4118
|
+
"chevronOpen": "EFxmGG_chevronOpen",
|
|
4119
|
+
"costBreakdown": "EFxmGG_costBreakdown",
|
|
4120
|
+
"costRow": "EFxmGG_costRow",
|
|
4121
|
+
"infoButton": "EFxmGG_infoButton",
|
|
4122
|
+
"inlineIcon": "EFxmGG_inlineIcon",
|
|
4123
|
+
"linePrimary": "EFxmGG_linePrimary",
|
|
4124
|
+
"lineSecondary": "EFxmGG_lineSecondary",
|
|
4125
|
+
"modelName": "EFxmGG_modelName",
|
|
4126
|
+
"modelRow": "EFxmGG_modelRow",
|
|
4127
|
+
"panel": "EFxmGG_panel",
|
|
4128
|
+
"refreshButton": "EFxmGG_refreshButton",
|
|
4129
|
+
"root": "EFxmGG_root",
|
|
4130
|
+
"spendRow": "EFxmGG_spendRow",
|
|
4131
|
+
"spin": "EFxmGG_spin",
|
|
4132
|
+
"spinning": "EFxmGG_spinning",
|
|
4133
|
+
"tasks": "EFxmGG_tasks",
|
|
4134
|
+
"trigger": "EFxmGG_trigger",
|
|
4135
|
+
"triggerLines": "EFxmGG_triggerLines",
|
|
4136
|
+
"unavailable": "EFxmGG_unavailable"
|
|
4243
4137
|
};
|
|
4244
4138
|
//#endregion
|
|
4245
|
-
//#region
|
|
4139
|
+
//#region src/client/BalanceBadge.tsx
|
|
4246
4140
|
/** Session-header billing badge: balance plus the current conversation's billed spend. */
|
|
4247
4141
|
/** Currency prefix for one balance line; unknown codes render as a literal prefix. */
|
|
4248
4142
|
function currencySymbol(currency) {
|
|
@@ -4271,10 +4165,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4271
4165
|
* every session, a refresh action, and a spend disclaimer. Refreshing keeps
|
|
4272
4166
|
* the last values visible rather than blanking them.
|
|
4273
4167
|
*
|
|
4274
|
-
* The spend follows the conversation: a
|
|
4275
|
-
* recomputes only the (local, network-free)
|
|
4276
|
-
* through `getSessionSpend` /
|
|
4277
|
-
* manual-refresh snapshot and is never
|
|
4168
|
+
* The spend follows the conversation: when a prompt turn settles in the
|
|
4169
|
+
* current session, the badge recomputes only the (local, network-free)
|
|
4170
|
+
* session spend and today's spend through `getSessionSpend` /
|
|
4171
|
+
* `getTodaySpend`; the balance stays a manual-refresh snapshot and is never
|
|
4172
|
+
* refetched on its own.
|
|
4278
4173
|
* @param props - Remote face, locale, and the standard session-header runtime share.
|
|
4279
4174
|
* @returns the badge, or null until the first balance fetch settles.
|
|
4280
4175
|
*/
|
|
@@ -4287,8 +4182,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4287
4182
|
const [open, setOpen] = (0, react.useState)(false);
|
|
4288
4183
|
const [request, setRequest] = (0, react.useState)(0);
|
|
4289
4184
|
const rootRef = (0, react.useRef)(null);
|
|
4290
|
-
const
|
|
4291
|
-
const
|
|
4185
|
+
const running = useSession((snapshot) => snapshot.running);
|
|
4186
|
+
const pricedRunningRef = (0, react.useRef)(running);
|
|
4292
4187
|
(0, react.useEffect)(() => {
|
|
4293
4188
|
let current = true;
|
|
4294
4189
|
setRefreshing(balance !== null);
|
|
@@ -4328,8 +4223,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4328
4223
|
request
|
|
4329
4224
|
]);
|
|
4330
4225
|
(0, react.useEffect)(() => {
|
|
4331
|
-
if (
|
|
4332
|
-
|
|
4226
|
+
if (running === pricedRunningRef.current) return;
|
|
4227
|
+
pricedRunningRef.current = running;
|
|
4228
|
+
if (running) return;
|
|
4333
4229
|
let current = true;
|
|
4334
4230
|
const timer = setTimeout(() => {
|
|
4335
4231
|
Promise.resolve().then(() => {
|
|
@@ -4351,7 +4247,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4351
4247
|
getSessionSpend,
|
|
4352
4248
|
getTodaySpend,
|
|
4353
4249
|
sessionId,
|
|
4354
|
-
|
|
4250
|
+
running
|
|
4355
4251
|
]);
|
|
4356
4252
|
(0, react.useEffect)(() => {
|
|
4357
4253
|
if (!open) return;
|
|
@@ -4365,20 +4261,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4365
4261
|
}, [open]);
|
|
4366
4262
|
if (balance === null) {
|
|
4367
4263
|
if (error === null) return null;
|
|
4368
|
-
return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
4264
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
4369
4265
|
label: error,
|
|
4370
4266
|
delayMs: 500,
|
|
4371
|
-
children: (0, react_jsx_runtime.jsxs)("button", {
|
|
4267
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4372
4268
|
type: "button",
|
|
4373
4269
|
className: BalanceBadge_module_css_default.trigger,
|
|
4374
4270
|
onClick: () => {
|
|
4375
4271
|
setRequest((value) => value + 1);
|
|
4376
4272
|
},
|
|
4377
4273
|
"aria-label": t("action.refresh"),
|
|
4378
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
4274
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4379
4275
|
className: BalanceBadge_module_css_default.unavailable,
|
|
4380
4276
|
children: t("state.unavailable")
|
|
4381
|
-
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: BalanceBadge_module_css_default.inlineIcon })]
|
|
4277
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: BalanceBadge_module_css_default.inlineIcon })]
|
|
4382
4278
|
})
|
|
4383
4279
|
});
|
|
4384
4280
|
}
|
|
@@ -4388,10 +4284,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4388
4284
|
const line = primaryLine(balance);
|
|
4389
4285
|
const amount = line === void 0 ? "—" : `${line.symbol}${line.total}`;
|
|
4390
4286
|
const spendLine = spend !== null && spend.models.length > 0 ? t("trigger.conversationSpend", { amount: formatSpend(spend.total) }) : void 0;
|
|
4391
|
-
return (0, react_jsx_runtime.jsxs)("div", {
|
|
4287
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4392
4288
|
ref: rootRef,
|
|
4393
4289
|
className: BalanceBadge_module_css_default.root,
|
|
4394
|
-
children: [(0, react_jsx_runtime.jsxs)("button", {
|
|
4290
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4395
4291
|
type: "button",
|
|
4396
4292
|
className: BalanceBadge_module_css_default.trigger,
|
|
4397
4293
|
"aria-expanded": open,
|
|
@@ -4399,70 +4295,70 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4399
4295
|
onClick: () => {
|
|
4400
4296
|
setOpen((value) => !value);
|
|
4401
4297
|
},
|
|
4402
|
-
children: [(0, react_jsx_runtime.jsxs)("span", {
|
|
4298
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4403
4299
|
className: BalanceBadge_module_css_default.triggerLines,
|
|
4404
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
4300
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4405
4301
|
className: BalanceBadge_module_css_default.linePrimary,
|
|
4406
4302
|
children: t("trigger.balance", { amount })
|
|
4407
|
-
}), spendLine !== void 0 && (0, react_jsx_runtime.jsx)("span", {
|
|
4303
|
+
}), spendLine !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4408
4304
|
className: BalanceBadge_module_css_default.lineSecondary,
|
|
4409
4305
|
children: spendLine
|
|
4410
4306
|
})]
|
|
4411
|
-
}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? BalanceBadge_module_css_default.chevronOpen : void 0 })]
|
|
4412
|
-
}), open ? (0, react_jsx_runtime.jsxs)("div", {
|
|
4307
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutline14, { className: open ? BalanceBadge_module_css_default.chevronOpen : void 0 })]
|
|
4308
|
+
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4413
4309
|
className: BalanceBadge_module_css_default.panel,
|
|
4414
4310
|
role: "dialog",
|
|
4415
4311
|
"aria-label": t("panel.aria"),
|
|
4416
4312
|
children: [
|
|
4417
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
4313
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4418
4314
|
className: BalanceBadge_module_css_default.amountRow,
|
|
4419
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
4315
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4420
4316
|
className: BalanceBadge_module_css_default.amountLabel,
|
|
4421
4317
|
children: t("label.amount", { amount })
|
|
4422
|
-
}), (0, react_jsx_runtime.jsxs)("span", {
|
|
4318
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4423
4319
|
className: BalanceBadge_module_css_default.amountActions,
|
|
4424
|
-
children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
4320
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
4425
4321
|
label: t("info.hint"),
|
|
4426
4322
|
delayMs: 200,
|
|
4427
4323
|
maxWidth: 340,
|
|
4428
|
-
children: (0, react_jsx_runtime.jsx)("button", {
|
|
4324
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4429
4325
|
type: "button",
|
|
4430
4326
|
className: BalanceBadge_module_css_default.infoButton,
|
|
4431
4327
|
"aria-label": t("info.aria"),
|
|
4432
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14, { className: BalanceBadge_module_css_default.inlineIcon })
|
|
4328
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQuestionOutline14, { className: BalanceBadge_module_css_default.inlineIcon })
|
|
4433
4329
|
})
|
|
4434
|
-
}), (0, react_jsx_runtime.jsx)("button", {
|
|
4330
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4435
4331
|
type: "button",
|
|
4436
4332
|
className: BalanceBadge_module_css_default.refreshButton,
|
|
4437
4333
|
onClick: refresh,
|
|
4438
4334
|
"aria-label": t("action.refresh"),
|
|
4439
4335
|
"data-refreshing": refreshing || void 0,
|
|
4440
|
-
children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: refreshing ? BalanceBadge_module_css_default.spinning : BalanceBadge_module_css_default.inlineIcon })
|
|
4336
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline14, { className: refreshing ? BalanceBadge_module_css_default.spinning : BalanceBadge_module_css_default.inlineIcon })
|
|
4441
4337
|
})]
|
|
4442
4338
|
})]
|
|
4443
4339
|
}),
|
|
4444
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
4340
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4445
4341
|
className: BalanceBadge_module_css_default.spendRow,
|
|
4446
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
4342
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4447
4343
|
className: BalanceBadge_module_css_default.amountLabel,
|
|
4448
4344
|
children: t("label.sessionSpend", { amount: spend === null ? "—" : spend.models.length === 0 ? t("stat.none") : formatSpend(spend.total) })
|
|
4449
|
-
}), (0, react_jsx_runtime.jsx)("span", {
|
|
4345
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4450
4346
|
className: BalanceBadge_module_css_default.amountLabel,
|
|
4451
4347
|
children: t("label.todaySpend", { amount: todaySpend === null ? "—" : todaySpend.models.length === 0 ? t("stat.none") : formatSpend(todaySpend.total) })
|
|
4452
4348
|
})]
|
|
4453
4349
|
}),
|
|
4454
|
-
spend?.models.map((model) => (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [(0, react_jsx_runtime.jsxs)("div", {
|
|
4350
|
+
spend?.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4455
4351
|
className: BalanceBadge_module_css_default.modelRow,
|
|
4456
|
-
children: [(0, react_jsx_runtime.jsx)("span", {
|
|
4352
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4457
4353
|
className: BalanceBadge_module_css_default.modelName,
|
|
4458
4354
|
children: model.displayName
|
|
4459
|
-
}), (0, react_jsx_runtime.jsx)("span", {
|
|
4355
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4460
4356
|
className: BalanceBadge_module_css_default.tasks,
|
|
4461
4357
|
children: formatSpend(model.cost)
|
|
4462
4358
|
})]
|
|
4463
|
-
}), (0, react_jsx_runtime.jsx)("div", {
|
|
4359
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4464
4360
|
className: BalanceBadge_module_css_default.costRow,
|
|
4465
|
-
children: (0, react_jsx_runtime.jsxs)("span", {
|
|
4361
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4466
4362
|
className: BalanceBadge_module_css_default.costBreakdown,
|
|
4467
4363
|
children: [
|
|
4468
4364
|
t("label.cost.hit", { amount: formatSpend(model.cacheHitInputCost) }),
|
|
@@ -4478,7 +4374,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4478
4374
|
});
|
|
4479
4375
|
}
|
|
4480
4376
|
//#endregion
|
|
4481
|
-
//#region
|
|
4377
|
+
//#region src/client/locales.ts
|
|
4482
4378
|
/** `billing` namespace dictionaries. */
|
|
4483
4379
|
/** Dictionary namespace owned by this plugin. */
|
|
4484
4380
|
const NS = "billing";
|
|
@@ -4519,8 +4415,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4519
4415
|
"panel.aria": "DeepSeek balance details"
|
|
4520
4416
|
};
|
|
4521
4417
|
//#endregion
|
|
4522
|
-
//#region
|
|
4523
|
-
/** DeepSeek account-balance badge, browser half: one session-header utility entry. */
|
|
4418
|
+
//#region src/client/index.ts
|
|
4524
4419
|
/** Services required for locale registration, the Remote face, and the header slot. */
|
|
4525
4420
|
const inject = [
|
|
4526
4421
|
"slots",
|
package/lib/invariant.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region lib/types/invariant.js
|
|
2
2
|
/**
|
|
3
|
-
* Package-owned invariant companion for `@
|
|
4
|
-
* @module @
|
|
3
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-billing`.
|
|
4
|
+
* @module @deepseek-ai/dsh-client-ui-billing/invariant
|
|
5
5
|
*/
|
|
6
|
-
const PACKAGE_NAME = "@
|
|
6
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-client-ui-billing";
|
|
7
7
|
/** Cordis companion plugin name. */
|
|
8
8
|
const name = "client-ui-billing-invariant";
|
|
9
9
|
/** Service required before the companion can reserve package ownership. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Session-header billing badge: balance plus the current conversation's billed spend. */
|
|
2
|
-
import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySpend } from '@
|
|
2
|
+
import type { DeepSeekBalance, DeepSeekSessionSpend, DeepSeekTodaySpend } from '@deepseek-ai/dsh-llm-billing/types';
|
|
3
3
|
import type { SessionId } from '@deepseek-ai/dsh-client-runtime/client';
|
|
4
4
|
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
5
5
|
import { NS } from './locales.ts';
|
|
@@ -9,12 +9,8 @@ export interface BalanceBadgeInjected {
|
|
|
9
9
|
getBalance: () => Promise<DeepSeekBalance>;
|
|
10
10
|
/** Read one session's billed spend; rejects with the Remote error message. */
|
|
11
11
|
getSessionSpend: (sessionId: SessionId) => Promise<DeepSeekSessionSpend>;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
* error message. `force` bypasses the host-side cache — the manual refresh
|
|
15
|
-
* passes it, the message-triggered recompute does not.
|
|
16
|
-
*/
|
|
17
|
-
getTodaySpend: (force?: boolean) => Promise<DeepSeekTodaySpend>;
|
|
12
|
+
/** Read today's billed spend across every session; rejects with the Remote error message. */
|
|
13
|
+
getTodaySpend: () => Promise<DeepSeekTodaySpend>;
|
|
18
14
|
}
|
|
19
15
|
/** Full props assembled by the header utilities slot renderer. */
|
|
20
16
|
export type BalanceBadgeProps = PropsRuntime<'conversation.session.header.utilities'> & InjectFace<BalanceBadgeInjected> & PropsLocale<typeof NS>;
|
|
@@ -31,7 +27,7 @@ export type BalanceBadgeProps = PropsRuntime<'conversation.session.header.utilit
|
|
|
31
27
|
* through `getSessionSpend` / `getTodaySpend`; the balance stays a
|
|
32
28
|
* manual-refresh snapshot and is never refetched on its own.
|
|
33
29
|
* @param props - Remote face, locale, and the standard session-header runtime share.
|
|
34
|
-
* @returns the badge, or null
|
|
30
|
+
* @returns the badge, or null while the first fetch is in flight.
|
|
35
31
|
*/
|
|
36
32
|
export declare function BalanceBadge({ getBalance, getSessionSpend, getTodaySpend, sessionId, useSession, t }: BalanceBadgeProps): import("react").JSX.Element | null;
|
|
37
33
|
//# sourceMappingURL=BalanceBadge.d.ts.map
|
|
@@ -15,7 +15,7 @@ export declare const zh: {
|
|
|
15
15
|
readonly 'state.unavailable': "额度不可用";
|
|
16
16
|
readonly 'action.refresh': "刷新";
|
|
17
17
|
readonly 'info.aria': "花费说明";
|
|
18
|
-
readonly 'info.hint': "仅能预估 DeepSeek
|
|
18
|
+
readonly 'info.hint': "仅能预估 DeepSeek 相关模型。本会话花费按每条消息的发生时刻(北京时间)所在峰谷时段单价计费:缓存命中输入、未命中输入(含缓存写入)、输出(含推理)分别计价。费用按 8 月 17 日实行的标准。";
|
|
19
19
|
readonly 'badge.aria': "DeepSeek 额度:{amount}";
|
|
20
20
|
readonly 'panel.aria': "DeepSeek 额度详情";
|
|
21
21
|
};
|
package/lib/types/invariant.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Package-owned invariant companion for `@
|
|
3
|
-
* @module @
|
|
2
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-billing`.
|
|
3
|
+
* @module @deepseek-ai/dsh-client-ui-billing/invariant
|
|
4
4
|
*/
|
|
5
5
|
import type { Context } from '@deepseek-ai/cordis';
|
|
6
6
|
/** Cordis companion plugin name. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayadesu/dsh-client-ui-billing",
|
|
3
3
|
"description": "Session-header DeepSeek account-balance and conversation-spend badge over the billing Remote",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@rayadesu/dsh-llm-billing": "^0.2.
|
|
48
|
+
"@rayadesu/dsh-llm-billing": "^0.2.1",
|
|
49
49
|
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
|
|
50
50
|
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
|
|
51
51
|
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.8",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@rayadesu/dsh-llm-billing": "^0.2.
|
|
57
|
+
"@rayadesu/dsh-llm-billing": "^0.2.1",
|
|
58
58
|
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
|
|
59
59
|
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
|
|
60
60
|
"@deepseek-ai/dsh-client-test-runtime": "^0.1.0-rc.8",
|