dsh-session-title-stamp 0.8.2 → 0.9.0

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
@@ -9,9 +9,9 @@ English | [中文](./README.zh.md)
9
9
  A DeepSeek Harness title provider for a configurable `DATE | CATEGORY | NAME`
10
10
  title. Beyond automatic naming:
11
11
 
12
- - **Generate title on demand** — the conversation-header ↻ button, the session
13
- row's **Generate title** menu item, or `/retitle`. One click renames the
14
- session in place, no dialog.
12
+ - **Generate title on demand** — the conversation-header ↻ button, the first
13
+ row of the session menu (**Generate title**), or `/retitle`. One click
14
+ renames the session in place, no dialog.
15
15
  - **Auto refresh** — after a completed turn, with a 2-minute cooldown and a
16
16
  100-message freeze; forks and user-pinned titles are skipped.
17
17
  - **Copy title** — an extra item in the session `···` menu copies the full title.
@@ -54,9 +54,11 @@ the English labels above.
54
54
 
55
55
  ## Screenshots
56
56
 
57
- | Titles and Generate title | Settings | Hover stats |
58
- |---|---|---|
59
- | <img src="docs/screenshots/01-session-list.png" width="320" alt="Session list with the Generate title menu open"> | <img src="docs/screenshots/02-settings.png" width="320" alt="Session title settings page"> | <img src="docs/screenshots/03-hover-stats.png" width="320" alt="Hover card with duration, estimated cost and tokens"> |
57
+ | One-click Generate title | Generate title in the session menu |
58
+ |:---:|:---:|
59
+ | <img src="docs/screenshots/00-generate-title.png" width="360" alt="Conversation header with the Generate title refresh button"> | <img src="docs/screenshots/01-session-list.png" width="360" alt="Session list with the Generate title menu open"> |
60
+ | **Hover stats** | **Settings page** |
61
+ | <img src="docs/screenshots/03-hover-stats.png" width="360" alt="Hover card with duration, estimated cost and tokens"> | <img src="docs/screenshots/02-settings.png" width="360" alt="Session title settings page"> |
60
62
 
61
63
  ## Why
62
64
 
@@ -78,7 +80,7 @@ and mirrors conventions used by other coding agents.
78
80
  Add this market index source in **Plugins → Discover → Index sources**:
79
81
 
80
82
  ```text
81
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.2/market/index.json
83
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.9.0/market/index.json
82
84
  ```
83
85
 
84
86
  Then install **Session title stamp** from the list. The plugin installs as a
@@ -299,6 +301,9 @@ labels and the local fallback maps common keywords onto them.
299
301
  - The browser half needs the Web composition's `sidebar.session.row.hover` and
300
302
  `conversation.session.header.actions` seats. A shell that does not expose them
301
303
  simply shows no button/hover line.
304
+ - On DSH 0.2.2+ the session menu action is a data contribution and sorts above
305
+ **Pin**; on 0.2.1, which has no context-menu service, the same action renders
306
+ through the legacy Slot just above **Archive**.
302
307
  - The provider imports `@deepseek-ai/dsh-session-title-llm` dynamically. A
303
308
  missing or incompatible executor degrades to local naming, but a changed
304
309
  `ctx.sessionTitle` API can prevent registration. Pin the DSH range when
package/README.zh.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  给 DSH 会话一个稳定的「日期 | 分类 | 名称」标题。除了自动命名,还包括:
6
6
 
7
- - **一键重新生成**:会话头 ↻ 按钮、会话行 `···` 菜单「自动生成标题」,或 `/retitle`;点一下就地改名,不弹窗。
7
+ - **一键重新生成**:会话头 ↻ 按钮、会话菜单第一项「自动生成标题」,或 `/retitle`;点一下就地改名,不弹窗。
8
8
  - **自动重算**:回答完成后更新,2 分钟冷却,超过 100 条消息后冻结;fork、子代理和手动固定的标题跳过。
9
9
  - **复制标题**:会话行 `···` 菜单多一项复制完整标题。
10
10
  - **设置页**:可视化调整格式、emoji、标题语言和重算节奏,带实时预览,不用改 YAML。
@@ -39,9 +39,11 @@
39
39
 
