dsh-focus-overlay 0.12.4 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- A <b>focus mode</b> for the DeepSeek Harness (DSH) web GUI: one click to a full-screen reading overlay that hides the header, composer and sidebars, folding the AI tool-call flow into official-style count summaries — leaving only the conversation between you and the AI.<br>
8
+ A <b>focus mode</b> for the DeepSeek Harness (DSH) web GUI and the macOS / Windows desktop app: one click to a full-screen reading overlay that hides the header, composer and sidebars, folding the AI tool-call flow into official-style count summaries — leaving only the conversation between you and the AI.<br>
9
9
  Text, images, the turn rail, width handles and the answer card all reuse or 1:1 replicate official components, matching the chat view's look.
10
10
  </p>
11
11
 
@@ -26,6 +26,7 @@
26
26
  - **Auto-focus & reminders** — after a reply completes normally, optionally auto-enter focus at your question; while in focus, get a toast for a new reply or when the AI is waiting on you
27
27
  - **Width handles** — draggable strips beside the content column (official WidthHandle replica) that resize the reading column live and persist
28
28
  - **Hotkey F** — press `F` anywhere to enter focus mode instantly (toggleable in settings); typing in an input never triggers it
29
+ - **Desktop window chrome** — adapts to the dsh desktop app (macOS / Windows): the focus title row is merged into the official frame clearance (48px macOS traffic lights / 40px Windows native titlebar), so the title and exit control share one line with the window controls and the whole row drags the window — no extra blank band above it; native fullscreen keeps a compact 40px title row
29
30
  - **Focus counter** — the settings card keeps a running total of your focus-mode entries; past 100 entries a GitHub Star nudge appears, is remembered after the first use, and then becomes a direct "open the project page" button
30
31
 
31
32
  These features are designed to give **small screens** more content space: tucking away the persistent header/composer and tool steps lets the conversation use as much of the screen as possible.
@@ -56,7 +57,9 @@ Click the line to expand that turn's full work detail (per-category one-line sum
56
57
  | Feature | Description |
57
58
  | --- | --- |
58
59
  | Full-screen overlay | Registered into `shell.overlay` (additive, `replaceRisk: none`) — covers header / composer / sidebar; the thin top bar keeps only the session title and an exit button |
59
- | Official rendering primitives | Assistant text through official `MarkdownText` (GFM + code highlighting + TeX + code copy buttons + footnotes); user messages through the official `projectUserText` projection; buttons, modals and icons are all official primitives |
60
+ | Official rendering primitives | Assistant text through official `MarkdownText` (GFM + code highlighting + TeX + code copy buttons + footnotes); user messages pick the official user-text projection the running dsh exports: `projectUserText` on 0.1.2–0.2.0 (plain runs plus `@`/`/` reference chips), and the official `UserTextRun` plain run after the 0.2.2 desktop runtime removed that function — a missing projection can never crash the overlay; buttons, modals and icons are all official primitives |
61
+ | Desktop window frame | The focus title row and the official window clearance are merged into one band: the overlay reserves ONLY `--dsh-frame-top-clearance` (48px macOS traffic lights / 40px Windows native titlebar), the title and exit control sit inside that row, and the transcript starts right below it — the old stacked 48px title row and the extra 20px dialog gap are gone. The row is the overlay’s last effective drag claim on macOS (Windows keeps the separate `.fm-frame-strip` over the caption band as the overlay’s last child; both carry `data-window-drag` + `-webkit-app-region: drag`), so scrolled content / the turn rail’s no-drag rects cannot cancel the band, while the exit control is explicitly `no-drag` and stays clickable; the title starts at x=88px on macOS to clear the traffic lights and clears the top-right native caption buttons on Windows. Native fullscreen (`data-fullscreen`) keeps only a compact 40px title row. On Windows it also hides the official sidebar-collapse and new-session controls that the window chrome promotes into the titlebar layer when the sidebar is collapsed / the window is narrow — otherwise they painted above the focus layer and a stray click switched sessions while reading; both come back with the chrome on exit. In a plain browser the variables and markers are absent, so the 0px fallback keeps the old pixel-identical layout |
62
+ | File-mention chips | Inline-code paths in AI replies resolve through the official `chatFileMentions` into clickable chips: on dsh 0.2.x the overlay passes the same real Turn face (`deliverables` projection) the official chat turn tail uses and opens through the sidebar resource controller's `dsh-resource://file/session/…` address; on dsh ≤ 0.1.x it keeps the legacy owner shape and `workspaces.openPath`. No chip without projection data, and a resolver failure never crashes the overlay |
60
63
  | Image resolution | Assistant `image` blocks resolve through `uiConversation.imageUrl` (the dsh 0.1.2+ session-authorized image cache), falling back to the legacy resolver on older dsh |
