dsh-session-title-stamp 0.7.0 → 0.7.1

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/README.md CHANGED
@@ -17,12 +17,15 @@ title. Beyond automatic naming:
17
17
  - **Settings page** — preview and change format, emoji, and refresh cadence without editing YAML.
18
18
  - **Optional category emoji** — `categoryEmoji: true` renders titles such as
19
19
  `1027 | ⚡ 优化 | ...`.
20
- - **Hover stats** — elapsed time, estimated CNY cost, and token count on the
21
- session hover card.
20
+ - **Hover stats** — see duration, estimated CNY cost, and token count at a glance,
21
+ without opening a dashboard.
22
22
  - **Category language** — `categoryPreset: zh | en`, or your own `categories`.
23
23
  - **Failure-safe** — a failed retitle keeps the current title.
24
24
  - **Zero build** — pure Host logic plus a small hand-written browser half.
25
25
 
26
+ > **The title tells you what the session was about; the hover card tells you what it cost.**
27
+ > Duration, estimated CNY, and tokens are one hover away — no dashboard.
28
+
26
29
  Default format:
27
30
 
28
31
  ```text
@@ -64,7 +67,7 @@ and mirrors conventions used by other coding agents.
64
67
  Add this market index source in **Plugins → Discover → Index sources**:
65
68
 
66
69
  ```text
67
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.7.0/market/index.json
70
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.7.1/market/index.json
68
71
  ```
69
72
 
70
73
  Then install **Session title stamp** from the list. The plugin installs as a
@@ -138,6 +141,9 @@ mode using `retitleEvery`.
138
141
 
139
142
  - a **refresh icon** in the conversation header; it runs the same `/retitle`
140
143
  command as typing it, and is disabled while the session is running.
144
+
145
+ ![Session hover card](docs/0.7.0-hover-card-mock.png)
146
+
141
147
  - a **hover-card line** under the native relative time, for example
142
148
  `Duration 1h 51m · est. ≈¥4.11 · 131.7M tokens`;
143
149
  - a **Generate title** item at the top of the session row's `···` menu, plus a
@@ -150,6 +156,19 @@ never loaded is not resumed just to show the numbers. Native DSH already shows
150
156
  running / pending / completed-unread status (spinner, warning dot, idle line),
151
157
  so this plugin does **not** add a second status-color layer.
152
158
 
159
+ #### Hover-card field guide
160
+
161
+ | Field | Meaning |
162
+ |---|---|
163
+ | `Duration 1h 51m` | Cumulative model + tool execution time from `sessionStats`; not wall-clock elapsed time |
164
+ | `est. ≈¥4.11` | `tokenUsage` × the current DeepSeek CNY rate table; a rough estimate, not an invoice |
165
+ | `131.7M tokens` | Input, output, cache-read and cache-write tokens combined |
166
+ | `Idle` / scheduled-task line | Native DSH status content; this plugin does not add or replace it |
167
+
168
+ Mixed-model sessions are estimated with the session's last-used model, so the
169
+ cost can differ from the actual bill. The line is intentionally omitted when the
170
+ host has no stats for that session.
171
+
153
172
  If the hover line is missing, the browser half could not reach the host stats
154
173
  route; the refresh button and automatic titles are unaffected.
155
174
 
package/README.zh.md CHANGED
@@ -9,11 +9,14 @@
9
9
  - **复制标题**:会话行 `···` 菜单多一项复制完整标题。
10
10
  - **设置页**:可视化调整格式、emoji 和重算节奏,带实时预览,不用改 YAML。
11
11
  - **可选 emoji 分类**:`categoryEmoji: true` 后标题形如 `1027 | ⚡ 优化 | ...`。
12
- - **悬停统计**:会话行悬停显示耗时、估算 CNY 成本、token 数。
12
+ - **悬停统计**:不打开面板,一眼看到耗时、估算 CNY 成本、token 数。
13
13
  - **分类语言**:`categoryPreset: zh | en`,也可以用 `categories` 自定义。
14
14
  - **失败保护**:重算失败保留当前标题,不被兜底标题覆盖。
15
15
  - **零构建**:纯 Host 逻辑 + 小型手写浏览器半边。
16
16
 
17
+ > **标题告诉你这个会话在做什么,悬停卡片告诉你它花了多少。**
18
+ > 耗时、估算 CNY 成本和 token 数,悬停即见,不需要打开面板。
19
+
17
20
  默认格式:
18
21
 
19
22
  ```text
