dsh-session-stats/packages/session/session-stats官方

175.3kStar19.0kFork0Issue752Watching

注册sessionStats投影单元提供整个会话的统计信息,包括步骤数、对话轮次、LLM耗时、首次token耗时、解码时间和工具调用耗时,通过session-projection接缝提供给web聊天统计条等客户端使用

机审证据安装命令仓库已核验dsh-plugin Topic许可证READMEAI 百科

此插件是大仓库 deepseek-ai/deepseek-harness 的子包,星数与活跃度统计的是整个仓库。

语言
TypeScript
License
MIT
分支
master
ai-agentscordisdshdsh-plugin

安装

$ dsh plugin --profile web add npm:@deepseek-ai/dsh-session-stats

在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程

对话式安装

帮我安装 DeepSeek Harness 插件 deepseek-ai/deepseek-harness/packages/session/session-stats:先查看仓库 https://github.com/deepseek-ai/deepseek-harness 确认安全性,然后执行安装命令并验证插件加载成功。

把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。

English | 中文

Function plugin registering the sessionStats projection unit: whole-log conversation figures — turn/step counts and the LLM, tool, first-token, and decode wall times — folded from step boundaries, stream chunks, tool pairs, and assembled assistant messages, and served through the session-projection seam (registry snapshot, change feed, and every projection carrier: history tail page, session/projection push frames, session list rows). Clients render full-session figures that paging and compaction cannot change; the reference consumer is the web chat stats strip, whose window fold mirrors these field names as its no-unit fallback.

Fold semantics

  • steps counts step/end events. The agent loop appends exactly one per entered step, in a finally, so completed, failed, cancelled, and max-tokens steps all count. 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).
  • turns counts distinct turns carrying at least one closed step; rejected or empty turns (closed with no step) are uncounted. Turn numbers are host-assigned and monotonic per session, so the fold keeps only the last counted turn.
  • llmMs sums step/startassistant/message per step that assembled a message (retry waits inside the step are model time, as in the window fold).
  • ttftMs/ttftSteps sum and count step/start → first non-empty delta chunk; the first attempt's boundary survives an in-step llm/retry (window resetForRetry parity).
  • decodeMs/decodeTokens sum first token → assembled message and the provider-reported output tokens, only over steps carrying both.
  • toolMs sums tool/calltool/result pairs matched by callId; unresolved calls are dropped at turn/end (results land within their turn).
  • Every field is 0 until its first contributing event. A composed registry always serves the key, so clients read the value, never key presence.

Composition

- id: session-stats
  name: '@deepseek-ai/dsh-session-stats'

Injects sessionProjections — the plugin's whole purpose; in assemblies without the registry the fiber stays pending and nothing registers.

Model Experience

None, as the plugin only computes a client-facing read model of already-logged session events and touches no prompt, message, schema, stream, or tool result.

KV Cache effect

None; the plugin never assembles or sends provider requests.

Known Limitations and Deferred Work

  • Steps count work attempted, not visible output — a step that failed before producing any visible content still closed with step/end and counts; a step interrupted by a crash counts after the session reloads, when crash recovery appends its synthetic step/end (interruptedTurnClosers in dsh-session).
  • A cancelled step is counted but untimed — no assistant message assembles, so its partial stream time enters no wall-time figure, matching the window fold's untimed interrupted node; 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 in the web-app bundle — other assemblies serve no sessionStats key, and their consumers fall back to window-scoped counting (the web stats strip's fallback path).

收录徽章

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/deepseek-ai/deepseek-harness/packages/session/session-stats)

把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。

返回插件目录
dsh-session-stats/packages/session/session-stats — DeepSeek Harness 插件 | deepseek-plugin.org