61
64
  | Tool-call folding | Follows the official "transcript view" preference (normal / compact); compact mode folds each turn's work part into a "N tool calls · M messages · K subagents" disclosure line ("Thought for a while" when nothing is countable), clickable to expand the full detail; steering messages always stay top-level, never buried; the last turn stays unfolded while streaming |
62
65
  | Categorized summaries | The expanded detail counts tools by family: commands / edits / searches / reads / directory listings / subagents / todos / goals / workflows / skills / questions / plans / background jobs / context injections |
@@ -82,11 +85,11 @@ Click the line to expand that turn's full work detail (per-category one-line sum
82
85
  | Render error boundary | The overlay content is wrapped in an error boundary: one render crash never bricks the Focus button — the next open retries |
83
86
  | DSH-better-sidebar compatibility | While in focus, a `<body>` marker makes the package stylesheet hide better-sidebar's top-right panel toggles and any open right/bottom panels (and release the squeezed layout); restored on exit |
84
87
  | Legacy compatibility mode | On dsh < 0.1.2 missing the new services, the overlay degrades gracefully (legacy snapshot adapters) with a one-time console notice — no crash |
85
- | Cross-release primitive compatibility | Official primitives renamed between major releases fall back by availability (dsh 0.2 removed the fixed-size `…14` / `…16` icons in favour of `…Regular` + `size`), so an `undefined` component can never throw React #130 |
88
+ | Cross-release primitive compatibility | Official primitives renamed between major releases fall back by availability (dsh 0.2 removed the fixed-size `…14` / `…16` icons in favour of `…Regular` + `size`; the dsh 0.2.2 desktop runtime removed `projectUserText` in favour of `UserTextRun`), so an `undefined` component can never throw React #130 |
86
89
 
87
90
  ## Install
88
91
 
89
- Requires the `dsh` CLI (`>= 0.1.2-rc.1`) and Node `>= 22.19.0`.
92
+ Requires `dsh` (Web CLI or the desktop app, `>= 0.1.2-rc.1`) and, for source installs, Node `>= 22.19.0`.
90
93
 
91
94
  **From npm (recommended)**
92
95
 
@@ -121,6 +124,14 @@ dsh web
121
124
 
122
125
  Restart `dsh web` after install.
123
126
 
127
+ **DSH desktop app (macOS / Windows)**
128
+
129
+ The desktop app manages plugins itself, no CLI needed: **Plugins → Add plugin** in the sidebar, enter `dsh-focus-overlay` (or a local directory / `link:` path such as `link:/path/to/dsh-focus-overlay`), then configure it on this plugin's detail page. Reload the desktop window (or restart the app) after installing or updating.
130
+
131
+ Desktop support is verified against **dsh desktop 0.2.2-rc.1**: macOS and Windows share the same Electron renderer and client contracts; the window-chrome differences (macOS traffic lights / Windows native titlebar) are driven by the official `data-platform` / `data-windows-titlebar` / `data-fullscreen` markers, and the plugin adapts through the official frame variables — one install serves both platforms. In focus mode the top of the overlay is a single draggable title row that shares the window-control line (no extra blank band above it); native fullscreen (macOS green button / Windows maximize) tightens it to a compact 40px row.
132
+
133
+ > The desktop app uses its own `desktop` profile: installing the plugin only into the Web CLI's `web` profile does not install it in the desktop app — add it once on the Plugins page there too.
134
+
124
135
  > **First run**: after restarting, the welcome page shows a one-time "Focus Mode" intro that explains the features and lets you configure them in place; all of these settings can be changed anytime — on newer dsh open this plugin's detail page from the sidebar "Plugins" page, on older dsh use "Settings → Plugins → Plugin configuration".
125
136
 
126
137
  ## Usage
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p align="center">中文 | <a href="README.en.md">English</a></p>
4
4
 
5
5
  <p align="center">
6
- 为 DeepSeek Harness(DSH)Web GUI 提供的<b>专注模式</b>:一键进入全屏阅读遮罩,隐藏标题区、输入区与侧栏,把 AI 的工具调用过程折叠成官方样式的计数摘要,只保留「你与 AI 的对话」本身。<br>
6
+ 为 DeepSeek Harness(DSH)Web GUI 与桌面版(macOS / Windows)提供的<b>专注模式</b>:一键进入全屏阅读遮罩,隐藏标题区、输入区与侧栏,把 AI 的工具调用过程折叠成官方样式的计数摘要,只保留「你与 AI 的对话」本身。<br>
7
7
  文本、图片、导航条、宽度调节与答题卡均复用或 1:1 复刻官方组件,观感与聊天视图一致。
