@dsh-agent-toolkit/token-usage 0.1.0 → 0.2.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 +21 -21
- package/README.md +30 -30
- package/cordis.patch.yml +7 -7
- package/lib/client.js +51252 -82
- package/lib/client.js.map +1 -1
- package/lib/index.js +51 -0
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 dsh-agent-toolkit contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-agent-toolkit contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# @dsh-agent-toolkit/token-usage
|
|
2
|
-
|
|
3
|
-
DeepSeek Harness(dsh)插件:按日统计 token 用量。
|
|
4
|
-
|
|
5
|
-
- `/token-usage [YYYY-MM-DD]` 斜杠命令:今日 + 近 7 日汇总,或指定日期
|
|
6
|
-
- `GET /token-usage/api/daily?date=YYYY-MM-DD` JSON 端点(web 模式)
|
|
7
|
-
- Web UI 侧边栏用量面板(点击打开明细弹窗)
|
|
8
|
-
|
|
9
|
-
## 安装
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
dsh plugin --profile web add @dsh-agent-toolkit/token-usage
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 配置
|
|
16
|
-
|
|
17
|
-
| 字段 | 类型 | 默认 | 说明 |
|
|
18
|
-
|---|---|---|---|
|
|
19
|
-
| `timezone` | string(IANA 名) | 系统时区 | 按日聚合的分日时区 |
|
|
20
|
-
|
|
21
|
-
在 profile 的 `cordis.patch.yml` 中整行覆盖:
|
|
22
|
-
|
|
23
|
-
```yaml
|
|
24
|
-
- id: token-usage
|
|
25
|
-
name: '@dsh-agent-toolkit/token-usage'
|
|
26
|
-
config:
|
|
27
|
-
timezone: Asia/Shanghai
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
依赖 dsh 提供 `storageDomain`、`tokenMeter`、`commands` 服务(`@deepseek-ai/dsh-base` 均含);`webServer` 为可选注入,headless/CLI 下不注册 HTTP 端点。
|
|
1
|
+
# @dsh-agent-toolkit/token-usage
|
|
2
|
+
|
|
3
|
+
DeepSeek Harness(dsh)插件:按日统计 token 用量。
|
|
4
|
+
|
|
5
|
+
- `/token-usage [YYYY-MM-DD]` 斜杠命令:今日 + 近 7 日汇总,或指定日期
|
|
6
|
+
- `GET /token-usage/api/daily?date=YYYY-MM-DD` JSON 端点(web 模式)
|
|
7
|
+
- Web UI 侧边栏用量面板(点击打开明细弹窗)
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
dsh plugin --profile web add @dsh-agent-toolkit/token-usage
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 配置
|
|
16
|
+
|
|
17
|
+
| 字段 | 类型 | 默认 | 说明 |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| `timezone` | string(IANA 名) | 系统时区 | 按日聚合的分日时区 |
|
|
20
|
+
|
|
21
|
+
在 profile 的 `cordis.patch.yml` 中整行覆盖:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
- id: token-usage
|
|
25
|
+
name: '@dsh-agent-toolkit/token-usage'
|
|
26
|
+
config:
|
|
27
|
+
timezone: Asia/Shanghai
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
依赖 dsh 提供 `storageDomain`、`tokenMeter`、`commands` 服务(`@deepseek-ai/dsh-base` 均含);`webServer` 为可选注入,headless/CLI 下不注册 HTTP 端点。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# token-usage 组合包层:profile 的 dsh.profile.bundles 列出本包时应用。
|
|
2
|
-
# 行 name 用包名(非路径),Node 模块解析以 profile 目录为锚点找到已安装代码。
|
|
3
|
-
# config 不写:timezone 由 Config schema 默认(系统时区),用户可在自己 profile 的
|
|
4
|
-
# cordis.patch.yml 中整行覆盖(patch 是整行替换,不深度合并)。
|
|
5
|
-
- insert:
|
|
6
|
-
- id: token-usage
|
|
7
|
-
name: '@dsh-agent-toolkit/token-usage'
|
|
1
|
+
# token-usage 组合包层:profile 的 dsh.profile.bundles 列出本包时应用。
|
|
2
|
+
# 行 name 用包名(非路径),Node 模块解析以 profile 目录为锚点找到已安装代码。
|
|
3
|
+
# config 不写:timezone 由 Config schema 默认(系统时区),用户可在自己 profile 的
|
|
4
|
+
# cordis.patch.yml 中整行覆盖(patch 是整行替换,不深度合并)。
|
|
5
|
+
- insert:
|
|
6
|
+
- id: token-usage
|
|
7
|
+
name: '@dsh-agent-toolkit/token-usage'
|