@deepseek-ai/dsh-session-projection-cache 0.1.0-rc.8 → 0.1.1-rc.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 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/session/session-projection-cache/README.md
5
- README.md: 5d4ad07fab6648acdb40c6aa86d32cc78b4c016e
6
- README.zh.md: 5e38ee98b04bc8f856538112d2922b64cadce4d5
5
+ README.md: 33908578a5127f2b6bb78ed7467833aaaa2cf085
6
+ README.zh.md: 0ca410f91562360d85faadf4cf64cb61ac467482
package/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
5
- The persisted projection cache (`ctx.sessionProjectionCache`): durable checkpoints of every registered projection unit's state, one record per session on the domain data form (`session_projcache` domain — the shipped json backend lands it beside `workspace.json` under the configured storage root). Design authority: the [session-projection RFC](../../../.agents/notes/proposed/architecture/2026-07-27-session-projection-and-command-log.md) (persisted projection cache section).
5
+ The persisted projection cache (`ctx.sessionProjectionCache`): durable checkpoints of every projection unit's state, one record per session on the domain data form (`session_projcache` domain — the shipped json backend lands it beside `workspace.json` under the configured storage root). Design authority: the [session-projection RFC](../../../.agents/notes/proposed/architecture/2026-07-27-session-projection-and-command-log.md) (persisted projection cache section).
6
6
 
7
7
  A stored row `(key → {ver, seq, val})` is a fold shortcut, never an authority: possibly stale (`seq` says exactly how stale) but never wrong. Consequences the implementation commits to:
8
8
 
9
9
  - **Every background write is fail-soft.** A failed durable write logs a warning and keeps the cache stale; the next write or cold read self-heals. A crash between writes costs a longer tail replay, never a wrong value.
10
10
  - **A `ver` mismatch against the live unit's `stateVersion` discards, never migrates.** A unit bump invalidates its rows at read time; the key refolds from the log.
11
+ - **A row must pass the live unit's `stateSchema`.** A malformed row is omitted from the zero-I/O view and rejected by restore so the cold-read ladder refolds it from the log.
11
12
  - **Whole-record writes.** Each write replaces the session's full checkpoint (the registry cut is always complete), snapshotted through the lossless-JSON boundary — a unit state violating the plain-JSON contract fails loud.
12
13
  - **Records are bound to a log lifecycle, not just an id.** Each record stores the header identity (`createdAt`, `cwd`) it was folded from; every read validates it (the live or stored header is the witness) before accepting a row, so a deleted-then-recreated id or a persistence store swapped under a surviving cache discards the unrelated record instead of seeding phantom values.
13
14
  - **The log leads, the cache follows.** A live checkpoint flushes the session's buffered events durably BEFORE the cache row lands, so a crash can leave the cache behind the log (a longer tail replay) but never ahead of it.
@@ -27,7 +28,7 @@ Both `Config` fields are required (no defaults): flush cadence is a deployment c
27
28
 
28
29
  ## Listing read (`cachedSnapshot(meta)`)
29
30
 
30
- The zero-I/O rung: whole values viewed straight from the identity-matching stored record (version-matching keys only), returned as a `{asOfSeq, values}` cut — `asOfSeq` is the lowest served-row watermark, so a client seeding its per-session value store under higher-seq-wins can never let a stale list block overwrite a newer push frame. `undefined` when no usable record exists (unknown id, unrelated lifecycle, or no version-matching rows); the api-proxy list carrier turns that into an absent column.
31
+ The zero-I/O rung: client values viewed straight from the identity-matching stored record (version- and state-schema-matching keys only), returned as a `{asOfSeq, values}` cut — `asOfSeq` is the lowest served-row watermark, so a client seeding its per-session value store under higher-seq-wins can never let a stale list block overwrite a newer push frame. Host-only rows are never returned. `undefined` when no usable client row exists (unknown id, unrelated lifecycle, or no usable rows); the api-proxy list carrier turns that into an absent column.
31
32
 
32
33
  ## Cold read (`coldSnapshot(id, signal?)`)
33
34
 
package/README.zh.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
- 持久投影缓存(`ctx.sessionProjectionCache`):把每个已注册投影单元的状态持久化为检查点,基于域数据形态(domain data form)每会话一条记录(`session_projcache` 域——出厂 JSON 后端将其落在配置的存储根目录下、`workspace.json` 旁边)。设计权威:[session-projection RFC](../../../.agents/notes/proposed/architecture/2026-07-27-session-projection-and-command-log.md)(persisted projection cache 一节)。
5
+ 持久投影缓存(`ctx.sessionProjectionCache`):把每个投影单元的状态保存为检查点,基于域数据形态(domain data form)每会话一条记录(`session_projcache` 域——出厂 JSON 后端将其落在配置的存储根目录下、`workspace.json` 旁边)。设计权威:[session-projection RFC](../../../.agents/notes/proposed/architecture/2026-07-27-session-projection-and-command-log.zh.md)(persisted projection cache 一节)。
6
6
 
7
7
  一条存储行 `(key → {ver, seq, val})` 是折叠捷径,绝不是权威:可能陈旧(`seq` 精确说明陈旧到哪),但绝不会错。实现据此承诺:
8
8
 
9
9
  - **每次后台写入都 fail-soft。** 持久写失败只记一条警告并保持缓存陈旧;下一次写入或冷读自愈。两次写之间崩溃的代价是更长的尾部回放,绝不是错误的值。