8
8
  </p>
9
9
 
@@ -24,6 +24,7 @@
24
24
  - **自动专注与提醒** —— 回复正常完成后可自动进入专注并定位到你的提问;专注中收到新回复、或 AI 等待你回答时弹出提醒
25
25
  - **宽度调节** —— 正文两侧的拖拽把手(官方 WidthHandle 复刻),实时拖动阅读列宽并持久化
26
26
  - **快捷键 F** —— 任意界面按 `F` 一键进入专注模式,可在设置中关闭;输入框内打字不会误触发
27
+ - **桌面版窗口适配** —— 适配 dsh 桌面版(macOS / Windows):专注标题栏直接并进官方窗口留白(macOS 红绿灯 48px / Windows 原生标题栏 40px),标题与「退出专注」就在这一行里,整条标题栏可拖动窗口,不再额外占一行空白;原生全屏时收紧为 40px 紧凑标题行
27
28
  - **专注计数** —— 设置卡片最底部累计展示你进入专注模式的次数;超过 100 次后出现 GitHub Star 引导,点过一次即被记住,之后提供「前往 GitHub 项目页面」直达按钮
28
29
 
29
30
  这些功能专为**小屏幕**提供更多内容呈现空间:收起常驻的标题 / 输入区与工具步骤,让有限的屏幕尽可能多地展示对话。
@@ -54,7 +55,9 @@
54
55
  | 功能 | 说明 |
55
56
  | --- | --- |
56
57
  | 全屏专注遮罩 | 经 `shell.overlay` 注册(纯增量、`replaceRisk: none`),覆盖标题区 / 输入区 / 侧栏;顶部只留会话标题与「退出专注」按钮 |
57
- | 官方渲染原语 | AI 文本走官方 `MarkdownText`(GFM + 代码高亮 + TeX + 代码复制按钮 + 脚注),用户消息走官方 `projectUserText` 投影;按钮、模态、图标均为官方原语 |
58
+ | 官方渲染原语 | AI 文本走官方 `MarkdownText`(GFM + 代码高亮 + TeX + 代码复制按钮 + 脚注);用户消息按运行版本选择官方用户文本投影:dsh 0.1.2–0.2.0 用 `projectUserText`(纯文本 + `@`/`/` 引用 chip),dsh 0.2.2 桌面版移除了该函数后自动回退到官方 `UserTextRun`(纯文本 run),不会因 `undefined` 组件崩溃;按钮、模态、图标均为官方原语 |
59
+ | 桌面版窗口框架 | 专注标题栏与官方窗口留白合并为一条:只预留官方 `--dsh-frame-top-clearance`(macOS 红绿灯 48px / Windows 原生标题栏 40px),标题与「退出专注」就在这条标题栏内,正文紧接着从留白下沿开始,不再叠加原来那行 48px 标题栏、也不再占用官方弹窗额外的 20px 间距;标题行是叠加层里最后生效的拖拽矩形(macOS 由合并后的标题行自身声明;Windows 由 overlay 最后一个子节点 `.fm-frame-strip` 声明,均为 `data-window-drag` + `-webkit-app-region: drag`),保证滚动内容 / 右侧导航等 `no-drag` 矩形不会覆盖它,「退出专注」按钮显式排除拖拽、保持可点;标题在 macOS 从 x=88px 起避开红绿灯、在 Windows 避开右上角原生按钮;原生全屏(`data-fullscreen`)时只保留 40px 紧凑标题行;Windows 上还会隐藏被官方提升到标题栏层的「侧边栏开关」与「新建会话」按钮(侧栏折叠 / 窄窗口时出现),避免它们浮在专注层之上、误触后在你阅读时切换会话;退出专注后随窗口 chrome 一起恢复。普通浏览器中这些变量与标记不存在,回退 0px、与旧版逐像素一致 |
60
+ | 文件引用 chip | AI 回复中的行内代码路径由官方 `chatFileMentions` 解析为可点击 chip:dsh 0.2.x 传入官方同款的真实 Turn face(`deliverables` 投影),点击经右侧栏资源控制器以 `dsh-resource://file/session/…` 打开;dsh ≤ 0.1.x 继续使用旧的 owner 形状与 `workspaces.openPath`;无投影数据时不显示 chip,绝不因解析异常崩溃 |
58
61
  | 图片解析 | assistant 的 `image` 块经 `uiConversation.imageUrl`(dsh 0.1.2+ 的会话授权图片缓存)解析,旧版 dsh 自动回退到 legacy 解析器 |
