dsh-session-title-stamp 0.8.3 → 0.9.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
@@ -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.
@@ -80,7 +80,7 @@ and mirrors conventions used by other coding agents.
80
80
  Add this market index source in **Plugins → Discover → Index sources**:
81
81
 
82
82
  ```text
83
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.3/market/index.json
83
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.9.1/market/index.json
84
84
  ```
85
85
 
86
86
  Then install **Session title stamp** from the list. The plugin installs as a
@@ -301,6 +301,9 @@ labels and the local fallback maps common keywords onto them.
301
301
  - The browser half needs the Web composition's `sidebar.session.row.hover` and
302
302
  `conversation.session.header.actions` seats. A shell that does not expose them
303
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**.
304
307
  - The provider imports `@deepseek-ai/dsh-session-title-llm` dynamically. A
305
308
  missing or incompatible executor degrades to local naming, but a changed
306
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。
@@ -61,7 +61,7 @@
61
61
  在 **插件 → 发现(Discover)→ 索引源** 添加:
62
62
 
63
63
  ```text
64
- https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.8.3/market/index.json
64
+ https://cdn.jsdelivr.net/gh/xuedipiaofei/dsh-session-title-stamp@v0.9.1/market/index.json
65
65
  ```
66
66
 
67
67
  然后在列表里安装 **Session title stamp / 会话标题印章**。插件以 profile bundle 的形式安装,之后可在插件页启停。
@@ -226,6 +226,7 @@ fork 子会话、子代理会话,以及用户手动改名固定的标题都会
226
226
  - bundle 依赖内置行 id `session-title-llm`。如果已有其它标题 provider 先注册,本插件会打 warn 并保持 inactive;先停用另一个再重载。
227
227
  - `llm`、`commands`、`sessions`、`sessionProjections`、`connection` 都采用延迟注入;缺少哪个只损失对应能力,不影响插件加载。
228
228
  - 浏览器半边依赖 Web 组合的 `sidebar.session.row.hover` 和 `conversation.session.header.actions` 座位;没有这两个座位的 shell 不会显示按钮/悬停行。
229
+ - 在 DSH 0.2.2+「自动生成标题」是会话菜单的第一项(在「置顶会话」之上);0.2.1 没有 context-menu 服务,同一动作走旧 Slot,排在「归档会话」之前。
229
230
  - 插件动态 import `@deepseek-ai/dsh-session-title-llm`。执行器缺失或不兼容时会降级为本地命名;如果 `ctx.sessionTitle` API 本身变化,则可能无法注册。
230
231
 
231
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(
Binary file
package/market/index.json CHANGED
@@ -34,8 +34,8 @@
34
34
  "zh": "会话标题印章"
35
35
  },
36
36
  "description": {
37
- "en": "One-click Generate title from the header ↻ or the session menu; turn-aware auto-refresh in DATE | CATEGORY | NAME; settings page for format and title language; hover duration/cost/token stats.",
38
- "zh": "一键重新生成标题:会话头 ↻ 或会话菜单「自动生成标题」都可触发;回答后自动重算,标题固定为「日期 | 分类 | 名称」;设置页可改格式和标题语言;悬停看耗时/成本/token。"
37
+ "en": "Hover a session to see duration, estimated cost and tokens; one-click Generate title from the header ↻ or menu keeps titles in DATE | CATEGORY | NAME, with a settings page for format and language.",
38
+ "zh": "悬停会话行就能看到耗时、估算费用和 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.8.3",
61
- "publishTimestamp": 1794759134,
60
+ "version": "0.9.1",
61
+ "publishTimestamp": 1795417544,
62
62
  "source": {
63
63
  "type": "git",
64
64
  "url": "https://github.com/xuedipiaofei/dsh-session-title-stamp",
65
- "commit": "5934adaeebdfca3e1d19ab7b81ce57781fa1afc2"
65
+ "commit": "864f890b1fe976793ebf03b74955fcb18fcd3c68"
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.8.3",
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.",
3
+ "version": "0.9.1",
4
+ "description": "DSH session titles in a DATE | CATEGORY | NAME template, with hover duration/cost/token stats, one-click Generate title from the header or menu, turn-aware auto-refresh, and a settings page for format and title language.",
5
5
  "keywords": [
6
6
  "dsh",
7
7
  "dsh-plugin",
package/screenshots.json CHANGED
@@ -1,6 +1,6 @@
1
1
  [
2
2
  "docs/screenshots/00-generate-title.png",
3
3
  "docs/screenshots/01-session-list.png",
4
- "docs/screenshots/02-settings.png",
5
- "docs/screenshots/03-hover-stats.png"
4
+ "docs/screenshots/03-hover-stats.png",
5
+ "docs/screenshots/02-settings.png"
6
6
  ]