dsh-enhance 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/lib/client.js +705 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,18 +11,26 @@ DeepSeek Harness(DSH)增强插件:Markdown 主题统一、划词批注、
|
|
|
11
11
|
- 每行右侧可编辑(弹窗)或删除,胶囊右侧一键清空
|
|
12
12
|
- 已批注段落在正文保留带序号的蓝色圆标(图钉与编号合为一个图标),点击圆标直接编辑该批注,并在正文保持该段落的高亮
|
|
13
13
|
- 编辑弹窗内可直接删除该批注
|
|
14
|
-
-
|
|
14
|
+
- 有批注挂起时发送按钮即刻可用,而输入框保持空白;发送瞬间才把批注拼进消息,每条编号为一项,分 `Selected text` 与 `User comment` 两块(无说明时只发引文那块)
|
|
15
15
|
- 弹窗输入框无内边距、贴合面板,高度随内容自动增长且不出现滚动条
|
|
16
16
|
- **侧栏提问** — 从同一面板把段落送到右侧栏的侧边对话,不打断当前对话。首次创建,之后复用同一标签页。
|
|
17
17
|
- **文件右键菜单** — 在对话消息里的文件链接(含行内代码形式的文件引用)上右键,弹出跟随深浅主题的菜单:用默认应用打开、打开方式(列出系统为该登记的应用)、另存为、复制路径、复制文件内容、在 Finder 中显示。打开/打开方式/Finder 定位走宿主 `ctx.remote.session.openWorkspacePath`,应用清单走 `workspacePathApplications`,读取内容走鉴权路由 `GET /api/file?path=`。路径取文件链接的 `title`,相对路径按当前会话 `cwd` 补全;另存为从 `/api/file` 取得字节后优先调用 `showSaveFilePicker`,不支持时退化为浏览器下载(DSH 未提供原生保存对话框)。
|
|
18
18
|
- **网页链接右键菜单** — 在对话消息里的普通 HTTP(S) 链接上右键,弹出「打开方式」菜单:新标签页、新窗口、默认浏览器、复制链接、链接另存为…。新标签页优先打开宿主内置浏览器页签(`ctx.sidebarRight.openTab('browser', { url })`,未启用该页签时回退到新窗口);新窗口用浏览器弹窗;默认浏览器交给系统(桌面端主窗口把 `window.open` 的 http(s) 交给系统浏览器);链接另存为通过 `fetch` 取数据后以 `download` 下载,受跨域限制时提示无法下载。两个菜单都只在会话正文内拦截右键,其它位置保留宿主原生菜单;点击别处、滚动、Esc、失焦、窗口缩放都会关闭它。
|
|
19
19
|
- **侧栏更窄** — 侧栏可拖到 214px(上游限制 264px),文字相应缩小一档;文件夹图标换成展开/收起三角,文件夹标题与会话标题同字号、左端对齐。
|
|
20
|
-
- **面板图标置顶** — Plugins /
|
|
21
|
-
- **插件图标也置顶** — 新装的插件如果把图标注册到侧栏底部(`sidebar.footer.action
|
|
20
|
+
- **面板图标置顶** — Plugins / 自动化等面板图标移到侧栏顶部、工作区列表之上,并排成一行;一行放几个由侧栏宽度决定,放不下就换行。上游是带文字的竖排列表,此前本插件把它放在右下角。只改位置与排版,宿主的选中态、悬停态和那个「更多」菜单都照旧。悬停和选中时的底统一成 36×36 的正方形:宿主按钮左右各有 3px 透明边,背景又画在内边距盒上,同样是 36px 的按钮底只剩 30×36;搬上来的插件按钮没有这条边,底是正方的。
|
|
21
|
+
- **插件图标也置顶** — 新装的插件如果把图标注册到侧栏底部(`sidebar.footer.action`,比如「远程访问」的电话图标),它的按钮会被搬进同一行顶部列表,跟着侧栏宽度一起换行。搬的是宿主自己的容器而不是插件的按钮,所以插件自己的选中态、悬停态和弹层都照常工作;折叠成图标轨时交回宿主布局。
|
|
22
|
+
- **这一行只显示图标** — 顶部图标行里的每个按钮只留图标,文字一律不显示:宿主面板的标题本来就已隐藏,插件自己带进这一行的标签(比如「远程访问」那个图标旁边的「Remote」)也被去掉——标签按形状识别(这一段里没有图标的内容就是文字),不写死插件的类名。按钮的 `title`/`aria-label` 原样保留,悬停和读屏仍能认出是哪个插件;插件若在同一个插槽里放了纯文字按钮(如「退出」),它保持可读、可点,不会被压成空白方块。
|
|
23
|
+
- **区段标题改成计数** — 侧栏「Workspaces」这一行不再显示文字,改成图标加数字。空闲时是会话总数和工作区数;有会话正在跑或有跑完还没看的会话时,改显示运行数和未读完成数。悬停图标仍能读出名称。
|
|
22
24
|
- **启动即最窄** — 首次启动侧栏直接是 214px(上游每次加载都回到 280px),之后按你上次拖到的宽度打开。折叠/展开不会丢掉这个宽度。
|
|
23
25
|
- **窗口铺满屏幕** — 首次启动主窗口铺满可用区域(菜单栏与 Dock 保留,等同绿色按钮的缩放);之后按上次关闭时的窗口位置与大小重新打开。保存的窗口若超出当前显示器(换屏、改分辨率)会被拉回可见区域。
|
|
24
26
|
- **运行中彩色转圈** — 侧栏里正在运行的会话,状态环不再是宿主那样的灰色,而是一圈彩色:蓝→紫→洋红→琥珀的 4 秒色相循环,浅色与深色主题下都清晰。环的转动与虚线段仍由宿主驱动,本插件只改颜色;其他位置的状态点(任务、审批、工作流)保持原样。
|
|
25
27
|
- **Dock 完成角标** — macOS Dock 图标上的红色数字 = 侧栏「绿点未读会话」的数量:某会话跑完而你没在看它(切到别的会话或别的 App)就 +1,点开读一下即 -1,全部读完角标消失。直接映射宿主 `uiSession.sessionStatus.completionUnread`(与侧栏绿点同一数据源)。页面侧把数字报到插件自己的 Host 路由 `/dsh-enhance/badge`,由主进程 `app.dock.setBadge` 画角标——Electron 渲染层不实现 Badging API,之前走 `navigator.setAppBadge` 是空操作;普通浏览器里仍保留 Badging API 作为备选。
|
|
28
|
+
- **空会话纯色首页** — 之前这条规则给空会话(hero)画了一整幅海面:天空渐变、424px 处一道地平线硬切、下方深海渐变,空中的品牌鲸鱼标记也是配着这片天色画的。现在把这层 `background-image` 去掉,只留主题底色,天空、地平线和海面一起消失,页面回到干净的纯色;进入对话(phase 变 active)立刻恢复,不影响有消息的会话。
|
|
29
|
+
- **鲸鱼游得更慢** — 空会话那尾鲸从 9 秒一趟的乱窜改成 24 秒一趟的慢游:沿标题行横穿整个开阔水面,只有缓慢的起伏和两端的两个大转弯,尾巴约一秒半摆一次。转向时身体压成侧身再翻面,像鱼真的转身一样。朝向也跟着对:宿主画的那尾鱼头在左,向右游时镜像、向左游时不镜像,不会倒着游。
|
|
30
|
+
顺带修掉一个旧毛病:转向的缩放原本挂在父元素上,父级缩放会把子级的位移一起缩小,于是鲸鱼每次转向都被拽回行首再冲出去(实测一次转向瞬间位移 700px)。现在位移和身体形变合并到同一条关键帧里,路径全程连续。
|
|
31
|
+
- **鲸鱼带着水泡** — 游动时从背上冒出一串小水泡,缓缓上浮、微微后飘,到顶时炸开消失(环快速放大并淡出)。水泡由样式表绘制,脚本只负责在鲸鱼的实时位置上放它——样式表做不到「在鱼此刻所在的地方放一个泡」。
|
|
32
|
+
找鲸鱼不靠宿主的哈希类名,而是靠插件自己给它的动画名,宿主改版改名也不受影响;系统开启「减弱动态效果」时动画根本不跑,自然也没有水泡。
|
|
33
|
+
- **发送按钮是实心深蓝** — 输入框可用时(不是禁用态),发送按钮是一枚饱和的深蓝圆盘加白色箭头。宿主在深色主题下把它画成淡蓝强调色,看着灰扑扑的;改用静态令牌 `--dsw-static-deepseek-500`(#4176e6)后两个主题一致,悬停再提亮一档。禁用态仍由宿主淡化(opacity .4)。
|
|
26
34
|
|
|
27
35
|
## 安装
|
|
28
36
|
|
|
@@ -33,9 +41,9 @@ DSH 打开 **Plugins** 页面 → 添加插件 → 输入 `dsh-enhance` → 安
|
|
|
33
41
|
### 方式二:本地 tar 包
|
|
34
42
|
|
|
35
43
|
```bash
|
|
36
|
-
# 从 Releases 下载 dsh-enhance-0.3.
|
|
44
|
+
# 从 Releases 下载 dsh-enhance-0.3.7.tgz 后
|
|
37
45
|
cd ~/.dsh/profiles/desktop
|
|
38
|
-
npx pnpm@11.28.5 add "file:/绝对路径/dsh-enhance-0.3.
|
|
46
|
+
npx pnpm@11.28.5 add "file:/绝对路径/dsh-enhance-0.3.7.tgz"
|
|
39
47
|
```
|
|
40
48
|
|
|
41
49
|
再编辑 `~/.dsh/profiles/desktop/package.json`,把 `dsh-enhance` 加入 `dsh.profile.bundles`:
|
package/lib/client.js
CHANGED
|
@@ -699,18 +699,101 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
|
|
|
699
699
|
[class*="sidebarCol"] [class*="sectionLabel"] {
|
|
700
700
|
margin-left: 4px !important;
|
|
701
701
|
}
|
|
702
|
-
|
|
702
|
+
|
|
703
|
+
/* The section heading gives up its words for two icon counts.
|
|
703
704
|
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
705
|
+
* The host renders the words ("Workspaces", or "Sessions" in the flat
|
|
706
|
+
* grouping) and re-renders them, so the node stays put and only its text is
|
|
707
|
+
* hidden. The counts row is inserted right after it by section-stats.ts and
|
|
708
|
+
* takes the same line: the heading collapses to nothing, and the row is the
|
|
709
|
+
* heading's flex sibling, so it lands where the words were.
|
|
707
710
|
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
+
* One of the two groups shows. The row carries data-active once a session is
|
|
712
|
+
* running or a finished one is still unread, and that group replaces the idle
|
|
713
|
+
* one — totals for sessions and workspaces — rather than sitting beside it.
|
|
714
|
+
* Four numbers on one line would no longer fit the heading's width.
|
|
715
|
+
*/
|
|
716
|
+
[class*="sidebarCol"] [class*="sectionHeader"]:has([data-dsh-enhance-stats]) [class*="sectionLabel"] {
|
|
717
|
+
display: none !important;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/* The row starts on the sidebar's content edge, the line the reader marked in
|
|
721
|
+
* red. The heading's own padding puts it past that line, so the margin pulls
|
|
722
|
+
* the first icon back onto it. The tree rows below are pulled to the same
|
|
723
|
+
* line, which is what keeps the icons, the arrows and the folder names flush. */
|
|
724
|
+
[data-dsh-enhance-stats] {
|
|
725
|
+
display: inline-flex !important;
|
|
726
|
+
align-items: center !important;
|
|
727
|
+
gap: 10px !important;
|
|
728
|
+
min-width: 0 !important;
|
|
729
|
+
margin-left: -2px !important;
|
|
730
|
+
color: var(--dsw-alias-label-secondary) !important;
|
|
731
|
+
font-size: 12px !important;
|
|
732
|
+
line-height: 16px !important;
|
|
733
|
+
font-variant-numeric: tabular-nums !important;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
[data-dsh-enhance-stats] [data-group] {
|
|
737
|
+
display: inline-flex !important;
|
|
738
|
+
align-items: center !important;
|
|
739
|
+
gap: 10px !important;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
[data-dsh-enhance-stats]:not([data-active="true"]) [data-group="active"],
|
|
743
|
+
[data-dsh-enhance-stats][data-active="true"] [data-group="idle"] {
|
|
744
|
+
display: none !important;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/* The heading row is a fixed 36px tall and clips its overflow, so a 16px icon
|
|
748
|
+
* leaves a dead band above and below it where the pointer lands on the row
|
|
749
|
+
* instead of the count and the tip never shows. Stretching the count to the
|
|
750
|
+
* row's height makes the whole band the hover target; the icon stays centred. */
|
|
751
|
+
[data-dsh-enhance-stats] .dsh-enhance-stat {
|
|
752
|
+
display: inline-flex !important;
|
|
753
|
+
align-items: center !important;
|
|
754
|
+
gap: 1px !important;
|
|
755
|
+
height: 36px !important;
|
|
756
|
+
margin-top: -10px !important;
|
|
757
|
+
margin-bottom: -10px !important;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
[data-dsh-enhance-stats] svg {
|
|
761
|
+
flex: none !important;
|
|
762
|
+
width: 14px !important;
|
|
763
|
+
height: 14px !important;
|
|
764
|
+
fill: none !important;
|
|
765
|
+
stroke: currentColor !important;
|
|
766
|
+
stroke-width: 2 !important;
|
|
767
|
+
stroke-linecap: round !important;
|
|
768
|
+
stroke-linejoin: round !important;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/* The bell's notification dot is a filled disc in the lucide glyph; the bell
|
|
772
|
+
* itself stays an outline. Filling only the circle keeps both. */
|
|
773
|
+
[data-dsh-enhance-stats] [data-count="unread"] svg circle {
|
|
774
|
+
fill: currentColor !important;
|
|
775
|
+
stroke: none !important;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/* The running mark is a filled silhouette, not a stroked outline like the
|
|
779
|
+
* other three, so it opts out of the stroke treatment above. The glyph faces
|
|
780
|
+
* right; the row reads left to right, so it is mirrored to run towards the
|
|
781
|
+
* counts that follow it. */
|
|
782
|
+
[data-dsh-enhance-stats] [data-count="running"] svg {
|
|
783
|
+
fill: currentColor !important;
|
|
784
|
+
stroke: none !important;
|
|
785
|
+
transform: scaleX(-1) !important;
|
|
786
|
+
}
|
|
787
|
+
/* One indent for both row kinds, and that indent is the content edge.
|
|
788
|
+
*
|
|
789
|
+
* The list pulls its rows back 4px and the rows themselves add a start inset,
|
|
790
|
+
* which left the disclosure arrows and the folder names short of the sidebar's
|
|
791
|
+
* content edge. Zeroing the inset lands both on that edge, the same line the
|
|
792
|
+
* counts row above is pulled to. A negative margin was tried instead and
|
|
793
|
+
* reverted: it dragged the whole row past the column, so the arrows vanished. */
|
|
711
794
|
[role="treeitem"][data-row-key^="session:"],
|
|
712
795
|
[role="treeitem"][data-row-key^="workspace:"] {
|
|
713
|
-
padding-inline-start:
|
|
796
|
+
padding-inline-start: 4px !important;
|
|
714
797
|
}
|
|
715
798
|
|
|
716
799
|
|
|
@@ -726,9 +809,17 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
|
|
|
726
809
|
* The row is kept — upstream stacks these icons in a column, which costs one
|
|
727
810
|
* row per shortcut at the top of the tree.
|
|
728
811
|
*
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
812
|
+
* How many fit on a line follows the sidebar's own width: the row takes the
|
|
813
|
+
* full content width and the wrap does the counting, so a wider sidebar shows
|
|
814
|
+
* more icons on the first line and the narrowest one (214px) still fits five
|
|
815
|
+
* 36px buttons and four 2px gaps.
|
|
816
|
+
*
|
|
817
|
+
* Every hover and active fill is that same square. The host paints the fill on
|
|
818
|
+
* the padding box and keeps a 3px transparent border on each side, the inset
|
|
819
|
+
* it uses to line labelled rows up. On a 36px button that leaves a 30×36
|
|
820
|
+
* painted background, a rectangle, while a plugin button in the same row has
|
|
821
|
+
* no such border and paints a 36px square. The border is dropped here, and the
|
|
822
|
+
* fill is clipped to the border box, so both kinds cover the whole square.
|
|
732
823
|
*
|
|
733
824
|
* Scope excludes the collapsed rail: there the column is the app's 56px icon
|
|
734
825
|
* strip (0px on macOS), a row of 36px buttons cannot fit it, and the host's own
|
|
@@ -742,18 +833,23 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
|
|
|
742
833
|
justify-content: flex-start !important;
|
|
743
834
|
gap: 2px !important;
|
|
744
835
|
margin: 0 0 6px 0 !important;
|
|
745
|
-
|
|
836
|
+
width: 100% !important;
|
|
837
|
+
max-width: 100% !important;
|
|
746
838
|
}
|
|
747
839
|
|
|
748
840
|
[class*="sidebarCol"] [class*="panelList"] [class*="panelTitle"] { display: none !important; }
|
|
749
841
|
[class*="sidebarCol"] [class*="panelList"] button[class*="panelRow"] {
|
|
842
|
+
box-sizing: border-box !important;
|
|
750
843
|
width: 36px !important;
|
|
751
844
|
height: 36px !important;
|
|
845
|
+
min-width: 36px !important;
|
|
752
846
|
min-height: 36px !important;
|
|
753
847
|
justify-content: center !important;
|
|
754
848
|
gap: 0 !important;
|
|
755
849
|
margin: 0 !important;
|
|
756
850
|
padding: 0 !important;
|
|
851
|
+
border: none !important;
|
|
852
|
+
background-clip: border-box !important;
|
|
757
853
|
border-radius: 12px !important;
|
|
758
854
|
}
|
|
759
855
|
|
|
@@ -780,29 +876,300 @@ body[data-ds-dark-theme] [class*="sidebarCol"] {
|
|
|
780
876
|
* trigger into an icon+label pill that fills that row's width, which means
|
|
781
877
|
* justify-content:flex-start and a gap. In a 36px square that reads as an icon
|
|
782
878
|
* glued to the left edge, so the box model is normalised here: centred, no
|
|
783
|
-
* gap, no padding, one icon size for the whole row.
|
|
784
|
-
|
|
879
|
+
* gap, no padding, no border, one icon size for the whole row. The border goes
|
|
880
|
+
* too: a plugin border would inset the fill the same way the host's side
|
|
881
|
+
* border does, and the row would be back to mixed shapes.
|
|
882
|
+
*
|
|
883
|
+
* Only a trigger that carries an icon is normalised: a plugin may also put a
|
|
884
|
+
* text-only control in the same slot (the Remote plugin's Exit link), and
|
|
885
|
+
* squeezing that into a 36px square would clip the word instead of showing it.
|
|
886
|
+
*
|
|
887
|
+
* The font size goes to zero as well: a trigger that puts bare text next to
|
|
888
|
+
* its icon (no element around it) has no box to hide, and the text would
|
|
889
|
+
* otherwise spill out of the square. The icon keeps its own size — the sheet
|
|
890
|
+
* pins the svg to 16px below, in pixels, not in em. */
|
|
891
|
+
[class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] button:has(svg, img) {
|
|
785
892
|
flex: none !important;
|
|
786
893
|
display: inline-flex !important;
|
|
787
894
|
justify-content: center !important;
|
|
788
895
|
align-items: center !important;
|
|
789
896
|
gap: 0 !important;
|
|
897
|
+
box-sizing: border-box !important;
|
|
790
898
|
width: 36px !important;
|
|
791
899
|
height: 36px !important;
|
|
900
|
+
min-width: 36px !important;
|
|
901
|
+
min-height: 36px !important;
|
|
792
902
|
margin: 0 !important;
|
|
793
903
|
padding: 0 !important;
|
|
904
|
+
border: none !important;
|
|
905
|
+
background-clip: border-box !important;
|
|
794
906
|
border-radius: 12px !important;
|
|
907
|
+
font-size: 0 !important;
|
|
795
908
|
}
|
|
796
909
|
[class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] button svg {
|
|
797
910
|
flex: none !important;
|
|
798
911
|
width: 16px !important;
|
|
799
912
|
height: 16px !important;
|
|
800
913
|
}
|
|
914
|
+
/* The row is a strip of glyphs: every entry shows its icon and nothing else.
|
|
915
|
+
*
|
|
916
|
+
* A plugin that joins the row brings its footer markup with it, and that
|
|
917
|
+
* markup is written for a wide footer row — the Remote plugin's entry is an
|
|
918
|
+
* icon+label pill, so in the 36px square its label spilled out as a clipped
|
|
919
|
+
* "R…". The label is dropped by shape rather than by name, because the markup
|
|
920
|
+
* is the plugin's own: inside the relocated container an element that carries
|
|
921
|
+
* no icon is text. The has() selector keeps an icon wrapper (a span around an
|
|
922
|
+
* svg) alive, and the empty check keeps the plugin's own badge dots.
|
|
923
|
+
*
|
|
924
|
+
* The trigger keeps its title and aria-label, so the icon still names the
|
|
925
|
+
* plugin on hover and to a screen reader; only the visible text goes.
|
|
926
|
+
*/
|
|
927
|
+
[class*="sidebarCol"] [class*="panelList"] > [data-dsh-enhance-entries] :where(span, label, p, div):not(:empty):not(:has(svg)):not(:has(img)) {
|
|
928
|
+
display: none !important;
|
|
929
|
+
}
|
|
801
930
|
/* The rail keeps the host's own treatment: the footer action block is hidden
|
|
802
931
|
there exactly as the host hides it, so the strip keeps only the app's icons. */
|
|
803
932
|
[class*="sidebarCol"] [class*="_root"][class*="collapsed"] [data-dsh-enhance-entries] {
|
|
804
933
|
display: none !important;
|
|
805
934
|
}
|
|
935
|
+
|
|
936
|
+
/* The right sidebar's Start page lists its tools as one centred column of
|
|
937
|
+
* 380px rounded rectangles (the host's guide entries). Two per row, wrapping,
|
|
938
|
+
* matches the host's own tool grid, and the column stops being a fixed width
|
|
939
|
+
* so the pair fills the pane. */
|
|
940
|
+
[class*="_guide"]:has([data-sidebar-right-guide-entry]) {
|
|
941
|
+
display: grid !important;
|
|
942
|
+
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
|
|
943
|
+
align-content: center !important;
|
|
944
|
+
justify-items: stretch !important;
|
|
945
|
+
}
|
|
946
|
+
[class*="_guide"]:has([data-sidebar-right-guide-entry]) [class*="entryCell"],
|
|
947
|
+
[class*="_guide"]:has([data-sidebar-right-guide-entry]) [class*="moreAnchor"] {
|
|
948
|
+
width: auto !important;
|
|
949
|
+
max-width: none !important;
|
|
950
|
+
}
|
|
951
|
+
/* The entry sizes to its label, so it would sit as a short pill at the left of
|
|
952
|
+
* its cell. Stretching it makes each card fill its half of the row. The More
|
|
953
|
+
* tools card is the same entry class but carries no data attribute, so it is
|
|
954
|
+
* named alongside the attributed ones. */
|
|
955
|
+
[data-sidebar-right-guide-entry],
|
|
956
|
+
[class*="_guide"] [class$="_entry"] {
|
|
957
|
+
width: 100% !important;
|
|
958
|
+
max-width: none !important;
|
|
959
|
+
box-sizing: border-box !important;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/* The compass mark above the list is decoration; the entries name themselves. */
|
|
963
|
+
[class*="_guide"]:has([data-sidebar-right-guide-entry]) [class*="hero"] {
|
|
964
|
+
display: none !important;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/* The entries become pills, a third shorter than the host's 56px floor. The
|
|
968
|
+
* radius supplies the curve and the superellipse decides its shape: 1.5
|
|
969
|
+
* flattens the ends toward a rounded rectangle and higher values go squarer,
|
|
970
|
+
* so 1 — a plain ellipse — is the capsule. The attribute is the host's own
|
|
971
|
+
* marker on a guide entry, so no other button is touched. */
|
|
972
|
+
[data-sidebar-right-guide-entry],
|
|
973
|
+
[class*="_guide"] [class$="_entry"] {
|
|
974
|
+
border-radius: 999px !important;
|
|
975
|
+
corner-shape: superellipse(1) !important;
|
|
976
|
+
min-height: 0 !important;
|
|
977
|
+
height: 37px !important;
|
|
978
|
+
padding-top: 0 !important;
|
|
979
|
+
padding-bottom: 0 !important;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/* Two more chips that paint a small rounded rectangle: the preset picker in
|
|
983
|
+
* the composer (its hover fill shows the 8px radius) and the background-job
|
|
984
|
+
* count in the session header. Named exactly, because "_seat" and "_trigger"
|
|
985
|
+
* also occur inside the account menu, the access-mode picker and the model
|
|
986
|
+
* picker, which keep their own shape. */
|
|
987
|
+
.ufIuna_seat,
|
|
988
|
+
._4iHfma_trigger {
|
|
989
|
+
border-radius: 999px !important;
|
|
990
|
+
corner-shape: superellipse(1) !important;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/* The composer's plain chips grow a rounded-rectangle hover fill: the
|
|
994
|
+
* workspace picker, the new-worktree toggle, the access-mode picker and the
|
|
995
|
+
* model picker. Only the hover fill changes shape, so the resting chip stays
|
|
996
|
+
* as the host drew it. */
|
|
997
|
+
._8tPydW_workspace:hover,
|
|
998
|
+
.ZTF-0q_toggle:hover,
|
|
999
|
+
.SJRB_q_trigger:hover,
|
|
1000
|
+
.htuFrW_root:hover .htuFrW_trigger {
|
|
1001
|
+
border-radius: 999px !important;
|
|
1002
|
+
corner-shape: unset !important;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/* The send button only looks solid while the pointer is over it: the host
|
|
1006
|
+
* fades it while disabled and swaps its fill for a darker one on hover. It keeps
|
|
1007
|
+
* the solid fill whenever it can be clicked, and stays faded when it cannot.
|
|
1008
|
+
*
|
|
1009
|
+
* While it can be clicked it is a solid disc of the deep blue with a white
|
|
1010
|
+
* arrow. The host's dark theme paints it in the pale accent instead, which
|
|
1011
|
+
* reads as a washed-out pill; the light theme already uses the deep blue, so
|
|
1012
|
+
* naming the static token makes the button look the same in both. */
|
|
1013
|
+
.JZLxKW_primary:not(:disabled) {
|
|
1014
|
+
background: var(--dsw-static-deepseek-500) !important;
|
|
1015
|
+
color: #fff !important;
|
|
1016
|
+
}
|
|
1017
|
+
.JZLxKW_primary:not(:disabled):hover {
|
|
1018
|
+
background: var(--dsw-static-deepseek-400) !important;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/* The Preview chip and the "Into the Unknown" line are labels, not controls.
|
|
1022
|
+
* The whale stays. */
|
|
1023
|
+
._8tPydW_previewBadge,
|
|
1024
|
+
._8tPydW_titleGroup {
|
|
1025
|
+
display: none !important;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
.ga5fXW_split {
|
|
1029
|
+
border-radius: var(--dsw-radius-xl) !important;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/* The whale swims the way a whale swims: one long, unhurried passage across
|
|
1033
|
+
* the open water of the headline row, a slow rise and fall, and two wide turns
|
|
1034
|
+
* at the ends of the row. The previous version darted between the edges every
|
|
1035
|
+
* few hundred milliseconds, which read as a fish being startled rather than one
|
|
1036
|
+
* making its way.
|
|
1037
|
+
*
|
|
1038
|
+
* Travel and body share one element and one transform. With the scale on a
|
|
1039
|
+
* parent, the parent's scale also scales the child's translation, so the
|
|
1040
|
+
* whale collapsed back to the start of the row while it turned. Here the turn
|
|
1041
|
+
* is a dip to edge-on inside the same transform as the swim, and the fish
|
|
1042
|
+
* never leaves the path it is swimming.
|
|
1043
|
+
*
|
|
1044
|
+
* The host draws the fish facing left, so the sign of the scale carries the
|
|
1045
|
+
* facing: mirrored while it swims right, upright while it swims left. The
|
|
1046
|
+
* rotations are negated in the mirrored stretch, because a mirrored element
|
|
1047
|
+
* turns the other way on screen. */
|
|
1048
|
+
@keyframes dsh-enhance-whale-travel {
|
|
1049
|
+
0% {
|
|
1050
|
+
transform: translate(0, 0) rotate(0deg) scale(-1.05, 0.96);
|
|
1051
|
+
}
|
|
1052
|
+
8% {
|
|
1053
|
+
transform: translate(66px, -14px) rotate(3deg) scale(-1.05, 0.96);
|
|
1054
|
+
}
|
|
1055
|
+
16% {
|
|
1056
|
+
transform: translate(140px, -6px) rotate(-2deg) scale(-0.97, 1.04);
|
|
1057
|
+
}
|
|
1058
|
+
24% {
|
|
1059
|
+
transform: translate(212px, -18px) rotate(3deg) scale(-1.05, 0.96);
|
|
1060
|
+
}
|
|
1061
|
+
32% {
|
|
1062
|
+
transform: translate(280px, -8px) rotate(-2deg) scale(-0.97, 1.04);
|
|
1063
|
+
}
|
|
1064
|
+
40% {
|
|
1065
|
+
transform: translate(336px, 8px) rotate(-5deg) scale(-1.05, 0.96);
|
|
1066
|
+
}
|
|
1067
|
+
47% {
|
|
1068
|
+
transform: translate(368px, 30px) rotate(-11deg) scale(-0.97, 1.04);
|
|
1069
|
+
}
|
|
1070
|
+
50% {
|
|
1071
|
+
transform: translate(378px, 42px) rotate(-13deg) scale(-0.5, 1);
|
|
1072
|
+
}
|
|
1073
|
+
52% {
|
|
1074
|
+
transform: translate(372px, 48px) rotate(-12deg) scale(-0.06, 1.05);
|
|
1075
|
+
}
|
|
1076
|
+
54% {
|
|
1077
|
+
transform: translate(358px, 52px) rotate(-8deg) scale(0.06, 1.05);
|
|
1078
|
+
}
|
|
1079
|
+
57% {
|
|
1080
|
+
transform: translate(330px, 56px) rotate(4deg) scale(1.05, 0.96);
|
|
1081
|
+
}
|
|
1082
|
+
63% {
|
|
1083
|
+
transform: translate(272px, 58px) rotate(3deg) scale(0.97, 1.04);
|
|
1084
|
+
}
|
|
1085
|
+
71% {
|
|
1086
|
+
transform: translate(196px, 54px) rotate(5deg) scale(1.05, 0.96);
|
|
1087
|
+
}
|
|
1088
|
+
78% {
|
|
1089
|
+
transform: translate(134px, 44px) rotate(7deg) scale(0.97, 1.04);
|
|
1090
|
+
}
|
|
1091
|
+
86% {
|
|
1092
|
+
transform: translate(58px, 26px) rotate(8deg) scale(1.05, 0.96);
|
|
1093
|
+
}
|
|
1094
|
+
93% {
|
|
1095
|
+
transform: translate(10px, 4px) rotate(6deg) scale(0.97, 1.04);
|
|
1096
|
+
}
|
|
1097
|
+
95% {
|
|
1098
|
+
transform: translate(-14px, -12px) rotate(4deg) scale(0.2, 1.02);
|
|
1099
|
+
}
|
|
1100
|
+
98% {
|
|
1101
|
+
transform: translate(-8px, -10px) rotate(-3deg) scale(-0.2, 1.02);
|
|
1102
|
+
}
|
|
1103
|
+
100% {
|
|
1104
|
+
transform: translate(0, 0) rotate(0deg) scale(-1.05, 0.96);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
/* The bubbles the whale leaves behind. Each one is let go at the fish, rises,
|
|
1108
|
+
* swells on the way up, and pops: the last stretch of the keyframe opens the
|
|
1109
|
+
* ring and fades it out. */
|
|
1110
|
+
.dsh-enhance-bubble {
|
|
1111
|
+
position: fixed;
|
|
1112
|
+
border-radius: 50%;
|
|
1113
|
+
border: 1px solid rgba(72, 132, 180, 0.42);
|
|
1114
|
+
background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.98), rgba(186, 220, 242, 0.42) 72%);
|
|
1115
|
+
pointer-events: none;
|
|
1116
|
+
z-index: 30;
|
|
1117
|
+
animation: dsh-enhance-bubble 2.6s cubic-bezier(0.2, 0.6, 0.35, 1) forwards;
|
|
1118
|
+
}
|
|
1119
|
+
body[data-ds-dark-theme] .dsh-enhance-bubble {
|
|
1120
|
+
border-color: rgba(186, 224, 255, 0.5);
|
|
1121
|
+
background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.52), rgba(200, 230, 255, 0.08) 72%);
|
|
1122
|
+
}
|
|
1123
|
+
@keyframes dsh-enhance-bubble {
|
|
1124
|
+
0% {
|
|
1125
|
+
transform: translate(0, 0) scale(0.3);
|
|
1126
|
+
opacity: 0;
|
|
1127
|
+
}
|
|
1128
|
+
14% {
|
|
1129
|
+
opacity: 0.85;
|
|
1130
|
+
}
|
|
1131
|
+
60% {
|
|
1132
|
+
transform: translate(2px, -30px) scale(1);
|
|
1133
|
+
opacity: 0.8;
|
|
1134
|
+
}
|
|
1135
|
+
80% {
|
|
1136
|
+
transform: translate(-2px, -48px) scale(1.14);
|
|
1137
|
+
opacity: 0.75;
|
|
1138
|
+
}
|
|
1139
|
+
100% {
|
|
1140
|
+
transform: translate(1px, -62px) scale(2.1);
|
|
1141
|
+
opacity: 0;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
/* The headline row is only as wide as its contents, which leaves the whale
|
|
1145
|
+
* nowhere to swim but across the letters. Stretching the row gives it open
|
|
1146
|
+
* water on both sides; the input card below keeps its own width. */
|
|
1147
|
+
._8tPydW_headline {
|
|
1148
|
+
width: calc(100vw - 520px) !important;
|
|
1149
|
+
max-width: 960px !important;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/* The GenUI prompt toggle paints an inset ring and a fill while a mode is on.
|
|
1153
|
+
* It rests plain and only shows its fill under the pointer. */
|
|
1154
|
+
.aG4Rta_trigger[data-active] {
|
|
1155
|
+
box-shadow: none !important;
|
|
1156
|
+
background: transparent !important;
|
|
1157
|
+
}
|
|
1158
|
+
.aG4Rta_trigger[data-active]:hover {
|
|
1159
|
+
background: var(--dsw-alias-interactive-bg-hover) !important;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/* The host rounds every corner with a superellipse, which flattens a pill
|
|
1163
|
+
* back into a rounded rectangle. The variable is what that rule reads. */
|
|
1164
|
+
:root {
|
|
1165
|
+
--dsw-corner-shape: superellipse(1) !important;
|
|
1166
|
+
}
|
|
1167
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1168
|
+
._8tPydW_fish {
|
|
1169
|
+
animation: dsh-enhance-whale-travel 24s linear infinite !important;
|
|
1170
|
+
transform-origin: 50% 60% !important;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
806
1173
|
`;
|
|
807
1174
|
// src/client/styles/toolbar.ts
|
|
808
1175
|
/** Global presentation owned by dsh-enhance: annotation popover and tray. */
|
|
@@ -1897,6 +2264,100 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
1897
2264
|
};
|
|
1898
2265
|
}, `dsh-enhance: ${name} stylesheet`);
|
|
1899
2266
|
}
|
|
2267
|
+
// src/client/whale-bubbles.ts
|
|
2268
|
+
/**
|
|
2269
|
+
* Small bubbles trailing the whale on the empty page.
|
|
2270
|
+
*
|
|
2271
|
+
* The whale is the host's own hero illustration, and the plugin drives it with
|
|
2272
|
+
* a stylesheet animation. A stylesheet cannot put a bubble where the fish
|
|
2273
|
+
* happens to be: the bubble has to be let go at the fish's current position
|
|
2274
|
+
* and then left behind, and only a script can do that. The bubble itself is
|
|
2275
|
+
* drawn and animated by the stylesheet — this module only decides where and
|
|
2276
|
+
* when one appears.
|
|
2277
|
+
*
|
|
2278
|
+
* The fish is found through the plugin's own travel animation rather than
|
|
2279
|
+
* through the host's hashed CSS-module class, so the lookup survives a host
|
|
2280
|
+
* release that renames that module. Under reduced motion the animation never
|
|
2281
|
+
* runs, no fish is found and no bubbles appear, which is the right outcome.
|
|
2282
|
+
*/
|
|
2283
|
+
/** Name of the animation the plugin gives the whale; it identifies the fish. */
|
|
2284
|
+
const TRAVEL_ANIMATION = "dsh-enhance-whale-travel";
|
|
2285
|
+
/** Class the stylesheet draws the bubble with. */
|
|
2286
|
+
const BUBBLE_CLASS = "dsh-enhance-bubble";
|
|
2287
|
+
/** How often a bubble is let go, in milliseconds. */
|
|
2288
|
+
const INTERVAL = 620;
|
|
2289
|
+
/** Bubbles alive at once. Each lives about 2.6s, so the trail stays short. */
|
|
2290
|
+
const MAX_LIVE = 16;
|
|
2291
|
+
/** Smallest and largest bubble, in pixels. */
|
|
2292
|
+
const MIN_SIZE = 5;
|
|
2293
|
+
/**
|
|
2294
|
+
* Find the whale.
|
|
2295
|
+
*
|
|
2296
|
+
* The travel animation is applied to the fish by the plugin's own stylesheet,
|
|
2297
|
+
* so the animation is a stable handle on it: the host's class names are
|
|
2298
|
+
* hashed per release and change without notice.
|
|
2299
|
+
* @param root - document the plugin is mounted in.
|
|
2300
|
+
* @returns the whale element, or null when the page has no whale.
|
|
2301
|
+
*/
|
|
2302
|
+
function findWhale(root) {
|
|
2303
|
+
for (const animation of root.getAnimations()) {
|
|
2304
|
+
if (animation.animationName !== TRAVEL_ANIMATION) continue;
|
|
2305
|
+
const target = animation.effect?.target;
|
|
2306
|
+
if (target === null || target === void 0) continue;
|
|
2307
|
+
const node = target;
|
|
2308
|
+
if (node.nodeType === 1 && typeof node.getBoundingClientRect === "function") return node;
|
|
2309
|
+
}
|
|
2310
|
+
return null;
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Let go one bubble at the whale.
|
|
2314
|
+
* @param root - document the plugin is mounted in.
|
|
2315
|
+
* @param whale - the fish to bubble from.
|
|
2316
|
+
* @returns the bubble element, or null when the fish is not on screen.
|
|
2317
|
+
*/
|
|
2318
|
+
function spawn(root, whale) {
|
|
2319
|
+
const rect = whale.getBoundingClientRect();
|
|
2320
|
+
if (rect.width === 0) return null;
|
|
2321
|
+
const size = MIN_SIZE + Math.random() * 4;
|
|
2322
|
+
const bubble = root.createElement("div");
|
|
2323
|
+
bubble.className = BUBBLE_CLASS;
|
|
2324
|
+
bubble.style.width = `${size}px`;
|
|
2325
|
+
bubble.style.height = `${size}px`;
|
|
2326
|
+
bubble.style.marginLeft = `${-size / 2}px`;
|
|
2327
|
+
bubble.style.marginTop = `${-size / 2}px`;
|
|
2328
|
+
bubble.style.left = `${rect.left + rect.width * .5 + (Math.random() * 8 - 4)}px`;
|
|
2329
|
+
bubble.style.top = `${rect.top + rect.height * .3}px`;
|
|
2330
|
+
bubble.style.animationDuration = `${2.2 + Math.random() * .8}s`;
|
|
2331
|
+
root.body.appendChild(bubble);
|
|
2332
|
+
return bubble;
|
|
2333
|
+
}
|
|
2334
|
+
/**
|
|
2335
|
+
* Install the bubble trail.
|
|
2336
|
+
* @param root - document the plugin is mounted in.
|
|
2337
|
+
* @returns disposer that stops the trail and clears the bubbles still up.
|
|
2338
|
+
*/
|
|
2339
|
+
function installWhaleBubbles(root) {
|
|
2340
|
+
let live = 0;
|
|
2341
|
+
const timer = window.setInterval(() => {
|
|
2342
|
+
const whale = findWhale(root);
|
|
2343
|
+
if (whale === null) return;
|
|
2344
|
+
if (live >= MAX_LIVE) return;
|
|
2345
|
+
const bubble = spawn(root, whale);
|
|
2346
|
+
if (bubble === null) return;
|
|
2347
|
+
live += 1;
|
|
2348
|
+
bubble.addEventListener("animationend", () => {
|
|
2349
|
+
live -= 1;
|
|
2350
|
+
bubble.remove();
|
|
2351
|
+
});
|
|
2352
|
+
}, INTERVAL);
|
|
2353
|
+
return () => {
|
|
2354
|
+
window.clearInterval(timer);
|
|
2355
|
+
live = 0;
|
|
2356
|
+
root.querySelectorAll(`.${BUBBLE_CLASS}`).forEach((bubble) => {
|
|
2357
|
+
bubble.remove();
|
|
2358
|
+
});
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
1900
2361
|
// src/client/sidebar-floor.ts
|
|
1901
2362
|
/**
|
|
1902
2363
|
* A sidebar drag floor 50px below the app's own.
|
|
@@ -2148,8 +2609,9 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
2148
2609
|
* parents, and no amount of `order` moves a node into a sibling container. So
|
|
2149
2610
|
* this module moves the footer's action container into the panel nav once the
|
|
2150
2611
|
* shell exists, and the stylesheet dissolves it (`display: contents`) so its
|
|
2151
|
-
* buttons join the row the nav lays out.
|
|
2152
|
-
*
|
|
2612
|
+
* buttons join the row the nav lays out. How many sit on one line follows the
|
|
2613
|
+
* sidebar's width: the row spans the content width and wraps by itself (see
|
|
2614
|
+
* sidebar-layout.css).
|
|
2153
2615
|
*
|
|
2154
2616
|
* The relocated element is the *container* the host owns, not the entries a
|
|
2155
2617
|
* plugin renders. React updates those entries inside it and removes them from
|
|
@@ -2242,6 +2704,206 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
2242
2704
|
else home.append(moved);
|
|
2243
2705
|
};
|
|
2244
2706
|
}
|
|
2707
|
+
// src/client/section-stats.ts
|
|
2708
|
+
/** Marks the injected row, for the stylesheet and the disposer. */
|
|
2709
|
+
const STATS_ATTRIBUTE = "data-dsh-enhance-stats";
|
|
2710
|
+
/**
|
|
2711
|
+
* Count what the row displays.
|
|
2712
|
+
*
|
|
2713
|
+
* Blank rows and subagent children are excluded from every session count: the
|
|
2714
|
+
* sidebar shows neither as a conversation of its own, so counting them would
|
|
2715
|
+
* disagree with the tree under the heading.
|
|
2716
|
+
* @param byId - the session list snapshot.
|
|
2717
|
+
* @param status - the session status snapshot.
|
|
2718
|
+
* @param workspaces - number of workspaces in the list.
|
|
2719
|
+
* @returns the four counts.
|
|
2720
|
+
*/
|
|
2721
|
+
function sectionCounts(byId, status, workspaces) {
|
|
2722
|
+
let sessions = 0;
|
|
2723
|
+
let running = 0;
|
|
2724
|
+
let unread = 0;
|
|
2725
|
+
for (const [id, row] of Object.entries(byId)) {
|
|
2726
|
+
if (row.blank === true || row.origin === "subagent") continue;
|
|
2727
|
+
sessions += 1;
|
|
2728
|
+
if (row.running === true) running += 1;
|
|
2729
|
+
if (status.get(id)?.completionUnread === true) unread += 1;
|
|
2730
|
+
}
|
|
2731
|
+
return {
|
|
2732
|
+
sessions,
|
|
2733
|
+
workspaces,
|
|
2734
|
+
running,
|
|
2735
|
+
unread
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* The idle pair: how many conversations exist, and how many workspaces hold them.
|
|
2740
|
+
*
|
|
2741
|
+
* `message-circle-more` stands for a conversation, which is what a session is
|
|
2742
|
+
* here. `folder` stands for a workspace, the group the tree splits sessions into.
|
|
2743
|
+
*/
|
|
2744
|
+
const IDLE_ITEMS = [{
|
|
2745
|
+
count: "sessions",
|
|
2746
|
+
tip: (count) => `${count} sessions`,
|
|
2747
|
+
icon: "<path d=\"M7.9 20A9 9 0 1 0 4 16.1L2 22Z\"/><path d=\"M8 12h.01\"/><path d=\"M12 12h.01\"/><path d=\"M16 12h.01\"/>"
|
|
2748
|
+
}, {
|
|
2749
|
+
count: "workspaces",
|
|
2750
|
+
tip: (count) => `${count} workspaces`,
|
|
2751
|
+
icon: "<path d=\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z\"/>"
|
|
2752
|
+
}];
|
|
2753
|
+
/**
|
|
2754
|
+
* The active pair: conversations running right now, and ones that finished
|
|
2755
|
+
* without being looked at.
|
|
2756
|
+
*
|
|
2757
|
+
* `directions-run` is the running mark: a figure mid-stride, which reads as
|
|
2758
|
+
* running where a standing figure does not. `bell-dot` is the unread mark, a
|
|
2759
|
+
* bell with a dot, the same idea as the green dot on a finished session.
|
|
2760
|
+
*/
|
|
2761
|
+
const ACTIVE_ITEMS = [{
|
|
2762
|
+
count: "running",
|
|
2763
|
+
tip: (count) => `${count} running`,
|
|
2764
|
+
icon: "<path d=\"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z\"/>"
|
|
2765
|
+
}, {
|
|
2766
|
+
count: "unread",
|
|
2767
|
+
tip: (count) => `${count} unread`,
|
|
2768
|
+
icon: "<path d=\"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3\"/><path d=\"M10.3 21a1.94 1.94 0 0 0 3.4 0\"/><circle cx=\"18\" cy=\"8\" r=\"3\"/>"
|
|
2769
|
+
}];
|
|
2770
|
+
/** One count: the icon, then the number. The hover text starts empty and is filled with the number. */
|
|
2771
|
+
function item(entry) {
|
|
2772
|
+
return `<span class="dsh-enhance-stat" data-count="${entry.count}"><svg viewBox="0 0 24 24" aria-hidden="true">${entry.icon}</svg><span class="dsh-enhance-stat__value"></span></span>`;
|
|
2773
|
+
}
|
|
2774
|
+
/** Hover text for one count, looked up by the key the row stores on each item. */
|
|
2775
|
+
const TIPS = Object.fromEntries([...IDLE_ITEMS, ...ACTIVE_ITEMS].map((entry) => [entry.count, entry.tip]));
|
|
2776
|
+
/** The row: the idle pair and the active pair, one of them hidden by CSS. */
|
|
2777
|
+
function rowMarkup() {
|
|
2778
|
+
return `<span class="dsh-enhance-stats__group" data-group="idle">${IDLE_ITEMS.map(item).join("")}</span><span class="dsh-enhance-stats__group" data-group="active">${ACTIVE_ITEMS.map(item).join("")}</span>`;
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Write the four numbers into a row already in the document.
|
|
2782
|
+
*
|
|
2783
|
+
* Only a number that changed is touched, so a list update that moves nothing
|
|
2784
|
+
* this row cares about costs no layout.
|
|
2785
|
+
* @param row - the injected row.
|
|
2786
|
+
* @param counts - the numbers to show.
|
|
2787
|
+
* @param previous - the numbers currently shown, mutated to match.
|
|
2788
|
+
*/
|
|
2789
|
+
function paintCounts(row, counts, previous) {
|
|
2790
|
+
const active = counts.running > 0 || counts.unread > 0;
|
|
2791
|
+
if (row.dataset.active !== String(active)) row.dataset.active = String(active);
|
|
2792
|
+
for (const key of [
|
|
2793
|
+
"sessions",
|
|
2794
|
+
"workspaces",
|
|
2795
|
+
"running",
|
|
2796
|
+
"unread"
|
|
2797
|
+
]) {
|
|
2798
|
+
if (previous[key] === counts[key]) continue;
|
|
2799
|
+
previous[key] = counts[key];
|
|
2800
|
+
const value = row.querySelector(`[data-count="${key}"] .dsh-enhance-stat__value`);
|
|
2801
|
+
if (value !== null) value.textContent = String(counts[key]);
|
|
2802
|
+
const stat = row.querySelector(`[data-count="${key}"]`);
|
|
2803
|
+
if (stat !== null) stat.title = TIPS[key](counts[key]);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Install the counts in place of the section heading.
|
|
2808
|
+
* @param ctx - client root carrying the session list, its status and the workspaces.
|
|
2809
|
+
* @param root - document the plugin is mounted in.
|
|
2810
|
+
* @param sources - override the host stores, mainly for tests.
|
|
2811
|
+
* @returns disposer that removes the row.
|
|
2812
|
+
*/
|
|
2813
|
+
function installSectionStats(ctx, root, sources) {
|
|
2814
|
+
const from = sources ?? sourcesFrom(ctx);
|
|
2815
|
+
if (from === void 0) return () => {};
|
|
2816
|
+
let frame = 0;
|
|
2817
|
+
let row = null;
|
|
2818
|
+
const shown = {};
|
|
2819
|
+
/** The heading the host renders, re-queried because a re-render replaces it. */
|
|
2820
|
+
const heading = () => {
|
|
2821
|
+
for (const column of root.querySelectorAll("[class*=\"sidebarCol\"]")) {
|
|
2822
|
+
const label = column.querySelector("[class*=\"sectionLabel\"]");
|
|
2823
|
+
if (label !== null) return label;
|
|
2824
|
+
}
|
|
2825
|
+
return null;
|
|
2826
|
+
};
|
|
2827
|
+
/** Build the row once and keep it next to the heading. */
|
|
2828
|
+
const place = () => {
|
|
2829
|
+
const label = heading();
|
|
2830
|
+
if (label === null || label.parentElement === null) return;
|
|
2831
|
+
if (row === null || !row.isConnected) {
|
|
2832
|
+
row = root.createElement("span");
|
|
2833
|
+
row.setAttribute(STATS_ATTRIBUTE, "");
|
|
2834
|
+
row.className = "dsh-enhance-stats";
|
|
2835
|
+
row.innerHTML = rowMarkup();
|
|
2836
|
+
for (const key of Object.keys(shown)) delete shown[key];
|
|
2837
|
+
}
|
|
2838
|
+
if (row.previousElementSibling !== label) label.after(row);
|
|
2839
|
+
};
|
|
2840
|
+
/** Recompute and paint. Cheap enough to run on every list change. */
|
|
2841
|
+
const paint = () => {
|
|
2842
|
+
place();
|
|
2843
|
+
if (row === null) return;
|
|
2844
|
+
paintCounts(row, sectionCounts(from.sessions().byId, from.status(), from.workspaces().length), shown);
|
|
2845
|
+
};
|
|
2846
|
+
const schedule = () => {
|
|
2847
|
+
if (frame !== 0) return;
|
|
2848
|
+
frame = requestAnimationFrame(() => {
|
|
2849
|
+
frame = 0;
|
|
2850
|
+
paint();
|
|
2851
|
+
});
|
|
2852
|
+
};
|
|
2853
|
+
let observer = null;
|
|
2854
|
+
let observed = null;
|
|
2855
|
+
const watch = () => {
|
|
2856
|
+
const column = root.querySelector("[class*=\"sidebarCol\"]");
|
|
2857
|
+
if (column === observed) return;
|
|
2858
|
+
observer?.disconnect();
|
|
2859
|
+
observer = new MutationObserver(schedule);
|
|
2860
|
+
observed = column;
|
|
2861
|
+
observer.observe(column ?? root.documentElement, {
|
|
2862
|
+
childList: true,
|
|
2863
|
+
subtree: true
|
|
2864
|
+
});
|
|
2865
|
+
};
|
|
2866
|
+
watch();
|
|
2867
|
+
paint();
|
|
2868
|
+
const stopSessions = from.subscribeSessions(paint);
|
|
2869
|
+
const stopStatus = from.subscribeStatus(paint);
|
|
2870
|
+
const stopWorkspaces = from.subscribeWorkspaces(paint);
|
|
2871
|
+
const mountWatcher = new MutationObserver(() => {
|
|
2872
|
+
if (observed !== null && observed.isConnected) return;
|
|
2873
|
+
watch();
|
|
2874
|
+
schedule();
|
|
2875
|
+
});
|
|
2876
|
+
mountWatcher.observe(root.documentElement, {
|
|
2877
|
+
childList: true,
|
|
2878
|
+
subtree: true
|
|
2879
|
+
});
|
|
2880
|
+
return () => {
|
|
2881
|
+
if (frame !== 0) cancelAnimationFrame(frame);
|
|
2882
|
+
observer?.disconnect();
|
|
2883
|
+
mountWatcher.disconnect();
|
|
2884
|
+
stopSessions();
|
|
2885
|
+
stopStatus();
|
|
2886
|
+
stopWorkspaces();
|
|
2887
|
+
row?.remove();
|
|
2888
|
+
row = null;
|
|
2889
|
+
};
|
|
2890
|
+
}
|
|
2891
|
+
/** The host stores behind the structural face, or undefined when one is missing. */
|
|
2892
|
+
function sourcesFrom(ctx) {
|
|
2893
|
+
const services = ctx;
|
|
2894
|
+
const sessions = services.sessions?.list;
|
|
2895
|
+
const status = services.uiSession?.sessionStatus;
|
|
2896
|
+
const workspaces = services.workspaces?.list;
|
|
2897
|
+
if (sessions === void 0 || status === void 0 || workspaces === void 0) return void 0;
|
|
2898
|
+
return {
|
|
2899
|
+
sessions: () => sessions.getSnapshot(),
|
|
2900
|
+
subscribeSessions: (listener) => sessions.subscribe(listener),
|
|
2901
|
+
status: () => status.getSnapshot(),
|
|
2902
|
+
subscribeStatus: (listener) => status.subscribe(listener),
|
|
2903
|
+
workspaces: () => ({ length: workspaces.getSnapshot().items.length }),
|
|
2904
|
+
subscribeWorkspaces: (listener) => workspaces.subscribe(listener)
|
|
2905
|
+
};
|
|
2906
|
+
}
|
|
2245
2907
|
// src/client/sidebar-width.ts
|
|
2246
2908
|
/**
|
|
2247
2909
|
* The sidebar width the shell opens with, and the one it is left at.
|
|
@@ -4317,32 +4979,45 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
4317
4979
|
refresh(sessionId);
|
|
4318
4980
|
publish();
|
|
4319
4981
|
}
|
|
4982
|
+
/** Column the body of an entry sits at, so it lines up under its label. */
|
|
4983
|
+
const INDENT = " ";
|
|
4320
4984
|
/**
|
|
4321
|
-
* Render one annotation as the
|
|
4985
|
+
* Render one annotation as two labelled blocks: the passage, then the comment.
|
|
4986
|
+
*
|
|
4987
|
+
* One line with a dash between the two read badly as soon as the passage was
|
|
4988
|
+
* long: the quotation, the truncation ellipsis and the reader's own sentence
|
|
4989
|
+
* ran together, and the words they typed were no longer visibly theirs. Named
|
|
4990
|
+
* blocks keep each half on its own lines, and drop the quotes, since the label
|
|
4991
|
+
* already says what the text under it is. Without a comment only the passage
|
|
4992
|
+
* block is sent — an empty label would ask the model to answer nothing.
|
|
4322
4993
|
*
|
|
4323
|
-
* The
|
|
4324
|
-
*
|
|
4325
|
-
* keeps the draft readable while still carrying both halves the model needs.
|
|
4994
|
+
* The number goes on in `annotationsPrompt`, which keeps this text contiguous:
|
|
4995
|
+
* the composer looks for it in the draft before carrying an annotation again.
|
|
4326
4996
|
* @param annotation - the annotation to render.
|
|
4327
|
-
* @returns one
|
|
4997
|
+
* @returns message text for one annotation, its continuation lines indented.
|
|
4328
4998
|
*/
|
|
4329
|
-
function
|
|
4999
|
+
function annotationBlock(annotation) {
|
|
4330
5000
|
const passage = annotation.passage.replace(/\s+/g, " ").trim();
|
|
4331
5001
|
const quoted = passage.length > 140 ? `${passage.slice(0, 139)}…` : passage;
|
|
4332
|
-
const
|
|
4333
|
-
|
|
5002
|
+
const lines = ["Selected text:", `${INDENT}${quoted}`];
|
|
5003
|
+
const note = annotation.note.replace(/\r\n|\r/g, "\n").trim();
|
|
5004
|
+
if (note.length > 0) {
|
|
5005
|
+
lines.push("", `${INDENT}User comment:`);
|
|
5006
|
+
for (const line of note.split("\n")) lines.push(`${INDENT}${line}`);
|
|
5007
|
+
}
|
|
5008
|
+
return lines.join("\n");
|
|
4334
5009
|
}
|
|
4335
5010
|
/**
|
|
4336
5011
|
* Render the marked passages as the preamble of an outgoing message.
|
|
4337
5012
|
*
|
|
4338
|
-
*
|
|
4339
|
-
*
|
|
5013
|
+
* Each annotation becomes a numbered entry, and the reader's own words follow
|
|
5014
|
+
* the last one as the body of the message.
|
|
4340
5015
|
* @param annotations - the annotations being sent.
|
|
4341
5016
|
* @returns message text, or an empty string when there are none.
|
|
4342
5017
|
*/
|
|
4343
5018
|
function annotationsPrompt(annotations) {
|
|
4344
5019
|
if (annotations.length === 0) return "";
|
|
4345
|
-
return
|
|
5020
|
+
return annotations.map((annotation, index) => `${index + 1}. ${annotationBlock(annotation)}`).join("\n\n");
|
|
4346
5021
|
}
|
|
4347
5022
|
/**
|
|
4348
5023
|
* Annotations whose passage is rendered in one Session's transcript.
|
|
@@ -5037,7 +5712,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
5037
5712
|
if (carrying) return;
|
|
5038
5713
|
carrying = true;
|
|
5039
5714
|
try {
|
|
5040
|
-
const missing = annotations.filter((annotation) => !draft.includes(
|
|
5715
|
+
const missing = annotations.filter((annotation) => !draft.includes(annotationBlock(annotation)));
|
|
5041
5716
|
if (missing.length > 0) {
|
|
5042
5717
|
const text = `${annotationsPrompt(missing)}\n\n`;
|
|
5043
5718
|
const insertion = inputActions.captureInsertion();
|
|
@@ -5316,6 +5991,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
5316
5991
|
en
|
|
5317
5992
|
}), "dsh-enhance: dictionaries");
|
|
5318
5993
|
installStyles(ctx);
|
|
5994
|
+
ctx.effect(() => installWhaleBubbles(document), "dsh-enhance: whale bubbles");
|
|
5319
5995
|
ctx.effect(() => installFileMenu(ctx, t), "dsh-enhance: file context menu");
|
|
5320
5996
|
const widthStore = pageStorage();
|
|
5321
5997
|
ctx.effect(() => installSidebarFloor(document, {
|
|
@@ -5325,6 +6001,7 @@ body[data-ds-dark-theme] .dsh-enhance-edit {
|
|
|
5325
6001
|
}
|
|
5326
6002
|
}), "dsh-enhance: sidebar floor");
|
|
5327
6003
|
ctx.effect(() => installSidebarTopRow(document), "dsh-enhance: sidebar top row");
|
|
6004
|
+
ctx.effect(() => installSectionStats(ctx, document), "dsh-enhance: section stats");
|
|
5328
6005
|
if (isDesktopShell()) ctx.effect(() => installStartupGeometry(window), "dsh-enhance: window geometry");
|
|
5329
6006
|
ctx.effect(() => installTurnBadge(ctx), "dsh-enhance: turn badge");
|
|
5330
6007
|
registerSideChat(ctx, t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-enhance",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "DeepSeek Harness enhancements: Markdown theme for every renderer, select-text annotations with pins, a file right-click menu, a narrower sidebar, and startup defaults (maximized window, narrowest sidebar, colourful running marker). 中文:DSH 增强插件——Markdown 主题、划词批注、文件右键菜单、侧栏宽度、启动默认状态。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|