Skip to content

v0.16.0 — 自由窗口 + 模型主动打开 + Markdown 内嵌 HTML/TOC / Free windows + model-driven opens + Markdown inline HTML & TOC

Choose a tag to compare

@Menghuan1918 Menghuan1918 released this 24 Aug 15:59
· 1385 commits to main since this release

v0.16.0 — 自由窗口 + 模型主动打开 + Markdown 内嵌 HTML/TOC / Free windows + model-driven opens + Markdown inline HTML & TOC

支持的 DSH 版本 / Supported DSH versions: 0.1.0-rc.8 · 0.1.1-rc.1 · 0.1.1-rc.2

✨ 新功能

  • 🪟 自由窗口(#354):把标签栏的任意 tab(内置或插件注册)拖到主会话区域——会话列出现虚线提示浮层,松开即成为悬浮窗口(默认 390×780,手机竖屏比例,创建时按视口钳制后居中于松点);窗口支持头部拖动移动、右下角 SE 缩放(≥320×200)、点击任意处置顶、头部右键「回到侧边栏 / 关闭」、X 走 closeTab 正常关闭生命周期(释放终端等);拖到侧边栏 pane 上时该 pane 高亮、松开即停靠合并回该 pane;floats 随会话持久化(刷新原样恢复,宽容 sanitize + 几何钳入视口);服务语义:features 新增 'floatWindows'——openTab 的 dedupe/id 聚焦命中浮动 tab = 置顶窗口(不重复开、不展开面板),closeTab / activateTab 对浮窗正常关窗 / 置顶并照常触发回调,浮窗内 tab visible 恒 true,agent 终端 reconcile 覆盖浮窗;tab 内容复用常规渲染、插件 tab 与 pane 完全同契约;附带文件二级页面 8px 网格间距规整(设计文档)
  • 📂 模型主动打开(sidebar_open 工具)(#353):侧边栏新增全局设置 agentOpenTools(默认关闭),开启后向模型注入一个工具——模型可在调用方会话的侧边栏打开本地文件(editor tab,按 path 去重)、文件夹(全窗树窗口,以该目录为根,meta.dir)与 HTTP(S) 网页(browser tab,URL 预填);关闭设置即注销工具并清空未投递队列,已打开 tab 保留;非激活会话的打开排队、下次可见时重放(/sidebar/ws/agent-opens 推送,同一 trust fence);无新增公共 API、不改变 BetterSidebarService(设计文档)
  • 📝 Markdown README 级内嵌 HTML + 目录大纲(TOC)(#360):Markdown 预览现在真实渲染块级内嵌 HTML——徽章墙 <div align=center>、<details> 折叠块内嵌 markdown、表格单元格 <br/>/<sub>/<img>、<video>/<picture> 全部经 DOMPurify 白名单消毒(<script> 等活性内容剥除、<a> 强制 _blank rel=noopener),本地媒体 src 重写为会话媒体路由;≥3 标题出现浮动目录大纲按钮,点击平滑滚动并自动展开折叠 <details>,HTML 段内标题同样收录;渲染器仍是宿主 MarkdownText(shiki / KaTeX / GFM 保留),纯 markdown(零 HTML)文档走原路径零回归(设计文档)
  • 🌏 第三语言覆盖(19 语言)(#339):接入可选 peer @huanlin/dsh-plugin-better-locale——ja / de / fr / pt / ko / ar / hi / id / tr / vi / th / ru / it / nl / sv / pl / zh-HK / zh-TW / zh-MO 全量词典(每种约 340 keys);覆盖借用 DSH 英文槽位(DSH active=en 时生效,zh 下完全惰性、界面不混语言);19 语言词典同时注册进 better-locale,外部 ctx.locale.lookup('betterSidebar', key) 调用者同样可拿覆盖文本;未安装时 ctx.get('betterLocale') 为 undefined、整段 no-op,zh/en 行为不变
  • 🌿 Git 多仓库选择 + linked worktree 变更发现(#326 #285):会话 cwd 是工作区容器(非 Git 仓库)时自动发现直接子仓库并显示仓库选择器——status / 分支 / 历史 / diff / 暂存 / 提交 / 还原 / cherry-pick / 文件打开全部按所选仓库线程化;linked worktree 的变更发现与按工作树操作(含延迟分页响应的事务一致性),并拒绝过期 / 可修剪的 worktree 命令目标、对单库存取失败降级
  • 🖥️ 浏览器本地回环允许清单(#365):新增侧边卡设置 browserAllowedLoopback(逗号分隔 host 或 host:port;裸 host 匹配任意端口、带有端口精确匹配)——显式信任的本地开发服务器(如 Vite)可导航,并额外获得 iframe allow-same-origin 令牌(模块 / HMR / fetch 管线需要真实 origin,否则白屏);页面相对 GUI 与其他站点仍是跨源;服务端 browser.probe 镜像同一允许清单,本地服务器不再被误拒
  • 📝 编辑器 Vue + 28 种 legacy 语言语法高亮(#202):.vue 映射 @codemirror/lang-vue(template / script / style 按 lang 属性分派、<style lang="scss"> 预处理器);零新依赖用 legacy-modes 补齐 scss/sass/less/stylus/ruby/lua/perl/r/dart/scala/groovy/powershell/diff/protobuf/cmake/pug/tcl/haskell/clojure/erlang/julia/pascal/vb/vhdl/stex/objectivecpp;语言工厂抛错降级纯文本(console.warn),不再炸编辑器;.v / .m 跨语言歧义故意不映射
  • 🔄 编辑器预览刷新三件套(#215 #228,修复 #167):文本预览新增手动刷新按钮;编辑保存后切回预览自动重载(dirty 时抑制,草稿不丢);预览模式下保存成功边沿自动重载;移除自动轮询与 fs.stat 版本端点(后台 API 零流量)
  • 🖼️ Markdown 本地 / 相对图片(#292):![alt](./img.png)、/cwd/img.png 与引用式 [id]: url 目标重写为 /sidebar/file 媒体 URL(会话 cwd 边界不变)——预览不再只显示 alt 文本
  • ➕ 推荐插件目录新增 ego-browser(#340):@dsh-external/ego-browser Agent 浏览器 Tab(会话侧边栏自动注册本机浏览器页,无 better-sidebar 时回退浮动浮窗);描述词典 19 语言补全(#371)

🐛 修复

  • 🛒 DSH 市场受管安装兼容(#338):移除 peerDependencies 里的公开版 cordis(市场预览硬拒依赖字段出现 cordis,optional 无效)——npm 包满足 dsh-community-market 安装规范,dshfind / 1024Store 目录里的条目重新获得 repository_backlink 验证目标,可直接从 Desktop 市场受管安装
  • 🔤 类型基底迁移到 @deepseek-ai/cordis(#338):Context = 真实 vendored cordis Context 与结构化服务面的交集,ctx.betterSidebar 类型合并改挂 @deepseek-ai/cordis,公开版 cordis 不再被依赖。消费者迁移:import type { Context } from 'cordis' 改为 import type { Context } from '@deepseek-ai/cordis'(import type {} from 'dsh-better-sidebar' 的类型合并方式不变);未使用该导入的插件无影响
  • 🧩 插件树内 ctx.betterSidebar 读取全面修复(#357,修复 #356):npm 安装的 DSH 0.1.1-rc.x(web bundle)下侧边栏页面每次加载即崩(cannot get property "betterSidebar" without inject)——26 处内部直读 ctx.betterSidebar 改走 ctx.get('betterSidebar')(root reflect store 解析,不受 fiber 链影响);外部消费者 inject: ['betterSidebar'] + ctx.betterSidebar 契约不变
  • 🔐 文件 API 会话工作区边界(#345,修复 #328):fs.tree / fs.read / fs.write 的 workspace 越界访问修复;媒体、HTML 预览与上传统一 real-path 符号链接校验;新增绝对路径 / 符号链接 / 上传 / 嵌套 Git 会话回归测试
  • 🪟 面板宿主层级与视口裁剪(#330 #278,修复 #277):面板宿主层 z-index 40→25——低于 DSH cordis 动态插件面板 30,工作台不再遮挡 cordis 清单 / 审批面(AppFrame 20 之上、100+ 浮层之下);宿主 overflow: hidden 裁剪视口边缘,收起的面板不再把文档撑出双向滚动(实测 scrollWidth 2289→1672 / scrollHeight 1280→1032,任意皮肤)
  • 📐 布局推挤加固(#310 #130 #180):对话列补 min-height: 0 + overflow: hidden + overflow-wrap: anywhere(长不可断 URL / OAuth 链接不再把 composer 与左侧设置按钮挤出视口);layout-push effect 拆「仅设置 + 仅卸载移除」并按 panelOpen 门控宽度 push——右栏关闭时拖底部高度不再挤压对话区、松手瞬间不再整页右铺再回弹;useLayoutEffect 消除跨 paint 全宽闪帧;松手 flush 最终帧 + centerRect.right 同步提交;底部高度按 viewportHeight - PANEL_MIN 封顶;拖拽手柄拖动中不再高亮
  • 📱 移动端无会话状态说明 + 1px 溢出修复(#254):无会话时开关改用 aria-disabled 保持不可执行语义、同时允许触摸 / 键盘聚焦显示「选择一个会话以使用侧边栏」提示;panel 改 border-box——移动端 100vw 含左边框,不再产生 1px 横向溢出
  • 📏 侧边栏宽度跨会话共享(#36):面板宽度是布局偏好而非会话内容——「最后一次拖拽胜出」写入全局 dsh-sidebar:v1:width,缓存会话切换与新建会话即时跟随;无全局键(首次运行 / 旧会话)时行为逐字节不变
  • 🧹 会话删除立即关闭该会话终端(#130):新增 PtyManager.closeSession() + 订阅 DSH session/disposed——删除会话不再等 30s 重连宽限到期(agent 终端由 agent 生命周期管理,不受影响)
  • 🔍 文件名搜索跳过噪声目录(#342):node_modules / .pnpm-store / .yarn / .turbo / .next / dist / build / coverage 等黑名单(小写不敏感,.git 仍跳)——超大依赖树不再耗尽 10 万访问预算提前 truncated,docs/ 等后序目录里的真实文件能搜到;不引入 .gitignore 语义,保持「文件名查找」
  • 📝 mermaid 全局错误渲染抑制(#341):开启 suppressErrorRendering——非法图表不再把大错误 SVG 注入 document.body;组件级错误回退与源码展示保留
  • 🖥️ 终端 Nerd Font 图标字体回退(#190):starship / powerlevel10k 提示符的补充平面 PUA 图标(Nerd Fonts v3 Material 图标集)不再显示豆腐块——withIconFontFallbacks() 为胜出的基础字体追加 Nerd Font 图标族(插入首个通用族之前、按族名去重、过滤 CSS 全局关键字、不列彩色 emoji 字体)
  • 🌐 HTML 预览 UTF-8 声明(#193,修复 #170):/sidebar/html 响应带 charset=utf-8(无 <meta charset> 的中文片段不再乱码),保留原始文件字节
  • 🧪 trust-fence Origin 改按 hostname 比较(#182):Edge 151 把非默认端口 loopback 页面的 Origin 序列化为无端口形式——http://127.0.0.1 对 Host: 127.0.0.1:3080 不再 403(对齐 DSH 官方网关栅栏);不同 hostname / opaque null origin 仍拒绝
  • 🪟 「在文件夹中显示」改为资源管理器揭示(#94):不再把目录当文件开进编辑器("..." is a directory)——revealInExplorer 切到资源管理器 tab、面板折叠时自动展开、展开父目录并高亮滚动到本轮产出文件;产物行数据改读引擎 Turn deliverable(与 ui-deliverables 同源)
  • 🖱️ 面板拖动布局闪烁(#180):右侧栏关闭时拖底部高度不再左移挤压对话区;松手瞬间不再整体右铺再回弹
  • 🖥️ PowerShell 安装脚本修复(#47):远程入口统一为「下载脚本 → 移除 UTF-8 BOM → 内存执行」,-Version / -DryRun 参数在 Windows PowerShell 5.1 下恢复生效(BOM 解析不再吃掉首行 param(...));安装前校验 pnpm --version(主版本 <10 时明确报错并以退出码 1 结束,不再写一半 profile)
  • 🔄 浏览器嵌入探测 GET 兜底(#69):HEAD 响应同时缺 CSP 与 X-Frame-Options 时回退 GET 重试一次——阿里云百炼等只在 GET 回头发嵌入策略的站点不再显示误导性「拒绝连接请求」,而是正确显示「该站点拒绝嵌入」面板 + 「在浏览器中打开」
  • 🔧 git 源安装修复 unrun devDependency(#336):tsdown 0.22 经 unrun 加载配置而 pnpm 11 不自动装 peer——git-hosted 安装的 prepare 不再报 Failed to import module "unrun"(npm tarball 不受影响)
  • 🍃 ctx.effect 严格化顺手修了 4 处:拦截注册失败时 effect 体返回 undefined 改为 no-op disposer(vendored cordis 的 effect 契约要求返回 disposer,返回 undefined 属非法形状)

📖 文档与社区

✨ New features

  • 🪟 Free windows (#354): drag any tab (built-in or plugin-registered) out of the tab bar onto the main conversation area — a dashed drop hint marks the landing zone and release turns it into a floating window (default 390×780, phone-portrait ratio, clamped to the viewport and centered at the drop point). Windows can be moved by dragging the header, resized from the SE corner (≥320×200), raised to the top by clicking anywhere, sent back with the header context menu ("Back to sidebar" / "Close"), and closed with X through the normal closeTab lifecycle (pty release etc.). Dragging over a sidebar pane highlights it and releasing docks the window back into that pane. floats persist per session (restored as-is after refresh, lenient sanitize + geometry clamping). Service semantics: features gains 'floatWindows' — openTab's dedupe/id focus on a floating tab raises its window (no duplicate open, no panel expansion), closeTab / activateTab work on floating tabs and still fire their lifecycle callbacks, visible is always true inside a float, and agent-terminal reconcile covers floating windows. Tab content reuses the regular render path; plugin tabs are fully supported. Also ships the 8px-grid spacing cleanup of file sub-pages (design)
  • 📂 Model-driven sidebar opens (sidebar_open tool) (#353): a new global setting agentOpenTools (off by default) injects one tool letting the model open local files (editor tab, deduped by path), folders (full-window tree rooted there, meta.dir) and HTTP(S) pages (browser tab, URL prefilled) in the caller's sidebar. Turning the setting off unregisters the tool and clears the undelivered queue; already-open tabs stay. Opens targeting non-active sessions queue and replay when visible (/sidebar/ws/agent-opens push, same trust fence). No new public API and no new /sidebar/api routes (design)
  • 📝 README-level inline HTML + table of contents (TOC) in Markdown previews (#360): previews now genuinely render block-level inline HTML — badge walls <div align=center>, <details> blocks nesting markdown, <br/>/<sub>/<img> inside table cells, <video>/<picture> — all sanitized through a DOMPurify allowlist (<script> and other active content stripped, <a> forced _blank rel=noopener), with local media src rewritten to the session media route. With ≥3 headings a floating TOC button appears: smooth scroll, auto-expanding folded <details> ancestors, collecting headings from HTML segments too. The renderer is still the host MarkdownText (shiki / KaTeX / GFM preserved); pure-markdown documents take the original path with zero regression (design)
  • 🌏 Third-language coverage (19 languages) (#339): optional peer @huanlin/dsh-plugin-better-locale adds full dictionaries for ja / de / fr / pt / ko / ar / hi / id / tr / vi / th / ru / it / nl / sv / pl / zh-HK / zh-TW / zh-MO (~340 keys each). Coverage borrows the DSH English slot: it is active only while DSH's active locale is en and is completely inert under zh (no mixed-language UI). The 19 dictionaries are also registered into better-locale so external ctx.locale.lookup('betterSidebar', key) callers get the override text. Without better-locale installed ctx.get('betterLocale') is undefined and the whole block is a no-op — zh/en behavior is unchanged
  • 🌿 Multi-repository Git selection + linked-worktree discovery (#326 #285): when the session cwd is a workspace container rather than a Git repository, the Git panel discovers direct child repositories and shows a repository selector — status / branch / history / diff / stage / commit / revert / cherry-pick / file opening are all threaded through the selected repository. Linked-worktree change discovery and per-worktree git operations are transactionally bound to the selected checkout (including delayed pagination responses), stale/prunable worktree targets are rejected, and individual inventory failures degrade safely
  • 🖥️ Browser loopback allowlist (#365): a new side-card setting browserAllowedLoopback (comma-separated host or host:port entries; bare hosts match every port, host:port matches exactly) lets the sidebar browser navigate to explicitly trusted local addresses. Allowlisted loopback pages additionally get the allow-same-origin iframe sandbox token — local dev servers (Vite etc.) need a real origin for their module/HMR/fetch pipeline and would otherwise render blank. The page stays cross-origin to the GUI and to every other site; the server-side browser.probe route mirrors the same allowlist
  • 📝 Vue + 28 legacy languages in the editor (#202): .vue maps to @codemirror/lang-vue (template / script / style dispatch on the lang attribute, <style lang="scss"> preprocessors); zero new dependencies bring scss/sass/less/stylus/ruby/lua/perl/r/dart/scala/groovy/powershell/diff/protobuf/cmake/pug/tcl/haskell/clojure/erlang/julia/pascal/vb/vhdl/stex/objectivecpp via legacy-modes. A throwing language factory degrades to plain text (console.warn) instead of breaking the editor; ambiguous .v / .m extensions stay unmapped on purpose
  • 🔄 Editor preview refresh trio (#215 #228, fixes #167): a manual refresh button for text previews; switching back to preview after an edit-save auto-reloads (suppressed while dirty so drafts survive); a successful save while in preview mode reloads on the saved edge. Automatic polling and the fs.stat version endpoint are gone (zero background API traffic)
  • 🖼️ Local / relative images in Markdown (#292): ![alt](./img.png), /cwd/img.png and reference-style [id]: url destinations are rewritten to /sidebar/file media URLs (still bounded by the session cwd) — previews no longer show just the alt text
  • ➕ New recommended-catalog entry: ego-browser (#340): @dsh-external/ego-browser Agent browser tab (registers a sidebar page automatically when better-sidebar is present, falls back to a floating bubble otherwise); description dictionary completed across 19 languages (#371)

🐛 Fixes

  • 🛒 DSH marketplace managed-install compatibility (#338): the public cordis entry was removed from peerDependencies (the market preview hard-rejects cordis in any dependency field — optional does not help), so the npm package satisfies the dsh-community-market install rules — catalog sources (dshfind / 1024Store) can re-issue the repository_backlink verified target and the plugin becomes installable through the Desktop market
  • 🔤 Type base migrated to @deepseek-ai/cordis (#338): the declaration surface (src/context-types.ts) no longer depends on or restates the public cordis — Context is now an intersection of the real vendored cordis Context with the structural service faces, and the ctx.betterSidebar type merge lives on @deepseek-ai/cordis. Consumer migration: change import type { Context } from 'cordis' to import type { Context } from '@deepseek-ai/cordis' (the import type {} from 'dsh-better-sidebar' merge path is unchanged); plugins that never used that import are unaffected
  • 🧩 All internal ctx.betterSidebar reads fixed (#357, fixes #356): on npm-installed DSH 0.1.1-rc.x (web bundle) the sidebar died on every page load (cannot get property "betterSidebar" without inject) — the 26 internal direct reads now go through ctx.get('betterSidebar') (root reflect-store resolution, immune to the fiber chain); external consumers keep inject: ['betterSidebar'] + ctx.betterSidebar
  • 🔐 Session-workspace boundary for file APIs (#345, fixes #328): fixed fs.tree / fs.read / fs.write workspace escapes; media, HTML preview and uploads share real-path symlink validation; regression tests for absolute paths, symlinks, uploads and nested Git sessions
  • 🪟 Panel-host layering and viewport clipping (#330 #278, fixes #277): panel host z-index 40→25 — below the DSH cordis dynamic-plugin layer (30), so the workbench no longer covers cordis inventory/approval surfaces (still above AppFrame's 20 and below the 100+ float stack); overflow: hidden on the host clips at the viewport edge, so collapsed panels no longer stretch the document into bidirectional scrolling (measured scrollWidth 2289→1672 / scrollHeight 1280→1032, any skin)
  • 📐 Layout-push hardening (#310 #130 #180): conversation column gets min-height: 0 + overflow: hidden + overflow-wrap: anywhere (long unbreakable URLs / OAuth links no longer push the composer and left-rail Settings out of the viewport); the layout-push effect is split into "set only" + "remove only on unmount" and the width push is gated on panelOpen — dragging the bottom height with the right panel closed no longer squeezes the conversation, and release no longer flashes full-width; useLayoutEffect removes cross-paint full-width frames; all three drags flush the final frame and sync centerRect.right before committing; bottom height caps at viewportHeight - PANEL_MIN; drag handles no longer highlight mid-drag
  • 📱 Mobile: unavailable-sidebar clarity + 1px overflow (#254): with no session the toggle uses aria-disabled — keeping the non-executable semantics while allowing touch/keyboard focus so the "select a session to use the sidebar" tooltip is reachable; the panel uses border-box so mobile 100vw includes the left border and no longer causes 1px horizontal overflow
  • 📏 Side-card width shared across sessions (#36): panel width is a layout preference, not session content — "last drag wins" writes the global dsh-sidebar:v1:width key that fresh and cached session switches adopt; without a global key (first run / pre-existing sessions) behavior is byte-for-byte unchanged
  • 🧹 Terminals close immediately on session delete (#130): new PtyManager.closeSession() subscribing to DSH's session/disposed — deleted sessions no longer wait for the 30s reconnect grace to release their terminals (agent terminals are agent-lifecycle-owned and untouched)
  • 🔍 Filename search skips noise directories (#342): node_modules / .pnpm-store / .yarn / .turbo / .next / dist / build / coverage etc. (case-insensitive, .git still skipped) — huge dependency trees no longer burn the 100k visit budget and return truncated early, so real files in later directories (docs/) are found; no .gitignore semantics, still filename lookup
  • 📝 Mermaid global error rendering suppressed (#341): suppressErrorRendering enabled — invalid diagrams no longer inject a large error SVG into document.body; the component-level error fallback and source display remain
  • 🖥️ Terminal Nerd Font icon fallback (#190): supplementary-plane PUA icons in starship / powerlevel10k prompts (Nerd Fonts v3 Material icon set) no longer render as tofu — withIconFontFallbacks() appends Nerd Font icon families to the winning base font (before the first generic family, deduped by family name, CSS global keywords filtered, no color-emoji fonts)
  • 🌐 HTML preview declares UTF-8 (#193, fixes #170): /sidebar/html responses carry charset=utf-8 (Chinese fragments without <meta charset> no longer mojibake); original file bytes preserved
  • 🧪 trust-fence Origin compared by hostname (#182): some Chromium builds (Edge 151) serialize the Origin of non-default-port loopback pages without the port — http://127.0.0.1 against Host: 127.0.0.1:3080 no longer 403s (mirrors DSH's official gateway fence); different hostnames and opaque null origins are still rejected
  • 🪟 "Show in folder" now reveals in the explorer (#94): the folder-reveal gesture no longer opens the directory as a file in the editor ("..." is a directory) — revealInExplorer switches to the explorer tab, auto-expands a collapsed panel, expands the parent folder and highlights/scrolls to the produced file; the produced-files selector now reads the engine's Turn deliverables (same source as ui-deliverables)
  • 🖱️ Panel-drag layout flash fixed (#180): dragging the bottom height with the right panel closed no longer shifts the conversation left; release no longer flashes full-width before snapping back
  • 🖥️ PowerShell installer fixes (#47): the remote entry is now "download the script → strip the UTF-8 BOM → run it in memory", so -Version / -DryRun work again under Windows PowerShell 5.1 (the BOM no longer eats the leading param(...)); pnpm --version is checked before touching the profile (major <10 fails with a clear error and exit code 1)
  • 🔄 Browser embed probing GET fallback (#69): when a HEAD response omits both Content-Security-Policy and X-Frame-Options, probe retries once with GET — sites like Alibaba Bailian that only advertise their embed policy on GET no longer show a misleading "refused to connect"; they get the friendly "site refuses embedding" panel with an "open in browser" button
  • 🔧 git-source installs fixed via unrun devDependency (#336): tsdown 0.22 loads its config through unrun and pnpm 11 does not auto-install peer deps — git-hosted prepare no longer fails with Failed to import module "unrun" (npm tarballs unaffected)
  • 🍃 Strict ctx.effect also fixed 4 latent sites: interception / IME-guard effect bodies returned undefined on failure instead of a disposer (invalid shape under the vendored cordis effect contract) — now a no-op disposer

📖 Docs & community