* perf(session): send one projection frame per committed event * fix(session): deliver keys changed before a drive failure; address review * perf(session): carry projection frame changes as key and val entries
2.3 KiB
kind, description
| kind | description |
|---|---|
| upgrade-guide | Live Session projection frames list every key one committed event changed instead of carrying one key each. |
Projection frames list every key one event changed
English | 中文
Change
Live projection frames on the session/control stream and change frames on the session/observeProjections stream carried one projection key each: { type: 'projection', sessionId, key, value, seq }. An event that changed several keys produced several frames with the same seq. Each frame now carries every key one committed event changed: { type: 'projection', sessionId, seq, changes } on session/control, and the same fields without sessionId on session/observeProjections. changes holds one { key, val } entry per changed key, without duplicate keys, where val is the key's new value. A key absent from changes is unchanged. The exported types SessionProjectionUpdate, SessionProjectionChange, SessionControlFrame, and SessionProjectionFrame of @deepseek-ai/dsh-api-session-controller follow the new fields.
Baseline frames, session/projections reads, and the Host listener ctx.sessionProjections.onChanged keep their behavior. The Host adds ctx.sessionProjections.onEventChanged for one call per committed event.
This affects Remote clients that read either stream directly, such as test harnesses, proxies, and external dashboards. The bundled Web client and @deepseek-ai/dsh-api-session-controller/client read the new frames.
Migration
-
Replace a call such as
apply(frame.key, frame.value, frame.seq)with a loop overframe.changes:import type { SessionControlFrame } from '@deepseek-ai/dsh-api-session-controller' declare const frame: Extract<SessionControlFrame, { type: 'projection' }> declare function apply(key: string, value: unknown, seq: number): void for (const change of frame.changes) apply(change.key, change.val, frame.seq) -
Replace key tests such as
frame.key === 'inbox'withframe.changes.find(change => change.key === 'inbox'), and read the value from that entry'sval. -
Confirm that one committed event yields at most one
projectionframe per Session, and that the values your client holds match a freshsession/projectionsread.