forked from deepseek-ai/deepseek-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
27 lines (25 loc) · 1.29 KB
/
Copy pathindex.ts
File metadata and controls
27 lines (25 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* The `Branded<B>` nominal-typing primitive — a type-only utility (no runtime
* code, no harness-package dependency) shared by every package that owns a
* cross-boundary id.
*
* A brand makes structurally-identical strings non-interchangeable at the type
* level: a `SessionId` cannot be passed where a `CallId` is expected, even
* though both are plain strings at runtime. Construction goes through a per-id
* factory in the OWNING package (a plain cast inside — zero runtime cost);
* comparison, logging, and serialization all behave as ordinary strings.
*
* Policy: a package brands the ids it owns — `CallId` in dsh-llm (tool-call
* correlation), the shared agent/session `SessionId` in dsh-session, and
* `JobId` in dsh-jobs. Branding is for ids that cross package boundaries and
* could plausibly be confused; not every string needs a brand.
* This package owns ONLY the primitive — no concrete id, no runtime code beyond
* the (erased) type — so the brand vocabulary stays dependency-free and a
* package can brand its ids without depending on an unrelated capability
* package.
*
* @module @deepseek-ai/dsh-brand
*/
declare const BRAND: unique symbol
/** A string carrying a compile-time-only brand `B`. */
export type Branded<B extends string> = string & { readonly [BRAND]: B }