* feat(release): publish package source, declaration maps, and documentation Every release member publishes its TypeScript source and the declaration maps that resolve into it, and @deepseek-ai/dsh publishes the repository Markdown documentation staged from docs/ at prepack time. The ./src/* export most members already declared now resolves for an installed consumer, and a consumer editor follows a declaration to the implementation. Bundled JavaScript maps stay unpublished; the vendored family and the Desktop runtime file policy are unchanged. Rationale: .agents/notes/implemented/process/2026-10-08-published-source-and-docs.md * feat(release): publish JavaScript maps and compress bundles Every emitted JavaScript map ships beside the bundle it describes, and the workspace build and the client preset compress bundles without mangling identifiers. The documentation payload now mirrors the website publication manifest and is removed again by `postpack`; Desktop and the Python executable exclude the published source, documentation, and maps; `clean` removes a staged copy. Typert's publication contract gains the Remote declaration map. * fix(release): keep node bundles readable for the worker image The browser worker image lowers `yield*` only as a whole statement and rewrites `for await` loops by their source layout, so compressed node-side entries either fail that lowering or lower to unparseable code. Only the browser bundles keep compression, which removes about a third of their text. The bundle-purity assertion now matches the module-loader call regardless of the quote style compression picks, and the release-pack fixture exercises the installed package's new documentation requirement. * feat(release): publish the whole documentation tree `@deepseek-ai/dsh` copies `docs/` in full instead of the website's page set: the maintainer documents, the generated migration records, the translation guidelines, and the `*.i18n.yaml` consistency records ship with the installed package, so the documentation's own links resolve without a checkout. * feat(release): publish the upgrade guides with the documentation The staged documentation keeps the website's page set and adds every `docs/upgrade-guide/` document, which is what an installed reader consults when a released change breaks something. The rest of the maintainer tree stays out. * test(release): expect source and maps in master's new payload cases * feat(release): keep installed docs and source readable in Desktop Desktop keeps the published src/ and docs/ trees inside app.asar, and every model shell call receives DSH_INSTALL_DIR and DSH_NODE_EXECUTABLE so an agent can read them through Electron's Node mode. Staging also generates docs/upgrade-guide/README.md, an index of the upgrade guides grouped by the release they upgrade from. Minified client bundles print string literals with backticks: the worker image packer now recognizes those chunk requests, client license banners are prepended after minification so their text survives, and the affected artifact tests accept either quote. * test(desktop): read archived docs through the Windows PowerShell form Regenerate the config catalog for the shifted shell-env source line. * test(desktop): wait for the GUI-subsystem Electron process from PowerShell * build(release): publish source and maps from the message-quotes package * build(release): publish source and maps from packages new on master * build(release): publish source and maps from the tool-office package
description, kind
| description | kind |
|---|---|
| Whole-log conversation counts and wall times for clients and maintainers choosing, composing, or debugging the sessionStats projection unit. | package-reference |
@deepseek-ai/dsh-session-stats
English | 中文
Summary
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.
Table of Contents
- Use this package
- Understand the implementation
- Further Exploration
- Model Experience
- Known Limitations and Deferred Work
- Dev Note
Use this package
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.
Composition
- name: '@deepseek-ai/dsh-session'
- name: '@deepseek-ai/dsh-session-projection'
- name: '@deepseek-ai/dsh-session-stats'
What the figures mean
| 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.
Failures and recovery
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.
Understand the implementation
Implementation internals — click to expand
This section explains the fold behind the figures; the observable behavior is fully covered in Use this package.
Design concept
The unit is a pure fold over committed session events: step/end is the counted step event because the agent loop appends exactly one per entered step in a finally, so completed, failed, cancelled, and max-tokens steps all land one. Counting assembled assistant messages instead would overcount max-tokens usage-host messages (empty content, excluded from the surface) and undercount cancelled steps (aborted before the message assembles). The wall-time folds mirror the client window fold field by field.
Source map
| File | Role |
|---|---|
src/index.ts |
Plugin entry: inject, unit registration on the mounting fiber |
src/projection.ts |
The fold: state shape, per-event transitions, wire view |
src/types.ts |
One home of the sessionStats projection-key declaration and field types |
Data model
The fold state holds the eight totals plus in-flight boundaries: lastTurn (turn of the last counted step/end), openStep (the open step's boundary facts, closed by its assistant/message), and pendingCalls (tool dispatch times by callId). The wire view is a strict subset — the eight totals — so the persisted-cache state schema extends the view schema with the boundary fields.
Fold rules
- Uninteresting events return the same state reference; the registry's
Object.isgate keeps the change feed quiet. - First-token latency records the first non-empty delta chunk and survives an in-step
llm/retry. - Decode time and tokens accrue only over steps carrying both a first token and a valid provider usage report; malformed usage is ignored like the window fold guards node usage.
- Tool time pairs
tool/call→tool/resultby callId; unresolved calls are dropped atturn/endbecause results land within their turn, and a callId colliding with anObjectprototype name reads as unmatched.
Further Exploration
Read these pages when the unit's contract is not enough. They move from the registry that drives units to adjacent session packages.
- Session projection subsystem — the registry that drives units and serves snapshot and change-feed values.
- Session projection registry package — the registry contract units register against.
- Session package map — adjacent persistence, projection, title, and telemetry packages.
Model Experience
None, as the sessionStats unit folds already-logged step boundaries into a client-facing read model and registers nothing model-facing.
KV Cache effect
None; the package never assembles or sends provider requests.
Known Limitations and Deferred Work
These limits define what the figures describe and when the unit is absent. They are current package constraints.
- Steps count work attempted, not visible output — a step that failed before producing visible content still closes with
step/endand counts; a step interrupted by a crash counts after the session reloads, when crash recovery appends its syntheticstep/end. - A cancelled step is counted but untimed — no assistant message assembles, so its partial stream time enters no wall-time figure; a max-tokens usage-host message conversely contributes model time the surface does not show.
- Counts are log-scoped, not surface-scoped — steps whose messages were later compacted away stay counted; the figures describe the whole session, not the current model-visible surface.
- Mounted only where the projection registry is composed — other assemblies serve no
sessionStatskey, and their consumers fall back to window-scoped counting.
Dev Note
Working context for maintainers — click to expand
None.