@deepseek-ai/dsh-experimental-client-ui-stats 0.0.0-stage → 0.2.2-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +43 -0
- package/README.md +120 -2
- package/README.zh.md +121 -0
- package/lib/client.js +6272 -0
- package/lib/index.js +6 -0
- package/lib/types/client/StatsTable.d.ts +120 -0
- package/lib/types/client/StatsView.d.ts +13 -0
- package/lib/types/client/index.d.ts +17 -0
- package/lib/types/client/locales.d.ts +208 -0
- package/lib/types/client/stats-aggregate.d.ts +53 -0
- package/lib/types/client/stats-compaction.d.ts +32 -0
- package/lib/types/client/stats-contract.d.ts +282 -0
- package/lib/types/client/stats-definition.d.ts +20 -0
- package/lib/types/client/stats-event.d.ts +23 -0
- package/lib/types/client/stats-fold.d.ts +68 -0
- package/lib/types/client/stats-format.d.ts +85 -0
- package/lib/types/client/stats-snapshot-builder.d.ts +15 -0
- package/lib/types/client/stats-totals.d.ts +12 -0
- package/lib/types/client/stats-usage.d.ts +39 -0
- package/lib/types/index.d.ts +4 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +76 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/experimental/client-ui-stats/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: db1b5b42664d338d
|
|
7
|
+
zh: 6985139d86d1b08f
|
|
8
|
+
/deepseek-ai-dsh-experimental-client-ui-stats:
|
|
9
|
+
en: 5f8749a942af8c93
|
|
10
|
+
zh: 969e2b9f331bd83e
|
|
11
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/summary:
|
|
12
|
+
en: cd8563fb8d8a9a3f
|
|
13
|
+
zh: a5fd771cabccedd7
|
|
14
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/use-this-package:
|
|
18
|
+
en: 0fde622d41dedcbf
|
|
19
|
+
zh: a5d6e96e732f81ce
|
|
20
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/use-this-package/when-to-choose-it:
|
|
21
|
+
en: 2fd311c521059d04
|
|
22
|
+
zh: c9a5373274039878
|
|
23
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/use-this-package/minimal-configuration:
|
|
24
|
+
en: e001601f2f9779b1
|
|
25
|
+
zh: 077d3703b8c82774
|
|
26
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/understand-the-implementation:
|
|
27
|
+
en: 7e560f4017eed7a8
|
|
28
|
+
zh: ea7d8b4c0f938dab
|
|
29
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/further-exploration:
|
|
30
|
+
en: 285cfe1d7a99af34
|
|
31
|
+
zh: fbcee76e0c2f20fb
|
|
32
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/model-experience:
|
|
33
|
+
en: 9cc467886fff1f2d
|
|
34
|
+
zh: 4b10d95f64769bad
|
|
35
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/model-experience/kv-cache-effect:
|
|
36
|
+
en: 7605bb868f93b4a8
|
|
37
|
+
zh: 184ca10ce6680499
|
|
38
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/known-limitations-and-deferred-work:
|
|
39
|
+
en: 952b20669aec9c80
|
|
40
|
+
zh: d44f0a126f111e9a
|
|
41
|
+
/deepseek-ai-dsh-experimental-client-ui-stats/known-limitations-and-deferred-work/dev-note:
|
|
42
|
+
en: 3518dbaf30fb19a6
|
|
43
|
+
zh: 73565f0bcc32a364
|
package/README.md
CHANGED
|
@@ -1,3 +1,121 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Experimental conversation view showing per-turn and per-step context size, first-token latency, model versus tool time, cache hit rate, and output speed."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-experimental-client-ui-stats
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Adds a Statistics tab beside Chat and Trajectory. Turn rows expand into steps with context and output tokens, cache hit rate, first-token latency, model and tool time, output speed, and a total-time bar. Scrolling up pulls earlier turns through shared Session paging. The Trigger column names what opened the turn, including a team message's sender, and prompt images show a count pill with a hover preview in the shared viewer. The tab reads Session events and durable prompt images; it registers no tool, prompt section, or service.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Mount it in a client composition that already provides `slots`, `sessions`, `uiConversation`, and `locale`. It contributes one entry to the `conversation.view` slot; no configuration fields exist.
|
|
29
|
+
|
|
30
|
+
### When to choose it
|
|
31
|
+
|
|
32
|
+
Choose it when you need to compare turns or steps by prompt length, cache reuse, and where wall time went. Choose `@deepseek-ai/dsh-client-ui-trajectory` when you need the full event ledger with request headers and tool payloads; the two panels read the same Session and can be enabled together.
|
|
33
|
+
|
|
34
|
+
### Minimal configuration
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- id: ui-stats
|
|
38
|
+
name: '@deepseek-ai/dsh-experimental-client-ui-stats'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
-----
|
|
42
|
+
|
|
43
|
+
<a id="understand-the-implementation"></a>
|
|
44
|
+
## Understand the implementation
|
|
45
|
+
|
|
46
|
+
<details>
|
|
47
|
+
<summary>Implementation internals — click to expand</summary>
|
|
48
|
+
|
|
49
|
+
Six Conversation Definitions fold the event window into nodes for one view target named `stats`. `stats-step` owns one context per `step/start`; `stats-prompt` owns one context per waking user message (human prompt or automated trigger); `stats-turn-end` records the turn boundary so an interrupted tail closes; `stats-code-mode` owns one context per Code-Mode root call for the inner dispatches its runner performed; `stats-compaction` owns one compaction transaction; `stats-event` owns the non-step request, prompt, retry, approval, and prune rows. Turn and step identity comes from the engine's match Location, never from module state, so history paging and multiple Sessions cannot cross-attribute events.
|
|
50
|
+
|
|
51
|
+
| File | Responsibility |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `src/client/stats-definition.ts` | The six Definitions, their match rules, publication cadence, and node envelopes |
|
|
54
|
+
| `src/client/stats-fold.ts` | Event folding, tool pairing, Code-Mode dispatch attribution, and per-step metrics |
|
|
55
|
+
| `src/client/stats-aggregate.ts` | Turn aggregation and ordering, the interrupted-tail close, and the Code-Mode merge into the owning step |
|
|
56
|
+
| `src/client/stats-compaction.ts` | Compaction transaction state and its synthetic summary row |
|
|
57
|
+
| `src/client/stats-event.ts` | Normalization of non-step event rows |
|
|
58
|
+
| `src/client/stats-format.ts` | Display formatting for timestamps, durations, tokens, and percentages |
|
|
59
|
+
| `src/client/stats-usage.ts` | Token-usage derivation shared by step, compaction, and totals rows |
|
|
60
|
+
| `src/client/stats-totals.ts` | Whole-session totals from the host stats and token-usage projections |
|
|
61
|
+
| `src/client/stats-snapshot-builder.ts` | The `stats` view target builder |
|
|
62
|
+
| `src/client/StatsView.tsx` | Scrollport with scroll-to-top paging, table, totals and event rows, time bars, step/tool/answer details, copy controls, and the prompt image pill with its preview and viewer |
|
|
63
|
+
| `src/client/locales.ts` | Every visible string in all eight shipped languages |
|
|
64
|
+
|
|
65
|
+
The footer switches control the totals row, event rows, and the context basis, and the footer stays pinned above the composer while the table scrolls. `Show context delta` is off by default; when on, every turn and step shows its prompt-size change against the previous measured value in that scope, with negative deltas (for example after compaction) in the error colour. An expanded step row fills the Trigger column with its start timestamp (`MM-DD HH:MM:SS.mmm`; the tooltip carries the full `YYYY-MM-DD HH:MM:SS.mmm`) and any gap of at least one second since the previous step; sub-second scheduler noise is hidden. A step carrying a model answer is expandable: clicking its row opens a detail row that renders the answer as Markdown through the shared Chat primitive, capped at 16,000 characters with a truncation notice.
|
|
66
|
+
|
|
67
|
+
`Context basis` changes only how a turn row aggregates its steps: `Latest` shows the turn's final prompt size, while `Cumulative` sums that turn's step prompt sizes. The totals row is not affected by this switch. When the host exposes the `sessionStats` and `tokenUsage` projections, the totals row covers the complete Session: turns, steps, cumulative context and output, token-weighted cache, first-token/model/tool time, and output speed. Total time there is model time + tool time because no whole-session wall projection exists. Without those projections the row falls back to the loaded window and is labelled `Window total`. Token cells switch from `K` to `M` at ten million.
|
|
68
|
+
|
|
69
|
+
Non-step rows are hidden by default; the `Show event rows (incl. compaction)` footer switch enables them. Compaction is a log-only transaction, not a step. The table inserts a synthetic `Compaction` row between the steps it ran between; the row shows the summary call's context, output and cache-hit cells, the shadowed token count, the summary size, and its wall time. The same switch reveals request-header, route-context, system-prompt, tool-set, model-retry, model-attempt, context-refresh, approval, and model-free prune rows: a request header shows its reason, provider/model, series flag and tool count; a route context shows provider/model and the prompt-update mode; a system prompt shows append/replace/clear and size; a tool-set row lists added and removed tool names; a retry row shows the attempt number, wait, and failure message; an attempt row marks a model attempt that committed no message; a context-refresh row shows runtime/time context refresh size; an approval row shows the tool and waiting/allowed/rejected state; a prune row shows the pruned token count. These rows are excluded from the turn and totals step sums, so the step columns keep their step-only meaning.
|
|
70
|
+
|
|
71
|
+
The turn cache-hit cell is token-weighted across the steps that reported usage (summed cache reads ÷ summed prompt tokens), so one transient cold step is not hidden by a warmer neighbour; the tooltip shows the summed read/input/write breakdown. A step row keeps its own measured share.
|
|
72
|
+
|
|
73
|
+
Windows are bounded: when a step's `step/start` is outside the loaded window, its start-dependent columns show `—` with a `start unknown` marker rather than a guessed value. Scrolling to the top asks the Session for one older page; the view offsets the scroll position by the height it prepended, so the row being read stays in place.
|
|
74
|
+
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
-----
|
|
78
|
+
|
|
79
|
+
<a id="further-exploration"></a>
|
|
80
|
+
## Further Exploration
|
|
81
|
+
|
|
82
|
+
- [`@deepseek-ai/dsh-client-ui-trajectory`](../../client/ui-trajectory/README.md) — the event ledger this panel borrows its table conventions from.
|
|
83
|
+
- [`@deepseek-ai/dsh-session-stats`](../../session/session-stats/README.md) — the host-side session totals the footer vocabulary follows.
|
|
84
|
+
- [`docs/subsystems/conversation.md`](../../../docs/subsystems/conversation.md) — how view targets and Definitions assemble.
|
|
85
|
+
|
|
86
|
+
-----
|
|
87
|
+
|
|
88
|
+
<a id="model-experience"></a>
|
|
89
|
+
## Model Experience
|
|
90
|
+
|
|
91
|
+
None, as the tab only reads Session events and renders them in the browser; it registers no tool, prompt section, or model input.
|
|
92
|
+
|
|
93
|
+
#### KV Cache effect
|
|
94
|
+
|
|
95
|
+
No effect. The package never constructs a model request and never mutates a prompt.
|
|
96
|
+
|
|
97
|
+
## Known Limitations and Deferred Work
|
|
98
|
+
|
|
99
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
100
|
+
|
|
101
|
+
- **Not mounted by the default product.** The Web bundle refuses experimental packages by rule; the optional Developer tools bundle (`@deepseek-ai/dsh-experimental-inspector-profile`) mounts this view, or a profile can add the row explicitly.
|
|
102
|
+
- **Trimmed windows lose start times.** When the loaded window begins mid-step, first-token, model time, and total time cannot be derived; the row says `start unknown` instead of estimating.
|
|
103
|
+
- **Code-Mode dispatches merge by root-call context.** Inner calls carry no turn or step, so each root call opens its own context keyed by the root call id, and the builder merges its dispatches into the step that owns the runner. A window that lost the dispatch start still merges the calls but cannot show their measured duration.
|
|
104
|
+
- **Older-page retries are explicit.** A page request reports `grew`, `exhausted`, or `retry`; when Chat or Trajectory owns the Session's in-flight page, the Statistics trigger stays visible instead of marking history exhausted or throwing.
|
|
105
|
+
- **Known limitation: no whole-session wall projection.** The totals row substitutes model time + tool time because the host projections expose no whole-session wall clock. The tool segment sums paired call durations, so parallel calls can make that split look longer than a non-overlapping wall interval. This is recorded here; the view does not change host logic to fill the gap.
|
|
106
|
+
- **Recorded-session coverage is exempted for this experimental PR.** Package tests cover folding, aggregation, formatting, paging, and the jsdom table; `apps/web/tests/client-ui-stats-panel.e2e.ts` mounts the plugin through a test-only overlay over the shipped Web surface and compares a committed ARIA golden. By owner decision, this experimental PR does not add a keyless recorded-session scenario; a profile or bundle promotion must add one.
|
|
107
|
+
- **Late re-deliveries are not turns.** Compaction can restate a pruned tool result under its original turn and step after that turn left the window; a turn with no loaded start, prompt, or end marker is dropped instead of appearing as an empty ghost row.
|
|
108
|
+
- **Timing is derived, not sampled.** Total time is the last step's end minus the first step's start; queueing and scheduler waits land in the "rest" segment. The total-time bar draws tool calls as the union of their paired intervals, so parallel calls count once; the tool column keeps the summed per-call time. A turn bar is scaled against the turns currently visible on screen, so a much larger turn that scrolled away does not flatten the rows in view.
|
|
109
|
+
- **Prompt images load through the shared image cache.** The pill and its preview resolve durable attachments with `uiConversation.imageUrl`, so the cache owns and revokes the browser URLs per Session binding; the view creates none of its own. A failed read shows a localized failure state with retry. Touch clients do not open the hover preview; tapping the pill loads the first image directly.
|
|
110
|
+
|
|
111
|
+
<a id="dev-note"></a>
|
|
112
|
+
### Dev Note
|
|
113
|
+
|
|
114
|
+
<details>
|
|
115
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
116
|
+
|
|
117
|
+
The panel was ported from a standalone client plugin. The table vocabulary follows `@deepseek-ai/dsh-session-stats` (model time, tool time, first token, output speed), while the layout follows the Trajectory table so the two tabs read alike.
|
|
118
|
+
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
**Runtime invariant:** No companion is published. All state derives from the Session event window, so independent observation would restate the register/fold logic rather than assert a distinct relationship.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "实验性会话视图:按轮次与步骤展示上下文大小、首 token 延迟、模型与工具耗时、缓存命中率和输出速度。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-experimental-client-ui-stats
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
在「对话」和「轨迹」旁边加一个「统计」页签。每轮一行,展开后列出各步的上下文与输出词数、缓存命中率、首 token 延迟、模型与工具用时、输出速度和总用时条;滚到顶部通过共用 Session 分页加载更早轮次。「触发」列说明这一轮由什么触发,团队消息会写明发送方;带图提问显示张数标签,悬停预览、点击在共用看图器中打开。页签只读会话事件和提问里的持久图片,不注册工具、提示词段落或服务。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
挂到已经提供 `slots`、`uiConversation`、`locale` 的客户端组合里。它向 `conversation.view` 槽贡献一个条目,没有配置字段。
|
|
29
|
+
|
|
30
|
+
### 何时选择它
|
|
31
|
+
|
|
32
|
+
需要按提示词长度、缓存复用情况和总时间去向比较轮次或步骤时选它。需要完整事件清单、请求头和工具正文时选 `@deepseek-ai/dsh-client-ui-trajectory`;两个页签读同一份会话,可以同时启用。
|
|
33
|
+
|
|
34
|
+
### 最小配置
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- id: ui-stats
|
|
38
|
+
name: '@deepseek-ai/dsh-experimental-client-ui-stats'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
-----
|
|
42
|
+
|
|
43
|
+
<a id="understand-the-implementation"></a>
|
|
44
|
+
## 理解实现
|
|
45
|
+
|
|
46
|
+
<details>
|
|
47
|
+
<summary>实现细节——点击展开</summary>
|
|
48
|
+
|
|
49
|
+
六个 Conversation Definition 把事件窗口折叠成名为 `stats` 的视图目标节点。`stats-step` 每个 `step/start` 一个上下文;`stats-prompt` 每条唤醒该轮的用户消息(人写提示或自动触发)一个上下文;`stats-turn-end` 记录轮次边界,让被中断的尾部也能收尾;`stats-code-mode` 每个 Code-Mode 根调用一个上下文,收纳它实际派发的内层调用;`stats-compaction` 每个压缩事务一个上下文;`stats-event` 负责请求、提示词、重试、审批和裁剪等非步骤事件行。轮次与步骤身份取自引擎给出的 match Location,而不是模块级状态,因此历史分页和多个 Session 都不会串归属。
|
|
50
|
+
|
|
51
|
+
| 文件 | 职责 |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `src/client/stats-definition.ts` | 六个 Definition:匹配规则、发布节奏与节点信封 |
|
|
54
|
+
| `src/client/stats-fold.ts` | 事件折叠、工具配对、Code-Mode 内层调用归属、单步指标 |
|
|
55
|
+
| `src/client/stats-aggregate.ts` | 轮次汇总与排序,含被中断尾部的收尾 |
|
|
56
|
+
| `src/client/stats-compaction.ts` | 压缩事务状态与合成摘要行 |
|
|
57
|
+
| `src/client/stats-event.ts` | 非步骤事件行的归一化 |
|
|
58
|
+
| `src/client/stats-format.ts` | 时间、耗时、token、百分比的显示格式化 |
|
|
59
|
+
| `src/client/stats-usage.ts` | 步骤、压缩与合计共用的 token 用量推导 |
|
|
60
|
+
| `src/client/stats-totals.ts` | 从宿主 stats 与 tokenUsage projection 生成全量合计 |
|
|
61
|
+
| `src/client/stats-snapshot-builder.ts` | `stats` 视图目标的增量 builder |
|
|
62
|
+
| `src/client/StatsView.tsx` | 表格、合计/事件行、时间条、步骤/工具/回答详情、复制按钮,以及提问图片标签、预览与看图器 |
|
|
63
|
+
| `src/client/locales.ts` | 全部可见文案,覆盖 8 种 shipped 语言 |
|
|
64
|
+
|
|
65
|
+
页脚的开关控制合计行、事件行与上下文口径,滚表格时页脚钉在输入框上方。「显示上下文增量」默认关闭;打开后每轮/每步显示相对同范围内上一个已测值的提示词大小变化,负增量(例如压缩后)用错误色显示。展开的步骤行在「触发」列显示该步开始时间戳(`MM-DD HH:MM:SS.mmm`,tooltip 为完整的 `YYYY-MM-DD HH:MM:SS.mmm`),以及距上一步至少一秒的空闲;亚秒级调度噪声不显示。带模型回答的步骤也可以展开:点击该行会打开详情行,通过共享的 Chat Markdown 原语渲染回答,最多保留 16,000 字符并提示截断。
|
|
66
|
+
|
|
67
|
+
「上下文口径」只改变轮次行对其各步的聚合方式:「最新」显示该轮最后一步的提示词大小,「累计」显示该轮各步提示词大小之和。合计行不受这个开关影响。宿主提供 `sessionStats` 与 `tokenUsage` projection 时,合计行覆盖整段会话:轮次、步数、累计上下文与输出、token 加权缓存、首 token/模型/工具用时和输出速度;总用时为模型用时 + 工具用时(暂无整段墙钟 projection)。projection 不可用时回退到已加载窗口,并标为「本窗口合计」。token 超过一千万时从 K 切换为 M。
|
|
68
|
+
|
|
69
|
+
非步骤行默认隐藏,由页脚的「显示事件行(含压缩)」开关打开。压缩是 log-only 事务,不是 step。表格会在压缩发生的相邻步骤之间插入一条合成的「压缩」行,显示摘要调用的上下文、输出与缓存命中、被压缩的 token 数、摘要大小和墙钟时间。同一个开关还会显示请求头、路由能力、系统提示词、工具集变更、模型重试、模型尝试、上下文刷新、审批和纯裁剪行:请求头显示 reason、provider/model、是否新序列和工具数;路由能力显示 provider/model 和提示词更新模式;系统提示词显示追加/替换/清空和字符数;工具集行列出新增与移除;重试行显示第几次、等待时间和失败信息;尝试行标记未提交消息的模型尝试;上下文刷新行显示运行时/时间上下文的刷新大小;审批行显示工具和等待/允许/拒绝状态;裁剪行显示被裁剪的 token 数。这些行不计入轮次与合计的步骤求和,步骤列仍只表示步骤。
|
|
70
|
+
|
|
71
|
+
轮次的缓存命中率按报了 usage 的各步做 token 加权(缓存读之和 ÷ 提示词 token 之和),不会因为相邻步命中高就把某一次冷启动盖掉;tooltip 展示汇总后的读/输入/写明细。步骤行仍显示该步自己的实测比例。
|
|
72
|
+
|
|
73
|
+
会话窗口是有界的:某一步的 `step/start` 不在已加载窗口里时,与起点有关的列显示 `—` 并标「起止未知」,不估算数值。滚到顶部会向 Session 请求更早的一页;视图按新增内容的高度补偿滚动位置,正在读的行不会跳走。
|
|
74
|
+
|
|
75
|
+
</details>
|
|
76
|
+
|
|
77
|
+
-----
|
|
78
|
+
|
|
79
|
+
<a id="further-exploration"></a>
|
|
80
|
+
## 进一步探索
|
|
81
|
+
|
|
82
|
+
- [`@deepseek-ai/dsh-client-ui-trajectory`](../../client/ui-trajectory/README.zh.md) —— 本页签的表格约定参考它。
|
|
83
|
+
- [`@deepseek-ai/dsh-session-stats`](../../session/session-stats/README.zh.md) —— 列名口径与会话统计一致。
|
|
84
|
+
- [`docs/subsystems/conversation.md`](../../../docs/subsystems/conversation.zh.md) —— 视图目标与 Definition 的装配方式。
|
|
85
|
+
|
|
86
|
+
-----
|
|
87
|
+
|
|
88
|
+
<a id="model-experience"></a>
|
|
89
|
+
## 模型体验
|
|
90
|
+
|
|
91
|
+
无直接影响,因为页签只读会话事件并在浏览器里渲染,不注册工具、提示词段落或模型输入。
|
|
92
|
+
|
|
93
|
+
#### KV Cache 影响
|
|
94
|
+
|
|
95
|
+
没有影响。本包不构造模型请求,也不修改提示词。
|
|
96
|
+
|
|
97
|
+
## 已知限制与延期工作
|
|
98
|
+
|
|
99
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
100
|
+
|
|
101
|
+
- **默认产品不挂载。** Web 包按规则拒绝引用 experimental 包;可选的「开发者工具」组合包(`@deepseek-ai/dsh-experimental-inspector-profile`)会挂载本视图,也可以由 profile 显式添加。
|
|
102
|
+
- **窗口被截断时没有起始时刻。** 已加载窗口从半步中间开始时,首 token、模型用时和总用时都推导不出来;行上标「起止未知」,不估算。
|
|
103
|
+
- **Code-Mode 内层调用按根调用上下文并回步骤。** 内层调用不带 turn/step,因此每个根调用各自开一个以 root call id 为键的上下文,由 builder 把它的派发并回持有 runner 的那一步。窗口里丢了派发起点时仍会合并调用,但无法给出它们各自的实测耗时。
|
|
104
|
+
- **更早历史的加载结果显式区分重试。** 页面请求只返回 `grew`、`exhausted` 或 `retry`;如果 Chat 或轨迹视图正在加载同一个 Session 的页,统计视图会保留加载按钮,而不是误报历史已耗尽或抛出错误。
|
|
105
|
+
- **已知限制:没有整段墙钟 projection。** 合计行的总用时用模型用时 + 工具用时替代,因为宿主 projection 没有整段墙钟;工具段是逐调用求和,并行调用会让这段显得比非重叠墙钟更长。这里作为已知限制记录,插件不为此改动宿主逻辑。
|
|
106
|
+
- **本实验 PR 的 recorded-session 覆盖已获豁免。** 包测试覆盖折叠、聚合、格式化、分页与 jsdom 表格;`apps/web/tests/client-ui-stats-panel.e2e.ts` 通过仅测试用的 overlay 挂载 shipped Web 表面并比较已提交的 ARIA golden。经 owner 决定,本实验 PR 不新增 keyless recorded-session 场景;后续 profile 或 bundle 转正时必须补充。
|
|
107
|
+
- **迟到重投不是轮次。** 压缩可能把被裁剪的工具结果按原来的轮次/步骤在之后重新投递;窗口里既没有加载到的起点、也没有问题或结束标记的轮次会被丢弃,不再显示成空的幽灵行。
|
|
108
|
+
- **计时是推导值。** 总用时取最后一步结束减第一步开始;排队和调度等待落在「其余」段里。总用时条把工具调用画成配对区间之并,并行调用只算一次;工具列仍显示逐次求和。轮次时间条以当前屏幕内可见的轮次为刻度,滚出屏幕的超大轮次不会把本屏的行压扁。
|
|
109
|
+
- **提问图片走共用图片缓存。** 标签与预览用 `uiConversation.imageUrl` 解析持久附件,浏览器 URL 由缓存按 Session binding 持有并释放,视图不自己创建 URL。读取失败时显示本地化失败状态并可重试。触屏不打开悬停预览,点击标签会直接加载第一张图。
|
|
110
|
+
|
|
111
|
+
<a id="dev-note"></a>
|
|
112
|
+
### 开发备注
|
|
113
|
+
|
|
114
|
+
<details>
|
|
115
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
116
|
+
|
|
117
|
+
本页签从一份独立的客户端插件移植而来。列名口径参照 `@deepseek-ai/dsh-session-stats`(模型用时、工具用时、首 token、输出速度),版式参照轨迹表格,让两个页签读起来一致。
|
|
118
|
+
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
**运行时不变式:** 不发布伴生入口。全部状态都从会话事件窗口推导,独立观察只会重复注册与折叠逻辑,而不会断言另一种关系。
|