@deepseek-ai/dsh-anonymous-user-id 0.1.2-alpha.3 → 0.1.2-alpha.4
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 +2 -2
- package/README.md +4 -5
- package/README.zh.md +4 -5
- package/package.json +6 -13
- package/lib/invariant.js +0 -24
- package/lib/types/invariant.d.ts +0 -16
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/identity/anonymous-user-id/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: d3865070206d624c21e202161e5f2089a8c1ca3e
|
|
6
|
+
README.zh.md: a731e12880d68faa1fff0c85b431e7e94893cfc3
|
package/README.md
CHANGED
|
@@ -66,16 +66,15 @@ This section explains the design decisions behind the package and points at the
|
|
|
66
66
|
- **Random, never derived.** The id comes from `crypto.randomUUID()`; it is never derived from the hostname, network address, git remote, or any other identifying source, so anonymity is a property of the mint.
|
|
67
67
|
- **Synchronous and memoized.** One process touches the disk once: reads and writes are synchronous, and the result is memoized per resolved file path.
|
|
68
68
|
- **Best-effort persistence.** A write failure still returns a usable id for the run, so telemetry and feedback never block on an unwritable home.
|
|
69
|
-
- **Library, not plugin.** There is no Cordis plugin entry or config
|
|
69
|
+
- **Library, not plugin.** There is no Cordis plugin entry or config. No invariant companion is published because the package owns no event stream or public mutable relation to compare without creating the id as a side effect.
|
|
70
70
|
|
|
71
71
|
### Source map
|
|
72
72
|
|
|
73
73
|
| File | Role |
|
|
74
74
|
|---|---|
|
|
75
75
|
| [`src/index.ts`](src/index.ts) | Library entry: `getOrCreateAnonymousUserId`, file persistence, per-path memoization |
|
|
76
|
-
|
|
|
76
|
+
| — | No runtime invariant companion is published; the API owns one private memo and one best-effort file, with no independent event stream or public mutable relation for a companion to compare without creating the identity as a side effect. |
|
|
77
77
|
| [`tests/anonymous-user-id.spec.ts`](tests/anonymous-user-id.spec.ts) | Exercised behavior: mint, persistence, corruption, concurrency, memoization |
|
|
78
|
-
| [`tests/invariant.spec.ts`](tests/invariant.spec.ts) | Companion registration through the invariants service |
|
|
79
78
|
|
|
80
79
|
### The API
|
|
81
80
|
|
|
@@ -137,8 +136,8 @@ This Dev Note is working context for maintainers: open questions and directions
|
|
|
137
136
|
|
|
138
137
|
The persistence contract is a bare UUID line with no version marker. Adding a second value beside the id, or wrapping the line in a container, has no migration story for existing files; a versioned line format is one way to make such a change safe.
|
|
139
138
|
|
|
140
|
-
#### Open: invariant
|
|
139
|
+
#### Open: invariant observation point
|
|
141
140
|
|
|
142
|
-
|
|
141
|
+
No invariant companion is published because no relation can be checked without creating the id as a side effect. A future observation point could support comparing a re-read of the persisted file against the memoized id.
|
|
143
142
|
|
|
144
143
|
</details>
|
package/README.zh.md
CHANGED
|
@@ -66,16 +66,15 @@ const userId = getOrCreateAnonymousUserId() // stable for the process lifetime
|
|
|
66
66
|
- **随机生成,绝不派生。** id 来自 `crypto.randomUUID()`;绝不从 hostname、网络地址、git remote 或任何其他可识别来源派生,因此匿名性是生成过程的属性。
|
|
67
67
|
- **同步且记忆化。** 一个进程只触碰一次磁盘:读写都是同步的,结果按解析后的文件路径记忆化。
|
|
68
68
|
- **Best-effort 持久化。** 写入失败仍会为本次运行返回可用 id,遥测与反馈因此不会因 home 不可写而阻塞。
|
|
69
|
-
- **库而非插件。** 没有 Cordis
|
|
69
|
+
- **库而非插件。** 没有 Cordis 插件入口或配置。不发布不变式伴生入口,因为本包不拥有任何事件流或公开可变关系,无法在不产生创建 id 这一副作用的情况下比较。
|
|
70
70
|
|
|
71
71
|
### 源码地图
|
|
72
72
|
|
|
73
73
|
| 文件 | 职责 |
|
|
74
74
|
|---|---|
|
|
75
75
|
| [`src/index.ts`](src/index.ts) | 库入口:`getOrCreateAnonymousUserId`、文件持久化、按路径记忆化 |
|
|
76
|
-
|
|
|
76
|
+
| — | 不发布运行时不变式伴生入口;唯一的关系是私有的且带副作用。 |
|
|
77
77
|
| [`tests/anonymous-user-id.spec.ts`](tests/anonymous-user-id.spec.ts) | 已演练行为:生成、持久化、损坏、并发、记忆化 |
|
|
78
|
-
| [`tests/invariant.spec.ts`](tests/invariant.spec.ts) | 通过 invariants 服务注册伴生插件 |
|
|
79
78
|
|
|
80
79
|
### API
|
|
81
80
|
|
|
@@ -137,8 +136,8 @@ const userId = getOrCreateAnonymousUserId() // stable for the process lifetime
|
|
|
137
136
|
|
|
138
137
|
持久化约定是没有任何版本标记的裸 UUID 行。在 id 旁边增加第二个值,或用容器包裹该行,对现有文件都没有迁移方案;带版本的行格式是让此类变更安全的一种方式。
|
|
139
138
|
|
|
140
|
-
####
|
|
139
|
+
#### 开放:不变式观测点
|
|
141
140
|
|
|
142
|
-
|
|
141
|
+
不发布不变式伴生入口,因为任何关系都无法在不产生创建 id 这一副作用的情况下检查。未来若有安全的观测点,可以把重新读取的持久化文件与记忆化的 id 进行比较。
|
|
143
142
|
|
|
144
143
|
</details>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-anonymous-user-id",
|
|
3
3
|
"description": "Shared anonymous user identity for DeepSeek Harness telemetry and feedback correlation",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,29 +18,22 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./src/*": "./src/*",
|
|
26
22
|
"./package.json": "./package.json"
|
|
27
23
|
},
|
|
28
24
|
"files": [
|
|
29
25
|
"lib/index.js",
|
|
30
|
-
"lib/invariant.js",
|
|
31
26
|
"lib/types/**/*.d.ts"
|
|
32
27
|
],
|
|
33
28
|
"license": "MIT",
|
|
34
29
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.3",
|
|
30
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.4",
|
|
31
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.4",
|
|
38
32
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
39
33
|
},
|
|
40
34
|
"devDependencies": {
|
|
41
|
-
"@deepseek-ai/
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/cordis": "^4.0.2"
|
|
35
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
36
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.4",
|
|
37
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.4"
|
|
45
38
|
}
|
|
46
39
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//#region lib/types/invariant.js
|
|
2
|
-
/**
|
|
3
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-anonymous-user-id`.
|
|
4
|
-
* @module @deepseek-ai/dsh-anonymous-user-id/invariant
|
|
5
|
-
*/
|
|
6
|
-
const PACKAGE_NAME = "@deepseek-ai/dsh-anonymous-user-id";
|
|
7
|
-
/** Cordis companion plugin name. */
|
|
8
|
-
const name = "anonymous-user-id-invariant";
|
|
9
|
-
/** Service required before the companion can reserve package ownership. */
|
|
10
|
-
const inject = ["invariants"];
|
|
11
|
-
/**
|
|
12
|
-
* No runtime invariant: the API owns one private memo and one best-effort
|
|
13
|
-
* file, with no independent event stream or public mutable relation for a
|
|
14
|
-
* companion to compare without creating the identity as a side effect.
|
|
15
|
-
*/
|
|
16
|
-
const install = () => {};
|
|
17
|
-
/**
|
|
18
|
-
* Register this package's invariant companion.
|
|
19
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
20
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
21
|
-
*/
|
|
22
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
23
|
-
//#endregion
|
|
24
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-anonymous-user-id`.
|
|
3
|
-
* @module @deepseek-ai/dsh-anonymous-user-id/invariant
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
-
/** Cordis companion plugin name. */
|
|
7
|
-
export declare const name = "anonymous-user-id-invariant";
|
|
8
|
-
/** Service required before the companion can reserve package ownership. */
|
|
9
|
-
export declare const inject: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Register this package's invariant companion.
|
|
12
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
-
*/
|
|
15
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
-
//# sourceMappingURL=invariant.d.ts.map
|