dsh-recent-usage-metrics 0.3.5 → 0.3.7

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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 0.3.7
2
+
3
+ - `#` 表头的提示拆成三行:最近记录、三个状态图标、两种行颜色。原来挤成一句,
4
+ 三件事连在一起读起来费劲。
5
+ - 实时行不再显示总用时的工具提示。还在跑的请求尚未结算工具时间,提示只能给出
6
+ 「无工具调用」或一个不完整的数,对一个仍在进行的请求都是错的;行结算后再出现。
7
+
8
+ ## 0.3.6
9
+
10
+ - `#` 表头的提示加了一行颜色说明:黄色表示缓存命中过低,蓝色表示这一步切换了模型。
11
+ 颜色用色块画出来而不是写成文字,读者按颜色对号即可,不必在脑内翻译一个词。
12
+ 色块与行高亮取同一组主题令牌,两者不会各自漂移。
13
+
1
14
  ## 0.3.5
2
15
 
3
16
  - 修复:模型切换或缓存偏低时,高亮只染了数字列,时间与速度列仍是灰色——那三列各自设置了
package/README.en.md CHANGED
@@ -153,7 +153,7 @@ Every drawer column and every header carries a hint:
153
153
  | Speed column | the model that served that row |
154
154
  | Tokens column | input tokens (with thousands separators, e.g. `370,683 tok`) and cache hit rate |
155
155
  | Time column | how much of the request was tool time, both summed and parallel-merged |
156
- | Headers | what the column measures (the `#` header draws the four state glyphs) |
156
+ | Headers | what the column measures (the `#` header draws the four state glyphs and swatches for the two row colours) |
157
157
 
158
158
  **Row highlights:**
159
159
 
package/README.md CHANGED
@@ -137,7 +137,7 @@ DSH 的极客级请求指标。它在 **设置 → 通用 → 性能与用量**
137
137
  | 速度列 | 该行使用的模型 |
138
138
  | 输出 Token 列 | 输入 token(带千分位,如 `370,683 tok`)与缓存命中率 |
139
139
  | 总用时列 | 工具调用的用时(串行累加与并行合并两个口径);无工具时说明没有调用 |
140
- | 表头 | 该列的含义(`#` 一列用图标展示四种状态) |
140
+ | 表头 | 该列的含义(`#` 一列用图标展示四种状态,并用色块说明两种行高亮的颜色) |
141
141
 
142
142
  **行高亮:**
143
143
 