@@ -47,7 +50,7 @@
47
50
  在 **插件 → 发现(Discover)→ 索引源** 添加:
48
51
 
49
52
  ```text
50
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.7.0/market/index.json
53
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.7.1/market/index.json
51
54
  ```
52
55
 
53
56
  然后在列表里安装 **Session title stamp / 会话标题印章**。插件以 profile bundle 的形式安装,之后可在插件页启停。
@@ -100,6 +103,9 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
100
103
  0.7.0 增加了一个很小的浏览器半边:
101
104
 
102
105
  - 会话头有一个**刷新图标**,效果等同输入 `/retitle`,会话运行中禁用;
106
+
107
+ ![悬停卡片统计](docs/0.7.0-hover-card-mock.png)
108
+
103
109
  - 鼠标悬停会话行时,在原生相对时间下面多一行:
104
110
  `耗时 1h 51m · 估算 ≈¥4.11 · 131.7M tokens`;
105
111
  - 会话行 `···` 菜单最上面多一项「自动生成标题」,下面多一项「复制标题」;
@@ -107,6 +113,17 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
107
113
 
108
114
  数字来自 `sessionStats` / `tokenUsage` 投影,按 DeepSeek 当前 CNY 价格估算,并标注「估算」。只在悬停时向宿主请求,不会为了显示数字去恢复未加载的会话。DSH 原生已经有运行中/待交互/完成未读的状态点与 loader,所以本插件**不再加一层状态颜色**。
109
115
 
116
+ #### 悬停卡片字段说明
117
+
118
+ | 字段 | 含义 |
119
+ |---|---|
120
+ | `耗时 1h 51m` | 来自 `sessionStats` 的模型 + 工具累计执行时间,不是墙钟耗时 |
121
+ | `估算 ≈¥4.11` | `tokenUsage` × DeepSeek 当前 CNY 价格表,是粗略估算,不是账单 |
122
+ | `131.7M tokens` | 输入、输出、缓存读、缓存写的 token 合计 |
123
+ | `空闲` / 定时任务行 | DSH 原生状态内容,本插件不添加或替换 |
124
+
125
+ 混合模型的会话按“最近使用的模型”估算,成本可能和实际账单不同。宿主没有该会话统计时,这一行会刻意不显示。
126
+
110
127
  如果悬停行不显示,说明浏览器半边没连上宿主统计路由;刷新按钮和自动标题不受影响。
111
128
 
112
129
  ### 设置页
