@rayadesu/dsh-billing 0.2.1 → 0.2.2
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/AGENTS.md +16 -7
- package/README.i18n.yaml +2 -2
- package/README.md +36 -1
- package/README.zh.md +33 -1
- package/package.json +20 -4
package/AGENTS.md
CHANGED
|
@@ -11,6 +11,7 @@ deepseek-harness 官方仓库([deepseek-ai/deepseek-harness](https://github.co
|
|
|
11
11
|
```
|
|
12
12
|
packages/llm-billing/ 宿主插件 @rayadesu/dsh-llm-billing(/user/balance 传输、峰谷计价、billing Remote)
|
|
13
13
|
packages/ui-billing/ 浏览器插件 @rayadesu/dsh-client-ui-billing(会话头部徽标与详情面板)
|
|
14
|
+
packages/typert-protocol/ 内嵌 Typert 协议声明(@deepseek-ai/dsh-typert-protocol@0.1.1-rc.2 的 lib/types),构建期供 typert 生成器识别装饰器;刻意不在 pnpm workspace 内,让 @deepseek-ai/dsh-typert-protocol 从 npm 解析(内嵌副本只有声明,无运行时实现)
|
|
14
15
|
cordis.patch.yml DSH profile bundle 补丁层:挂载 llm-billing + ui-billing 两个插件行
|
|
15
16
|
```
|
|
16
17
|
|
|
@@ -31,23 +32,31 @@ cordis.patch.yml DSH profile bundle 补丁层:挂载 llm-billing + ui-
|
|
|
31
32
|
## 约定
|
|
32
33
|
|
|
33
34
|
- **源文件以本仓库为准**:`packages/*/src` 与 `tests/` 没有上游 fork,改动直接在本仓库进行。
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
- **本仓库独立构建**:本仓库是独立 pnpm workspace,tsconfig 只依赖仓库根的
|
|
36
|
+
`tsconfig.base*.json`,`@deepseek-ai/*` peer 包从 npm 解析。`pnpm run build`
|
|
37
|
+
依次跑 host/client 两个编译面:`tsc -b` 产出 `lib/types`,tsdown 产出
|
|
38
|
+
`lib/index.js`/`lib/invariant.js`,typert 生成器按 package.json 的 name 重新生成
|
|
39
|
+
`lib/typert.host.js` 与 `lib/typert.remote-client.*`,client 面重建 `lib/client.js`。
|
|
40
|
+
`lib/` 仍是 gitignore 的构建产物,不进仓库。
|
|
41
|
+
- **发布前校验**:`pnpm run verify`(每个包 `prepublishOnly` 自动运行)检查
|
|
42
|
+
`lib/typert.host.js` 的 `TYPERT.package` 必须等于导出它的包名,且 lib 中不得残留
|
|
43
|
+
其他包名的清单;失败即禁止发布。
|
|
44
|
+
- **依赖以发布形态声明**:`@deepseek-ai/dsh-*` 依赖写 `^0.1.1-rc.2`(对应官方 monorepo 当前发布基线,monorepo 内为
|
|
45
|
+
`workspace:^`);本插件的三个包发布到 npm 的
|
|
40
46
|
`@rayadesu` scope,直接 `dsh plugin add @rayadesu/...` 安装。
|
|
41
47
|
- **密钥不进仓库**:`DEEPSEEK_API_KEY` 等一律由用户环境或凭据 seam 提供,仓库不含真实值。
|
|
42
48
|
- **README 双语**:每个 README 遵循 DSH 结构 `README.md`(EN) + `README.zh.md`(ZH) +
|
|
43
49
|
`README.i18n.yaml`(记录两文件 git blob hash,改动后需更新)。
|
|
44
|
-
- **版本对齐**:根 bundle 与两个包统一版本号(当前 0.2.
|
|
50
|
+
- **版本对齐**:根 bundle 与两个包统一版本号(当前 0.2.2),`pnpm-lock.yaml` 随依赖变更更新。
|
|
45
51
|
- **文本规范**:LF 换行、文件末尾一个换行(`.editorconfig`/`.gitattributes` 已声明)。
|
|
46
52
|
|
|
47
53
|
## 常用命令
|
|
48
54
|
|
|
49
55
|
```sh
|
|
50
56
|
pnpm install # 安装本仓库依赖(dsh-* 从 registry 解析)
|
|
57
|
+
pnpm run build # host + client 两个编译面(tsc + tsdown + typert 产物)
|
|
58
|
+
pnpm run test # vitest
|
|
59
|
+
pnpm run verify # 发布前校验
|
|
51
60
|
dsh plugin --profile web add @rayadesu/dsh-billing @rayadesu/dsh-llm-billing @rayadesu/dsh-client-ui-billing # 安装进 DSH
|
|
52
61
|
```
|
|
53
62
|
|
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: f3072dc71e845a685a5ffbc7148d7fa35c9d7ead
|
|
6
|
+
README.zh.md: 99be34e3d1a1b328956b37d43aff472f9f62470b
|
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ Manual rows (only when you do not want the bundle):
|
|
|
68
68
|
|
|
69
69
|
The two plugin packages declare the DeepSeek Harness packages they build on
|
|
70
70
|
(`@deepseek-ai/cordis`, `@deepseek-ai/dsh-credentials`, `@deepseek-ai/dsh-session`,
|
|
71
|
-
and the client runtime packages) as `peerDependencies` at `^0.1.
|
|
71
|
+
and the client runtime packages) as `peerDependencies` at `^0.1.1-rc.2`. A dsh
|
|
72
72
|
profile does not auto-install peers, so these are provided by the dsh
|
|
73
73
|
installation itself through the `profiles/node_modules` fallback rather than
|
|
74
74
|
fetched from the registry — no extra packages to install, and no registry token
|
|
@@ -88,6 +88,41 @@ export DEEPSEEK_API_KEY=sk-...
|
|
|
88
88
|
dsh web
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
This repository is a standalone pnpm workspace: the plugin packages resolve the
|
|
94
|
+
`@deepseek-ai/*` peer packages from npm, so building does not need a full
|
|
95
|
+
DeepSeek Harness checkout.
|
|
96
|
+
|
|
97
|
+
Requirements: Node `^22.19 || >=24` and pnpm.
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
pnpm install # installs workspace and npm dev dependencies
|
|
101
|
+
pnpm run build # host face (tsc + tsdown + typert artifacts), then client face
|
|
102
|
+
pnpm run typecheck # both compile faces
|
|
103
|
+
pnpm run test # vitest unit/browser tests
|
|
104
|
+
pnpm run verify # pre-publish gate (also runs via prepublishOnly)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The host pass regenerates `lib/typert.host.js` and `lib/typert.remote-client.*`
|
|
108
|
+
from the package source, keyed by each package.json name; the client pass
|
|
109
|
+
rebuilds `lib/client.js`. `lib/` is git-ignored build output — do not hand-edit
|
|
110
|
+
it. If a typert manifest ever names a package other than its own
|
|
111
|
+
(`TYPERT.package` !== package.json name), the `verify` gate fails before publish.
|
|
112
|
+
|
|
113
|
+
The typert generator recognizes `Remote`/`TypertRemoteService` only from a
|
|
114
|
+
workspace-registered protocol package, so `packages/typert-protocol` vendors
|
|
115
|
+
the published `@deepseek-ai/dsh-typert-protocol@0.1.1-rc.2` declarations; when
|
|
116
|
+
the dsh dependency line moves, refresh it from the installed package.
|
|
117
|
+
|
|
118
|
+
Publishing (the bundle and both plugins share one version):
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
pnpm --filter @rayadesu/dsh-llm-billing publish --access public
|
|
122
|
+
pnpm --filter @rayadesu/dsh-client-ui-billing publish --access public
|
|
123
|
+
pnpm publish --access public # @rayadesu/dsh-billing bundle
|
|
124
|
+
```
|
|
125
|
+
|
|
91
126
|
## Configuration
|
|
92
127
|
|
|
93
128
|
Both packages ship sane defaults; everything below is optional.
|
package/README.zh.md
CHANGED
|
@@ -65,7 +65,7 @@ dsh plugin --profile web add @rayadesu/dsh-billing @rayadesu/dsh-llm-billing @ra
|
|
|
65
65
|
|
|
66
66
|
两个插件包把它们依赖的 DeepSeek Harness 包(`@deepseek-ai/cordis`、
|
|
67
67
|
`@deepseek-ai/dsh-credentials`、`@deepseek-ai/dsh-session` 以及客户端运行时包)
|
|
68
|
-
声明为 `peerDependencies`(`^0.1.
|
|
68
|
+
声明为 `peerDependencies`(`^0.1.1-rc.2`)。dsh profile 默认不自动安装 peer,所以
|
|
69
69
|
这些由 dsh 安装本身通过 `profiles/node_modules` 回退提供,而不是从 registry 拉取——
|
|
70
70
|
无需额外安装,安装机也不需要 registry token。
|
|
71
71
|
|
|
@@ -83,6 +83,38 @@ export DEEPSEEK_API_KEY=sk-...
|
|
|
83
83
|
dsh web
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
## 开发
|
|
87
|
+
|
|
88
|
+
本仓库是独立的 pnpm workspace:两个插件包从 npm 解析 `@deepseek-ai/*` peer 包,
|
|
89
|
+
构建不需要完整的 DeepSeek Harness checkout。
|
|
90
|
+
|
|
91
|
+
环境要求:Node `^22.19 || >=24` 与 pnpm。
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
pnpm install # 安装 workspace 与 npm 开发依赖
|
|
95
|
+
pnpm run build # host 面(tsc + tsdown + typert 产物),再 client 面
|
|
96
|
+
pnpm run typecheck # 两个编译面
|
|
97
|
+
pnpm run test # vitest 单元/浏览器测试
|
|
98
|
+
pnpm run verify # 发布前校验(prepublishOnly 也会自动运行)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
host 面会从源码重新生成 `lib/typert.host.js` 与 `lib/typert.remote-client.*`,
|
|
102
|
+
包名取自各 package.json;client 面重建 `lib/client.js`。`lib/` 是 git-ignored
|
|
103
|
+
的构建产物,不要手工修改。一旦 typert 清单里的 `TYPERT.package` 与 package.json
|
|
104
|
+
的 name 不一致,`verify` 会在发布前直接失败。
|
|
105
|
+
|
|
106
|
+
typert 生成器只认工作区内已注册协议包里的 `Remote`/`TypertRemoteService` 声明,所以
|
|
107
|
+
`packages/typert-protocol` 内嵌了 npm 上 `@deepseek-ai/dsh-typert-protocol@0.1.1-rc.2` 的
|
|
108
|
+
声明文件;dsh 依赖线升级时,从安装包重新刷新它。
|
|
109
|
+
|
|
110
|
+
发布(bundle 与两个插件包统一版本号):
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
pnpm --filter @rayadesu/dsh-llm-billing publish --access public
|
|
114
|
+
pnpm --filter @rayadesu/dsh-client-ui-billing publish --access public
|
|
115
|
+
pnpm publish --access public # @rayadesu/dsh-billing bundle
|
|
116
|
+
```
|
|
117
|
+
|
|
86
118
|
## 配置
|
|
87
119
|
|
|
88
120
|
两个包都有合理默认值,下面都是可选的。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayadesu/dsh-billing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "DeepSeek Harness billing plugin: account balance and this session's billed spend with a session-header badge.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"packageManager": "pnpm@11.7.0",
|
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "pnpm
|
|
16
|
+
"build": "pnpm run build:host && pnpm run build:client",
|
|
17
|
+
"build:host": "tsc -b tsconfig.host.json && tsdown --env.DSH_BUILD_FACE host",
|
|
18
|
+
"build:client": "tsc -b tsconfig.client.json && tsdown --env.DSH_BUILD_FACE client",
|
|
19
|
+
"typecheck": "tsc -b tsconfig.host.json && tsc -b tsconfig.client.json",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"verify": "node scripts/verify-packages.mjs"
|
|
17
22
|
},
|
|
18
23
|
"files": [
|
|
19
24
|
"cordis.patch.yml",
|
|
@@ -26,7 +31,18 @@
|
|
|
26
31
|
"access": "public"
|
|
27
32
|
},
|
|
28
33
|
"peerDependencies": {
|
|
29
|
-
"@rayadesu/dsh-llm-billing": "^0.2.
|
|
30
|
-
"@rayadesu/dsh-client-ui-billing": "^0.2.
|
|
34
|
+
"@rayadesu/dsh-llm-billing": "^0.2.2",
|
|
35
|
+
"@rayadesu/dsh-client-ui-billing": "^0.2.2"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
39
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
40
|
+
"@deepseek-ai/dsh-typert-generator": "^0.1.1-rc.2",
|
|
41
|
+
"@types/node": "^22.20.0",
|
|
42
|
+
"jsdom": "29.1.1",
|
|
43
|
+
"lightningcss": "^1.32.0",
|
|
44
|
+
"tsdown": "^0.22.2",
|
|
45
|
+
"typescript": "^6.0.3",
|
|
46
|
+
"vitest": "^4.1.8"
|
|
31
47
|
}
|
|
32
48
|
}
|