package/client/client.js CHANGED
@@ -114,7 +114,14 @@ window.__ModuleLoader__.load({
114
114
  hoursAgo: '{count} 小时前',
115
115
  // Column-header hints. `{bolt}` / `{tools}` / `{compact}` are replaced by the glyphs
116
116
  // themselves, which is why these are rendered by the tooltip component and not by title.
117
- hintIndex: '行号:1–10 为已完成的最近记录,{bolt} 为模型输出中,{tools} 为工具调用中,{compact} 为压缩上下文中',
117
+ /*
118
+ * The index hint is three lines: what the column holds, what the glyphs mean, then what
119
+ * the row colours mean. Splitting them keeps each line short enough to read at a glance
120
+ * instead of being one long sentence the eye has to parse.
121
+ */
122
+ hintIndexRows: '行号:1–10 为已完成的最近记录',
123
+ hintIndexGlyphs: '{bolt} 为模型输出中,{tools} 为工具调用中,{compact} 为压缩上下文中',
124
+ hintColour: '整行黄色表示缓存命中过低,蓝色表示这一步切换了模型',
118
125
  hintTime: '请求发出的时刻(本地时间)',
119
126
  hintTtft: '从发出到收到第一个 token 的耗时',
120
127
  hintSpeed: '模型生成速度 = 输出 token ÷ 解码时长',
@@ -176,7 +183,9 @@ window.__ModuleLoader__.load({
176
183
  secondsAgo: '{count}s ago',
177
184
  minutesAgo: '{count}m ago',
178
185
  hoursAgo: '{count}h ago',
179
- hintIndex: 'Row number: 1–10 are the most recent finished records; {bolt} is a model reply, {tools} is a tool call, {compact} is a context compaction',
186
+ hintIndexRows: 'Row number: 1–10 are the most recent finished records',
187
+ hintIndexGlyphs: '{bolt} is a model reply, {tools} is a tool call, {compact} is a context compaction',
188
+ hintColour: 'A yellow row means a low cache hit; a blue row means this step switched models',
180
189
  hintTime: 'When the request was issued (local time)',
181
190
  hintTtft: 'Time from issuing the request to receiving its first token',
182
191
  hintSpeed: 'Generation speed = output tokens ÷ decode time',
@@ -639,6 +648,39 @@ window.__ModuleLoader__.load({
639
648
  .dsh-rum-tip .dsh-rum-tip-icon {
640
649
  color: var(--dsw-alias-brand-primary);
641
650
  }
651
+ /*
652
+ * The index hint is two lines: what the glyphs mean, then what the row colours mean.
653
+ *
654
+ * The colour line leads with two swatches instead of naming the hues, so a reader matches a
655
+ * row against the legend by colour rather than by translating a word. The swatches take the
656
+ * same tokens the rows take, so the two can never disagreement.
657
+ */
658
+ .dsh-rum-tip-body {
659
+ display: block;
660
+ }
661
+ .dsh-rum-tip-line {
662
+ display: block;
663
+ }
664
+ .dsh-rum-tip-line + .dsh-rum-tip-line {
665
+ margin-top: 5px;
666
+ }
667
+ .dsh-rum-tip-swatch {
668
+ display: inline-block;
669
+ width: 8px;
670
+ height: 8px;
671
+ border-radius: 2px;
672
+ margin-right: 3px;
673
+ vertical-align: 0;
674
+ }
675
+ .dsh-rum-tip-swatch + .dsh-rum-tip-swatch {
676
+ margin-left: 6px;
677
+ }
678
+ .dsh-rum-tip-swatch[data-hue="lowcache"] {
679
+ background: var(--dsw-alias-state-warn-primary, var(--dsw-alias-state-warn-label));
680
+ }
681
+ .dsh-rum-tip-swatch[data-hue="switched"] {
682
+ background: var(--dsw-alias-state-business-primary, var(--dsw-alias-brand-primary));
683
+ }
642
684
  .dsh-rum-empty {
643
685
  flex: 1 1 auto;
644
686
  padding: 14px 6px 16px;
@@ -1924,21 +1966,41 @@ window.__ModuleLoader__.load({
1924
1966
  function indexHint(t) {
1925
1967
  const glyph = (Icon) => h(Icon, { className: 'dsh-rum-tip-icon' })
1926
1968
  /*
1927
- * Split on every placeholder first, then walk the pieces: a string piece is literal text,
1928
- * a placeholder becomes its glyph. Walking once over a token list is simpler to follow
1929
- * than nesting one split per placeholder.
1969
+ * Turn one sentence into elements, replacing each glyph placeholder with the glyph itself.
1970
+ * A single pass over a token list is simpler to follow than nesting one split per
1971
+ * placeholder, and it keeps the placeholders in whatever order a translation uses.
1930
1972
  */
1931
- const tokens = t('hintIndex').split(/(\{bolt\}|\{tools\}|\{compact\})/)
1932
- const nodes = []
1933
- for (let i = 0; i < tokens.length; i += 1) {
1934
- const token = tokens[i]
1935
- if (token === '') continue
1936
- if (token === '{bolt}') nodes.push(glyph(BoltIcon))
1937
- else if (token === '{tools}') nodes.push(glyph(ToolIcon))
1938
- else if (token === '{compact}') nodes.push(glyph(CompactionIcon))
1939
- else nodes.push(token)
1973
+ const withGlyphs = (text) => {
1974
+ const tokens = text.split(/(\{bolt\}|\{tools\}|\{compact\})/)
1975
+ const nodes = []
1976
+ for (const token of tokens) {
1977
+ if (token === '') continue
1978
+ if (token === '{bolt}') nodes.push(glyph(BoltIcon))
1979
+ else if (token === '{tools}') nodes.push(glyph(ToolIcon))
1980
+ else if (token === '{compact}') nodes.push(glyph(CompactionIcon))
1981
+ else nodes.push(token)
1982
+ }
1983
+ return nodes
1940
1984
  }
1941
- return h('span', null, ...nodes)
1985
+ /*
1986
+ * Three lines: what the column holds, what the glyphs mean, then what the row colours mean.
1987
+ * The colour line leads with two swatches instead of naming the hues, so a reader matches a
1988
+ * row against the legend by colour rather than by translating a word. The swatches take the
1989
+ * same tokens the rows take, so the two cannot drift apart.
1990
+ */
1991
+ return h(
1992
+ 'span',
1993
+ { className: 'dsh-rum-tip-body' },
1994
+ h('span', { className: 'dsh-rum-tip-line' }, t('hintIndexRows')),
1995
+ h('span', { className: 'dsh-rum-tip-line' }, ...withGlyphs(t('hintIndexGlyphs'))),
1996
+ h(
1997
+ 'span',
1998
+ { className: 'dsh-rum-tip-line' },
1999
+ h('span', { className: 'dsh-rum-tip-swatch', 'data-hue': 'lowcache' }),
2000
+ h('span', { className: 'dsh-rum-tip-swatch', 'data-hue': 'switched' }),
2001
+ t('hintColour'),
2002
+ ),
2003
+ )
1942
2004
  }
1943
2005
 
1944
2006
  /**
@@ -3859,15 +3921,17 @@ window.__ModuleLoader__.load({
3859
3921
  : speedText(live.speed, live.estimated === true, t),
3860
3922
  ),
3861
3923
  h('span', { className: 'dsh-rum-col', role: 'cell' }, tokensText(live.tokens, live.estimated === true, t)),
3924
+ /*
3925
+ * No hint on the live row's total.
3926
+ *
3927
+ * A running request has not reported its tool time yet, so the only
3928
+ * possible readings are "no tools" or a partial count — both would be
3929
+ * wrong about a request that is still going. The hint appears when the
3930
+ * row settles and the fold has the real figures.
3931
+ */
3862
3932
  h(
3863
3933
  'span',
3864
- {
3865
- className: 'dsh-rum-col',
3866
- role: 'cell',
3867
- /* Same hint as the numbered rows, so the meaning never changes. */
3868
- onMouseEnter: (event) => hint.show(toolHintText(live, t), event),
3869
- onMouseLeave: hint.hide,
3870
- },
3934
+ { className: 'dsh-rum-col', role: 'cell' },
3871
3935
  secondsText(
3872
3936
  live.compaction !== null && live.compaction !== undefined
3873
3937
  ? compactionSpan(live.compaction, now)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-recent-usage-metrics",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Geek level for the Performance & usage setting: a live reading of the newest request (first-token latency, speed, tokens, total, amortised) plus a drawer listing the last ten, all derived from the shipped Statistics view data",
5
5
  "repository": {
6
6
  "type": "git",