@mzzsfy/dsh-usage-stats 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/package.json +1 -1
- package/src/client.js +1 -1
- package/src/index.js +1 -1
- package/test/client-id.test.mjs +16 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mzzsfy/dsh-usage-stats",
|
|
3
3
|
"description": "DeepSeek Harness 会话费用统计插件:监听 llm/stream 累计 token 用量,按 models.dev 单价估算费用,提供今日/本月/累计、近 14 天趋势与今日会话明细,输入区显示本会话费用徽章",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
package/src/client.js
CHANGED
package/src/index.js
CHANGED
|
@@ -53,7 +53,7 @@ const SETTINGS_SCHEMA = z.object({
|
|
|
53
53
|
model: z.string().description('模型 id,支持 provider/model 精确或模型名前缀'),
|
|
54
54
|
input: z.number().description('输入单价 / 百万 token'),
|
|
55
55
|
output: z.number().description('输出单价 / 百万 token'),
|
|
56
|
-
cacheRead: z.number().
|
|
56
|
+
cacheRead: z.number().description('缓存命中单价 / 百万 token'),
|
|
57
57
|
currency: z.union([z.literal('CNY'), z.literal('USD')]).default('USD').description('单价原生币种'),
|
|
58
58
|
})).default([]).description('自定义模型单价表,命中优先于目录价'),
|
|
59
59
|
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// client.js 注册 id 守卫:loader 按 graph row id(完整包名)匹配注册,短名即加载失败。
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { dirname, join } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import test from 'node:test'
|
|
6
|
+
import assert from 'node:assert/strict'
|
|
7
|
+
|
|
8
|
+
const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
9
|
+
const { name } = JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8'))
|
|
10
|
+
|
|
11
|
+
test('client.js 注册 id 为完整包名', () => {
|
|
12
|
+
const source = readFileSync(join(PKG_ROOT, 'src', 'client.js'), 'utf8')
|
|
13
|
+
const match = source.match(/__ModuleLoader__\.load\(\{\s*id:\s*'([^']+)'/)
|
|
14
|
+
assert.ok(match, 'client.js 缺少 __ModuleLoader__.load 注册')
|
|
15
|
+
assert.equal(match[1], name)
|
|
16
|
+
})
|