40
40
  ## 截图
41
41
 
42
- | 标题与重新生成 | 设置页 | 悬停统计 |
43
- |---|---|---|
44
- | <img src="docs/screenshots/01-session-list.png" width="320" alt="侧栏里的日期、分类、名称标题,以及「自动生成标题」菜单"> | <img src="docs/screenshots/02-settings.png" width="320" alt="会话标题设置页"> | <img src="docs/screenshots/03-hover-stats.png" width="320" alt="悬停卡片显示耗时、估算成本和 token"> |
42
+ | 会话头一键重新生成 | 会话菜单「自动生成标题」 |
43
+ |:---:|:---:|
44
+ | <img src="docs/screenshots/00-generate-title.png" width="360" alt="会话头里的「重新生成标题」刷新按钮"> | <img src="docs/screenshots/01-session-list.png" width="360" alt="侧栏会话行的「自动生成标题」菜单"> |
45
+ | **悬停统计** | **设置页** |
46
+ | <img src="docs/screenshots/03-hover-stats.png" width="360" alt="悬停卡片显示耗时、估算成本和 token"> | <img src="docs/screenshots/02-settings.png" width="360" alt="会话标题设置页"> |
45
47
 
46
48
  ## 为什么
47
49
 
@@ -59,7 +61,7 @@
59
61
  在 **插件 → 发现(Discover)→ 索引源** 添加:
60
62
 
61
63
  ```text
62
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.2/market/index.json
64
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.9.0/market/index.json
63
65
  ```
64
66
 
65
67
  然后在列表里安装 **Session title stamp / 会话标题印章**。插件以 profile bundle 的形式安装,之后可在插件页启停。
@@ -224,6 +226,7 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
224
226
  - bundle 依赖内置行 id `session-title-llm`。如果已有其它标题 provider 先注册,本插件会打 warn 并保持 inactive;先停用另一个再重载。
225
227
  - `llm`、`commands`、`sessions`、`sessionProjections`、`connection` 都采用延迟注入;缺少哪个只损失对应能力,不影响插件加载。
226
228
  - 浏览器半边依赖 Web 组合的 `sidebar.session.row.hover` 和 `conversation.session.header.actions` 座位;没有这两个座位的 shell 不会显示按钮/悬停行。
229
+ - 在 DSH 0.2.2+「自动生成标题」是会话菜单的第一项(在「置顶会话」之上);0.2.1 没有 context-menu 服务,同一动作走旧 Slot,排在「归档会话」之前。
227
230
  - 插件动态 import `@deepseek-ai/dsh-session-title-llm`。执行器缺失或不兼容时会降级为本地命名;如果 `ctx.sessionTitle` API 本身变化,则可能无法注册。
228
231
 
229
232
  ## 开发
