@pinkbanana/dsh-balance 0.8.1 → 0.9.0
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 +14 -1
- package/README_EN.md +14 -1
- package/lib/client.js +4 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +16 -12
- package/lib/index.js.map +1 -1
- package/lib/types/billing.d.ts +3 -3
- package/lib/types/client/BalanceDock.d.ts +1 -1
- package/lib/types/client/BillingTab.d.ts +1 -1
- package/lib/types/client/index.d.ts +1 -1
- package/package.json +36 -26
package/README.md
CHANGED
|
@@ -24,6 +24,19 @@ DeepSeek Harness 插件,用于查询 DeepSeek / StepFun API 余额、各提供
|
|
|
24
24
|
- 原生支持简体中文和英文,并跟随 Harness 系统语言切换
|
|
25
25
|
- 支持 Harness 已保存的 `DEEPSEEK_API_KEY`
|
|
26
26
|
|
|
27
|
+
## 兼容性
|
|
28
|
+
|
|
29
|
+
0.9.0 适配 DeepSeek Harness **0.2.0-rc.2**([上游提交 639ed01](https://github.com/deepseek-ai/deepseek-harness/commit/639ed015397290b3745d163aafe02ffee4aa3f84)),需要 Node.js **22.19+(22.x)或 24+**。本次源码不再兼容 Harness 0.1 的接口。
|
|
30
|
+
|
|
31
|
+
也可在本地构建并打包源码,再用 `dsh plugin --profile web add /absolute/path/to/package.tgz` 安装生成的 `.tgz` 文件,随后重启 Harness:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm install --frozen-lockfile
|
|
35
|
+
pnpm pack
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
消费统计通过新版只读会话句柄读取,以 `inheritedEventCount` 排除分叉继承的记录;会话页在 token 用量变化或一轮运行结束后刷新。
|
|
39
|
+
|
|
27
40
|
## 安装
|
|
28
41
|
|
|
29
42
|
```bash
|
|
@@ -33,7 +46,7 @@ dsh --profile web
|
|
|
33
46
|
|
|
34
47
|
打开 <http://127.0.0.1:3080/>,进入“设置 → 模型余额”。该入口位于“Agent 预设”下方,余额摘要也会显示在已有会话的聊天框下方。API Key 可在“设置 → 模型”中保存,或通过 `DEEPSEEK_API_KEY` 环境变量提供。
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
消费统计从已保存会话日志读取,包含当前运行会话已写入的记录,不展示 prompt 内容。可在插件配置中增加固定汇率,例如:
|
|
37
50
|
|
|
38
51
|
```yaml
|
|
39
52
|
usdToCny: 7.2
|
package/README_EN.md
CHANGED
|
@@ -24,6 +24,19 @@ The composer readout follows the current session’s provider and model. The Set
|
|
|
24
24
|
- Native Simplified Chinese and English that follows the Harness system language
|
|
25
25
|
- Use the `DEEPSEEK_API_KEY` saved by Harness
|
|
26
26
|
|
|
27
|
+
## Compatibility
|
|
28
|
+
|
|
29
|
+
Version 0.9.0 targets DeepSeek Harness **0.2.0-rc.2** ([upstream commit 639ed01](https://github.com/deepseek-ai/deepseek-harness/commit/639ed015397290b3745d163aafe02ffee4aa3f84)). Use Node.js **22.19+ (22.x) or 24+**. Harness 0.1 APIs are no longer supported by this checkout.
|
|
30
|
+
|
|
31
|
+
To install from source, build and pack it locally, then pass the generated `.tgz` path to `dsh plugin --profile web add /absolute/path/to/package.tgz` and restart Harness:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm install --frozen-lockfile
|
|
35
|
+
pnpm pack
|
|
36
|
+
```
|
|
37
|
+
|
|
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
|
+
|
|
27
40
|
## Install
|
|
28
41
|
|
|
29
42
|
```bash
|
|
@@ -33,7 +46,7 @@ dsh --profile web
|
|
|
33
46
|
|
|
34
47
|
Open <http://127.0.0.1:3080/> and go to Settings → Model Balances. The panel sits directly below Agent presets, and the balance summary also appears below the composer in existing sessions. Save the API key in Settings → Models or provide it through the `DEEPSEEK_API_KEY` environment variable.
|
|
35
48
|
|
|
36
|
-
Usage statistics read
|
|
49
|
+
Usage statistics read persisted session logs, including writes visible from active sessions. Prompt content is never exposed. To show a fixed-rate CNY conversion, add for example:
|
|
37
50
|
|
|
38
51
|
```yaml
|
|
39
52
|
usdToCny: 7.2
|
package/lib/client.js
CHANGED
|
@@ -1103,20 +1103,15 @@ window.__ModuleLoader__.load({
|
|
|
1103
1103
|
]
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
1106
|
-
function BillingView({ loadUsage, sessionId, useSession, t }) {
|
|
1106
|
+
function BillingView({ loadUsage, sessionId, useSession, useProjection, t }) {
|
|
1107
1107
|
const timeZone = (0, react.useMemo)(() => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC", []);
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
const node = snapshot.nodes[index];
|
|
1111
|
-
if (node?.kind === "assistant") return `${node.seq}:${node.time}`;
|
|
1112
|
-
}
|
|
1113
|
-
return "empty";
|
|
1114
|
-
});
|
|
1108
|
+
const running = useSession((snapshot) => snapshot.running);
|
|
1109
|
+
const tokenUsage = useProjection("tokenUsage");
|
|
1115
1110
|
const { result, loading, refresh } = useUsageResult(loadUsage, (0, react.useMemo)(() => ({
|
|
1116
1111
|
scope: "session",
|
|
1117
1112
|
sessionId,
|
|
1118
1113
|
timeZone
|
|
1119
|
-
}), [sessionId, timeZone]), `${sessionId}:${
|
|
1114
|
+
}), [sessionId, timeZone]), `${sessionId}:${running}:${JSON.stringify(tokenUsage)}`);
|
|
1120
1115
|
const sessionResult = result?.ok === true && result.scope === "session" ? result : void 0;
|
|
1121
1116
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1122
1117
|
className: "dsh-billing-view",
|