description: "Whole-log conversation counts and wall times for clients and maintainers choosing, composing, or debugging the sessionStats projection unit."
English | 中文
This package gives clients whole-session turn and step counts plus LLM, tool, first-token, and decode wall times through the public sessionStats value. The figures come from the complete durable log, so paging and compaction do not change them. Use it when a client must display consistent conversation statistics across reloads and reduced history. When whole-session statistics are unavailable, clients can use window-scoped counting instead.
Mount the plugin beside the session store and the projection registry when clients should display whole-session conversation figures that survive paging and compaction. The unit registers only when the registry is present.
- name: '@deepseek-ai/dsh-session'
- name: '@deepseek-ai/dsh-session-projection'
- name: '@deepseek-ai/dsh-session-stats'
| Field | Meaning |
|---|---|
turns |
Distinct turns with at least one closed step; rejected or empty turns are uncounted |
steps |
Closed steps — completed, failed, cancelled, and max-tokens steps all count |
llmMs |
Summed model wall time over steps that assembled a message |
toolMs |
Summed matched tool/call → tool/result wall time |
ttftMs / ttftSteps |
Summed first-token latency and the steps carrying it |
decodeMs / decodeTokens |
Summed decode wall time and provider output tokens over usage-reporting steps |
Every field is 0 until its first contributing event; the composed registry always serves the key, so clients read the value rather than key presence. Clients render whole-log figures through the projection seam's snapshot and change feed; the reference consumer is the web chat stats strip, whose window fold mirrors these field names as its no-unit fallback.
The unit is inert without the projection registry: inject keeps the fiber pending and nothing registers, so other assemblies lack the sessionStats key. Unmounting the plugin removes the key, because registrations are effects on the mounting fiber. A crash-interrupted step counts after the session reloads, when crash recovery appends its synthetic step/end.
Read these pages when the unit's contract is not enough. They move from the registry that drives units to adjacent session packages.
None, as the sessionStats unit folds already-logged step boundaries into a client-facing read model and registers nothing model-facing.
None; the package never assembles or sends provider requests.
These limits define what the figures describe and when the unit is absent. They are current package constraints.
step/end and counts; a step interrupted by a crash counts after the session reloads, when crash recovery appends its synthetic step/end.sessionStats key, and their consumers fall back to window-scoped counting.Runtime invariant: No companion is published. The package owns a single pure projection fold whose wire payload is schema-validated by the projection registry at every snapshot and change-feed emission, and the event relations the fold relies on (step/end exactly once per entered step, monotonic host-assigned turn numbers, chunk and tool events carrying their step coordinates and call ids) are owned and runtime-checked by dsh-agent-loop and the session surface, not here.