dsh-keeper-plugin 0.1.4 → 0.1.6

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.
Files changed (4) hide show
  1. package/README.md +63 -30
  2. package/client.js +2498 -155
  3. package/index.js +30 -1
  4. package/package.json +1 -1
package/client.js CHANGED
@@ -57,8 +57,57 @@ const DICT = {
57
57
  tabTrash: '回收站',
58
58
  tabPanels: '插件管理',
59
59
  tabNotify: '通知管理',
60
+ quickJump: '快速跳转',
61
+ quickJumpTitle: 'DSH 管家 · 快速跳转',
62
+ quickJumpPlaceholder: '搜索会话、工作区、设置或操作…',
63
+ quickJumpHint: 'Esc 关闭 · Enter 打开 · ↑↓ 选择',
64
+ quickJumpEmpty: '没有匹配结果',
65
+ quickJumpGroupActions: 'DSH 管家',
66
+ quickJumpGroupSettings: '设置',
67
+ quickJumpGroupWorkspaces: '工作区',
68
+ quickJumpGroupSessions: '会话',
69
+ quickJumpGroupPlugins: '其他插件',
70
+ quickJumpGroupTrash: '回收站',
71
+ quickJumpArchived: '已归档',
72
+ quickJumpSubagent: '子会话',
73
+ quickJumpCopyId: '复制 ID',
74
+ quickJumpCopied: '已复制 Session ID',
75
+ quickJumpRestored: '已恢复「{name}」到原工作区',
76
+ quickJumpRestoreFailed: '恢复失败:{message}',
77
+ quickJumpMarkRead: '全部标为已读',
78
+ quickJumpMarkedRead: '通知均已标为已读',
79
+ quickJumpClearHistory: '清空通知历史',
80
+ quickJumpHistoryCleared: '通知历史已清空',
81
+ quickJumpOpenDataDir: '打开数据目录',
82
+ quickJumpOpenDataDirFailed: '无法打开数据目录。',
83
+ quickJumpOpenTab: '打开{name}',
84
+ quickJumpSettings: '打开 DSH 管家设置',
85
+ quickJumpRefresh: '刷新数据',
86
+ quickJumpKeysHint: '可在 DSH 主程序设置 → DSH 管家 → 快捷键中修改',
87
+ quickJumpChipAll: '全部',
88
+ quickJumpChipActions: '管家',
89
+ quickJumpChipSettings: '设置',
90
+ quickJumpChipPlugins: '插件',
91
+ quickJumpChipWorkspaces: '工作区',
92
+ quickJumpChipSessions: '会话',
93
+ quickJumpLoading: '加载中…',
94
+ shortcutTitle: '快捷键',
95
+ shortcutHint: '快速跳转的快捷键,点击右侧键位进行录制。',
96
+ shortcutRecordTitle: '录制快捷键',
97
+ shortcutRecordHint: '按下新的组合键;Esc 取消,Backspace 清除绑定。',
98
+ shortcutRecordModifier: '请至少按住一个修饰键(Ctrl / Alt / Shift / ⌘)。',
99
+ shortcutRecordInvalid: '该组合键不可用:{reason}',
100
+ shortcutRecordConflict: '与「{names}」冲突,请换一个组合键。',
101
+ shortcutSaved: '快捷键已保存',
102
+ shortcutReset: '重置',
103
+ shortcutResetDone: '已恢复默认快捷键',
104
+ shortcutRecording: '按键盘输入快捷键',
105
+ shortcutClear: '清除',
106
+ shortcutCleared: '已清除快捷键',
107
+ shortcutEmptyText: '点击录制',
108
+ shortcutSaveFailed: '快捷键保存失败:{message}',
60
109
  notifyTitle: '任务状态通知',
61
- notifySubtitle: '允许任务完成或失败时接收通知',
110
+ notifySubtitle: '设置任务提醒方式、静音规则,并查看本机通知历史。',
62
111
  notifyEnabled: '启用通知',
63
112
  notifyEnabledHint: '关闭后不再发送任何提醒。',
64
113
  notifyChannels: '提醒方式',
@@ -120,6 +169,23 @@ const DICT = {
120
169
  notifyAskGenericBody: '请返回 DSH 继续。',
121
170
  notifyUntitled: '未命名会话',
122
171
  notifyEmpty: '暂时没有新的提醒。',
172
+ notifyCenter: '通知中心',
173
+ notifyCenterEmpty: '还没有通知记录。任务结束、失败或等待输入时会出现在这里。',
174
+ notifyCenterHint: '记录只保存在本机;点击条目可打开对应会话。',
175
+ notifyMarkAllRead: '全部标为已读',
176
+ notifyClearHistory: '清空记录',
177
+ notifyUnreadN: '{n} 条未读',
178
+ notifyMutedTag: '已静音',
179
+ quietTitle: '静音规则',
180
+ quietEnabled: '启用免打扰时段',
181
+ quietEnabledHint: '每天在设定时段内不弹桌面横幅、不播放提示音;提醒仍会记入通知中心,可随时回看。开始时间晚于结束时间表示跨天(如 22:00–08:00)。',
182
+ quietStart: '开始时间',
183
+ quietEnd: '结束时间',
184
+ muteDone: '静音「任务完成」提醒',
185
+ muteDoneHint: '只静音「任务完成」这一类提醒,通知中心仍会记录;「失败/异常打断」「等待操作」不受影响,照常提醒。适合长任务跑完不想被打断、但出问题仍要知道的场景。',
186
+ muteWorkspaces: '按工作区静音',
187
+ muteWorkspacesHint: '勾选的工作区里产生的提醒只写入通知中心,不弹横幅、不响提示音;未勾选的工作区不受影响。适合把某个工作区当作后台批量处理时使用。',
188
+ noWorkspaces: '还没有工作区。',
123
189
  searchPlaceholder: '搜索会话标题、工作区…',
124
190
  sortUpdated: '按最近活动',
125
191
  sortSize: '按占用大小',
@@ -145,7 +211,7 @@ const DICT = {
145
211
  autoClean: '清理空会话',
146
212
  autoCleanEmpty: '没有可清理的空会话',
147
213
  cleanBlankConfirmTitle: '清理空会话',
148
- cleanBlankConfirmBody: '将把 {n} 个空会话移入回收站,之后可以恢复。',
214
+ cleanBlankConfirmBody: '将把 {n} 个空会话(约 {size})移入回收站,之后可以恢复。',
149
215
  showPath: '显示路径',
150
216
  hidePath: '隐藏路径',
151
217
  openPath: '打开路径',
@@ -183,19 +249,33 @@ const DICT = {
183
249
  cleanedMsg: '已清理 {n} 个空会话',
184
250
  undo: '撤销',
185
251
  confirmPurgeTitle: '彻底删除会话?',
186
- confirmPurgeBody: '将从磁盘删除 {n} 个会话(约 {size})。此操作不可撤销,删除后重启也不会恢复。',
252
+ confirmPurgeBody: '将从磁盘永久删除 {n} 个会话(约 {size})。此操作不可撤销,删除后重启也不会恢复。',
187
253
  confirmEmptyTitle: '清空回收站?',
188
- confirmEmptyBody: '将彻底删除回收站中全部 {n} 个会话(约 {size}),此操作不可撤销。',
254
+ confirmEmptyBody: '将永久删除回收站中全部 {n} 个会话(约 {size}),此操作不可撤销。',
189
255
  confirmDeleteTitle: '删除会话?',
190
256
  confirmDeleteBody: '将永久删除 {n} 个会话(约 {size}),并清理其日志、缓存与索引。此操作不可撤销,删除后重启也不会恢复。',
257
+ confirmTrashTitle: '移入回收站?',
258
+ confirmTrashBody: '将把 {n} 个会话(约 {size})移入回收站,可随时恢复。',
259
+ deleteFailedTitle: '部分会话未删除',
260
+ purgeFailedTitle: '部分会话未彻底删除',
261
+ purgePartial: '已彻底删除 {ok} 个,{fail} 个失败',
262
+ cleanPartial: '已清理 {ok} 个,{fail} 个失败',
263
+ purgeSessionList: '将彻底删除:{names}',
264
+ previewExpand: '展开全部 {n} 个',
265
+ previewCollapse: '收起',
266
+ deleteWorkspaces: '所属工作区:{names}',
267
+ deleteSessionList: '将删除会话:{names}',
268
+ deletePartial: '已删除 {ok} 个,{fail} 个失败',
269
+ workspacesN: '{n} 个工作区',
191
270
  cancel: '取消',
192
271
  confirm: '确认删除',
272
+ close: '关闭',
193
273
  topSizes: '空间占用排行',
194
274
  topSizesHint: '按会话日志占用空间从大到小排列,共 {n} 个会话;点击标题或「选中」可加入批量操作。',
195
275
  selectHint: '点击选中此会话,加入批量操作。',
196
276
  selectTop: '选中',
197
277
  panelsTitle: '插件管理',
198
- panelsHint: '开关只控制侧栏入口的显示,不会停用插件本身。',
278
+ panelsHint: '开关只控制侧栏入口的显示,插件仍会加载。要停用或卸载,点该行的「禁用」或「卸载」。',
199
279
  moreMenu: '更多',
200
280
  moreMenuMeta: '侧栏面板列表底部的分组菜单',
201
281
  moreBrowse: '浏览更多插件',
@@ -350,9 +430,9 @@ const DICT = {
350
430
  modeArchiveHint: '只从侧栏隐藏,不移动磁盘文件,可从会话列表取消归档。',
351
431
  modeDelete: '永久删除',
352
432
  modeDeleteHint: '直接删除日志、缓存与索引,不可恢复。',
353
- deleteModeHint: '列表「删除会话」的行为:默认移入回收站、可恢复;选永久删除时删除前会二次确认。',
354
- confirmPurgeLabel: '永久删除前二次确认',
355
- confirmPurgeHint: '关闭后永久删除(列表删除或回收站彻底删除)不再弹出确认框,请谨慎使用。',
433
+ deleteModeHint: '列表「删除会话」的行为:默认移入回收站、可恢复;永久删除不可恢复。删除前是否弹确认框由右侧开关统一控制。',
434
+ confirmPurgeLabel: '删除前二次确认',
435
+ confirmPurgeHint: '开启后,列表删除(移入回收站 / 永久删除)、回收站「彻底删除 / 清空回收站」与清理空会话都会先弹出确认框;关闭后这些操作直接执行。',
356
436
  entryVisible: '显示侧栏入口',
357
437
  entryVisibleHint: '关闭后侧栏底部不再显示「DSH 管家」图标,设置页仍然可用。',
358
438
  resetSettings: '恢复默认设置',
@@ -385,8 +465,57 @@ const DICT = {
385
465
  tabTrash: 'Trash',
386
466
  tabPanels: 'Plugin manager',
387
467
  tabNotify: 'Notification manager',
468
+ quickJump: 'Quick jump',
469
+ quickJumpTitle: 'DSH Keeper · Quick jump',
470
+ quickJumpPlaceholder: 'Search sessions, workspaces, settings, or commands…',
471
+ quickJumpHint: 'Esc close · Enter open · ↑↓ select',
472
+ quickJumpEmpty: 'No matches',
473
+ quickJumpGroupActions: 'DSH Keeper',
474
+ quickJumpGroupSettings: 'Settings',
475
+ quickJumpGroupWorkspaces: 'Workspaces',
476
+ quickJumpGroupSessions: 'Sessions',
477
+ quickJumpGroupPlugins: 'Other plugins',
478
+ quickJumpGroupTrash: 'Trash',
479
+ quickJumpArchived: 'Archived',
480
+ quickJumpSubagent: 'Subagent',
481
+ quickJumpCopyId: 'Copy ID',
482
+ quickJumpCopied: 'Session ID copied',
483
+ quickJumpRestored: 'Restored "{name}" to its workspace',
484
+ quickJumpRestoreFailed: 'Restore failed: {message}',
485
+ quickJumpMarkRead: 'Mark all read',
486
+ quickJumpMarkedRead: 'All notifications marked as read',
487
+ quickJumpClearHistory: 'Clear notification history',
488
+ quickJumpHistoryCleared: 'Notification history cleared',
489
+ quickJumpOpenDataDir: 'Open data directory',
490
+ quickJumpOpenDataDirFailed: 'Could not open the data directory.',
491
+ quickJumpOpenTab: 'Open {name}',
492
+ quickJumpSettings: 'Open DSH Keeper settings',
493
+ quickJumpRefresh: 'Refresh data',
494
+ quickJumpKeysHint: 'Change it in DSH Settings → DSH Keeper → Shortcut.',
495
+ quickJumpChipAll: 'All',
496
+ quickJumpChipActions: 'Keeper',
497
+ quickJumpChipSettings: 'Settings',
498
+ quickJumpChipPlugins: 'Plugins',
499
+ quickJumpChipWorkspaces: 'Workspaces',
500
+ quickJumpChipSessions: 'Sessions',
501
+ quickJumpLoading: 'Loading…',
502
+ shortcutTitle: 'Shortcut',
503
+ shortcutHint: 'Quick jump shortcut; click the keys on the right to record one.',
504
+ shortcutRecordTitle: 'Record shortcut',
505
+ shortcutRecordHint: 'Press the new combination; Esc cancels, Backspace clears the binding.',
506
+ shortcutRecordModifier: 'Hold at least one modifier (Ctrl / Alt / Shift / ⌘).',
507
+ shortcutRecordInvalid: 'This combination is unavailable: {reason}',
508
+ shortcutRecordConflict: 'Conflicts with “{names}”; choose another combination.',
509
+ shortcutSaved: 'Shortcut saved',
510
+ shortcutReset: 'Reset',
511
+ shortcutResetDone: 'Shortcut reset to default',
512
+ shortcutRecording: 'Press the keys',
513
+ shortcutClear: 'Clear',
514
+ shortcutCleared: 'Shortcut cleared',
515
+ shortcutEmptyText: 'Click to record',
516
+ shortcutSaveFailed: 'Failed to save shortcut: {message}',
388
517
  notifyTitle: 'Task status notifications',
389
- notifySubtitle: 'Allow notifications when a task finishes or fails',
518
+ notifySubtitle: 'Set how task reminders arrive, tune quiet rules, and review local notification history.',
390
519
  notifyEnabled: 'Enable notifications',
391
520
  notifyEnabledHint: 'Off stops all reminders.',
392
521
  notifyChannels: 'How to notify',
@@ -449,6 +578,23 @@ const DICT = {
449
578
  notifyAskGenericBody: 'Return to DSH to continue.',
450
579
  notifyUntitled: 'Untitled session',
451
580
  notifyEmpty: 'No new notifications yet.',
581
+ notifyCenter: 'Notification center',
582
+ notifyCenterEmpty: 'No notifications yet. Task completions, failures and pending inputs will appear here.',
583
+ notifyCenterHint: 'History stays on this machine; click an entry to open its session.',
584
+ notifyMarkAllRead: 'Mark all as read',
585
+ notifyClearHistory: 'Clear history',
586
+ notifyUnreadN: '{n} unread',
587
+ notifyMutedTag: 'Muted',
588
+ quietTitle: 'Quiet rules',
589
+ quietEnabled: 'Enable quiet hours',
590
+ quietEnabledHint: 'No banners or tones during this window each day; notifications still go to the Notification center. A start later than the end means the window crosses midnight (e.g. 22:00–08:00).',
591
+ quietStart: 'Start',
592
+ quietEnd: 'End',
593
+ muteDone: 'Mute task-completion reminders',
594
+ muteDoneHint: 'Mutes only "task completed" reminders; the Notification center still records them. Failures/interruptions and pending inputs still notify. Useful when you do not want to be interrupted by long runs but still need to know about problems.',
595
+ muteWorkspaces: 'Mute by workspace',
596
+ muteWorkspacesHint: 'Notifications from the selected workspaces go only to the Notification center, without banners or tones; other workspaces are unaffected. Useful when a workspace runs background batches.',
597
+ noWorkspaces: 'No workspaces yet.',
452
598
  searchPlaceholder: 'Search sessions or workspaces…',
453
599
  sortUpdated: 'Last activity',
454
600
  sortSize: 'Size',
@@ -474,7 +620,7 @@ const DICT = {
474
620
  autoClean: 'Clean blank sessions',
475
621
  autoCleanEmpty: 'No blank sessions to clean',
476
622
  cleanBlankConfirmTitle: 'Clean blank sessions',
477
- cleanBlankConfirmBody: 'Move {n} blank sessions to the trash? You can restore them later.',
623
+ cleanBlankConfirmBody: 'Move {n} blank sessions ({size}) to the trash? You can restore them later.',
478
624
  showPath: 'Show path',
479
625
  hidePath: 'Hide path',
480
626
  openPath: 'Open path',
@@ -512,19 +658,33 @@ const DICT = {
512
658
  cleanedMsg: 'Cleaned {n} blank sessions',
513
659
  undo: 'Undo',
514
660
  confirmPurgeTitle: 'Delete permanently?',
515
- confirmPurgeBody: 'This removes {n} sessions ({size}) from disk. It cannot be undone and will not come back after a restart.',
661
+ confirmPurgeBody: 'This permanently removes {n} sessions ({size}) from disk. It cannot be undone and will not come back after a restart.',
516
662
  confirmEmptyTitle: 'Empty the trash?',
517
663
  confirmEmptyBody: 'This permanently deletes all {n} sessions in the trash ({size}). It cannot be undone.',
518
664
  confirmDeleteTitle: 'Delete session?',
519
665
  confirmDeleteBody: 'This permanently deletes {n} sessions ({size}) and clears their transcript, caches and index. It cannot be undone and will not come back after a restart.',
666
+ confirmTrashTitle: 'Move to trash?',
667
+ confirmTrashBody: 'Move {n} sessions ({size}) to the trash? You can restore them later.',
668
+ deleteFailedTitle: 'Some sessions were not deleted',
669
+ purgeFailedTitle: 'Some sessions were not purged',
670
+ purgePartial: '{ok} purged, {fail} failed',
671
+ cleanPartial: '{ok} cleaned, {fail} failed',
672
+ purgeSessionList: 'Purge sessions: {names}',
673
+ previewExpand: 'Show all {n}',
674
+ previewCollapse: 'Show less',
675
+ deleteWorkspaces: 'Workspaces: {names}',
676
+ deleteSessionList: 'Sessions to delete: {names}',
677
+ deletePartial: '{ok} deleted, {fail} failed',
678
+ workspacesN: '{n} workspaces',
520
679
  cancel: 'Cancel',
521
680
  confirm: 'Delete permanently',
681
+ close: 'Close',
522
682
  topSizes: 'Largest sessions',
523
683
  topSizesHint: 'Ranked by session log size, largest first — {n} sessions. Click a title or Select to add it to a batch.',
524
684
  selectHint: 'Click to select this session for batch actions.',
525
685
  selectTop: 'Select',
526
686
  panelsTitle: 'Plugin manager',
527
- panelsHint: 'Switches only hide the sidebar entry; the plugin keeps running.',
687
+ panelsHint: 'Switches only control whether the sidebar entry is shown; the plugin keeps running. To disable or uninstall one, click "Disable" or "Uninstall" on its row.',
528
688
  moreMenu: 'More',
529
689
  moreMenuMeta: 'Grouped menu at the end of the panel list',
530
690
  moreBrowse: 'Browse other plugins',
@@ -679,9 +839,9 @@ const DICT = {
679
839
  modeArchiveHint: 'Hides the session from the sidebar without touching the log; unarchive from the session list.',
680
840
  modeDelete: 'Delete permanently',
681
841
  modeDeleteHint: 'Removes the log, cache and index at once; cannot be undone.',
682
- deleteModeHint: 'What the list Delete action does: move to trash (restorable) by default; permanent delete asks first.',
683
- confirmPurgeLabel: 'Confirm before permanent delete',
684
- confirmPurgeHint: 'When off, permanent deletes (from the list or the trash) happen without a dialog. Use with care.',
842
+ deleteModeHint: 'What the list Delete action does: move to trash (restorable) by default; permanent delete cannot be undone. Confirmation is controlled by the switch on the right.',
843
+ confirmPurgeLabel: 'Confirm before deleting',
844
+ confirmPurgeHint: 'When on, deleting from the list (move to trash or permanently), purging or emptying the trash, and cleaning blank sessions all ask for confirmation. When off, they run immediately.',
685
845
  entryVisible: 'Show sidebar entry',
686
846
  entryVisibleHint: 'Hide the DSH Keeper icon at the sidebar foot; the settings page stays available.',
687
847
  resetSettings: 'Reset to defaults',
@@ -901,9 +1061,17 @@ body[data-ds-dark-theme] .ss-rank-3{color:#ecc94b}
901
1061
  .ss-switch span{position:absolute;top:2px;left:2px;display:block;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-switch-thumb,var(--dsw-alias-label-secondary));transition:transform .26s cubic-bezier(.3,0,.2,1),background-color .26s ease}
902
1062
  .ss-switch[aria-checked="true"] span{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-base))}
903
1063
  .ss-overlay{position:fixed;inset:0;z-index:1200;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;padding:24px}
904
- .ss-modal{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;max-width:480px;width:100%;padding:20px;box-shadow:0 12px 40px rgba(0,0,0,.35)}
1064
+ .ss-modal{position:relative;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;max-width:480px;width:100%;padding:20px;box-shadow:0 12px 40px rgba(0,0,0,.35)}
1065
+ .ss-modalclose{position:absolute;top:10px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:18px;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease}
1066
+ .ss-modalclose:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}
1067
+ .ss-modalclose:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
905
1068
  .ss-modal h3{margin:0 0 8px;font-size:15px;color:var(--dsw-alias-label-primary)}
906
1069
  .ss-modal p{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.65;margin:0 0 18px}
1070
+ .ss-modalbody{display:flex;flex-direction:column;gap:4px;margin:-8px 0 18px;padding:10px 12px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.6;word-break:break-word}
1071
+ .ss-previewtoggle{align-self:flex-start;margin-top:2px;padding:0;border:none;background:none;color:var(--dsw-alias-state-business-primary);font-family:inherit;font-size:12px;cursor:pointer}
1072
+ .ss-previewtoggle:hover{text-decoration:underline}
1073
+ .ss-modalpreview{max-height:40vh;overflow:auto}
1074
+ .ss-modaldesc + .ss-modalpreview{margin-top:6px}
907
1075
  .ss-modalfoot{display:flex;justify-content:flex-end;gap:8px}
908
1076
  .ss-modal.ss-exportmodal{width:min(520px,calc(100vw - 48px))}
909
1077
  .ss-dialoghint{margin:-6px 0 14px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.55}
@@ -932,9 +1100,11 @@ body[data-ds-dark-theme] .ss-rank-3{color:#ecc94b}
932
1100
  .ss-field:last-child{border-bottom:none}
933
1101
  .ss-field:first-of-type{padding-top:2px}
934
1102
  .ss-fieldlabel{font-size:12px;color:var(--dsw-alias-label-primary)}
1103
+ .ss-fieldicon{display:inline-flex;align-items:center;gap:6px}
1104
+ .ss-fieldicon svg{flex:none;opacity:.8}
935
1105
  .ss-fieldlabel small{display:block;color:var(--dsw-alias-label-secondary);font-size:11px;margin-top:3px;max-width:520px;line-height:1.55}
936
- .ss-radios{display:flex;flex-direction:column;gap:6px}
937
- .ss-radio{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;color:var(--dsw-alias-label-primary)}
1106
+ .ss-radios{display:flex;flex-direction:column;gap:6px;white-space:nowrap}
1107
+ .ss-radio{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;color:var(--dsw-alias-label-primary);white-space:nowrap}
938
1108
  .ss-radio input{accent-color:var(--dsw-alias-brand-primary);width:14px;height:14px;margin:0}
939
1109
  .ss-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;color:var(--dsw-alias-label-secondary);word-break:break-all}
940
1110
  .ss-settingshead{margin-bottom:16px}
@@ -1028,6 +1198,8 @@ body[data-ds-dark-theme] .ss-rank-3{color:#ecc94b}
1028
1198
  .ss-settings .ss-card{background:transparent;border:0;border-radius:0;padding:4px 0 0;margin:6px 0 0}
1029
1199
  .ss-settings .ss-card h4{font-size:13px;font-weight:600;letter-spacing:0;text-transform:none;margin:0 0 8px;color:var(--dsw-alias-label-secondary)}
1030
1200
  .ss-settings .ss-notifycard h4{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary)}
1201
+ .ss-notifycount{color:var(--dsw-alias-label-secondary)}
1202
+ .ss-notifycount b{color:var(--dsw-alias-state-business-primary);font-weight:600;font-variant-numeric:tabular-nums}
1031
1203
  .ss-settings .ss-kpis{font-size:13px;line-height:22px;gap:10px}
1032
1204
  .ss-settings .ss-kpis b{font-weight:600}
1033
1205
  .ss-notifyactions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
@@ -1038,9 +1210,39 @@ body[data-ds-dark-theme] .ss-rank-3{color:#ecc94b}
1038
1210
  .ss-notifycard .ss-hint{color:var(--dsw-alias-label-tertiary)}
1039
1211
  .ss-notifyfooter{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:16px 0 6px}
1040
1212
  .ss-notifyintro{margin:0 0 10px}
1213
+ .ss-notifylog{display:flex;flex-direction:column;gap:4px;margin-top:10px;max-height:300px;overflow:auto}
1214
+ .ss-notifylogempty{margin-top:10px;opacity:.6}
1215
+ .ss-notifylogrow{display:flex;align-items:flex-start;gap:10px;width:100%;text-align:left;padding:8px 10px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary);cursor:pointer;font:inherit;box-sizing:border-box}
1216
+ .ss-notifylogrow:hover{background:var(--dsw-alias-bg-layer-1)}
1217
+ .ss-notifylogrow.unread{background:var(--dsw-alias-bg-layer-2)}
1218
+ .ss-notifylogrow:not(.unread){border-color:var(--dsw-alias-border-l1);background:transparent}
1219
+ .ss-notifylogrow:not(.unread):hover{background:var(--dsw-alias-bg-layer-1)}
1220
+ .ss-notifylogrow.unread .ss-notifylogtitle{font-weight:600}
1221
+ .ss-notifylogrow:not(.unread) .ss-notifylogtitle{color:var(--dsw-alias-label-tertiary);font-weight:400}
1222
+ .ss-notifylogrow:not(.unread) .ss-notifylogkind,
1223
+ .ss-notifylogrow:not(.unread) .ss-notifylogws,
1224
+ .ss-notifylogrow:not(.unread) .ss-notifylogsum,
1225
+ .ss-notifylogrow:not(.unread) .ss-notifylogtime{opacity:.6}
1226
+ .ss-notifylogkind{flex:none;min-width:48px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
1227
+ .ss-notifylogbody{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
1228
+ .ss-notifylogtitle{font-size:13px;line-height:19px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1229
+ .ss-notifylogws,.ss-notifylogsum,.ss-notifylogtime{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1230
+ .ss-notifylogtime{flex:none;margin-left:auto}
1231
+ .ss-notifylogmuted{align-self:center}
1232
+ .ss-notifytimes{display:flex;gap:20px;padding:8px 12px;margin-top:2px;border-radius:8px;background:var(--dsw-alias-bg-layer-2);width:fit-content;max-width:100%}
1233
+ .ss-notifytime{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--dsw-alias-label-secondary)}
1234
+ .ss-notifytime input[type=time]{height:28px;padding:0 8px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit}
1235
+ .ss-notifytime input[type=time]:focus{outline:none;border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 var(--dsw-focus-ring-width) var(--dsw-focus-ring-color)}
1236
+ .ss-mutelist{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:6px}
1237
+ .ss-quietcard .ss-field{padding:14px 0}
1238
+ .ss-quietcard .ss-field:first-of-type{padding-top:2px}
1239
+ .ss-quietcard .ss-fieldlabel small{margin-top:5px}
1240
+ .ss-quiettimesep{height:0;border-top:1px solid var(--dsw-alias-border-l1);margin-top:8px}
1241
+ .ss-muteworkspace{display:flex;align-items:center;gap:7px;font-size:13px;color:var(--dsw-alias-label-primary);cursor:pointer}
1242
+ .ss-muteworkspace input{width:14px;height:14px;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}
1041
1243
  .ss-channelrow{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:6px 0 6px 14px;border-left:1px solid var(--dsw-alias-border-l2)}
1042
1244
  .ss-channel{display:flex;align-items:center;gap:10px}
1043
- .ss-channellabel{font-size:12px;line-height:20px;color:var(--dsw-alias-label-secondary)}
1245
+ .ss-channellabel{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:20px;color:var(--dsw-alias-label-secondary)}
1044
1246
  .ss-volumewrap{display:flex;align-items:center;gap:10px;min-width:230px}
1045
1247
  .ss-volumerange{flex:1;min-width:120px;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}
1046
1248
  .ss-volumenum{width:64px;height:28px;padding:0 8px;text-align:right;font-size:12px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-sizing:border-box}
@@ -1068,6 +1270,46 @@ body[data-ds-dark-theme] .ss-rank-3{color:#ecc94b}
1068
1270
  /* --- settings navigation icon. DSH 0.2.2 exposes the keyed slot
1069
1271
  settings.section.icon (id = settings.section id), so the nav glyph is
1070
1272
  registered as slot content instead of being patched into the shell's DOM. --- */
1273
+ /* --- quick jump palette (session-wide Ctrl+Alt+K) --- */
1274
+ .ss-qj-overlay{position:fixed;inset:0;z-index:1300;background:rgba(0,0,0,.45);display:flex;align-items:flex-start;justify-content:center;padding:12vh 24px 24px}
1275
+ .ss-qj-panel{width:min(620px,100%);max-height:70vh;display:flex;flex-direction:column;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,.35);overflow:hidden}
1276
+ .ss-qj-head{padding:12px 16px 12px;font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary)}
1277
+ .ss-qj-input{margin:0 12px 8px;padding:8px 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font-family:inherit;font-size:13px;line-height:20px;box-sizing:border-box}
1278
+ .ss-qj-input:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
1279
+ .ss-qj-chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 12px 8px}
1280
+ .ss-qj-chip{font-size:11px;line-height:18px;padding:1px 9px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer}
1281
+ .ss-qj-chip:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}
1282
+ .ss-qj-chip.on{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 10%,transparent)}
1283
+ .ss-qj-loading{padding:8px;text-align:center;font-size:11px;color:var(--dsw-alias-label-tertiary)}
1284
+ .ss-qj-list{flex:1;min-height:0;overflow:auto;padding:1px 8px 8px;scrollbar-gutter:stable}
1285
+ .ss-qj-item{display:flex;gap:12px;align-items:center;width:100%;padding:8px;border:none;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary);font-family:inherit;font-size:13px;line-height:20px;text-align:left;cursor:pointer}
1286
+ .ss-qj-item:hover,.ss-qj-item.active{background:var(--dsw-alias-bg-layer-2)}
1287
+ .ss-qj-item:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
1288
+ .ss-qj-kind{flex:none;width:64px;font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1289
+ .ss-qj-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1290
+ .ss-qj-meta{flex:none;font-size:11px;color:var(--dsw-alias-label-tertiary);max-width:45%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1291
+ .ss-qj-copy{flex:none;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:10px;line-height:14px;padding:1px 6px;border-radius:4px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-tertiary);cursor:pointer;opacity:0;transition:opacity .15s ease,border-color .15s ease,color .15s ease}
1292
+ .ss-qj-item:hover .ss-qj-copy,.ss-qj-item.active .ss-qj-copy,.ss-qj-copy:focus-visible{opacity:1}
1293
+ .ss-qj-copy:hover{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}
1294
+ .ss-qj-empty{padding:24px;text-align:center;color:var(--dsw-alias-label-tertiary);font-size:12px}
1295
+ .ss-qj-hint{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:11px;color:var(--dsw-alias-label-tertiary)}
1296
+ .ss-qj-hintactions{display:flex;flex-wrap:wrap;align-items:center;gap:12px;min-width:0}
1297
+ .ss-qj-keys{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;line-height:18px;padding:1px 8px;border-radius:4px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);white-space:nowrap;margin-left:auto}
1298
+ .ss-kbd{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:10px;line-height:16px;padding:0 4px;border-radius:4px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);margin-left:4px;white-space:nowrap}
1299
+ .ss-kbdbtn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:160px;height:30px;box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;font-weight:500;letter-spacing:.2px;line-height:24px;padding:0 22px;border-radius:6px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-primary);cursor:pointer;margin-left:4px;white-space:nowrap;flex:none;user-select:none;transition:transform .26s ease;box-shadow:none}
1300
+ .ss-kbdrow .ss-kbdbtn{transform:translateX(58px)}
1301
+ .ss-kbdrow.is-cleared .ss-kbdbtn{transform:translateX(0)}
1302
+ .ss-kbdbtn:not(.recording):hover{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}
1303
+ .ss-kbdbtn.recording{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2))}
1304
+ .ss-kbdtext{display:block;width:100%;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1305
+ .ss-kbdrow{position:relative;display:inline-flex;align-items:center;gap:6px;justify-content:flex-end;width:218px}
1306
+ .ss-kbdclear{position:absolute;right:6px;top:50%;transform:translateY(-50%);border:none;background:transparent;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1;padding:0 1px;cursor:pointer;border-radius:3px;display:inline-flex;align-items:center}
1307
+ .ss-kbdclear:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2)}
1308
+ .ss-kbdrow .ss-btn.ghost.ss-kbdreset{font-size:11px;padding:0 10px;line-height:28px;height:30px;width:52px;min-width:52px;margin-left:0;justify-content:center;box-sizing:border-box;background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));border:1px solid transparent;color:var(--dsw-alias-label-primary);opacity:0;pointer-events:none;transition:opacity .26s ease,border-color .26s ease}
1309
+ .ss-kbdrow .ss-btn.ghost.ss-kbdreset.is-on{opacity:1;pointer-events:auto;border-color:var(--dsw-alias-border-l1)}
1310
+ .ss-kbdrow .ss-btn.ghost.ss-kbdreset:hover:not(:disabled){background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-bg-layer-2));border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary)}
1311
+ .ss-kbdrow .ss-btn.ghost.ss-kbdreset:active:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 84%,var(--dsw-alias-label-primary) 16%);border-color:var(--dsw-alias-border-l2)}
1312
+ .ss-kbdbtn:focus-visible{outline:none;border-color:var(--dsw-alias-state-business-primary);box-shadow:none}
1071
1313
  `;
1072
1314
 
1073
1315
  /* ------------------------------------------------------------- primitives */
@@ -1229,6 +1471,328 @@ function ArrowUpIcon(props) {
1229
1471
  }
1230
1472
 
1231
1473
  /** Gear shown on the header's settings shortcut. */
1474
+ /** Quiet hours: a crescent moon. */
1475
+ function MoonIcon(props) {
1476
+ const size = Number(props?.size) || 15;
1477
+ return React.createElement(
1478
+ 'svg',
1479
+ {
1480
+ width: size,
1481
+ height: size,
1482
+ viewBox: '0 0 24 24',
1483
+ fill: 'none',
1484
+ stroke: 'currentColor',
1485
+ strokeWidth: 1.8,
1486
+ strokeLinecap: 'round',
1487
+ strokeLinejoin: 'round',
1488
+ className: props?.className,
1489
+ 'aria-hidden': 'true',
1490
+ },
1491
+ React.createElement('path', { d: 'M20.7 13.1A8.6 8.6 0 1 1 10.9 3.3a6.7 6.7 0 0 0 9.8 9.8Z' }),
1492
+ );
1493
+ }
1494
+
1495
+ /** Mute one reminder type: a bell with a slash. */
1496
+ function BellOffIcon(props) {
1497
+ const size = Number(props?.size) || 15;
1498
+ return React.createElement(
1499
+ 'svg',
1500
+ {
1501
+ width: size,
1502
+ height: size,
1503
+ viewBox: '0 0 24 24',
1504
+ fill: 'none',
1505
+ stroke: 'currentColor',
1506
+ strokeWidth: 1.8,
1507
+ strokeLinecap: 'round',
1508
+ strokeLinejoin: 'round',
1509
+ className: props?.className,
1510
+ 'aria-hidden': 'true',
1511
+ },
1512
+ React.createElement('path', { d: 'M8.7 3.4A6 6 0 0 1 18 8.6c0 3.3.7 5.4 1.4 6.5' }),
1513
+ React.createElement('path', { d: 'M17 17H4.6a2 2 0 0 1-1.4-3.4A2 2 0 0 0 3.7 12V8.6a6 6 0 0 1 .6-2.6' }),
1514
+ React.createElement('path', { d: 'M3 3l18 18' }),
1515
+ React.createElement('path', { d: 'M10.3 21a2 2 0 0 0 3.4 0' }),
1516
+ );
1517
+ }
1518
+
1519
+ /** Mute one workspace: a folder with a slash. */
1520
+ function FolderOffIcon(props) {
1521
+ const size = Number(props?.size) || 15;
1522
+ return React.createElement(
1523
+ 'svg',
1524
+ {
1525
+ width: size,
1526
+ height: size,
1527
+ viewBox: '0 0 24 24',
1528
+ fill: 'none',
1529
+ stroke: 'currentColor',
1530
+ strokeWidth: 1.8,
1531
+ strokeLinecap: 'round',
1532
+ strokeLinejoin: 'round',
1533
+ className: props?.className,
1534
+ 'aria-hidden': 'true',
1535
+ },
1536
+ React.createElement('path', {
1537
+ d: 'M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9L9.6 3.9A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z',
1538
+ }),
1539
+ React.createElement('path', { d: 'M2 2l20 20' }),
1540
+ );
1541
+ }
1542
+
1543
+ /** Notification master switch: a bell. */
1544
+ function BellIcon(props) {
1545
+ const size = Number(props?.size) || 15;
1546
+ return React.createElement(
1547
+ 'svg',
1548
+ {
1549
+ width: size,
1550
+ height: size,
1551
+ viewBox: '0 0 24 24',
1552
+ fill: 'none',
1553
+ stroke: 'currentColor',
1554
+ strokeWidth: 1.8,
1555
+ strokeLinecap: 'round',
1556
+ strokeLinejoin: 'round',
1557
+ className: props?.className,
1558
+ 'aria-hidden': 'true',
1559
+ },
1560
+ React.createElement('path', {
1561
+ d: 'M18 8.6a6 6 0 0 0-12 0c0 3.4-.7 5.5-1.4 6.6a1 1 0 0 0 .9 1.5h13a1 1 0 0 0 .9-1.5c-.7-1.1-1.4-3.2-1.4-6.6Z',
1562
+ }),
1563
+ React.createElement('path', { d: 'M10.3 21a2 2 0 0 0 3.4 0' }),
1564
+ );
1565
+ }
1566
+
1567
+ /** Banner channel: a desktop window. */
1568
+ function BannerIcon(props) {
1569
+ const size = Number(props?.size) || 15;
1570
+ return React.createElement(
1571
+ 'svg',
1572
+ {
1573
+ width: size,
1574
+ height: size,
1575
+ viewBox: '0 0 24 24',
1576
+ fill: 'none',
1577
+ stroke: 'currentColor',
1578
+ strokeWidth: 1.8,
1579
+ strokeLinecap: 'round',
1580
+ strokeLinejoin: 'round',
1581
+ className: props?.className,
1582
+ 'aria-hidden': 'true',
1583
+ },
1584
+ React.createElement('rect', { x: 3, y: 5, width: 18, height: 13, rx: 2 }),
1585
+ React.createElement('path', { d: 'M3 9h18' }),
1586
+ );
1587
+ }
1588
+
1589
+ /** Sound channel / volume: a speaker. */
1590
+ function SpeakerIcon(props) {
1591
+ const size = Number(props?.size) || 16;
1592
+ return React.createElement(
1593
+ 'svg',
1594
+ {
1595
+ width: size,
1596
+ height: size,
1597
+ viewBox: '0 0 24 24',
1598
+ fill: 'none',
1599
+ stroke: 'currentColor',
1600
+ strokeWidth: 1.8,
1601
+ strokeLinecap: 'round',
1602
+ strokeLinejoin: 'round',
1603
+ className: props?.className,
1604
+ 'aria-hidden': 'true',
1605
+ },
1606
+ React.createElement('path', { d: 'M3 9h4.2L12 5.6v12.8L7.2 15H3z' }),
1607
+ React.createElement('path', { d: 'M15.6 8.7a5 5 0 0 1 0 6.6' }),
1608
+ React.createElement('path', { d: 'M18 6.5a7.8 7.8 0 0 1 0 11' }),
1609
+ );
1610
+ }
1611
+
1612
+ /** Open the related session on click: an outbound arrow. */
1613
+ function ExternalLinkIcon(props) {
1614
+ const size = Number(props?.size) || 15;
1615
+ return React.createElement(
1616
+ 'svg',
1617
+ {
1618
+ width: size,
1619
+ height: size,
1620
+ viewBox: '0 0 24 24',
1621
+ fill: 'none',
1622
+ stroke: 'currentColor',
1623
+ strokeWidth: 1.8,
1624
+ strokeLinecap: 'round',
1625
+ strokeLinejoin: 'round',
1626
+ className: props?.className,
1627
+ 'aria-hidden': 'true',
1628
+ },
1629
+ React.createElement('path', { d: 'M14 4h6v6' }),
1630
+ React.createElement('path', { d: 'M20 4l-9 9' }),
1631
+ React.createElement('path', { d: 'M18.5 13.5V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4.5' }),
1632
+ );
1633
+ }
1634
+
1635
+ /** Delete / trash actions. */
1636
+ function TrashIcon(props) {
1637
+ const size = Number(props?.size) || 15;
1638
+ return React.createElement(
1639
+ 'svg',
1640
+ {
1641
+ width: size,
1642
+ height: size,
1643
+ viewBox: '0 0 24 24',
1644
+ fill: 'none',
1645
+ stroke: 'currentColor',
1646
+ strokeWidth: 1.8,
1647
+ strokeLinecap: 'round',
1648
+ strokeLinejoin: 'round',
1649
+ className: props?.className,
1650
+ 'aria-hidden': 'true',
1651
+ },
1652
+ React.createElement('path', { d: 'M4 6h16' }),
1653
+ React.createElement('path', { d: 'M9.5 6V4.5a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1V6' }),
1654
+ React.createElement('path', { d: 'M6.5 6l.9 13.1a1.5 1.5 0 0 0 1.5 1.4h6.2a1.5 1.5 0 0 0 1.5-1.4L17.5 6' }),
1655
+ React.createElement('path', { d: 'M10 11v5M14 11v5' }),
1656
+ );
1657
+ }
1658
+
1659
+ /** Safety guards such as the purge confirmation. */
1660
+ function ShieldIcon(props) {
1661
+ const size = Number(props?.size) || 15;
1662
+ return React.createElement(
1663
+ 'svg',
1664
+ {
1665
+ width: size,
1666
+ height: size,
1667
+ viewBox: '0 0 24 24',
1668
+ fill: 'none',
1669
+ stroke: 'currentColor',
1670
+ strokeWidth: 1.8,
1671
+ strokeLinecap: 'round',
1672
+ strokeLinejoin: 'round',
1673
+ className: props?.className,
1674
+ 'aria-hidden': 'true',
1675
+ },
1676
+ React.createElement('path', { d: 'M12 3l7 3v5.2c0 4.4-3 7.7-7 9.8-4-2.1-7-5.4-7-9.8V6z' }),
1677
+ React.createElement('path', { d: 'M9 11.6l2.1 2.1 4-4' }),
1678
+ );
1679
+ }
1680
+
1681
+ /** Sidebar entry visibility. */
1682
+ function SidebarIcon(props) {
1683
+ const size = Number(props?.size) || 15;
1684
+ return React.createElement(
1685
+ 'svg',
1686
+ {
1687
+ width: size,
1688
+ height: size,
1689
+ viewBox: '0 0 24 24',
1690
+ fill: 'none',
1691
+ stroke: 'currentColor',
1692
+ strokeWidth: 1.8,
1693
+ strokeLinecap: 'round',
1694
+ strokeLinejoin: 'round',
1695
+ className: props?.className,
1696
+ 'aria-hidden': 'true',
1697
+ },
1698
+ React.createElement('rect', { x: 3, y: 4.5, width: 18, height: 15, rx: 2 }),
1699
+ React.createElement('path', { d: 'M9 4.5v15' }),
1700
+ );
1701
+ }
1702
+
1703
+ /** Default export format: a file with a download arrow. */
1704
+ function ExportFileIcon(props) {
1705
+ const size = Number(props?.size) || 15;
1706
+ return React.createElement(
1707
+ 'svg',
1708
+ {
1709
+ width: size,
1710
+ height: size,
1711
+ viewBox: '0 0 24 24',
1712
+ fill: 'none',
1713
+ stroke: 'currentColor',
1714
+ strokeWidth: 1.8,
1715
+ strokeLinecap: 'round',
1716
+ strokeLinejoin: 'round',
1717
+ className: props?.className,
1718
+ 'aria-hidden': 'true',
1719
+ },
1720
+ React.createElement('path', { d: 'M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9z' }),
1721
+ React.createElement('path', { d: 'M13 3v6h6' }),
1722
+ React.createElement('path', { d: 'M12 12.5v5.5M9.5 15.5L12 18l2.5-2.5' }),
1723
+ );
1724
+ }
1725
+
1726
+ /** Clear-cache style actions: an eraser. */
1727
+ function EraserIcon(props) {
1728
+ const size = Number(props?.size) || 15;
1729
+ return React.createElement(
1730
+ 'svg',
1731
+ {
1732
+ width: size,
1733
+ height: size,
1734
+ viewBox: '0 0 24 24',
1735
+ fill: 'none',
1736
+ stroke: 'currentColor',
1737
+ strokeWidth: 1.8,
1738
+ strokeLinecap: 'round',
1739
+ strokeLinejoin: 'round',
1740
+ className: props?.className,
1741
+ 'aria-hidden': 'true',
1742
+ },
1743
+ React.createElement('path', { d: 'M5 19.5h14' }),
1744
+ React.createElement('path', { d: 'M7 18l-3-3a1.5 1.5 0 0 1 0-2.1l8-8a1.5 1.5 0 0 1 2.1 0l4 4a1.5 1.5 0 0 1 0 2.1l-7 7z' }),
1745
+ React.createElement('path', { d: 'M9.5 6.5l8 8' }),
1746
+ );
1747
+ }
1748
+
1749
+ /** Open the data directory: a folder. */
1750
+ function FolderIcon(props) {
1751
+ const size = Number(props?.size) || 15;
1752
+ return React.createElement(
1753
+ 'svg',
1754
+ {
1755
+ width: size,
1756
+ height: size,
1757
+ viewBox: '0 0 24 24',
1758
+ fill: 'none',
1759
+ stroke: 'currentColor',
1760
+ strokeWidth: 1.8,
1761
+ strokeLinecap: 'round',
1762
+ strokeLinejoin: 'round',
1763
+ className: props?.className,
1764
+ 'aria-hidden': 'true',
1765
+ },
1766
+ React.createElement('path', { d: 'M3 7a2 2 0 0 1 2-2h4.2l2 2H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z' }),
1767
+ );
1768
+ }
1769
+
1770
+ /** Label with a leading icon, matching the quiet-rules rows. */
1771
+ function KeyboardIcon(props) {
1772
+ const size = Number(props?.size) || 15;
1773
+ return React.createElement(
1774
+ 'svg',
1775
+ {
1776
+ width: size,
1777
+ height: size,
1778
+ viewBox: '0 0 24 24',
1779
+ fill: 'none',
1780
+ stroke: 'currentColor',
1781
+ strokeWidth: 1.8,
1782
+ strokeLinecap: 'round',
1783
+ strokeLinejoin: 'round',
1784
+ className: props?.className,
1785
+ 'aria-hidden': 'true',
1786
+ },
1787
+ React.createElement('rect', { x: 3, y: 7, width: 18, height: 10, rx: 2 }),
1788
+ React.createElement('path', { d: 'M6.6 10.3h.01M9.6 10.3h.01M12.6 10.3h.01M15.6 10.3h.01M17.4 10.3h.01M8 13.7h8' }),
1789
+ );
1790
+ }
1791
+
1792
+ function iconLabel(icon, text) {
1793
+ return React.createElement('span', { className: 'ss-fieldicon' }, icon, text);
1794
+ }
1795
+
1232
1796
  function GearIcon(props) {
1233
1797
  const size = Number(props?.size) || 16;
1234
1798
  return React.createElement(
@@ -1725,8 +2289,29 @@ function makeStyles(bridge) {
1725
2289
 
1726
2290
  /* ---------------------------------------------------------------- dialogs */
1727
2291
 
2292
+ function describeSessionErrors(errors, nameById) {
2293
+ return (Array.isArray(errors) ? errors : []).map((item) => {
2294
+ const id = item && (item.sessionId || item.session_id || item.id);
2295
+ const message = (item && (item.message || item.code)) || '';
2296
+ const title = id && nameById ? nameById[id] : '';
2297
+ const label = title ? `${title}(${id})` : id;
2298
+ return label ? `${label} - ${message}` : String(message);
2299
+ });
2300
+ }
2301
+
2302
+ function publishSettingsPatch(patch) {
2303
+ try {
2304
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function') {
2305
+ window.dispatchEvent(new CustomEvent('dsh-keeper:settings', { detail: patch }));
2306
+ }
2307
+ } catch (error) {
2308
+ /* cross-instance sync is best effort */
2309
+ }
2310
+ }
2311
+
1728
2312
  function ConfirmDialog(props) {
1729
- const { t, title, body, confirmLabel, danger, onCancel, onConfirm } = props;
2313
+ const { t, title, body, details, preview, confirmLabel, danger, onCancel, onConfirm } = props;
2314
+ const [expanded, setExpanded] = React.useState(false);
1730
2315
  const cancelRef = React.useRef(null);
1731
2316
  React.useEffect(() => {
1732
2317
  if (cancelRef.current && typeof cancelRef.current.focus === 'function') cancelRef.current.focus();
@@ -1755,6 +2340,45 @@ function ConfirmDialog(props) {
1755
2340
  { className: 'ss-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': title },
1756
2341
  React.createElement('h3', null, title),
1757
2342
  React.createElement('p', null, body),
2343
+ (Array.isArray(details) && details.length > 0) ||
2344
+ (preview && Array.isArray(preview.items) && preview.items.length > 0)
2345
+ ? React.createElement(
2346
+ 'div',
2347
+ { className: 'ss-modalbody' },
2348
+ Array.isArray(details) && details.length > 0
2349
+ ? React.createElement(
2350
+ 'div',
2351
+ { className: 'ss-modaldesc' },
2352
+ details.map((line, index) => React.createElement('div', { key: index }, line)),
2353
+ )
2354
+ : null,
2355
+ preview && Array.isArray(preview.items) && preview.items.length > 0
2356
+ ? React.createElement(
2357
+ 'div',
2358
+ { className: 'ss-modalpreview' },
2359
+ React.createElement(
2360
+ 'div',
2361
+ null,
2362
+ preview.prefix +
2363
+ (expanded
2364
+ ? preview.items.join('、')
2365
+ : preview.items.slice(0, 5).join('、') + (preview.items.length > 5 ? '…' : '')),
2366
+ ),
2367
+ preview.items.length > 5
2368
+ ? React.createElement(
2369
+ 'button',
2370
+ {
2371
+ type: 'button',
2372
+ className: 'ss-previewtoggle',
2373
+ onClick: () => setExpanded((value) => !value),
2374
+ },
2375
+ expanded ? t('previewCollapse') : t('previewExpand').replace('{n}', String(preview.items.length)),
2376
+ )
2377
+ : null,
2378
+ )
2379
+ : null,
2380
+ )
2381
+ : null,
1758
2382
  React.createElement(
1759
2383
  'div',
1760
2384
  { className: 'ss-modalfoot' },
@@ -1798,6 +2422,17 @@ function ExportDialog(props) {
1798
2422
  'div',
1799
2423
  { className: 'ss-modal ss-exportmodal', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('exportDialogTitle') },
1800
2424
  React.createElement('h3', null, t('exportDialogTitle')),
2425
+ React.createElement(
2426
+ 'button',
2427
+ {
2428
+ type: 'button',
2429
+ className: 'ss-modalclose',
2430
+ title: t('close'),
2431
+ 'aria-label': t('close'),
2432
+ onClick: onCancel,
2433
+ },
2434
+ '×',
2435
+ ),
1801
2436
  React.createElement('p', { className: 'ss-dialoghint' }, t('exportDialogHint')),
1802
2437
  React.createElement(
1803
2438
  'div',
@@ -1893,6 +2528,11 @@ function normalizeNotifyLastChannels(value, fallback) {
1893
2528
  return { banner: true, sound: true };
1894
2529
  }
1895
2530
 
2531
+ function normalizeNotifyClock(value, fallback) {
2532
+ const match = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(typeof value === 'string' ? value.trim() : '');
2533
+ return match ? `${match[1]}:${match[2]}` : fallback;
2534
+ }
2535
+
1896
2536
  function normalizeNotifySettings(value) {
1897
2537
  const raw = value && typeof value === 'object' ? value : {};
1898
2538
  const volume = Number(raw.volume);
@@ -1931,6 +2571,15 @@ function normalizeNotifySettings(value) {
1931
2571
  lastChannels,
1932
2572
  volume: Number.isFinite(volume) ? Math.max(0, Math.min(100, Math.round(volume))) : 100,
1933
2573
  sounds,
2574
+ quiet: {
2575
+ enabled: raw.quiet?.enabled === true,
2576
+ start: normalizeNotifyClock(raw.quiet?.start, '22:00'),
2577
+ end: normalizeNotifyClock(raw.quiet?.end, '08:00'),
2578
+ },
2579
+ muteDone: raw.muteDone === true,
2580
+ mutedWorkspaces: Array.isArray(raw.mutedWorkspaces)
2581
+ ? raw.mutedWorkspaces.filter((id) => typeof id === 'string' && id).slice(0, 100)
2582
+ : [],
1934
2583
  openOnClick: raw.openOnClick !== false,
1935
2584
  };
1936
2585
  }
@@ -1939,6 +2588,82 @@ function notifySettingsAreDefault(value) {
1939
2588
  return JSON.stringify(normalizeNotifySettings(value)) === JSON.stringify(normalizeNotifySettings(null));
1940
2589
  }
1941
2590
 
2591
+ /* ------------------------------------------------- notification center log */
2592
+
2593
+ // Local history for the notification center. Bounded and stored in the webview
2594
+ // localStorage so it survives page reloads without touching the host state.
2595
+ const NOTIFY_LOG_KEY = 'dsh-keeper:notify-log';
2596
+ const NOTIFY_LOG_LIMIT = 200;
2597
+
2598
+ function readNotifyLog() {
2599
+ try {
2600
+ if (typeof window === 'undefined' || !window.localStorage) return [];
2601
+ const raw = window.localStorage.getItem(NOTIFY_LOG_KEY);
2602
+ const list = raw ? JSON.parse(raw) : [];
2603
+ return Array.isArray(list) ? list : [];
2604
+ } catch (error) {
2605
+ return [];
2606
+ }
2607
+ }
2608
+
2609
+ function publishNotifyLog(list) {
2610
+ try {
2611
+ if (typeof window === 'undefined') return;
2612
+ window.localStorage.setItem(NOTIFY_LOG_KEY, JSON.stringify(list));
2613
+ window.dispatchEvent(new CustomEvent('dsh-keeper:notify-log', { detail: list }));
2614
+ } catch (error) {
2615
+ /* best effort */
2616
+ }
2617
+ }
2618
+
2619
+ function appendNotifyLog(entry) {
2620
+ const list = readNotifyLog();
2621
+ list.unshift(entry);
2622
+ publishNotifyLog(list.slice(0, NOTIFY_LOG_LIMIT));
2623
+ }
2624
+
2625
+ function markNotifyLogRead(ids) {
2626
+ const wanted = ids ? new Set(ids.map(String)) : null;
2627
+ const next = readNotifyLog().map((item) =>
2628
+ wanted && !wanted.has(String(item.id)) ? item : { ...item, read: true },
2629
+ );
2630
+ publishNotifyLog(next);
2631
+ return next;
2632
+ }
2633
+
2634
+ function clearNotifyLog() {
2635
+ publishNotifyLog([]);
2636
+ }
2637
+
2638
+ function notifyUnreadCount(list) {
2639
+ return (Array.isArray(list) ? list : []).filter((item) => item && item.read !== true).length;
2640
+ }
2641
+
2642
+ function notifyClockMinutes(value) {
2643
+ const match = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(typeof value === 'string' ? value : '');
2644
+ return match ? Number(match[1]) * 60 + Number(match[2]) : null;
2645
+ }
2646
+
2647
+ /** Whether the local clock is inside the configured quiet-hours window. */
2648
+ function notifyQuietActive(quiet) {
2649
+ if (!quiet || quiet.enabled !== true) return false;
2650
+ const start = notifyClockMinutes(quiet.start);
2651
+ const end = notifyClockMinutes(quiet.end);
2652
+ if (start === null || end === null || start === end) return false;
2653
+ const now = new Date();
2654
+ const minutes = now.getHours() * 60 + now.getMinutes();
2655
+ return start < end ? minutes >= start && minutes < end : minutes >= start || minutes < end;
2656
+ }
2657
+
2658
+ /** History records everything; this decides whether a banner/tones are held. */
2659
+ function notifyItemMuted(item, settings) {
2660
+ if (!item) return false;
2661
+ if (settings.muteDone && item.kind === 'done') return true;
2662
+ const muted = Array.isArray(settings.mutedWorkspaces) ? settings.mutedWorkspaces : [];
2663
+ if (item.workspaceId && muted.includes(item.workspaceId)) return true;
2664
+ return notifyQuietActive(settings.quiet);
2665
+ }
2666
+
1942
2667
  function notifySoundGroup(kind) {
1943
2668
  return kind === 'error' || kind === 'stopped' ? 'interrupt' : 'normal';
1944
2669
  }
@@ -2310,6 +3035,9 @@ function startNotifier(bridge, t) {
2310
3035
  let seen = epoch !== '';
2311
3036
  let staleWarned = false;
2312
3037
  let pollCount = 0;
3038
+ // Ids already written to the notification center, so a cursor reset or a
3039
+ // replay after a host restart cannot duplicate rows.
3040
+ const loggedIds = new Set();
2313
3041
  notifyDebug(bridge, 'notifier-start', {
2314
3042
  cursor,
2315
3043
  epoch,
@@ -2411,6 +3139,26 @@ function startNotifier(bridge, t) {
2411
3139
  for (const item of items) {
2412
3140
  if (!item || !item.id) continue;
2413
3141
  if (Number(item.id) > Number(newest)) newest = String(item.id);
3142
+ // The notification center records every event; the mute rules below only
3143
+ // decide whether this one also raises a banner or a tone.
3144
+ const recordKey = String(item.id);
3145
+ const muted = notifyItemMuted(item, settings);
3146
+ if (!loggedIds.has(recordKey)) {
3147
+ loggedIds.add(recordKey);
3148
+ appendNotifyLog({
3149
+ id: recordKey,
3150
+ kind: String(item.kind || ''),
3151
+ sessionId: String(item.sessionId || ''),
3152
+ workspaceId: String(item.workspaceId || ''),
3153
+ title: truncateNotifyText(item.title, 80),
3154
+ workspace: truncateNotifyText(item.workspace, 60),
3155
+ summary: truncateNotifyText(item.summary, 140),
3156
+ at: Number(item.at) || Date.now(),
3157
+ muted,
3158
+ read: false,
3159
+ });
3160
+ }
3161
+ if (muted) continue;
2414
3162
  if (!settings.enabled) continue;
2415
3163
  const kind = item.kind;
2416
3164
  if (kind === 'done' && !settings.onDone) continue;
@@ -2491,79 +3239,736 @@ function startNotifier(bridge, t) {
2491
3239
  showInApp(t('notifyHostStale'));
2492
3240
  }
2493
3241
  }
2494
- };
2495
- void poll();
2496
- timer = setInterval(poll, 2000);
2497
- return () => {
2498
- alive = false;
2499
- notifierStarted = false;
2500
- if (timer) clearInterval(timer);
2501
- };
2502
- }
3242
+ };
3243
+ void poll();
3244
+ timer = setInterval(poll, 2000);
3245
+ return () => {
3246
+ alive = false;
3247
+ notifierStarted = false;
3248
+ if (timer) clearInterval(timer);
3249
+ };
3250
+ }
3251
+
3252
+ /**
3253
+ * `bootstrap` decodes every session log on the host's first call, so keep the
3254
+ * last snapshot at module level: re-entering the panel paints instantly and the
3255
+ * background poll refreshes it (stale-while-revalidate). `apply()` warms the
3256
+ * same promise at startup, which also feeds the hidden-panel CSS.
3257
+ */
3258
+ let bootstrapCache = null;
3259
+ let bootstrapInflight = null;
3260
+
3261
+ function readBootstrapCache() {
3262
+ return bootstrapCache;
3263
+ }
3264
+
3265
+ function loadBootstrap(bridge, options) {
3266
+ const force = options?.force === true;
3267
+ if (!force && bootstrapCache) return Promise.resolve(bootstrapCache);
3268
+ if (bootstrapInflight) return bootstrapInflight;
3269
+ bootstrapInflight = bridge
3270
+ .api('bootstrap', {})
3271
+ .then((value) => {
3272
+ bootstrapCache = value;
3273
+ bootstrapInflight = null;
3274
+ return value;
3275
+ })
3276
+ .catch((error) => {
3277
+ bootstrapInflight = null;
3278
+ throw error;
3279
+ });
3280
+ return bootstrapInflight;
3281
+ }
3282
+
3283
+ /** Layout-identical placeholder so a cold bootstrap never flashes an empty page. */
3284
+ function BootstrapSkeleton() {
3285
+ return React.createElement(
3286
+ 'div',
3287
+ { className: 'ss-pane ss-pane-main ss-skeleton', 'aria-busy': 'true' },
3288
+ React.createElement(
3289
+ 'div',
3290
+ { className: 'ss-skelmeta' },
3291
+ React.createElement('span', { className: 'ss-skel ss-skel-line', style: { width: 78 } }),
3292
+ React.createElement('span', { className: 'ss-skel ss-skel-line', style: { width: 44 } }),
3293
+ ),
3294
+ React.createElement('div', { className: 'ss-skel ss-skel-group' }),
3295
+ [0, 1, 2].map((index) =>
3296
+ React.createElement(
3297
+ 'div',
3298
+ { key: index, className: 'ss-skelrow' },
3299
+ React.createElement('span', { className: 'ss-skel ss-skel-circle' }),
3300
+ React.createElement(
3301
+ 'span',
3302
+ { className: 'ss-skellines' },
3303
+ React.createElement('span', {
3304
+ className: 'ss-skel ss-skel-line',
3305
+ style: { width: index === 1 ? '46%' : '58%' },
3306
+ }),
3307
+ React.createElement('span', {
3308
+ className: 'ss-skel ss-skel-line small',
3309
+ style: { width: '34%' },
3310
+ }),
3311
+ ),
3312
+ ),
3313
+ ),
3314
+ );
3315
+ }
3316
+
3317
+ /* --- quick jump palette (vanilla DOM; react-dom is not available in the plugin bundle) --- */
3318
+
3319
+ const QUICK_JUMP_ID = 'dsh-keeper.quickJump';
3320
+
3321
+ function formatShortcutKeys(keys) {
3322
+ if (!Array.isArray(keys) || keys.length === 0) return '';
3323
+ return keys.filter((key) => key !== '+').join(' + ');
3324
+ }
3325
+
3326
+ function shortcutBindingFromEvent(event, platform) {
3327
+ if (!event || typeof event.code !== 'string' || event.code === '') return null;
3328
+ if (/^(Control|Alt|Shift|Meta|OS)/.test(event.code)) return null;
3329
+ const modifiers = [];
3330
+ if (platform === 'macos') {
3331
+ if (event.metaKey) modifiers.push('primary');
3332
+ if (event.ctrlKey) modifiers.push('control');
3333
+ } else {
3334
+ if (event.ctrlKey) modifiers.push('primary');
3335
+ if (event.metaKey) modifiers.push('meta');
3336
+ }
3337
+ if (event.altKey) modifiers.push('alt');
3338
+ if (event.shiftKey) modifiers.push('shift');
3339
+ if (modifiers.length === 0) return null;
3340
+ return { code: event.code, modifiers };
3341
+ }
3342
+
3343
+ function openPluginTarget(bridge, panelId, close, fallback) {
3344
+ const target = String(panelId || '');
3345
+ if (typeof close === 'function') close();
3346
+ let opened = false;
3347
+ if (target && bridge && typeof bridge.openPanel === 'function') {
3348
+ try {
3349
+ opened = bridge.openPanel(target) === true;
3350
+ } catch {
3351
+ opened = false;
3352
+ }
3353
+ }
3354
+ if (!opened && typeof fallback === 'function') fallback(target);
3355
+ return opened;
3356
+ }
3357
+
3358
+ function createQuickJump(bridge, t) {
3359
+ let root = null;
3360
+ let input = null;
3361
+ let list = null;
3362
+ let panelEl = null;
3363
+ let rows = [];
3364
+ let active = 0;
3365
+ let sessions = [];
3366
+ let workspaces = [];
3367
+ let actions = [];
3368
+ let trashes = [];
3369
+ let plugins = [];
3370
+ let settingsSections = [];
3371
+ let dataDir = '';
3372
+ let chip = 'all';
3373
+ let limit = 12;
3374
+ let loadingTimer = null;
3375
+ let chipsEl = null;
3376
+ const PAGE = 12;
3377
+ const STEP = 10;
3378
+ const MRU_KEY = 'dsh-keeper:qj-mru';
3379
+
3380
+ function readMru() {
3381
+ try {
3382
+ const raw = window.localStorage.getItem(MRU_KEY);
3383
+ const parsed = raw ? JSON.parse(raw) : [];
3384
+ return Array.isArray(parsed) ? parsed.filter((value) => typeof value === 'string') : [];
3385
+ } catch {
3386
+ return [];
3387
+ }
3388
+ }
3389
+
3390
+ function touchMru(id) {
3391
+ const value = String(id ?? '');
3392
+ if (!value) return;
3393
+ try {
3394
+ const next = [value, ...readMru().filter((item) => item !== value)].slice(0, 50);
3395
+ window.localStorage.setItem(MRU_KEY, JSON.stringify(next));
3396
+ } catch {
3397
+ /* best effort */
3398
+ }
3399
+ }
3400
+
3401
+ function sortByMru(list) {
3402
+ const rank = new Map(readMru().map((id, index) => [id, index]));
3403
+ return list
3404
+ .map((row, index) => ({ row, index }))
3405
+ .sort((left, right) => {
3406
+ const leftRank = rank.has(left.row.id) ? rank.get(left.row.id) : Number.MAX_SAFE_INTEGER;
3407
+ const rightRank = rank.has(right.row.id) ? rank.get(right.row.id) : Number.MAX_SAFE_INTEGER;
3408
+ return leftRank - rightRank || left.index - right.index;
3409
+ })
3410
+ .map((entry) => entry.row);
3411
+ }
3412
+
3413
+ function rowChip(row) {
3414
+ if (row.kind === 'session' || row.kind === 'trash') return 'session';
3415
+ if (row.kind === 'plugin') return 'plugin';
3416
+ if (row.kind === 'setting') return 'setting';
3417
+ if (row.kind === 'workspace') return 'workspace';
3418
+ return 'action';
3419
+ }
3420
+
3421
+ function chipOptions() {
3422
+ return [
3423
+ { id: 'all', label: t('quickJumpChipAll') },
3424
+ { id: 'action', label: t('quickJumpChipActions') },
3425
+ { id: 'setting', label: t('quickJumpChipSettings') },
3426
+ { id: 'plugin', label: t('quickJumpChipPlugins') },
3427
+ { id: 'workspace', label: t('quickJumpChipWorkspaces') },
3428
+ { id: 'session', label: t('quickJumpChipSessions') },
3429
+ ];
3430
+ }
3431
+
3432
+ function renderChips() {
3433
+ if (!chipsEl) return;
3434
+ chipsEl.textContent = '';
3435
+ for (const option of chipOptions()) {
3436
+ const button = document.createElement('button');
3437
+ button.type = 'button';
3438
+ button.className = `ss-qj-chip${chip === option.id ? ' on' : ''}`;
3439
+ button.textContent = option.label;
3440
+ button.addEventListener('mousedown', (event) => event.preventDefault());
3441
+ button.addEventListener('click', () => setChip(option.id));
3442
+ chipsEl.append(button);
3443
+ }
3444
+ }
3445
+
3446
+ function setChip(next) {
3447
+ chip = next;
3448
+ limit = PAGE;
3449
+ active = 0;
3450
+ if (panelEl) panelEl.style.height = '';
3451
+ if (input) input.value = '';
3452
+ rows = filterRows('');
3453
+ renderChips();
3454
+ paint();
3455
+ if (input) input.focus();
3456
+ }
3457
+
3458
+ function loadMore() {
3459
+ if (loadingTimer || limit >= rows.length) return;
3460
+ const snapshot = rows;
3461
+ loadingTimer = setTimeout(() => {
3462
+ loadingTimer = null;
3463
+ if (!list || rows !== snapshot) return;
3464
+ const previous = limit;
3465
+ limit = Math.min(rows.length, limit + STEP);
3466
+ const loadingRow = Array.from(list.children).find((child) => child && child.className === 'ss-qj-loading');
3467
+ if (loadingRow) loadingRow.remove();
3468
+ for (let index = previous; index < limit; index += 1) appendRow(rows[index], index);
3469
+ }, 180);
3470
+ showLoadingRow();
3471
+ }
3472
+
3473
+ function onScroll() {
3474
+ if (!list || loadingTimer) return;
3475
+ if (list.clientHeight <= 0) return;
3476
+ if (list.scrollHeight <= list.clientHeight + 8) return;
3477
+ if (list.scrollTop + list.clientHeight < list.scrollHeight - 48) return;
3478
+ loadMore();
3479
+ }
3480
+
3481
+ function onWheel(event) {
3482
+ if (!list || loadingTimer || limit >= rows.length) return;
3483
+ if (event.deltaY <= 0) return;
3484
+ const noScrollbar = list.scrollHeight <= list.clientHeight + 8;
3485
+ const atBottom = list.scrollTop + list.clientHeight >= list.scrollHeight - 8;
3486
+ if (!noScrollbar && !atBottom) return;
3487
+ event.preventDefault();
3488
+ loadMore();
3489
+ }
3490
+
3491
+ function close() {
3492
+ if (!root) return;
3493
+ document.removeEventListener('keydown', onKeyDown, true);
3494
+ if (loadingTimer) clearTimeout(loadingTimer);
3495
+ loadingTimer = null;
3496
+ chipsEl = null;
3497
+ chip = 'all';
3498
+ limit = PAGE;
3499
+ active = 0;
3500
+ root.remove();
3501
+ root = null;
3502
+ input = null;
3503
+ list = null;
3504
+ panelEl = null;
3505
+ rows = [];
3506
+ }
3507
+
3508
+ function openPanelTab(tab, extra) {
3509
+ close();
3510
+ const payload = { tab, ...(extra || {}) };
3511
+ if (typeof bridge.setPendingTab === 'function') bridge.setPendingTab(payload);
3512
+ try {
3513
+ bridge.openPanel(PANEL_ID);
3514
+ window.dispatchEvent(
3515
+ new CustomEvent('dsh-keeper:switch-tab', { detail: payload }),
3516
+ );
3517
+ } catch {
3518
+ /* best effort */
3519
+ }
3520
+ }
3521
+
3522
+ function notify(text) {
3523
+ const value = String(text ?? '').trim();
3524
+ if (!value) return;
3525
+ try {
3526
+ if (typeof document === 'undefined' || !document.body) return;
3527
+ let node = document.getElementById('ss-global-toast');
3528
+ if (!node) {
3529
+ node = document.createElement('div');
3530
+ node.id = 'ss-global-toast';
3531
+ node.className = 'ss-global-toast';
3532
+ node.setAttribute('role', 'status');
3533
+ document.body.appendChild(node);
3534
+ }
3535
+ node.textContent = value;
3536
+ node.classList.add('ss-global-toast-open');
3537
+ clearTimeout(node.__ssTimer);
3538
+ node.__ssTimer = setTimeout(() => node.classList.remove('ss-global-toast-open'), 4600);
3539
+ } catch {
3540
+ /* best effort */
3541
+ }
3542
+ }
3543
+
3544
+ function copySessionId(sessionId) {
3545
+ const id = String(sessionId ?? '');
3546
+ if (!id) return;
3547
+ Promise.resolve()
3548
+ .then(() => bridge.copyText(id))
3549
+ .then(() => notify(t('quickJumpCopied')))
3550
+ .catch(() => notify(t('quickJumpCopied')));
3551
+ }
3552
+
3553
+ async function restoreTrashRow(row) {
3554
+ try {
3555
+ const result = await bridge.api('restoreSessions', { sessionIds: [row.id] });
3556
+ const failure = Array.isArray(result?.errors) ? result.errors[0] : null;
3557
+ if (failure) throw new Error(failure.message || failure.code || 'restore failed');
3558
+ try {
3559
+ window.dispatchEvent(new CustomEvent('dsh-keeper:refresh'));
3560
+ } catch {
3561
+ /* best effort */
3562
+ }
3563
+ notify(t('quickJumpRestored').replace('{name}', row.title));
3564
+ } catch (error) {
3565
+ notify(t('quickJumpRestoreFailed').replace('{message}', String(error?.message ?? error)));
3566
+ }
3567
+ }
3568
+
3569
+ async function openDataDirectory() {
3570
+ try {
3571
+ if (!dataDir) throw new Error(t('quickJumpOpenDataDirFailed'));
3572
+ const value = await bridge.api('openWorkspacePath', { path: dataDir });
3573
+ if (!value || value.opened !== true) throw new Error(t('quickJumpOpenDataDirFailed'));
3574
+ } catch {
3575
+ notify(t('quickJumpOpenDataDirFailed'));
3576
+ }
3577
+ }
3578
+
3579
+ function workspaceRow(workspace) {
3580
+ const title = String(workspace?.title || workspace?.path || workspace?.id || '');
3581
+ return {
3582
+ kind: 'workspace',
3583
+ id: String(workspace?.id ?? ''),
3584
+ title,
3585
+ run: () => openPanelTab('sessions', { query: title }),
3586
+ };
3587
+ }
3588
+
3589
+ function buildActions() {
3590
+ return [
3591
+ { kind: 'action', id: 'tab:sessions', label: t('quickJumpOpenTab').replace('{name}', t('tabSessions')), run: () => openPanelTab('sessions') },
3592
+ { kind: 'action', id: 'tab:notify', label: t('quickJumpOpenTab').replace('{name}', t('tabNotify')), run: () => openPanelTab('notify') },
3593
+ { kind: 'action', id: 'tab:panels', label: t('quickJumpOpenTab').replace('{name}', t('tabPanels')), run: () => openPanelTab('panels') },
3594
+ { kind: 'action', id: 'tab:trash', label: t('quickJumpOpenTab').replace('{name}', t('tabTrash')), run: () => openPanelTab('trash') },
3595
+ {
3596
+ kind: 'action',
3597
+ id: 'settings',
3598
+ label: t('quickJumpSettings'),
3599
+ run: () => {
3600
+ close();
3601
+ try {
3602
+ bridge.openSettings();
3603
+ } catch {
3604
+ /* ignore */
3605
+ }
3606
+ },
3607
+ },
3608
+ { kind: 'action', id: 'notify:read', label: t('quickJumpMarkRead'), run: () => { markNotifyLogRead(); notify(t('quickJumpMarkedRead')); } },
3609
+ { kind: 'action', id: 'notify:clear', label: t('quickJumpClearHistory'), run: () => { clearNotifyLog(); notify(t('quickJumpHistoryCleared')); } },
3610
+ { kind: 'action', id: 'data:open', label: t('quickJumpOpenDataDir'), run: () => { void openDataDirectory(); } },
3611
+ { kind: 'action', id: 'refresh', label: t('quickJumpRefresh'), run: () => { void reload(true); } },
3612
+ ];
3613
+ }
3614
+
3615
+ function kindLabel(row) {
3616
+ if (row.kind === 'session') return t('quickJumpGroupSessions');
3617
+ if (row.kind === 'workspace') return t('quickJumpGroupWorkspaces');
3618
+ if (row.kind === 'trash') return t('quickJumpGroupTrash');
3619
+ if (row.kind === 'plugin') return t('quickJumpGroupPlugins');
3620
+ if (row.kind === 'setting') return t('quickJumpGroupSettings');
3621
+ return t('quickJumpGroupActions');
3622
+ }
3623
+
3624
+ function filterRows(value) {
3625
+ const q = String(value ?? '').trim().toLowerCase();
3626
+ const match = (text) => String(text ?? '').toLowerCase().includes(q);
3627
+ let list;
3628
+ if (!q) {
3629
+ list = [
3630
+ ...actions,
3631
+ ...settingsSections,
3632
+ ...plugins,
3633
+ ...workspaces.map(workspaceRow),
3634
+ ...sessions,
3635
+ ...trashes,
3636
+ ];
3637
+ } else {
3638
+ list = [
3639
+ ...sessions.filter((session) => match(session.title) || match(session.workspaceTitle)).slice(0, 50),
3640
+ ...trashes.filter((row) => match(row.title) || match(row.workspaceTitle)).slice(0, 20),
3641
+ ...plugins.filter((row) => match(row.title) || match(row.panelId) || match(row.registrant)),
3642
+ ...settingsSections.filter((row) => match(row.title) || match(row.sectionId)),
3643
+ ...workspaces.filter((workspace) => match(workspace?.title || workspace?.path || workspace?.id)).map(workspaceRow),
3644
+ ...actions.filter((action) => match(action.label)),
3645
+ ];
3646
+ }
3647
+ if (!q && chip !== 'all') {
3648
+ list = list.filter((row) => rowChip(row) === chip);
3649
+ }
3650
+ return sortByMru(list);
3651
+ }
3652
+
3653
+ function appendRow(row, index) {
3654
+ const item = document.createElement('button');
3655
+ item.type = 'button';
3656
+ item.className = `ss-qj-item${index === active ? ' active' : ''}`;
3657
+ item.setAttribute('role', 'option');
3658
+ item.setAttribute('aria-selected', index === active ? 'true' : 'false');
3659
+ const kind = document.createElement('span');
3660
+ kind.className = 'ss-qj-kind';
3661
+ kind.textContent = kindLabel(row);
3662
+ const label = document.createElement('span');
3663
+ label.className = 'ss-qj-label';
3664
+ label.textContent = row.kind === 'action' ? row.label : row.title;
3665
+ item.append(kind, label);
3666
+ const metaParts = [];
3667
+ if (row.kind === 'session') {
3668
+ if (row.archived) metaParts.push(t('quickJumpArchived'));
3669
+ if (row.parentSession) metaParts.push(t('quickJumpSubagent'));
3670
+ if (row.workspaceTitle) metaParts.push(row.workspaceTitle);
3671
+ } else if (row.kind === 'trash') {
3672
+ metaParts.push(t('quickJumpGroupTrash'));
3673
+ if (row.workspaceTitle) metaParts.push(row.workspaceTitle);
3674
+ } else if (row.kind === 'plugin') {
3675
+ metaParts.push(row.registrant || row.panelId);
3676
+ }
3677
+ if (metaParts.length > 0) {
3678
+ const meta = document.createElement('span');
3679
+ meta.className = 'ss-qj-meta';
3680
+ meta.textContent = metaParts.join(' · ');
3681
+ item.append(meta);
3682
+ }
3683
+ if (row.kind === 'session') {
3684
+ const copy = document.createElement('button');
3685
+ copy.type = 'button';
3686
+ copy.className = 'ss-qj-copy';
3687
+ copy.textContent = 'ID';
3688
+ copy.title = t('quickJumpCopyId');
3689
+ copy.addEventListener('mousedown', (event) => event.stopPropagation());
3690
+ copy.addEventListener('click', (event) => {
3691
+ event.preventDefault();
3692
+ event.stopPropagation();
3693
+ copySessionId(row.id);
3694
+ });
3695
+ item.append(copy);
3696
+ }
3697
+ item.addEventListener('mouseenter', () => {
3698
+ active = index;
3699
+ Array.from(list.children).forEach((child, childIndex) => {
3700
+ if (child instanceof HTMLElement) child.classList.toggle('active', childIndex === index);
3701
+ });
3702
+ });
3703
+ item.addEventListener('click', () => runRow(row));
3704
+ list.append(item);
3705
+ }
3706
+
3707
+ function showLoadingRow() {
3708
+ if (!list) return;
3709
+ if (Array.from(list.children).some((child) => child && child.className === 'ss-qj-loading')) return;
3710
+ const more = document.createElement('div');
3711
+ more.className = 'ss-qj-loading';
3712
+ more.textContent = t('quickJumpLoading');
3713
+ list.append(more);
3714
+ }
3715
+
3716
+ function lockPanelHeight() {
3717
+ if (!panelEl || !list) return;
3718
+ if (panelEl.style.height) return;
3719
+ if (limit !== PAGE || rows.length <= limit) return;
3720
+ const height = panelEl.offsetHeight;
3721
+ if (height > 0) panelEl.style.height = `${height}px`;
3722
+ }
3723
+
3724
+ function paint() {
3725
+ if (!list) return;
3726
+ const scrollTop = list.scrollTop;
3727
+ list.textContent = '';
3728
+ if (rows.length === 0) {
3729
+ const empty = document.createElement('div');
3730
+ empty.className = 'ss-qj-empty';
3731
+ empty.textContent = t('quickJumpEmpty');
3732
+ list.append(empty);
3733
+ lockPanelHeight();
3734
+ return;
3735
+ }
3736
+ rows.slice(0, limit).forEach((row, index) => appendRow(row, index));
3737
+ // Freeze the whole palette height on the first page, so loading more rows
3738
+ // scrolls inside the list instead of growing the panel.
3739
+ lockPanelHeight();
3740
+ if (loadingTimer && rows.length > limit) showLoadingRow();
3741
+ list.scrollTop = scrollTop;
3742
+ }
3743
+
3744
+ function runRow(row) {
3745
+ if (!row) return;
3746
+ touchMru(row.id);
3747
+ if (row.kind === 'session') {
3748
+ close();
3749
+ Promise.resolve(bridge.openSession(row.id)).catch(() => {});
3750
+ return;
3751
+ }
3752
+ if (row.kind === 'trash') {
3753
+ close();
3754
+ void restoreTrashRow(row);
3755
+ return;
3756
+ }
3757
+ if (row.kind === 'plugin') {
3758
+ openPluginTarget(bridge, row.panelId, close, (target) => openPanelTab('panels', { panelQuery: target }));
3759
+ return;
3760
+ }
3761
+ if (row.kind === 'setting') {
3762
+ close();
3763
+ try {
3764
+ if (typeof bridge.openSettingsSection === 'function') bridge.openSettingsSection(row.sectionId);
3765
+ } catch {
3766
+ /* ignore */
3767
+ }
3768
+ return;
3769
+ }
3770
+ row.run();
3771
+ }
3772
+
3773
+ function move(delta) {
3774
+ const visibleCount = Math.min(limit, rows.length);
3775
+ if (visibleCount === 0) return;
3776
+ active = (active + delta + visibleCount) % visibleCount;
3777
+ paint();
3778
+ const current = list && list.children[active];
3779
+ if (current && typeof current.scrollIntoView === 'function') current.scrollIntoView({ block: 'nearest' });
3780
+ }
3781
+
3782
+ function onKeyDown(event) {
3783
+ if (!root) return;
3784
+ if (event.key === 'Escape') {
3785
+ event.preventDefault();
3786
+ event.stopPropagation();
3787
+ close();
3788
+ return;
3789
+ }
3790
+ if (event.key === 'ArrowDown') {
3791
+ event.preventDefault();
3792
+ event.stopPropagation();
3793
+ move(1);
3794
+ return;
3795
+ }
3796
+ if (event.key === 'ArrowUp') {
3797
+ event.preventDefault();
3798
+ event.stopPropagation();
3799
+ move(-1);
3800
+ return;
3801
+ }
3802
+ if (event.key === 'Enter') {
3803
+ event.preventDefault();
3804
+ event.stopPropagation();
3805
+ runRow(rows[active]);
3806
+ }
3807
+ }
2503
3808
 
2504
- /**
2505
- * `bootstrap` decodes every session log on the host's first call, so keep the
2506
- * last snapshot at module level: re-entering the panel paints instantly and the
2507
- * background poll refreshes it (stale-while-revalidate). `apply()` warms the
2508
- * same promise at startup, which also feeds the hidden-panel CSS.
2509
- */
2510
- let bootstrapCache = null;
2511
- let bootstrapInflight = null;
3809
+ function onInput() {
3810
+ active = 0;
3811
+ limit = PAGE;
3812
+ if (panelEl) panelEl.style.height = '';
3813
+ rows = filterRows(input ? input.value : '');
3814
+ paint();
3815
+ }
2512
3816
 
2513
- function readBootstrapCache() {
2514
- return bootstrapCache;
2515
- }
3817
+ async function reload(force) {
3818
+ let boot = null;
3819
+ try {
3820
+ boot = await loadBootstrap(bridge, { force });
3821
+ } catch {
3822
+ boot = null;
3823
+ }
3824
+ const workspaceList = Array.isArray(boot?.workspaces) ? boot.workspaces : [];
3825
+ const sessionList = [];
3826
+ for (const workspace of workspaceList) {
3827
+ for (const session of workspace?.sessions ?? []) {
3828
+ if (!session?.id) continue;
3829
+ sessionList.push({
3830
+ kind: 'session',
3831
+ id: session.id,
3832
+ title: String(session.title || session.id),
3833
+ workspaceId: String(workspace.id ?? ''),
3834
+ workspaceTitle: String(workspace.title || workspace.path || workspace.id || ''),
3835
+ updatedAt: Number(session.updatedAt) || 0,
3836
+ running: session.running === true,
3837
+ archived: session.archived === true,
3838
+ origin: String(session.origin || ''),
3839
+ parentSession: String(session.parentSession || ''),
3840
+ });
3841
+ }
3842
+ }
3843
+ sessionList.sort((left, right) => right.updatedAt - left.updatedAt);
3844
+ const trashList = (Array.isArray(boot?.trash) ? boot.trash : [])
3845
+ .map((entry) => ({
3846
+ kind: 'trash',
3847
+ id: String(entry?.sessionId ?? ''),
3848
+ title: String(entry?.title || entry?.sessionId || ''),
3849
+ workspaceTitle: String(entry?.workspaceTitle || ''),
3850
+ deletedAt: Number(entry?.deletedAt) || 0,
3851
+ }))
3852
+ .filter((row) => row.id !== '');
3853
+ let pluginList = [];
3854
+ try {
3855
+ const panels = typeof bridge?.listPanels === 'function' ? bridge.listPanels() : [];
3856
+ pluginList = (panels ?? [])
3857
+ .filter((panel) => panel && panel.id && panel.id !== PANEL_ID)
3858
+ .map((panel) => ({
3859
+ kind: 'plugin',
3860
+ id: `plugin:${panel.id}`,
3861
+ title: String(panel.label || panel.id),
3862
+ panelId: String(panel.id ?? ''),
3863
+ registrant: String(panel.registrant || ''),
3864
+ }))
3865
+ .sort((left, right) => left.registrant.localeCompare(right.registrant) || left.title.localeCompare(right.title));
3866
+ } catch {
3867
+ pluginList = [];
3868
+ }
3869
+ dataDir = String(boot?.paths?.dataDir ?? '');
3870
+ let sectionList = [];
3871
+ try {
3872
+ const sections = typeof bridge?.listSettingsSections === 'function' ? bridge.listSettingsSections() : [];
3873
+ sectionList = (Array.isArray(sections) ? sections : [])
3874
+ .filter((section) => section && section.id)
3875
+ .map((section) => ({
3876
+ kind: 'setting',
3877
+ id: `setting:${section.id}`,
3878
+ title: String(section.label || section.id),
3879
+ sectionId: String(section.id),
3880
+ }));
3881
+ } catch {
3882
+ sectionList = [];
3883
+ }
3884
+ workspaces = workspaceList;
3885
+ sessions = sessionList;
3886
+ trashes = trashList;
3887
+ plugins = pluginList;
3888
+ settingsSections = sectionList;
3889
+ actions = buildActions();
3890
+ if (input) {
3891
+ rows = filterRows(input.value);
3892
+ paint();
3893
+ }
3894
+ }
2516
3895
 
2517
- function loadBootstrap(bridge, options) {
2518
- const force = options?.force === true;
2519
- if (!force && bootstrapCache) return Promise.resolve(bootstrapCache);
2520
- if (bootstrapInflight) return bootstrapInflight;
2521
- bootstrapInflight = bridge
2522
- .api('bootstrap', {})
2523
- .then((value) => {
2524
- bootstrapCache = value;
2525
- bootstrapInflight = null;
2526
- return value;
2527
- })
2528
- .catch((error) => {
2529
- bootstrapInflight = null;
2530
- throw error;
3896
+ async function open() {
3897
+ if (root) {
3898
+ close();
3899
+ return;
3900
+ }
3901
+ const overlay = document.createElement('div');
3902
+ overlay.className = 'ss-qj-overlay';
3903
+ overlay.addEventListener('mousedown', (event) => {
3904
+ if (event.target === overlay) close();
2531
3905
  });
2532
- return bootstrapInflight;
2533
- }
3906
+ const panel = document.createElement('div');
3907
+ panel.className = 'ss-qj-panel';
3908
+ panelEl = panel;
3909
+ panel.setAttribute('role', 'dialog');
3910
+ panel.setAttribute('aria-modal', 'true');
3911
+ panel.setAttribute('aria-label', t('quickJumpTitle'));
3912
+ const head = document.createElement('div');
3913
+ head.className = 'ss-qj-head';
3914
+ head.textContent = t('quickJumpTitle');
3915
+ const field = document.createElement('input');
3916
+ field.className = 'ss-qj-input';
3917
+ field.type = 'text';
3918
+ field.placeholder = t('quickJumpPlaceholder');
3919
+ field.setAttribute('autocomplete', 'off');
3920
+ field.setAttribute('spellcheck', 'false');
3921
+ const hint = document.createElement('div');
3922
+ hint.className = 'ss-qj-hint';
3923
+ const currentKeys = typeof bridge?.shortcutKeys === 'function' ? bridge.shortcutKeys() : [];
3924
+ const hintParts = String(t('quickJumpHint')).split(/\s*·\s*/).filter(Boolean);
3925
+ const hintActions = document.createElement('div');
3926
+ hintActions.className = 'ss-qj-hintactions';
3927
+ for (const part of hintParts) {
3928
+ const segment = document.createElement('span');
3929
+ segment.textContent = part;
3930
+ hintActions.append(segment);
3931
+ }
3932
+ const keySegment = document.createElement('span');
3933
+ keySegment.className = 'ss-qj-keys';
3934
+ keySegment.title = t('quickJumpKeysHint');
3935
+ keySegment.textContent = Array.isArray(currentKeys) && currentKeys.length > 0
3936
+ ? formatShortcutKeys(currentKeys)
3937
+ : t('quickJumpKeysHint');
3938
+ hint.append(hintActions, keySegment);
3939
+ const container = document.createElement('div');
3940
+ container.className = 'ss-qj-list';
3941
+ container.setAttribute('role', 'listbox');
3942
+ const chips = document.createElement('div');
3943
+ chips.className = 'ss-qj-chips';
3944
+ chips.setAttribute('role', 'tablist');
3945
+ input = field;
3946
+ list = container;
3947
+ chipsEl = chips;
3948
+ chip = 'all';
3949
+ limit = PAGE;
3950
+ active = 0;
3951
+ renderChips();
3952
+ panel.append(head, field, chips, container, hint);
3953
+ overlay.append(panel);
3954
+ root = overlay;
3955
+ document.body.append(overlay);
3956
+ document.addEventListener('keydown', onKeyDown, true);
3957
+ field.addEventListener('input', onInput);
3958
+ container.addEventListener('scroll', onScroll);
3959
+ container.addEventListener('wheel', onWheel, { passive: false });
3960
+ field.focus();
3961
+ await reload(false);
3962
+ setTimeout(() => {
3963
+ lockPanelHeight();
3964
+ }, 0);
3965
+ }
2534
3966
 
2535
- /** Layout-identical placeholder so a cold bootstrap never flashes an empty page. */
2536
- function BootstrapSkeleton() {
2537
- return React.createElement(
2538
- 'div',
2539
- { className: 'ss-pane ss-pane-main ss-skeleton', 'aria-busy': 'true' },
2540
- React.createElement(
2541
- 'div',
2542
- { className: 'ss-skelmeta' },
2543
- React.createElement('span', { className: 'ss-skel ss-skel-line', style: { width: 78 } }),
2544
- React.createElement('span', { className: 'ss-skel ss-skel-line', style: { width: 44 } }),
2545
- ),
2546
- React.createElement('div', { className: 'ss-skel ss-skel-group' }),
2547
- [0, 1, 2].map((index) =>
2548
- React.createElement(
2549
- 'div',
2550
- { key: index, className: 'ss-skelrow' },
2551
- React.createElement('span', { className: 'ss-skel ss-skel-circle' }),
2552
- React.createElement(
2553
- 'span',
2554
- { className: 'ss-skellines' },
2555
- React.createElement('span', {
2556
- className: 'ss-skel ss-skel-line',
2557
- style: { width: index === 1 ? '46%' : '58%' },
2558
- }),
2559
- React.createElement('span', {
2560
- className: 'ss-skel ss-skel-line small',
2561
- style: { width: '34%' },
2562
- }),
2563
- ),
2564
- ),
2565
- ),
2566
- );
3967
+ function toggle() {
3968
+ void open();
3969
+ }
3970
+
3971
+ return { open, close, toggle };
2567
3972
  }
2568
3973
 
2569
3974
  function MainPanel(props) {
@@ -2574,6 +3979,34 @@ function MainPanel(props) {
2574
3979
  const [loadError, setLoadError] = React.useState(null);
2575
3980
  const [busy, setBusy] = React.useState(false);
2576
3981
  const [tab, setTab] = React.useState('sessions');
3982
+ const [qjKeys, setQjKeys] = React.useState(() => (typeof bridge?.shortcutKeys === 'function' ? bridge.shortcutKeys() : []));
3983
+ React.useEffect(() => {
3984
+ if (typeof bridge?.subscribeShortcutKeys !== 'function') return undefined;
3985
+ return bridge.subscribeShortcutKeys((keys) => setQjKeys(Array.isArray(keys) ? keys : []));
3986
+ }, []);
3987
+ React.useEffect(() => {
3988
+ const onSwitchTab = (event) => {
3989
+ const detail = event && event.detail ? event.detail : {};
3990
+ if (typeof detail.tab === 'string') setTab(detail.tab);
3991
+ if (typeof detail.query === 'string') setQuery(detail.query);
3992
+ if (typeof detail.panelQuery === 'string') setPanelQuery(detail.panelQuery);
3993
+ if (typeof bridge?.takePendingTab === 'function') bridge.takePendingTab();
3994
+ };
3995
+ const onRefresh = () => setReloadKey((key) => key + 1);
3996
+ window.addEventListener('dsh-keeper:switch-tab', onSwitchTab);
3997
+ window.addEventListener('dsh-keeper:refresh', onRefresh);
3998
+ return () => {
3999
+ window.removeEventListener('dsh-keeper:switch-tab', onSwitchTab);
4000
+ window.removeEventListener('dsh-keeper:refresh', onRefresh);
4001
+ };
4002
+ }, []);
4003
+ React.useEffect(() => {
4004
+ const pending = typeof bridge?.takePendingTab === 'function' ? bridge.takePendingTab() : null;
4005
+ if (!pending) return;
4006
+ if (typeof pending.tab === 'string') setTab(pending.tab);
4007
+ if (typeof pending.query === 'string') setQuery(pending.query);
4008
+ if (typeof pending.panelQuery === 'string') setPanelQuery(pending.panelQuery);
4009
+ }, []);
2577
4010
  const [query, setQuery] = React.useState('');
2578
4011
  const [panelQuery, setPanelQuery] = React.useState('');
2579
4012
  const [scopeFilter, setScopeFilter] = React.useState('all');
@@ -2605,6 +4038,7 @@ function MainPanel(props) {
2605
4038
  // pointer away restarts the full 5s window.
2606
4039
  const [toastHovered, setToastHovered] = React.useState(false);
2607
4040
  const [confirm, setConfirm] = React.useState(null);
4041
+ const [outcome, setOutcome] = React.useState(null);
2608
4042
  const [tick, setTick] = React.useState(0);
2609
4043
  const [reloadKey, setReloadKey] = React.useState(0);
2610
4044
  const bootJsonRef = React.useRef('');
@@ -2632,6 +4066,45 @@ function MainPanel(props) {
2632
4066
  const notifyFileRef = React.useRef(null);
2633
4067
  const pendingSoundGroupRef = React.useRef('normal');
2634
4068
  const notifySaveTimerRef = React.useRef(null);
4069
+ const [notifyLog, setNotifyLog] = React.useState(() => readNotifyLog());
4070
+
4071
+ React.useEffect(() => {
4072
+ const onLog = (event) => {
4073
+ setNotifyLog(event && Array.isArray(event.detail) ? event.detail : readNotifyLog());
4074
+ };
4075
+ const onStorage = (event) => {
4076
+ if (!event || event.key === NOTIFY_LOG_KEY) setNotifyLog(readNotifyLog());
4077
+ };
4078
+ window.addEventListener('dsh-keeper:notify-log', onLog);
4079
+ window.addEventListener('storage', onStorage);
4080
+ setNotifyLog(readNotifyLog());
4081
+ return () => {
4082
+ window.removeEventListener('dsh-keeper:notify-log', onLog);
4083
+ window.removeEventListener('storage', onStorage);
4084
+ };
4085
+ }, []);
4086
+
4087
+ React.useEffect(() => {
4088
+ if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') return undefined;
4089
+ const onSettings = (event) => {
4090
+ const patch = event && event.detail;
4091
+ if (!patch || typeof patch !== 'object') return;
4092
+ setBoot((previous) => {
4093
+ if (!previous) return previous;
4094
+ const state = previous.state ?? {};
4095
+ const current = state.settings ?? {};
4096
+ const next = { ...current, ...patch };
4097
+ if (patch.notifications) {
4098
+ next.notifications = { ...(current.notifications ?? {}), ...patch.notifications };
4099
+ }
4100
+ return { ...previous, state: { ...state, settings: next } };
4101
+ });
4102
+ };
4103
+ window.addEventListener('dsh-keeper:settings', onSettings);
4104
+ return () => {
4105
+ window.removeEventListener('dsh-keeper:settings', onSettings);
4106
+ };
4107
+ }, []);
2635
4108
 
2636
4109
  const refresh = () => setReloadKey((key) => key + 1);
2637
4110
 
@@ -2912,20 +4385,69 @@ function MainPanel(props) {
2912
4385
  const mode = settings.deleteMode === 'delete' ? 'delete' : 'trash';
2913
4386
  const rows = sessions.filter((session) => ids.includes(session.id));
2914
4387
  const size = rows.reduce((sum, session) => sum + (Number(session.sizeBytes) || 0), 0);
4388
+ const workspaceNames = [
4389
+ ...new Set(
4390
+ rows
4391
+ .map((session) => session.workspaceTitle || session.workspaceId || '')
4392
+ .filter(Boolean),
4393
+ ),
4394
+ ];
4395
+ const details = [];
4396
+ if (workspaceNames.length > 0) {
4397
+ details.push(t('deleteWorkspaces').replace('{names}', workspaceNames.join('、')));
4398
+ }
4399
+ const preview = {
4400
+ prefix: t('deleteSessionList').replace('{names}', ''),
4401
+ items: rows.map((session) => session.title || session.id),
4402
+ };
4403
+ const nameById = Object.fromEntries(rows.map((session) => [session.id, session.title || '']));
2915
4404
 
2916
4405
  if (mode === 'trash') {
2917
- void run(async () => {
2918
- const result = await bridge.api('deleteSessions', { sessionIds: ids, mode: 'trash' });
2919
- const done = (result?.done ?? []).map((item) => item.sessionId);
2920
- const errors = result?.errors ?? [];
2921
- setSelected(new Set());
2922
- if (errors.length > 0) return errors[0].message;
2923
- if (done.length === 0) return '';
2924
- setToast({
2925
- text: t('movedToTrash').replace('{n}', String(done.length)),
2926
- undoValue: { kind: 'restore', ids: done },
4406
+ const runTrash = () =>
4407
+ run(async () => {
4408
+ const result = await bridge.api('deleteSessions', { sessionIds: ids, mode: 'trash' });
4409
+ const done = (result?.done ?? []).map((item) => item.sessionId);
4410
+ const errors = result?.errors ?? [];
4411
+ setSelected(new Set());
4412
+ if (errors.length > 0) {
4413
+ if (done.length > 0) {
4414
+ setToast({
4415
+ text: t('movedToTrash').replace('{n}', String(done.length)),
4416
+ undoValue: { kind: 'restore', ids: done },
4417
+ });
4418
+ }
4419
+ setOutcome({
4420
+ title: t('deleteFailedTitle'),
4421
+ body: t('deletePartial')
4422
+ .replace('{ok}', String(done.length))
4423
+ .replace('{fail}', String(errors.length)),
4424
+ details: describeSessionErrors(errors, nameById),
4425
+ });
4426
+ return '';
4427
+ }
4428
+ if (done.length === 0) return '';
4429
+ setToast({
4430
+ text: t('movedToTrash').replace('{n}', String(done.length)),
4431
+ undoValue: { kind: 'restore', ids: done },
4432
+ });
4433
+ return '';
2927
4434
  });
2928
- return '';
4435
+ if (!settings.confirmPurge) {
4436
+ void runTrash();
4437
+ return;
4438
+ }
4439
+ setConfirm({
4440
+ title: t('confirmTrashTitle'),
4441
+ body: t('confirmTrashBody')
4442
+ .replace('{n}', String(rows.length || ids.length))
4443
+ .replace('{size}', fmtBytes(size)),
4444
+ details,
4445
+ preview,
4446
+ confirmLabel: t('moveToTrash'),
4447
+ onConfirm: async () => {
4448
+ setConfirm(null);
4449
+ await runTrash();
4450
+ },
2929
4451
  });
2930
4452
  return;
2931
4453
  }
@@ -2937,7 +4459,13 @@ function MainPanel(props) {
2937
4459
  const errors = result?.errors ?? [];
2938
4460
  setSelected(new Set());
2939
4461
  if (errors.length > 0) {
2940
- setToast({ text: errors[0].message });
4462
+ setOutcome({
4463
+ title: t('deleteFailedTitle'),
4464
+ body: t('deletePartial')
4465
+ .replace('{ok}', String(done.length))
4466
+ .replace('{fail}', String(errors.length)),
4467
+ details: describeSessionErrors(errors, nameById),
4468
+ });
2941
4469
  return '';
2942
4470
  }
2943
4471
  if (done.length === 0) return '';
@@ -2952,6 +4480,8 @@ function MainPanel(props) {
2952
4480
  body: t('confirmDeleteBody')
2953
4481
  .replace('{n}', String(rows.length || ids.length))
2954
4482
  .replace('{size}', fmtBytes(size)),
4483
+ details,
4484
+ preview,
2955
4485
  danger: true,
2956
4486
  onConfirm: async () => {
2957
4487
  setConfirm(null);
@@ -3031,11 +4561,32 @@ function MainPanel(props) {
3031
4561
  const purgeFromTrash = (ids) => {
3032
4562
  const rows = trash.filter((entry) => ids.includes(entry.sessionId));
3033
4563
  const size = rows.reduce((sum, entry) => sum + (Number(entry.sizeBytes) || 0), 0);
4564
+ const workspaceNames = [
4565
+ ...new Set(rows.map((entry) => entry.workspaceTitle || entry.workspaceId || '').filter(Boolean)),
4566
+ ];
4567
+ const details = [];
4568
+ if (workspaceNames.length > 0) {
4569
+ details.push(t('deleteWorkspaces').replace('{names}', workspaceNames.join('、')));
4570
+ }
4571
+ const preview = {
4572
+ prefix: t('purgeSessionList').replace('{names}', ''),
4573
+ items: rows.map((entry) => entry.title || entry.sessionId),
4574
+ };
4575
+ const nameById = Object.fromEntries(rows.map((entry) => [entry.sessionId, entry.title || '']));
3034
4576
  const runPurge = () =>
3035
4577
  run(async () => {
3036
4578
  const result = await bridge.api('purgeSessions', { sessionIds: ids });
3037
4579
  const done = (result?.done ?? []).length;
4580
+ const errors = result?.errors ?? [];
3038
4581
  setSelected(new Set());
4582
+ if (errors.length > 0) {
4583
+ setOutcome({
4584
+ title: t('purgeFailedTitle'),
4585
+ body: t('purgePartial').replace('{ok}', String(done)).replace('{fail}', String(errors.length)),
4586
+ details: describeSessionErrors(errors, nameById),
4587
+ });
4588
+ return '';
4589
+ }
3039
4590
  return t('purgedMsg').replace('{n}', String(done));
3040
4591
  });
3041
4592
  if (!settings.confirmPurge) {
@@ -3045,6 +4596,8 @@ function MainPanel(props) {
3045
4596
  setConfirm({
3046
4597
  title: t('confirmPurgeTitle'),
3047
4598
  body: t('confirmPurgeBody').replace('{n}', String(rows.length)).replace('{size}', fmtBytes(size)),
4599
+ details,
4600
+ preview,
3048
4601
  danger: true,
3049
4602
  onConfirm: async () => {
3050
4603
  setConfirm(null);
@@ -3055,17 +4608,46 @@ function MainPanel(props) {
3055
4608
 
3056
4609
  const emptyTrash = () => {
3057
4610
  if (trash.length === 0) return;
4611
+ const workspaceNames = [
4612
+ ...new Set(trash.map((entry) => entry.workspaceTitle || entry.workspaceId || '').filter(Boolean)),
4613
+ ];
4614
+ const details = [];
4615
+ if (workspaceNames.length > 0) {
4616
+ details.push(t('deleteWorkspaces').replace('{names}', workspaceNames.join('、')));
4617
+ }
4618
+ const preview = {
4619
+ prefix: t('purgeSessionList').replace('{names}', ''),
4620
+ items: trash.map((entry) => entry.title || entry.sessionId),
4621
+ };
4622
+ const nameById = Object.fromEntries(trash.map((entry) => [entry.sessionId, entry.title || '']));
4623
+ const runEmpty = () =>
4624
+ run(async () => {
4625
+ const result = await bridge.api('emptyTrash', {});
4626
+ const done = (result?.done ?? []).length;
4627
+ const errors = result?.errors ?? [];
4628
+ if (errors.length > 0) {
4629
+ setOutcome({
4630
+ title: t('purgeFailedTitle'),
4631
+ body: t('purgePartial').replace('{ok}', String(done)).replace('{fail}', String(errors.length)),
4632
+ details: describeSessionErrors(errors, nameById),
4633
+ });
4634
+ return '';
4635
+ }
4636
+ return t('purgedMsg').replace('{n}', String(done));
4637
+ });
4638
+ if (!settings.confirmPurge) {
4639
+ void runEmpty();
4640
+ return;
4641
+ }
3058
4642
  setConfirm({
3059
4643
  title: t('confirmEmptyTitle'),
3060
4644
  body: t('confirmEmptyBody').replace('{n}', String(trash.length)).replace('{size}', fmtBytes(trashSize)),
4645
+ details,
4646
+ preview,
3061
4647
  danger: true,
3062
4648
  onConfirm: async () => {
3063
4649
  setConfirm(null);
3064
- await run(async () => {
3065
- const result = await bridge.api('emptyTrash', {});
3066
- const done = (result?.done ?? []).length;
3067
- return t('purgedMsg').replace('{n}', String(done));
3068
- });
4650
+ await runEmpty();
3069
4651
  },
3070
4652
  });
3071
4653
  };
@@ -3075,7 +4657,15 @@ function MainPanel(props) {
3075
4657
  const result = await bridge.api('cleanBlankSessions', {});
3076
4658
  const done = (result?.done ?? []).filter((item) => !item.detachedOnly).map((item) => item.sessionId);
3077
4659
  const errors = result?.errors ?? [];
3078
- if (errors.length > 0) return errors[0].message;
4660
+ const nameById = Object.fromEntries(blankSessions.map((session) => [session.id, session.title || '']));
4661
+ if (errors.length > 0) {
4662
+ setOutcome({
4663
+ title: t('deleteFailedTitle'),
4664
+ body: t('cleanPartial').replace('{ok}', String(done.length)).replace('{fail}', String(errors.length)),
4665
+ details: describeSessionErrors(errors, nameById),
4666
+ });
4667
+ return '';
4668
+ }
3079
4669
  if (done.length === 0) return '';
3080
4670
  setToast({
3081
4671
  text: t('cleanedMsg').replace('{n}', String(done.length)),
@@ -3091,9 +4681,29 @@ function MainPanel(props) {
3091
4681
 
3092
4682
  const askCleanBlank = () => {
3093
4683
  if (blankSessions.length === 0) return;
4684
+ const size = blankSessions.reduce((sum, session) => sum + (Number(session.sizeBytes) || 0), 0);
4685
+ const workspaceNames = [
4686
+ ...new Set(blankSessions.map((session) => session.workspaceTitle || session.workspaceId || '').filter(Boolean)),
4687
+ ];
4688
+ const details = [];
4689
+ if (workspaceNames.length > 0) {
4690
+ details.push(t('deleteWorkspaces').replace('{names}', workspaceNames.join('、')));
4691
+ }
4692
+ const preview = {
4693
+ prefix: t('deleteSessionList').replace('{names}', ''),
4694
+ items: blankSessions.map((session) => session.title || session.id),
4695
+ };
4696
+ if (!settings.confirmPurge) {
4697
+ void cleanBlank();
4698
+ return;
4699
+ }
3094
4700
  setConfirm({
3095
4701
  title: t('cleanBlankConfirmTitle'),
3096
- body: t('cleanBlankConfirmBody').replace('{n}', String(blankSessions.length)),
4702
+ body: t('cleanBlankConfirmBody')
4703
+ .replace('{n}', String(blankSessions.length))
4704
+ .replace('{size}', fmtBytes(size)),
4705
+ details,
4706
+ preview,
3097
4707
  onConfirm: async () => {
3098
4708
  setConfirm(null);
3099
4709
  await cleanBlank();
@@ -3530,6 +5140,19 @@ function MainPanel(props) {
3530
5140
  : null,
3531
5141
  ),
3532
5142
  React.createElement('button', { type: 'button', className: 'ss-btn quiet', disabled: busy, onClick: refresh }, t('refresh')),
5143
+ React.createElement(
5144
+ 'button',
5145
+ {
5146
+ type: 'button',
5147
+ className: 'ss-btn quiet',
5148
+ title: t('quickJumpKeysHint'),
5149
+ onClick: () => {
5150
+ if (bridge && typeof bridge.quickJump === 'function') bridge.quickJump();
5151
+ },
5152
+ },
5153
+ t('quickJump'),
5154
+ qjKeys.length > 0 ? React.createElement('kbd', { className: 'ss-kbd' }, formatShortcutKeys(qjKeys)) : null,
5155
+ ),
3533
5156
  React.createElement(
3534
5157
  'button',
3535
5158
  {
@@ -3572,6 +5195,30 @@ function MainPanel(props) {
3572
5195
  React.Fragment,
3573
5196
  null,
3574
5197
  React.createElement('b', null, t('selectedN').replace('{n}', String(selected.size))),
5198
+ React.createElement(
5199
+ 'span',
5200
+ null,
5201
+ fmtBytes(
5202
+ sessions
5203
+ .filter((session) => selected.has(session.id))
5204
+ .reduce((sum, session) => sum + (Number(session.sizeBytes) || 0), 0),
5205
+ ),
5206
+ ),
5207
+ React.createElement(
5208
+ 'span',
5209
+ null,
5210
+ t('workspacesN').replace(
5211
+ '{n}',
5212
+ String(
5213
+ new Set(
5214
+ sessions
5215
+ .filter((session) => selected.has(session.id))
5216
+ .map((session) => session.workspaceTitle || session.workspaceId || '')
5217
+ .filter(Boolean),
5218
+ ).size,
5219
+ ),
5220
+ ),
5221
+ ),
3575
5222
  React.createElement(
3576
5223
  Tip,
3577
5224
  { text: t('archiveSessionHint') },
@@ -3579,8 +5226,21 @@ function MainPanel(props) {
3579
5226
  ),
3580
5227
  React.createElement(
3581
5228
  Tip,
3582
- { text: listDeleteHint },
3583
- React.createElement('button', { type: 'button', className: 'ss-btn tiny', disabled: busy, onClick: () => deleteSessionsFromList([...selected]) }, listDeleteLabel),
5229
+ {
5230
+ text: sessions.some((session) => selected.has(session.id) && session.running)
5231
+ ? t('runningHint')
5232
+ : listDeleteHint,
5233
+ },
5234
+ React.createElement(
5235
+ 'button',
5236
+ {
5237
+ type: 'button',
5238
+ className: 'ss-btn tiny',
5239
+ disabled: busy || sessions.some((session) => selected.has(session.id) && session.running),
5240
+ onClick: () => deleteSessionsFromList([...selected]),
5241
+ },
5242
+ listDeleteLabel,
5243
+ ),
3584
5244
  ),
3585
5245
  )
3586
5246
  : React.createElement(
@@ -5188,6 +6848,7 @@ function MainPanel(props) {
5188
6848
  // The footer reset applies to the whole page, so it is only actionable once
5189
6849
  // at least one option differs from the defaults.
5190
6850
  const notifyDefaults = notifySettingsAreDefault(notifySettings);
6851
+ const quiet = notifySettings.quiet || { enabled: false, start: '22:00', end: '08:00' };
5191
6852
  const row = (label, hint, control, style) =>
5192
6853
  React.createElement(
5193
6854
  'div',
@@ -5243,11 +6904,11 @@ function MainPanel(props) {
5243
6904
  );
5244
6905
  // Channel switches sit stacked at the right edge of the "提醒方式" row:
5245
6906
  // label on the left of each switch, both switches right-aligned together.
5246
- const channelSwitch = (checked, label, hint, onChange) =>
6907
+ const channelSwitch = (checked, label, hint, onChange, icon) =>
5247
6908
  React.createElement(
5248
6909
  'div',
5249
6910
  { className: 'ss-channel' },
5250
- React.createElement('span', { className: 'ss-channellabel' }, label),
6911
+ React.createElement('span', { className: 'ss-channellabel' }, icon || null, label),
5251
6912
  React.createElement(Switch, {
5252
6913
  checked,
5253
6914
  label,
@@ -5283,12 +6944,14 @@ function MainPanel(props) {
5283
6944
  t('notifyChannelBanner'),
5284
6945
  t('notifySystemHint'),
5285
6946
  (value) => setChannel('banner', value),
6947
+ React.createElement(BannerIcon),
5286
6948
  );
5287
6949
  const soundChannel = channelSwitch(
5288
6950
  notifySettings.sound !== 'none',
5289
6951
  t('notifyChannelSound'),
5290
6952
  t('notifySoundHint'),
5291
6953
  (value) => setChannel('sound', value),
6954
+ React.createElement(SpeakerIcon),
5292
6955
  );
5293
6956
  const soundRow = (group, label) => {
5294
6957
  const entry = notifySettings.sounds[group] || { name: '' };
@@ -5331,32 +6994,125 @@ function MainPanel(props) {
5331
6994
  onClick: () => pickNotifySound(group),
5332
6995
  disabled: notifyBusy,
5333
6996
  },
5334
- React.createElement(UploadIcon, { size: 15 }),
5335
- ),
6997
+ React.createElement(UploadIcon, { size: 15 }),
6998
+ ),
6999
+ ),
7000
+ entry.name
7001
+ ? React.createElement(
7002
+ Tip,
7003
+ { text: t('notifySoundClear') },
7004
+ React.createElement(
7005
+ 'button',
7006
+ {
7007
+ type: 'button',
7008
+ className: 'ss-iconbtn ss-soundbtn',
7009
+ onClick: () => clearNotifySound(group),
7010
+ disabled: notifyBusy,
7011
+ },
7012
+ React.createElement(ResetIcon, { size: 15 }),
7013
+ ),
7014
+ )
7015
+ : null,
7016
+ ),
7017
+ );
7018
+ };
7019
+ return React.createElement(
7020
+ 'div',
7021
+ null,
7022
+ React.createElement('div', { className: 'ss-hint ss-notifyintro' }, t('notifySubtitle')),
7023
+ React.createElement(
7024
+ 'div',
7025
+ { className: 'ss-card ss-notifycard' },
7026
+ React.createElement(
7027
+ 'h4',
7028
+ null,
7029
+ t('notifyCenter'),
7030
+ notifyUnreadCount(notifyLog) > 0
7031
+ ? React.createElement(
7032
+ 'span',
7033
+ { className: 'ss-notifycount' },
7034
+ ' · ',
7035
+ t('notifyUnreadN').split('{n}')[0],
7036
+ React.createElement('b', null, String(notifyUnreadCount(notifyLog))),
7037
+ t('notifyUnreadN').split('{n}')[1],
7038
+ )
7039
+ : null,
7040
+ ),
7041
+ React.createElement('div', { className: 'ss-hint' }, t('notifyCenterHint')),
7042
+ notifyLog.length === 0
7043
+ ? React.createElement('div', { className: 'ss-hint ss-notifylogempty' }, t('notifyCenterEmpty'))
7044
+ : React.createElement(
7045
+ 'div',
7046
+ { className: 'ss-notifylog' },
7047
+ notifyLog.slice(0, 30).map((item) =>
7048
+ React.createElement(
7049
+ 'button',
7050
+ {
7051
+ key: item.id,
7052
+ type: 'button',
7053
+ className: 'ss-notifylogrow' + (item.read === true ? '' : ' unread'),
7054
+ onClick: () => {
7055
+ markNotifyLogRead([item.id]);
7056
+ setNotifyLog(readNotifyLog());
7057
+ if (item.sessionId) openSessionSafe(item.sessionId);
7058
+ },
7059
+ },
7060
+ React.createElement(
7061
+ 'span',
7062
+ { className: 'ss-notifylogkind' },
7063
+ item.kind === 'done'
7064
+ ? t('notifyDone')
7065
+ : item.kind === 'ask'
7066
+ ? t('notifyAsk')
7067
+ : t('notifyInterrupt'),
7068
+ ),
7069
+ React.createElement(
7070
+ 'span',
7071
+ { className: 'ss-notifylogbody' },
7072
+ React.createElement(
7073
+ 'span',
7074
+ { className: 'ss-notifylogtitle' },
7075
+ item.title || item.sessionId || '',
7076
+ ),
7077
+ item.workspace ? React.createElement('span', { className: 'ss-notifylogws' }, item.workspace) : null,
7078
+ item.summary ? React.createElement('span', { className: 'ss-notifylogsum' }, item.summary) : null,
7079
+ ),
7080
+ item.muted ? React.createElement('span', { className: 'ss-badge ss-notifylogmuted' }, t('notifyMutedTag')) : null,
7081
+ React.createElement('span', { className: 'ss-notifylogtime' }, fmtWhen(item.at)),
7082
+ ),
7083
+ ),
7084
+ ),
7085
+ React.createElement(
7086
+ 'div',
7087
+ { className: 'ss-notifyactions' },
7088
+ React.createElement(
7089
+ 'button',
7090
+ {
7091
+ type: 'button',
7092
+ className: 'ss-btn quiet',
7093
+ disabled: notifyLog.length === 0,
7094
+ onClick: () => {
7095
+ markNotifyLogRead();
7096
+ setNotifyLog(readNotifyLog());
7097
+ },
7098
+ },
7099
+ t('notifyMarkAllRead'),
7100
+ ),
7101
+ React.createElement(
7102
+ 'button',
7103
+ {
7104
+ type: 'button',
7105
+ className: 'ss-btn quiet',
7106
+ disabled: notifyLog.length === 0,
7107
+ onClick: () => {
7108
+ clearNotifyLog();
7109
+ setNotifyLog(readNotifyLog());
7110
+ },
7111
+ },
7112
+ t('notifyClearHistory'),
5336
7113
  ),
5337
- entry.name
5338
- ? React.createElement(
5339
- Tip,
5340
- { text: t('notifySoundClear') },
5341
- React.createElement(
5342
- 'button',
5343
- {
5344
- type: 'button',
5345
- className: 'ss-iconbtn ss-soundbtn',
5346
- onClick: () => clearNotifySound(group),
5347
- disabled: notifyBusy,
5348
- },
5349
- React.createElement(ResetIcon, { size: 15 }),
5350
- ),
5351
- )
5352
- : null,
5353
7114
  ),
5354
- );
5355
- };
5356
- return React.createElement(
5357
- 'div',
5358
- null,
5359
- React.createElement('div', { className: 'ss-hint ss-notifyintro' }, t('notifySubtitle')),
7115
+ ),
5360
7116
  React.createElement(
5361
7117
  'div',
5362
7118
  { className: 'ss-card ss-notifycard' },
@@ -5390,7 +7146,16 @@ function MainPanel(props) {
5390
7146
  'div',
5391
7147
  { className: 'ss-card ss-notifycard' },
5392
7148
  React.createElement('h4', null, t('notifyTitle')),
5393
- toggleText('enabled', t('notifyEnabled'), t('notifyEnabledHint'), setMaster),
7149
+ row(
7150
+ iconLabel(React.createElement(BellIcon), t('notifyEnabled')),
7151
+ t('notifyEnabledHint'),
7152
+ React.createElement(Switch, {
7153
+ checked: notifySettings.enabled === true,
7154
+ label: t('notifyEnabled'),
7155
+ disabled: notifyBusy,
7156
+ onChange: setMaster,
7157
+ }),
7158
+ ),
5394
7159
  row(
5395
7160
  t('notifyChannels'),
5396
7161
  t('notifyChannelsHint'),
@@ -5451,14 +7216,119 @@ function MainPanel(props) {
5451
7216
  { className: 'ss-subhead ss-behaviorsub' },
5452
7217
  t('notifyBehavior'),
5453
7218
  ),
5454
- togglePlain(
5455
- 'openOnClick',
5456
- t('notifyOpenOnClick'),
7219
+ row(
7220
+ iconLabel(React.createElement(ExternalLinkIcon), t('notifyOpenOnClick')),
5457
7221
  t('notifyOpenOnClickHint'),
5458
- false,
5459
- notifySettings.enabled && notifySettings.openOnClick,
7222
+ React.createElement(Switch, {
7223
+ checked: notifySettings.enabled && notifySettings.openOnClick,
7224
+ label: t('notifyOpenOnClick'),
7225
+ disabled: notifyBusy,
7226
+ onChange: (value) => updateNotify({ openOnClick: value }),
7227
+ }),
7228
+ ),
7229
+ ),
7230
+ ),
7231
+ React.createElement(
7232
+ 'div',
7233
+ { className: 'ss-card ss-notifycard ss-quietcard' },
7234
+ React.createElement('h4', null, t('quietTitle')),
7235
+ row(
7236
+ React.createElement(
7237
+ 'span',
7238
+ { className: 'ss-fieldicon' },
7239
+ React.createElement(MoonIcon),
7240
+ t('quietEnabled'),
7241
+ ),
7242
+ t('quietEnabledHint'),
7243
+ React.createElement(Switch, {
7244
+ checked: quiet.enabled,
7245
+ label: t('quietEnabled'),
7246
+ disabled: notifyBusy,
7247
+ onChange: (value) => updateNotify({ quiet: { ...quiet, enabled: value } }),
7248
+ }),
7249
+ { borderBottom: 'none', paddingBottom: '6px' },
7250
+ ),
7251
+ React.createElement(
7252
+ Collapse,
7253
+ { open: quiet.enabled },
7254
+ React.createElement(
7255
+ 'div',
7256
+ { className: 'ss-notifytimes' },
7257
+ React.createElement(
7258
+ 'label',
7259
+ { className: 'ss-notifytime' },
7260
+ React.createElement('span', null, t('quietStart')),
7261
+ React.createElement('input', {
7262
+ type: 'time',
7263
+ value: quiet.start,
7264
+ disabled: notifyBusy,
7265
+ onChange: (event) => updateNotify({ quiet: { ...quiet, start: event.target.value } }),
7266
+ }),
7267
+ ),
7268
+ React.createElement(
7269
+ 'label',
7270
+ { className: 'ss-notifytime' },
7271
+ React.createElement('span', null, t('quietEnd')),
7272
+ React.createElement('input', {
7273
+ type: 'time',
7274
+ value: quiet.end,
7275
+ disabled: notifyBusy,
7276
+ onChange: (event) => updateNotify({ quiet: { ...quiet, end: event.target.value } }),
7277
+ }),
7278
+ ),
7279
+ ),
7280
+ ),
7281
+ React.createElement('div', { className: 'ss-quiettimesep' }),
7282
+ row(
7283
+ React.createElement(
7284
+ 'span',
7285
+ { className: 'ss-fieldicon' },
7286
+ React.createElement(BellOffIcon),
7287
+ t('muteDone'),
7288
+ ),
7289
+ t('muteDoneHint'),
7290
+ React.createElement(Switch, {
7291
+ checked: notifySettings.muteDone === true,
7292
+ label: t('muteDone'),
7293
+ disabled: notifyBusy,
7294
+ onChange: (value) => updateNotify({ muteDone: value }),
7295
+ }),
7296
+ ),
7297
+ row(
7298
+ React.createElement(
7299
+ 'span',
7300
+ { className: 'ss-fieldicon' },
7301
+ React.createElement(FolderOffIcon),
7302
+ t('muteWorkspaces'),
5460
7303
  ),
7304
+ t('muteWorkspacesHint'),
7305
+ null,
7306
+ { borderBottom: 'none', paddingBottom: '8px' },
5461
7307
  ),
7308
+ (boot && Array.isArray(boot.workspaces) ? boot.workspaces : []).length === 0
7309
+ ? React.createElement('div', { className: 'ss-hint' }, t('noWorkspaces'))
7310
+ : React.createElement(
7311
+ 'div',
7312
+ { className: 'ss-mutelist' },
7313
+ (boot.workspaces || []).map((workspace) =>
7314
+ React.createElement(
7315
+ 'label',
7316
+ { key: workspace.id, className: 'ss-muteworkspace' },
7317
+ React.createElement('input', {
7318
+ type: 'checkbox',
7319
+ checked: notifySettings.mutedWorkspaces.includes(workspace.id),
7320
+ disabled: notifyBusy,
7321
+ onChange: (event) => {
7322
+ const set = new Set(notifySettings.mutedWorkspaces);
7323
+ if (event.target.checked) set.add(workspace.id);
7324
+ else set.delete(workspace.id);
7325
+ updateNotify({ mutedWorkspaces: [...set] });
7326
+ },
7327
+ }),
7328
+ workspace.title || workspace.name || workspace.id,
7329
+ ),
7330
+ ),
7331
+ ),
5462
7332
  ),
5463
7333
  React.createElement(
5464
7334
  'div',
@@ -5484,7 +7354,7 @@ function MainPanel(props) {
5484
7354
 
5485
7355
  const tabs = [
5486
7356
  { id: 'sessions', label: `${t('tabSessions')} (${sessions.length})` },
5487
- { id: 'notify', label: t('tabNotify') },
7357
+ { id: 'notify', label: notifyUnreadCount(notifyLog) > 0 ? `${t('tabNotify')} (${notifyUnreadCount(notifyLog)})` : t('tabNotify') },
5488
7358
  { id: 'panels', label: t('tabPanels') },
5489
7359
  { id: 'trash', label: `${t('tabTrash')} (${trash.length})` },
5490
7360
  ];
@@ -5624,11 +7494,24 @@ function MainPanel(props) {
5624
7494
  t,
5625
7495
  title: confirm.title,
5626
7496
  body: confirm.body,
7497
+ details: confirm.details ?? null,
7498
+ preview: confirm.preview ?? null,
5627
7499
  danger: confirm.danger === true,
5628
7500
  onCancel: () => setConfirm(null),
5629
7501
  onConfirm: confirm.onConfirm,
5630
7502
  })
5631
7503
  : null,
7504
+ outcome
7505
+ ? React.createElement(ConfirmDialog, {
7506
+ t,
7507
+ title: outcome.title,
7508
+ body: outcome.body,
7509
+ details: outcome.details ?? null,
7510
+ confirmLabel: t('close'),
7511
+ onCancel: () => setOutcome(null),
7512
+ onConfirm: () => setOutcome(null),
7513
+ })
7514
+ : null,
5632
7515
  exportTarget
5633
7516
  ? React.createElement(ExportDialog, {
5634
7517
  t,
@@ -5678,6 +7561,7 @@ function SettingsPage(props) {
5678
7561
  const [error, setError] = React.useState(null);
5679
7562
  const [busy, setBusy] = React.useState(false);
5680
7563
  const [toast, setToast] = React.useState(null);
7564
+ const [confirm, setConfirm] = React.useState(null);
5681
7565
  const [reloadKey, setReloadKey] = React.useState(0);
5682
7566
 
5683
7567
  React.useEffect(() => {
@@ -5709,8 +7593,9 @@ function SettingsPage(props) {
5709
7593
  const deleteMode = settings.deleteMode === 'delete' ? 'delete' : 'trash';
5710
7594
  const hidden = new Set(boot?.state?.hiddenPanels ?? []);
5711
7595
  const paths = boot?.paths ?? {};
5712
- const version = boot?.version ?? '0.1.4';
5713
- const trashCount = Array.isArray(boot?.trash) ? boot.trash.length : 0;
7596
+ const version = boot?.version ?? '0.1.6';
7597
+ const trash = Array.isArray(boot?.trash) ? boot.trash : [];
7598
+ const trashCount = trash.length;
5714
7599
 
5715
7600
  const call = async (work, message) => {
5716
7601
  setBusy(true);
@@ -5728,6 +7613,7 @@ function SettingsPage(props) {
5728
7613
  const saveSettings = (patch) =>
5729
7614
  call(async () => {
5730
7615
  await bridge.api('saveSettings', { settings: patch });
7616
+ publishSettingsPatch(patch);
5731
7617
  }, t('settingsSaved'));
5732
7618
 
5733
7619
  const setConfirmPurge = (value) => saveSettings({ confirmPurge: value });
@@ -5761,6 +7647,108 @@ function SettingsPage(props) {
5761
7647
  bridge.applyHide([...next], bridge.listPanels());
5762
7648
  }, t('panelsSaved'));
5763
7649
 
7650
+ const [qjKeys, setQjKeys] = React.useState(() => (typeof bridge?.shortcutKeys === 'function' ? bridge.shortcutKeys() : []));
7651
+ React.useEffect(() => {
7652
+ if (typeof bridge?.subscribeShortcutKeys !== 'function') return undefined;
7653
+ return bridge.subscribeShortcutKeys((keys) => setQjKeys(Array.isArray(keys) ? keys : []));
7654
+ }, []);
7655
+ const [recordingShortcut, setRecordingShortcut] = React.useState(false);
7656
+ const [shortcutCleared, setShortcutCleared] = React.useState(false);
7657
+ const refreshShortcutKeys = () => {
7658
+ if (typeof bridge?.shortcutKeys !== 'function') return;
7659
+ const next = bridge.shortcutKeys();
7660
+ setQjKeys(Array.isArray(next) ? next : []);
7661
+ };
7662
+ const stopShortcutRecording = () => {
7663
+ setRecordingShortcut(false);
7664
+ if (typeof bridge?.setShortcutRecording === 'function') void bridge.setShortcutRecording(false);
7665
+ };
7666
+ React.useEffect(() => {
7667
+ if (!recordingShortcut) return undefined;
7668
+ if (typeof bridge?.setShortcutRecording === 'function') void bridge.setShortcutRecording(true);
7669
+ const onKey = (event) => {
7670
+ if (event.key === 'Escape') {
7671
+ event.preventDefault();
7672
+ event.stopImmediatePropagation();
7673
+ stopShortcutRecording();
7674
+ return;
7675
+ }
7676
+ if (['Control', 'Alt', 'Shift', 'Meta', 'OS'].includes(event.key)) return;
7677
+ event.preventDefault();
7678
+ event.stopImmediatePropagation();
7679
+ const binding = shortcutBindingFromEvent(
7680
+ event,
7681
+ typeof bridge?.shortcutPlatform === 'function' ? bridge.shortcutPlatform() : 'windows',
7682
+ );
7683
+ if (!binding) {
7684
+ setToast({ text: t('shortcutRecordModifier') });
7685
+ return;
7686
+ }
7687
+ const info = typeof bridge?.describeShortcut === 'function' ? bridge.describeShortcut(binding) : null;
7688
+ if (!info || info.issue) {
7689
+ setToast({ text: t('shortcutRecordInvalid').replace('{reason}', String(info?.issue ?? 'invalid')) });
7690
+ return;
7691
+ }
7692
+ if (Array.isArray(info.conflicts) && info.conflicts.length > 0) {
7693
+ setToast({ text: t('shortcutRecordConflict').replace('{names}', info.conflicts.join('、')) });
7694
+ return;
7695
+ }
7696
+ if (typeof bridge?.saveShortcut !== 'function') {
7697
+ setToast({ text: t('shortcutSaveFailed').replace('{message}', 'unsupported') });
7698
+ stopShortcutRecording();
7699
+ return;
7700
+ }
7701
+ void bridge.saveShortcut(binding).then(
7702
+ () => {
7703
+ stopShortcutRecording();
7704
+ setShortcutCleared(false);
7705
+ refreshShortcutKeys();
7706
+ setToast({ text: t('shortcutSaved') });
7707
+ },
7708
+ (error) => {
7709
+ stopShortcutRecording();
7710
+ setToast({ text: t('shortcutSaveFailed').replace('{message}', String(error?.message ?? error)) });
7711
+ },
7712
+ );
7713
+ };
7714
+ window.addEventListener('keydown', onKey, true);
7715
+ const onPointerDown = (event) => {
7716
+ const target = event.target;
7717
+ if (target && typeof target.closest === 'function' && target.closest('.ss-kbdbtn')) return;
7718
+ stopShortcutRecording();
7719
+ };
7720
+ window.addEventListener('mousedown', onPointerDown, true);
7721
+ return () => {
7722
+ window.removeEventListener('keydown', onKey, true);
7723
+ window.removeEventListener('mousedown', onPointerDown, true);
7724
+ if (typeof bridge?.setShortcutRecording === 'function') void bridge.setShortcutRecording(false);
7725
+ };
7726
+ }, [recordingShortcut]);
7727
+ const clearShortcut = () => {
7728
+ if (recordingShortcut || busy || typeof bridge?.saveShortcut !== 'function') return;
7729
+ void bridge.saveShortcut(null).then(
7730
+ () => {
7731
+ setShortcutCleared(true);
7732
+ refreshShortcutKeys();
7733
+ setToast({ text: t('shortcutCleared') });
7734
+ },
7735
+ (error) => setToast({ text: t('shortcutSaveFailed').replace('{message}', String(error?.message ?? error)) }),
7736
+ );
7737
+ };
7738
+ const resetShortcutDefault = () => {
7739
+ if (busy || typeof bridge?.resetShortcut !== 'function') return;
7740
+ stopShortcutRecording();
7741
+ void bridge.resetShortcut().then(
7742
+ () => {
7743
+ setShortcutCleared(false);
7744
+ refreshShortcutKeys();
7745
+ setTimeout(refreshShortcutKeys, 120);
7746
+ setToast({ text: t('shortcutResetDone') });
7747
+ },
7748
+ (error) => setToast({ text: t('shortcutSaveFailed').replace('{message}', String(error?.message ?? error)) }),
7749
+ );
7750
+ };
7751
+
5764
7752
  const resetSettings = () =>
5765
7753
  call(async () => {
5766
7754
  await bridge.api('resetSettings', {});
@@ -5772,10 +7760,56 @@ function SettingsPage(props) {
5772
7760
  bridge.applyHide([], bridge.listPanels());
5773
7761
  }, t('panelsSaved'));
5774
7762
 
5775
- const emptyTrashNow = () =>
5776
- call(async () => {
5777
- await bridge.api('emptyTrash', {});
5778
- }, t('trashEmptied'));
7763
+ const emptyTrashNow = () => {
7764
+ if (busy || trash.length === 0) return;
7765
+ const size = trash.reduce((sum, entry) => sum + (Number(entry.sizeBytes) || 0), 0);
7766
+ const workspaceNames = [...new Set(trash.map((entry) => entry.workspaceTitle || entry.workspaceId || '').filter(Boolean))];
7767
+ const details = [];
7768
+ if (workspaceNames.length > 0) {
7769
+ details.push(React.createElement('div', null, t('deleteWorkspaces').replace('{names}', workspaceNames.join('、'))));
7770
+ }
7771
+ const preview = {
7772
+ prefix: t('purgeSessionList').replace('{names}', ''),
7773
+ items: trash.map((entry) => entry.title || entry.sessionId),
7774
+ };
7775
+ const runEmpty = async () => {
7776
+ setBusy(true);
7777
+ try {
7778
+ const result = await bridge.api('emptyTrash', {});
7779
+ const errors = result?.errors ?? [];
7780
+ if (errors.length > 0) {
7781
+ const done = (result?.done ?? []).length;
7782
+ setToast({
7783
+ text: t('purgePartial')
7784
+ .replace('{ok}', String(done))
7785
+ .replace('{fail}', String(errors.length)),
7786
+ });
7787
+ } else {
7788
+ setToast({ text: t('trashEmptied') });
7789
+ }
7790
+ setReloadKey((key) => key + 1);
7791
+ } catch (callError) {
7792
+ setToast({ text: callError?.message || String(callError) });
7793
+ } finally {
7794
+ setBusy(false);
7795
+ }
7796
+ };
7797
+ if (!settings.confirmPurge) {
7798
+ void runEmpty();
7799
+ return;
7800
+ }
7801
+ setConfirm({
7802
+ title: t('confirmEmptyTitle'),
7803
+ body: t('confirmEmptyBody').replace('{n}', String(trash.length)).replace('{size}', fmtBytes(size)),
7804
+ details,
7805
+ preview,
7806
+ danger: true,
7807
+ onConfirm: () => {
7808
+ setConfirm(null);
7809
+ void runEmpty();
7810
+ },
7811
+ });
7812
+ };
5779
7813
 
5780
7814
  const field = (label, hint, control) =>
5781
7815
  React.createElement(
@@ -5815,7 +7849,7 @@ function SettingsPage(props) {
5815
7849
  'div',
5816
7850
  null,
5817
7851
  field(
5818
- t('defaultDeleteMode'),
7852
+ iconLabel(React.createElement(TrashIcon), t('defaultDeleteMode')),
5819
7853
  t('deleteModeHint'),
5820
7854
  React.createElement(
5821
7855
  'div',
@@ -5840,7 +7874,7 @@ function SettingsPage(props) {
5840
7874
  ),
5841
7875
  ),
5842
7876
  field(
5843
- t('confirmPurgeLabel'),
7877
+ iconLabel(React.createElement(ShieldIcon), t('confirmPurgeLabel')),
5844
7878
  t('confirmPurgeHint'),
5845
7879
  React.createElement(Switch, {
5846
7880
  checked: settings.confirmPurge !== false,
@@ -5850,7 +7884,68 @@ function SettingsPage(props) {
5850
7884
  }),
5851
7885
  ),
5852
7886
  field(
5853
- t('entryVisible'),
7887
+ iconLabel(React.createElement(KeyboardIcon), t('shortcutTitle')),
7888
+ t('shortcutHint'),
7889
+ React.createElement(
7890
+ 'span',
7891
+ { className: `ss-kbdrow${shortcutCleared ? ' is-cleared' : ''}` },
7892
+ React.createElement(
7893
+ 'span',
7894
+ {
7895
+ role: 'button',
7896
+ tabIndex: 0,
7897
+ className: `ss-kbdbtn${recordingShortcut ? ' recording' : ''}`,
7898
+ title: qjKeys.length > 0 ? '' : (typeof bridge?.shortcutError === 'function' ? bridge.shortcutError() : ''),
7899
+ onClick: () => {
7900
+ if (recordingShortcut) return;
7901
+ setRecordingShortcut(true);
7902
+ },
7903
+ onKeyDown: (event) => {
7904
+ if (event.key === 'Enter' || event.key === ' ') {
7905
+ event.preventDefault();
7906
+ if (!recordingShortcut) setRecordingShortcut(true);
7907
+ }
7908
+ },
7909
+ },
7910
+ React.createElement(
7911
+ 'span',
7912
+ { className: 'ss-kbdtext' },
7913
+ recordingShortcut
7914
+ ? t('shortcutRecording')
7915
+ : (qjKeys.length > 0 ? formatShortcutKeys(qjKeys) : t('shortcutEmptyText')),
7916
+ ),
7917
+ !recordingShortcut && qjKeys.length > 0
7918
+ ? React.createElement(
7919
+ 'button',
7920
+ {
7921
+ type: 'button',
7922
+ className: 'ss-kbdclear',
7923
+ 'aria-label': t('shortcutClear'),
7924
+ title: t('shortcutClear'),
7925
+ onClick: (event) => {
7926
+ event.stopPropagation();
7927
+ clearShortcut();
7928
+ },
7929
+ },
7930
+ '×',
7931
+ )
7932
+ : null,
7933
+ ),
7934
+ React.createElement(
7935
+ 'button',
7936
+ {
7937
+ type: 'button',
7938
+ className: `ss-btn ghost ss-kbdreset${shortcutCleared ? ' is-on' : ''}`,
7939
+ disabled: !shortcutCleared,
7940
+ 'aria-hidden': !shortcutCleared,
7941
+ onClick: resetShortcutDefault,
7942
+ },
7943
+ t('shortcutReset'),
7944
+ ),
7945
+ ),
7946
+ ),
7947
+ field(
7948
+ iconLabel(React.createElement(SidebarIcon), t('entryVisible')),
5854
7949
  t('entryVisibleHint'),
5855
7950
  React.createElement(Switch, {
5856
7951
  checked: !hidden.has(PANEL_ID),
@@ -5860,7 +7955,7 @@ function SettingsPage(props) {
5860
7955
  }),
5861
7956
  ),
5862
7957
  field(
5863
- t('exportDefaultFormat'),
7958
+ iconLabel(React.createElement(ExportFileIcon), t('exportDefaultFormat')),
5864
7959
  t('exportDefaultFormatHint'),
5865
7960
  React.createElement(
5866
7961
  'div',
@@ -5882,7 +7977,7 @@ function SettingsPage(props) {
5882
7977
  ),
5883
7978
  ),
5884
7979
  field(
5885
- t('clearTranslationCache'),
7980
+ iconLabel(React.createElement(EraserIcon), t('clearTranslationCache')),
5886
7981
  t('clearTranslationCacheHint'),
5887
7982
  React.createElement(
5888
7983
  'button',
@@ -5891,7 +7986,7 @@ function SettingsPage(props) {
5891
7986
  ),
5892
7987
  ),
5893
7988
  field(
5894
- t('openDataDir'),
7989
+ iconLabel(React.createElement(FolderIcon), t('openDataDir')),
5895
7990
  t('openDataDirHint'),
5896
7991
  React.createElement(
5897
7992
  'button',
@@ -5900,7 +7995,7 @@ function SettingsPage(props) {
5900
7995
  ),
5901
7996
  ),
5902
7997
  field(
5903
- t('tabTrash'),
7998
+ iconLabel(React.createElement(TrashIcon), t('tabTrash')),
5904
7999
  trashCount > 0 ? t('trashHint') : t('emptyTrashDisabled'),
5905
8000
  React.createElement(
5906
8001
  'button',
@@ -5932,6 +8027,19 @@ function SettingsPage(props) {
5932
8027
  React.createElement('div', { className: 'ss-mono' }, String(paths.sessionsRoot ?? '')),
5933
8028
  ),
5934
8029
  ),
8030
+ confirm
8031
+ ? React.createElement(ConfirmDialog, {
8032
+ t,
8033
+ title: confirm.title,
8034
+ body: confirm.body,
8035
+ details: confirm.details,
8036
+ preview: confirm.preview,
8037
+ danger: confirm.danger === true,
8038
+ confirmLabel: confirm.confirmLabel,
8039
+ onCancel: () => setConfirm(null),
8040
+ onConfirm: confirm.onConfirm,
8041
+ })
8042
+ : null,
5935
8043
  toast ? React.createElement(Toast, { text: toast.text }) : null,
5936
8044
  ),
5937
8045
  );
@@ -6185,6 +8293,37 @@ function apply(ctx) {
6185
8293
  .sort((a, b) => a.order - b.order || a.label.localeCompare(b.label));
6186
8294
  };
6187
8295
 
8296
+ const listSettingsSections = () => {
8297
+ let entries = [];
8298
+ try {
8299
+ if (ctx.slots && typeof ctx.slots.entries === 'function') {
8300
+ entries = ctx.slots.entries('settings.section') ?? [];
8301
+ }
8302
+ } catch {
8303
+ entries = [];
8304
+ }
8305
+ if ((!Array.isArray(entries) || entries.length === 0) && ctx.slots && typeof ctx.slots.entriesOfSlot === 'function') {
8306
+ try {
8307
+ entries = ctx.slots.entriesOfSlot('settings.section') ?? [];
8308
+ } catch {
8309
+ entries = [];
8310
+ }
8311
+ }
8312
+ const locale = getLocaleId();
8313
+ return entries
8314
+ .map((entry) => {
8315
+ const options = entry && typeof entry === 'object' && entry.options ? entry.options : entry;
8316
+ const id = String(options?.id ?? '');
8317
+ return {
8318
+ id,
8319
+ order: Number(options?.order ?? 100),
8320
+ label: resolveLabel(options, t, locale) || id,
8321
+ };
8322
+ })
8323
+ .filter((section) => section.id !== '')
8324
+ .sort((a, b) => a.order - b.order || a.label.localeCompare(b.label));
8325
+ };
8326
+
6188
8327
  let lastHidden = [];
6189
8328
 
6190
8329
  const applyHide = (hiddenIds, panels) => {
@@ -6366,6 +8505,30 @@ function apply(ctx) {
6366
8505
  }
6367
8506
  };
6368
8507
 
8508
+ const openSettingsSection = (sectionId) => {
8509
+ const id = String(sectionId || '');
8510
+ if (!id) return false;
8511
+ try {
8512
+ const slots = ctx.slots;
8513
+ const entries = slots && typeof slots.entriesOfSlot === 'function' ? slots.entriesOfSlot('sidebar.settings') : null;
8514
+ const entry = (entries || []).find((candidate) => candidate && candidate.store !== undefined);
8515
+ const host = slots && typeof slots.hostFace === 'function' ? slots.hostFace() : null;
8516
+ const store = host && typeof host.storeOf === 'function' && entry ? host.storeOf(entry) : null;
8517
+ const actions = store && store.actions;
8518
+ if (actions && typeof actions.openSection === 'function') {
8519
+ actions.openSection(id);
8520
+ return true;
8521
+ }
8522
+ if (actions && typeof actions.open === 'function') {
8523
+ actions.open();
8524
+ return true;
8525
+ }
8526
+ } catch (error) {
8527
+ console.warn('[dsh-keeper] settings section route unavailable:', error);
8528
+ }
8529
+ return false;
8530
+ };
8531
+
6369
8532
  // Remember which plugins owned a sidebar panel, so a plugin disabled at
6370
8533
  // runtime can keep its row (and Enable button) even after a page reload.
6371
8534
  const PANEL_MEMORY_KEY = 'dsh-keeper:panel-memory';
@@ -6386,21 +8549,201 @@ function apply(ctx) {
6386
8549
  }
6387
8550
  };
6388
8551
 
8552
+ let quickJump = null;
8553
+ let quickJumpShortcuts = null;
8554
+ let quickJumpShortcutError = '';
8555
+ let quickJumpRecording = false;
8556
+ let pendingTabSwitch = null;
8557
+ const quickJumpKeyListeners = new Set();
8558
+ const readQuickJumpKeys = () => {
8559
+ try {
8560
+ const entries = quickJumpShortcuts && typeof quickJumpShortcuts.catalog?.getSnapshot === 'function'
8561
+ ? quickJumpShortcuts.catalog.getSnapshot()
8562
+ : null;
8563
+ const row = Array.isArray(entries) ? entries.find((entry) => entry && entry.id === QUICK_JUMP_ID) : null;
8564
+ return Array.isArray(row?.keys) ? row.keys : [];
8565
+ } catch (error) {
8566
+ return [];
8567
+ }
8568
+ };
8569
+ const publishQuickJumpKeys = () => {
8570
+ const keys = readQuickJumpKeys();
8571
+ for (const listener of quickJumpKeyListeners) {
8572
+ try {
8573
+ listener(keys);
8574
+ } catch (error) {
8575
+ /* ignore listener errors */
8576
+ }
8577
+ }
8578
+ };
8579
+
6389
8580
  const bridge = {
6390
8581
  api,
6391
8582
  listPanels,
8583
+ listSettingsSections,
6392
8584
  getLocaleId,
6393
8585
  openPanel,
8586
+ openSettingsSection,
8587
+ setPendingTab: (payload) => {
8588
+ pendingTabSwitch = payload && typeof payload === 'object' ? payload : null;
8589
+ },
8590
+ takePendingTab: () => {
8591
+ const value = pendingTabSwitch;
8592
+ pendingTabSwitch = null;
8593
+ return value;
8594
+ },
6394
8595
  openSettings,
6395
8596
  copyText,
6396
8597
  applyHide,
6397
8598
  subscribePanels,
6398
8599
  hasForeignMoreRows,
6399
8600
  openSession,
8601
+ quickJump: () => {
8602
+ if (quickJump) quickJump.toggle();
8603
+ },
8604
+ shortcutKeys: readQuickJumpKeys,
8605
+ shortcutError: () => quickJumpShortcutError,
8606
+ shortcutPlatform: () => {
8607
+ try {
8608
+ return quickJumpShortcuts && typeof quickJumpShortcuts.platform === 'string'
8609
+ ? quickJumpShortcuts.platform
8610
+ : 'windows';
8611
+ } catch (error) {
8612
+ return 'windows';
8613
+ }
8614
+ },
8615
+ describeShortcut: (binding) => {
8616
+ try {
8617
+ if (!quickJumpShortcuts || typeof quickJumpShortcuts.describeBinding !== 'function') return null;
8618
+ const info = quickJumpShortcuts.describeBinding(binding);
8619
+ if (!info) return null;
8620
+ const conflicts = Array.isArray(info.conflicts)
8621
+ ? info.conflicts.filter((id) => id !== QUICK_JUMP_ID)
8622
+ : [];
8623
+ return { ...info, conflicts };
8624
+ } catch (error) {
8625
+ return null;
8626
+ }
8627
+ },
8628
+ saveShortcut: async (binding) => {
8629
+ const shortcuts = quickJumpShortcuts;
8630
+ if (!shortcuts || typeof shortcuts.edit !== 'function') throw new Error('shortcut service unavailable');
8631
+ const snapshot = shortcuts.config && typeof shortcuts.config.getSnapshot === 'function'
8632
+ ? shortcuts.config.getSnapshot()
8633
+ : null;
8634
+ if (!snapshot || snapshot.revision === undefined) throw new Error('shortcut config unavailable');
8635
+ const result = await shortcuts.edit({ type: 'set', id: QUICK_JUMP_ID, binding }, snapshot.revision);
8636
+ if (result && result.status === 'saved') return result;
8637
+ const reason = result && result.issue
8638
+ ? String(result.issue)
8639
+ : result && Array.isArray(result.conflicts) && result.conflicts.length > 0
8640
+ ? result.conflicts.join(',')
8641
+ : String((result && result.status) || 'unknown');
8642
+ throw new Error(reason);
8643
+ },
8644
+ resetShortcut: async () => {
8645
+ if (!quickJumpShortcuts || typeof quickJumpShortcuts.edit !== 'function') {
8646
+ throw new Error(quickJumpShortcutError || 'shortcut service unavailable');
8647
+ }
8648
+ const snapshot = quickJumpShortcuts.config?.getSnapshot?.();
8649
+ const revision = snapshot?.revision;
8650
+ if (revision === undefined) throw new Error('shortcut config not ready');
8651
+ const result = await quickJumpShortcuts.edit({ type: 'reset', id: QUICK_JUMP_ID }, revision);
8652
+ if (!result || result.status !== 'saved') {
8653
+ throw new Error(
8654
+ result?.issue
8655
+ ?? (result?.conflicts?.length ? `conflicts: ${result.conflicts.join(', ')}` : result?.status ?? 'reset failed'),
8656
+ );
8657
+ }
8658
+ return result;
8659
+ },
8660
+ setShortcutRecording: (active) => {
8661
+ quickJumpRecording = active === true;
8662
+ try {
8663
+ if (quickJumpShortcuts && typeof quickJumpShortcuts.recording === 'function') {
8664
+ return Promise.resolve(quickJumpShortcuts.recording(active === true)).catch(() => {});
8665
+ }
8666
+ } catch (error) {
8667
+ /* ignore */
8668
+ }
8669
+ return Promise.resolve();
8670
+ },
8671
+ subscribeShortcutKeys: (listener) => {
8672
+ if (typeof listener !== 'function') return () => {};
8673
+ quickJumpKeyListeners.add(listener);
8674
+ listener(readQuickJumpKeys());
8675
+ return () => quickJumpKeyListeners.delete(listener);
8676
+ },
6400
8677
  panelMemory: readPanelMemory(),
6401
8678
  rememberPanels: writePanelMemory,
6402
8679
  ...makeStyles(),
6403
8680
  };
8681
+ quickJump = createQuickJump(bridge, t);
8682
+
8683
+ // Session-wide quick jump: Ctrl+Alt+K (Cmd+Option+K on macOS) on desktop.
8684
+ // On Web the host registers Ctrl+Alt+K for its sidebar search, so Web keeps
8685
+ // Ctrl+Alt+J to avoid a shortcut conflict. Web/Linux only admits
8686
+ // Slash/Comma/Period defaults, so no web:linux binding is declared.
8687
+ try {
8688
+ if (typeof ctx.inject === 'function') {
8689
+ ctx.inject(['shortcuts'], (scope) => {
8690
+ scope.effect(() => {
8691
+ const shortcuts = scope.shortcuts;
8692
+ if (!shortcuts || typeof shortcuts.register !== 'function') return () => {};
8693
+ quickJumpShortcuts = shortcuts;
8694
+ const defaults = {
8695
+ 'desktop:macos': { code: 'KeyK', modifiers: ['primary', 'alt'] },
8696
+ 'desktop:windows': { code: 'KeyK', modifiers: ['primary', 'alt'] },
8697
+ 'desktop:linux': { code: 'KeyK', modifiers: ['primary', 'alt'] },
8698
+ 'web:macos': { code: 'KeyJ', modifiers: ['primary', 'alt'] },
8699
+ 'web:windows': { code: 'KeyJ', modifiers: ['primary', 'alt'] },
8700
+ };
8701
+ let dispose = () => {};
8702
+ try {
8703
+ dispose = shortcuts.register({
8704
+ id: QUICK_JUMP_ID,
8705
+ label: () => t('quickJump'),
8706
+ aliases: ['jump', 'quick jump', '快速跳转', 'palette'],
8707
+ defaults,
8708
+ regions: ['page', 'editable'],
8709
+ modals: [],
8710
+ resolve: () => (quickJumpRecording
8711
+ ? { status: 'pass' }
8712
+ : {
8713
+ status: 'handled',
8714
+ run: () => {
8715
+ if (quickJump) quickJump.toggle();
8716
+ },
8717
+ }),
8718
+ });
8719
+ quickJumpShortcutError = '';
8720
+ } catch (error) {
8721
+ quickJumpShortcutError = String(error?.message ?? error);
8722
+ console.warn('[dsh-keeper] quick jump shortcut registration failed:', error);
8723
+ }
8724
+ const offCatalog = shortcuts.catalog && typeof shortcuts.catalog.subscribe === 'function'
8725
+ ? shortcuts.catalog.subscribe(() => publishQuickJumpKeys())
8726
+ : () => {};
8727
+ publishQuickJumpKeys();
8728
+ return () => {
8729
+ try {
8730
+ dispose();
8731
+ } catch (error) {
8732
+ /* ignore */
8733
+ }
8734
+ try {
8735
+ offCatalog();
8736
+ } catch (error) {
8737
+ /* ignore */
8738
+ }
8739
+ quickJumpShortcuts = null;
8740
+ };
8741
+ }, 'dsh-keeper: quick jump shortcut');
8742
+ });
8743
+ }
8744
+ } catch (error) {
8745
+ console.warn('[dsh-keeper] quick jump shortcut unavailable:', error);
8746
+ }
6404
8747
 
6405
8748
  /** Register without taking the whole plugin down if a host lacks a slot. */
6406
8749
  const safeRegister = (options, component) => {