package/client.js CHANGED
@@ -675,6 +675,50 @@ window.__ModuleLoader__.load({
675
675
  ctx.effect?.(() => () => style.remove())
676
676
  }
677
677
 
678
+ const SESSION_MENU_ICON_KEY = 'session-title-stamp.retitle'
679
+
680
+ /** The context-menu service exists from DSH 0.2.2 on; older hosts keep the legacy Slot row. */
681
+ function sessionMenuService(ctx) {
682
+ try {
683
+ return typeof ctx.get === 'function' ? ctx.get('contextMenus') : undefined
684
+ } catch {
685
+ return undefined
686
+ }
687
+ }
688
+
689
+ function registerSessionMenuAction(scope, menus, { run, t }) {
690
+ try {
691
+ scope.slots.inject('contextMenu.icon', () =>
692
+ scope.slots.register({ name: 'contextMenu.icon', key: SESSION_MENU_ICON_KEY }, RefreshIcon),
693
+ )
694
+ scope.effect?.(() =>
695
+ menus.register({
696
+ id: 'session-title-stamp.retitle',
697
+ target: 'session',
698
+ order: 10,
699
+ resolve: ({ sessionId }) => [
700
+ {
701
+ id: 'retitle',
702
+ label: t('menu'),
703
+ icon: { key: SESSION_MENU_ICON_KEY },
704
+ run: async () => {
705
+ try {
706
+ await run(sessionId)
707
+ } catch (error) {
708
+ menus.notify?.(String(error?.message ?? error), false)
709
+ }
710
+ },
711
+ },
712
+ ],
713
+ }),
714
+ )
715
+ return true
716
+ } catch (error) {
717
+ console.warn('session-title-stamp: context menu unavailable, keeping the Slot row', error)
718
+ return false
719
+ }
720
+ }
721
+
678
722
  function apply(ctx) {
679
723
  installStyle(ctx)
680
724
  ctx.effect?.(() => ctx.locale.register(NS, DICT))
@@ -704,17 +748,32 @@ window.__ModuleLoader__.load({
704
748
  ),
705
749
  )
706
750
 
707
- ctx.slots.inject('sidebar.workspaces.session.menu.item', () =>
708
- ctx.slots.register(
709
- {
710
- name: 'sidebar.workspaces.session.menu.item',
711
- id: 'session-title-stamp-retitle',
712
- order: 0,
713
- inject: () => ({ run, t }),
714
- },
715
- RegenerateMenuItem,
716
- ),
717
- )
751
+ const menus = sessionMenuService(ctx)
752
+ let dataMenu = typeof menus?.register === 'function' ? registerSessionMenuAction(ctx, menus, { run, t }) : false
753
+ if (!dataMenu) {
754
+ let disposeLegacyMenu
755
+ ctx.slots.inject('sidebar.workspaces.session.menu.item', () => {
756
+ if (dataMenu) return undefined
757
+ disposeLegacyMenu = ctx.slots.register(
758
+ {
759
+ name: 'sidebar.workspaces.session.menu.item',
760
+ id: 'session-title-stamp-retitle',
761
+ order: 0,
762
+ inject: () => ({ run, t }),
763
+ },
764
+ RegenerateMenuItem,
765
+ )
766
+ return disposeLegacyMenu
767
+ })
768
+ ctx.inject?.(['contextMenus'], (scope) => {
769
+ if (dataMenu) return
770
+ const service = scope.contextMenus ?? sessionMenuService(scope)
771
+ if (typeof service?.register !== 'function') return
772
+ if (!registerSessionMenuAction(scope, service, { run, t })) return
773
+ dataMenu = true
774
+ disposeLegacyMenu?.()
775
+ })
776
+ }
718
777
 
719
778
  ctx.slots.inject('sidebar.workspaces.session.menu.item', () =>
720
779
  ctx.slots.register(
package/market/index.json CHANGED
@@ -57,12 +57,12 @@
57
57
  },
58
58
  "versions": [
59
59
  {
60
- "version": "0.8.2",
61
- "publishTimestamp": 1794711537,
60
+ "version": "0.9.0",
61
+ "publishTimestamp": 1794927576,
62
62
  "source": {
63
63
  "type": "git",
64
64
  "url": "https://github.com/xuedipiaofei/dsh-session-title-stamp",
65
- "commit": "4b07f13dea33b114112f821223ec2502e5153a71"
65
+ "commit": "5d54cb1ba73084c85a01490e310f80d9fff63701"
66
66
  },
67
67
  "engines": {
68
68
  "dsh": ">=0.2.1-rc.3 <0.3.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-title-stamp",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "DSH session titles in a DATE | CATEGORY | NAME template, with one-click Generate title from the header or session menu, turn-aware auto-refresh, a settings page for format and title language, and hover duration/cost/token stats.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -37,6 +37,7 @@
37
37
  "README.zh.md",
38
38
  "docs/0.7.0-settings-mock.png",
39
39
  "docs/0.7.0-hover-card-mock.png",
40
+ "docs/screenshots/00-generate-title.png",
40
41
  "docs/screenshots/01-session-list.png",
41
42
  "docs/screenshots/02-settings.png",
42
43
  "docs/screenshots/03-hover-stats.png",
package/screenshots.json CHANGED
@@ -1,4 +1,5 @@
1
1
  [
2
+ "docs/screenshots/00-generate-title.png",
2
3
  "docs/screenshots/01-session-list.png",
3
4
  "docs/screenshots/02-settings.png",
4
5
  "docs/screenshots/03-hover-stats.png"