10
10
  - **`ver` 与当前运行单元的 `stateVersion` 不匹配即丢弃,绝不迁移。** 单元递增版本会在读取时使其行失效;该 key 从日志重新折叠。
11
+ - **存储行必须通过当前单元的 `stateSchema`。** 畸形行从零 I/O view 中省略,并被 restore 拒绝,使冷读阶梯从日志重新折叠。
11
12
  - **整记录写入。** 每次写入替换该会话的完整检查点(注册表切面始终是完整的),并经无损 JSON 边界快照——违反纯 JSON 约定的单元状态会显式失败并报错。
12
13
  - **记录绑定到日志生命周期,而不只是 id。** 每条记录存储其折叠来源的 header 身份(`createdAt`、`cwd`);每次读取先以活 header 或存储 header 为证验证它,再接受任何行——被删后重建的 id、或缓存幸存而持久化存储被换掉时,无关记录被整体丢弃,绝不播种幻影值。
13
14
  - **日志领先,缓存跟随。** 活会话检查点先把缓冲事件持久 flush,缓存行才落地,因此崩溃只会让缓存落后于日志(更长的尾部回放),绝不领先于它。
@@ -27,7 +28,7 @@
27
28
 
28
29
  ## 列表读(`cachedSnapshot(meta)`)
29
30
 
30
- 零 I/O 一档:从身份匹配的存储记录直接 view 全量值(仅版本匹配的 key),以 `{asOfSeq, values}` 切面返回——`asOfSeq` 取所服务行的最低水位,客户端在 higher-seq-wins 规则下播种值存储时,陈旧列表块永远压不过更新的推送帧。无可用记录(未知 id、无关生命周期、无版本匹配行)时返回 `undefined`;api-proxy 列表载体将其转为列缺席。
31
+ 零 I/O 一档:从身份匹配的存储记录直接 view 客户端值(仅版本与 state schema 均匹配的 key),以 `{asOfSeq, values}` 切面返回——`asOfSeq` 取所服务行的最低水位,客户端在 higher-seq-wins 规则下播种值存储时,陈旧列表块永远压不过更新的推送帧。host-only 行永不返回。无可用客户端行(未知 id、无关生命周期、无可用行)时返回 `undefined`;api-proxy 列表载体将其转为列缺席。
31
32
 
32
33
  ## 冷读(`coldSnapshot(id, signal?)`)
33
34
 
package/lib/index.js CHANGED
@@ -64,7 +64,7 @@ const projectionCacheDomainSpec = defineDomain({
64
64
  //#region lib/types/index.js
65
65
  /**
66
66
  * Persisted projection cache (`ctx.sessionProjectionCache`): durable
67
- * checkpoints of every registered projection unit's state, one record per
67
+ * checkpoints of every client-visible or explicitly persisted projection unit's state, one record per
68
68
  * session on the domain data form (`session_projcache` domain — the shipped
69
69
  * json backend lands it beside `workspace.json`). The cache is a fold
70
70
  * shortcut, never an authority: a row is possibly stale (its `seq`
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Persisted projection cache (`ctx.sessionProjectionCache`): durable
3
- * checkpoints of every registered projection unit's state, one record per
3
+ * checkpoints of every client-visible or explicitly persisted projection unit's state, one record per
4
4
  * session on the domain data form (`session_projcache` domain — the shipped
5
5
  * json backend lands it beside `workspace.json`). The cache is a fold
6
6
  * shortcut, never an authority: a row is possibly stale (its `seq`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-session-projection-cache",
3
3
  "description": "Persisted projection cache (ctx.sessionProjectionCache): durable per-session projection checkpoints over the domain data form, throttled write-behind, and the cold-read ladder (cache row + persistence tail replay)",
4
- "version": "0.1.0-rc.8",
4
+ "version": "0.1.1-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -36,20 +36,20 @@
36
36
  "@deepseek-ai/schemastery": "^3.18.1"
37
37
  },
38
38
  "peerDependencies": {
39
- "@deepseek-ai/dsh-session": "^0.1.0-rc.8",
40
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
41
- "@deepseek-ai/dsh-session-persistence": "^0.1.0-rc.8",
42
- "@deepseek-ai/dsh-session-projection": "^0.1.0-rc.8",
43
- "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.8",
39
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
40
+ "@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
41
+ "@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
42
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
43
+ "@deepseek-ai/dsh-storage-domain": "^0.1.1-rc.2",
44
44
  "@deepseek-ai/cordis": "^4.0.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
48
- "@deepseek-ai/dsh-session": "^0.1.0-rc.8",
49
- "@deepseek-ai/dsh-session-persistence": "^0.1.0-rc.8",
50
- "@deepseek-ai/dsh-session-projection": "^0.1.0-rc.8",
51
- "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.8",
52
- "@deepseek-ai/cordis": "^4.0.1",
53
- "@deepseek-ai/dsh-storage": "^0.1.0-rc.8"
47
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
48
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
49
+ "@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
50
+ "@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
51
+ "@deepseek-ai/dsh-storage": "^0.1.1-rc.2",
52
+ "@deepseek-ai/dsh-storage-domain": "^0.1.1-rc.2",
53
+ "@deepseek-ai/cordis": "^4.0.1"
54
54
  }
55
55
  }