docs: translate remaining READMEs
This commit is contained in:
6
packages/util/brand/README.i18n.yaml
Normal file
6
packages/util/brand/README.i18n.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
README.md: 68401d95a31ed2122386794ad5256a5cd93bb2a6
|
||||
README.zh.md: c8b773937426487e67001bc133cf7fae3aea2c6e
|
||||
@@ -1,5 +1,7 @@
|
||||
# dsh-brand
|
||||
|
||||
English | [中文](README.zh.md)
|
||||
|
||||
The `Branded<B>` nominal-typing primitive — a tiny, **type-only** package (no runtime code, no harness-package dependency) shared by every package that owns a cross-boundary id.
|
||||
|
||||
## What `Branded` is
|
||||
|
||||
28
packages/util/brand/README.zh.md
Normal file
28
packages/util/brand/README.zh.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# dsh-brand
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
`Branded<B>` 名义类型原语:一个微小的**仅类型** 包(无运行时代码,无 harness 包依赖),由每个拥有跨边界 id 的包共享。
|
||||
|
||||
## `Branded` 是什么
|
||||
|
||||
品牌使 `SessionId` 和 `CallId` 这样结构相同的字符串在类型层面不可互换,尽管两者在运行时都是普通 `string`。
|
||||
|
||||
```ts
|
||||
import type { Branded } from '@deepseek-ai/dsh-brand'
|
||||
|
||||
export type SessionId = Branded<'SessionId'>
|
||||
|
||||
/** Brand a string as a SessionId (a plain cast — zero runtime cost). */
|
||||
export function SessionId(id: string): SessionId {
|
||||
return id as SessionId
|
||||
}
|
||||
```
|
||||
|
||||
构造操作通过所属包中针对每个 id 的工厂完成。比较、日志记录、JSON 序列化和协议格式与普通字符串表现相同;品牌会在编译时被擦除。
|
||||
|
||||
## 策略:为跨包边界的 id 添加品牌
|
||||
|
||||
包为自己拥有的 id 添加品牌:`CallId` 位于 `dsh-llm`,共享的 agent/会话 `SessionId` 位于 `dsh-session`,`TaskId` 位于 `dsh-tasks`。为可能被混淆的跨包 id 添加品牌,但无需为每个字符串都添加。
|
||||
|
||||
该包只负责原语。保持无依赖意味着,例如 `dsh-tasks` 可以为 `TaskId` 添加品牌,而无需仅为使用 `Branded` 而导入不相关的功能包。
|
||||
Reference in New Issue
Block a user