deepseek-harness-background 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/README.zh.md +3 -0
- package/lib/client.js +221 -27
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ The look (fixed wallpaper layer + theme-aware scrim + translucent glass panels d
|
|
|
36
36
|
- **Fit modes** — `cover` (fill, crop) or `contain` (whole image).
|
|
37
37
|
- **Theme-aware scrim** — the light theme uses a white veil (lifts the art so dark text keeps contrast); the dark theme automatically switches to a black veil (dims the art so light text keeps contrast).
|
|
38
38
|
- **Frosted glass (whitelisted)** — while a background is active, only the surfaces that float as small cards over the wallpaper turn into translucent glass (specular sheen + `backdrop-filter`): the composer card and message bubbles, code blocks / terminal / diff / tool-IO cards / skill & MCP call cards and inline code, the agent task strips and their takeover panels (approval / question / plan review), the chrome buttons (new session, composer plus, scroll-to-bottom), the load-earlier history button, the subagent lineage popover, the sidebar build badge, and the home hero "preview" badge — every glassed surface carries the full recipe (fill + sheen + blur), never translucency without frost. Reading surfaces — dialogs, the settings UI, menus, tooltips, toasts, hover fills and every accent (the send button stays blue) — keep their **official opaque paints** so nothing legible turns washy. The blur radius is driven by the glass-blur slider; `panelOpacity` at 100% restores the official paints on the whitelisted list too.
|
|
39
|
+
- **Third-party glass registry** — any plugin can register its own panels into the same frosted-glass system through the published bridge (`window.__DSH_BACKGROUND_GLASS__` global + the `dsh-background-glass:ready` event): *token* mode adds the missing sheen + blur chain when the panel already fills with an overridden `--dsw-*` token, *fill* mode takes the fill over as well; every rule sits under the `data-dsh-bg-glass` gate so it toggles with the glass automatically. Consumers take zero dependencies and degrade gracefully when this plugin is absent; the whole bridge tears down with it. See [docs/GLASS_API.md](docs/GLASS_API.md).
|
|
39
40
|
- **Conversation timeline** — a DeepSeek-web-style scroll-navigation rail at the right edge of long conversations: one tick per user message on a frosted capsule; hovering expands it into a frosted panel listing every question (active one highlighted in brand blue); clicking jumps the chat to that message. **Key-point bookmarks** — star a question in the expanded panel (persisted per session): marked questions show a golden tick in the collapsed capsule and a "★ marked only" filter narrows the list. Jumps freeze the reading-position tracker until scrolling settles (no mid-jump jitter), and messages withdrawn by a rewind are dropped from the rail automatically. Collapsed and expanded share **one identical height** (no jump); idle ticks are **bottom-pinned** — the newest question's tick hugs the capsule's bottom edge like the official nav, fed by the full-session history regardless of how much of the conversation the chat view has paged in — and the expanded panel's clipped edges get the official **32px fade veils**. While the background glass is on, the rail joins the **same unified glass recipe** as the composer card and bubbles (fill follows panel opacity, blur follows the glass-blur slider); without glass it keeps the official DeepSeek frosted paints. Toggle it off with the timeline switch in the row. If the third-party dsh-chat-timeline plugin is also installed, this rail steps aside instead of doubling it.
|
|
40
41
|
- **Persisted in the official settings document** (`$DSH_HOME/settings.yaml`), waits out restarts.
|
|
41
42
|
- **Clean teardown** — disabling, clearing or uninstalling restores the original background exactly; the plugin only ever removes what it wrote.
|
|
@@ -97,6 +98,7 @@ dsh --profile web
|
|
|
97
98
|
- The plugin's own host routes (`/api/bg-wallpaper/*`: `settings`, `upload`, `image/<id>`) read/write the section and serve uploads with same-origin + size caps + MIME/signature checks + a path-escape fence. A custom route family is used because the api-proxy settings allowlist does not expose third-party namespaces over the settings RPC.
|
|
98
99
|
- The background is drawn as a fixed `z-index:-2` wallpaper layer plus a `z-index:-1` scrim on `body`, toggled by the `data-dsh-bg` attribute; the scrim switches white/black by `data-ds-dark-theme` in the injected stylesheet. Frosted glass is whitelist-scoped: only the whitelisted surfaces get `--dsw-*` surface-token overrides, while everything else is painted by explicit `data-dsh-bg-glass`-gated rules carrying the FULL recipe (fill + sheen + blur chain): the three chrome buttons, the load-earlier history button, the composer dock family (agent task strips TodoPanel / GoalBar / QueueDock and their takeover panels — approval, question, plan review — whose tokens turn translucent and need the blur added), the subagent lineage popover, the home hero preview badge and the sidebar build badge — every other official token and reading surface (menus, dialogs, tooltips, toasts) stays untouched.
|
|
99
100
|
- The **timeline rail** is registered into the `conversation.input.dock` slot (per-session lifecycle) and portals to `body`. Its data comes, fastest first, from a host-side session projection (`bgTimeline`, registered in `src/projection.ts`) that enumerates every user message of the whole session — including turns the conversation has not paged in yet — with the loaded chat-node window as fallback. The conversation's own lazy loading is never driven by the rail (jumping to an old message pages history on demand, exactly like clicking "load earlier"); bookmarks persist in localStorage per session. Idle (collapsed), the tick stack is pinned to the capsule's bottom edge — the newest question's tick always hugs the bottom, older ones clip at the top — matching the official ScrollNav; hovering expands and follows the reading position instead. The official DeepSeek frosted paints are the no-glass fallback — under `data-dsh-bg-glass` the rail joins the plugin's unified recipe (composer fill token + the glass-blur slider chain), exactly like the chrome buttons, code cards and the composer itself.
|
|
101
|
+
- The **third-party glass registry** (`src/client/glass-registry.ts`) publishes its bridge on client apply — before any repaint can race it: `register({ plugin, selectors, mode })` is idempotent per (plugin, mode, selector) triple and synthesizes explicit `body[data-dsh-bg-glass]`-gated recipe rules into a dedicated `<style data-plugin-css>` tag; selectors are structurally validated first (no `{ } ; @ < >`, no backslashes, 500-char cap) with per-selector warn-and-drop that never blocks valid siblings; disposing the client fiber retracts the whole bridge (stylesheet, entries, window key). Contract docs in `docs/GLASS_API.md` / `GLASS_API.zh.md`; behavior locked by `tests/glass-registry.spec.ts`.
|
|
100
102
|
- Uploads live under `$DSH_HOME/deepseek-harness-background/` (content-addressed ids). Switching to a new image or clearing the background deletes the superseded upload file, so the directory does not accumulate dead images in normal use. (An upload that is never saved into the section — e.g. the tab closes right after an upload — can leave one orphaned file behind.) Disable / uninstall leaves nothing behind.
|
|
101
103
|
|
|
102
104
|
## Development
|
|
@@ -124,6 +126,7 @@ deepseek-harness-background/ # the plugin repo (package name stays the
|
|
|
124
126
|
│ ├── index.ts # painter lifecycle + settings row registration
|
|
125
127
|
│ ├── backdrop.ts # fixed wallpaper layer + scrim + glass surface + preview vars
|
|
126
128
|
│ ├── background-css.ts # injected stylesheet (layers, glass, light/dark scrim, variables)
|
|
129
|
+
│ ├── glass-registry.ts # third-party glass registry (window bridge + gated rule synthesis)
|
|
127
130
|
│ ├── timeline.tsx # conversation timeline rail (ScrollNav port on the glass system)
|
|
128
131
|
│ ├── timeline-css.ts # timeline stylesheet (dsbt- prefixed, official metrics)
|
|
129
132
|
│ ├── SettingsRow.tsx # the General-settings row (preview surface + stepped sliders)
|
package/README.zh.md
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
- **填充方式** —— `cover`(铺满、裁剪)或 `contain`(完整、留白)。
|
|
37
37
|
- **主题自适应遮罩** —— 浅色主题用白色纱帘(把图片提亮保持深色文字对比度),深色主题自动换成黑色纱帘(压暗图片保持浅色文字对比度)。
|
|
38
38
|
- **毛玻璃(白名单制)** —— 启用背景后,只有以小卡片/小按钮形态悬浮在壁纸上的表面才会变成半透明玻璃(顶部白色高光渐变 + `backdrop-filter`):输入框卡片与消息气泡、代码块 / 终端 / diff / 工具 IO 卡 / 技能与 MCP 调用卡与行内代码、agent 任务条及其接管面板(审批 / 提问 / 计划评审)、三个铬件按钮(新会话、输入框加号、回到底部)、「加载更早」历史按钮、标题栏展开的子代理列表面板、侧栏构建徽标,以及首页右上角的「预览版」徽标——每块玻璃面都带完整配方(填充 + 高光 + 模糊),绝无"只透明不磨砂"的残缺面。阅读型表面——对话框、设置界面、菜单、Tooltip、Toast、悬停填充与所有强调色(发送键保持品牌蓝)——一律保留**官方不透明样式**,保证可读性。模糊半径由「毛玻璃模糊」滑块驱动;「面板不透明度」调至 100% 时白名单表面也恢复官方原样。
|
|
39
|
+
- **第三方毛玻璃接口** —— 内置毛玻璃注册表(`window.__DSH_BACKGROUND_GLASS__` 全局 + `dsh-background-glass:ready` 事件):任何插件都可把自家面板的选择器注册进来,套上与内置表面完全一致的配方——`token` 模式为已使用被覆盖 `--dsw-*` 填充的面板补齐高光+模糊链,`fill` 模式连填充一并接管;规则统一挂在 `data-dsh-bg-glass` 门控下随玻璃自动开关。消费方零依赖、未安装本插件时优雅降级,本插件卸载时整桥拆除。详见 [docs/GLASS_API.zh.md](docs/GLASS_API.zh.md)。
|
|
39
40
|
- **会话时间线** —— 长会话右缘的 DeepSeek 官网风格滚动导航轨:毛玻璃胶囊上每条用户消息一枚指示刻度;悬停展开为列出全部提问的毛玻璃面板(当前阅读位置品牌蓝高亮);点击跳转到对应消息。**重点书签**——展开面板内点击 ★ 标记重点提问(按会话持久化):已标记项在折叠胶囊上显示金色加宽刻度,「★ 只看标记」一键筛选;跳转期间冻结高亮跟踪(消除中途乱跳),被回退撤回的消息自动从轨道剔除。折叠态与展开态**共用同一高度**(零跳变);折叠刻度**贴底锚定**——最新提问的横杠始终贴住胶囊底缘(与官网一致),且由全量会话历史驱动、不受对话区分页加载进度影响;展开面板的裁切边缘带官方同款 **32px 淡化渐变**。开启背景毛玻璃后,导航轨与输入框、消息气泡共用**同一套玻璃配方**(透明度随「面板不透明度」、模糊随「毛玻璃模糊」滑块调节,不比其他表面更重);未开启背景时保持 DeepSeek 官网同款毛玻璃配色。可在设置行内用「会话时间线」开关关闭;若同时安装了第三方 dsh-chat-timeline 插件,本轨道会自动让位避免重叠。
|
|
40
41
|
- **持久化到官方设置文档** —— 存于 `$DSH_HOME/settings.yaml`,跨重启保留。
|
|
41
42
|
- **干净卸载** —— 关闭、清除或卸载后完整恢复原背景;插件只移除自己写过的内容。
|
|
@@ -97,6 +98,7 @@ dsh --profile web
|
|
|
97
98
|
- **会话时间线**注册进 `conversation.input.dock` 槽位(绑定每会话生命周期),portal 渲染到 `body`。数据按速度优先:host 侧会话投影 `bgTimeline`(见 `src/projection.ts`,完整枚举整个会话的全部用户消息——包括对话区尚未分页加载的早期内容),已加载聊天节点窗口作为兜底;轨道从不驱动对话区的懒加载策略(点击旧消息跳转时才按需补页,与点「加载更早」一致)。折叠态刻度列贴底锚定——最新一条提问的横杠始终贴住胶囊底缘、更早的向顶部裁掉,与官网 ScrollNav 一致;悬停展开则改为跟随阅读位置。书签存于 localStorage(按会话隔离)。官网同款毛玻璃配色仅作为未开背景时的兜底:开启玻璃后(`data-dsh-bg-glass`)轨道并入插件统一配方——与输入框一致的 token 填充 + 由「毛玻璃模糊」滑块驱动的同一滤镜链。
|
|
98
99
|
- 插件自有的 host 路由(`/api/bg-wallpaper/*`:`settings`、`upload`、`image/<id>`)负责读写设置与提供上传图片,带同源校验、大小上限、MIME/签名校验与路径穿越防护。使用自定义路由族,是因为 api-proxy 的 settings 白名单不向第三方命名空间开放 settings RPC。
|
|
99
100
|
- 背景以 `body` 上一张固定的 `z-index:-2` 壁纸层 + `z-index:-1` 遮罩绘制,由 `data-dsh-bg` 属性开关;遮罩在注入样式表里按 `data-ds-dark-theme` 切换白/黑纱帘。毛玻璃为白名单制:仅对输入/气泡/代码/任务条等白名单表面覆盖 `--dsw-*` surface token,其余表面通过 `data-dsh-bg-glass` 门控的显式规则补齐整套配方(填充 + 高光 + 模糊滤镜链):三个 chrome 按钮、「加载更早」历史按钮、composer 坞列家族——agent 任务条(TodoPanel / GoalBar / QueueDock)与接管面板(审批 / 提问 / 计划评审,token 变半透明后由这里补上模糊)、子代理列表弹出层、首页「预览版」徽标、侧栏构建徽章——全部官方 token 与阅读型界面(菜单/对话框/tooltip/toast)保持原样。
|
|
101
|
+
- **第三方玻璃注册表**(`src/client/glass-registry.ts`):客户端 apply 时即在 `window.__DSH_BACKGROUND_GLASS__` 发布注册 api 并派发 `dsh-background-glass:ready`;`register({ plugin, selectors, mode })` 按 `(plugin, mode, selector)` 三元组幂等登记,把 `body[data-dsh-bg-glass]` 门控的显式配方规则合成进独立的 `<style data-plugin-css>` 标签;选择器先做结构性校验(禁 `{} ; @ < >` 与反斜杠、500 字符上限),违规条目逐条警告并丢弃、不影响兄弟条目;fiber dispose 时整桥拆除(样式表、条目、window 键全清)。契约文档见 `docs/GLASS_API.md` / `GLASS_API.zh.md`,行为由 `tests/glass-registry.spec.ts` 锁定。
|
|
100
102
|
- 上传文件存放在 `$DSH_HOME/deepseek-harness-background/`(内容寻址 id)。切换新图片或清除背景时,被替换的旧上传文件会被自动回收,正常使用下目录不会堆积死图片。(例外:上传后从未保存进设置——例如上传后立刻关闭标签页——会留下一个孤儿文件。)关闭 / 卸载后不留残留。
|
|
101
103
|
|
|
102
104
|
## 开发
|
|
@@ -124,6 +126,7 @@ deepseek-harness-background/ # 插件仓库(包名保留 npm 风格 i
|
|
|
124
126
|
│ ├── index.ts # painter 生命周期 + 设置行注册
|
|
125
127
|
│ ├── backdrop.ts # 固定壁纸层 + 遮罩 + 玻璃表面 + 预览变量
|
|
126
128
|
│ ├── background-css.ts # 注入的样式表(层、玻璃、明暗遮罩、变量)
|
|
129
|
+
│ ├── glass-registry.ts # 第三方毛玻璃注册表(window 桥 + 门控规则合成)
|
|
127
130
|
│ ├── timeline.tsx # 会话时间线导航轨(官方 ScrollNav 结构 × 本插件玻璃体系)
|
|
128
131
|
│ ├── timeline-css.ts # 时间线样式(dsbt- 前缀,官方度量)
|
|
129
132
|
│ ├── SettingsRow.tsx # 通用设置中的设置行(预览卡 + 阻尼滑块)
|
package/lib/client.js
CHANGED
|
@@ -688,6 +688,198 @@ window.__ModuleLoader__.load({
|
|
|
688
688
|
function clearPreviewSurface(el) {
|
|
689
689
|
for (const name of PREVIEW_VARS) el.style.removeProperty(name);
|
|
690
690
|
}
|
|
691
|
+
/** Property name on window where the api is published. */
|
|
692
|
+
const GLASS_BRIDGE_GLOBAL = "__DSH_BACKGROUND_GLASS__";
|
|
693
|
+
/** DOM event announced once the api becomes available (detail = the api). */
|
|
694
|
+
const GLASS_READY_EVENT = "dsh-background-glass:ready";
|
|
695
|
+
/** Style-tag dedup key of the registry stylesheet (data-plugin-css). */
|
|
696
|
+
const REGISTRY_CSS_TAG = "deepseek-harness-background/glass-registry";
|
|
697
|
+
/** Plugin identity stamped onto the registry <style> element. */
|
|
698
|
+
const PLUGIN_ID = "deepseek-harness-background";
|
|
699
|
+
/** Characters whose presence would let a selector escape its rule context. */
|
|
700
|
+
const FORBIDDEN_SELECTOR_CHARS = [
|
|
701
|
+
"{",
|
|
702
|
+
"}",
|
|
703
|
+
";",
|
|
704
|
+
"@",
|
|
705
|
+
"<",
|
|
706
|
+
">"
|
|
707
|
+
];
|
|
708
|
+
/** Hard cap on one selector's length (diagnostics-friendly, abuse-proof). */
|
|
709
|
+
const MAX_SELECTOR_LENGTH = 500;
|
|
710
|
+
/** Hard cap on selectors per registration call. */
|
|
711
|
+
const MAX_SELECTORS_PER_SPEC = 64;
|
|
712
|
+
/**
|
|
713
|
+
* Validate one raw selector string. Structural checks only: anything that
|
|
714
|
+
* could escape the generated rule body ({}, ;, @, <, >) is rejected, and a
|
|
715
|
+
* backslash is refused too (escape sequences have no business in an anchor
|
|
716
|
+
* selector); ordinary CSS mistakes (a typo'd pseudo-class) are left to the
|
|
717
|
+
* browser, which drops just that one rule — a safe failure mode.
|
|
718
|
+
* @returns an error message, or null when the selector is acceptable.
|
|
719
|
+
*/
|
|
720
|
+
function selectorProblem(selector) {
|
|
721
|
+
if (typeof selector !== "string") return "must be a string";
|
|
722
|
+
const trimmed = selector.trim();
|
|
723
|
+
if (trimmed === "") return "must not be empty";
|
|
724
|
+
if (trimmed.length > MAX_SELECTOR_LENGTH) return "exceeds the 500-character limit (" + trimmed.length + ")";
|
|
725
|
+
for (const ch of FORBIDDEN_SELECTOR_CHARS) if (trimmed.includes(ch)) return "contains a forbidden character (" + JSON.stringify(ch) + ")";
|
|
726
|
+
if (trimmed.includes(String.fromCharCode(92))) return "contains a backslash (escape sequences are not accepted)";
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
/** Normalize a spec into validated (plugin, mode, selector) triples.
|
|
730
|
+
* @returns the accepted triples plus one warning line per rejected selector. */
|
|
731
|
+
function normalizeSpec(spec) {
|
|
732
|
+
const plugin = typeof spec?.plugin === "string" && spec.plugin.trim() !== "" ? spec.plugin.trim() : "(anonymous)";
|
|
733
|
+
const mode = spec?.mode === "fill" ? "fill" : "token";
|
|
734
|
+
const raw = Array.isArray(spec?.selectors) ? [...spec.selectors] : [spec?.selectors];
|
|
735
|
+
const rows = [];
|
|
736
|
+
const warnings = [];
|
|
737
|
+
if (raw.length > MAX_SELECTORS_PER_SPEC) warnings.push("[glass-registry] " + plugin + ": " + raw.length + " selectors exceeds the 64-selector cap; extra entries dropped.");
|
|
738
|
+
for (const item of raw.slice(0, MAX_SELECTORS_PER_SPEC)) {
|
|
739
|
+
const problem = selectorProblem(item);
|
|
740
|
+
if (typeof item !== "string" || problem !== null) {
|
|
741
|
+
warnings.push("[glass-registry] " + plugin + ": rejected selector " + JSON.stringify(item) + " — " + (problem ?? "must be a string") + ".");
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
rows.push({
|
|
745
|
+
plugin,
|
|
746
|
+
mode,
|
|
747
|
+
selector: item.trim()
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
rows,
|
|
752
|
+
warnings
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Render one registered surface as a gated CSS rule — the same recipes the
|
|
757
|
+
* built-in sheets emit for their explicit-fill families.
|
|
758
|
+
*/
|
|
759
|
+
function ruleFor(row) {
|
|
760
|
+
const fill = row.mode === "fill" ? "background-color: var(--dsw-specific-input-major); background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01)); -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01); backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);" : "background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01)); -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01); backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);";
|
|
761
|
+
return "body[data-dsh-bg-glass] " + row.selector + " { " + fill + " }";
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Owns the registered surfaces and the registry stylesheet.
|
|
765
|
+
*/
|
|
766
|
+
var GlassRegistry = class {
|
|
767
|
+
entries = /* @__PURE__ */ new Map();
|
|
768
|
+
styleEl = null;
|
|
769
|
+
disposed = false;
|
|
770
|
+
/**
|
|
771
|
+
* Register one spec. See BackgroundGlassApi.register.
|
|
772
|
+
* @param spec - the surfaces to glass.
|
|
773
|
+
* @returns the unregister function (idempotent).
|
|
774
|
+
*/
|
|
775
|
+
register(spec) {
|
|
776
|
+
if (this.disposed || publishedRegistry !== void 0 && publishedRegistry !== this) {
|
|
777
|
+
console.warn("[glass-registry] registration ignored: this bridge is no longer the live publication");
|
|
778
|
+
return () => {};
|
|
779
|
+
}
|
|
780
|
+
let normalized;
|
|
781
|
+
try {
|
|
782
|
+
normalized = normalizeSpec(spec);
|
|
783
|
+
} catch (error) {
|
|
784
|
+
console.warn("[glass-registry] spec rejected: " + (error instanceof Error ? error.message : String(error)));
|
|
785
|
+
normalized = {
|
|
786
|
+
rows: [],
|
|
787
|
+
warnings: []
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
const { rows, warnings } = normalized;
|
|
791
|
+
for (const message of warnings) console.warn(message);
|
|
792
|
+
const owner = {};
|
|
793
|
+
const keys = [];
|
|
794
|
+
for (const row of rows) {
|
|
795
|
+
const key = JSON.stringify([
|
|
796
|
+
row.plugin,
|
|
797
|
+
row.mode,
|
|
798
|
+
row.selector
|
|
799
|
+
]);
|
|
800
|
+
this.entries.set(key, {
|
|
801
|
+
row,
|
|
802
|
+
owner
|
|
803
|
+
});
|
|
804
|
+
keys.push(key);
|
|
805
|
+
}
|
|
806
|
+
this.sync();
|
|
807
|
+
let unregistered = false;
|
|
808
|
+
return () => {
|
|
809
|
+
if (unregistered) return;
|
|
810
|
+
unregistered = true;
|
|
811
|
+
for (const key of keys) {
|
|
812
|
+
const entry = this.entries.get(key);
|
|
813
|
+
if (entry !== void 0 && entry.owner === owner) this.entries.delete(key);
|
|
814
|
+
}
|
|
815
|
+
this.sync();
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
/** Rebuild the registry stylesheet from the live entries. */
|
|
819
|
+
sync() {
|
|
820
|
+
if (this.entries.size === 0) {
|
|
821
|
+
this.styleEl?.remove();
|
|
822
|
+
this.styleEl = null;
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
const seen = /* @__PURE__ */ new Set();
|
|
826
|
+
const rules = [];
|
|
827
|
+
for (const { row } of this.entries.values()) {
|
|
828
|
+
const rule = ruleFor(row);
|
|
829
|
+
if (!seen.has(rule)) {
|
|
830
|
+
seen.add(rule);
|
|
831
|
+
rules.push(rule);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
if (this.styleEl === null) {
|
|
835
|
+
this.styleEl = document.createElement("style");
|
|
836
|
+
this.styleEl.dataset.plugin = PLUGIN_ID;
|
|
837
|
+
this.styleEl.dataset.pluginCss = REGISTRY_CSS_TAG;
|
|
838
|
+
document.head.appendChild(this.styleEl);
|
|
839
|
+
}
|
|
840
|
+
this.styleEl.textContent = rules.join(String.fromCharCode(10));
|
|
841
|
+
}
|
|
842
|
+
/** Tear everything down: entries, stylesheet, and the window publication. */
|
|
843
|
+
dispose() {
|
|
844
|
+
this.disposed = true;
|
|
845
|
+
this.entries.clear();
|
|
846
|
+
this.sync();
|
|
847
|
+
const w = window;
|
|
848
|
+
if (w["__DSH_BACKGROUND_GLASS__"] === this.api) delete w[GLASS_BRIDGE_GLOBAL];
|
|
849
|
+
if (publishedRegistry === this) publishedRegistry = void 0;
|
|
850
|
+
}
|
|
851
|
+
/** The published api face over this registry. */
|
|
852
|
+
api = {
|
|
853
|
+
version: 1,
|
|
854
|
+
bridgeId: "deepseek-harness-background",
|
|
855
|
+
isActive: () => typeof document !== "undefined" && document.body !== null && document.body.hasAttribute("data-dsh-bg-glass"),
|
|
856
|
+
register: (spec) => this.register(spec)
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
/** The registry whose api is CURRENTLY published on window. Module-level on
|
|
860
|
+
* purpose: the published api face deliberately carries no dispose member
|
|
861
|
+
* (internal teardown stays unreachable for consumers), so reinstall-time
|
|
862
|
+
* cleanup needs a handle the window key cannot provide. */
|
|
863
|
+
let publishedRegistry;
|
|
864
|
+
/**
|
|
865
|
+
* Publish the glass registry bridge onto window and announce it. Safe to
|
|
866
|
+
* call repeatedly: a previous publication's REGISTRY is disposed first, so
|
|
867
|
+
* exactly one bridge — and one stylesheet — is ever live.
|
|
868
|
+
* @returns the bridge handle — call .dispose() when this plugin's client
|
|
869
|
+
* fiber tears down.
|
|
870
|
+
*/
|
|
871
|
+
function installGlassBridge() {
|
|
872
|
+
publishedRegistry?.dispose();
|
|
873
|
+
document.querySelector("style[data-plugin-css=\"deepseek-harness-background/glass-registry\"]")?.remove();
|
|
874
|
+
const registry = new GlassRegistry();
|
|
875
|
+
publishedRegistry = registry;
|
|
876
|
+
window[GLASS_BRIDGE_GLOBAL] = registry.api;
|
|
877
|
+
window.dispatchEvent(new CustomEvent(GLASS_READY_EVENT, { detail: registry.api }));
|
|
878
|
+
return {
|
|
879
|
+
api: registry.api,
|
|
880
|
+
dispose: () => registry.dispose()
|
|
881
|
+
};
|
|
882
|
+
}
|
|
691
883
|
//#endregion
|
|
692
884
|
//#region src/client/locales.ts
|
|
693
885
|
/** Chinese copy. */
|
|
@@ -895,41 +1087,41 @@ window.__ModuleLoader__.load({
|
|
|
895
1087
|
document.head.appendChild(tag);
|
|
896
1088
|
}
|
|
897
1089
|
var SettingsRow_module_css_default = {
|
|
898
|
-
"error": "-ozqdq_error",
|
|
899
|
-
"urlRow": "-ozqdq_urlRow",
|
|
900
1090
|
"switch": "-ozqdq_switch",
|
|
901
|
-
"
|
|
902
|
-
"
|
|
903
|
-
"
|
|
1091
|
+
"preview": "-ozqdq_preview",
|
|
1092
|
+
"sliderLabel": "-ozqdq_sliderLabel",
|
|
1093
|
+
"segRow": "-ozqdq_segRow",
|
|
1094
|
+
"urlRow": "-ozqdq_urlRow",
|
|
1095
|
+
"previewImg": "-ozqdq_previewImg",
|
|
904
1096
|
"previewGlass": "-ozqdq_previewGlass",
|
|
905
|
-
"
|
|
906
|
-
"
|
|
907
|
-
"
|
|
908
|
-
"segGroup": "-ozqdq_segGroup",
|
|
909
|
-
"previewScrim": "-ozqdq_previewScrim",
|
|
910
|
-
"previewGlassText": "-ozqdq_previewGlassText",
|
|
1097
|
+
"hint": "-ozqdq_hint",
|
|
1098
|
+
"header": "-ozqdq_header",
|
|
1099
|
+
"slider": "-ozqdq_slider",
|
|
911
1100
|
"title": "-ozqdq_title",
|
|
912
|
-
"
|
|
913
|
-
"
|
|
1101
|
+
"segLabel": "-ozqdq_segLabel",
|
|
1102
|
+
"urlInput": "-ozqdq_urlInput",
|
|
1103
|
+
"error": "-ozqdq_error",
|
|
1104
|
+
"enabledBadge": "-ozqdq_enabledBadge",
|
|
1105
|
+
"btnPrimary": "-ozqdq_btnPrimary",
|
|
1106
|
+
"clearBtn": "-ozqdq_clearBtn",
|
|
1107
|
+
"sectionLabel": "-ozqdq_sectionLabel",
|
|
914
1108
|
"switchKnob": "-ozqdq_switchKnob",
|
|
915
|
-
"
|
|
1109
|
+
"section": "-ozqdq_section",
|
|
1110
|
+
"sliderValue": "-ozqdq_sliderValue",
|
|
1111
|
+
"row": "-ozqdq_row",
|
|
1112
|
+
"previewScrim": "-ozqdq_previewScrim",
|
|
916
1113
|
"desc": "-ozqdq_desc",
|
|
917
|
-
"
|
|
918
|
-
"
|
|
919
|
-
"sectionLabel": "-ozqdq_sectionLabel",
|
|
920
|
-
"enabledBadge": "-ozqdq_enabledBadge",
|
|
1114
|
+
"segGroup": "-ozqdq_segGroup",
|
|
1115
|
+
"clearRow": "-ozqdq_clearRow",
|
|
921
1116
|
"segActive": "-ozqdq_segActive",
|
|
1117
|
+
"sliderRow": "-ozqdq_sliderRow",
|
|
1118
|
+
"btn": "-ozqdq_btn",
|
|
1119
|
+
"titleRow": "-ozqdq_titleRow",
|
|
922
1120
|
"btnDanger": "-ozqdq_btnDanger",
|
|
923
|
-
"
|
|
1121
|
+
"previewGlassText": "-ozqdq_previewGlassText",
|
|
1122
|
+
"sourceRow": "-ozqdq_sourceRow",
|
|
924
1123
|
"segBtn": "-ozqdq_segBtn",
|
|
925
|
-
"
|
|
926
|
-
"preview": "-ozqdq_preview",
|
|
927
|
-
"row": "-ozqdq_row",
|
|
928
|
-
"segLabel": "-ozqdq_segLabel",
|
|
929
|
-
"header": "-ozqdq_header",
|
|
930
|
-
"slider": "-ozqdq_slider",
|
|
931
|
-
"btnPrimary": "-ozqdq_btnPrimary",
|
|
932
|
-
"section": "-ozqdq_section"
|
|
1124
|
+
"previewEmpty": "-ozqdq_previewEmpty"
|
|
933
1125
|
};
|
|
934
1126
|
//#endregion
|
|
935
1127
|
//#region src/client/SettingsRow.tsx
|
|
@@ -2444,6 +2636,7 @@ window.__ModuleLoader__.load({
|
|
|
2444
2636
|
* @param ctx - client cordis context (slots/locale/sessions injected).
|
|
2445
2637
|
*/
|
|
2446
2638
|
function apply(ctx) {
|
|
2639
|
+
const glassBridge = installGlassBridge();
|
|
2447
2640
|
const paint = () => {
|
|
2448
2641
|
const snapshot = settingsClient.getSnapshot();
|
|
2449
2642
|
const value = snapshot.status === "ready" ? snapshot.value : void 0;
|
|
@@ -2474,6 +2667,7 @@ window.__ModuleLoader__.load({
|
|
|
2474
2667
|
}, TimelineRail));
|
|
2475
2668
|
ctx.effect(() => () => {
|
|
2476
2669
|
unsubscribe();
|
|
2670
|
+
glassBridge.dispose();
|
|
2477
2671
|
backgroundPainter.dispose();
|
|
2478
2672
|
}, "deepseek-harness-background: background surface");
|
|
2479
2673
|
}
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["useState","useRef","css","useSyncExternalStore","useCallback","reactDom"],"sources":["../src/client/background-css.ts","../src/settings.ts","../src/client/backdrop.ts","../src/client/locales.ts","../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../src/client/settings-client.ts","../src/client/SettingsRow.tsx","../src/client/timeline-css.ts","../src/client/timeline.tsx","../src/client/index.ts"],"sourcesContent":["/**\n * Background CSS — the stylesheet injected once into the document when the\n * plugin first runs. It defines the behind-body wallpaper layer, the scrim,\n * and the frosted-glass surfaces, all driven by CSS variables the painter\n * writes onto `document.body`. Kept in a single idempotent\n * `<style data-plugin-css>` tag (mirrors the reference `dsh-wallpaper-engine`\n * bundle).\n */\n\n/** Unique id stamped on the injected style element (dedup key). */\nexport const BACKGROUND_CSS_TAG = 'deepseek-harness-background/styles'\n\n/** Body attribute the painter sets while a wallpaper is active. */\nexport const ACTIVE_ATTR = 'data-dsh-bg'\n\n/**\n * Body attribute the painter sets only while the glass is actually on (a\n * wallpaper is active AND panelOpacity < 1). The explicit-fill rules below —\n * whitelisted buttons, popovers and badges whose official fills are not\n * token-mediated — key on this gate so they return to the exact official\n * paints when the user maxes the panel-opacity slider.\n */\nexport const GLASS_ATTR = 'data-dsh-bg-glass'\n\n/**\n * The backdrop CSS. The wallpaper is a fixed `z-index:-2` element (below the\n * scrim at `-1`, below the UI). While active, the app frame + sidebar fills\n * turn transparent so all columns share one backdrop.\n *\n * Frosted glass is a WHITELIST, not a blanket: only the surfaces that float\n * as small cards/buttons over the wallpaper are glassed — composer card,\n * message bubbles, code surfaces (blocks, inline code, tool IO cards,\n * skill/MCP call cards), the three chrome buttons (new session, composer +\n * button, scroll-to-bottom), the load-earlier history button, the composer\n * dock family (agent task strips: TodoPanel / GoalBar / QueueDock) and its\n * takeover panels (approval, question, plan review), the subagent lineage\n * popover, the home hero \"preview\" badge, the sidebar build badge, and the\n * timeline rail (timeline-css.ts). Every glassed surface shares ONE recipe:\n * fill from the painter's --dsw-specific-input-major token (same alpha\n * curve + theme dimming), the full shared blur/saturate/brightness chain\n * driven by the glass-blur slider, and the shared sheen vars — so no\n * surface reads heavier than the composer card. Dialogs, the settings UI,\n * menus, tooltips, toasts and every hover/accent fill keep the OFFICIAL\n * opaque paints — they are reading surfaces and must stay legible.\n *\n * Selectors target authored attributes (`data-dsh-bg`, `data-composer-card`,\n * `data-terminal`…), the `:global` `.md-code-block` anchor, and CSS-module\n * SUFFIX conventions (`_bubble`, `_newSession`…) audited for collisions:\n * `_bubble` excludes `role=\"tooltip\"` (Tooltip.module.css shares the suffix),\n * `_add` is scoped under `[data-composer-card]` (DiffBlock line markers share\n * it), `_newSession` excludes `Label` (the button's inner label span) and\n * `_toBottom` excludes `Slot` (the zero-height sticky wrapper) — both share\n * the substring with the chrome control but must keep their own paint, and\n * the subagent popover is `role=\"tree\"` + `_menu` so the generic menu\n * surface stays untouched.\n */\nexport const BACKGROUND_CSS = `\n .dsh-bg-layer {\n position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none;\n }\n .dsh-bg-layer .dsh-bg-image {\n width: 100%; height: 100%; display: block; border: 0; background: transparent;\n object-fit: var(--bg-object-fit, cover);\n opacity: var(--bg-opacity, 1);\n filter: blur(var(--bg-wallpaper-blur, 0px));\n /* Blur thins the edges; scale the image up to hide the fringe. */\n transform: scale(var(--bg-wallpaper-scale, 1));\n transform-origin: center;\n }\n /* Scrim is theme-aware: a WHITE veil in the light scheme (it lifts the art\n toward the near-white surface so dark text keeps contrast) and a BLACK veil\n in the dark scheme (it dims the art so light text keeps contrast). */\n .dsh-bg-scrim {\n position: fixed; inset: 0; z-index: -1; pointer-events: none;\n background: rgba(255, 255, 255, var(--bg-scrim, 0.25));\n }\n body[data-ds-dark-theme] .dsh-bg-scrim {\n background: rgba(0, 0, 0, var(--bg-scrim, 0.25));\n }\n\n /* Active: make the app frame + sidebar background transparent so all columns\n share the same wallpaper + scrim backdrop. */\n body[data-dsh-bg] {\n --dsw-alias-bg-base: transparent;\n --dsw-specific-sidebar-fill: transparent;\n }\n\n /* ---- Whitelisted frosted-glass sheet ---------------------------------\n Fills come from the --dsw-* tokens the painter overrides on body ONLY for\n this list's own surfaces (input/bubble/code/tip); this block adds the\n shared wet-glass sheen + blur from --bg-glass-blur. Exposure is calibrated\n per scheme (the painter writes --bg-glass-brightness / --bg-glass-sheen):\n light glass slightly DIMS, dark glass keeps a slight lift. Gated on the\n GLASS ATTR (wallpaper active AND panelOpacity < 1): maxing the panel\n slider returns these surfaces to the exact official paints. */\n body[data-dsh-bg-glass] [data-composer-card],\n body[data-dsh-bg-glass] [class*=\"_bubble\"]:not([role=\"tooltip\"]),\n body[data-dsh-bg-glass] .md-code-block,\n body[data-dsh-bg-glass] [data-terminal],\n body[data-dsh-bg-glass] [data-diff],\n body[data-dsh-bg-glass] [data-read],\n body[data-dsh-bg-glass] [data-search],\n body[data-dsh-bg-glass] [data-web],\n body[data-dsh-bg-glass] [class*=\"_ioCard\"],\n body[data-dsh-bg-glass] [class*=\"_instructionsCard\"],\n body[data-dsh-bg-glass] [class*=\"_markdown\"] :not(pre) > code {\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 -1px 0 rgba(255, 255, 255, 0.08),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.08),\n 0 12px 40px rgba(0, 0, 0, 0.12);\n }\n\n /* The sticky code-block header officially occludes scrolled code with\n bg-base (transparent under a wallpaper): refill it with the banner token\n (itself translucent glass) so code stays hidden beneath the sticky bar. */\n body[data-dsh-bg] .md-code-block [class*=\"_bannerWrap\"] {\n background-color: var(--dsw-alias-markdown-code-block-banner);\n }\n\n /* The sidebar build badge paints with the label-ink token — a TEXT token we\n must not override globally — so it gets a theme-aware translucent ink. */\n body[data-dsh-bg] [class*=\"_buildRevision\"] {\n background-color: rgba(15, 17, 21, 0.62);\n }\n body[data-ds-dark-theme][data-dsh-bg] [class*=\"_buildRevision\"] {\n background-color: rgba(249, 250, 251, 0.62);\n }\n\n /* The empty-state hero glow asset would wash out the wallpaper behind the\n welcome message — dim it so the art stays visible. */\n body[data-dsh-bg] [class*=\"_heroGlow\"] {\n opacity: 0.2;\n }\n\n /* ---- Whitelisted chrome buttons --------------------------------------\n These three buttons' official fills ride button-* tokens shared with\n unrelated surfaces, so instead of overriding the tokens they get explicit\n paints — but the SAME glass recipe as the composer card and bubbles:\n fill = the painter's --dsw-specific-input-major token (the identical\n translucent white + theme curve), filter = the sheet's exact\n blur/saturate/brightness chain (blur follows the glass-blur slider, no\n caps), sheen = the shared sheen vars. Hover = the same white glass at the\n boosted alpha var. Gated on data-dsh-bg-glass (off when the panel is\n fully opaque). */\n body[data-dsh-bg-glass] [class*=\"_newSession\"]:not([class*=\"Label\"]),\n body[data-dsh-bg-glass] [data-composer-card] [class*=\"_add\"],\n body[data-dsh-bg-glass] [class*=\"_toBottom\"]:not([class*=\"Slot\"]) {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),\n 0 4px 14px rgba(0, 0, 0, 0.08);\n }\n body[data-dsh-bg-glass] [class*=\"_newSession\"]:not([class*=\"Label\"]):hover,\n body[data-dsh-bg-glass] [data-composer-card] [class*=\"_add\"]:hover:not(:disabled),\n body[data-dsh-bg-glass] [class*=\"_toBottom\"]:not([class*=\"Slot\"]):hover {\n background-color: color-mix(in srgb, rgb(255 255 255) calc(var(--bg-glass-alpha-strong, 0.8) * 100%), transparent);\n }\n /* Collapsed rail renders the new-session control as a bare icon — keep the\n official transparent paint (and its official translucent hover). */\n body[data-dsh-bg-glass] [class*=\"_collapsed\"] [class*=\"_newSession\"],\n body[data-dsh-bg-glass] [class*=\"_collapsed\"] [class*=\"_newSession\"]:hover {\n background-color: transparent;\n background-image: none;\n box-shadow: none;\n }\n\n /* ---- Subagent lineage popover (title-bar expanded list) --------------\n Its official fill rides the menu token shared with every dropdown; glass\n THIS popover explicitly via its role=\"tree\" + _menu combination so real\n menus stay officially opaque and legible. Same unified recipe: the\n composer fill token + the full shared filter chain (the official\n elevation shadow stays). */\n body[data-dsh-bg-glass] [role=\"tree\"][class*=\"_menu\"] {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n\n /* ---- Home hero \"preview\" badge (top-right superscript pill) ----------\n Officially the state-business-tertiary pastel; re-emit the same hue as\n glass but with the UNIFIED alpha curve (color-mix against the painter's\n --bg-glass-alpha) and the shared blur chain, so it sits on the wallpaper\n with exactly the glass strength of the composer card. */\n body[data-dsh-bg-glass] [class*=\"_previewBadge\"] {\n background-color: color-mix(in srgb, rgb(228 237 253) calc(var(--bg-glass-alpha, 0.72) * 100%), transparent);\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n body[data-ds-dark-theme][data-dsh-bg-glass] [class*=\"_previewBadge\"] {\n background-color: color-mix(in srgb, rgb(52 65 91) calc(var(--bg-glass-alpha, 0.72) * 100%), transparent);\n }\n\n /* ---- Composer dock family: task strips + takeover panels --------------\n The agent task strips (TodoPanel, GoalBar, QueueDock — one dock column\n above the composer) and the composer takeovers (approval, question,\n plan review) paint with tokens the painter turns translucent\n (--dsw-specific-tip / --dsw-specific-input-major) but their own styles\n never blur anything: translucent-without-blur reads as bare\n transparency, not frosted glass. Give each the shared sheen + filter\n chain; their fills stay token-driven so the panel-opacity slider keeps\n driving them. Anchors are the components' own stable data attributes\n plus a structural child, so no generic class suffix is swept in. */\n body[data-dsh-bg-glass] [data-testid=\"todo-panel\"],\n body[data-dsh-bg-glass] [data-goal-bar] > div,\n body[data-dsh-bg-glass] [data-queue-dock] > div,\n body[data-dsh-bg-glass] [data-approval-key] > div,\n body[data-dsh-bg-glass] [data-question-key] > section,\n body[data-dsh-bg-glass] [data-plan-review-key] > section {\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n\n /* ---- \"Load earlier\" history button (top of long conversations) --------\n Its official fill is an opaque solid button token that is deliberately\n NOT overridden, so unlike the tip family it needs an explicit glass\n fill too — same recipe as the three chrome buttons above. */\n body[data-dsh-bg-glass] [class*=\"_older\"] button {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),\n 0 4px 14px rgba(0, 0, 0, 0.08);\n }\n body[data-dsh-bg-glass] [class*=\"_older\"] button:hover:not(:disabled) {\n background-color: color-mix(in srgb, rgb(255 255 255) calc(var(--bg-glass-alpha-strong, 0.8) * 100%), transparent);\n }\n\n /* Sidebar build badge: translucent ink already, but it sat directly on\n the wallpaper without frost. Join the shared blur chain under the same\n gate (its theme-aware ink fills from the active block above). */\n body[data-dsh-bg-glass] [class*=\"_buildRevision\"] {\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n`\n\n/**\n * Inject the backdrop stylesheet once. Safe to call repeatedly; a second call\n * is a no-op (dedup key on the style tag).\n */\nexport function injectBackgroundCss(): void {\n if (document.querySelector(`style[data-plugin-css=\"${BACKGROUND_CSS_TAG}\"]`)) return\n const tag = document.createElement('style')\n tag.dataset.plugin = 'deepseek-harness-background'\n tag.dataset.pluginCss = BACKGROUND_CSS_TAG\n tag.textContent = BACKGROUND_CSS\n document.head.appendChild(tag)\n}\n","/** Durable background settings — pure constants/types shared by both halves. */\r\n\r\n/** Settings namespace owned by the background plugin. */\r\nexport const BACKGROUND_SETTINGS_NAMESPACE = 'ui-background'\r\n\r\n/**\r\n * The schema's field names, in schema order. Used as a whitelist when a\r\n * section write commits: the settings layer keeps unknown keys in the user\r\n * document (a legacy schema field would linger forever under a merge-only\r\n * write), so the write path strips everything outside this list.\r\n */\r\nexport const BACKGROUND_SETTINGS_FIELDS = [\r\n 'enabled', 'uploadId', 'url', 'opacity', 'scrim',\r\n 'panelOpacity', 'blur', 'wallpaperBlur', 'fit', 'timeline',\r\n] as const\r\n\r\n/** Browser-facing base path of the background API (shared with the host routes). */\r\nexport const BACKGROUND_API_PREFIX = '/api/bg-wallpaper'\r\n\r\n/** Minimum scrim opacity (0 = no veil at all). */\r\nexport const SCRIM_MIN = 0\r\n\r\n/** Maximum scrim opacity (1 = fully opaque veil — hides the wallpaper entirely).\r\n * Kept at 1 so every percent-unit slider shares one 0..1 domain: the same\r\n * displayed percentage puts every thumb at the same fraction of its track. */\r\nexport const SCRIM_MAX = 1\r\n\r\n/** Default scrim strength applied over user art (a light readability veil). */\r\nexport const DEFAULT_SCRIM = 0.25\r\n\r\n/** Default background image opacity (1 = fully opaque). */\r\nexport const DEFAULT_OPACITY = 1\r\n\r\n/** Minimum background image opacity (0 = fully invisible). */\r\nexport const OPACITY_MIN = 0\r\n\r\n/** Maximum background image opacity (1 = fully opaque). */\r\nexport const OPACITY_MAX = 1\r\n\r\n/** Default panel opacity (0..1); 1 = fully opaque official surfaces, 0 = fully transparent glass. */\r\nexport const DEFAULT_PANEL_OPACITY = 0.15\r\n\r\n/** Minimum panel opacity. */\r\nexport const PANEL_OPACITY_MIN = 0\r\n\r\n/** Maximum panel opacity (opaque — effectively disables the glass). */\r\nexport const PANEL_OPACITY_MAX = 1\r\n\r\n/** Default frosted-glass blur radius in px (0 disables backdrop-filter). */\r\nexport const DEFAULT_BLUR = 16\r\n\r\n/** Minimum glass blur radius. */\r\nexport const BLUR_MIN = 0\r\n\r\n/** Maximum glass blur radius. */\r\nexport const BLUR_MAX = 40\r\n\r\n/** Default wallpaper blur radius in px (blurs the image itself). */\r\nexport const DEFAULT_WALLPAPER_BLUR = 0\r\n\r\n/** Maximum wallpaper blur radius. */\r\nexport const WALLPAPER_BLUR_MAX = 60\r\n\r\n/** Whether the DeepSeek-style conversation timeline rail renders (default on). */\r\nexport const DEFAULT_TIMELINE = true\r\n\r\n/**\r\n * Session-projection key this plugin owns in the client-visible value map —\r\n * the host fold registers it (src/projection.ts) and the rail reads it\r\n * (src/client/timeline.tsx); one shared constant so the two can never drift.\r\n */\r\nexport const TIMELINE_PROJECTION_KEY = 'bgTimeline'\r\n\r\n/** Default background rendering mode. */\r\nexport const DEFAULT_FIT = 'cover'\r\n\r\n/** Image positioning modes. `cover` fills the frame (cropping as needed); `contain` fits the whole image inside the frame (letterboxing). */\r\nexport const FIT_MODES = ['cover', 'contain'] as const\r\n\r\n/** Background rendering mode. */\r\nexport type BackgroundFit = typeof FIT_MODES[number]\r\n\r\n/**\r\n * User-owned background section, resolved from schema defaults + user layer.\r\n * The active source is either a local upload id (host serves it via\r\n * `/api/bg-wallpaper/image/<id>`) or a raw HTTP(S) image URL the browser\r\n * loads; exactly one of `uploadId` / `url` is set — when both are empty no\r\n * background renders.\r\n */\r\nexport interface BackgroundSettings {\r\n /** Whether the custom background renders at all. */\r\n enabled: boolean\r\n /** Local upload id when the active source is an uploaded file. */\r\n uploadId: string\r\n /** Image URL when the active source is a remote URL. */\r\n url: string\r\n /** Background image opacity (0..1); the image fades toward the surface color. */\r\n opacity: number\r\n /** Readability scrim strength (0..1) layered between the art and the UI. */\r\n scrim: number\r\n /** Panel transparency (0..1): 0 = fully transparent surfaces, 1 = unaffected. */\r\n panelOpacity: number\r\n /** Frosted-glass blur radius on opaque surfaces (px; 0 disables). */\r\n blur: number\r\n /** Blur of the wallpaper image itself (px; 0 disables). */\r\n wallpaperBlur: number\r\n /** How the image fits the frame. */\r\n fit: BackgroundFit\r\n /** Whether the conversation timeline rail renders at the right edge. */\r\n timeline: boolean\r\n}\r\n","/**\n * Background painter — renders the user background behind the whole app frame:\n * a fixed `z-index:-2` wallpaper element plus a `z-index:-1` scrim on\n * `document.body`, driven by the `data-dsh-bg` body attribute and a set of\n * CSS variables. It also applies the frosted-glass surface tokens so the\n * wallpaper shows through translucent input / bubble panels.\n *\n * Retraction discipline mirrors the reference skin plugins: every property /\n * DOM node this painter owns is restored to its prior state on dispose, and\n * the `data-ds-dark-theme` observer is disconnected.\n */\n\nimport { ACTIVE_ATTR, GLASS_ATTR, injectBackgroundCss } from './background-css.ts'\nimport { BACKGROUND_API_PREFIX, type BackgroundSettings } from '../settings.ts'\n\n/** Class names the layer and scrim elements carry. */\nconst LAYER_CLASS = 'dsh-bg-layer'\nconst IMAGE_CLASS = 'dsh-bg-image'\nconst SCRIM_CLASS = 'dsh-bg-scrim'\n\n/** Body style properties the painter owns while a wallpaper paints: the app\n * frame and sidebar fills go transparent so every column shares one art.\n * Inline values outrank any stylesheet rule (the body[data-dsh-bg] gate only\n * covers the CSS copy), so a sourceless section must actively restore them. */\nconst FRAME_TOKENS = ['--dsw-alias-bg-base', '--dsw-specific-sidebar-fill'] as const\n\n/**\n * White-glass tokens — the WHITELISTED surfaces only. Everything that floats\n * as a small card over the wallpaper: the composer input stack, message\n * bubbles, the markdown code surfaces (blocks + banner + inline code), and\n * the agent task strip family (`--dsw-specific-tip`: TodoPanel + GoalBar +\n * QueueDock share one dock column and one fill token). Menus, dialogs, the\n * settings UI, tooltips, toasts, hover fills and every accent keep the\n * OFFICIAL token values — they are reading surfaces and must stay legible.\n * `factor` scales the alpha relative to the input surface.\n */\nconst GLASS_SURFACE_TOKENS: readonly { token: string; factor: number }[] = [\n { token: '--dsw-specific-input-major', factor: 1 },\n { token: '--dsw-specific-bubble', factor: 0.8 },\n { token: '--dsw-alias-markdown-code-block', factor: 1 },\n { token: '--dsw-alias-markdown-code-block-banner', factor: 1 },\n { token: '--dsw-alias-markdown-inline-code', factor: 0.9 },\n { token: '--dsw-specific-tip', factor: 1 },\n]\n\n/** Every token the glass owns (save/restore key set). */\nconst GLASS_TOKENS: readonly string[] = GLASS_SURFACE_TOKENS.map(({ token }) => token)\n\n/** Fraction of the official white surface alpha kept at the most transparent panel setting. */\nconst GLASS_MIN_ALPHA = 0.05\n\n/** Base white-glass alpha for one panelOpacity (the curve every surface shares). */\nfunction glassAlpha(panelOpacity: number): number {\n const alpha = GLASS_MIN_ALPHA + panelOpacity * (0.9 - GLASS_MIN_ALPHA)\n return Math.max(0, Math.min(0.9, alpha))\n}\n\n/**\n * Saturation boost that rides the blur radius. Gentler than the reference\n * engine (1.1 + blur * 0.02, capped at 1.6): stacking a hot saturate on top of\n * the brightness/sheen layers pushed bright wallpapers into clipping.\n */\nfunction glassSaturate(blur: number): number {\n if (blur <= 0) return 1\n // Round off float dust (1.1 + 16 * 0.02 is 1.4200000000000002 raw).\n return Math.round(Math.min(1.6, 1.1 + blur * 0.02) * 1000) / 1000\n}\n\n/**\n * Exposure calibration per scheme. Light glass neither boosts brightness nor\n * stacks a heavy sheen (mainstream frosted recipes — macOS vibrancy, Windows\n * acrylic, common web glass — blur + saturate + tint without a positive\n * brightness gain); dark glass keeps the reference engine's slight lift, which\n * stops the white-glass fills from turning muddy.\n */\nfunction glassExposure(inDark: boolean): { brightness: string; sheen: string; sheenMid: string } {\n return inDark\n ? { brightness: '1.04', sheen: '0.16', sheenMid: '0.05' }\n : { brightness: '0.98', sheen: '0.07', sheenMid: '0.02' }\n}\n\n/**\n * The theme-aware base alpha for one panelOpacity — THE curve every glass\n * surface shares (surface tokens, bare alpha knobs and the settings preview\n * included). Single-sourced here so the live painter and the preview card\n * cannot drift.\n */\nfunction glassBaseAlpha(panelOpacity: number, inDark: boolean): number {\n return glassAlpha(panelOpacity) * (inDark ? 0.4 : 0.8)\n}\n\n/**\n * The theme-aware glass surface alphas for one panelOpacity: the input-surface\n * token and the bubble token share one curve, dimmed per scheme. Shared by the\n * live painter and the settings-row preview card so the two cannot drift.\n */\nfunction glassSurfaceAlphas(panelOpacity: number, inDark: boolean): { major: string; bubble: string } {\n const alpha = glassBaseAlpha(panelOpacity, inDark)\n return {\n major: `rgba(255, 255, 255, ${alpha.toFixed(3)})`,\n bubble: `rgba(255, 255, 255, ${(alpha * 0.8).toFixed(3)})`,\n }\n}\n\n/**\n * Resolve the effective background image url for a section.\n * @param settings - resolved background section.\n * @returns the image url, or '' when no source is set.\n */\nexport function backgroundImageUrl(settings: BackgroundSettings, uploadBase: string): string {\n if (settings.uploadId) return `${uploadBase}/image/${settings.uploadId}`\n return settings.url\n}\n\n/**\n * Manage the behind-body wallpaper + scrim layers and the glass surface.\n */\nexport class BackgroundPainter {\n private layer: HTMLDivElement | null = null\n private img: HTMLImageElement | null = null\n private scrim: HTMLDivElement | null = null\n private observer: MutationObserver | undefined\n private active = false\n private settings: BackgroundSettings | undefined\n private readonly savedTokens = new Map<string, string>()\n private readonly savedVars = new Map<string, string>()\n\n /** Remember + hijack a property only once so dispose restores the original. */\n private rememberOnce(prop: string): void {\n if (this.savedTokens.has(prop) || this.savedVars.has(prop)) return\n const value = document.body.style.getPropertyValue(prop)\n if (GLASS_TOKENS.includes(prop)) {\n this.savedTokens.set(prop, value)\n } else {\n this.savedVars.set(prop, value)\n }\n }\n\n /**\n * Apply the latest settings. Idempotent.\n * @param settings - resolved background section.\n * @param uploadBase - the API base for resolving uploads.\n */\n apply(settings: BackgroundSettings, uploadBase: string): void {\n this.settings = settings\n if (!settings.enabled) {\n this.dispose()\n return\n }\n injectBackgroundCss()\n\n const url = backgroundImageUrl(settings, uploadBase)\n if (url === '') {\n // No source: the frame transparency is owned only while a wallpaper\n // paints — hand the base/sidebar fills back (a sourceless \"enabled\"\n // section must never leave transparent chrome over the bare page), and\n // drop the theme observer + glass tokens whose flip handler would\n // otherwise re-write translucent panels over that bare page too.\n this.observer?.disconnect()\n this.observer = undefined\n this.restoreFrameTokens()\n this.applySurfaceGlass(settings, true)\n this.active = false\n this.removeLayers()\n document.body.removeAttribute(ACTIVE_ATTR)\n return\n }\n\n // Transparent frame: all columns share the wallpaper behind the UI.\n for (const prop of FRAME_TOKENS) {\n this.rememberOnce(prop)\n document.body.style.setProperty(prop, 'transparent')\n }\n\n // Wallpaper layer + scrim.\n if (!this.layer) {\n this.layer = document.createElement('div')\n this.layer.className = LAYER_CLASS\n this.img = document.createElement('img')\n this.img.className = IMAGE_CLASS\n this.img.alt = ''\n // Remote-url sources must not leak the local origin via Referer.\n this.img.referrerPolicy = 'no-referrer'\n this.layer.appendChild(this.img)\n document.body.appendChild(this.layer)\n }\n // Compare the *attribute* (the raw value we set) rather than the .src\n // property, which resolves to an absolute URL and would make this check\n // always-true for relative urls. Same-value writes are no-ops in the DOM,\n // so this is a clarity fix, not a behavior fix.\n if (this.img && this.img.getAttribute('src') !== url) this.img.src = url\n\n if (!this.scrim) {\n this.scrim = document.createElement('div')\n this.scrim.className = SCRIM_CLASS\n document.body.appendChild(this.scrim)\n }\n document.body.setAttribute(ACTIVE_ATTR, 'on')\n this.active = true\n\n // Push the knobs into CSS variables.\n const s = document.body.style\n this.setVar('--bg-object-fit', settings.fit)\n this.setVar('--bg-opacity', String(settings.opacity))\n this.setVar('--bg-wallpaper-blur', `${settings.wallpaperBlur}px`)\n this.setVar('--bg-wallpaper-scale', (1 + settings.wallpaperBlur * 0.006).toFixed(4))\n this.setVar('--bg-scrim', String(settings.scrim))\n this.setVar('--bg-glass-blur', `${settings.blur}px`)\n this.setVar('--bg-glass-saturate', String(glassSaturate(settings.blur)))\n\n // Glass surface: theme-aware translucent token (panelOpacity === 1 keeps\n // the official opaque surfaces and disables the blur).\n this.applySurfaceGlass(settings, false)\n\n // Theme observer: repaint the glass tokens when the light/dark scheme\n // flips (the surface translucency differs between schemes). Disconnects\n // on dispose.\n if (!this.observer) {\n this.observer = new MutationObserver(() => this.applySurfaceGlass(this.settings, false))\n this.observer.observe(document.body, { attributes: true, attributeFilter: ['data-ds-dark-theme'] })\n }\n }\n\n/** Write one owned CSS variable onto body. */\nprivate setVar(name: string, value: string): void {\n this.rememberOnce(name)\n document.body.style.setProperty(name, value)\n}\n\n/**\n * Return the owned frame-transparency properties to their saved state (or\n * remove them when this session never overrode them). dispose() restores\n * everything wholesale; this targeted variant serves the sourceless path,\n * where the painter keeps running for a later source.\n */\nprivate restoreFrameTokens(): void {\n for (const prop of FRAME_TOKENS) {\n this.rememberOnce(prop)\n const original = this.savedVars.get(prop)\n if (original !== undefined && original !== '') document.body.style.setProperty(prop, original)\n else document.body.style.removeProperty(prop)\n }\n}\n\n/**\n * Update one effect knob without re-running the full apply. This is the hot\n * path for slider drags (many events per second): only the single CSS\n * variable changes, the DOM layers are untouched.\n * @param key - the knob to update.\n * @param value - its new value in its canonical unit.\n */\nsetKnob(key: 'opacity' | 'scrim' | 'blur' | 'wallpaperBlur' | 'fit', value: number | BackgroundSettings['fit']): void {\n if (this.settings === undefined || !this.settings.enabled) return\n switch (key) {\n case 'opacity':\n this.setVar('--bg-opacity', String(value))\n break\n case 'scrim':\n this.setVar('--bg-scrim', String(value))\n break\n case 'blur': {\n this.setVar('--bg-glass-blur', `${value}px`)\n this.setVar('--bg-glass-saturate', String(glassSaturate(Number(value))))\n break\n }\n case 'wallpaperBlur': {\n this.setVar('--bg-wallpaper-blur', `${value}px`)\n this.setVar('--bg-wallpaper-scale', (1 + Number(value) * 0.006).toFixed(4))\n break\n }\n case 'fit':\n this.setVar('--bg-object-fit', String(value))\n break\n }\n}\n\n /**\n * Apply the translucent-glass surface tokens (or restore the official ones\n * when the panel is fully opaque / there is no background).\n * @param settings - resolved section (for panelOpacity).\n * @param forceRestore - true to restore official surfaces regardless (used\n * when no source is set, so leftover glass tokens never linger).\n */\n private applySurfaceGlass(settings: BackgroundSettings | undefined, forceRestore: boolean): void {\n const s = document.body.style\n const inDark = document.body.dataset.dsDarkTheme !== undefined\n // Always remember the original surface values so a restore / dispose\n // returns them cleanly.\n for (const token of GLASS_TOKENS) this.rememberOnce(token)\n\n const restore = () => {\n for (const token of GLASS_TOKENS) {\n const original = this.savedTokens.get(token)\n if (original !== undefined && original !== '') s.setProperty(token, original)\n else s.removeProperty(token)\n }\n }\n\n if (forceRestore || settings === undefined || settings.panelOpacity >= 1) {\n restore()\n document.body.removeAttribute(GLASS_ATTR)\n // No blur and a neutral exposure when glass is off; the bare alpha\n // knobs only matter under the glass gate.\n this.setVar('--bg-glass-blur', '0px')\n this.setVar('--bg-glass-brightness', '1')\n s.removeProperty('--bg-glass-alpha')\n s.removeProperty('--bg-glass-alpha-strong')\n return\n }\n\n document.body.setAttribute(GLASS_ATTR, 'on')\n\n // Exposure calibration (theme-aware, mirrored by the preview surface).\n const exposure = glassExposure(inDark)\n this.setVar('--bg-glass-brightness', exposure.brightness)\n this.setVar('--bg-glass-sheen', exposure.sheen)\n this.setVar('--bg-glass-sheen-mid', exposure.sheenMid)\n\n // Dark scheme uses a lower white alpha (the wallpaper stays visible\n // without washing the surface), mirroring the reference engine.\n const base = glassBaseAlpha(settings.panelOpacity, inDark)\n for (const { token, factor } of GLASS_SURFACE_TOKENS) {\n s.setProperty(token, `rgba(255, 255, 255, ${(base * factor).toFixed(3)})`)\n }\n // Bare alpha knobs for the surfaces that keep their own hue (preview\n // badge, via color-mix) or need a hover boost (chrome buttons): the same\n // curve every glass surface shares.\n this.setVar('--bg-glass-alpha', base.toFixed(3))\n this.setVar('--bg-glass-alpha-strong', Math.min(0.9, base * 1.5).toFixed(3))\n }\n\n /** Remove the wallpaper + scrim layers and clear the active attribute. */\n private removeLayers(): void {\n if (this.layer) { this.layer.remove(); this.layer = null; this.img = null }\n if (this.scrim) { this.scrim.remove(); this.scrim = null }\n }\n\n /** Restore every owned property and remove the layers. */\n dispose(): void {\n this.observer?.disconnect()\n this.observer = undefined\n this.removeLayers()\n const s = document.body.style\n document.body.removeAttribute(ACTIVE_ATTR)\n document.body.removeAttribute(GLASS_ATTR)\n for (const [prop, value] of this.savedTokens) s.setProperty(prop, value)\n for (const [prop, value] of this.savedVars) s.setProperty(prop, value)\n this.savedTokens.clear()\n this.savedVars.clear()\n this.active = false\n this.settings = undefined\n }\n\n /** @returns whether a wallpaper is currently rendered. */\n isActive(): boolean {\n return this.active\n }\n}\n\n/** Module-level painter singleton shared by the settings row preview and the live apply. */\nexport const backgroundPainter = new BackgroundPainter()\n\n/**\n * Apply the given settings through the shared painter (idempotent). Convenience\n * used by the settings row for live previews and by the plugin apply to render\n * the persisted section.\n * @param settings - settings to apply (may be an unsaved draft for preview).\n */\nexport function paintBackground(settings: BackgroundSettings): void {\n backgroundPainter.apply(settings, BACKGROUND_API_PREFIX)\n}\n\n/** Numeric effect knobs the slider drag path repaints. */\nexport type BackgroundKnob = 'opacity' | 'scrim' | 'blur' | 'wallpaperBlur' | 'fit'\n\n/**\n * Update one effect knob on the live backdrop without re-running the full\n * apply — the hot path for slider drags (see BackgroundPainter.setKnob).\n * @param key - the knob to update.\n * @param value - its new value.\n */\nexport function paintBackgroundKnob(key: BackgroundKnob, value: number | BackgroundSettings['fit']): void {\n backgroundPainter.setKnob(key, value)\n}\n\n/** Preview variables the settings-surface preview card consumes. */\nconst PREVIEW_VARS = [\n '--bg-opacity', '--bg-scrim', '--bg-object-fit',\n '--bg-wallpaper-blur', '--bg-wallpaper-scale',\n '--bg-glass-blur', '--bg-glass-saturate', '--bg-glass-brightness',\n '--bg-preview-glass',\n] as const\n\n/**\n * Push the effect knobs onto one element (the settings-surface preview card)\n * so dragging a slider updates the card without touching the live backdrop.\n * The card's CSS reads the same variable names as the painter writes on body.\n * @param el - the preview element.\n * @param settings - the draft settings to render (may be unsaved).\n */\nexport function paintPreviewSurface(el: HTMLElement, settings: BackgroundSettings): void {\n const s = el.style\n s.setProperty('--bg-object-fit', settings.fit)\n s.setProperty('--bg-opacity', String(settings.opacity))\n s.setProperty('--bg-scrim', String(settings.scrim))\n s.setProperty('--bg-wallpaper-blur', `${settings.wallpaperBlur}px`)\n s.setProperty('--bg-wallpaper-scale', (1 + settings.wallpaperBlur * 0.006).toFixed(4))\n // The glass bubble mirrors the live panel surface: below panelOpacity 1 its\n // alpha follows the same theme-aware curve as --dsw-specific-bubble (so the\n // panel-opacity slider is visible in the preview); at 1 the official opaque\n // surface returns — the bubble turns opaque and the blur switches off, just\n // like applySurfaceGlass does on the real backdrop.\n const inDark = document.body.dataset.dsDarkTheme !== undefined\n if (settings.panelOpacity >= 1) {\n s.setProperty('--bg-glass-blur', '0px')\n s.setProperty('--bg-glass-brightness', '1')\n s.setProperty('--bg-preview-glass', 'var(--dsw-alias-bg-layer-1)')\n return\n }\n s.setProperty('--bg-glass-blur', `${settings.blur}px`)\n s.setProperty('--bg-glass-saturate', String(glassSaturate(settings.blur)))\n // The preview filter mirrors the live exposure calibration (slightly dimmed\n // in light, lifted in dark) so the card never reads brighter than the app.\n s.setProperty('--bg-glass-brightness', glassExposure(inDark).brightness)\n // The preview bubble mirrors the live --dsw-specific-bubble token.\n s.setProperty('--bg-preview-glass', glassSurfaceAlphas(settings.panelOpacity, inDark).bubble)\n}\n\n/** Remove every preview variable from an element (restores CSS defaults). */\nexport function clearPreviewSurface(el: HTMLElement): void {\n for (const name of PREVIEW_VARS) el.style.removeProperty(name)\n}\n","/** Locale dictionaries for the background plugin. */\n\nimport type { BackgroundCardLocaleKey } from './types.ts'\n\n/** Dictionary of the namespace this plugin owns. */\nexport type BackgroundCardDict = Record<BackgroundCardLocaleKey, string>\n\n/** Chinese copy. */\nexport const zh: BackgroundCardDict = {\n 'background.title': '自定义背景',\n 'background.description': '为整个应用界面设置背景图片,可调不透明度、遮罩、面板透明与毛玻璃模糊',\n 'background.upload': '上传图片',\n 'background.uploading': '上传中…',\n 'background.uploadMediaTypes': '支持 JPG / PNG / WebP / GIF',\n 'background.urlPlaceholder': '或粘贴图片 http(s) 链接后回车',\n 'background.invalidUrl': '链接无效,请粘贴 http(s) 开头的图片链接',\n 'background.applyUrl': '应用链接',\n 'background.enabled': '背景已启用',\n 'background.source': '图片',\n 'background.effects': '效果',\n 'background.noPreview': '上传图片或粘贴链接后,此处实时预览效果',\n 'background.previewGlass': '毛玻璃',\n 'background.opacity': '不透明度',\n 'background.scrim': '遮罩',\n 'background.panelOpacity': '面板不透明度',\n 'background.blur': '毛玻璃模糊',\n 'background.wallpaperBlur': '壁纸模糊',\n 'background.fit': '填充方式',\n 'background.cover': '铺满',\n 'background.contain': '完整',\n 'background.clear': '清除背景',\n 'background.uploadFailed': '上传失败,请重试',\n 'background.saveFailed': '保存失败,请重试',\n 'background.timeline': '会话时间线',\n 'background.timelineHint': '右侧消息导航轨,悬停展开问题列表(DeepSeek 官网风格)',\n 'timeline.railLabel': '对话时间线',\n 'timeline.roleUser': '用户',\n 'timeline.noText': '(无文本内容)',\n 'timeline.marksOnly': '★ 只看标记',\n 'timeline.mark': '标记为重点',\n 'timeline.unmark': '取消重点标记',\n 'timeline.noMarks': '还没有标记的重点',\n}\n\n/** English copy. */\nexport const en: BackgroundCardDict = {\n 'background.title': 'Custom Background',\n 'background.description': 'Set a background image behind the whole app surface with adjustable opacity, scrim, panel transparency and glass blur',\n 'background.upload': 'Upload image',\n 'background.uploading': 'Uploading…',\n 'background.uploadMediaTypes': 'JPG / PNG / WebP / GIF',\n 'background.urlPlaceholder': 'Or paste an image http(s) link and press Enter',\n 'background.invalidUrl': 'Invalid link — paste an image link starting with http(s)',\n 'background.applyUrl': 'Apply URL',\n 'background.enabled': 'Background on',\n 'background.source': 'Image',\n 'background.effects': 'Effects',\n 'background.noPreview': 'Upload an image or paste a link to preview live here',\n 'background.previewGlass': 'Glass',\n 'background.opacity': 'Opacity',\n 'background.scrim': 'Scrim',\n 'background.panelOpacity': 'Panel opacity',\n 'background.blur': 'Glass blur',\n 'background.wallpaperBlur': 'Wallpaper blur',\n 'background.fit': 'Fit',\n 'background.cover': 'Cover',\n 'background.contain': 'Contain',\n 'background.clear': 'Clear background',\n 'background.uploadFailed': 'Upload failed, try again',\n 'background.saveFailed': 'Save failed, try again',\n 'background.timeline': 'Conversation timeline',\n 'background.timelineHint': 'Message rail at the right edge; hover to expand the question list (DeepSeek web style)',\n 'timeline.railLabel': 'Chat timeline',\n 'timeline.roleUser': 'User',\n 'timeline.noText': '(no text)',\n 'timeline.marksOnly': '★ Marked only',\n 'timeline.mark': 'Mark as key point',\n 'timeline.unmark': 'Unmark key point',\n 'timeline.noMarks': 'No marked key points',\n}\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Background settings transport — reads and writes the `ui-background`\n * section, and uploads local images, through the plugin's own same-origin\n * HTTP routes (see src/routes.ts). A custom route family keeps the section\n * usable even though the api-proxy settings allowlist does not expose\n * third-party namespaces over the settings RPC. One module-level client\n * serves the painter and the settings row.\n */\n\nimport type { BackgroundSettings } from '../settings.ts'\nimport { BACKGROUND_API_PREFIX } from '../settings.ts'\n\n/** One snapshot of the section as last seen by the transport. */\nexport interface SettingsSnapshot {\n status: 'loading' | 'ready' | 'error'\n value?: BackgroundSettings\n}\n\ntype Listener = () => void\n\n/** Outcome of one save attempt: committed, displaced by a newer save (the\n * caller must not adopt its own section back into the draft), or rejected. */\nexport type SaveResult = 'ok' | 'superseded' | 'failed'\n\n/**\n * Observable settings client (getSnapshot/subscribe — the uSES currency).\n * Methods are arrow properties so React's useSyncExternalStore can call them\n * without an owning `this`.\n */\nexport class SettingsClient {\n private snapshot: SettingsSnapshot = { status: 'loading' }\n private readonly listeners = new Set<Listener>()\n /** Monotonic request id; the latest save wins even when POSTs interleave. */\n private saveSeq = 0\n /** Pending save promise (used by the row's flush-on-unmount). */\n private pending: Promise<SaveResult> | undefined\n\n /** @returns the current sync snapshot (stable reference until the next change). */\n getSnapshot = (): SettingsSnapshot => this.snapshot\n\n /** Observe snapshot replacements. @returns the disposer removing this listener. */\n subscribe = (listener: Listener): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n\n /** Await any in-flight save (used before teardown so edits are not dropped). */\n async flush(): Promise<void> {\n await this.pending\n }\n\n /** Fetch the section from the host. */\n async load(): Promise<void> {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/settings`)\n if (!response.ok) throw new Error(`HTTP ${response.status}`)\n const body = await response.json() as { ok: boolean; value?: BackgroundSettings }\n if (!body.ok || body.value === undefined) throw new Error('unexpected payload')\n this.snapshot = { status: 'ready', value: body.value }\n } catch {\n this.snapshot = { status: 'error' }\n }\n this.notify()\n }\n\n /**\n * Persist the section through the host route. Concurrent calls are\n * serialized by a request sequence: an older save that resolves after a\n * newer one answers 'superseded' instead of 'ok', so the caller can never\n * mistake a stale write for success and adopt its outdated section.\n * @param section - the complete next section.\n * @returns whether the write committed, was displaced by a newer save, or failed.\n */\n async save(section: BackgroundSettings): Promise<SaveResult> {\n const seq = ++this.saveSeq\n const run = async (): Promise<SaveResult> => {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/settings`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(section),\n })\n const body = await response.json() as { ok: boolean; value?: BackgroundSettings }\n if (!response.ok || !body.ok || body.value === undefined) return 'failed'\n // Discard the response of a superseded save — it reflects an older\n // document that must not overwrite the latest one.\n if (seq !== this.saveSeq) return 'superseded'\n this.snapshot = { status: 'ready', value: body.value }\n this.notify()\n return 'ok'\n } catch {\n return 'failed'\n }\n }\n const promise = run()\n this.pending = promise\n // Release the handle once settled so flush() never awaits a stale save\n // from a long-finished gesture (a later flush then resolves instantly).\n void promise.then(() => {\n if (this.pending === promise) this.pending = undefined\n })\n return promise\n }\n\n /**\n * Upload a local image file; on success stores its id into the snapshot and\n * returns the resolved background url (or null on failure).\n * @param file - the chosen image file.\n * @returns the resolved image url, or null.\n */\n async upload(file: File): Promise<string | null> {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/upload`, {\n method: 'POST',\n headers: { 'content-type': file.type },\n body: file,\n })\n const body = await response.json() as { ok: boolean; id?: string; url?: string }\n if (!response.ok || !body.ok || body.id === undefined || body.url === undefined) return null\n return body.url ?? null\n } catch {\n return null\n }\n }\n}\n\n/** Shared client for the painter and the settings row. */\nexport const settingsClient = new SettingsClient()\n","/**\n * Background settings row — the editable form rendered inside the General\n * settings section (`settings.general.item` slot), in the same visual area as\n * the official Appearance row. Layout mirrors the reference wallpaper engine\n * picker (preview surface + grouped sections), styled with the harness alias\n * tokens so it reads as part of the settings chrome.\n *\n * Interaction model (fixes the previous jank):\n * - Sliders STEP in 5% (or 2px/5px) increments, so dragging snaps between\n * discrete values instead of firing dozens of sub-percent updates.\n * - While dragging, only the CSS variables change: the slider holds its own\n * state (no parent re-render) and the preview card repaints in isolation.\n * React's onChange maps to the native `input` event and would fire on every\n * step, so a commit is deferred to release (pointerup / keyup / blur) and\n * debounced — one POST per gesture, never per tick.\n * - A `lastSavedRef` distinguishes our own saves from external changes, so\n * the snapshot sync can never clobber a draft the user is still editing.\n */\n\nimport { useCallback, useEffect, useRef, useState, type ChangeEvent } from 'react'\nimport { useSyncExternalStore } from 'react'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport clsx from 'clsx'\nimport {\n BACKGROUND_API_PREFIX, BLUR_MAX, BLUR_MIN, DEFAULT_BLUR, DEFAULT_FIT,\n DEFAULT_OPACITY, DEFAULT_PANEL_OPACITY, DEFAULT_SCRIM, DEFAULT_TIMELINE,\n DEFAULT_WALLPAPER_BLUR, FIT_MODES, OPACITY_MAX, OPACITY_MIN, PANEL_OPACITY_MAX,\n PANEL_OPACITY_MIN, SCRIM_MAX, SCRIM_MIN, WALLPAPER_BLUR_MAX, type BackgroundFit,\n type BackgroundSettings,\n} from '../settings.ts'\nimport { clearPreviewSurface, paintBackground, paintBackgroundKnob, paintPreviewSurface } from './backdrop.ts'\nimport { settingsClient, type SettingsSnapshot } from './settings-client.ts'\nimport css from './SettingsRow.module.css'\n\n/** Full component props: runtime share + locale seat. */\nexport type BackgroundRowProps =\n PropsRuntime<'settings.general.item'> & PropsLocale<'ui-background'>\n\n/** Defaults mirror the host schema (also the pre-load draft fallback). */\nconst DEFAULTS: BackgroundSettings = {\n enabled: false,\n uploadId: '',\n url: '',\n opacity: DEFAULT_OPACITY,\n scrim: DEFAULT_SCRIM,\n panelOpacity: DEFAULT_PANEL_OPACITY,\n blur: DEFAULT_BLUR,\n wallpaperBlur: DEFAULT_WALLPAPER_BLUR,\n fit: DEFAULT_FIT,\n timeline: DEFAULT_TIMELINE,\n}\n\n/** The numeric field keys a slider edits. */\ntype NumField = 'opacity' | 'scrim' | 'panelOpacity' | 'blur' | 'wallpaperBlur'\n\n/** Per-field slider geometry: 5% steps for ratios, fine px steps for radii so\n * the two blur sliders feel smooth near small values. Bounds come from the\n * shared settings constants so the schema boundary and the UI cannot drift. */\nconst SLIDER_SPEC: Record<NumField, { min: number; max: number; step: number; unit: 'percent' | 'px' }> = {\n opacity: { min: OPACITY_MIN, max: OPACITY_MAX, step: 0.05, unit: 'percent' },\n scrim: { min: SCRIM_MIN, max: SCRIM_MAX, step: 0.05, unit: 'percent' },\n panelOpacity: { min: PANEL_OPACITY_MIN, max: PANEL_OPACITY_MAX, step: 0.05, unit: 'percent' },\n blur: { min: BLUR_MIN, max: BLUR_MAX, step: 1, unit: 'px' },\n wallpaperBlur: { min: BLUR_MIN, max: WALLPAPER_BLUR_MAX, step: 2, unit: 'px' },\n}\n\n/** Derive the bare upload id from a resolve url like /api/bg-wallpaper/image/<id>. */\nfunction stripId(url: string): string {\n const prefix = `${BACKGROUND_API_PREFIX}/image/`\n return url.startsWith(prefix) ? url.slice(prefix.length) : ''\n}\n\n/** Read the settings store (uSES-friendly). */\nfunction readSnapshot(): SettingsSnapshot {\n return settingsClient.getSnapshot()\n}\n\n/** Field-wise equality for distinguishing our own saves from external changes. */\nfunction sameSettings(a: BackgroundSettings, b: BackgroundSettings): boolean {\n return a.enabled === b.enabled && a.uploadId === b.uploadId && a.url === b.url\n && a.opacity === b.opacity && a.scrim === b.scrim && a.panelOpacity === b.panelOpacity\n && a.blur === b.blur && a.wallpaperBlur === b.wallpaperBlur && a.fit === b.fit\n && a.timeline === b.timeline\n}\n\n/**\n * A stepped range control. While dragging it re-renders only itself: the value\n * is local state, `onLive(name, value)` repaints (CSS variables, no React\n * state), and `onCommit()` fires once on release through a debounced save.\n */\nfunction ControlSlider(props: {\n name: NumField\n label: string\n value: number\n onLive: (name: NumField, value: number) => void\n onCommit: () => void\n}) {\n const { name, label, value, onLive, onCommit } = props\n const spec = SLIDER_SPEC[name]\n const [local, setLocal] = useState(value)\n const localRef = useRef(value)\n const dragging = useRef(false)\n const onLiveRef = useRef(onLive)\n const onCommitRef = useRef(onCommit)\n onLiveRef.current = onLive\n onCommitRef.current = onCommit\n\n // Adopt an external value (load / save) when not mid-drag.\n useEffect(() => {\n if (!dragging.current && localRef.current !== value) {\n localRef.current = value\n setLocal(value)\n }\n }, [value])\n\n const handleLive = (e: ChangeEvent<HTMLInputElement>): void => {\n dragging.current = true\n const v = Number(e.currentTarget.value)\n localRef.current = v\n setLocal(v)\n syncTrackFill(e.currentTarget)\n onLiveRef.current(name, v)\n }\n\n const handleCommit = (): void => {\n if (!dragging.current) return\n dragging.current = false\n onCommitRef.current()\n }\n\n const text = spec.unit === 'percent'\n ? `${Math.round(local * 100)}%`\n : `${local}px`\n\n return (\n <div className={css.sliderRow}>\n <span className={css.sliderLabel}>{label}</span>\n <input\n type=\"range\"\n className={css.slider}\n ref={(el) => {\n // Sync the \"filled\" track fraction on mount and on every external\n // value adoption (the webkit track reads --bg-fill; moz draws its\n // own ::-moz-range-progress).\n if (el) syncTrackFill(el)\n }}\n min={spec.min} max={spec.max} step={spec.step}\n value={String(local)}\n aria-label={label}\n onInput={handleLive}\n onPointerUp={handleCommit}\n onKeyUp={(e) => {\n if (e.key.startsWith('Arrow') || e.key === 'Home' || e.key === 'End'\n || e.key === 'PageUp' || e.key === 'PageDown') handleCommit()\n }}\n onBlur={handleCommit}\n />\n <span className={css.sliderValue}>{text}</span>\n </div>\n )\n}\n\n/** Write the filled-track fraction (%) of a range input into its --bg-fill\n * variable (webkit has no range-progress pseudo-element; moz draws its own). */\nfunction syncTrackFill(el: HTMLInputElement): void {\n const min = Number(el.min)\n const max = Number(el.max)\n const value = Number(el.value)\n const pct = max === min ? 0 : ((value - min) / (max - min)) * 100\n el.style.setProperty('--bg-fill', `${pct}%`)\n}\n\n/**\n * The background settings row. A draft mirrors the persisted section; dragging\n * repaints the preview card and the live backdrop through CSS variables, and a\n * release commits once through the plugin's own host route.\n */\nexport function BackgroundSettingsRow({ t }: BackgroundRowProps) {\n const snapshot = useSyncExternalStore(settingsClient.subscribe, readSnapshot)\n const [draft, setDraft] = useState<BackgroundSettings>(DEFAULTS)\n const [uploading, setUploading] = useState(false)\n const [urlText, setUrlText] = useState('')\n const [error, setError] = useState('')\n const fileInput = useRef<HTMLInputElement>(null)\n const previewRef = useRef<HTMLDivElement>(null)\n // The latest draft, read by every handler (never a stale closure).\n const draftRef = useRef<BackgroundSettings>(DEFAULTS)\n // True while a drag/gesture is in flight: hold off snapshot sync.\n const editingRef = useRef(false)\n // The last section this row saved; external changes are snapshots that differ.\n const lastSavedRef = useRef<BackgroundSettings | null>(null)\n // True while an edit has not yet reached the host (drives flush-on-unmount).\n const dirtyRef = useRef(false)\n const commitTimer = useRef<number | undefined>(undefined)\n const editingTimer = useRef<number | undefined>(undefined)\n\n /** Repaint the live backdrop + preview card from one draft (no React state). */\n const paintLive = useCallback((next: BackgroundSettings): void => {\n paintBackground(next)\n if (previewRef.current) paintPreviewSurface(previewRef.current, next)\n }, [])\n\n /** Mark the row as being edited; clears after a quiet 600ms window. */\n const markEditing = useCallback((): void => {\n editingRef.current = true\n clearTimeout(editingTimer.current)\n editingTimer.current = window.setTimeout(() => { editingRef.current = false }, 600)\n }, [])\n\n /** Slider live handler (stable identity for the memoized sliders). */\n const onLive = useCallback((key: NumField, value: number): void => {\n const next = { ...draftRef.current, [key]: value }\n draftRef.current = next\n markEditing()\n // Hot path: most knobs repaint through the painter's single-variable\n // writer (no DOM layer churn). panelOpacity drives the glass surface\n // tokens, which need the full apply.\n if (key === 'panelOpacity') {\n paintBackground(next)\n } else {\n paintBackgroundKnob(key, value)\n }\n if (previewRef.current) paintPreviewSurface(previewRef.current, next)\n }, [markEditing])\n\n /** Persist one section through the host route and adopt it on success. */\n const saveNow = useCallback(async (next: BackgroundSettings): Promise<void> => {\n dirtyRef.current = true\n const result = await settingsClient.save(next)\n if (result === 'failed') {\n setError(t('background.saveFailed'))\n return\n }\n // A superseded save lost to a newer in-flight one, which now owns BOTH\n // the snapshot adoption and the dirty flag (cleared when IT commits).\n // Clearing the flag here would strand that write, and adopting this\n // response would resurrect an outdated section — so keep it set.\n if (result === 'superseded') return\n dirtyRef.current = false\n setError('')\n lastSavedRef.current = next\n draftRef.current = next\n setDraft(next)\n if (!next.uploadId) setUrlText(next.url)\n }, [t])\n\n // The latest saveNow, readable from stable callbacks and the unmount\n // cleanup (never a stale closure).\n const saveNowRef = useRef(saveNow)\n saveNowRef.current = saveNow\n\n /** Debounced commit: one POST per drag gesture, from the latest draft. */\n const onCommit = useCallback((): void => {\n clearTimeout(commitTimer.current)\n commitTimer.current = window.setTimeout(() => {\n // Reset before saving: a fired timer must never look like an armed one,\n // or the unmount flush would re-save an already-committed gesture.\n commitTimer.current = undefined\n void saveNowRef.current(draftRef.current)\n }, 120)\n }, [])\n\n // Sync the draft from the persisted value when it changes externally, but\n // never overwrite a draft the user is mid-editing.\n useEffect(() => {\n if (snapshot.status !== 'ready' || snapshot.value === undefined) return\n const saved = lastSavedRef.current\n const external = saved === null || !sameSettings(saved, snapshot.value)\n if (external && !editingRef.current) {\n lastSavedRef.current = snapshot.value\n draftRef.current = snapshot.value\n setDraft(snapshot.value)\n setUrlText(snapshot.value.uploadId ? '' : snapshot.value.url)\n if (previewRef.current) paintPreviewSurface(previewRef.current, snapshot.value)\n }\n }, [snapshot])\n\n // Teardown: a pending debounced commit must not die with the row. If the\n // timer is still armed, fire the save NOW (the timer callback would never\n // run after unmount, and dirtyRef is only set inside saveNow — clearing\n // the timer alone would silently drop the last slider adjustment). Then\n // wait out any save already in flight. The effect runs once per mount:\n // saveNow is reached through its ref, so an identity change mid-session\n // cannot re-trigger this teardown, and editingRef is reset so a cleared\n // editing window can never block snapshot sync forever.\n useEffect(() => () => {\n clearTimeout(editingTimer.current)\n editingRef.current = false\n if (commitTimer.current !== undefined) {\n clearTimeout(commitTimer.current)\n commitTimer.current = undefined\n void saveNowRef.current(draftRef.current)\n }\n if (dirtyRef.current) void settingsClient.flush()\n }, [])\n\n const handleFile = async (file?: File): Promise<void> => {\n if (!file) return\n markEditing()\n setUploading(true)\n setError('')\n try {\n const url = await settingsClient.upload(file)\n if (url === null) {\n setError(t('background.uploadFailed'))\n return\n }\n const next: BackgroundSettings = { ...draftRef.current, uploadId: stripId(url), url: '', enabled: true }\n draftRef.current = next\n setDraft(next)\n setUrlText('')\n paintLive(next)\n await saveNow(next)\n } finally {\n setUploading(false)\n }\n }\n\n const handleUrlSubmit = (): void => {\n const url = urlText.trim()\n if (!/^https?:\\/\\//i.test(url)) {\n setError(t('background.invalidUrl'))\n return\n }\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, uploadId: '', url, enabled: true }\n draftRef.current = next\n setDraft(next)\n paintLive(next)\n void saveNow(next)\n }\n\n const handleClear = (): void => {\n const next: BackgroundSettings = { ...draftRef.current, uploadId: '', url: '', enabled: false }\n draftRef.current = next\n setDraft(next)\n setUrlText('')\n if (previewRef.current) clearPreviewSurface(previewRef.current)\n paintBackground(next)\n void saveNow(next)\n }\n\n const handleFit = (mode: BackgroundFit): void => {\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, fit: mode }\n draftRef.current = next\n setDraft(next)\n paintLive(next)\n void saveNow(next)\n }\n\n const handleTimelineToggle = (): void => {\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, timeline: !draftRef.current.timeline }\n draftRef.current = next\n setDraft(next)\n // The rail reads the shared snapshot itself; no painter repaint needed.\n void saveNow(next)\n }\n\n const sourceUrl = draft.uploadId ? `${BACKGROUND_API_PREFIX}/image/${draft.uploadId}` : draft.url\n const hasImage = sourceUrl !== ''\n\n return (\n <div className={css.row}>\n <div className={css.header}>\n <div className={css.titleRow}>\n <div className={css.title}>{t('background.title')}</div>\n {hasImage && (\n <button type=\"button\" className={clsx(css.btn, css.btnDanger, css.clearBtn)} onClick={handleClear}>\n {t('background.clear')}\n </button>\n )}\n </div>\n <div className={css.desc}>{t('background.description')}</div>\n </div>\n\n {/* Live preview surface: image + theme-aware scrim + frosted glass bubble. */}\n <div className={css.preview} ref={previewRef}>\n {hasImage\n ? (\n <>\n <img className={css.previewImg} src={sourceUrl} alt=\"\" draggable={false} referrerPolicy=\"no-referrer\" />\n <div className={css.previewScrim} />\n <div className={css.previewGlass}>\n <span className={css.previewGlassText}>{t('background.previewGlass')}</span>\n </div>\n </>\n )\n : (\n <div className={css.previewEmpty}>{t('background.noPreview')}</div>\n )}\n </div>\n\n {/* Image source: upload or paste an http(s) link. */}\n <div className={css.section}>\n <div className={css.sectionLabel}>{t('background.source')}</div>\n <div className={css.sourceRow}>\n <input\n type=\"file\"\n ref={fileInput}\n hidden\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n onChange={(e) => {\n void handleFile(e.currentTarget.files?.[0])\n e.currentTarget.value = ''\n }}\n />\n <button\n type=\"button\"\n className={clsx(css.btn, css.btnPrimary)}\n disabled={uploading}\n onClick={() => fileInput.current?.click()}\n >\n {uploading ? t('background.uploading') : t('background.upload')}\n </button>\n <span className={css.hint}>{t('background.uploadMediaTypes')}</span>\n {draft.uploadId && <span className={css.enabledBadge}>✓ {t('background.enabled')}</span>}\n </div>\n <div className={css.urlRow}>\n <input\n className={css.urlInput}\n value={urlText}\n placeholder={t('background.urlPlaceholder')}\n onKeyDown={(e) => { if (e.key === 'Enter') handleUrlSubmit() }}\n onChange={(e) => setUrlText(e.currentTarget.value)}\n />\n <button\n type=\"button\"\n className={css.btn}\n disabled={!urlText.trim()}\n onClick={handleUrlSubmit}\n >\n {t('background.applyUrl')}\n </button>\n </div>\n </div>\n\n {/* Effects: stepped sliders + fit segmented control. */}\n <div className={css.section}>\n <div className={css.sectionLabel}>{t('background.effects')}</div>\n <ControlSlider name=\"opacity\" label={t('background.opacity')} value={draft.opacity} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"scrim\" label={t('background.scrim')} value={draft.scrim} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"panelOpacity\" label={t('background.panelOpacity')} value={draft.panelOpacity} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"blur\" label={t('background.blur')} value={draft.blur} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"wallpaperBlur\" label={t('background.wallpaperBlur')} value={draft.wallpaperBlur} onLive={onLive} onCommit={onCommit} />\n <div className={css.segRow}>\n <span className={css.segLabel}>{t('background.fit')}</span>\n <div className={css.segGroup} role=\"group\" aria-label={t('background.fit')}>\n {FIT_MODES.map((mode) => (\n <button\n key={mode}\n type=\"button\"\n className={clsx(css.segBtn, draft.fit === mode && css.segActive)}\n onClick={() => handleFit(mode)}\n >\n {t(mode === 'cover' ? 'background.cover' : 'background.contain')}\n </button>\n ))}\n </div>\n </div>\n <div className={css.segRow}>\n <span className={css.segLabel}>{t('background.timeline')}</span>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={draft.timeline}\n aria-label={t('background.timeline')}\n title={t('background.timelineHint')}\n className={css.switch}\n onClick={handleTimelineToggle}\n >\n <span className={css.switchKnob} />\n </button>\n <span className={css.hint}>{t('background.timelineHint')}</span>\n </div>\n </div>\n\n {error && <div className={css.error} role=\"alert\">{error}</div>}\n\n {hasImage && (\n <div className={css.clearRow}>\n <button type=\"button\" className={clsx(css.btn, css.btnDanger)} onClick={handleClear}>\n {t('background.clear')}\n </button>\n </div>\n )}\n </div>\n )\n}\n","/**\n * Timeline CSS — the conversation scroll-navigation rail (DeepSeek web\n * ScrollNav structure, rebuilt on this plugin's frosted-glass system).\n *\n * Structure and metrics mirror the official chat.deepseek.com stylesheet\n * (module map extracted from the shipped bundle; v0.1.4 of the reference port\n * dsh-chat-timeline widens the panel to 260px and adds bookmarks):\n * nav 34px-wide rail, fixed right edge, vertically centered; collapsed\n * blurred capsule (height − 8px); expanding panel (max 260px, radius 16)\n * whose scroll area holds 30px rows (tick indicator + fading-in title);\n * 32px gradient fade veils top/bottom, expanded-only, shown while that\n * side actually clips.\n *\n * Deviations from the reference port, all fidelity fixes:\n * - The filter bar collapses to zero height while idle instead of staying\n * in layout invisibly (it pushed every tick ~33px down).\n * - Short stacks center vertically; overflowing stacks are bottom-pinned\n * by the component so the newest tick hugs the capsule's bottom edge\n * (the official idle strategy — the reference port flowed ticks from\n * the top and clipped the newest away).\n *\n * Glass integration: the official chat.deepseek.com paints (light\n * rgba(255,255,255,.8)/.94, dark rgba(21,21,23,.6)/rgba(28,28,32,.95),\n * 5px collapsed / 16px expanded blur) remain as the NO-GLASS fallback.\n * While the plugin's glass system is on (`body[data-dsh-bg-glass]`), the\n * rail joins the SAME unified recipe as the composer card and bubbles:\n * fill = the painter's `--dsw-specific-input-major` token, blur/saturate/\n * brightness = the shared `--bg-glass-*` variables, i.e. the glass-blur\n * slider. Class prefix `dsbt-` deliberately avoids every\n * `[class*=\"_xxx\"]` anchor of the plugin's glass sheet (underscores only).\n */\n\n/** Unique id stamped on the injected style element (dedup key). */\nexport const TIMELINE_CSS_TAG = 'deepseek-harness-background/timeline'\n\n/**\n * Expanded-row title size in px. The canvas width measurement in timeline.tsx\n * reads this same constant — a fitted panel width must track the real text\n * metrics, so the two can never drift apart.\n */\nexport const TIMELINE_TITLE_FONT_PX = 13\n\n/** Inject the timeline stylesheet once. Idempotent (dedup key on the tag). */\nexport function injectTimelineCss(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[data-plugin-css=\"${TIMELINE_CSS_TAG}\"]`)) return\n const tag = document.createElement('style')\n tag.dataset.plugin = 'deepseek-harness-background'\n tag.dataset.pluginCss = TIMELINE_CSS_TAG\n tag.textContent = TIMELINE_CSS\n document.head.appendChild(tag)\n}\n\nexport const TIMELINE_CSS = `\n .dsbt-nav {\n user-select: none; -webkit-user-select: none;\n /* Filter-bar chrome height shared by the bar itself and the top veil's\n expanded offset. */\n --dsbt-bar-h: 33px;\n z-index: 90; align-items: center; width: 34px;\n height: var(--dsbt-h, 300px);\n transition: right .2s ease, opacity .2s ease;\n display: flex; position: fixed; top: 50%; right: 16px;\n transform: translateY(-50%); pointer-events: auto;\n }\n @media (max-width: 767px) { .dsbt-nav { display: none; } }\n\n /* Collapsed capsule — frosted strip behind the tick marks. Official paint:\n light rgba(255,255,255,.8), dark rgba(21,21,23,.6), 5px blur. */\n .dsbt-bg {\n background-color: rgba(255, 255, 255, .8);\n -webkit-backdrop-filter: blur(5px);\n backdrop-filter: blur(5px);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, .28),\n inset 0 0 0 .5px rgba(255, 255, 255, .1),\n 0 6px 18px rgba(0, 0, 0, .07);\n border-radius: 16px; width: 34px;\n height: calc(var(--dsbt-h, 300px) - 8px); max-height: calc(var(--dsbt-h, 300px) - 8px);\n position: absolute; top: 50%; right: 0; transform: translateY(-50%);\n transition: opacity .2s ease; pointer-events: none;\n }\n body[data-ds-dark-theme] .dsbt-bg {\n background-color: rgba(21, 21, 23, .6);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, .09),\n inset 0 0 0 .5px rgba(255, 255, 255, .05),\n 0 6px 18px rgba(0, 0, 0, .3);\n }\n .dsbt-bg.dsbt-bg-hide { opacity: 0; }\n\n /* Expanding panel — exactly the capsule's box (identical height in both\n states), width animates 34px -> measured fit (max 260px). Official\n hover-state paint: white/black frosted glass at ~94% alpha, 16px blur. */\n .dsbt-wrap {\n width: 34px;\n height: calc(var(--dsbt-h, 300px) - 8px); max-height: calc(var(--dsbt-h, 300px) - 8px);\n border: 1px solid transparent; border-radius: 16px;\n flex-direction: column; align-items: stretch;\n transition: width .22s cubic-bezier(.4, 0, .2, 1), background-color .2s ease,\n box-shadow .2s ease, border-color .2s ease;\n display: flex; position: absolute; top: 50%; right: 0;\n transform: translateY(-50%);\n overflow: hidden; box-sizing: border-box; background: transparent;\n pointer-events: none;\n }\n .dsbt-wrap.dsbt-show {\n pointer-events: auto;\n width: min(var(--dsbt-w, 260px), 260px);\n background-color: rgba(255, 255, 255, .94);\n -webkit-backdrop-filter: blur(16px);\n backdrop-filter: blur(16px);\n border-color: rgba(0, 0, 0, .06);\n box-shadow: 0 10px 30px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .04);\n }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show {\n background-color: rgba(28, 28, 32, .95);\n border-color: rgba(255, 255, 255, .08);\n box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .25);\n }\n\n /* Content fade veils — the official ::before/::after pair rebuilt as\n elements: a bar of the panel's OWN fill color masked to nothing over\n 32px (solid -> mask == gradient-to-transparent, but works with the\n translucent fill). They belong to the EXPANDED panel only — the idle\n capsule hard-clips its ticks at the rounded ends like the official\n strip — and while expanded the top veil starts BELOW the filter bar,\n not over it. Shown only while that side actually clips. */\n .dsbt-fade {\n z-index: 2; pointer-events: none; opacity: 0;\n background-color: rgba(255, 255, 255, .94);\n -webkit-mask-image: linear-gradient(#000 20.19%, transparent 100%);\n mask-image: linear-gradient(#000 20.19%, transparent 100%);\n width: 100%; height: 32px; transition: opacity .2s ease;\n position: absolute; left: 0; top: 0;\n }\n body[data-ds-dark-theme] .dsbt-fade { background-color: rgba(28, 28, 32, .95); }\n .dsbt-fade.dsbt-fade-bot { top: auto; bottom: 0; transform: rotate(180deg); }\n .dsbt-wrap.dsbt-show .dsbt-fade.dsbt-fade-on { opacity: 1; }\n .dsbt-wrap.dsbt-show .dsbt-fade:not(.dsbt-fade-bot) { top: var(--dsbt-bar-h, 33px); }\n\n /* Filter bar — \"marked only\" toggle pinned above the scroll area while\n expanded. Collapsed, it collapses to ZERO height (not just opacity): a\n transparent-but-in-layout bar pushed every tick ~33px down, one of the\n reasons the idle capsule read as off-alignment. */\n .dsbt-filterbar {\n height: var(--dsbt-bar-h, 33px);\n padding: 8px 12px 4px; display: flex; justify-content: flex-end;\n align-items: center; border-bottom: 1px solid rgba(0, 0, 0, .05);\n box-sizing: border-box; flex: none; overflow: hidden;\n transition: opacity .2s ease, height .2s ease, padding .2s ease,\n border-color .2s ease;\n }\n .dsbt-wrap:not(.dsbt-show) .dsbt-filterbar {\n height: 0; padding-top: 0; padding-bottom: 0; opacity: 0;\n border-bottom-color: transparent;\n }\n body[data-ds-dark-theme] .dsbt-filterbar { border-bottom-color: rgba(255, 255, 255, .06); }\n .dsbt-filterbtn {\n font-size: 11px; line-height: 16px; padding: 2px 8px; border-radius: 10px;\n border: 1px solid rgba(0, 0, 0, .1); background: rgba(0, 0, 0, .03);\n color: rgba(0, 0, 0, .65); cursor: pointer; transition: all .15s ease;\n display: inline-flex; align-items: center; gap: 3px; font-family: inherit;\n }\n .dsbt-filterbtn:hover { background: rgba(0, 0, 0, .07); color: rgba(0, 0, 0, .9); }\n .dsbt-filterbtn.dsbt-filteron {\n background: rgba(245, 158, 11, .12); border-color: #f59e0b;\n color: #b45309; font-weight: 600;\n }\n body[data-ds-dark-theme] .dsbt-filterbtn {\n border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05);\n color: rgba(255, 255, 255, .7);\n }\n body[data-ds-dark-theme] .dsbt-filterbtn:hover { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .95); }\n body[data-ds-dark-theme] .dsbt-filterbtn.dsbt-filteron {\n background: rgba(251, 191, 36, .18); border-color: #fbbf24; color: #fbbf24;\n }\n\n /* Scroll area — rows hug the right edge; scrolls only when overfull. The\n auto-margin pseudo pair vertically centers the stack when it fits the\n capsule (short conversations), and resolves to zero free space when it\n overflows, so bottom-pinned scrolling behaves like a plain column. */\n .dsbt-page {\n padding: 15px 0 15px 24px; box-sizing: border-box;\n overscroll-behavior: contain; flex: 1 1 auto; min-height: 0;\n flex-direction: column; align-items: flex-end; display: flex;\n position: relative; width: 100%; overflow: hidden;\n }\n .dsbt-page::before, .dsbt-page::after {\n content: ''; flex: none; margin-block: auto;\n }\n .dsbt-wrap.dsbt-show .dsbt-page {\n overflow-y: auto; overflow-x: hidden;\n scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .15) transparent;\n }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-page { scrollbar-color: rgba(255, 255, 255, .25) transparent; }\n .dsbt-page::-webkit-scrollbar { width: 4px; }\n .dsbt-page::-webkit-scrollbar-track { background: transparent; }\n .dsbt-page::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .15); border-radius: 4px; }\n body[data-ds-dark-theme] .dsbt-page::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); }\n\n /* Empty state (filtered list with no marks). */\n .dsbt-empty {\n font-size: 12px; line-height: 18px; padding: 16px 12px;\n color: rgba(0, 0, 0, .45); text-align: center; width: 100%; box-sizing: border-box;\n }\n body[data-ds-dark-theme] .dsbt-empty { color: rgba(255, 255, 255, .45); }\n\n /* One message row: 30px, star bookmark + tick indicator at the right,\n title fading in. */\n /* Row shell: layout + shared ink only — the interactive hit areas are the\n sibling .dsbt-jump / .dsbt-star buttons below. */\n .dsbt-item {\n height: 30px; min-height: 30px; flex-shrink: 0;\n justify-content: flex-end; align-items: center;\n width: calc(100% - 4px); margin-right: 4px;\n display: flex; box-sizing: border-box;\n color: var(--dsw-alias-label-tertiary, rgba(0, 0, 0, .65));\n transition: color .15s ease;\n }\n\n /* Jump target: a real button so Enter/Space work natively without nesting\n an interactive element inside another. */\n .dsbt-jump {\n cursor: pointer; background: none; border: none; margin: 0; padding: 0;\n font: inherit; line-height: 20px; text-align: right; color: inherit;\n flex: 1 1 auto; min-width: 0; height: 100%;\n display: flex; align-items: center; justify-content: flex-end;\n }\n .dsbt-jump:focus-visible { outline: 1px solid currentColor; outline-offset: -1px; border-radius: 6px; }\n .dsbt-item:hover { color: var(--dsw-alias-label-primary, rgba(0, 0, 0, .95)); }\n body[data-ds-dark-theme] .dsbt-item { color: rgba(255, 255, 255, .65); }\n body[data-ds-dark-theme] .dsbt-item:hover { color: rgba(255, 255, 255, .95); }\n .dsbt-title {\n font-size: ${TIMELINE_TITLE_FONT_PX}px; line-height: 20px; flex: 1 1 auto; min-width: 0;\n text-overflow: ellipsis; white-space: nowrap; overflow: hidden;\n margin-right: 6px; text-align: right; color: inherit;\n opacity: 0; transition: opacity .12s ease, color .15s ease;\n }\n .dsbt-show .dsbt-title { opacity: 1; }\n\n /* Star bookmark — appears on row hover while the panel is expanded; gold\n when marked. A real sibling button next to the jump target, so marking\n stays keyboard-operable without nested interactive elements. */\n .dsbt-star {\n font-size: ${TIMELINE_TITLE_FONT_PX}px; line-height: 16px; width: 18px; height: 18px;\n display: inline-flex; align-items: center; justify-content: center;\n opacity: 0; cursor: pointer; transition: all .15s ease; margin-right: 6px;\n flex-shrink: 0; color: rgba(0, 0, 0, .25); border-radius: 4px; user-select: none;\n -webkit-user-select: none;\n background: none; border: none; padding: 0; font-family: inherit;\n }\n .dsbt-star:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; opacity: .9; }\n .dsbt-wrap.dsbt-show .dsbt-item:hover .dsbt-star { opacity: .75; }\n .dsbt-wrap.dsbt-show .dsbt-star:hover { opacity: 1; transform: scale(1.2); color: #d97706; }\n .dsbt-wrap.dsbt-show .dsbt-star.dsbt-staron { opacity: 1; color: #f59e0b; }\n body[data-ds-dark-theme] .dsbt-star { color: rgba(255, 255, 255, .25); }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-star:hover { color: #fde047; }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-star.dsbt-staron { opacity: 1; color: #fbbf24; }\n\n .dsbt-ind { flex-shrink: 0; justify-content: center; align-items: center; width: 16px; height: 20px; display: flex; }\n .dsbt-line {\n background-color: var(--dsw-alias-border-l4, rgba(0, 0, 0, .16));\n border-radius: 4px; flex-shrink: 0; width: 8px; height: 2px;\n transition: background-color .2s ease, transform .2s ease, width .2s ease, height .2s ease;\n }\n .dsbt-item:hover .dsbt-line { background-color: var(--dsw-alias-label-primary, rgba(0, 0, 0, .9)); }\n .dsbt-item.dsbt-active { color: var(--dsw-alias-state-business-primary, #4d6bfe); }\n .dsbt-item.dsbt-active .dsbt-title { color: var(--dsw-alias-state-business-primary, #4d6bfe); font-weight: 500; }\n .dsbt-item.dsbt-active .dsbt-line {\n background-color: var(--dsw-alias-state-business-primary, #4d6bfe);\n transform-origin: 50%; transform: scale(1.5);\n }\n body[data-ds-dark-theme] .dsbt-item.dsbt-active { color: var(--dsw-alias-state-business-primary, #4d6bfe); }\n body[data-ds-dark-theme] .dsbt-line { background-color: rgba(255, 255, 255, .2); }\n body[data-ds-dark-theme] .dsbt-item:hover .dsbt-line { background-color: rgba(255, 255, 255, .9); }\n\n /* Marked (key-point) rows: a wider golden tick in both themes; the active\n state keeps its brand-blue scale so reading position always wins. */\n .dsbt-item.dsbt-marked .dsbt-line { background-color: #d97706; width: 10px; height: 2.5px; }\n .dsbt-item.dsbt-marked:hover .dsbt-line { background-color: #b45309; }\n .dsbt-item.dsbt-marked.dsbt-active .dsbt-line {\n background-color: var(--dsw-alias-state-business-primary, #4d6bfe);\n transform-origin: 50%; transform: scale(1.5);\n }\n body[data-ds-dark-theme] .dsbt-item.dsbt-marked .dsbt-line { background-color: #fbbf24; width: 10px; height: 2.5px; }\n body[data-ds-dark-theme] .dsbt-item.dsbt-marked:hover .dsbt-line { background-color: #fde047; }\n\n /* ---- Unified glass integration -----------------------------------------\n Glass system on (wallpaper active + panelOpacity < 1): the rail joins\n the composer/bubble recipe — the same translucent fill token and the\n same blur/saturate/brightness chain (the glass-blur slider drives it,\n no fixed 5/16px). Placed after the dark-theme rules so equal-specificity\n overrides win in both schemes. */\n body[data-dsh-bg-glass] .dsbt-bg,\n body[data-dsh-bg-glass] .dsbt-wrap.dsbt-show {\n background-color: var(--dsw-specific-input-major);\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n body[data-dsh-bg-glass] .dsbt-fade {\n background-color: var(--dsw-specific-input-major);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .dsbt-nav, .dsbt-bg, .dsbt-wrap, .dsbt-fade, .dsbt-title, .dsbt-line, .dsbt-jump, .dsbt-star, .dsbt-filterbtn, .dsbt-filterbar { transition: none; }\n }\n`\n","/**\n * Conversation timeline rail — DeepSeek web ScrollNav rebuilt on this\n * plugin's frosted-glass system (styles: ./timeline-css.ts).\n *\n * Collapsed: a fixed 34px-wide frosted capsule at the right edge, vertically\n * centered, one tick per user message (active tick scaled + brand blue,\n * key-point bookmarks golden). Hovering expands the SAME box into a frosted\n * panel listing every user question (title fades in; >8 messages widen to\n * 260px, otherwise the width fits the longest title). Both states share one\n * computed outer height, so expanding never jumps, and 32px fade veils mask\n * the clipped edge on each side while that side actually scrolls.\n *\n * Enhancements ported from dsh-chat-timeline v0.1.4 (MIT):\n * - Key-point bookmarks: star a question in the expanded panel, persisted per\n * session in localStorage; marked rows show a golden tick in the capsule\n * and a \"marked only\" filter narrows the list.\n * - Jump stabilization: the reading-position tracker freezes while a smooth\n * jump animates (cleared 150ms after the last scroll event, plus an 800ms\n * fallback), so the panel cannot jitter mid-jump.\n * - Rewind integration: messages withdrawn by a rewind command node are\n * filtered out of the rail.\n *\n * Data source, fastest first: the host-side `bgTimeline` session projection\n * (src/projection.ts — a complete enumeration of the session's user messages\n * delivered through the projection baseline/push channel) -> the loaded chat\n * node window. The conversation's own lazy loading is never driven from here;\n * clicking a row pages older history on demand, scrolls the conversation to\n * the target row, and keeps the rail's own active row visible.\n *\n * Collapsed idle strategy (official ScrollNav behavior): the tick stack is\n * pinned to the BOTTOM inner edge — the newest question's tick always sits at\n * the bottom of the capsule, older ticks clip away at the top. Hovering\n * expands the SAME box and scrolls the active row into view instead.\n *\n * The rail reads the shared settings transport: it renders unless\n * `timeline: false`. Its glass paints are self-contained official values\n * (see timeline-css.ts), independent of the plugin's token overrides.\n */\n\nimport react from 'react'\nimport reactDom from 'react-dom'\nimport { settingsClient } from './settings-client.ts'\nimport { TIMELINE_PROJECTION_KEY } from '../settings.ts'\nimport { injectTimelineCss, TIMELINE_TITLE_FONT_PX } from './timeline-css.ts'\n\n/** Shared constant lives in settings.ts; re-exported for consumers of this module. */\nexport { TIMELINE_PROJECTION_KEY }\n\n// Inject the stylesheet once at module evaluation (the loader removes\n// plugin-owned tags on unload; re-evaluation dedupes on the tag id).\nif (typeof document !== 'undefined') injectTimelineCss()\n\n/** Structural view of one chat node this rail consumes. */\ninterface ChatNodeLike {\n kind?: string\n key?: string\n anchorSeq?: number\n data?: {\n time?: number\n content?: unknown\n name?: unknown\n seq?: unknown\n args?: unknown\n outcome?: { kind?: unknown; sourceEventSeq?: unknown; text?: unknown }\n }\n}\n\n/** One normalized user-message entry in the rail. */\nexport interface TimelineMessage {\n seq: number\n time: number\n text: string\n key?: string\n}\n\n/** Session handle face the rail needs off the runtime sessions service. */\nexport interface TimelineSessionHandle {\n subscribe(listener: () => void): () => void\n getSnapshot(): unknown\n loadOlder(): Promise<unknown>\n}\n\n/** Sessions service face (narrowed to what jump/data collection touches). */\nexport interface TimelineSessionsService {\n binding(sessionId: string): { session: TimelineSessionHandle } | undefined\n}\n\n/** Component props delivered by the dock slot registration. */\nexport interface TimelineRailProps {\n sessionId?: string\n sessionsService?: TimelineSessionsService\n /** Framework projection reader (SessionStandardProps seat; undefined-capable). */\n useProjection?: (key: string) => unknown\n t: (key: string) => string\n}\n\nconst delay = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))\n\n/** Extract preview text from a user message's ContentBlock list. */\nfunction userTextOf(content: unknown): string {\n if (!Array.isArray(content)) return ''\n let out = ''\n for (const block of content) {\n if (block !== null && typeof block === 'object' && (block as { type?: unknown }).type === 'text') {\n const text = (block as { text?: unknown }).text\n if (typeof text === 'string') out += text\n }\n }\n return out.trim().slice(0, 80)\n}\n\n/* ---- Key-point bookmarks (ported from dsh-chat-timeline v0.1.4) --------- */\n\n/**\n * Stable bookmark key for one entry: the durable message key, falling back to\n * the anchor seq — so marks survive history reloads. Entries with neither are\n * not markable (empty key).\n * @param m - the entry (or any shaped object).\n */\nexport function markKeyOf(m: unknown): string {\n if (m === null || typeof m !== 'object') return ''\n const rec = m as { key?: unknown; seq?: unknown }\n if (typeof rec.key === 'string' && rec.key !== '') return `key:${rec.key}`\n return typeof rec.seq === 'number' ? `seq:${rec.seq}` : ''\n}\n\n/** localStorage key prefix for the per-session marked-key lists. */\nexport const MARKS_STORAGE_PREFIX = 'dsbt_marks_'\n\n/**\n * Read the marked keys for one session from localStorage.\n * @param sessionId - the session the marks belong to.\n */\nexport function readMarks(sessionId: string | undefined): string[] {\n if (typeof window === 'undefined' || !sessionId) return []\n try {\n const raw = window.localStorage.getItem(MARKS_STORAGE_PREFIX + sessionId)\n if (!raw) return []\n const parsed: unknown = JSON.parse(raw)\n return Array.isArray(parsed) ? parsed.filter((k): k is string => typeof k === 'string') : []\n } catch {\n return []\n }\n}\n\n/**\n * Persist the marked keys for one session (removes the key when empty).\n * @param sessionId - the session the marks belong to.\n * @param marks - the marked-key list.\n */\nexport function writeMarks(sessionId: string | undefined, marks: string[]): void {\n if (typeof window === 'undefined' || !sessionId) return\n try {\n if (!Array.isArray(marks) || marks.length === 0) window.localStorage.removeItem(MARKS_STORAGE_PREFIX + sessionId)\n else window.localStorage.setItem(MARKS_STORAGE_PREFIX + sessionId, JSON.stringify(marks))\n } catch { /* storage unavailable — marks stay in-memory */ }\n}\n\n/* ---- Rewind integration (ported from dsh-chat-timeline v0.1.4) ---------- */\n\n/**\n * Extract the rewind target seq from a rewind outcome text.\n * @param text - the command outcome text.\n */\nexport function rewindTargetOfOutcome(text: unknown): number | undefined {\n if (typeof text !== 'string') return undefined\n const match = /rewound.*?(?:target\\s+)?(\\d+)/i.exec(text) ?? /#(\\d+)/.exec(text)\n const digits = match?.[1]\n if (digits === undefined) return undefined\n const n = Number.parseInt(digits, 10)\n return Number.isFinite(n) ? n : undefined\n}\n\n/**\n * Is this rewind command a preview/dry-run (marks the target hidden without\n * an outcome)?\n * @param command - the command payload.\n */\nfunction isRewindPreviewCommand(command: { args?: unknown }): boolean {\n if (command.args === null || typeof command.args !== 'object') return false\n const args = command.args as { preview?: unknown; dryRun?: unknown }\n return args.preview === true || args.dryRun === true\n}\n\n/**\n * Collect the seq numbers a rewind hid: preview commands hide their target\n * directly; successful commands hide their own row plus every node anchored\n * inside the rewound span [target, sourceEventSeq].\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function hiddenSeqsOfChat(chat: unknown): Set<number> {\n const hidden = rewindHiddenSeqsOfChat(chat)\n const spans = rewindSpansOfChat(chat)\n if (spans.length === 0) return hidden\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return hidden\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n const anchor = typeof node.anchorSeq === 'number' ? node.anchorSeq : undefined\n if (anchor === undefined) continue\n if (spans.some((span) => anchor >= span.start && anchor <= span.end)) hidden.add(anchor)\n }\n return hidden\n}\n\n/**\n * Seq numbers a rewind hid directly: successful commands hide their own row;\n * preview commands hide their target.\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function rewindHiddenSeqsOfChat(chat: unknown): Set<number> {\n const hidden = new Set<number>()\n if (chat === null || typeof chat !== 'object') return hidden\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return hidden\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'command') continue\n const command = node.data\n if (command === null || typeof command !== 'object') continue\n if (command.name !== 'rewind') continue\n if (isRewindPreviewCommand(command)) {\n if (typeof command.seq === 'number') hidden.add(command.seq)\n continue\n }\n const outcome = command.outcome\n if (outcome === null || typeof outcome !== 'object' || outcome.kind !== 'success') continue\n if (typeof command.seq === 'number') hidden.add(command.seq)\n }\n return hidden\n}\n\n/**\n * The [target, sourceEventSeq] spans successful rewind commands cut — the\n * range form of hiding, needed to filter sources that are NOT chat nodes\n * (the host projection) by plain seq membership.\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function rewindSpansOfChat(chat: unknown): { start: number; end: number }[] {\n const spans: { start: number; end: number }[] = []\n if (chat === null || typeof chat !== 'object') return spans\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return spans\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'command') continue\n const command = node.data\n if (command === null || typeof command !== 'object') continue\n if (command.name !== 'rewind') continue\n if (isRewindPreviewCommand(command)) continue\n const outcome = command.outcome\n if (outcome === null || typeof outcome !== 'object' || outcome.kind !== 'success') continue\n const marker = outcome.sourceEventSeq\n if (typeof marker !== 'number') continue\n const target = rewindTargetOfOutcome(outcome.text)\n if (target !== undefined) spans.push({ start: target, end: marker })\n }\n return spans\n}\n\n/**\n * Enumerate user messages from the loaded chat-node snapshot (the client-side\n * collector; sorted by anchor sequence, rewind-hidden entries dropped).\n * @param snapshot - a session snapshot (loosely typed on purpose).\n */\nexport function collectMessages(snapshot: unknown): TimelineMessage[] {\n const chat = (snapshot as { chat?: { nodes?: Map<string, ChatNodeLike> } } | undefined)?.chat\n const nodes = chat?.nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return []\n const hidden = hiddenSeqsOfChat(chat)\n const out: TimelineMessage[] = []\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'user') continue\n const data = node.data\n if (data === null || typeof data !== 'object' || typeof data.time !== 'number' || !Array.isArray(data.content)) continue\n const key = typeof node.key === 'string' ? node.key : undefined\n if (key === undefined) continue\n const seq = typeof node.anchorSeq === 'number' ? node.anchorSeq : 0\n if (hidden.has(seq)) continue\n out.push({ seq, time: data.time, text: userTextOf(data.content), key })\n }\n out.sort((a, b) => a.seq - b.seq)\n return out\n}\n\n/** Resolve the DOM anchor key of one entry (direct key form only). */\nexport function resolveAnchorKey(m: TimelineMessage): string | undefined {\n return typeof m.key === 'string' && m.key !== '' ? m.key : undefined\n}\n\n/* ---- Host projection source --------------------------------------------- */\n\n/** The user-message node definition kind in ui-conversation. */\nconst INPUT_MESSAGE_KIND = 'input-message'\n\n/**\n * Rebuild a chat row's DOM anchor key from the durable message id — the same\n * engine formula as conversationContextKey(kind, id) for the input-message\n * definition (`13:input-message<id>`), so projected entries can jump even\n * when their chat node is not loaded yet.\n * @param id - the durable message id carried by the projection entry.\n */\nexport function inputAnchorKeyOf(id: string): string {\n return `${INPUT_MESSAGE_KIND.length}:${INPUT_MESSAGE_KIND}${id}`\n}\n\n/**\n * Validate one projected wire value into rail entries (defensive: the value\n * crosses the wire and may be absent, partial, or stale).\n * @param value - the raw useProjection(TIMELINE_PROJECTION_KEY) snapshot.\n */\nexport function normalizeProjectedTimeline(value: unknown): TimelineMessage[] {\n if (value === null || typeof value !== 'object') return []\n const raw = (value as { messages?: unknown }).messages\n if (!Array.isArray(raw)) return []\n const seen = new Set<number>()\n const out: TimelineMessage[] = []\n for (const item of raw) {\n if (item === null || typeof item !== 'object') continue\n const rec = item as { seq?: unknown; time?: unknown; text?: unknown; id?: unknown }\n if (typeof rec.seq !== 'number' || !Number.isFinite(rec.seq)) continue\n if (seen.has(rec.seq)) continue\n seen.add(rec.seq)\n out.push({\n seq: rec.seq,\n time: typeof rec.time === 'number' ? rec.time : 0,\n text: typeof rec.text === 'string' ? rec.text.slice(0, 80) : '',\n ...(typeof rec.id === 'string' && rec.id !== '' ? { key: inputAnchorKeyOf(rec.id) } : {}),\n })\n }\n out.sort((a, b) => a.seq - b.seq)\n return out\n}\n\n/**\n * Rail messages with the fastest source first: the host projection covers the\n * WHOLE session (and already excludes rewind cuts), so it wins whenever it\n * has anything; otherwise fall back to the loaded chat-node window. The\n * projection path still applies locally-known rewind hiding so a cut lands\n * instantly even before the next projection push arrives.\n * @param snapshot - the session conversation snapshot (node fallback).\n * @param projected - the raw bgTimeline projection value.\n */\nexport function railMessages(snapshot: unknown, projected: unknown): TimelineMessage[] {\n const projectedMessages = normalizeProjectedTimeline(projected)\n if (projectedMessages.length > 0) {\n // The host projection already drops rewind cuts authoritatively; this\n // locally-known hiding (command rows, preview targets and cut spans read\n // off the loaded window) makes a rewind land instantly, before the next\n // projection push arrives.\n const chat = (snapshot as { chat?: { nodes?: Map<string, ChatNodeLike> } } | undefined)?.chat\n const hidden = rewindHiddenSeqsOfChat(chat)\n const spans = rewindSpansOfChat(chat)\n if (hidden.size === 0 && spans.length === 0) return projectedMessages\n return projectedMessages.filter((m) =>\n !hidden.has(m.seq) && !spans.some((span) => m.seq >= span.start && m.seq <= span.end))\n }\n return collectMessages(snapshot)\n}\n\n/**\n * Outer rail height for a message count: rows + breathing room, clamped so\n * both states always share the exact same height (never jumps on expand).\n * @param count - number of user messages.\n */\nexport function railHeightFor(count: number): number {\n return Math.max(140, Math.min(300, count * 30 + 38))\n}\n\n/** Longest-title width estimate bounds. */\nconst RAIL_MIN_WIDTH = 96\nconst RAIL_MAX_WIDTH = 260\n\n/**\n * Measure the expanded-panel width for the given titles (canvas text metrics;\n * falls back to the max width when measurement is unavailable). Accounts for\n * the star column so a marked row never clips its tick.\n * @param texts - the message previews.\n */\nexport function railWidthFor(texts: string[]): number {\n if (texts.length > 8) return RAIL_MAX_WIDTH\n let widest = 0\n if (typeof document !== 'undefined') {\n const canvas = document.createElement('canvas')\n const ctx = canvas.getContext('2d')\n if (ctx) {\n ctx.font = `${TIMELINE_TITLE_FONT_PX}px -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif`\n for (const t of texts) {\n const w = ctx.measureText(t === '' ? '…' : t).width\n if (w > widest) widest = w\n }\n }\n }\n // Title + title gap + star column + indicator + item gutters + border/padding.\n return Math.round(Math.max(RAIL_MIN_WIDTH, Math.min(RAIL_MAX_WIDTH, widest + 6 + 24 + 16 + 12)))\n}\n\n/** Ensure the target node is loaded, then scroll its row into view. */\nasync function jumpToMessage(sessionsService: TimelineSessionsService, sessionId: string, key: string): Promise<boolean> {\n const session = sessionsService.binding(sessionId)?.session\n if (session === undefined) return false\n let guard = 0\n while (guard++ < 120) {\n const snapshot = session.getSnapshot() as { chat?: { nodes?: Map<string, unknown> }; hasMore?: boolean; loadingOlder?: boolean }\n if (snapshot?.chat?.nodes?.get(key) !== undefined) break\n if (snapshot?.hasMore !== true) return false\n if (snapshot.loadingOlder === true) {\n await delay(50)\n continue\n }\n await session.loadOlder()\n }\n const scrollport = document.querySelector('[data-conversation-scroll]')\n const row = scrollport?.querySelector(`[data-chat-anchor-key=\"${CSS.escape(key)}\"]`) ?? null\n if (row === null) return false\n const reducedMotion = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n row.scrollIntoView({ behavior: reducedMotion ? 'auto' : 'smooth', block: 'center' })\n return true\n}\n\n/**\n * Scroll only the rail itself so the active row stays visible (min distance).\n * offsetTop math instead of getBoundingClientRect: stable while the panel's\n * own smooth scroll animates (no feedback loop with live rects).\n */\nfunction scrollTimelineItemIntoView(page: HTMLElement, item: HTMLElement): void {\n const pageTop = page.scrollTop\n const pageBottom = pageTop + page.clientHeight\n const itemTop = item.offsetTop\n const itemBottom = itemTop + item.offsetHeight\n if (itemTop < pageTop) page.scrollTop = Math.max(0, itemTop - 10)\n else if (itemBottom > pageBottom) page.scrollTop = itemBottom - page.clientHeight + 10\n}\n\n/** Is another timeline rail already mounted (e.g. dsh-chat-timeline)? */\nfunction otherRailPresent(): boolean {\n return document.querySelector('.dsct_nav') !== null\n}\n\n/**\n * The timeline rail component. Portaled to body; registered into the\n * conversation input dock purely to bind per-session lifecycle.\n */\nexport function TimelineRail(props: TimelineRailProps): react.ReactElement | null {\n const { sessionId, sessionsService, useProjection, t } = props\n\n // Shared settings: the rail hides while timeline === false. Read through a\n // hook like every other store here, but the gate itself must sit with the\n // FINAL early return below — an early return between hooks would crash\n // React (\"rendered fewer hooks\") the moment the toggle flips mid-session.\n const settings = react.useSyncExternalStore(settingsClient.subscribe, settingsClient.getSnapshot)\n // Hide only while the persisted toggle is UNKNOWN (no wrong-state flash for\n // timeline:false users); once loading settles the default-on rail renders\n // even if the section errored.\n const timelineUnknown = settings.status === 'loading'\n const timelineDisabled = settings.value?.timeline === false\n\n const session = sessionId !== undefined && sessionsService !== undefined ? sessionsService.binding(sessionId)?.session : undefined\n // SessionFace methods are prototype methods reading \"this\"; React invokes\n // store callbacks as bare functions, so keep the receiver via closures\n // (same shape as the host's own wiring, e.g. ModelSelect). Identity stays\n // stable per session so uSES does not resubscribe on every render.\n const subscribeSession = react.useCallback(\n (listener: () => void) => session === undefined ? () => {} : session.subscribe(listener),\n [session],\n )\n const snapshotSession = react.useCallback(\n () => session === undefined ? undefined : session.getSnapshot(),\n [session],\n )\n const nodeSnapshot = react.useSyncExternalStore(subscribeSession, snapshotSession)\n\n // Host projection first: the full-session user-message index (baseline on\n // session open, live push frames after). Undefined until the framework\n // seat exists or the deployment lacks the projection registry — then the\n // loaded chat-node window below is the fallback source.\n const projected = useProjection !== undefined ? useProjection(TIMELINE_PROJECTION_KEY) : undefined\n\n // Collected per snapshot/projection change (the collector allocates +\n // sorts); memoized so width measurement and tracking effects key on\n // content, not renders.\n const messages = react.useMemo(() => railMessages(nodeSnapshot, projected), [nodeSnapshot, projected])\n\n const [activeIndex, setActiveIndex] = react.useState(-1)\n const [show, setShow] = react.useState(false)\n const [rightOffset, setRightOffset] = react.useState(16)\n const [railWidth, setRailWidth] = react.useState(RAIL_MAX_WIDTH)\n const [fades, setFades] = react.useState({ top: false, bottom: false })\n const [hidden, setHidden] = react.useState(() => otherRailPresent())\n // Key-point bookmarks: per-session list + the \"marked only\" filter toggle.\n const [marks, setMarks] = react.useState<string[]>(() => readMarks(sessionId))\n const [marksOnly, setMarksOnly] = react.useState(false)\n const [isNarrow, setIsNarrow] = react.useState(\n () => typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n && window.matchMedia('(max-width: 767px)').matches,\n )\n const pageRef = react.useRef<HTMLDivElement | null>(null)\n const activeItemRef = react.useRef<HTMLButtonElement | null>(null)\n // Jump-stabilization lock: freezes the reading-position tracker while a\n // click-triggered smooth jump animates (cleared by the settle timer below\n // or the 800ms fallback in the click handler). The fallback timeout is\n // tracked so the settle path can cancel it and unmount cannot leak it.\n const jumpPendingRef = react.useRef(false)\n const jumpFallbackRef = react.useRef<number | undefined>(undefined)\n\n // Marks follow the session switch; the filter resets with them.\n react.useEffect(() => {\n setMarks(readMarks(sessionId))\n setMarksOnly(false)\n }, [sessionId])\n\n const markedSet = react.useMemo(() => new Set(marks), [marks])\n // Mirror ref so rapid successive toggles always see the latest list (the\n // handler writes storage directly, outside the setState updater — updaters\n // must stay pure and StrictMode re-runs them).\n const marksRef = react.useRef(marks)\n marksRef.current = marks\n const toggleMark = react.useCallback((m: TimelineMessage) => {\n const k = markKeyOf(m)\n if (k === '') return\n const prev = marksRef.current\n const next = prev.includes(k) ? prev.filter((x) => x !== k) : [...prev, k]\n marksRef.current = next\n setMarks(next)\n writeMarks(sessionId, next)\n }, [sessionId])\n\n // Narrow-viewport guard (matches the official breakpoint).\n react.useEffect(() => {\n if (typeof window.matchMedia !== 'function') return\n const mql = window.matchMedia('(max-width: 767px)')\n const onChange = (e: MediaQueryListEvent): void => setIsNarrow(e.matches)\n mql.addEventListener('change', onChange)\n return () => mql.removeEventListener('change', onChange)\n }, [])\n\n // Width follows the longest title (remeasured when messages arrive/change).\n // No gating on a \"fully loaded\" flag: the projection source is complete by\n // construction, and the node fallback measures whatever it has.\n react.useEffect(() => {\n setRailWidth(railWidthFor(messages.map((m) => m.text)))\n }, [messages])\n\n // Reading position tracking: nearest user row to the 40% viewport line.\n // An IntersectionObserver (when available) keeps a live set of the rows\n // currently inside the scrollport — the best row is always one of them — so\n // each pass reads a few dozen rects instead of one per row of a possibly\n // thousand-row history; without IO measure() scans every row as before.\n react.useEffect(() => {\n if (messages.length === 0) return\n const indexByKey = new Map<string, number>()\n messages.forEach((m, i) => {\n const key = resolveAnchorKey(m)\n if (key !== undefined) indexByKey.set(key, i)\n })\n const sp = document.querySelector('[data-conversation-scroll]')\n if (sp === null) return\n const rows = sp.querySelectorAll('[data-chat-anchor-key]')\n\n let settleTimer: number | undefined\n let frame = 0\n const nearRows = new Set<Element>()\n\n const updateActive = (): void => {\n // A jump is animating: freeze the highlight so the panel cannot jitter.\n if (jumpPendingRef.current) return\n const rect = sp.getBoundingClientRect()\n if (rect.height === 0) return\n const candidates = nearRows.size > 0 ? nearRows : rows\n const line = rect.top + rect.height * 0.4\n let best = -1\n let bestDist = Infinity\n for (const row of candidates) {\n const key = row.getAttribute('data-chat-anchor-key')\n if (key === null) continue\n const idx = indexByKey.get(key) ?? -1\n if (idx === -1) continue\n const r = row.getBoundingClientRect()\n const dist = Math.abs(r.top + r.height / 2 - line)\n if (dist < bestDist) {\n bestDist = dist\n best = idx\n }\n }\n setActiveIndex(best)\n }\n const scheduleMeasure = (): void => {\n if (frame !== 0) return\n frame = window.requestAnimationFrame(() => {\n frame = 0\n updateActive()\n })\n }\n\n let io: IntersectionObserver | undefined\n if (typeof IntersectionObserver === 'function') {\n io = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) nearRows.add(entry.target)\n else nearRows.delete(entry.target)\n }\n scheduleMeasure()\n }, { root: sp })\n rows.forEach((row) => io?.observe(row))\n }\n\n const onScroll = (): void => {\n // Detect the true end of scrolling: 150ms after the LAST scroll event\n // release the jump lock and refresh the highlight exactly once.\n if (settleTimer !== undefined) clearTimeout(settleTimer)\n settleTimer = window.setTimeout(() => {\n settleTimer = undefined\n if (jumpPendingRef.current) {\n jumpPendingRef.current = false\n if (jumpFallbackRef.current !== undefined) {\n clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = undefined\n }\n updateActive()\n }\n }, 150)\n scheduleMeasure()\n }\n sp.addEventListener('scroll', onScroll, { passive: true })\n const interval = window.setInterval(scheduleMeasure, 2000)\n scheduleMeasure()\n return () => {\n io?.disconnect()\n if (frame !== 0) cancelAnimationFrame(frame)\n if (settleTimer !== undefined) clearTimeout(settleTimer)\n if (jumpFallbackRef.current !== undefined) {\n clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = undefined\n }\n sp.removeEventListener('scroll', onScroll)\n clearInterval(interval)\n }\n }, [messages])\n\n // Fade veils reflect the page's actual clip state (scroll position).\n const syncFades = react.useCallback((): void => {\n const page = pageRef.current\n if (page === null) {\n setFades({ top: false, bottom: false })\n return\n }\n const canTop = page.scrollTop > 2\n const canBot = page.scrollTop + page.clientHeight < page.scrollHeight - 2\n setFades((prev) => (prev.top === canTop && prev.bottom === canBot ? prev : { top: canTop, bottom: canBot }))\n }, [])\n react.useEffect(syncFades, [syncFades, show, messages.length, marksOnly])\n\n // Keep the active row visible inside the rail without moving the chat.\n react.useLayoutEffect(() => {\n if (!show) return\n const page = pageRef.current\n const item = activeItemRef.current\n if (page === null || item === null) return\n scrollTimelineItemIntoView(page, item)\n syncFades()\n }, [activeIndex, messages.length, marksOnly, show, syncFades])\n\n // Collapsed idle strategy (official ScrollNav behavior): pin the tick stack\n // to the BOTTOM inner edge so the newest question's tick always hugs the\n // bottom of the capsule and older ticks clip away at the top. overflow:hidden\n // boxes still accept programmatic scrollTop; scrollHeight clamps the value,\n // and short stacks that fit simply stay put (the page centers them). Runs on\n // every collapse and whenever the stack changes while idle, so a message\n // sent in another window keeps the newest tick pinned.\n const height = railHeightFor(messages.length)\n react.useLayoutEffect(() => {\n if (show) return\n const page = pageRef.current\n if (page === null) return\n page.scrollTop = page.scrollHeight\n }, [show, messages.length, marksOnly, height])\n\n // Avoid right-side workbenches: derive the offset from the chat scrollport.\n react.useEffect(() => {\n let raf = 0\n const measure = (): void => {\n raf = 0\n const sp = document.querySelector('[data-conversation-scroll]')\n if (sp === null) return\n const rect = sp.getBoundingClientRect()\n if (rect.width === 0 && rect.height === 0) return\n const next = Math.max(8, Math.round(window.innerWidth - rect.right + 12))\n setRightOffset((prev) => (Math.abs(prev - next) > 0.5 ? next : prev))\n }\n const schedule = (): void => {\n if (raf === 0) raf = window.requestAnimationFrame(measure)\n }\n const sp = document.querySelector('[data-conversation-scroll]')\n const ro = typeof ResizeObserver === 'function' && sp !== null ? new ResizeObserver(schedule) : null\n if (ro !== null && sp !== null) ro.observe(sp)\n window.addEventListener('resize', schedule)\n // Slow guard: pick up a competing rail (un)mounting mid-session.\n const guard = window.setInterval(() => setHidden(otherRailPresent()), 2000)\n measure()\n return () => {\n if (raf !== 0) cancelAnimationFrame(raf)\n ro?.disconnect()\n window.removeEventListener('resize', schedule)\n clearInterval(guard)\n }\n }, [])\n\n // Any non-empty conversation gets the rail — the official ScrollNav renders\n // for a lone question too, and the clamped shared height keeps a single\n // tick cleanly bottom-pinned instead of hiding the capsule.\n if (timelineUnknown || timelineDisabled\n || sessionId === undefined || sessionsService === undefined || isNarrow || hidden || messages.length === 0) {\n return null\n }\n\n // Compare actives by bookmark key, not index: the filtered display list\n // reindexes rows, and the active ref must track the SAME question.\n const activeKey = activeIndex >= 0 && activeIndex < messages.length ? markKeyOf(messages[activeIndex]) : ''\n const displayMessages = marksOnly ? messages.filter((m) => markedSet.has(markKeyOf(m))) : messages\n\n return reactDom.createPortal(\n <div\n className=\"dsbt-nav\"\n style={{ right: rightOffset, ['--dsbt-h' as string]: `${height}px`, ['--dsbt-w' as string]: `${railWidth}px` }}\n role=\"navigation\"\n aria-label={t('timeline.railLabel')}\n onMouseEnter={() => setShow(true)}\n onMouseLeave={() => setShow(false)}\n >\n <div className={show ? 'dsbt-bg dsbt-bg-hide' : 'dsbt-bg'} />\n <div className={show ? 'dsbt-wrap dsbt-show' : 'dsbt-wrap'}>\n <div className=\"dsbt-filterbar\">\n <button\n type=\"button\"\n className={marksOnly ? 'dsbt-filterbtn dsbt-filteron' : 'dsbt-filterbtn'}\n aria-pressed={marksOnly}\n onClick={() => setMarksOnly((v) => !v)}\n >\n {t('timeline.marksOnly')}{marks.length > 0 ? ` (${marks.length})` : ''}\n </button>\n </div>\n <div className={fades.top ? 'dsbt-fade dsbt-fade-on' : 'dsbt-fade'} aria-hidden />\n <div className={fades.bottom ? 'dsbt-fade dsbt-fade-bot dsbt-fade-on' : 'dsbt-fade dsbt-fade-bot'} aria-hidden />\n <div\n className=\"dsbt-page\"\n ref={pageRef}\n onScroll={syncFades}\n >\n {displayMessages.length === 0\n ? <div className=\"dsbt-empty\">{t('timeline.noMarks')}</div>\n : displayMessages.map((m) => {\n const key = resolveAnchorKey(m)\n const mk = markKeyOf(m)\n const marked = markedSet.has(mk)\n const isActive = activeKey !== '' && mk === activeKey\n const cls = `dsbt-item${isActive ? ' dsbt-active' : ''}${marked ? ' dsbt-marked' : ''}`\n return (\n <div key={m.seq} className={cls}>\n {/* Jump target and star bookmark are SIBLING real buttons —\n the previous span[role=button] nested inside the row\n button was invalid interactive-in-interactive markup,\n while native buttons keep Enter/Space for both roles. */}\n <button\n type=\"button\"\n className=\"dsbt-jump\"\n ref={isActive ? activeItemRef : undefined}\n title={`${marked ? '★ ' : ''}${m.text === '' ? t('timeline.noText') : m.text}`}\n aria-label={`${marked ? '★ ' : ''}${t('timeline.roleUser')}: ${m.text.slice(0, 60) || t('timeline.noText')}`}\n aria-current={isActive ? 'location' : undefined}\n onClick={() => {\n if (key === undefined) return\n // Engage the stabilization lock with a fallback timeout:\n // the settle timer normally releases it after the jump.\n // A fresh click replaces the pending fallback so a rapid\n // second jump cannot be unlocked by the first one's timer.\n jumpPendingRef.current = true\n if (jumpFallbackRef.current !== undefined) clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = window.setTimeout(() => {\n jumpFallbackRef.current = undefined\n jumpPendingRef.current = false\n }, 800)\n void jumpToMessage(sessionsService, sessionId, key).catch(() => {})\n }}\n >\n <span className=\"dsbt-title\">{m.text === '' ? t('timeline.noText') : m.text}</span>\n </button>\n <button\n type=\"button\"\n className={marked ? 'dsbt-star dsbt-staron' : 'dsbt-star'}\n aria-pressed={marked}\n aria-label={marked ? t('timeline.unmark') : t('timeline.mark')}\n onClick={() => toggleMark(m)}\n >\n ★\n </button>\n <span className=\"dsbt-ind\" aria-hidden>\n <span className=\"dsbt-line\" />\n </span>\n </div>\n )\n })}\n </div>\n </div>\n </div>,\n document.body,\n )\n}\n","/**\n * Browser half of the background plugin: paints the background behind the\n * whole app frame, provides the settings surface (a live row inside the\n * official General settings section), and renders the conversation timeline\n * rail (DeepSeek ScrollNav style) on the same frosted-glass system. Data\n * flows through the plugin's own host route (`/api/bg-wallpaper/*`), not the\n * settings RPC. Retraction discipline mirrors the skin plugins: every\n * property and DOM node the painter owns is restored on dispose.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { backgroundPainter, paintBackground } from './backdrop.ts'\nimport { en, zh } from './locales.ts'\nimport { BackgroundSettingsRow } from './SettingsRow.tsx'\nimport { settingsClient } from './settings-client.ts'\nimport { TimelineRail } from './timeline.tsx'\nimport type {} from './types.ts'\n\n/**\n * Service injections this entry declares: `slots` + `locale` for the settings\n * surface and the timeline slot seat, and `sessions` so the timeline rail can\n * enumerate user messages and jump between them. The settings surface itself\n * talks to the plugin's own host route over plain same-origin fetch.\n */\nexport const inject = ['slots', 'locale', 'sessions']\n\n/**\n * Client plugin body: paint the persisted background live, register the\n * General-settings row, and mount the conversation timeline rail.\n * @param ctx - client cordis context (slots/locale/sessions injected).\n */\nexport function apply(ctx: Context): void {\n // Paint from the plugin's own transport; repaint on every snapshot change.\n const paint = (): void => {\n const snapshot = settingsClient.getSnapshot()\n const value = snapshot.status === 'ready' ? snapshot.value : undefined\n if (value === undefined || !value.enabled) {\n backgroundPainter.dispose()\n return\n }\n paintBackground(value)\n }\n const unsubscribe = settingsClient.subscribe(paint)\n void settingsClient.load()\n\n ctx.effect(() => ctx.locale.register('ui-background', { zh, en }), 'deepseek-harness-background: dictionaries')\n\n // Live settings row in the General section (same slot as the Appearance row).\n ctx.slots.inject('settings.general.item', () => ctx.slots.register({\n name: 'settings.general.item',\n id: 'deepseek-harness-background',\n order: 600,\n locale: 'ui-background',\n }, BackgroundSettingsRow))\n\n // Conversation timeline rail: takes a per-session dock seat only to bind\n // its lifecycle; the rail portals to body. The sessions service is handed\n // to the component through the registration's inject face — resolved\n // lazily inside the factory so a runtime-side service rebuild can never\n // leave the rail holding a stale reference.\n ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({\n name: 'conversation.input.dock',\n id: 'deepseek-harness-background.timeline',\n order: 45,\n locale: 'ui-background',\n inject: () => ({ sessionsService: ctx.sessions }),\n }, TimelineRail))\n\n ctx.effect(() => () => {\n unsubscribe()\n backgroundPainter.dispose()\n }, 'deepseek-harness-background: background surface')\n}\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAa,qBAAqB;;EAGlC,MAAa,cAAc;;;;;;;;EAS3B,MAAa,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC1B,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqM9B,SAAgB,sBAA4B;GAC1C,IAAI,SAAS,cAAc,6DAAgD,GAAG;GAC9E,MAAM,MAAM,SAAS,cAAc,OAAO;GAC1C,IAAI,QAAQ,SAAS;GACrB,IAAI,QAAQ,YAAY;GACxB,IAAI,cAAc;GAClB,SAAS,KAAK,YAAY,GAAG;EAC/B;;;;ECnPA,MAAa,wBAAwB;;EAWrC,MAAa,gBAAgB;;EAY7B,MAAa,wBAAwB;;;;;;EA+BrC,MAAa,0BAA0B;;EAGvC,MAAa,cAAc;;EAG3B,MAAa,YAAY,CAAC,SAAS,SAAS;;;;;;;;;;;;;;;EC7D5C,MAAM,cAAc;EACpB,MAAM,cAAc;EACpB,MAAM,cAAc;;;;;EAMpB,MAAM,eAAe,CAAC,uBAAuB,6BAA6B;;;;;;;;;;;EAY1E,MAAM,uBAAqE;GACzE;IAAE,OAAO;IAA8B,QAAQ;GAAE;GACjD;IAAE,OAAO;IAAyB,QAAQ;GAAI;GAC9C;IAAE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,CAAC;GAOzB,IAAI,MAAM,OAAO,iCAAiC,IAAI,MAAM,SAAS;IACnE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,eAAe,EAAE,iBAAiB,IAAI,SAAS;GACjD,GAAG,YAAY,CAAC;GAEhB,IAAI,mBAAmB;IACrB,YAAY;IACZ,kBAAkB,QAAQ;GAC5B,GAAG,iDAAiD;EACtD"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["useState","useRef","css","useSyncExternalStore","useCallback","reactDom"],"sources":["../src/client/background-css.ts","../src/settings.ts","../src/client/backdrop.ts","../src/client/glass-registry.ts","../src/client/locales.ts","../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../src/client/settings-client.ts","../src/client/SettingsRow.tsx","../src/client/timeline-css.ts","../src/client/timeline.tsx","../src/client/index.ts"],"sourcesContent":["/**\n * Background CSS — the stylesheet injected once into the document when the\n * plugin first runs. It defines the behind-body wallpaper layer, the scrim,\n * and the frosted-glass surfaces, all driven by CSS variables the painter\n * writes onto `document.body`. Kept in a single idempotent\n * `<style data-plugin-css>` tag (mirrors the reference `dsh-wallpaper-engine`\n * bundle).\n */\n\n/** Unique id stamped on the injected style element (dedup key). */\nexport const BACKGROUND_CSS_TAG = 'deepseek-harness-background/styles'\n\n/** Body attribute the painter sets while a wallpaper is active. */\nexport const ACTIVE_ATTR = 'data-dsh-bg'\n\n/**\n * Body attribute the painter sets only while the glass is actually on (a\n * wallpaper is active AND panelOpacity < 1). The explicit-fill rules below —\n * whitelisted buttons, popovers and badges whose official fills are not\n * token-mediated — key on this gate so they return to the exact official\n * paints when the user maxes the panel-opacity slider.\n */\nexport const GLASS_ATTR = 'data-dsh-bg-glass'\n\n/**\n * The backdrop CSS. The wallpaper is a fixed `z-index:-2` element (below the\n * scrim at `-1`, below the UI). While active, the app frame + sidebar fills\n * turn transparent so all columns share one backdrop.\n *\n * Frosted glass is a WHITELIST, not a blanket: only the surfaces that float\n * as small cards/buttons over the wallpaper are glassed — composer card,\n * message bubbles, code surfaces (blocks, inline code, tool IO cards,\n * skill/MCP call cards), the three chrome buttons (new session, composer +\n * button, scroll-to-bottom), the load-earlier history button, the composer\n * dock family (agent task strips: TodoPanel / GoalBar / QueueDock) and its\n * takeover panels (approval, question, plan review), the subagent lineage\n * popover, the home hero \"preview\" badge, the sidebar build badge, and the\n * timeline rail (timeline-css.ts). Every glassed surface shares ONE recipe:\n * fill from the painter's --dsw-specific-input-major token (same alpha\n * curve + theme dimming), the full shared blur/saturate/brightness chain\n * driven by the glass-blur slider, and the shared sheen vars — so no\n * surface reads heavier than the composer card. Dialogs, the settings UI,\n * menus, tooltips, toasts and every hover/accent fill keep the OFFICIAL\n * opaque paints — they are reading surfaces and must stay legible.\n *\n * Selectors target authored attributes (`data-dsh-bg`, `data-composer-card`,\n * `data-terminal`…), the `:global` `.md-code-block` anchor, and CSS-module\n * SUFFIX conventions (`_bubble`, `_newSession`…) audited for collisions:\n * `_bubble` excludes `role=\"tooltip\"` (Tooltip.module.css shares the suffix),\n * `_add` is scoped under `[data-composer-card]` (DiffBlock line markers share\n * it), `_newSession` excludes `Label` (the button's inner label span) and\n * `_toBottom` excludes `Slot` (the zero-height sticky wrapper) — both share\n * the substring with the chrome control but must keep their own paint, and\n * the subagent popover is `role=\"tree\"` + `_menu` so the generic menu\n * surface stays untouched.\n */\nexport const BACKGROUND_CSS = `\n .dsh-bg-layer {\n position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none;\n }\n .dsh-bg-layer .dsh-bg-image {\n width: 100%; height: 100%; display: block; border: 0; background: transparent;\n object-fit: var(--bg-object-fit, cover);\n opacity: var(--bg-opacity, 1);\n filter: blur(var(--bg-wallpaper-blur, 0px));\n /* Blur thins the edges; scale the image up to hide the fringe. */\n transform: scale(var(--bg-wallpaper-scale, 1));\n transform-origin: center;\n }\n /* Scrim is theme-aware: a WHITE veil in the light scheme (it lifts the art\n toward the near-white surface so dark text keeps contrast) and a BLACK veil\n in the dark scheme (it dims the art so light text keeps contrast). */\n .dsh-bg-scrim {\n position: fixed; inset: 0; z-index: -1; pointer-events: none;\n background: rgba(255, 255, 255, var(--bg-scrim, 0.25));\n }\n body[data-ds-dark-theme] .dsh-bg-scrim {\n background: rgba(0, 0, 0, var(--bg-scrim, 0.25));\n }\n\n /* Active: make the app frame + sidebar background transparent so all columns\n share the same wallpaper + scrim backdrop. */\n body[data-dsh-bg] {\n --dsw-alias-bg-base: transparent;\n --dsw-specific-sidebar-fill: transparent;\n }\n\n /* ---- Whitelisted frosted-glass sheet ---------------------------------\n Fills come from the --dsw-* tokens the painter overrides on body ONLY for\n this list's own surfaces (input/bubble/code/tip); this block adds the\n shared wet-glass sheen + blur from --bg-glass-blur. Exposure is calibrated\n per scheme (the painter writes --bg-glass-brightness / --bg-glass-sheen):\n light glass slightly DIMS, dark glass keeps a slight lift. Gated on the\n GLASS ATTR (wallpaper active AND panelOpacity < 1): maxing the panel\n slider returns these surfaces to the exact official paints. */\n body[data-dsh-bg-glass] [data-composer-card],\n body[data-dsh-bg-glass] [class*=\"_bubble\"]:not([role=\"tooltip\"]),\n body[data-dsh-bg-glass] .md-code-block,\n body[data-dsh-bg-glass] [data-terminal],\n body[data-dsh-bg-glass] [data-diff],\n body[data-dsh-bg-glass] [data-read],\n body[data-dsh-bg-glass] [data-search],\n body[data-dsh-bg-glass] [data-web],\n body[data-dsh-bg-glass] [class*=\"_ioCard\"],\n body[data-dsh-bg-glass] [class*=\"_instructionsCard\"],\n body[data-dsh-bg-glass] [class*=\"_markdown\"] :not(pre) > code {\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 -1px 0 rgba(255, 255, 255, 0.08),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.08),\n 0 12px 40px rgba(0, 0, 0, 0.12);\n }\n\n /* The sticky code-block header officially occludes scrolled code with\n bg-base (transparent under a wallpaper): refill it with the banner token\n (itself translucent glass) so code stays hidden beneath the sticky bar. */\n body[data-dsh-bg] .md-code-block [class*=\"_bannerWrap\"] {\n background-color: var(--dsw-alias-markdown-code-block-banner);\n }\n\n /* The sidebar build badge paints with the label-ink token — a TEXT token we\n must not override globally — so it gets a theme-aware translucent ink. */\n body[data-dsh-bg] [class*=\"_buildRevision\"] {\n background-color: rgba(15, 17, 21, 0.62);\n }\n body[data-ds-dark-theme][data-dsh-bg] [class*=\"_buildRevision\"] {\n background-color: rgba(249, 250, 251, 0.62);\n }\n\n /* The empty-state hero glow asset would wash out the wallpaper behind the\n welcome message — dim it so the art stays visible. */\n body[data-dsh-bg] [class*=\"_heroGlow\"] {\n opacity: 0.2;\n }\n\n /* ---- Whitelisted chrome buttons --------------------------------------\n These three buttons' official fills ride button-* tokens shared with\n unrelated surfaces, so instead of overriding the tokens they get explicit\n paints — but the SAME glass recipe as the composer card and bubbles:\n fill = the painter's --dsw-specific-input-major token (the identical\n translucent white + theme curve), filter = the sheet's exact\n blur/saturate/brightness chain (blur follows the glass-blur slider, no\n caps), sheen = the shared sheen vars. Hover = the same white glass at the\n boosted alpha var. Gated on data-dsh-bg-glass (off when the panel is\n fully opaque). */\n body[data-dsh-bg-glass] [class*=\"_newSession\"]:not([class*=\"Label\"]),\n body[data-dsh-bg-glass] [data-composer-card] [class*=\"_add\"],\n body[data-dsh-bg-glass] [class*=\"_toBottom\"]:not([class*=\"Slot\"]) {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),\n 0 4px 14px rgba(0, 0, 0, 0.08);\n }\n body[data-dsh-bg-glass] [class*=\"_newSession\"]:not([class*=\"Label\"]):hover,\n body[data-dsh-bg-glass] [data-composer-card] [class*=\"_add\"]:hover:not(:disabled),\n body[data-dsh-bg-glass] [class*=\"_toBottom\"]:not([class*=\"Slot\"]):hover {\n background-color: color-mix(in srgb, rgb(255 255 255) calc(var(--bg-glass-alpha-strong, 0.8) * 100%), transparent);\n }\n /* Collapsed rail renders the new-session control as a bare icon — keep the\n official transparent paint (and its official translucent hover). */\n body[data-dsh-bg-glass] [class*=\"_collapsed\"] [class*=\"_newSession\"],\n body[data-dsh-bg-glass] [class*=\"_collapsed\"] [class*=\"_newSession\"]:hover {\n background-color: transparent;\n background-image: none;\n box-shadow: none;\n }\n\n /* ---- Subagent lineage popover (title-bar expanded list) --------------\n Its official fill rides the menu token shared with every dropdown; glass\n THIS popover explicitly via its role=\"tree\" + _menu combination so real\n menus stay officially opaque and legible. Same unified recipe: the\n composer fill token + the full shared filter chain (the official\n elevation shadow stays). */\n body[data-dsh-bg-glass] [role=\"tree\"][class*=\"_menu\"] {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n\n /* ---- Home hero \"preview\" badge (top-right superscript pill) ----------\n Officially the state-business-tertiary pastel; re-emit the same hue as\n glass but with the UNIFIED alpha curve (color-mix against the painter's\n --bg-glass-alpha) and the shared blur chain, so it sits on the wallpaper\n with exactly the glass strength of the composer card. */\n body[data-dsh-bg-glass] [class*=\"_previewBadge\"] {\n background-color: color-mix(in srgb, rgb(228 237 253) calc(var(--bg-glass-alpha, 0.72) * 100%), transparent);\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n body[data-ds-dark-theme][data-dsh-bg-glass] [class*=\"_previewBadge\"] {\n background-color: color-mix(in srgb, rgb(52 65 91) calc(var(--bg-glass-alpha, 0.72) * 100%), transparent);\n }\n\n /* ---- Composer dock family: task strips + takeover panels --------------\n The agent task strips (TodoPanel, GoalBar, QueueDock — one dock column\n above the composer) and the composer takeovers (approval, question,\n plan review) paint with tokens the painter turns translucent\n (--dsw-specific-tip / --dsw-specific-input-major) but their own styles\n never blur anything: translucent-without-blur reads as bare\n transparency, not frosted glass. Give each the shared sheen + filter\n chain; their fills stay token-driven so the panel-opacity slider keeps\n driving them. Anchors are the components' own stable data attributes\n plus a structural child, so no generic class suffix is swept in. */\n body[data-dsh-bg-glass] [data-testid=\"todo-panel\"],\n body[data-dsh-bg-glass] [data-goal-bar] > div,\n body[data-dsh-bg-glass] [data-queue-dock] > div,\n body[data-dsh-bg-glass] [data-approval-key] > div,\n body[data-dsh-bg-glass] [data-question-key] > section,\n body[data-dsh-bg-glass] [data-plan-review-key] > section {\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n\n /* ---- \"Load earlier\" history button (top of long conversations) --------\n Its official fill is an opaque solid button token that is deliberately\n NOT overridden, so unlike the tip family it needs an explicit glass\n fill too — same recipe as the three chrome buttons above. */\n body[data-dsh-bg-glass] [class*=\"_older\"] button {\n background-color: var(--dsw-specific-input-major);\n background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, 0.32),\n inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),\n 0 4px 14px rgba(0, 0, 0, 0.08);\n }\n body[data-dsh-bg-glass] [class*=\"_older\"] button:hover:not(:disabled) {\n background-color: color-mix(in srgb, rgb(255 255 255) calc(var(--bg-glass-alpha-strong, 0.8) * 100%), transparent);\n }\n\n /* Sidebar build badge: translucent ink already, but it sat directly on\n the wallpaper without frost. Join the shared blur chain under the same\n gate (its theme-aware ink fills from the active block above). */\n body[data-dsh-bg-glass] [class*=\"_buildRevision\"] {\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n`\n\n/**\n * Inject the backdrop stylesheet once. Safe to call repeatedly; a second call\n * is a no-op (dedup key on the style tag).\n */\nexport function injectBackgroundCss(): void {\n if (document.querySelector(`style[data-plugin-css=\"${BACKGROUND_CSS_TAG}\"]`)) return\n const tag = document.createElement('style')\n tag.dataset.plugin = 'deepseek-harness-background'\n tag.dataset.pluginCss = BACKGROUND_CSS_TAG\n tag.textContent = BACKGROUND_CSS\n document.head.appendChild(tag)\n}\n","/** Durable background settings — pure constants/types shared by both halves. */\r\n\r\n/** Settings namespace owned by the background plugin. */\r\nexport const BACKGROUND_SETTINGS_NAMESPACE = 'ui-background'\r\n\r\n/**\r\n * The schema's field names, in schema order. Used as a whitelist when a\r\n * section write commits: the settings layer keeps unknown keys in the user\r\n * document (a legacy schema field would linger forever under a merge-only\r\n * write), so the write path strips everything outside this list.\r\n */\r\nexport const BACKGROUND_SETTINGS_FIELDS = [\r\n 'enabled', 'uploadId', 'url', 'opacity', 'scrim',\r\n 'panelOpacity', 'blur', 'wallpaperBlur', 'fit', 'timeline',\r\n] as const\r\n\r\n/** Browser-facing base path of the background API (shared with the host routes). */\r\nexport const BACKGROUND_API_PREFIX = '/api/bg-wallpaper'\r\n\r\n/** Minimum scrim opacity (0 = no veil at all). */\r\nexport const SCRIM_MIN = 0\r\n\r\n/** Maximum scrim opacity (1 = fully opaque veil — hides the wallpaper entirely).\r\n * Kept at 1 so every percent-unit slider shares one 0..1 domain: the same\r\n * displayed percentage puts every thumb at the same fraction of its track. */\r\nexport const SCRIM_MAX = 1\r\n\r\n/** Default scrim strength applied over user art (a light readability veil). */\r\nexport const DEFAULT_SCRIM = 0.25\r\n\r\n/** Default background image opacity (1 = fully opaque). */\r\nexport const DEFAULT_OPACITY = 1\r\n\r\n/** Minimum background image opacity (0 = fully invisible). */\r\nexport const OPACITY_MIN = 0\r\n\r\n/** Maximum background image opacity (1 = fully opaque). */\r\nexport const OPACITY_MAX = 1\r\n\r\n/** Default panel opacity (0..1); 1 = fully opaque official surfaces, 0 = fully transparent glass. */\r\nexport const DEFAULT_PANEL_OPACITY = 0.15\r\n\r\n/** Minimum panel opacity. */\r\nexport const PANEL_OPACITY_MIN = 0\r\n\r\n/** Maximum panel opacity (opaque — effectively disables the glass). */\r\nexport const PANEL_OPACITY_MAX = 1\r\n\r\n/** Default frosted-glass blur radius in px (0 disables backdrop-filter). */\r\nexport const DEFAULT_BLUR = 16\r\n\r\n/** Minimum glass blur radius. */\r\nexport const BLUR_MIN = 0\r\n\r\n/** Maximum glass blur radius. */\r\nexport const BLUR_MAX = 40\r\n\r\n/** Default wallpaper blur radius in px (blurs the image itself). */\r\nexport const DEFAULT_WALLPAPER_BLUR = 0\r\n\r\n/** Maximum wallpaper blur radius. */\r\nexport const WALLPAPER_BLUR_MAX = 60\r\n\r\n/** Whether the DeepSeek-style conversation timeline rail renders (default on). */\r\nexport const DEFAULT_TIMELINE = true\r\n\r\n/**\r\n * Session-projection key this plugin owns in the client-visible value map —\r\n * the host fold registers it (src/projection.ts) and the rail reads it\r\n * (src/client/timeline.tsx); one shared constant so the two can never drift.\r\n */\r\nexport const TIMELINE_PROJECTION_KEY = 'bgTimeline'\r\n\r\n/** Default background rendering mode. */\r\nexport const DEFAULT_FIT = 'cover'\r\n\r\n/** Image positioning modes. `cover` fills the frame (cropping as needed); `contain` fits the whole image inside the frame (letterboxing). */\r\nexport const FIT_MODES = ['cover', 'contain'] as const\r\n\r\n/** Background rendering mode. */\r\nexport type BackgroundFit = typeof FIT_MODES[number]\r\n\r\n/**\r\n * User-owned background section, resolved from schema defaults + user layer.\r\n * The active source is either a local upload id (host serves it via\r\n * `/api/bg-wallpaper/image/<id>`) or a raw HTTP(S) image URL the browser\r\n * loads; exactly one of `uploadId` / `url` is set — when both are empty no\r\n * background renders.\r\n */\r\nexport interface BackgroundSettings {\r\n /** Whether the custom background renders at all. */\r\n enabled: boolean\r\n /** Local upload id when the active source is an uploaded file. */\r\n uploadId: string\r\n /** Image URL when the active source is a remote URL. */\r\n url: string\r\n /** Background image opacity (0..1); the image fades toward the surface color. */\r\n opacity: number\r\n /** Readability scrim strength (0..1) layered between the art and the UI. */\r\n scrim: number\r\n /** Panel transparency (0..1): 0 = fully transparent surfaces, 1 = unaffected. */\r\n panelOpacity: number\r\n /** Frosted-glass blur radius on opaque surfaces (px; 0 disables). */\r\n blur: number\r\n /** Blur of the wallpaper image itself (px; 0 disables). */\r\n wallpaperBlur: number\r\n /** How the image fits the frame. */\r\n fit: BackgroundFit\r\n /** Whether the conversation timeline rail renders at the right edge. */\r\n timeline: boolean\r\n}\r\n","/**\n * Background painter — renders the user background behind the whole app frame:\n * a fixed `z-index:-2` wallpaper element plus a `z-index:-1` scrim on\n * `document.body`, driven by the `data-dsh-bg` body attribute and a set of\n * CSS variables. It also applies the frosted-glass surface tokens so the\n * wallpaper shows through translucent input / bubble panels.\n *\n * Retraction discipline mirrors the reference skin plugins: every property /\n * DOM node this painter owns is restored to its prior state on dispose, and\n * the `data-ds-dark-theme` observer is disconnected.\n */\n\nimport { ACTIVE_ATTR, GLASS_ATTR, injectBackgroundCss } from './background-css.ts'\nimport { BACKGROUND_API_PREFIX, type BackgroundSettings } from '../settings.ts'\n\n/** Class names the layer and scrim elements carry. */\nconst LAYER_CLASS = 'dsh-bg-layer'\nconst IMAGE_CLASS = 'dsh-bg-image'\nconst SCRIM_CLASS = 'dsh-bg-scrim'\n\n/** Body style properties the painter owns while a wallpaper paints: the app\n * frame and sidebar fills go transparent so every column shares one art.\n * Inline values outrank any stylesheet rule (the body[data-dsh-bg] gate only\n * covers the CSS copy), so a sourceless section must actively restore them. */\nconst FRAME_TOKENS = ['--dsw-alias-bg-base', '--dsw-specific-sidebar-fill'] as const\n\n/**\n * White-glass tokens — the WHITELISTED surfaces only. Everything that floats\n * as a small card over the wallpaper: the composer input stack, message\n * bubbles, the markdown code surfaces (blocks + banner + inline code), and\n * the agent task strip family (`--dsw-specific-tip`: TodoPanel + GoalBar +\n * QueueDock share one dock column and one fill token). Menus, dialogs, the\n * settings UI, tooltips, toasts, hover fills and every accent keep the\n * OFFICIAL token values — they are reading surfaces and must stay legible.\n * `factor` scales the alpha relative to the input surface.\n */\nconst GLASS_SURFACE_TOKENS: readonly { token: string; factor: number }[] = [\n { token: '--dsw-specific-input-major', factor: 1 },\n { token: '--dsw-specific-bubble', factor: 0.8 },\n { token: '--dsw-alias-markdown-code-block', factor: 1 },\n { token: '--dsw-alias-markdown-code-block-banner', factor: 1 },\n { token: '--dsw-alias-markdown-inline-code', factor: 0.9 },\n { token: '--dsw-specific-tip', factor: 1 },\n]\n\n/** Every token the glass owns (save/restore key set). */\nconst GLASS_TOKENS: readonly string[] = GLASS_SURFACE_TOKENS.map(({ token }) => token)\n\n/** Fraction of the official white surface alpha kept at the most transparent panel setting. */\nconst GLASS_MIN_ALPHA = 0.05\n\n/** Base white-glass alpha for one panelOpacity (the curve every surface shares). */\nfunction glassAlpha(panelOpacity: number): number {\n const alpha = GLASS_MIN_ALPHA + panelOpacity * (0.9 - GLASS_MIN_ALPHA)\n return Math.max(0, Math.min(0.9, alpha))\n}\n\n/**\n * Saturation boost that rides the blur radius. Gentler than the reference\n * engine (1.1 + blur * 0.02, capped at 1.6): stacking a hot saturate on top of\n * the brightness/sheen layers pushed bright wallpapers into clipping.\n */\nfunction glassSaturate(blur: number): number {\n if (blur <= 0) return 1\n // Round off float dust (1.1 + 16 * 0.02 is 1.4200000000000002 raw).\n return Math.round(Math.min(1.6, 1.1 + blur * 0.02) * 1000) / 1000\n}\n\n/**\n * Exposure calibration per scheme. Light glass neither boosts brightness nor\n * stacks a heavy sheen (mainstream frosted recipes — macOS vibrancy, Windows\n * acrylic, common web glass — blur + saturate + tint without a positive\n * brightness gain); dark glass keeps the reference engine's slight lift, which\n * stops the white-glass fills from turning muddy.\n */\nfunction glassExposure(inDark: boolean): { brightness: string; sheen: string; sheenMid: string } {\n return inDark\n ? { brightness: '1.04', sheen: '0.16', sheenMid: '0.05' }\n : { brightness: '0.98', sheen: '0.07', sheenMid: '0.02' }\n}\n\n/**\n * The theme-aware base alpha for one panelOpacity — THE curve every glass\n * surface shares (surface tokens, bare alpha knobs and the settings preview\n * included). Single-sourced here so the live painter and the preview card\n * cannot drift.\n */\nfunction glassBaseAlpha(panelOpacity: number, inDark: boolean): number {\n return glassAlpha(panelOpacity) * (inDark ? 0.4 : 0.8)\n}\n\n/**\n * The theme-aware glass surface alphas for one panelOpacity: the input-surface\n * token and the bubble token share one curve, dimmed per scheme. Shared by the\n * live painter and the settings-row preview card so the two cannot drift.\n */\nfunction glassSurfaceAlphas(panelOpacity: number, inDark: boolean): { major: string; bubble: string } {\n const alpha = glassBaseAlpha(panelOpacity, inDark)\n return {\n major: `rgba(255, 255, 255, ${alpha.toFixed(3)})`,\n bubble: `rgba(255, 255, 255, ${(alpha * 0.8).toFixed(3)})`,\n }\n}\n\n/**\n * Resolve the effective background image url for a section.\n * @param settings - resolved background section.\n * @returns the image url, or '' when no source is set.\n */\nexport function backgroundImageUrl(settings: BackgroundSettings, uploadBase: string): string {\n if (settings.uploadId) return `${uploadBase}/image/${settings.uploadId}`\n return settings.url\n}\n\n/**\n * Manage the behind-body wallpaper + scrim layers and the glass surface.\n */\nexport class BackgroundPainter {\n private layer: HTMLDivElement | null = null\n private img: HTMLImageElement | null = null\n private scrim: HTMLDivElement | null = null\n private observer: MutationObserver | undefined\n private active = false\n private settings: BackgroundSettings | undefined\n private readonly savedTokens = new Map<string, string>()\n private readonly savedVars = new Map<string, string>()\n\n /** Remember + hijack a property only once so dispose restores the original. */\n private rememberOnce(prop: string): void {\n if (this.savedTokens.has(prop) || this.savedVars.has(prop)) return\n const value = document.body.style.getPropertyValue(prop)\n if (GLASS_TOKENS.includes(prop)) {\n this.savedTokens.set(prop, value)\n } else {\n this.savedVars.set(prop, value)\n }\n }\n\n /**\n * Apply the latest settings. Idempotent.\n * @param settings - resolved background section.\n * @param uploadBase - the API base for resolving uploads.\n */\n apply(settings: BackgroundSettings, uploadBase: string): void {\n this.settings = settings\n if (!settings.enabled) {\n this.dispose()\n return\n }\n injectBackgroundCss()\n\n const url = backgroundImageUrl(settings, uploadBase)\n if (url === '') {\n // No source: the frame transparency is owned only while a wallpaper\n // paints — hand the base/sidebar fills back (a sourceless \"enabled\"\n // section must never leave transparent chrome over the bare page), and\n // drop the theme observer + glass tokens whose flip handler would\n // otherwise re-write translucent panels over that bare page too.\n this.observer?.disconnect()\n this.observer = undefined\n this.restoreFrameTokens()\n this.applySurfaceGlass(settings, true)\n this.active = false\n this.removeLayers()\n document.body.removeAttribute(ACTIVE_ATTR)\n return\n }\n\n // Transparent frame: all columns share the wallpaper behind the UI.\n for (const prop of FRAME_TOKENS) {\n this.rememberOnce(prop)\n document.body.style.setProperty(prop, 'transparent')\n }\n\n // Wallpaper layer + scrim.\n if (!this.layer) {\n this.layer = document.createElement('div')\n this.layer.className = LAYER_CLASS\n this.img = document.createElement('img')\n this.img.className = IMAGE_CLASS\n this.img.alt = ''\n // Remote-url sources must not leak the local origin via Referer.\n this.img.referrerPolicy = 'no-referrer'\n this.layer.appendChild(this.img)\n document.body.appendChild(this.layer)\n }\n // Compare the *attribute* (the raw value we set) rather than the .src\n // property, which resolves to an absolute URL and would make this check\n // always-true for relative urls. Same-value writes are no-ops in the DOM,\n // so this is a clarity fix, not a behavior fix.\n if (this.img && this.img.getAttribute('src') !== url) this.img.src = url\n\n if (!this.scrim) {\n this.scrim = document.createElement('div')\n this.scrim.className = SCRIM_CLASS\n document.body.appendChild(this.scrim)\n }\n document.body.setAttribute(ACTIVE_ATTR, 'on')\n this.active = true\n\n // Push the knobs into CSS variables.\n const s = document.body.style\n this.setVar('--bg-object-fit', settings.fit)\n this.setVar('--bg-opacity', String(settings.opacity))\n this.setVar('--bg-wallpaper-blur', `${settings.wallpaperBlur}px`)\n this.setVar('--bg-wallpaper-scale', (1 + settings.wallpaperBlur * 0.006).toFixed(4))\n this.setVar('--bg-scrim', String(settings.scrim))\n this.setVar('--bg-glass-blur', `${settings.blur}px`)\n this.setVar('--bg-glass-saturate', String(glassSaturate(settings.blur)))\n\n // Glass surface: theme-aware translucent token (panelOpacity === 1 keeps\n // the official opaque surfaces and disables the blur).\n this.applySurfaceGlass(settings, false)\n\n // Theme observer: repaint the glass tokens when the light/dark scheme\n // flips (the surface translucency differs between schemes). Disconnects\n // on dispose.\n if (!this.observer) {\n this.observer = new MutationObserver(() => this.applySurfaceGlass(this.settings, false))\n this.observer.observe(document.body, { attributes: true, attributeFilter: ['data-ds-dark-theme'] })\n }\n }\n\n /** Write one owned CSS variable onto body. */\n private setVar(name: string, value: string): void {\n this.rememberOnce(name)\n document.body.style.setProperty(name, value)\n }\n\n /**\n * Return the owned frame-transparency properties to their saved state (or\n * remove them when this session never overrode them). dispose() restores\n * everything wholesale; this targeted variant serves the sourceless path,\n * where the painter keeps running for a later source.\n */\n private restoreFrameTokens(): void {\n for (const prop of FRAME_TOKENS) {\n this.rememberOnce(prop)\n const original = this.savedVars.get(prop)\n if (original !== undefined && original !== '') document.body.style.setProperty(prop, original)\n else document.body.style.removeProperty(prop)\n }\n }\n\n /**\n * Update one effect knob without re-running the full apply. This is the hot\n * path for slider drags (many events per second): only the single CSS\n * variable changes, the DOM layers are untouched.\n * @param key - the knob to update.\n * @param value - its new value in its canonical unit.\n */\n setKnob(key: 'opacity' | 'scrim' | 'blur' | 'wallpaperBlur' | 'fit', value: number | BackgroundSettings['fit']): void {\n if (this.settings === undefined || !this.settings.enabled) return\n switch (key) {\n case 'opacity':\n this.setVar('--bg-opacity', String(value))\n break\n case 'scrim':\n this.setVar('--bg-scrim', String(value))\n break\n case 'blur': {\n this.setVar('--bg-glass-blur', `${value}px`)\n this.setVar('--bg-glass-saturate', String(glassSaturate(Number(value))))\n break\n }\n case 'wallpaperBlur': {\n this.setVar('--bg-wallpaper-blur', `${value}px`)\n this.setVar('--bg-wallpaper-scale', (1 + Number(value) * 0.006).toFixed(4))\n break\n }\n case 'fit':\n this.setVar('--bg-object-fit', String(value))\n break\n }\n }\n\n /**\n * Apply the translucent-glass surface tokens (or restore the official ones\n * when the panel is fully opaque / there is no background).\n * @param settings - resolved section (for panelOpacity).\n * @param forceRestore - true to restore official surfaces regardless (used\n * when no source is set, so leftover glass tokens never linger).\n */\n private applySurfaceGlass(settings: BackgroundSettings | undefined, forceRestore: boolean): void {\n const s = document.body.style\n const inDark = document.body.dataset.dsDarkTheme !== undefined\n // Always remember the original surface values so a restore / dispose\n // returns them cleanly.\n for (const token of GLASS_TOKENS) this.rememberOnce(token)\n\n const restore = () => {\n for (const token of GLASS_TOKENS) {\n const original = this.savedTokens.get(token)\n if (original !== undefined && original !== '') s.setProperty(token, original)\n else s.removeProperty(token)\n }\n }\n\n if (forceRestore || settings === undefined || settings.panelOpacity >= 1) {\n restore()\n document.body.removeAttribute(GLASS_ATTR)\n // No blur and a neutral exposure when glass is off; the bare alpha\n // knobs only matter under the glass gate.\n this.setVar('--bg-glass-blur', '0px')\n this.setVar('--bg-glass-brightness', '1')\n s.removeProperty('--bg-glass-alpha')\n s.removeProperty('--bg-glass-alpha-strong')\n return\n }\n\n document.body.setAttribute(GLASS_ATTR, 'on')\n\n // Exposure calibration (theme-aware, mirrored by the preview surface).\n const exposure = glassExposure(inDark)\n this.setVar('--bg-glass-brightness', exposure.brightness)\n this.setVar('--bg-glass-sheen', exposure.sheen)\n this.setVar('--bg-glass-sheen-mid', exposure.sheenMid)\n\n // Dark scheme uses a lower white alpha (the wallpaper stays visible\n // without washing the surface), mirroring the reference engine.\n const base = glassBaseAlpha(settings.panelOpacity, inDark)\n for (const { token, factor } of GLASS_SURFACE_TOKENS) {\n s.setProperty(token, `rgba(255, 255, 255, ${(base * factor).toFixed(3)})`)\n }\n // Bare alpha knobs for the surfaces that keep their own hue (preview\n // badge, via color-mix) or need a hover boost (chrome buttons): the same\n // curve every glass surface shares.\n this.setVar('--bg-glass-alpha', base.toFixed(3))\n this.setVar('--bg-glass-alpha-strong', Math.min(0.9, base * 1.5).toFixed(3))\n }\n\n /** Remove the wallpaper + scrim layers and clear the active attribute. */\n private removeLayers(): void {\n if (this.layer) { this.layer.remove(); this.layer = null; this.img = null }\n if (this.scrim) { this.scrim.remove(); this.scrim = null }\n }\n\n /** Restore every owned property and remove the layers. */\n dispose(): void {\n this.observer?.disconnect()\n this.observer = undefined\n this.removeLayers()\n const s = document.body.style\n document.body.removeAttribute(ACTIVE_ATTR)\n document.body.removeAttribute(GLASS_ATTR)\n for (const [prop, value] of this.savedTokens) s.setProperty(prop, value)\n for (const [prop, value] of this.savedVars) s.setProperty(prop, value)\n this.savedTokens.clear()\n this.savedVars.clear()\n this.active = false\n this.settings = undefined\n }\n\n /** @returns whether a wallpaper is currently rendered. */\n isActive(): boolean {\n return this.active\n }\n}\n\n/** Module-level painter singleton shared by the settings row preview and the live apply. */\nexport const backgroundPainter = new BackgroundPainter()\n\n/**\n * Apply the given settings through the shared painter (idempotent). Convenience\n * used by the settings row for live previews and by the plugin apply to render\n * the persisted section.\n * @param settings - settings to apply (may be an unsaved draft for preview).\n */\nexport function paintBackground(settings: BackgroundSettings): void {\n backgroundPainter.apply(settings, BACKGROUND_API_PREFIX)\n}\n\n/** Numeric effect knobs the slider drag path repaints. */\nexport type BackgroundKnob = 'opacity' | 'scrim' | 'blur' | 'wallpaperBlur' | 'fit'\n\n/**\n * Update one effect knob on the live backdrop without re-running the full\n * apply — the hot path for slider drags (see BackgroundPainter.setKnob).\n * @param key - the knob to update.\n * @param value - its new value.\n */\nexport function paintBackgroundKnob(key: BackgroundKnob, value: number | BackgroundSettings['fit']): void {\n backgroundPainter.setKnob(key, value)\n}\n\n/** Preview variables the settings-surface preview card consumes. */\nconst PREVIEW_VARS = [\n '--bg-opacity', '--bg-scrim', '--bg-object-fit',\n '--bg-wallpaper-blur', '--bg-wallpaper-scale',\n '--bg-glass-blur', '--bg-glass-saturate', '--bg-glass-brightness',\n '--bg-preview-glass',\n] as const\n\n/**\n * Push the effect knobs onto one element (the settings-surface preview card)\n * so dragging a slider updates the card without touching the live backdrop.\n * The card's CSS reads the same variable names as the painter writes on body.\n * @param el - the preview element.\n * @param settings - the draft settings to render (may be unsaved).\n */\nexport function paintPreviewSurface(el: HTMLElement, settings: BackgroundSettings): void {\n const s = el.style\n s.setProperty('--bg-object-fit', settings.fit)\n s.setProperty('--bg-opacity', String(settings.opacity))\n s.setProperty('--bg-scrim', String(settings.scrim))\n s.setProperty('--bg-wallpaper-blur', `${settings.wallpaperBlur}px`)\n s.setProperty('--bg-wallpaper-scale', (1 + settings.wallpaperBlur * 0.006).toFixed(4))\n // The glass bubble mirrors the live panel surface: below panelOpacity 1 its\n // alpha follows the same theme-aware curve as --dsw-specific-bubble (so the\n // panel-opacity slider is visible in the preview); at 1 the official opaque\n // surface returns — the bubble turns opaque and the blur switches off, just\n // like applySurfaceGlass does on the real backdrop.\n const inDark = document.body.dataset.dsDarkTheme !== undefined\n if (settings.panelOpacity >= 1) {\n s.setProperty('--bg-glass-blur', '0px')\n s.setProperty('--bg-glass-brightness', '1')\n s.setProperty('--bg-preview-glass', 'var(--dsw-alias-bg-layer-1)')\n return\n }\n s.setProperty('--bg-glass-blur', `${settings.blur}px`)\n s.setProperty('--bg-glass-saturate', String(glassSaturate(settings.blur)))\n // The preview filter mirrors the live exposure calibration (slightly dimmed\n // in light, lifted in dark) so the card never reads brighter than the app.\n s.setProperty('--bg-glass-brightness', glassExposure(inDark).brightness)\n // The preview bubble mirrors the live --dsw-specific-bubble token.\n s.setProperty('--bg-preview-glass', glassSurfaceAlphas(settings.panelOpacity, inDark).bubble)\n}\n\n/** Remove every preview variable from an element (restores CSS defaults). */\nexport function clearPreviewSurface(el: HTMLElement): void {\n for (const name of PREVIEW_VARS) el.style.removeProperty(name)\n}\n","\n/**\n * Frosted-glass registry — the public integration surface other plugins use\n * to join this plugin's frosted-glass system.\n *\n * Third-party panels (diff viewers, file peeks, tool cards...) often fill\n * with an official --dsw-* token that the painter already turns translucent\n * under a wallpaper, but nothing adds the shared blur/sheen chain to THEM,\n * so they read as bare transparency instead of frosted glass (or stay fully\n * opaque when they carry their own literal fills). This registry lets their\n * authors register CSS selectors; every registered surface receives the\n * exact unified recipe the whitelisted official surfaces use:\n *\n * - mode 'token' (default) — adds ONLY the wet-glass sheen gradient and the\n * shared backdrop-filter chain. Pick it when the panel already paints with\n * a token the painter overrides (--dsw-specific-input-major,\n * --dsw-specific-bubble, --dsw-alias-markdown-code-block,\n * --dsw-alias-markdown-code-block-banner, --dsw-alias-markdown-inline-code,\n * --dsw-specific-tip): its fill then follows the panel-opacity slider\n * automatically. Same treatment as the composer dock family.\n * - mode 'fill' — also takes over the fill itself\n * (background-color: var(--dsh-specific-input-major)). Pick it when the\n * panel carries its own opaque/literal background today. Same explicit\n * recipe as the chrome buttons and the lineage popover.\n *\n * Rules are generated under the body[data-dsh-bg-glass] gate, so glass\n * toggling (wallpaper disabled, source cleared, or the user maxing the\n * panel-opacity slider) restores the registered surfaces' own paints with\n * ZERO extra coordination — the gate is the same one the built-in whitelist\n * keys on.\n *\n * Transport: because plugin client bundles load in no guaranteed order, the\n * api is published on window.__DSH_BACKGROUND_GLASS__ and announced with the\n * 'dsh-background-glass:ready' CustomEvent (detail = the api). Consumers\n * either poll the global or await the event; both are covered by the\n * copy-paste helper in docs/GLASS_API.md. The whole bridge is torn down when\n * this plugin's client fiber disposes.\n */\n\nimport { GLASS_ATTR } from './background-css.ts'\n\n/** Semantic version of this bridge contract (bumped on breaking changes). */\nexport const GLASS_BRIDGE_VERSION = 1 as const\n\n/** Property name on window where the api is published. */\nexport const GLASS_BRIDGE_GLOBAL = '__DSH_BACKGROUND_GLASS__'\n\n/** DOM event announced once the api becomes available (detail = the api). */\nexport const GLASS_READY_EVENT = 'dsh-background-glass:ready'\n\n/** Style-tag dedup key of the registry stylesheet (data-plugin-css). */\nconst REGISTRY_CSS_TAG = 'deepseek-harness-background/glass-registry'\n\n/** Plugin identity stamped onto the registry <style> element. */\nconst PLUGIN_ID = 'deepseek-harness-background'\n\n/**\n * Fill strategy for a registered surface.\n * - 'token': the surface paints with an overridden --dsw-* token; only the\n * sheen + blur chain is added (its fill follows the sliders).\n * - 'fill': the surface keeps its own opaque paint today; the registry takes\n * the fill over too (--dsw-specific-input-major, the composer's white).\n */\nexport type GlassSurfaceMode = 'token' | 'fill'\n\n/** Registration payload passed to BackgroundGlassApi.register. */\nexport interface GlassSurfaceSpec {\n /**\n * Caller identity, conventionally the consumer package name (e.g.\n * 'dsh-diff-stat'). Used for diagnostics only — registrations from\n * different plugins never conflict.\n */\n plugin: string\n /** One selector or a list. Each must match a stable anchor you render. */\n selectors: string | readonly string[]\n /** Fill strategy; defaults to 'token'. */\n mode?: GlassSurfaceMode\n}\n\n/** The object published at window.__DSH_BACKGROUND_GLASS__. */\nexport interface BackgroundGlassApi {\n /** Contract version (currently GLASS_BRIDGE_VERSION). */\n readonly version: typeof GLASS_BRIDGE_VERSION\n /** Publisher identity — lets consumers assert WHO owns the global. */\n readonly bridgeId: 'deepseek-harness-background'\n /**\n * Whether the frosted glass is ON right now (wallpaper active AND\n * panelOpacity < 1). Registrations made while this is false simply wait\n * under the gate until the glass turns on.\n */\n isActive(): boolean\n /**\n * Register surfaces to receive the unified frosted-glass recipe while the\n * glass is on. Idempotent per (plugin, mode, selector): re-registering the\n * same triple replaces the earlier entry. Returns an unregister function —\n * idempotent, safe to call twice, and the right cleanup inside a cordis\n * effect/fiber dispose.\n */\n register(spec: GlassSurfaceSpec): () => void\n}\n\n/** Characters whose presence would let a selector escape its rule context. */\nconst FORBIDDEN_SELECTOR_CHARS = ['{', '}', ';', '@', '<', '>'] as const\n\n/** Hard cap on one selector's length (diagnostics-friendly, abuse-proof). */\nconst MAX_SELECTOR_LENGTH = 500\n\n/** Hard cap on selectors per registration call. */\nconst MAX_SELECTORS_PER_SPEC = 64\n\n/**\n * Validate one raw selector string. Structural checks only: anything that\n * could escape the generated rule body ({}, ;, @, <, >) is rejected, and a\n * backslash is refused too (escape sequences have no business in an anchor\n * selector); ordinary CSS mistakes (a typo'd pseudo-class) are left to the\n * browser, which drops just that one rule — a safe failure mode.\n * @returns an error message, or null when the selector is acceptable.\n */\nfunction selectorProblem(selector: unknown): string | null {\n if (typeof selector !== 'string') return 'must be a string'\n const trimmed = selector.trim()\n if (trimmed === '') return 'must not be empty'\n if (trimmed.length > MAX_SELECTOR_LENGTH) {\n return 'exceeds the ' + MAX_SELECTOR_LENGTH + '-character limit (' + trimmed.length + ')'\n }\n for (const ch of FORBIDDEN_SELECTOR_CHARS) {\n if (trimmed.includes(ch)) {\n return 'contains a forbidden character (' + JSON.stringify(ch) + ')'\n }\n }\n if (trimmed.includes(String.fromCharCode(92))) {\n return 'contains a backslash (escape sequences are not accepted)'\n }\n return null\n}\n\n/** Normalize a spec into validated (plugin, mode, selector) triples.\n * @returns the accepted triples plus one warning line per rejected selector. */\nfunction normalizeSpec(spec: GlassSurfaceSpec): {\n rows: { plugin: string; mode: GlassSurfaceMode; selector: string }[]\n warnings: string[]\n} {\n const plugin = typeof spec?.plugin === 'string' && spec.plugin.trim() !== '' ? spec.plugin.trim() : '(anonymous)'\n const mode: GlassSurfaceMode = spec?.mode === 'fill' ? 'fill' : 'token'\n const raw: unknown[] = Array.isArray(spec?.selectors) ? [...spec.selectors] : [spec?.selectors]\n const rows: { plugin: string; mode: GlassSurfaceMode; selector: string }[] = []\n const warnings: string[] = []\n if (raw.length > MAX_SELECTORS_PER_SPEC) {\n warnings.push('[glass-registry] ' + plugin + ': ' + raw.length + ' selectors exceeds the '\n + MAX_SELECTORS_PER_SPEC + '-selector cap; extra entries dropped.')\n }\n for (const item of raw.slice(0, MAX_SELECTORS_PER_SPEC)) {\n // selectorProblem already covers non-strings; the typeof check below is\n // what narrows `item` to string on the accepted path.\n const problem = selectorProblem(item)\n if (typeof item !== 'string' || problem !== null) {\n warnings.push('[glass-registry] ' + plugin + ': rejected selector '\n + JSON.stringify(item) + ' — ' + (problem ?? 'must be a string') + '.')\n continue\n }\n rows.push({ plugin, mode, selector: item.trim() })\n }\n return { rows, warnings }\n}\n\n/** The shared sheen gradient declaration (identical to the built-in sheet). */\nconst SHEEN_DECL = 'background-image: linear-gradient(180deg, rgba(255, 255, 255, var(--bg-glass-sheen, 0.07)), rgba(255, 255, 255, var(--bg-glass-sheen-mid, 0.02)) 38%, rgba(255, 255, 255, 0.01));'\n\n/** The shared exposure chain (blur follows the glass-blur slider). */\nconst FILTER_DECL = '-webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01); backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);'\n\n/**\n * Render one registered surface as a gated CSS rule — the same recipes the\n * built-in sheets emit for their explicit-fill families.\n */\nfunction ruleFor(row: { mode: GlassSurfaceMode; selector: string }): string {\n const gate = 'body[' + GLASS_ATTR + ']'\n const fill = row.mode === 'fill'\n ? 'background-color: var(--dsw-specific-input-major); ' + SHEEN_DECL + ' ' + FILTER_DECL\n : SHEEN_DECL + ' ' + FILTER_DECL\n return gate + ' ' + row.selector + ' { ' + fill + ' }'\n}\n\n/**\n * Owns the registered surfaces and the registry stylesheet.\n */\nexport class GlassRegistry {\n private readonly entries = new Map<string, { row: { plugin: string; mode: GlassSurfaceMode; selector: string }; owner: object }>()\n private styleEl: HTMLStyleElement | null = null\n private disposed = false\n\n /**\n * Register one spec. See BackgroundGlassApi.register.\n * @param spec - the surfaces to glass.\n * @returns the unregister function (idempotent).\n */\n register(spec: GlassSurfaceSpec): () => void {\n // A disposed registry — or one superseded by a reinstall — must stay\n // INERT: accepting entries would orphan them outside the live fiber's\n // teardown (the stale api closure can outlive this plugin's disposal).\n if (this.disposed || (publishedRegistry !== undefined && publishedRegistry !== this)) {\n console.warn('[glass-registry] registration ignored: this bridge is no longer the live publication')\n return () => {}\n }\n let normalized: { rows: { plugin: string; mode: GlassSurfaceMode; selector: string }[]; warnings: string[] }\n try {\n normalized = normalizeSpec(spec)\n } catch (error) {\n // Hostile input (e.g. an array with a throwing getter) degrades to\n // warn-and-skip exactly like any other malformed spec — never throws.\n console.warn('[glass-registry] spec rejected: ' + (error instanceof Error ? error.message : String(error)))\n normalized = { rows: [], warnings: [] }\n }\n const { rows, warnings } = normalized\n for (const message of warnings) console.warn(message)\n const owner = {}\n const keys: string[] = []\n for (const row of rows) {\n // JSON encoding makes the three-part key unambiguous BY CONSTRUCTION:\n // control characters smuggled into any part cannot forge another triple.\n const key = JSON.stringify([row.plugin, row.mode, row.selector])\n this.entries.set(key, { row, owner })\n keys.push(key)\n }\n this.sync()\n let unregistered = false\n return () => {\n if (unregistered) return\n unregistered = true\n // The ownership check keeps a STALE handle from unregistering a newer\n // registration that replaced the same key (idempotent re-register).\n for (const key of keys) {\n const entry = this.entries.get(key)\n if (entry !== undefined && entry.owner === owner) this.entries.delete(key)\n }\n this.sync()\n }\n }\n\n /** Rebuild the registry stylesheet from the live entries. */\n private sync(): void {\n if (this.entries.size === 0) {\n this.styleEl?.remove()\n this.styleEl = null\n return\n }\n // Distinct rule texts only: two plugins may legitimately register the\n // same selector; cascade resolves duplicates anyway, but emitting one\n // identical rule keeps the sheet honest.\n const seen = new Set<string>()\n const rules: string[] = []\n for (const { row } of this.entries.values()) {\n const rule = ruleFor(row)\n if (!seen.has(rule)) {\n seen.add(rule)\n rules.push(rule)\n }\n }\n if (this.styleEl === null) {\n this.styleEl = document.createElement('style')\n this.styleEl.dataset.plugin = PLUGIN_ID\n this.styleEl.dataset.pluginCss = REGISTRY_CSS_TAG\n document.head.appendChild(this.styleEl)\n }\n this.styleEl.textContent = rules.join(String.fromCharCode(10))\n }\n\n /** Tear everything down: entries, stylesheet, and the window publication. */\n dispose(): void {\n this.disposed = true\n this.entries.clear()\n this.sync()\n const w = window as unknown as Record<string, unknown>\n if (w[GLASS_BRIDGE_GLOBAL] === this.api) delete w[GLASS_BRIDGE_GLOBAL]\n if (publishedRegistry === this) publishedRegistry = undefined\n }\n\n /** The published api face over this registry. */\n readonly api: BackgroundGlassApi = {\n version: GLASS_BRIDGE_VERSION,\n bridgeId: 'deepseek-harness-background',\n isActive: (): boolean =>\n typeof document !== 'undefined' && document.body !== null && document.body.hasAttribute(GLASS_ATTR),\n register: (spec: GlassSurfaceSpec): (() => void) => this.register(spec),\n }\n}\n\n/** The registry whose api is CURRENTLY published on window. Module-level on\n * purpose: the published api face deliberately carries no dispose member\n * (internal teardown stays unreachable for consumers), so reinstall-time\n * cleanup needs a handle the window key cannot provide. */\nlet publishedRegistry: GlassRegistry | undefined\n\n/**\n * Publish the glass registry bridge onto window and announce it. Safe to\n * call repeatedly: a previous publication's REGISTRY is disposed first, so\n * exactly one bridge — and one stylesheet — is ever live.\n * @returns the bridge handle — call .dispose() when this plugin's client\n * fiber tears down.\n */\nexport function installGlassBridge(): { api: BackgroundGlassApi; dispose(): void } {\n // A stale publication (hot reload of this very plugin) must not linger:\n // disposing its REGISTRY removes its stylesheet and clears its window\n // key. Dispose is idempotent, so a stale reference left behind by an\n // earlier fiber dispose is harmless to dispose again here.\n publishedRegistry?.dispose()\n // Belt-and-suspenders for the path where the module factory itself was\n // re-evaluated without a prior fiber dispose (closure state reset, so\n // publishedRegistry above is already undefined): any stylesheet carrying\n // our dedup key can only belong to a stale bridge — drop it.\n document.querySelector('style[data-plugin-css=\"' + REGISTRY_CSS_TAG + '\"]')?.remove()\n const registry = new GlassRegistry()\n publishedRegistry = registry\n ;(window as unknown as Record<string, unknown>)[GLASS_BRIDGE_GLOBAL] = registry.api\n // Announce right after publishing: consumers that already polled the\n // global see it immediately; listeners get the event synchronously now.\n window.dispatchEvent(new CustomEvent(GLASS_READY_EVENT, { detail: registry.api }))\n return { api: registry.api, dispose: () => registry.dispose() }\n}\n","/** Locale dictionaries for the background plugin. */\n\nimport type { BackgroundCardLocaleKey } from './types.ts'\n\n/** Dictionary of the namespace this plugin owns. */\nexport type BackgroundCardDict = Record<BackgroundCardLocaleKey, string>\n\n/** Chinese copy. */\nexport const zh: BackgroundCardDict = {\n 'background.title': '自定义背景',\n 'background.description': '为整个应用界面设置背景图片,可调不透明度、遮罩、面板透明与毛玻璃模糊',\n 'background.upload': '上传图片',\n 'background.uploading': '上传中…',\n 'background.uploadMediaTypes': '支持 JPG / PNG / WebP / GIF',\n 'background.urlPlaceholder': '或粘贴图片 http(s) 链接后回车',\n 'background.invalidUrl': '链接无效,请粘贴 http(s) 开头的图片链接',\n 'background.applyUrl': '应用链接',\n 'background.enabled': '背景已启用',\n 'background.source': '图片',\n 'background.effects': '效果',\n 'background.noPreview': '上传图片或粘贴链接后,此处实时预览效果',\n 'background.previewGlass': '毛玻璃',\n 'background.opacity': '不透明度',\n 'background.scrim': '遮罩',\n 'background.panelOpacity': '面板不透明度',\n 'background.blur': '毛玻璃模糊',\n 'background.wallpaperBlur': '壁纸模糊',\n 'background.fit': '填充方式',\n 'background.cover': '铺满',\n 'background.contain': '完整',\n 'background.clear': '清除背景',\n 'background.uploadFailed': '上传失败,请重试',\n 'background.saveFailed': '保存失败,请重试',\n 'background.timeline': '会话时间线',\n 'background.timelineHint': '右侧消息导航轨,悬停展开问题列表(DeepSeek 官网风格)',\n 'timeline.railLabel': '对话时间线',\n 'timeline.roleUser': '用户',\n 'timeline.noText': '(无文本内容)',\n 'timeline.marksOnly': '★ 只看标记',\n 'timeline.mark': '标记为重点',\n 'timeline.unmark': '取消重点标记',\n 'timeline.noMarks': '还没有标记的重点',\n}\n\n/** English copy. */\nexport const en: BackgroundCardDict = {\n 'background.title': 'Custom Background',\n 'background.description': 'Set a background image behind the whole app surface with adjustable opacity, scrim, panel transparency and glass blur',\n 'background.upload': 'Upload image',\n 'background.uploading': 'Uploading…',\n 'background.uploadMediaTypes': 'JPG / PNG / WebP / GIF',\n 'background.urlPlaceholder': 'Or paste an image http(s) link and press Enter',\n 'background.invalidUrl': 'Invalid link — paste an image link starting with http(s)',\n 'background.applyUrl': 'Apply URL',\n 'background.enabled': 'Background on',\n 'background.source': 'Image',\n 'background.effects': 'Effects',\n 'background.noPreview': 'Upload an image or paste a link to preview live here',\n 'background.previewGlass': 'Glass',\n 'background.opacity': 'Opacity',\n 'background.scrim': 'Scrim',\n 'background.panelOpacity': 'Panel opacity',\n 'background.blur': 'Glass blur',\n 'background.wallpaperBlur': 'Wallpaper blur',\n 'background.fit': 'Fit',\n 'background.cover': 'Cover',\n 'background.contain': 'Contain',\n 'background.clear': 'Clear background',\n 'background.uploadFailed': 'Upload failed, try again',\n 'background.saveFailed': 'Save failed, try again',\n 'background.timeline': 'Conversation timeline',\n 'background.timelineHint': 'Message rail at the right edge; hover to expand the question list (DeepSeek web style)',\n 'timeline.railLabel': 'Chat timeline',\n 'timeline.roleUser': 'User',\n 'timeline.noText': '(no text)',\n 'timeline.marksOnly': '★ Marked only',\n 'timeline.mark': 'Mark as key point',\n 'timeline.unmark': 'Unmark key point',\n 'timeline.noMarks': 'No marked key points',\n}\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Background settings transport — reads and writes the `ui-background`\n * section, and uploads local images, through the plugin's own same-origin\n * HTTP routes (see src/routes.ts). A custom route family keeps the section\n * usable even though the api-proxy settings allowlist does not expose\n * third-party namespaces over the settings RPC. One module-level client\n * serves the painter and the settings row.\n */\n\nimport type { BackgroundSettings } from '../settings.ts'\nimport { BACKGROUND_API_PREFIX } from '../settings.ts'\n\n/** One snapshot of the section as last seen by the transport. */\nexport interface SettingsSnapshot {\n status: 'loading' | 'ready' | 'error'\n value?: BackgroundSettings\n}\n\ntype Listener = () => void\n\n/** Outcome of one save attempt: committed, displaced by a newer save (the\n * caller must not adopt its own section back into the draft), or rejected. */\nexport type SaveResult = 'ok' | 'superseded' | 'failed'\n\n/**\n * Observable settings client (getSnapshot/subscribe — the uSES currency).\n * Methods are arrow properties so React's useSyncExternalStore can call them\n * without an owning `this`.\n */\nexport class SettingsClient {\n private snapshot: SettingsSnapshot = { status: 'loading' }\n private readonly listeners = new Set<Listener>()\n /** Monotonic request id; the latest save wins even when POSTs interleave. */\n private saveSeq = 0\n /** Pending save promise (used by the row's flush-on-unmount). */\n private pending: Promise<SaveResult> | undefined\n\n /** @returns the current sync snapshot (stable reference until the next change). */\n getSnapshot = (): SettingsSnapshot => this.snapshot\n\n /** Observe snapshot replacements. @returns the disposer removing this listener. */\n subscribe = (listener: Listener): (() => void) => {\n this.listeners.add(listener)\n return () => { this.listeners.delete(listener) }\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n\n /** Await any in-flight save (used before teardown so edits are not dropped). */\n async flush(): Promise<void> {\n await this.pending\n }\n\n /** Fetch the section from the host. */\n async load(): Promise<void> {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/settings`)\n if (!response.ok) throw new Error(`HTTP ${response.status}`)\n const body = await response.json() as { ok: boolean; value?: BackgroundSettings }\n if (!body.ok || body.value === undefined) throw new Error('unexpected payload')\n this.snapshot = { status: 'ready', value: body.value }\n } catch {\n this.snapshot = { status: 'error' }\n }\n this.notify()\n }\n\n /**\n * Persist the section through the host route. Concurrent calls are\n * serialized by a request sequence: an older save that resolves after a\n * newer one answers 'superseded' instead of 'ok', so the caller can never\n * mistake a stale write for success and adopt its outdated section.\n * @param section - the complete next section.\n * @returns whether the write committed, was displaced by a newer save, or failed.\n */\n async save(section: BackgroundSettings): Promise<SaveResult> {\n const seq = ++this.saveSeq\n const run = async (): Promise<SaveResult> => {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/settings`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(section),\n })\n const body = await response.json() as { ok: boolean; value?: BackgroundSettings }\n if (!response.ok || !body.ok || body.value === undefined) return 'failed'\n // Discard the response of a superseded save — it reflects an older\n // document that must not overwrite the latest one.\n if (seq !== this.saveSeq) return 'superseded'\n this.snapshot = { status: 'ready', value: body.value }\n this.notify()\n return 'ok'\n } catch {\n return 'failed'\n }\n }\n const promise = run()\n this.pending = promise\n // Release the handle once settled so flush() never awaits a stale save\n // from a long-finished gesture (a later flush then resolves instantly).\n void promise.then(() => {\n if (this.pending === promise) this.pending = undefined\n })\n return promise\n }\n\n /**\n * Upload a local image file; on success stores its id into the snapshot and\n * returns the resolved background url (or null on failure).\n * @param file - the chosen image file.\n * @returns the resolved image url, or null.\n */\n async upload(file: File): Promise<string | null> {\n try {\n const response = await fetch(`${BACKGROUND_API_PREFIX}/upload`, {\n method: 'POST',\n headers: { 'content-type': file.type },\n body: file,\n })\n const body = await response.json() as { ok: boolean; id?: string; url?: string }\n if (!response.ok || !body.ok || body.id === undefined || body.url === undefined) return null\n return body.url ?? null\n } catch {\n return null\n }\n }\n}\n\n/** Shared client for the painter and the settings row. */\nexport const settingsClient = new SettingsClient()\n","/**\n * Background settings row — the editable form rendered inside the General\n * settings section (`settings.general.item` slot), in the same visual area as\n * the official Appearance row. Layout mirrors the reference wallpaper engine\n * picker (preview surface + grouped sections), styled with the harness alias\n * tokens so it reads as part of the settings chrome.\n *\n * Interaction model (fixes the previous jank):\n * - Sliders STEP in 5% (or 2px/5px) increments, so dragging snaps between\n * discrete values instead of firing dozens of sub-percent updates.\n * - While dragging, only the CSS variables change: the slider holds its own\n * state (no parent re-render) and the preview card repaints in isolation.\n * React's onChange maps to the native `input` event and would fire on every\n * step, so a commit is deferred to release (pointerup / keyup / blur) and\n * debounced — one POST per gesture, never per tick.\n * - A `lastSavedRef` distinguishes our own saves from external changes, so\n * the snapshot sync can never clobber a draft the user is still editing.\n */\n\nimport { useCallback, useEffect, useRef, useState, type ChangeEvent } from 'react'\nimport { useSyncExternalStore } from 'react'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport clsx from 'clsx'\nimport {\n BACKGROUND_API_PREFIX, BLUR_MAX, BLUR_MIN, DEFAULT_BLUR, DEFAULT_FIT,\n DEFAULT_OPACITY, DEFAULT_PANEL_OPACITY, DEFAULT_SCRIM, DEFAULT_TIMELINE,\n DEFAULT_WALLPAPER_BLUR, FIT_MODES, OPACITY_MAX, OPACITY_MIN, PANEL_OPACITY_MAX,\n PANEL_OPACITY_MIN, SCRIM_MAX, SCRIM_MIN, WALLPAPER_BLUR_MAX, type BackgroundFit,\n type BackgroundSettings,\n} from '../settings.ts'\nimport { clearPreviewSurface, paintBackground, paintBackgroundKnob, paintPreviewSurface } from './backdrop.ts'\nimport { settingsClient, type SettingsSnapshot } from './settings-client.ts'\nimport css from './SettingsRow.module.css'\n\n/** Full component props: runtime share + locale seat. */\nexport type BackgroundRowProps =\n PropsRuntime<'settings.general.item'> & PropsLocale<'ui-background'>\n\n/** Defaults mirror the host schema (also the pre-load draft fallback). */\nconst DEFAULTS: BackgroundSettings = {\n enabled: false,\n uploadId: '',\n url: '',\n opacity: DEFAULT_OPACITY,\n scrim: DEFAULT_SCRIM,\n panelOpacity: DEFAULT_PANEL_OPACITY,\n blur: DEFAULT_BLUR,\n wallpaperBlur: DEFAULT_WALLPAPER_BLUR,\n fit: DEFAULT_FIT,\n timeline: DEFAULT_TIMELINE,\n}\n\n/** The numeric field keys a slider edits. */\ntype NumField = 'opacity' | 'scrim' | 'panelOpacity' | 'blur' | 'wallpaperBlur'\n\n/** Per-field slider geometry: 5% steps for ratios, fine px steps for radii so\n * the two blur sliders feel smooth near small values. Bounds come from the\n * shared settings constants so the schema boundary and the UI cannot drift. */\nconst SLIDER_SPEC: Record<NumField, { min: number; max: number; step: number; unit: 'percent' | 'px' }> = {\n opacity: { min: OPACITY_MIN, max: OPACITY_MAX, step: 0.05, unit: 'percent' },\n scrim: { min: SCRIM_MIN, max: SCRIM_MAX, step: 0.05, unit: 'percent' },\n panelOpacity: { min: PANEL_OPACITY_MIN, max: PANEL_OPACITY_MAX, step: 0.05, unit: 'percent' },\n blur: { min: BLUR_MIN, max: BLUR_MAX, step: 1, unit: 'px' },\n wallpaperBlur: { min: BLUR_MIN, max: WALLPAPER_BLUR_MAX, step: 2, unit: 'px' },\n}\n\n/** Derive the bare upload id from a resolve url like /api/bg-wallpaper/image/<id>. */\nfunction stripId(url: string): string {\n const prefix = `${BACKGROUND_API_PREFIX}/image/`\n return url.startsWith(prefix) ? url.slice(prefix.length) : ''\n}\n\n/** Read the settings store (uSES-friendly). */\nfunction readSnapshot(): SettingsSnapshot {\n return settingsClient.getSnapshot()\n}\n\n/** Field-wise equality for distinguishing our own saves from external changes. */\nfunction sameSettings(a: BackgroundSettings, b: BackgroundSettings): boolean {\n return a.enabled === b.enabled && a.uploadId === b.uploadId && a.url === b.url\n && a.opacity === b.opacity && a.scrim === b.scrim && a.panelOpacity === b.panelOpacity\n && a.blur === b.blur && a.wallpaperBlur === b.wallpaperBlur && a.fit === b.fit\n && a.timeline === b.timeline\n}\n\n/**\n * A stepped range control. While dragging it re-renders only itself: the value\n * is local state, `onLive(name, value)` repaints (CSS variables, no React\n * state), and `onCommit()` fires once on release through a debounced save.\n */\nfunction ControlSlider(props: {\n name: NumField\n label: string\n value: number\n onLive: (name: NumField, value: number) => void\n onCommit: () => void\n}) {\n const { name, label, value, onLive, onCommit } = props\n const spec = SLIDER_SPEC[name]\n const [local, setLocal] = useState(value)\n const localRef = useRef(value)\n const dragging = useRef(false)\n const onLiveRef = useRef(onLive)\n const onCommitRef = useRef(onCommit)\n onLiveRef.current = onLive\n onCommitRef.current = onCommit\n\n // Adopt an external value (load / save) when not mid-drag.\n useEffect(() => {\n if (!dragging.current && localRef.current !== value) {\n localRef.current = value\n setLocal(value)\n }\n }, [value])\n\n const handleLive = (e: ChangeEvent<HTMLInputElement>): void => {\n dragging.current = true\n const v = Number(e.currentTarget.value)\n localRef.current = v\n setLocal(v)\n syncTrackFill(e.currentTarget)\n onLiveRef.current(name, v)\n }\n\n const handleCommit = (): void => {\n if (!dragging.current) return\n dragging.current = false\n onCommitRef.current()\n }\n\n const text = spec.unit === 'percent'\n ? `${Math.round(local * 100)}%`\n : `${local}px`\n\n return (\n <div className={css.sliderRow}>\n <span className={css.sliderLabel}>{label}</span>\n <input\n type=\"range\"\n className={css.slider}\n ref={(el) => {\n // Sync the \"filled\" track fraction on mount and on every external\n // value adoption (the webkit track reads --bg-fill; moz draws its\n // own ::-moz-range-progress).\n if (el) syncTrackFill(el)\n }}\n min={spec.min} max={spec.max} step={spec.step}\n value={String(local)}\n aria-label={label}\n onInput={handleLive}\n onPointerUp={handleCommit}\n onKeyUp={(e) => {\n if (e.key.startsWith('Arrow') || e.key === 'Home' || e.key === 'End'\n || e.key === 'PageUp' || e.key === 'PageDown') handleCommit()\n }}\n onBlur={handleCommit}\n />\n <span className={css.sliderValue}>{text}</span>\n </div>\n )\n}\n\n/** Write the filled-track fraction (%) of a range input into its --bg-fill\n * variable (webkit has no range-progress pseudo-element; moz draws its own). */\nfunction syncTrackFill(el: HTMLInputElement): void {\n const min = Number(el.min)\n const max = Number(el.max)\n const value = Number(el.value)\n const pct = max === min ? 0 : ((value - min) / (max - min)) * 100\n el.style.setProperty('--bg-fill', `${pct}%`)\n}\n\n/**\n * The background settings row. A draft mirrors the persisted section; dragging\n * repaints the preview card and the live backdrop through CSS variables, and a\n * release commits once through the plugin's own host route.\n */\nexport function BackgroundSettingsRow({ t }: BackgroundRowProps) {\n const snapshot = useSyncExternalStore(settingsClient.subscribe, readSnapshot)\n const [draft, setDraft] = useState<BackgroundSettings>(DEFAULTS)\n const [uploading, setUploading] = useState(false)\n const [urlText, setUrlText] = useState('')\n const [error, setError] = useState('')\n const fileInput = useRef<HTMLInputElement>(null)\n const previewRef = useRef<HTMLDivElement>(null)\n // The latest draft, read by every handler (never a stale closure).\n const draftRef = useRef<BackgroundSettings>(DEFAULTS)\n // True while a drag/gesture is in flight: hold off snapshot sync.\n const editingRef = useRef(false)\n // The last section this row saved; external changes are snapshots that differ.\n const lastSavedRef = useRef<BackgroundSettings | null>(null)\n // True while an edit has not yet reached the host (drives flush-on-unmount).\n const dirtyRef = useRef(false)\n const commitTimer = useRef<number | undefined>(undefined)\n const editingTimer = useRef<number | undefined>(undefined)\n\n /** Repaint the live backdrop + preview card from one draft (no React state). */\n const paintLive = useCallback((next: BackgroundSettings): void => {\n paintBackground(next)\n if (previewRef.current) paintPreviewSurface(previewRef.current, next)\n }, [])\n\n /** Mark the row as being edited; clears after a quiet 600ms window. */\n const markEditing = useCallback((): void => {\n editingRef.current = true\n clearTimeout(editingTimer.current)\n editingTimer.current = window.setTimeout(() => { editingRef.current = false }, 600)\n }, [])\n\n /** Slider live handler (stable identity for the memoized sliders). */\n const onLive = useCallback((key: NumField, value: number): void => {\n const next = { ...draftRef.current, [key]: value }\n draftRef.current = next\n markEditing()\n // Hot path: most knobs repaint through the painter's single-variable\n // writer (no DOM layer churn). panelOpacity drives the glass surface\n // tokens, which need the full apply.\n if (key === 'panelOpacity') {\n paintBackground(next)\n } else {\n paintBackgroundKnob(key, value)\n }\n if (previewRef.current) paintPreviewSurface(previewRef.current, next)\n }, [markEditing])\n\n /** Persist one section through the host route and adopt it on success. */\n const saveNow = useCallback(async (next: BackgroundSettings): Promise<void> => {\n dirtyRef.current = true\n const result = await settingsClient.save(next)\n if (result === 'failed') {\n setError(t('background.saveFailed'))\n return\n }\n // A superseded save lost to a newer in-flight one, which now owns BOTH\n // the snapshot adoption and the dirty flag (cleared when IT commits).\n // Clearing the flag here would strand that write, and adopting this\n // response would resurrect an outdated section — so keep it set.\n if (result === 'superseded') return\n dirtyRef.current = false\n setError('')\n lastSavedRef.current = next\n draftRef.current = next\n setDraft(next)\n if (!next.uploadId) setUrlText(next.url)\n }, [t])\n\n // The latest saveNow, readable from stable callbacks and the unmount\n // cleanup (never a stale closure).\n const saveNowRef = useRef(saveNow)\n saveNowRef.current = saveNow\n\n /** Debounced commit: one POST per drag gesture, from the latest draft. */\n const onCommit = useCallback((): void => {\n clearTimeout(commitTimer.current)\n commitTimer.current = window.setTimeout(() => {\n // Reset before saving: a fired timer must never look like an armed one,\n // or the unmount flush would re-save an already-committed gesture.\n commitTimer.current = undefined\n void saveNowRef.current(draftRef.current)\n }, 120)\n }, [])\n\n // Sync the draft from the persisted value when it changes externally, but\n // never overwrite a draft the user is mid-editing.\n useEffect(() => {\n if (snapshot.status !== 'ready' || snapshot.value === undefined) return\n const saved = lastSavedRef.current\n const external = saved === null || !sameSettings(saved, snapshot.value)\n if (external && !editingRef.current) {\n lastSavedRef.current = snapshot.value\n draftRef.current = snapshot.value\n setDraft(snapshot.value)\n setUrlText(snapshot.value.uploadId ? '' : snapshot.value.url)\n if (previewRef.current) paintPreviewSurface(previewRef.current, snapshot.value)\n }\n }, [snapshot])\n\n // Teardown: a pending debounced commit must not die with the row. If the\n // timer is still armed, fire the save NOW (the timer callback would never\n // run after unmount, and dirtyRef is only set inside saveNow — clearing\n // the timer alone would silently drop the last slider adjustment). Then\n // wait out any save already in flight. The effect runs once per mount:\n // saveNow is reached through its ref, so an identity change mid-session\n // cannot re-trigger this teardown, and editingRef is reset so a cleared\n // editing window can never block snapshot sync forever.\n useEffect(() => () => {\n clearTimeout(editingTimer.current)\n editingRef.current = false\n if (commitTimer.current !== undefined) {\n clearTimeout(commitTimer.current)\n commitTimer.current = undefined\n void saveNowRef.current(draftRef.current)\n }\n if (dirtyRef.current) void settingsClient.flush()\n }, [])\n\n const handleFile = async (file?: File): Promise<void> => {\n if (!file) return\n markEditing()\n setUploading(true)\n setError('')\n try {\n const url = await settingsClient.upload(file)\n if (url === null) {\n setError(t('background.uploadFailed'))\n return\n }\n const next: BackgroundSettings = { ...draftRef.current, uploadId: stripId(url), url: '', enabled: true }\n draftRef.current = next\n setDraft(next)\n setUrlText('')\n paintLive(next)\n await saveNow(next)\n } finally {\n setUploading(false)\n }\n }\n\n const handleUrlSubmit = (): void => {\n const url = urlText.trim()\n if (!/^https?:\\/\\//i.test(url)) {\n setError(t('background.invalidUrl'))\n return\n }\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, uploadId: '', url, enabled: true }\n draftRef.current = next\n setDraft(next)\n paintLive(next)\n void saveNow(next)\n }\n\n const handleClear = (): void => {\n const next: BackgroundSettings = { ...draftRef.current, uploadId: '', url: '', enabled: false }\n draftRef.current = next\n setDraft(next)\n setUrlText('')\n if (previewRef.current) clearPreviewSurface(previewRef.current)\n paintBackground(next)\n void saveNow(next)\n }\n\n const handleFit = (mode: BackgroundFit): void => {\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, fit: mode }\n draftRef.current = next\n setDraft(next)\n paintLive(next)\n void saveNow(next)\n }\n\n const handleTimelineToggle = (): void => {\n markEditing()\n const next: BackgroundSettings = { ...draftRef.current, timeline: !draftRef.current.timeline }\n draftRef.current = next\n setDraft(next)\n // The rail reads the shared snapshot itself; no painter repaint needed.\n void saveNow(next)\n }\n\n const sourceUrl = draft.uploadId ? `${BACKGROUND_API_PREFIX}/image/${draft.uploadId}` : draft.url\n const hasImage = sourceUrl !== ''\n\n return (\n <div className={css.row}>\n <div className={css.header}>\n <div className={css.titleRow}>\n <div className={css.title}>{t('background.title')}</div>\n {hasImage && (\n <button type=\"button\" className={clsx(css.btn, css.btnDanger, css.clearBtn)} onClick={handleClear}>\n {t('background.clear')}\n </button>\n )}\n </div>\n <div className={css.desc}>{t('background.description')}</div>\n </div>\n\n {/* Live preview surface: image + theme-aware scrim + frosted glass bubble. */}\n <div className={css.preview} ref={previewRef}>\n {hasImage\n ? (\n <>\n <img className={css.previewImg} src={sourceUrl} alt=\"\" draggable={false} referrerPolicy=\"no-referrer\" />\n <div className={css.previewScrim} />\n <div className={css.previewGlass}>\n <span className={css.previewGlassText}>{t('background.previewGlass')}</span>\n </div>\n </>\n )\n : (\n <div className={css.previewEmpty}>{t('background.noPreview')}</div>\n )}\n </div>\n\n {/* Image source: upload or paste an http(s) link. */}\n <div className={css.section}>\n <div className={css.sectionLabel}>{t('background.source')}</div>\n <div className={css.sourceRow}>\n <input\n type=\"file\"\n ref={fileInput}\n hidden\n accept=\"image/jpeg,image/png,image/webp,image/gif\"\n onChange={(e) => {\n void handleFile(e.currentTarget.files?.[0])\n e.currentTarget.value = ''\n }}\n />\n <button\n type=\"button\"\n className={clsx(css.btn, css.btnPrimary)}\n disabled={uploading}\n onClick={() => fileInput.current?.click()}\n >\n {uploading ? t('background.uploading') : t('background.upload')}\n </button>\n <span className={css.hint}>{t('background.uploadMediaTypes')}</span>\n {draft.uploadId && <span className={css.enabledBadge}>✓ {t('background.enabled')}</span>}\n </div>\n <div className={css.urlRow}>\n <input\n className={css.urlInput}\n value={urlText}\n placeholder={t('background.urlPlaceholder')}\n onKeyDown={(e) => { if (e.key === 'Enter') handleUrlSubmit() }}\n onChange={(e) => setUrlText(e.currentTarget.value)}\n />\n <button\n type=\"button\"\n className={css.btn}\n disabled={!urlText.trim()}\n onClick={handleUrlSubmit}\n >\n {t('background.applyUrl')}\n </button>\n </div>\n </div>\n\n {/* Effects: stepped sliders + fit segmented control. */}\n <div className={css.section}>\n <div className={css.sectionLabel}>{t('background.effects')}</div>\n <ControlSlider name=\"opacity\" label={t('background.opacity')} value={draft.opacity} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"scrim\" label={t('background.scrim')} value={draft.scrim} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"panelOpacity\" label={t('background.panelOpacity')} value={draft.panelOpacity} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"blur\" label={t('background.blur')} value={draft.blur} onLive={onLive} onCommit={onCommit} />\n <ControlSlider name=\"wallpaperBlur\" label={t('background.wallpaperBlur')} value={draft.wallpaperBlur} onLive={onLive} onCommit={onCommit} />\n <div className={css.segRow}>\n <span className={css.segLabel}>{t('background.fit')}</span>\n <div className={css.segGroup} role=\"group\" aria-label={t('background.fit')}>\n {FIT_MODES.map((mode) => (\n <button\n key={mode}\n type=\"button\"\n className={clsx(css.segBtn, draft.fit === mode && css.segActive)}\n onClick={() => handleFit(mode)}\n >\n {t(mode === 'cover' ? 'background.cover' : 'background.contain')}\n </button>\n ))}\n </div>\n </div>\n <div className={css.segRow}>\n <span className={css.segLabel}>{t('background.timeline')}</span>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={draft.timeline}\n aria-label={t('background.timeline')}\n title={t('background.timelineHint')}\n className={css.switch}\n onClick={handleTimelineToggle}\n >\n <span className={css.switchKnob} />\n </button>\n <span className={css.hint}>{t('background.timelineHint')}</span>\n </div>\n </div>\n\n {error && <div className={css.error} role=\"alert\">{error}</div>}\n\n {hasImage && (\n <div className={css.clearRow}>\n <button type=\"button\" className={clsx(css.btn, css.btnDanger)} onClick={handleClear}>\n {t('background.clear')}\n </button>\n </div>\n )}\n </div>\n )\n}\n","/**\n * Timeline CSS — the conversation scroll-navigation rail (DeepSeek web\n * ScrollNav structure, rebuilt on this plugin's frosted-glass system).\n *\n * Structure and metrics mirror the official chat.deepseek.com stylesheet\n * (module map extracted from the shipped bundle; v0.1.4 of the reference port\n * dsh-chat-timeline widens the panel to 260px and adds bookmarks):\n * nav 34px-wide rail, fixed right edge, vertically centered; collapsed\n * blurred capsule (height − 8px); expanding panel (max 260px, radius 16)\n * whose scroll area holds 30px rows (tick indicator + fading-in title);\n * 32px gradient fade veils top/bottom, expanded-only, shown while that\n * side actually clips.\n *\n * Deviations from the reference port, all fidelity fixes:\n * - The filter bar collapses to zero height while idle instead of staying\n * in layout invisibly (it pushed every tick ~33px down).\n * - Short stacks center vertically; overflowing stacks are bottom-pinned\n * by the component so the newest tick hugs the capsule's bottom edge\n * (the official idle strategy — the reference port flowed ticks from\n * the top and clipped the newest away).\n *\n * Glass integration: the official chat.deepseek.com paints (light\n * rgba(255,255,255,.8)/.94, dark rgba(21,21,23,.6)/rgba(28,28,32,.95),\n * 5px collapsed / 16px expanded blur) remain as the NO-GLASS fallback.\n * While the plugin's glass system is on (`body[data-dsh-bg-glass]`), the\n * rail joins the SAME unified recipe as the composer card and bubbles:\n * fill = the painter's `--dsw-specific-input-major` token, blur/saturate/\n * brightness = the shared `--bg-glass-*` variables, i.e. the glass-blur\n * slider. Class prefix `dsbt-` deliberately avoids every\n * `[class*=\"_xxx\"]` anchor of the plugin's glass sheet (underscores only).\n */\n\n/** Unique id stamped on the injected style element (dedup key). */\nexport const TIMELINE_CSS_TAG = 'deepseek-harness-background/timeline'\n\n/**\n * Expanded-row title size in px. The canvas width measurement in timeline.tsx\n * reads this same constant — a fitted panel width must track the real text\n * metrics, so the two can never drift apart.\n */\nexport const TIMELINE_TITLE_FONT_PX = 13\n\n/** Inject the timeline stylesheet once. Idempotent (dedup key on the tag). */\nexport function injectTimelineCss(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector(`style[data-plugin-css=\"${TIMELINE_CSS_TAG}\"]`)) return\n const tag = document.createElement('style')\n tag.dataset.plugin = 'deepseek-harness-background'\n tag.dataset.pluginCss = TIMELINE_CSS_TAG\n tag.textContent = TIMELINE_CSS\n document.head.appendChild(tag)\n}\n\nexport const TIMELINE_CSS = `\n .dsbt-nav {\n user-select: none; -webkit-user-select: none;\n /* Filter-bar chrome height shared by the bar itself and the top veil's\n expanded offset. */\n --dsbt-bar-h: 33px;\n z-index: 90; align-items: center; width: 34px;\n height: var(--dsbt-h, 300px);\n transition: right .2s ease, opacity .2s ease;\n display: flex; position: fixed; top: 50%; right: 16px;\n transform: translateY(-50%); pointer-events: auto;\n }\n @media (max-width: 767px) { .dsbt-nav { display: none; } }\n\n /* Collapsed capsule — frosted strip behind the tick marks. Official paint:\n light rgba(255,255,255,.8), dark rgba(21,21,23,.6), 5px blur. */\n .dsbt-bg {\n background-color: rgba(255, 255, 255, .8);\n -webkit-backdrop-filter: blur(5px);\n backdrop-filter: blur(5px);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, .28),\n inset 0 0 0 .5px rgba(255, 255, 255, .1),\n 0 6px 18px rgba(0, 0, 0, .07);\n border-radius: 16px; width: 34px;\n height: calc(var(--dsbt-h, 300px) - 8px); max-height: calc(var(--dsbt-h, 300px) - 8px);\n position: absolute; top: 50%; right: 0; transform: translateY(-50%);\n transition: opacity .2s ease; pointer-events: none;\n }\n body[data-ds-dark-theme] .dsbt-bg {\n background-color: rgba(21, 21, 23, .6);\n box-shadow:\n inset 0 1px 0 rgba(255, 255, 255, .09),\n inset 0 0 0 .5px rgba(255, 255, 255, .05),\n 0 6px 18px rgba(0, 0, 0, .3);\n }\n .dsbt-bg.dsbt-bg-hide { opacity: 0; }\n\n /* Expanding panel — exactly the capsule's box (identical height in both\n states), width animates 34px -> measured fit (max 260px). Official\n hover-state paint: white/black frosted glass at ~94% alpha, 16px blur. */\n .dsbt-wrap {\n width: 34px;\n height: calc(var(--dsbt-h, 300px) - 8px); max-height: calc(var(--dsbt-h, 300px) - 8px);\n border: 1px solid transparent; border-radius: 16px;\n flex-direction: column; align-items: stretch;\n transition: width .22s cubic-bezier(.4, 0, .2, 1), background-color .2s ease,\n box-shadow .2s ease, border-color .2s ease;\n display: flex; position: absolute; top: 50%; right: 0;\n transform: translateY(-50%);\n overflow: hidden; box-sizing: border-box; background: transparent;\n pointer-events: none;\n }\n .dsbt-wrap.dsbt-show {\n pointer-events: auto;\n width: min(var(--dsbt-w, 260px), 260px);\n background-color: rgba(255, 255, 255, .94);\n -webkit-backdrop-filter: blur(16px);\n backdrop-filter: blur(16px);\n border-color: rgba(0, 0, 0, .06);\n box-shadow: 0 10px 30px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .04);\n }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show {\n background-color: rgba(28, 28, 32, .95);\n border-color: rgba(255, 255, 255, .08);\n box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .25);\n }\n\n /* Content fade veils — the official ::before/::after pair rebuilt as\n elements: a bar of the panel's OWN fill color masked to nothing over\n 32px (solid -> mask == gradient-to-transparent, but works with the\n translucent fill). They belong to the EXPANDED panel only — the idle\n capsule hard-clips its ticks at the rounded ends like the official\n strip — and while expanded the top veil starts BELOW the filter bar,\n not over it. Shown only while that side actually clips. */\n .dsbt-fade {\n z-index: 2; pointer-events: none; opacity: 0;\n background-color: rgba(255, 255, 255, .94);\n -webkit-mask-image: linear-gradient(#000 20.19%, transparent 100%);\n mask-image: linear-gradient(#000 20.19%, transparent 100%);\n width: 100%; height: 32px; transition: opacity .2s ease;\n position: absolute; left: 0; top: 0;\n }\n body[data-ds-dark-theme] .dsbt-fade { background-color: rgba(28, 28, 32, .95); }\n .dsbt-fade.dsbt-fade-bot { top: auto; bottom: 0; transform: rotate(180deg); }\n .dsbt-wrap.dsbt-show .dsbt-fade.dsbt-fade-on { opacity: 1; }\n .dsbt-wrap.dsbt-show .dsbt-fade:not(.dsbt-fade-bot) { top: var(--dsbt-bar-h, 33px); }\n\n /* Filter bar — \"marked only\" toggle pinned above the scroll area while\n expanded. Collapsed, it collapses to ZERO height (not just opacity): a\n transparent-but-in-layout bar pushed every tick ~33px down, one of the\n reasons the idle capsule read as off-alignment. */\n .dsbt-filterbar {\n height: var(--dsbt-bar-h, 33px);\n padding: 8px 12px 4px; display: flex; justify-content: flex-end;\n align-items: center; border-bottom: 1px solid rgba(0, 0, 0, .05);\n box-sizing: border-box; flex: none; overflow: hidden;\n transition: opacity .2s ease, height .2s ease, padding .2s ease,\n border-color .2s ease;\n }\n .dsbt-wrap:not(.dsbt-show) .dsbt-filterbar {\n height: 0; padding-top: 0; padding-bottom: 0; opacity: 0;\n border-bottom-color: transparent;\n }\n body[data-ds-dark-theme] .dsbt-filterbar { border-bottom-color: rgba(255, 255, 255, .06); }\n .dsbt-filterbtn {\n font-size: 11px; line-height: 16px; padding: 2px 8px; border-radius: 10px;\n border: 1px solid rgba(0, 0, 0, .1); background: rgba(0, 0, 0, .03);\n color: rgba(0, 0, 0, .65); cursor: pointer; transition: all .15s ease;\n display: inline-flex; align-items: center; gap: 3px; font-family: inherit;\n }\n .dsbt-filterbtn:hover { background: rgba(0, 0, 0, .07); color: rgba(0, 0, 0, .9); }\n .dsbt-filterbtn.dsbt-filteron {\n background: rgba(245, 158, 11, .12); border-color: #f59e0b;\n color: #b45309; font-weight: 600;\n }\n body[data-ds-dark-theme] .dsbt-filterbtn {\n border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05);\n color: rgba(255, 255, 255, .7);\n }\n body[data-ds-dark-theme] .dsbt-filterbtn:hover { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .95); }\n body[data-ds-dark-theme] .dsbt-filterbtn.dsbt-filteron {\n background: rgba(251, 191, 36, .18); border-color: #fbbf24; color: #fbbf24;\n }\n\n /* Scroll area — rows hug the right edge; scrolls only when overfull. The\n auto-margin pseudo pair vertically centers the stack when it fits the\n capsule (short conversations), and resolves to zero free space when it\n overflows, so bottom-pinned scrolling behaves like a plain column. */\n .dsbt-page {\n padding: 15px 0 15px 24px; box-sizing: border-box;\n overscroll-behavior: contain; flex: 1 1 auto; min-height: 0;\n flex-direction: column; align-items: flex-end; display: flex;\n position: relative; width: 100%; overflow: hidden;\n }\n .dsbt-page::before, .dsbt-page::after {\n content: ''; flex: none; margin-block: auto;\n }\n .dsbt-wrap.dsbt-show .dsbt-page {\n overflow-y: auto; overflow-x: hidden;\n scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .15) transparent;\n }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-page { scrollbar-color: rgba(255, 255, 255, .25) transparent; }\n .dsbt-page::-webkit-scrollbar { width: 4px; }\n .dsbt-page::-webkit-scrollbar-track { background: transparent; }\n .dsbt-page::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .15); border-radius: 4px; }\n body[data-ds-dark-theme] .dsbt-page::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); }\n\n /* Empty state (filtered list with no marks). */\n .dsbt-empty {\n font-size: 12px; line-height: 18px; padding: 16px 12px;\n color: rgba(0, 0, 0, .45); text-align: center; width: 100%; box-sizing: border-box;\n }\n body[data-ds-dark-theme] .dsbt-empty { color: rgba(255, 255, 255, .45); }\n\n /* One message row: 30px, star bookmark + tick indicator at the right,\n title fading in. */\n /* Row shell: layout + shared ink only — the interactive hit areas are the\n sibling .dsbt-jump / .dsbt-star buttons below. */\n .dsbt-item {\n height: 30px; min-height: 30px; flex-shrink: 0;\n justify-content: flex-end; align-items: center;\n width: calc(100% - 4px); margin-right: 4px;\n display: flex; box-sizing: border-box;\n color: var(--dsw-alias-label-tertiary, rgba(0, 0, 0, .65));\n transition: color .15s ease;\n }\n\n /* Jump target: a real button so Enter/Space work natively without nesting\n an interactive element inside another. */\n .dsbt-jump {\n cursor: pointer; background: none; border: none; margin: 0; padding: 0;\n font: inherit; line-height: 20px; text-align: right; color: inherit;\n flex: 1 1 auto; min-width: 0; height: 100%;\n display: flex; align-items: center; justify-content: flex-end;\n }\n .dsbt-jump:focus-visible { outline: 1px solid currentColor; outline-offset: -1px; border-radius: 6px; }\n .dsbt-item:hover { color: var(--dsw-alias-label-primary, rgba(0, 0, 0, .95)); }\n body[data-ds-dark-theme] .dsbt-item { color: rgba(255, 255, 255, .65); }\n body[data-ds-dark-theme] .dsbt-item:hover { color: rgba(255, 255, 255, .95); }\n .dsbt-title {\n font-size: ${TIMELINE_TITLE_FONT_PX}px; line-height: 20px; flex: 1 1 auto; min-width: 0;\n text-overflow: ellipsis; white-space: nowrap; overflow: hidden;\n margin-right: 6px; text-align: right; color: inherit;\n opacity: 0; transition: opacity .12s ease, color .15s ease;\n }\n .dsbt-show .dsbt-title { opacity: 1; }\n\n /* Star bookmark — appears on row hover while the panel is expanded; gold\n when marked. A real sibling button next to the jump target, so marking\n stays keyboard-operable without nested interactive elements. */\n .dsbt-star {\n font-size: ${TIMELINE_TITLE_FONT_PX}px; line-height: 16px; width: 18px; height: 18px;\n display: inline-flex; align-items: center; justify-content: center;\n opacity: 0; cursor: pointer; transition: all .15s ease; margin-right: 6px;\n flex-shrink: 0; color: rgba(0, 0, 0, .25); border-radius: 4px; user-select: none;\n -webkit-user-select: none;\n background: none; border: none; padding: 0; font-family: inherit;\n }\n .dsbt-star:focus-visible { outline: 1px solid currentColor; outline-offset: 1px; opacity: .9; }\n .dsbt-wrap.dsbt-show .dsbt-item:hover .dsbt-star { opacity: .75; }\n .dsbt-wrap.dsbt-show .dsbt-star:hover { opacity: 1; transform: scale(1.2); color: #d97706; }\n .dsbt-wrap.dsbt-show .dsbt-star.dsbt-staron { opacity: 1; color: #f59e0b; }\n body[data-ds-dark-theme] .dsbt-star { color: rgba(255, 255, 255, .25); }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-star:hover { color: #fde047; }\n body[data-ds-dark-theme] .dsbt-wrap.dsbt-show .dsbt-star.dsbt-staron { opacity: 1; color: #fbbf24; }\n\n .dsbt-ind { flex-shrink: 0; justify-content: center; align-items: center; width: 16px; height: 20px; display: flex; }\n .dsbt-line {\n background-color: var(--dsw-alias-border-l4, rgba(0, 0, 0, .16));\n border-radius: 4px; flex-shrink: 0; width: 8px; height: 2px;\n transition: background-color .2s ease, transform .2s ease, width .2s ease, height .2s ease;\n }\n .dsbt-item:hover .dsbt-line { background-color: var(--dsw-alias-label-primary, rgba(0, 0, 0, .9)); }\n .dsbt-item.dsbt-active { color: var(--dsw-alias-state-business-primary, #4d6bfe); }\n .dsbt-item.dsbt-active .dsbt-title { color: var(--dsw-alias-state-business-primary, #4d6bfe); font-weight: 500; }\n .dsbt-item.dsbt-active .dsbt-line {\n background-color: var(--dsw-alias-state-business-primary, #4d6bfe);\n transform-origin: 50%; transform: scale(1.5);\n }\n body[data-ds-dark-theme] .dsbt-item.dsbt-active { color: var(--dsw-alias-state-business-primary, #4d6bfe); }\n body[data-ds-dark-theme] .dsbt-line { background-color: rgba(255, 255, 255, .2); }\n body[data-ds-dark-theme] .dsbt-item:hover .dsbt-line { background-color: rgba(255, 255, 255, .9); }\n\n /* Marked (key-point) rows: a wider golden tick in both themes; the active\n state keeps its brand-blue scale so reading position always wins. */\n .dsbt-item.dsbt-marked .dsbt-line { background-color: #d97706; width: 10px; height: 2.5px; }\n .dsbt-item.dsbt-marked:hover .dsbt-line { background-color: #b45309; }\n .dsbt-item.dsbt-marked.dsbt-active .dsbt-line {\n background-color: var(--dsw-alias-state-business-primary, #4d6bfe);\n transform-origin: 50%; transform: scale(1.5);\n }\n body[data-ds-dark-theme] .dsbt-item.dsbt-marked .dsbt-line { background-color: #fbbf24; width: 10px; height: 2.5px; }\n body[data-ds-dark-theme] .dsbt-item.dsbt-marked:hover .dsbt-line { background-color: #fde047; }\n\n /* ---- Unified glass integration -----------------------------------------\n Glass system on (wallpaper active + panelOpacity < 1): the rail joins\n the composer/bubble recipe — the same translucent fill token and the\n same blur/saturate/brightness chain (the glass-blur slider drives it,\n no fixed 5/16px). Placed after the dark-theme rules so equal-specificity\n overrides win in both schemes. */\n body[data-dsh-bg-glass] .dsbt-bg,\n body[data-dsh-bg-glass] .dsbt-wrap.dsbt-show {\n background-color: var(--dsw-specific-input-major);\n -webkit-backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n backdrop-filter: blur(var(--bg-glass-blur, 16px)) saturate(var(--bg-glass-saturate, 1.42)) brightness(var(--bg-glass-brightness, 1)) contrast(1.01);\n }\n body[data-dsh-bg-glass] .dsbt-fade {\n background-color: var(--dsw-specific-input-major);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .dsbt-nav, .dsbt-bg, .dsbt-wrap, .dsbt-fade, .dsbt-title, .dsbt-line, .dsbt-jump, .dsbt-star, .dsbt-filterbtn, .dsbt-filterbar { transition: none; }\n }\n`\n","/**\n * Conversation timeline rail — DeepSeek web ScrollNav rebuilt on this\n * plugin's frosted-glass system (styles: ./timeline-css.ts).\n *\n * Collapsed: a fixed 34px-wide frosted capsule at the right edge, vertically\n * centered, one tick per user message (active tick scaled + brand blue,\n * key-point bookmarks golden). Hovering expands the SAME box into a frosted\n * panel listing every user question (title fades in; >8 messages widen to\n * 260px, otherwise the width fits the longest title). Both states share one\n * computed outer height, so expanding never jumps, and 32px fade veils mask\n * the clipped edge on each side while that side actually scrolls.\n *\n * Enhancements ported from dsh-chat-timeline v0.1.4 (MIT):\n * - Key-point bookmarks: star a question in the expanded panel, persisted per\n * session in localStorage; marked rows show a golden tick in the capsule\n * and a \"marked only\" filter narrows the list.\n * - Jump stabilization: the reading-position tracker freezes while a smooth\n * jump animates (cleared 150ms after the last scroll event, plus an 800ms\n * fallback), so the panel cannot jitter mid-jump.\n * - Rewind integration: messages withdrawn by a rewind command node are\n * filtered out of the rail.\n *\n * Data source, fastest first: the host-side `bgTimeline` session projection\n * (src/projection.ts — a complete enumeration of the session's user messages\n * delivered through the projection baseline/push channel) -> the loaded chat\n * node window. The conversation's own lazy loading is never driven from here;\n * clicking a row pages older history on demand, scrolls the conversation to\n * the target row, and keeps the rail's own active row visible.\n *\n * Collapsed idle strategy (official ScrollNav behavior): the tick stack is\n * pinned to the BOTTOM inner edge — the newest question's tick always sits at\n * the bottom of the capsule, older ticks clip away at the top. Hovering\n * expands the SAME box and scrolls the active row into view instead.\n *\n * The rail reads the shared settings transport: it renders unless\n * `timeline: false`. Its glass paints are self-contained official values\n * (see timeline-css.ts), independent of the plugin's token overrides.\n */\n\nimport react from 'react'\nimport reactDom from 'react-dom'\nimport { settingsClient } from './settings-client.ts'\nimport { TIMELINE_PROJECTION_KEY } from '../settings.ts'\nimport { injectTimelineCss, TIMELINE_TITLE_FONT_PX } from './timeline-css.ts'\n\n/** Shared constant lives in settings.ts; re-exported for consumers of this module. */\nexport { TIMELINE_PROJECTION_KEY }\n\n// Inject the stylesheet once at module evaluation (the loader removes\n// plugin-owned tags on unload; re-evaluation dedupes on the tag id).\nif (typeof document !== 'undefined') injectTimelineCss()\n\n/** Structural view of one chat node this rail consumes. */\ninterface ChatNodeLike {\n kind?: string\n key?: string\n anchorSeq?: number\n data?: {\n time?: number\n content?: unknown\n name?: unknown\n seq?: unknown\n args?: unknown\n outcome?: { kind?: unknown; sourceEventSeq?: unknown; text?: unknown }\n }\n}\n\n/** One normalized user-message entry in the rail. */\nexport interface TimelineMessage {\n seq: number\n time: number\n text: string\n key?: string\n}\n\n/** Session handle face the rail needs off the runtime sessions service. */\nexport interface TimelineSessionHandle {\n subscribe(listener: () => void): () => void\n getSnapshot(): unknown\n loadOlder(): Promise<unknown>\n}\n\n/** Sessions service face (narrowed to what jump/data collection touches). */\nexport interface TimelineSessionsService {\n binding(sessionId: string): { session: TimelineSessionHandle } | undefined\n}\n\n/** Component props delivered by the dock slot registration. */\nexport interface TimelineRailProps {\n sessionId?: string\n sessionsService?: TimelineSessionsService\n /** Framework projection reader (SessionStandardProps seat; undefined-capable). */\n useProjection?: (key: string) => unknown\n t: (key: string) => string\n}\n\nconst delay = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))\n\n/** Extract preview text from a user message's ContentBlock list. */\nfunction userTextOf(content: unknown): string {\n if (!Array.isArray(content)) return ''\n let out = ''\n for (const block of content) {\n if (block !== null && typeof block === 'object' && (block as { type?: unknown }).type === 'text') {\n const text = (block as { text?: unknown }).text\n if (typeof text === 'string') out += text\n }\n }\n return out.trim().slice(0, 80)\n}\n\n/* ---- Key-point bookmarks (ported from dsh-chat-timeline v0.1.4) --------- */\n\n/**\n * Stable bookmark key for one entry: the durable message key, falling back to\n * the anchor seq — so marks survive history reloads. Entries with neither are\n * not markable (empty key).\n * @param m - the entry (or any shaped object).\n */\nexport function markKeyOf(m: unknown): string {\n if (m === null || typeof m !== 'object') return ''\n const rec = m as { key?: unknown; seq?: unknown }\n if (typeof rec.key === 'string' && rec.key !== '') return `key:${rec.key}`\n return typeof rec.seq === 'number' ? `seq:${rec.seq}` : ''\n}\n\n/** localStorage key prefix for the per-session marked-key lists. */\nexport const MARKS_STORAGE_PREFIX = 'dsbt_marks_'\n\n/**\n * Read the marked keys for one session from localStorage.\n * @param sessionId - the session the marks belong to.\n */\nexport function readMarks(sessionId: string | undefined): string[] {\n if (typeof window === 'undefined' || !sessionId) return []\n try {\n const raw = window.localStorage.getItem(MARKS_STORAGE_PREFIX + sessionId)\n if (!raw) return []\n const parsed: unknown = JSON.parse(raw)\n return Array.isArray(parsed) ? parsed.filter((k): k is string => typeof k === 'string') : []\n } catch {\n return []\n }\n}\n\n/**\n * Persist the marked keys for one session (removes the key when empty).\n * @param sessionId - the session the marks belong to.\n * @param marks - the marked-key list.\n */\nexport function writeMarks(sessionId: string | undefined, marks: string[]): void {\n if (typeof window === 'undefined' || !sessionId) return\n try {\n if (!Array.isArray(marks) || marks.length === 0) window.localStorage.removeItem(MARKS_STORAGE_PREFIX + sessionId)\n else window.localStorage.setItem(MARKS_STORAGE_PREFIX + sessionId, JSON.stringify(marks))\n } catch { /* storage unavailable — marks stay in-memory */ }\n}\n\n/* ---- Rewind integration (ported from dsh-chat-timeline v0.1.4) ---------- */\n\n/**\n * Extract the rewind target seq from a rewind outcome text.\n * @param text - the command outcome text.\n */\nexport function rewindTargetOfOutcome(text: unknown): number | undefined {\n if (typeof text !== 'string') return undefined\n const match = /rewound.*?(?:target\\s+)?(\\d+)/i.exec(text) ?? /#(\\d+)/.exec(text)\n const digits = match?.[1]\n if (digits === undefined) return undefined\n const n = Number.parseInt(digits, 10)\n return Number.isFinite(n) ? n : undefined\n}\n\n/**\n * Is this rewind command a preview/dry-run (marks the target hidden without\n * an outcome)?\n * @param command - the command payload.\n */\nfunction isRewindPreviewCommand(command: { args?: unknown }): boolean {\n if (command.args === null || typeof command.args !== 'object') return false\n const args = command.args as { preview?: unknown; dryRun?: unknown }\n return args.preview === true || args.dryRun === true\n}\n\n/**\n * Collect the seq numbers a rewind hid: preview commands hide their target\n * directly; successful commands hide their own row plus every node anchored\n * inside the rewound span [target, sourceEventSeq].\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function hiddenSeqsOfChat(chat: unknown): Set<number> {\n const hidden = rewindHiddenSeqsOfChat(chat)\n const spans = rewindSpansOfChat(chat)\n if (spans.length === 0) return hidden\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return hidden\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n const anchor = typeof node.anchorSeq === 'number' ? node.anchorSeq : undefined\n if (anchor === undefined) continue\n if (spans.some((span) => anchor >= span.start && anchor <= span.end)) hidden.add(anchor)\n }\n return hidden\n}\n\n/**\n * Seq numbers a rewind hid directly: successful commands hide their own row;\n * preview commands hide their target.\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function rewindHiddenSeqsOfChat(chat: unknown): Set<number> {\n const hidden = new Set<number>()\n if (chat === null || typeof chat !== 'object') return hidden\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return hidden\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'command') continue\n const command = node.data\n if (command === null || typeof command !== 'object') continue\n if (command.name !== 'rewind') continue\n if (isRewindPreviewCommand(command)) {\n if (typeof command.seq === 'number') hidden.add(command.seq)\n continue\n }\n const outcome = command.outcome\n if (outcome === null || typeof outcome !== 'object' || outcome.kind !== 'success') continue\n if (typeof command.seq === 'number') hidden.add(command.seq)\n }\n return hidden\n}\n\n/**\n * The [target, sourceEventSeq] spans successful rewind commands cut — the\n * range form of hiding, needed to filter sources that are NOT chat nodes\n * (the host projection) by plain seq membership.\n * @param chat - a chat snapshot (loosely typed on purpose).\n */\nexport function rewindSpansOfChat(chat: unknown): { start: number; end: number }[] {\n const spans: { start: number; end: number }[] = []\n if (chat === null || typeof chat !== 'object') return spans\n const nodes = (chat as { nodes?: Map<string, ChatNodeLike> }).nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return spans\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'command') continue\n const command = node.data\n if (command === null || typeof command !== 'object') continue\n if (command.name !== 'rewind') continue\n if (isRewindPreviewCommand(command)) continue\n const outcome = command.outcome\n if (outcome === null || typeof outcome !== 'object' || outcome.kind !== 'success') continue\n const marker = outcome.sourceEventSeq\n if (typeof marker !== 'number') continue\n const target = rewindTargetOfOutcome(outcome.text)\n if (target !== undefined) spans.push({ start: target, end: marker })\n }\n return spans\n}\n\n/**\n * Enumerate user messages from the loaded chat-node snapshot (the client-side\n * collector; sorted by anchor sequence, rewind-hidden entries dropped).\n * @param snapshot - a session snapshot (loosely typed on purpose).\n */\nexport function collectMessages(snapshot: unknown): TimelineMessage[] {\n const chat = (snapshot as { chat?: { nodes?: Map<string, ChatNodeLike> } } | undefined)?.chat\n const nodes = chat?.nodes\n if (nodes === undefined || typeof nodes.values !== 'function') return []\n const hidden = hiddenSeqsOfChat(chat)\n const out: TimelineMessage[] = []\n for (const node of nodes.values()) {\n if (node === null || typeof node !== 'object') continue\n if (node.kind !== 'user') continue\n const data = node.data\n if (data === null || typeof data !== 'object' || typeof data.time !== 'number' || !Array.isArray(data.content)) continue\n const key = typeof node.key === 'string' ? node.key : undefined\n if (key === undefined) continue\n const seq = typeof node.anchorSeq === 'number' ? node.anchorSeq : 0\n if (hidden.has(seq)) continue\n out.push({ seq, time: data.time, text: userTextOf(data.content), key })\n }\n out.sort((a, b) => a.seq - b.seq)\n return out\n}\n\n/** Resolve the DOM anchor key of one entry (direct key form only). */\nexport function resolveAnchorKey(m: TimelineMessage): string | undefined {\n return typeof m.key === 'string' && m.key !== '' ? m.key : undefined\n}\n\n/* ---- Host projection source --------------------------------------------- */\n\n/** The user-message node definition kind in ui-conversation. */\nconst INPUT_MESSAGE_KIND = 'input-message'\n\n/**\n * Rebuild a chat row's DOM anchor key from the durable message id — the same\n * engine formula as conversationContextKey(kind, id) for the input-message\n * definition (`13:input-message<id>`), so projected entries can jump even\n * when their chat node is not loaded yet.\n * @param id - the durable message id carried by the projection entry.\n */\nexport function inputAnchorKeyOf(id: string): string {\n return `${INPUT_MESSAGE_KIND.length}:${INPUT_MESSAGE_KIND}${id}`\n}\n\n/**\n * Validate one projected wire value into rail entries (defensive: the value\n * crosses the wire and may be absent, partial, or stale).\n * @param value - the raw useProjection(TIMELINE_PROJECTION_KEY) snapshot.\n */\nexport function normalizeProjectedTimeline(value: unknown): TimelineMessage[] {\n if (value === null || typeof value !== 'object') return []\n const raw = (value as { messages?: unknown }).messages\n if (!Array.isArray(raw)) return []\n const seen = new Set<number>()\n const out: TimelineMessage[] = []\n for (const item of raw) {\n if (item === null || typeof item !== 'object') continue\n const rec = item as { seq?: unknown; time?: unknown; text?: unknown; id?: unknown }\n if (typeof rec.seq !== 'number' || !Number.isFinite(rec.seq)) continue\n if (seen.has(rec.seq)) continue\n seen.add(rec.seq)\n out.push({\n seq: rec.seq,\n time: typeof rec.time === 'number' ? rec.time : 0,\n text: typeof rec.text === 'string' ? rec.text.slice(0, 80) : '',\n ...(typeof rec.id === 'string' && rec.id !== '' ? { key: inputAnchorKeyOf(rec.id) } : {}),\n })\n }\n out.sort((a, b) => a.seq - b.seq)\n return out\n}\n\n/**\n * Rail messages with the fastest source first: the host projection covers the\n * WHOLE session (and already excludes rewind cuts), so it wins whenever it\n * has anything; otherwise fall back to the loaded chat-node window. The\n * projection path still applies locally-known rewind hiding so a cut lands\n * instantly even before the next projection push arrives.\n * @param snapshot - the session conversation snapshot (node fallback).\n * @param projected - the raw bgTimeline projection value.\n */\nexport function railMessages(snapshot: unknown, projected: unknown): TimelineMessage[] {\n const projectedMessages = normalizeProjectedTimeline(projected)\n if (projectedMessages.length > 0) {\n // The host projection already drops rewind cuts authoritatively; this\n // locally-known hiding (command rows, preview targets and cut spans read\n // off the loaded window) makes a rewind land instantly, before the next\n // projection push arrives.\n const chat = (snapshot as { chat?: { nodes?: Map<string, ChatNodeLike> } } | undefined)?.chat\n const hidden = rewindHiddenSeqsOfChat(chat)\n const spans = rewindSpansOfChat(chat)\n if (hidden.size === 0 && spans.length === 0) return projectedMessages\n return projectedMessages.filter((m) =>\n !hidden.has(m.seq) && !spans.some((span) => m.seq >= span.start && m.seq <= span.end))\n }\n return collectMessages(snapshot)\n}\n\n/**\n * Outer rail height for a message count: rows + breathing room, clamped so\n * both states always share the exact same height (never jumps on expand).\n * @param count - number of user messages.\n */\nexport function railHeightFor(count: number): number {\n return Math.max(140, Math.min(300, count * 30 + 38))\n}\n\n/** Longest-title width estimate bounds. */\nconst RAIL_MIN_WIDTH = 96\nconst RAIL_MAX_WIDTH = 260\n\n/**\n * Measure the expanded-panel width for the given titles (canvas text metrics;\n * falls back to the max width when measurement is unavailable). Accounts for\n * the star column so a marked row never clips its tick.\n * @param texts - the message previews.\n */\nexport function railWidthFor(texts: string[]): number {\n if (texts.length > 8) return RAIL_MAX_WIDTH\n let widest = 0\n if (typeof document !== 'undefined') {\n const canvas = document.createElement('canvas')\n const ctx = canvas.getContext('2d')\n if (ctx) {\n ctx.font = `${TIMELINE_TITLE_FONT_PX}px -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif`\n for (const t of texts) {\n const w = ctx.measureText(t === '' ? '…' : t).width\n if (w > widest) widest = w\n }\n }\n }\n // Title + title gap + star column + indicator + item gutters + border/padding.\n return Math.round(Math.max(RAIL_MIN_WIDTH, Math.min(RAIL_MAX_WIDTH, widest + 6 + 24 + 16 + 12)))\n}\n\n/** Ensure the target node is loaded, then scroll its row into view. */\nasync function jumpToMessage(sessionsService: TimelineSessionsService, sessionId: string, key: string): Promise<boolean> {\n const session = sessionsService.binding(sessionId)?.session\n if (session === undefined) return false\n let guard = 0\n while (guard++ < 120) {\n const snapshot = session.getSnapshot() as { chat?: { nodes?: Map<string, unknown> }; hasMore?: boolean; loadingOlder?: boolean }\n if (snapshot?.chat?.nodes?.get(key) !== undefined) break\n if (snapshot?.hasMore !== true) return false\n if (snapshot.loadingOlder === true) {\n await delay(50)\n continue\n }\n await session.loadOlder()\n }\n const scrollport = document.querySelector('[data-conversation-scroll]')\n const row = scrollport?.querySelector(`[data-chat-anchor-key=\"${CSS.escape(key)}\"]`) ?? null\n if (row === null) return false\n const reducedMotion = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches\n row.scrollIntoView({ behavior: reducedMotion ? 'auto' : 'smooth', block: 'center' })\n return true\n}\n\n/**\n * Scroll only the rail itself so the active row stays visible (min distance).\n * offsetTop math instead of getBoundingClientRect: stable while the panel's\n * own smooth scroll animates (no feedback loop with live rects).\n */\nfunction scrollTimelineItemIntoView(page: HTMLElement, item: HTMLElement): void {\n const pageTop = page.scrollTop\n const pageBottom = pageTop + page.clientHeight\n const itemTop = item.offsetTop\n const itemBottom = itemTop + item.offsetHeight\n if (itemTop < pageTop) page.scrollTop = Math.max(0, itemTop - 10)\n else if (itemBottom > pageBottom) page.scrollTop = itemBottom - page.clientHeight + 10\n}\n\n/** Is another timeline rail already mounted (e.g. dsh-chat-timeline)? */\nfunction otherRailPresent(): boolean {\n return document.querySelector('.dsct_nav') !== null\n}\n\n/**\n * The timeline rail component. Portaled to body; registered into the\n * conversation input dock purely to bind per-session lifecycle.\n */\nexport function TimelineRail(props: TimelineRailProps): react.ReactElement | null {\n const { sessionId, sessionsService, useProjection, t } = props\n\n // Shared settings: the rail hides while timeline === false. Read through a\n // hook like every other store here, but the gate itself must sit with the\n // FINAL early return below — an early return between hooks would crash\n // React (\"rendered fewer hooks\") the moment the toggle flips mid-session.\n const settings = react.useSyncExternalStore(settingsClient.subscribe, settingsClient.getSnapshot)\n // Hide only while the persisted toggle is UNKNOWN (no wrong-state flash for\n // timeline:false users); once loading settles the default-on rail renders\n // even if the section errored.\n const timelineUnknown = settings.status === 'loading'\n const timelineDisabled = settings.value?.timeline === false\n\n const session = sessionId !== undefined && sessionsService !== undefined ? sessionsService.binding(sessionId)?.session : undefined\n // SessionFace methods are prototype methods reading \"this\"; React invokes\n // store callbacks as bare functions, so keep the receiver via closures\n // (same shape as the host's own wiring, e.g. ModelSelect). Identity stays\n // stable per session so uSES does not resubscribe on every render.\n const subscribeSession = react.useCallback(\n (listener: () => void) => session === undefined ? () => {} : session.subscribe(listener),\n [session],\n )\n const snapshotSession = react.useCallback(\n () => session === undefined ? undefined : session.getSnapshot(),\n [session],\n )\n const nodeSnapshot = react.useSyncExternalStore(subscribeSession, snapshotSession)\n\n // Host projection first: the full-session user-message index (baseline on\n // session open, live push frames after). Undefined until the framework\n // seat exists or the deployment lacks the projection registry — then the\n // loaded chat-node window below is the fallback source.\n const projected = useProjection !== undefined ? useProjection(TIMELINE_PROJECTION_KEY) : undefined\n\n // Collected per snapshot/projection change (the collector allocates +\n // sorts); memoized so width measurement and tracking effects key on\n // content, not renders.\n const messages = react.useMemo(() => railMessages(nodeSnapshot, projected), [nodeSnapshot, projected])\n\n const [activeIndex, setActiveIndex] = react.useState(-1)\n const [show, setShow] = react.useState(false)\n const [rightOffset, setRightOffset] = react.useState(16)\n const [railWidth, setRailWidth] = react.useState(RAIL_MAX_WIDTH)\n const [fades, setFades] = react.useState({ top: false, bottom: false })\n const [hidden, setHidden] = react.useState(() => otherRailPresent())\n // Key-point bookmarks: per-session list + the \"marked only\" filter toggle.\n const [marks, setMarks] = react.useState<string[]>(() => readMarks(sessionId))\n const [marksOnly, setMarksOnly] = react.useState(false)\n const [isNarrow, setIsNarrow] = react.useState(\n () => typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n && window.matchMedia('(max-width: 767px)').matches,\n )\n const pageRef = react.useRef<HTMLDivElement | null>(null)\n const activeItemRef = react.useRef<HTMLButtonElement | null>(null)\n // Jump-stabilization lock: freezes the reading-position tracker while a\n // click-triggered smooth jump animates (cleared by the settle timer below\n // or the 800ms fallback in the click handler). The fallback timeout is\n // tracked so the settle path can cancel it and unmount cannot leak it.\n const jumpPendingRef = react.useRef(false)\n const jumpFallbackRef = react.useRef<number | undefined>(undefined)\n\n // Marks follow the session switch; the filter resets with them.\n react.useEffect(() => {\n setMarks(readMarks(sessionId))\n setMarksOnly(false)\n }, [sessionId])\n\n const markedSet = react.useMemo(() => new Set(marks), [marks])\n // Mirror ref so rapid successive toggles always see the latest list (the\n // handler writes storage directly, outside the setState updater — updaters\n // must stay pure and StrictMode re-runs them).\n const marksRef = react.useRef(marks)\n marksRef.current = marks\n const toggleMark = react.useCallback((m: TimelineMessage) => {\n const k = markKeyOf(m)\n if (k === '') return\n const prev = marksRef.current\n const next = prev.includes(k) ? prev.filter((x) => x !== k) : [...prev, k]\n marksRef.current = next\n setMarks(next)\n writeMarks(sessionId, next)\n }, [sessionId])\n\n // Narrow-viewport guard (matches the official breakpoint).\n react.useEffect(() => {\n if (typeof window.matchMedia !== 'function') return\n const mql = window.matchMedia('(max-width: 767px)')\n const onChange = (e: MediaQueryListEvent): void => setIsNarrow(e.matches)\n mql.addEventListener('change', onChange)\n return () => mql.removeEventListener('change', onChange)\n }, [])\n\n // Width follows the longest title (remeasured when messages arrive/change).\n // No gating on a \"fully loaded\" flag: the projection source is complete by\n // construction, and the node fallback measures whatever it has.\n react.useEffect(() => {\n setRailWidth(railWidthFor(messages.map((m) => m.text)))\n }, [messages])\n\n // Reading position tracking: nearest user row to the 40% viewport line.\n // An IntersectionObserver (when available) keeps a live set of the rows\n // currently inside the scrollport — the best row is always one of them — so\n // each pass reads a few dozen rects instead of one per row of a possibly\n // thousand-row history; without IO measure() scans every row as before.\n react.useEffect(() => {\n if (messages.length === 0) return\n const indexByKey = new Map<string, number>()\n messages.forEach((m, i) => {\n const key = resolveAnchorKey(m)\n if (key !== undefined) indexByKey.set(key, i)\n })\n const sp = document.querySelector('[data-conversation-scroll]')\n if (sp === null) return\n const rows = sp.querySelectorAll('[data-chat-anchor-key]')\n\n let settleTimer: number | undefined\n let frame = 0\n const nearRows = new Set<Element>()\n\n const updateActive = (): void => {\n // A jump is animating: freeze the highlight so the panel cannot jitter.\n if (jumpPendingRef.current) return\n const rect = sp.getBoundingClientRect()\n if (rect.height === 0) return\n const candidates = nearRows.size > 0 ? nearRows : rows\n const line = rect.top + rect.height * 0.4\n let best = -1\n let bestDist = Infinity\n for (const row of candidates) {\n const key = row.getAttribute('data-chat-anchor-key')\n if (key === null) continue\n const idx = indexByKey.get(key) ?? -1\n if (idx === -1) continue\n const r = row.getBoundingClientRect()\n const dist = Math.abs(r.top + r.height / 2 - line)\n if (dist < bestDist) {\n bestDist = dist\n best = idx\n }\n }\n setActiveIndex(best)\n }\n const scheduleMeasure = (): void => {\n if (frame !== 0) return\n frame = window.requestAnimationFrame(() => {\n frame = 0\n updateActive()\n })\n }\n\n let io: IntersectionObserver | undefined\n if (typeof IntersectionObserver === 'function') {\n io = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) nearRows.add(entry.target)\n else nearRows.delete(entry.target)\n }\n scheduleMeasure()\n }, { root: sp })\n rows.forEach((row) => io?.observe(row))\n }\n\n const onScroll = (): void => {\n // Detect the true end of scrolling: 150ms after the LAST scroll event\n // release the jump lock and refresh the highlight exactly once.\n if (settleTimer !== undefined) clearTimeout(settleTimer)\n settleTimer = window.setTimeout(() => {\n settleTimer = undefined\n if (jumpPendingRef.current) {\n jumpPendingRef.current = false\n if (jumpFallbackRef.current !== undefined) {\n clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = undefined\n }\n updateActive()\n }\n }, 150)\n scheduleMeasure()\n }\n sp.addEventListener('scroll', onScroll, { passive: true })\n const interval = window.setInterval(scheduleMeasure, 2000)\n scheduleMeasure()\n return () => {\n io?.disconnect()\n if (frame !== 0) cancelAnimationFrame(frame)\n if (settleTimer !== undefined) clearTimeout(settleTimer)\n if (jumpFallbackRef.current !== undefined) {\n clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = undefined\n }\n sp.removeEventListener('scroll', onScroll)\n clearInterval(interval)\n }\n }, [messages])\n\n // Fade veils reflect the page's actual clip state (scroll position).\n const syncFades = react.useCallback((): void => {\n const page = pageRef.current\n if (page === null) {\n setFades({ top: false, bottom: false })\n return\n }\n const canTop = page.scrollTop > 2\n const canBot = page.scrollTop + page.clientHeight < page.scrollHeight - 2\n setFades((prev) => (prev.top === canTop && prev.bottom === canBot ? prev : { top: canTop, bottom: canBot }))\n }, [])\n react.useEffect(syncFades, [syncFades, show, messages.length, marksOnly])\n\n // Keep the active row visible inside the rail without moving the chat.\n react.useLayoutEffect(() => {\n if (!show) return\n const page = pageRef.current\n const item = activeItemRef.current\n if (page === null || item === null) return\n scrollTimelineItemIntoView(page, item)\n syncFades()\n }, [activeIndex, messages.length, marksOnly, show, syncFades])\n\n // Collapsed idle strategy (official ScrollNav behavior): pin the tick stack\n // to the BOTTOM inner edge so the newest question's tick always hugs the\n // bottom of the capsule and older ticks clip away at the top. overflow:hidden\n // boxes still accept programmatic scrollTop; scrollHeight clamps the value,\n // and short stacks that fit simply stay put (the page centers them). Runs on\n // every collapse and whenever the stack changes while idle, so a message\n // sent in another window keeps the newest tick pinned.\n const height = railHeightFor(messages.length)\n react.useLayoutEffect(() => {\n if (show) return\n const page = pageRef.current\n if (page === null) return\n page.scrollTop = page.scrollHeight\n }, [show, messages.length, marksOnly, height])\n\n // Avoid right-side workbenches: derive the offset from the chat scrollport.\n react.useEffect(() => {\n let raf = 0\n const measure = (): void => {\n raf = 0\n const sp = document.querySelector('[data-conversation-scroll]')\n if (sp === null) return\n const rect = sp.getBoundingClientRect()\n if (rect.width === 0 && rect.height === 0) return\n const next = Math.max(8, Math.round(window.innerWidth - rect.right + 12))\n setRightOffset((prev) => (Math.abs(prev - next) > 0.5 ? next : prev))\n }\n const schedule = (): void => {\n if (raf === 0) raf = window.requestAnimationFrame(measure)\n }\n const sp = document.querySelector('[data-conversation-scroll]')\n const ro = typeof ResizeObserver === 'function' && sp !== null ? new ResizeObserver(schedule) : null\n if (ro !== null && sp !== null) ro.observe(sp)\n window.addEventListener('resize', schedule)\n // Slow guard: pick up a competing rail (un)mounting mid-session.\n const guard = window.setInterval(() => setHidden(otherRailPresent()), 2000)\n measure()\n return () => {\n if (raf !== 0) cancelAnimationFrame(raf)\n ro?.disconnect()\n window.removeEventListener('resize', schedule)\n clearInterval(guard)\n }\n }, [])\n\n // Any non-empty conversation gets the rail — the official ScrollNav renders\n // for a lone question too, and the clamped shared height keeps a single\n // tick cleanly bottom-pinned instead of hiding the capsule.\n if (timelineUnknown || timelineDisabled\n || sessionId === undefined || sessionsService === undefined || isNarrow || hidden || messages.length === 0) {\n return null\n }\n\n // Compare actives by bookmark key, not index: the filtered display list\n // reindexes rows, and the active ref must track the SAME question.\n const activeKey = activeIndex >= 0 && activeIndex < messages.length ? markKeyOf(messages[activeIndex]) : ''\n const displayMessages = marksOnly ? messages.filter((m) => markedSet.has(markKeyOf(m))) : messages\n\n return reactDom.createPortal(\n <div\n className=\"dsbt-nav\"\n style={{ right: rightOffset, ['--dsbt-h' as string]: `${height}px`, ['--dsbt-w' as string]: `${railWidth}px` }}\n role=\"navigation\"\n aria-label={t('timeline.railLabel')}\n onMouseEnter={() => setShow(true)}\n onMouseLeave={() => setShow(false)}\n >\n <div className={show ? 'dsbt-bg dsbt-bg-hide' : 'dsbt-bg'} />\n <div className={show ? 'dsbt-wrap dsbt-show' : 'dsbt-wrap'}>\n <div className=\"dsbt-filterbar\">\n <button\n type=\"button\"\n className={marksOnly ? 'dsbt-filterbtn dsbt-filteron' : 'dsbt-filterbtn'}\n aria-pressed={marksOnly}\n onClick={() => setMarksOnly((v) => !v)}\n >\n {t('timeline.marksOnly')}{marks.length > 0 ? ` (${marks.length})` : ''}\n </button>\n </div>\n <div className={fades.top ? 'dsbt-fade dsbt-fade-on' : 'dsbt-fade'} aria-hidden />\n <div className={fades.bottom ? 'dsbt-fade dsbt-fade-bot dsbt-fade-on' : 'dsbt-fade dsbt-fade-bot'} aria-hidden />\n <div\n className=\"dsbt-page\"\n ref={pageRef}\n onScroll={syncFades}\n >\n {displayMessages.length === 0\n ? <div className=\"dsbt-empty\">{t('timeline.noMarks')}</div>\n : displayMessages.map((m) => {\n const key = resolveAnchorKey(m)\n const mk = markKeyOf(m)\n const marked = markedSet.has(mk)\n const isActive = activeKey !== '' && mk === activeKey\n const cls = `dsbt-item${isActive ? ' dsbt-active' : ''}${marked ? ' dsbt-marked' : ''}`\n return (\n <div key={m.seq} className={cls}>\n {/* Jump target and star bookmark are SIBLING real buttons —\n the previous span[role=button] nested inside the row\n button was invalid interactive-in-interactive markup,\n while native buttons keep Enter/Space for both roles. */}\n <button\n type=\"button\"\n className=\"dsbt-jump\"\n ref={isActive ? activeItemRef : undefined}\n title={`${marked ? '★ ' : ''}${m.text === '' ? t('timeline.noText') : m.text}`}\n aria-label={`${marked ? '★ ' : ''}${t('timeline.roleUser')}: ${m.text.slice(0, 60) || t('timeline.noText')}`}\n aria-current={isActive ? 'location' : undefined}\n onClick={() => {\n if (key === undefined) return\n // Engage the stabilization lock with a fallback timeout:\n // the settle timer normally releases it after the jump.\n // A fresh click replaces the pending fallback so a rapid\n // second jump cannot be unlocked by the first one's timer.\n jumpPendingRef.current = true\n if (jumpFallbackRef.current !== undefined) clearTimeout(jumpFallbackRef.current)\n jumpFallbackRef.current = window.setTimeout(() => {\n jumpFallbackRef.current = undefined\n jumpPendingRef.current = false\n }, 800)\n void jumpToMessage(sessionsService, sessionId, key).catch(() => {})\n }}\n >\n <span className=\"dsbt-title\">{m.text === '' ? t('timeline.noText') : m.text}</span>\n </button>\n <button\n type=\"button\"\n className={marked ? 'dsbt-star dsbt-staron' : 'dsbt-star'}\n aria-pressed={marked}\n aria-label={marked ? t('timeline.unmark') : t('timeline.mark')}\n onClick={() => toggleMark(m)}\n >\n ★\n </button>\n <span className=\"dsbt-ind\" aria-hidden>\n <span className=\"dsbt-line\" />\n </span>\n </div>\n )\n })}\n </div>\n </div>\n </div>,\n document.body,\n )\n}\n","/**\n * Browser half of the background plugin: paints the background behind the\n * whole app frame, provides the settings surface (a live row inside the\n * official General settings section), and renders the conversation timeline\n * rail (DeepSeek ScrollNav style) on the same frosted-glass system. Data\n * flows through the plugin's own host route (`/api/bg-wallpaper/*`), not the\n * settings RPC. Retraction discipline mirrors the skin plugins: every\n * property and DOM node the painter owns is restored on dispose.\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport { backgroundPainter, paintBackground } from './backdrop.ts'\nimport { installGlassBridge } from './glass-registry.ts'\nimport { en, zh } from './locales.ts'\nimport { BackgroundSettingsRow } from './SettingsRow.tsx'\nimport { settingsClient } from './settings-client.ts'\nimport { TimelineRail } from './timeline.tsx'\nimport type {} from './types.ts'\n\n/**\n * Service injections this entry declares: `slots` + `locale` for the settings\n * surface and the timeline slot seat, and `sessions` so the timeline rail can\n * enumerate user messages and jump between them. The settings surface itself\n * talks to the plugin's own host route over plain same-origin fetch.\n */\nexport const inject = ['slots', 'locale', 'sessions']\n\n/**\n * Client plugin body: paint the persisted background live, register the\n * General-settings row, and mount the conversation timeline rail.\n * @param ctx - client cordis context (slots/locale/sessions injected).\n */\nexport function apply(ctx: Context): void {\n // Publish the third-party frosted-glass registry bridge FIRST so an\n // eager consumer can register before the first snapshot repaints; the\n // bridge lives for the whole fiber and dies with it (see the dispose below).\n const glassBridge = installGlassBridge()\n // Paint from the plugin's own transport; repaint on every snapshot change.\n const paint = (): void => {\n const snapshot = settingsClient.getSnapshot()\n const value = snapshot.status === 'ready' ? snapshot.value : undefined\n if (value === undefined || !value.enabled) {\n backgroundPainter.dispose()\n return\n }\n paintBackground(value)\n }\n const unsubscribe = settingsClient.subscribe(paint)\n void settingsClient.load()\n\n ctx.effect(() => ctx.locale.register('ui-background', { zh, en }), 'deepseek-harness-background: dictionaries')\n\n // Live settings row in the General section (same slot as the Appearance row).\n ctx.slots.inject('settings.general.item', () => ctx.slots.register({\n name: 'settings.general.item',\n id: 'deepseek-harness-background',\n order: 600,\n locale: 'ui-background',\n }, BackgroundSettingsRow))\n\n // Conversation timeline rail: takes a per-session dock seat only to bind\n // its lifecycle; the rail portals to body. The sessions service is handed\n // to the component through the registration's inject face — resolved\n // lazily inside the factory so a runtime-side service rebuild can never\n // leave the rail holding a stale reference.\n ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({\n name: 'conversation.input.dock',\n id: 'deepseek-harness-background.timeline',\n order: 45,\n locale: 'ui-background',\n inject: () => ({ sessionsService: ctx.sessions }),\n }, TimelineRail))\n\n ctx.effect(() => () => {\n unsubscribe()\n glassBridge.dispose()\n backgroundPainter.dispose()\n }, 'deepseek-harness-background: background surface')\n}\n"],"x_google_ignoreList":[5],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAa,qBAAqB;;EAGlC,MAAa,cAAc;;;;;;;;EAS3B,MAAa,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC1B,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqM9B,SAAgB,sBAA4B;GAC1C,IAAI,SAAS,cAAc,6DAAgD,GAAG;GAC9E,MAAM,MAAM,SAAS,cAAc,OAAO;GAC1C,IAAI,QAAQ,SAAS;GACrB,IAAI,QAAQ,YAAY;GACxB,IAAI,cAAc;GAClB,SAAS,KAAK,YAAY,GAAG;EAC/B;;;;ECnPA,MAAa,wBAAwB;;EAWrC,MAAa,gBAAgB;;EAY7B,MAAa,wBAAwB;;;;;;EA+BrC,MAAa,0B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;IAC7D,IAAI,UAAU,KAAA,KAAa,CAAC,MAAM,SAAS;KACzC,kBAAkB,QAAQ;KAC1B;IACF;IACA,gBAAgB,KAAK;GACvB;GACA,MAAM,cAAc,eAAe,UAAU,KAAK;GAClD,eAAoB,KAAK;GAEzB,IAAI,aAAa,IAAI,OAAO,SAAS,iBAAiB;IAAE;IAAI;GAAG,CAAC,GAAG,2CAA2C;GAG9G,IAAI,MAAM,OAAO,+BAA+B,IAAI,MAAM,SAAS;IACjE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;GACV,GAAG,qBAAqB,CAAC;GAOzB,IAAI,MAAM,OAAO,iCAAiC,IAAI,MAAM,SAAS;IACnE,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,eAAe,EAAE,iBAAiB,IAAI,SAAS;GACjD,GAAG,YAAY,CAAC;GAEhB,IAAI,mBAAmB;IACrB,YAAY;IACZ,YAAY,QAAQ;IACpB,kBAAkB,QAAQ;GAC5B,GAAG,iDAAiD;EACtD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepseek-harness-background",
|
|
3
3
|
"description": "Custom background image plugin for the DeepSeek Harness web GUI: upload a local picture or paste an image URL, and render it behind the whole app surface with adjustable opacity, scrim, panel transparency and frosted-glass blur.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
7
7
|
"dsh",
|