@deepseek-ai/dsh-brand 0.1.5-rc.2 → 0.1.6-alpha.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/README.i18n.yaml +1 -1
- package/README.zh.md +4 -4
- package/package.json +1 -1
package/README.i18n.yaml
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/util/brand/README.md
|
|
5
5
|
README.md: f9bcea11d223645a9bb1d2194a129f353220c684
|
|
6
|
-
README.zh.md:
|
|
6
|
+
README.zh.md: f27be07053e3f34bb7bbf298e9d161590386de1c
|
package/README.zh.md
CHANGED
|
@@ -37,7 +37,7 @@ export type SessionId = Branded<'SessionId'>
|
|
|
37
37
|
const sessionId = brandString<SessionId>('session-1')
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
`brandString()` 只改变静态类型,不执行运行时校验。所属类型若有领域文法,应在调用前完成校验。添加品牌后,该 id
|
|
40
|
+
`brandString()` 只改变静态类型,不执行运行时校验。所属类型若有领域文法,应在调用前完成校验。添加品牌后,该 id 在比较、日志记录、JSON 序列化和协议传输中仍表现为普通字符串。
|
|
41
41
|
|
|
42
42
|
### 为数字添加品牌
|
|
43
43
|
|
|
@@ -51,11 +51,11 @@ export type SessionSeq = BrandedNumber<'SessionSeq'>
|
|
|
51
51
|
const seq = brandNumber<SessionSeq>(7)
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
`brandNumber()` 原样返回数字,不执行校验。所属包会在添加品牌前校验非负安全整数范围等要求。比较、算术、日志、JSON
|
|
54
|
+
`brandNumber()` 原样返回数字,不执行校验。所属包会在添加品牌前校验非负安全整数范围等要求。比较、算术、日志、JSON 序列化与协议传输保留普通数字行为;算术会产生未品牌化数字,所属包必须重新准入该数字,才能让它再次进入领域。
|
|
55
55
|
|
|
56
56
|
### 何时添加品牌
|
|
57
57
|
|
|
58
|
-
为跨包边界且可能被混淆的值添加品牌——`dsh-llm` 中的 `ToolCallId`、`dsh-session`
|
|
58
|
+
为跨包边界且可能被混淆的值添加品牌——`dsh-llm` 中的 `ToolCallId`、`dsh-session` 中由 agent(智能体)和会话共享的 `SessionId`、`dsh-jobs` 中的 `JobId`,以及 `dsh-session` 中的 `SessionSeq` 与 `SessionLogOffset`。保持局部或无法混淆的值不需要这种抽象。
|
|
59
59
|
|
|
60
60
|
-----
|
|
61
61
|
|
|
@@ -72,7 +72,7 @@ const seq = brandNumber<SessionSeq>(7)
|
|
|
72
72
|
| 文件 | 职责 |
|
|
73
73
|
|---|---|
|
|
74
74
|
| [`src/index.ts`](src/index.ts) | 品牌化字符串与数字类型及其无状态构造函数 |
|
|
75
|
-
| — |
|
|
75
|
+
| — | 不发布运行时不变量配套入口;这个纯工具不拥有事件流或可变运行时数据;其值代数由单元测试保障。 |
|
|
76
76
|
|
|
77
77
|
### 值为何可移植
|
|
78
78
|
|