59
62
  | 工具调用折叠 | 遵循官方「对话显示」偏好(normal / compact);compact 模式把每轮的工作部分折叠成「N 次工具调用 · M 条消息 · K 个 subagent」披露行(无内容时显示「已思考」),点击可展开完整明细;steering 消息始终独立成行不被折叠;流式中的最后一轮保持展开直到结束 |
60
63
  | 分类摘要明细 | 展开后按工具类别计数:命令 / 编辑 / 搜索 / 读取 / 列目录 / 子代理 / 待办 / 目标 / 工作流 / 技能 / 提问 / 计划 / 后台任务 / 上下文注入 |
@@ -80,11 +83,11 @@
80
83
  | 渲染错误兜底 | 遮罩内容包裹错误边界:一次渲染崩溃不会永久打死「专注」按钮,下次打开自动重试 |
81
84
  | 兼容 DSH-better-sidebar | 进入专注时在 `<body>` 打标记,样式层自动隐藏其右上角的收放面板按钮与已开启的右侧 / 底部面板,并释放被挤压的布局;退出专注后按原状态还原 |
82
85
  | 旧版兼容模式 | dsh < 0.1.2 缺少新服务时降级运行(legacy 快照适配),控制台一次性提示,不会崩溃 |
83
- | 跨版本构件兼容 | 图标等官方构件在两个大版本间改名时按可用性回退(dsh 0.2 移除了 `…14` / `…16` 定尺图标,改用 `…Regular` + `size`),不会因为 `undefined` 组件触发 React #130 |
86
+ | 跨版本构件兼容 | 图标等官方构件在两个大版本间改名时按可用性回退(dsh 0.2 移除了 `…14` / `…16` 定尺图标,改用 `…Regular` + `size`;dsh 0.2.2 桌面版移除了 `projectUserText`,回退到 `UserTextRun`),不会因为 `undefined` 组件触发 React #130 |
84
87
 
85
88
  ## 安装
86
89
 
87
- 需要 `dsh` CLI(`>= 0.1.2-rc.1`),Node `>= 22.19.0`。
90
+ 需要 `dsh`(Web CLI 或桌面版,`>= 0.1.2-rc.1`),Node `>= 22.19.0`(仅源码安装时需要 Node)。
88
91
 
89
92
  **从 npm(推荐)**
90
93
 
@@ -119,6 +122,14 @@ dsh web
119
122
 
120
123
  安装后重启 `dsh web` 生效。
121
124
 
125
+ **DSH 桌面版(macOS / Windows)**
126
+
127
+ dsh 桌面版自带插件管理,不需要 CLI:侧栏 **Plugins → 添加插件**,填入 `dsh-focus-overlay`(或本机目录 / `link:` 路径,例如 `link:/path/to/dsh-focus-overlay`),安装后在本插件详情页中配置。安装或更新后重新加载桌面窗口(或重启桌面应用)生效。
128
+
129
+ 桌面版适配基于 **dsh 桌面版 0.2.2-rc.1** 验证:macOS 与 Windows 共用同一套 Electron 渲染层与客户端契约,窗口框架差异(macOS 红绿灯 / Windows 原生标题栏)由官方 `data-platform` / `data-windows-titlebar` / `data-fullscreen` 标记驱动,插件按官方窗口框架变量自适应,无需按平台分别安装。专注模式下顶部只有一条与窗口控制键同行的可拖动标题栏(不再有额外的空白条);按原生全屏切换后(macOS 绿灯 / Windows 最大化按钮)收紧为 40px 紧凑标题行。
130
+
131
+ > 桌面版使用独立的 `desktop` profile:如果只在 Web CLI 的 `web` profile 里装过本插件,桌面版仍需在 Plugins 页面安装一次。
132
+
122
133
  > **首次安装**:重启后欢迎页会弹出一次「专注模式」引导,说明功能并让你就地完成配置;其中所有设置随时可以更改——新版 dsh 在侧栏「Plugins」页面中打开本插件的详情页,旧版在「设置 → 插件 → 插件配置」中。
123
134
 
124
135
  ## 使用
