@dsh-agent-toolkit/token-usage 0.1.0 → 0.3.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/LICENSE +1 -1
- package/README.md +36 -15
- package/cordis.patch.yml +1 -5
- package/lib/client-module.d.ts +10 -0
- package/lib/client-module.js +24972 -0
- package/lib/client-module.js.map +1 -0
- package/lib/client.js +51409 -208
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +10 -5
- package/lib/index.js +186 -75
- package/lib/index.js.map +1 -1
- package/package.json +17 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
# @dsh-agent-toolkit/token-usage
|
|
2
2
|
|
|
3
|
-
DeepSeek Harness
|
|
3
|
+
DeepSeek Harness plugin: per-day token usage statistics — 13-week heatmap, stacked daily chart, `/token-usage` command.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
5
|
+
[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)插件:按日/按小时计量 token 用量。
|
|
6
|
+
|
|
7
|
+
- 13 周活动热力图 + 单日堆叠图(按模型/按项目/压缩单列),侧边栏底栏「Token 用量」打开
|
|
8
|
+
- `/token-usage [YYYY-MM-DD]` 命令:今日 + 近 7 日,或指定日期
|
|
9
|
+
- JSON API:`/dsh-agent-toolkit/api/usage/daily?date=`、`/dsh-agent-toolkit/api/usage/range?days=`(web 模式)
|
|
10
|
+
- 用量缺失的样本经 tokenMeter 启发式估算,估算量单列
|
|
11
|
+
|
|
12
|
+
## 截图
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+

|
|
8
17
|
|
|
9
18
|
## 安装
|
|
10
19
|
|
|
11
|
-
```
|
|
12
|
-
dsh plugin
|
|
20
|
+
```bash
|
|
21
|
+
dsh plugin add @dsh-agent-toolkit/token-usage
|
|
13
22
|
```
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
包自带 `cordis.patch.yml`(bundles 层),装进 profile 后自动激活。
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| `timezone` | string(IANA 名) | 系统时区 | 按日聚合的分日时区 |
|
|
26
|
+
> **与 dsh-agent-toolkit 二选一**:`dsh-agent-toolkit` 已内置本插件全部功能(Agent 注册表/分层提示词/委派/飞书 bots + token 用量)。
|
|
27
|
+
> 两者同时安装时,后到实例会自动停用用量功能(不重复计量、不注册 `/token-usage` 命令与面板),先到者完整工作;仍建议只装其一。
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
## 配置
|
|
22
30
|
|
|
23
31
|
```yaml
|
|
24
|
-
- id: token-usage
|
|
25
|
-
name: '@dsh-agent-toolkit/token-usage'
|
|
32
|
+
- id: '@dsh-agent-toolkit/token-usage'
|
|
26
33
|
config:
|
|
27
|
-
timezone: Asia/Shanghai
|
|
34
|
+
timezone: Asia/Shanghai # 默认值;按日/按小时聚合的时区
|
|
28
35
|
```
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
修改配置触发 HMR 热替换,无需重启。
|
|
38
|
+
|
|
39
|
+
## 运行前提
|
|
40
|
+
|
|
41
|
+
- 宿主注入服务:`storageDomain`、`tokenMeter`、`commands`(`webServer` 可选,headless/CLI 下 API 自动不注册)。
|
|
42
|
+
- peer dependency:`@deepseek-ai/cordis` ^4。
|
|
43
|
+
|
|
44
|
+
## 从 0.2.x 升级
|
|
45
|
+
|
|
46
|
+
0.3.0 起本包重写为 `dsh-agent-toolkit` workspace 的用量模块,存储域 `token_usage` 不变,历史数据保留。
|
|
47
|
+
0.1.x/0.2.x 已废弃(deprecated)。
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
package/cordis.patch.yml
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# token-usage 组合包层:profile 的 dsh.profile.bundles 列出本包时应用。
|
|
2
|
-
# 行 name 用包名(非路径),Node 模块解析以 profile 目录为锚点找到已安装代码。
|
|
3
|
-
# config 不写:timezone 由 Config schema 默认(系统时区),用户可在自己 profile 的
|
|
4
|
-
# cordis.patch.yml 中整行覆盖(patch 是整行替换,不深度合并)。
|
|
5
1
|
- insert:
|
|
6
|
-
- id: token-usage
|
|
2
|
+
- id: '@dsh-agent-toolkit/token-usage'
|
|
7
3
|
name: '@dsh-agent-toolkit/token-usage'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
//#region src/client/usage/index.d.ts
|
|
3
|
+
declare function setupUsageClient(ctx: Context): void;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/client/index.d.ts
|
|
6
|
+
declare const inject: string[];
|
|
7
|
+
declare function apply(ctx: Context): void;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { apply, inject, setupUsageClient };
|
|
10
|
+
//# sourceMappingURL=client-module.d.ts.map
|