package/client.js CHANGED
@@ -359,6 +359,9 @@ window.__ModuleLoader__.load({
359
359
  previewTitle: { fontSize: '15px', lineHeight: '23px', color: 'var(--dsw-alias-label-primary, #fff)', fontWeight: 500, wordBreak: 'break-word' },
360
360
  section: { marginTop: '18px' },
361
361
  sectionTitle: { display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px', color: 'var(--dsw-alias-label-caption, #737985)', letterSpacing: '.06em', textTransform: 'uppercase', margin: '0 0 2px' },
362
+ badge: { fontSize: '10px', lineHeight: '16px', fontWeight: 400, color: 'var(--dsw-alias-state-success-primary, #65d39a)', border: '.5px solid var(--dsw-alias-state-success-primary, #65d39a)', borderRadius: '99px', padding: '1px 7px', letterSpacing: 0, textTransform: 'none' },
363
+ previewRow: { display: 'flex', alignItems: 'flex-end', justifyContent: 'space-between', gap: '16px' },
364
+ previewGhost: { fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-caption, #737985)', whiteSpace: 'nowrap' },
362
365
  row: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '24px', padding: '15px 0', borderBottom: '.5px solid var(--dsw-alias-border-l2, #2b2e35)' },
363
366
  rowColumn: { display: 'flex', flexDirection: 'column', alignItems: 'stretch', gap: '10px', padding: '15px 0', borderBottom: '.5px solid var(--dsw-alias-border-l2, #2b2e35)' },
364
367
  text: { minWidth: 0 },
@@ -390,7 +393,7 @@ window.__ModuleLoader__.load({
390
393
  const type = emoji ? `⚡ ${base}` : base
391
394
  const topic = preset === 'en' ? 'Reduce renderer memory usage' : '降低渲染器内存占用'
392
395
  const date = dateFormat === 'YYMM' ? '2610' : dateFormat === 'YYYYMMDD' ? '20261027' : '1027'
393
- const values = { date, type, topic, YYYY: '2026', YY: '26', MM: '10', DD: '27', HH: '12', mm: '30', ss: '00' }
396
+ const values = { date, type, topic, MMDD: '1027', YYMM: '2610', YYYYMMDD: '20261027', HHmm: '1230', YYYY: '2026', YY: '26', MM: '10', DD: '27', HH: '12', mm: '30', ss: '00' }
394
397
  return (template || DEFAULT_TEMPLATE).replace(/\{([A-Za-z]+)\}/g, (match, key) => values[key] ?? match)
395
398
  }
396
399
 
@@ -488,11 +491,12 @@ window.__ModuleLoader__.load({
488
491
  h('span', { style: SETTINGS_STYLE.thumb(checked) }),
489
492
  )
490
493
 
491
- const number = (value, onChange, min, max) =>
494
+ const number = (value, onChange, min, max, unit) =>
492
495
  h(
493
496
  'div',
494
497
  { style: SETTINGS_STYLE.num },
495
498
  h('input', { type: 'number', min, max, value, disabled: !writable || busy, onChange: (event) => onChange(event.target.value), style: { ...SETTINGS_STYLE.input, ...SETTINGS_STYLE.number } }),
499
+ unit === undefined ? null : h('span', { style: SETTINGS_STYLE.unit }, unit),
496
500
  )
497
501
 
498
502
  const save = async () => {
@@ -552,7 +556,14 @@ window.__ModuleLoader__.load({
552
556
  'div',
553
557
  { style: SETTINGS_STYLE.preview },
554
558
  h('div', { style: SETTINGS_STYLE.previewLabel }, readText('preview')),
555
- h('div', { style: SETTINGS_STYLE.previewTitle }, preview),
559
+ h(
560
+ 'div',
561
+ { style: SETTINGS_STYLE.previewRow },
562
+ h('div', { style: SETTINGS_STYLE.previewTitle }, preview),
563
+ categoryEmoji
564
+ ? null
565
+ : h('span', { style: SETTINGS_STYLE.previewGhost }, `${readText('previewHint')}:⚡ ${categoryPreset === 'en' ? 'Optimize' : '优化'}`),
566
+ ),
556
567
  ),
557
568
  h('div', { style: SETTINGS_STYLE.sectionTitle }, readText('format')),
558
569
  row('preset', readText('categoryLanguage'), readText('categoryLanguageHint'),
@@ -562,10 +573,10 @@ window.__ModuleLoader__.load({
562
573
  segment([{ value: 'MMDD', label: 'MMDD' }, { value: 'YYMM', label: 'YYMM' }, { value: 'YYYYMMDD', label: 'YYYYMMDD' }], dateFormat, setDateFormat)),
563
574
  row('template', readText('template'), readText('templateHint'),
564
575
  h('input', { value: template, disabled: !writable || busy, onChange: (event) => setTemplate(event.target.value), spellCheck: false, style: { ...SETTINGS_STYLE.input, ...SETTINGS_STYLE.fullInput } }), true),
565
- h('div', { style: SETTINGS_STYLE.sectionTitle }, readText('auto')),
576
+ h('div', { style: SETTINGS_STYLE.sectionTitle }, readText('auto'), h('span', { style: SETTINGS_STYLE.badge }, readText('autoBadge'))),
566
577
  row('auto', readText('autoRefresh'), readText('autoRefreshHint'), toggle(autoRefresh, setAutoRefresh, readText('autoRefresh'))),
567
- row('minutes', readText('minInterval'), readText('minIntervalHint'), number(minutes, setMinutes, 0, 60)),
568
- row('freeze', readText('freeze'), readText('freezeHint'), number(freeze, setFreeze, 0, 100000)),
578
+ row('minutes', readText('minInterval'), readText('minIntervalHint'), number(minutes, setMinutes, 0, 60, readText('minutes'))),
579
+ row('freeze', readText('freeze'), readText('freezeHint'), number(freeze, setFreeze, 0, 100000, readText('messages'))),
569
580
  row('backfill', readText('backfill'), readText('backfillHint'), toggle(backfill, setBackfill, readText('backfill'))),
570
581
  h(
571
582
  'button',
@@ -575,8 +586,8 @@ window.__ModuleLoader__.load({
575
586
  ),
576
587
  advancedOpen
577
588
  ? h('div', null,
578
- row('nameChars', readText('nameLimit'), readText('nameLimitHint'), number(nameChars, setNameChars, 4, 40)),
579
- row('recent', readText('recentMessages'), readText('recentMessagesHint'), number(recentMessages, setRecentMessages, 2, 20)),
589
+ row('nameChars', readText('nameLimit'), readText('nameLimitHint'), number(nameChars, setNameChars, 4, 40, readText('chars'))),
590
+ row('recent', readText('recentMessages'), readText('recentMessagesHint'), number(recentMessages, setRecentMessages, 2, 20, readText('messages'))),
580
591
  h('div', { style: { ...SETTINGS_STYLE.desc, marginTop: '8px' } }, readText('advancedHint')),
581
592
  )
582
593
  : null,
Binary file
package/market/index.json CHANGED
@@ -34,8 +34,8 @@
34
34
  "zh": "会话标题印章"
35
35
  },
36
36
  "description": {
37
- "en": "Keeps DSH session titles in DATE | CATEGORY | NAME with turn-aware auto-retitle, a settings page, manual generation, and hover cost/duration.",
38
- "zh": "把 DSH 会话标题固定为「日期 | 分类 | 名称」,支持回答后自动重算、设置页、手动生成和悬停成本/耗时。"
37
+ "en": "Keeps DSH session titles in DATE | CATEGORY | NAME with turn-aware auto-retitle, a settings page, and hover duration/cost/token stats.",
38
+ "zh": "把 DSH 会话标题固定为「日期 | 分类 | 名称」,支持自动重算、设置页,以及悬停查看耗时/估算成本/token。"
39
39
  },
40
40
  "author": "xuedipiaofei",
41
41
  "icon": "../icon.svg",
@@ -57,12 +57,12 @@
57
57
  },
58
58
  "versions": [
59
59
  {
60
- "version": "0.7.0",
61
- "publishTimestamp": 1793721856,
60
+ "version": "0.7.1",
61
+ "publishTimestamp": 1793723566,
62
62
  "source": {
63
63
  "type": "git",
64
64
  "url": "https://github.com/xuedipiaofei/dsh-session-title-stamp",
65
- "commit": "e46d3544174626f922a2c1749bb300db93d01d04"
65
+ "commit": "a8b0c59662e0fe464f5bc5bf11ca2155a7fbe0e1"
66
66
  },
67
67
  "engines": {
68
68
  "dsh": ">=0.2.1-rc.3 <0.3.0"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-session-title-stamp",
3
- "version": "0.7.0",
4
- "description": "DSH session titles in a DATE | CATEGORY | NAME template, with turn-aware auto-generation, a settings page, a Generate title button, and hover cost/duration.",
3
+ "version": "0.7.1",
4
+ "description": "DSH session titles in a DATE | CATEGORY | NAME template, with turn-aware auto-generation, a settings page, and hover duration/cost/token stats.",
5
5
  "keywords": [
6
6
  "dsh",
7
7
  "dsh-plugin",
@@ -35,7 +35,8 @@
35
35
  "icon.svg",
36
36
  "README.md",
37
37
  "README.zh.md",
38
- "docs/0.7.0-settings-mock.png"
38
+ "docs/0.7.0-settings-mock.png",
39
+ "docs/0.7.0-hover-card-mock.png"
39
40
  ],
40
41
  "engines": {
41
42
  "dsh": ">=0.2.1-rc.3 <0.3.0"