package/lib/client.js CHANGED
@@ -29,6 +29,46 @@ window.__ModuleLoader__.load({
29
29
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
30
30
  _deepseek_ai_dsh_client_ui_primitives = __toESM(_deepseek_ai_dsh_client_ui_primitives, 1);
31
31
  let react_jsx_runtime = require("react/jsx-runtime");
32
+ //#region src/client/primitives.ts
33
+ /** Cross-release primitives resolution.
34
+ *
35
+ * dsh keeps renaming/removing symbols in `@deepseek-ai/dsh-client-ui-primitives`
36
+ * between releases, and a stale named import resolves to `undefined` — React
37
+ * then throws #130 ("element type is invalid") the moment it renders. Two
38
+ * such breaks are already in this repo's history: `MessageText` (0.1.3) and
39
+ * the fixed-size icon variants (0.2). The 0.2.2 desktop runtime adds a third:
40
+ * `projectUserText` is gone.
41
+ *
42
+ * The official user-text pipeline changed shape in 0.2.2: the conversation
43
+ * surface now parses text itself and renders inline nodes, falling back to
44
+ * the `UserTextRun` primitive (a plain inline run) for unmatched text. This
45
+ * module picks whichever projection the running primitives module actually
46
+ * exports, so one client bundle serves 0.1.2 through 0.2.2:
47
+ *
48
+ * - dsh 0.1.2 … 0.2.0: `projectUserText(text, sessionLabels, …)` returns
49
+ * inline plain runs plus `@session` / `/skill` chips (the richer path).
50
+ * - dsh 0.2.2+: `UserTextRun` renders the text as a plain inline run; the
51
+ * overlay's bubble chrome still supplies `white-space: pre-wrap`, so the
52
+ * text keeps its shape. Reference chips in *user* text are the only
53
+ * cosmetic loss on that generation.
54
+ * - Anything else: return the raw string (React renders it as a text node).
55
+ *
56
+ * Import the namespace once (not named symbols) so the resolver can never
57
+ * crash at module-evaluation time. */
58
+ /** Render one user prompt's text through the projection the running dsh
59
+ * exports. `sessionLabels` feeds the older chip projection; newer
60
+ * generations ignore it. */
61
+ function projectUserTextCompat(text, sessionLabels = []) {
62
+ const primitives = _deepseek_ai_dsh_client_ui_primitives;
63
+ const project = primitives.projectUserText;
64
+ if (typeof project === "function") try {
65
+ return project(text, sessionLabels);
66
+ } catch {}
67
+ const UserTextRun = primitives.UserTextRun;
68
+ if (typeof UserTextRun === "function") return (0, react.createElement)(UserTextRun, { text });
69
+ return text;
70
+ }
71
+ //#endregion
32
72
  //#region src/client/icons.ts
33
73
  /** Cross-release product-icon resolution.
34
74
  *
@@ -200,6 +240,44 @@ window.__ModuleLoader__.load({
200
240
  const body = relative.split("/").map(encode).join("/");
201
241
  return `dsh-resource://file/session/${encode(String(sessionId))}/${body}`;
202
242
  }
243
+ /** Resolve the owner object the official `chatFileMentions.forClosing` expects.
244
+ *
245
+ * dsh 0.2.x's provider resolves a turn's produced / presented files through
246
+ * `owner.turn.data.get('deliverables')` — the owner the official ui-chat turn
247
+ * tail passes — and throws on the plain `{turn: {turn, step}}` owner shape the
248
+ * overlay used to pass; the caller's catch then silently disabled the inline
249
+ * file-mention chips (pre-existing on every 0.2 build, not a desktop
250
+ * regression). The Chat snapshot's `timeline.turns` carries the real Turn
251
+ * faces, so look one up by the assistant node's turn number. Chips belong to
252
+ * the settled closing reply only, so a missing or still-running turn resolves
253
+ * to null. Generations without a `timeline` (0.1.x) keep the legacy shape
254
+ * their provider accepts. */
255
+ function fileMentionOwnerOf(chatView, node, openFile) {
256
+ const turns = chatView && chatView.timeline ? chatView.timeline.turns : null;
257
+ if (turns && typeof turns.get === "function") {
258
+ const turnFace = turns.get(node && node.turn);
259
+ if (!turnFace || turnFace.status !== "closed") return null;
260
+ return {
261
+ owner: {
262
+ turn: turnFace,
263
+ seq: node.seq,
264
+ openFile
265
+ },
266
+ modern: true
267
+ };
268
+ }
269
+ return {
270
+ owner: {
271
+ turn: {
272
+ turn: node.turn,
273
+ step: node.step
274
+ },
275
+ seq: node.seq,
276
+ openFile
277
+ },
278
+ modern: false
279
+ };
280
+ }
203
281
  function flattenText(content) {
204
282
  if (!content || !content.length) return "";
205
283
  let out = "";
@@ -1783,8 +1861,81 @@ window.__ModuleLoader__.load({
1783
1861
  //#region src/client/styles.ts
1784
1862
  /** Package-owned stylesheet text (injected by the client apply, cleaned up on unload). */
1785
1863
  const FOCUS_CSS = `
1786
- .fm-overlay{position:fixed;inset:0;z-index:2147483000;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);display:flex;flex-direction:column;pointer-events:auto;font-family:var(--dsw-font-family,sans-serif);outline:none}
1787
- .fm-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.12));flex:0 0 auto}
1864
+ .fm-overlay{position:fixed;inset:0;z-index:2147483000;box-sizing:border-box;--fm-frame-band:0px;padding-top:var(--fm-frame-band);background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#1a1a1a);display:flex;flex-direction:column;pointer-events:auto;font-family:var(--dsw-font-family,sans-serif);outline:none}
1865
+ /* Desktop window frame (dsh desktop 0.2.2+, macOS and Windows) — the top band.
1866
+ The shell's hidden native titlebar area is ordinary web content owned by
1867
+ whatever fills the viewport, and the official layout publishes the
1868
+ clearance on <html> (dsh-client-ui-layout + the desktop preload):
1869
+ --dsh-frame-top-clearance is 48px on macOS (traffic lights: x16..77,
1870
+ y18..32) and the 40px caption height on Windows (--dsh-windows-titlebar-
1871
+ height). The overlay reserves EXACTLY that band, not
1872
+ --dsh-frame-overlay-top — that variable is clearance + 20px because the
1873
+ official full-window surfaces are dialogs that want a gap; a full-window
1874
+ reading surface must not pay the dialog gap.
1875
+ macOS: the band holds nothing but the traffic lights, so the focus title row
1876
+ is merged INTO it (see .fm-topbar) and the transcript starts right below it;
1877
+ native fullscreen has no traffic lights, so the band shrinks to a compact
1878
+ 40px title row.
1879
+ Windows: the band is NOT merged into, because the preload-injected web
1880
+ caption MENUBAR ([data-windows-menu], shadow DOM, z-index 1100) sits at the
1881
+ top-left of that band ABOVE this overlay (the overlay lives inside the
1882
+ official z-20 shell.overlay stacking context) and must stay visible — it is
1883
+ the only app menu. Merging the title row into the band would hide the title
1884
+ behind the menubar, so Windows keeps the band as caption chrome and puts the
1885
+ title row directly underneath it (see the win32 rules below).
1886
+ The 0px fallback keeps the plain web generation pixel-identical (no band;
1887
+ the topbar sits in normal flow). */
1888
+ html[data-platform=darwin] .fm-overlay{--fm-frame-band:var(--dsh-frame-top-clearance,48px)}
1889
+ html[data-platform=darwin][data-fullscreen] .fm-overlay{--fm-frame-band:40px}
1890
+ html[data-windows-titlebar] .fm-overlay{--fm-frame-band:var(--dsh-windows-titlebar-height,40px)}
1891
+ /* Windows desktop: dsh-client-ui-sidebar promotes the sidebar collapse toggle
1892
+ to a fixed z-30 layer itself, above the official shell.overlay layer (z-20)
1893
+ that hosts this overlay — so without this rule the toggle floats above focus
1894
+ mode inside the titlebar band and steals clicks/drags from the merged
1895
+ title row's drag band (macOS keeps it behind the overlay). Hide it exactly while focus is on; it
1896
+ comes back with the rest of the chrome when focus exits. */
1897
+ html[data-windows-titlebar] body[data-fm-focus] [data-sidebar-toggle]{display:none!important}
1898
+ /* Same Windows titlebar band: when the official sidebar is collapsed (user
1899
+ collapsed it, or the window is narrower than 768px — Windows has no drawer),
1900
+ dsh-client-ui-sidebar promotes its "new session" control to the same fixed
1901
+ z-30 titlebar layer (left:48px, top:6px). It would sit above the overlay and
1902
+ click-through would start a new session under the reader, so hide it with
1903
+ the rest of the window chrome while focus is on. The hashed class name is
1904
+ the only stable hook the shipped CSS exposes; the e2e desktop-frame leak
1905
+ guard fails loudly if a future build renames it. */
1906
+ html[data-windows-titlebar] body[data-fm-focus] [class*="newSession"]{display:none!important}
1907
+ /* Focus titlebar row. Plain web: an ordinary flow row above the body (it is
1908
+ the overlay's last-but-one DOM child because the Windows drag strip follows
1909
+ it; order:-1 keeps it visually first here).
1910
+ macOS desktop: merged INTO the reserved band — absolutely positioned over
1911
+ the overlay's padding-top area, exactly as tall as the band, so the title
1912
+ shares the line with the native traffic lights instead of stacking another
1913
+ 48px bar underneath an empty band. The title is cleared past the traffic
1914
+ lights (they end at x≈76.7; the official leading seat uses left:88). This
1915
+ row IS the macOS drag surface: data-window-drag (the official darwin rule)
1916
+ plus an explicit app-region declaration, with every interactive descendant
1917
+ excluded so controls inside the band stay clickable (darwin's official
1918
+ no-drag for button/[tabindex] is repeated here so the contract is local).
1919
+ Windows desktop: the caption band above is owned by the native caption
1920
+ buttons and the web caption menubar (which paints above the overlay), so the
1921
+ title row is an ordinary row BELOW that band — no drag region here and no
1922
+ overlap with the menubar; the Windows drag surface is the separate
1923
+ .fm-frame-strip over the band. */
1924
+ .fm-topbar{order:-1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.12));flex:0 0 auto}
1925
+ html[data-platform=darwin] .fm-topbar{position:absolute;top:0;left:0;right:0;height:var(--fm-frame-band);box-sizing:border-box;margin:0;padding:0 16px 0 88px;z-index:4;-webkit-app-region:drag;-webkit-user-select:none;user-select:none}
1926
+ html[data-platform=darwin][data-fullscreen] .fm-topbar{padding:0 16px}
1927
+ html[data-platform=darwin] .fm-topbar :is(button,a,input,select,textarea,summary,[contenteditable=true],[tabindex]){-webkit-app-region:no-drag}
1928
+ html[data-windows-titlebar] .fm-topbar{height:40px;box-sizing:border-box;margin:0;padding:0 16px;flex:0 0 40px}
1929
+ /* Windows desktop drag band: the 40px caption band above the title row is
1930
+ ordinary overlay background, with the web caption menubar (painted above the
1931
+ overlay) at its left and the native caption buttons (OS overlay) at its
1932
+ right. This strip claims the band as the window drag surface; it is the
1933
+ overlay's LAST child because Electron applies the renderer's app-region
1934
+ rects in layout-tree order and the later rect wins (see FocusView.tsx).
1935
+ Hidden on the plain web and on macOS, where the merged title row itself is
1936
+ the drag surface and there is no separate element to claim. */
1937
+ .fm-frame-strip{display:none}
1938
+ html[data-windows-titlebar] .fm-frame-strip{display:block;position:absolute;top:0;left:0;right:0;height:var(--fm-frame-band);-webkit-app-region:drag;-webkit-user-select:none;user-select:none;z-index:0}
1788
1939
  .fm-title{font-size:calc(14px + var(--dsh-content-font-delta,0px));font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1789
1940
  .fm-body-wrap{position:relative;flex:1 1 auto;display:flex;min-height:0}
1790
1941
  .fm-body{flex:1 1 auto;min-width:0;overflow-y:auto;padding:28px 28px 160px}
@@ -2399,16 +2550,18 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
2399
2550
  }
2400
2551
  /** Body of a sent user message / steering row.
2401
2552
  *
2402
- * dsh 0.1.3-alpha.2 removed the `MessageText` component from the primitives
2403
- * module in favour of the `projectUserText` display projection (which has
2404
- * existed since 0.1.2 and is still exported by 0.1.5). Importing the removed
2405
- * name made it `undefined`, so the overlay threw React #130 the moment it
2406
- * rendered a session containing a user message — the "toggle does nothing"
2407
- * symptom. `projectUserText` returns inline plain runs plus `@session` /
2408
- * `/skill` chips; `.fm-user` still supplies the bubble chrome and
2409
- * `white-space: pre-wrap`, so the text keeps its shape. */
2553
+ * The official user-text projection has now changed twice: dsh 0.1.3-alpha.2
2554
+ * removed `MessageText` in favour of `projectUserText` (which this component
2555
+ * then imported as a named binding — React #130 the moment a user row
2556
+ * rendered when the later removal made it `undefined`), and dsh 0.2.2's
2557
+ * desktop runtime removed `projectUserText` itself (the conversation surface
2558
+ * parses user text and falls back to the `UserTextRun` primitive).
2559
+ * `projectUserTextCompat` resolves the projection the running primitives
2560
+ * module exports (`projectUserText` → `UserTextRun` → raw text), so one
2561
+ * bundle serves 0.1.2 through 0.2.2. `.fm-user` still supplies the bubble
2562
+ * chrome and `white-space: pre-wrap`, so the text keeps its shape. */
2410
2563
  function UserText({ text }) {
2411
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, _deepseek_ai_dsh_client_ui_primitives.projectUserText)(text, []) });
2564
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: projectUserTextCompat(text) });
2412
2565
  }
2413
2566
  let bodyEl = null;
2414
2567
  const anchors = {};
@@ -2964,22 +3117,28 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
2964
3117
  sessions,
2965
3118
  currentId
2966
3119
  ]);
3120
+ /** Assistant-row inline-code file mentions. The official provider resolves
3121
+ * only a turn's produced / presented files, and dsh 0.2.x reads them from
3122
+ * the real Turn face (`owner.turn.data.get('deliverables')`) — the same
3123
+ * owner the official ui-chat turn tail passes. Handing it a plain
3124
+ * `{turn: number, step}` makes `forClosing` throw, and the plugin's catch
3125
+ * silently disabled the chips on every 0.2 build (pre-existing bug, not a
3126
+ * 0.2.2 regression). `fileMentionOwnerOf` (model.ts) resolves the Turn face
3127
+ * from the Chat snapshot's `timeline.turns`, and keeps the legacy owner
3128
+ * shape for generations without a timeline. */
2967
3129
  const fileMentionsFor = (0, react.useCallback)((node) => {
2968
3130
  if (!chatFileMentions) return void 0;
2969
3131
  try {
2970
- return chatFileMentions.forClosing({
2971
- turn: {
2972
- turn: node.turn,
2973
- step: node.step
2974
- },
2975
- seq: node.seq,
2976
- openFile: (path, options) => openMentionedFile(path, options)
2977
- }, currentId);
3132
+ const openFile = (path, options) => openMentionedFile(path, options);
3133
+ const resolved = fileMentionOwnerOf(chatView, node, openFile);
3134
+ if (resolved === null) return void 0;
3135
+ return chatFileMentions.forClosing(resolved.owner, currentId);
2978
3136
  } catch {
2979
3137
  return;
2980
3138
  }
2981
3139
  }, [
2982
3140
  chatFileMentions,
3141
+ chatView,
2983
3142
  currentId,
2984
3143
  openMentionedFile
2985
3144
  ]);
@@ -3030,7 +3189,7 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
3030
3189
  setDockFocused(f);
3031
3190
  if (!f) setEngaged(false);
3032
3191
  };
3033
- const queueCount = snap && snap.queue ? snap.queue.length : 0;
3192
+ const queueCount = inputState && Array.isArray(inputState.queue) ? inputState.queue.length : snap && snap.queue ? snap.queue.length : 0;
3034
3193
  const occCount = inputState && inputState.occurrences ? inputState.occurrences.length : 0;
3035
3194
  const promptErr = snap && snap.promptError && snap.promptError.op === "send" ? snap.promptError.error : null;
3036
3195
  const errorLine = promptErr ? promptErr.message || promptErr.code || "send failed" : null;
@@ -3348,18 +3507,6 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
3348
3507
  ref: overlayRef,
3349
3508
  tabIndex: -1,
3350
3509
  children: [
3351
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3352
- className: "fm-topbar",
3353
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3354
- className: "fm-title",
3355
- children: title
3356
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3357
- variant: "outline",
3358
- size: "sm",
3359
- onClick: () => focusStore.set(false),
3360
- children: t("exit")
3361
- })]
3362
- }),
3363
3510
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3364
3511
  className: "fm-body-wrap",
3365
3512
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3399,7 +3546,25 @@ body[data-fm-focus] #root :has(> [data-slot="conversation"]){margin-bottom:0!imp
3399
3546
  onJumpBottom: scrollToBottom
3400
3547
  })
3401
3548
  }) : null,
3402
- replyNotice
3549
+ replyNotice,
3550
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3551
+ className: "fm-topbar",
3552
+ "data-window-drag": true,
3553
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3554
+ className: "fm-title",
3555
+ children: title
3556
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
3557
+ variant: "outline",
3558
+ size: "sm",
3559
+ onClick: () => focusStore.set(false),
3560
+ children: t("exit")
3561
+ })]
3562
+ }),
3563
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3564
+ className: "fm-frame-strip",
3565
+ "data-window-drag": true,
3566
+ "aria-hidden": "true"
3567
+ })
3403
3568
  ]
3404
3569
  });
3405
3570
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-focus-overlay",
3
- "version": "0.12.4",
3
+ "version": "0.13.1",
4
4
  "description": "Focus Mode for the dsh web GUI: a full-screen reading overlay that hides chrome and folds the AI tool-call flow into summaries, reusing the official Markdown / image primitives.",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -32,7 +32,8 @@
32
32
  "0.1.2-rc.1": "compatible",
33
33
  "0.1.3-alpha.1": "compatible",
34
34
  "0.1.5-rc.1": "compatible",
35
- "0.2.0-rc.2": "compatible"
35
+ "0.2.0-rc.2": "compatible",
36
+ "0.2.2-rc.1": "compatible"
36
37
  }
37
38
  }
38
39
  },