diff --git a/README.md b/README.md
index 462137b..9020af4 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@
- **🌐 内嵌浏览器**:多开网页 tab,后退 / 前进 / 刷新;内容运行在沙箱 iframe;外链默认按协议分流——HTTP 在侧边栏打开、HTTPS 走系统浏览器(设置页可分别调整)
- **💻 真实终端**:xterm.js + node-pty 真实 shell,断线重连回放;可选为模型注入 `terminal_*` 工具
- **📂 模型侧边栏打开(可选)**:全局设置开启后注入 `sidebar_open` 工具——模型可主动在侧边栏打开文件 / 文件夹(树以该目录为根)/ HTTP(S) 网页
-- **🌿 文件变动**:Git 视角(真 diff / 历史 / 暂存·提交·还原 / worktree·子仓库选择)与本轮文件视角(模型读 / 写 / 编辑实时追踪,按文件分组、按类型筛选)**双视角合一**;统一 diff 渲染(改蓝配对 + 行内字符级高亮 + 语法着色(含 mjs/cjs/mts/cts、CSS/SCSS/Less、HTML/XML/SVG/Vue、GraphQL、JSONC/JSON5)+ 上下文折叠),底部可拖拽预览面板,可一键展开为独立 diff tab(默认自由浮窗,可在设置改为面板下半 split);`.md` 操作(读 / 写 / 编辑)预览头部可切换**阅读模式**——经共享 MarkdownText 渲染 GFM 表格 / 任务列表 / 删除线 / 脚注 / 数学公式,本地图片自动改写为 `/sidebar/file` 媒体路由;含 ```mermaid 围栏时走编辑器同款懒加载 mermaid 渲染器(图可点击缩放 / 平移);**敏感内容脱敏**——凭据形态路径整文件遮罩、普通文件按内容形态遮值(api_key: / Bearer / sk- / AKIA / ghp_ / PEM 等,字段名保留),默认开启、预览面板一键开关(localStorage 记忆),仅影响显示、不改会话数据。已知边界:mermaid 无引号节点标签含被遮密钥时,图回退源码(规避:标签加引号)
+- **🌿 文件变动**:Git 视角(真 diff / 历史 / 暂存·提交·还原 / worktree·子仓库选择)与本轮文件视角(模型读 / 写 / 编辑实时追踪,按文件分组、按类型筛选)**双视角合一**;统一 diff 渲染(改蓝配对 + 行内字符级高亮 + 语法着色(含 mjs/cjs/mts/cts、CSS/SCSS/Less、HTML/XML/SVG/Vue、GraphQL、JSONC/JSON5)+ 上下文折叠),底部可拖拽预览面板,可一键展开为独立 diff tab(默认自由浮窗,可在设置改为面板下半 split);`.md` 操作(读 / 写 / 编辑)预览头部可切换**阅读模式**——经共享 MarkdownText 渲染 GFM 表格 / 任务列表 / 删除线 / 脚注 / 数学公式,本地图片自动改写为 `/sidebar/file` 媒体路由;含 ```mermaid 围栏时走编辑器同款懒加载 mermaid 渲染器(图可点击缩放 / 平移);**敏感内容脱敏**——凭据形态路径整文件遮罩、普通文件按内容形态遮值(api_key: / Bearer / sk- / AKIA / ghp_ / PEM 等,字段名保留),默认开启、预览面板一键开关(localStorage 记忆),仅影响显示、不改会话数据。已知边界:mermaid 无引号节点标签含被遮密钥时,图回退源码(规避:标签加引号);`.html` 操作(读 / 写 / 编辑)预览头部可切换**渲染模式**——复用编辑器同款 `/sidebar/html` 路由 iframe,相对资源(./style.css、img/x.png)同路由解析,分段读取也渲染完整文档,恒定沙箱(opaque origin + CSP 头,无逃生门)
- **🧩 后台任务页**:subagent 拓扑 + 后台任务(退出码 / 实时输出 / 强制终止)
- **💬 侧边对话(beta)**:Codex 风格的侧边线程——继承主会话完整上下文(含进行中的回合与工具调用)独立运行,不进入主会话;线程内可持续追问,一键「保存为新会话」提升为顶层会话
- **🪟 双工作台**:右侧栏 + 底部面板;拖 Tab 拆分 / 合并分栏(可跨面板),移动端自动合并全宽抽屉
diff --git a/README_EN.md b/README_EN.md
index cafcde1..23053a8 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -44,7 +44,7 @@
- **🌐 Embedded Browser**: multiple web tabs with back / forward / refresh; content runs in a sandboxed iframe; external links are routed by protocol by default — HTTP opens in the sidebar, HTTPS goes to the system browser (both adjustable in settings)
- **💻 Real Terminal**: xterm.js + node-pty real shell, reconnect with transcript replay; optionally injects `terminal_*` tools for the model
- **📂 Model-driven sidebar opens (opt-in)**: with the global setting on, the `sidebar_open` tool lets the model actively open files / folders (tree rooted there) / HTTP(S) pages in the sidebar
-- **🌿 Changes**: one tab, two lenses — **Git** (real diff / history / stage·commit·revert / worktree & child-repo selection) and **This Session** (live tracking of every file the model reads / writes / edits, grouped by file with kind filters); a unified diff renderer (mod pairing + intra-line character highlights + syntax coloring incl. mjs/cjs/mts/cts, CSS/SCSS/Less, HTML/XML/SVG/Vue, GraphQL, JSONC/JSON5 + context folding), a draggable bottom preview pane, and one-click expansion into a dedicated diff tab; `.md` ops (read / write / edit) offer a **reading-mode** toggle in the preview header — the shared MarkdownText renders GFM tables / task lists / strikethrough / footnotes / math, with local images rewritten through the /sidebar/file media route; documents with ```mermaid fences render through the editor's lazy mermaid renderer (click-to-zoom / pan diagrams); **secret redaction** — credential-shaped paths mask whole files and ordinary files mask secret-shaped values (api_key: / Bearer / sk- / AKIA / ghp_ / PEM …, field names kept), on by default with a one-click preview-pane toggle (persisted in localStorage), display-only — session data untouched. Known edge: an unquoted mermaid label containing a redacted secret breaks the diagram (falls back to source); workaround: quote the label
+- **🌿 Changes**: one tab, two lenses — **Git** (real diff / history / stage·commit·revert / worktree & child-repo selection) and **This Session** (live tracking of every file the model reads / writes / edits, grouped by file with kind filters); a unified diff renderer (mod pairing + intra-line character highlights + syntax coloring incl. mjs/cjs/mts/cts, CSS/SCSS/Less, HTML/XML/SVG/Vue, GraphQL, JSONC/JSON5 + context folding), a draggable bottom preview pane, and one-click expansion into a dedicated diff tab; `.md` ops (read / write / edit) offer a **reading-mode** toggle in the preview header — the shared MarkdownText renders GFM tables / task lists / strikethrough / footnotes / math, with local images rewritten through the /sidebar/file media route; documents with ```mermaid fences render through the editor's lazy mermaid renderer (click-to-zoom / pan diagrams); **secret redaction** — credential-shaped paths mask whole files and ordinary files mask secret-shaped values (api_key: / Bearer / sk- / AKIA / ghp_ / PEM …, field names kept), on by default with a one-click preview-pane toggle (persisted in localStorage), display-only — session data untouched. Known edge: an unquoted mermaid label containing a redacted secret breaks the diagram (falls back to source); workaround: quote the label. `.html` ops (read / write / edit) gain a **Render** toggle in the preview head — the editor's `/sidebar/html` route iframe, with relative assets resolving inside the route and segmented reads rendering the full document; always sandboxed (opaque origin + CSP header, no escape hatch)
- **🧩 Background Tasks**: agent topology + background tasks (exit codes / live output / force-kill)
- **💬 Side Chat (beta)**: Codex-style side threads — the child inherits the parent's FULL context (completed turns + the pending question + the in-progress turn's assistant output and tool activity, honestly frozen as "interrupted") and runs independently without entering the main conversation; threads support continuous follow-ups (auto-resumed after a DSH restart) and one-click "Save as new session" promotion to a top-level session
- **🪟 Dual Workbench**: right sidebar + bottom panel; drag tabs to split / merge panes (cross-panel), mobile auto-merges into a full-width drawer
diff --git a/src/client/TextEditor.tsx b/src/client/TextEditor.tsx
index 459eaf0..48b0440 100644
--- a/src/client/TextEditor.tsx
+++ b/src/client/TextEditor.tsx
@@ -36,21 +36,13 @@ import { LazyMermaidMarkdown, MarkdownDocument, type MarkdownHtmlMedia } from '.
import { MdToc } from './md-toc.tsx'
import { splitMermaidBlocks } from './mermaid-blocks.ts'
import { t } from './locales.ts'
+import { HTML_IFRAME_SANDBOX } from './html-preview.ts'
import type { EditorToolbarState, FileViewerProps } from './service.ts'
import css from './sidebar.module.css'
/** Previewable files (rendered output vs source editing). */
type ViewMode = 'preview' | 'edit'
-/**
- * The sandbox tokens of the HTML preview iframe. NO allow-same-origin (the
- * preview must stay in an opaque origin — with the route's own origin it
- * could read session data) and NO allow-top-navigation (a previewed page
- * must not hijack the GUI). The user can disable the sandbox per-feature
- * in the side card settings (warned); the toggle below reflects it.
- */
-export const HTML_IFRAME_SANDBOX = 'allow-scripts allow-popups allow-downloads allow-modals'
-
/** Per-file preview scroll memory. Module-level so it survives viewer
* remounts: the save-then-switch-to-preview reload (EditorHost #215 case B)
* rebuilds the whole TextEditor instance, and without this the preview
diff --git a/src/client/changes/DiffPane.tsx b/src/client/changes/DiffPane.tsx
index 6a78adc..2eed59a 100644
--- a/src/client/changes/DiffPane.tsx
+++ b/src/client/changes/DiffPane.tsx
@@ -11,10 +11,11 @@
import { useEffect, useMemo, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'
import { IconCloseOutline16, IconRefreshOutline16, IconRightUpOutline16, MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
import type { SessionScope } from '../api.ts'
-import { api } from '../api.ts'
+import { api, htmlUrl } from '../api.ts'
import { t } from '../locales.ts'
import { baseName } from '../paths.ts'
import { resolveSidebarPath } from '../produced-files.ts'
+import { HTML_IFRAME_SANDBOX } from '../html-preview.ts'
import type { SidebarDiffRef, SidebarTab } from '../state.ts'
import { DiffRows, ReadRows } from '../diff/DiffRows.tsx'
import { DiffFiles } from '../diff/DiffFiles.tsx'
@@ -60,6 +61,24 @@ function diffOf(op: FileOp, prior: string | undefined): readonly DiffRow[] {
return []
}
+/** The render view of one html op target: the route-src iframe. Extracted
+ * (and exported) so the always-sandboxed contract is pinned directly by the
+ * sandbox spec — this surface has NO no-sandbox escape hatch. */
+export function HtmlRenderPreview(props: { src: string; title: string }) {
+ return (
+
diff --git a/src/client/changes/changes.module.css b/src/client/changes/changes.module.css
index f349c36..4236122 100644
--- a/src/client/changes/changes.module.css
+++ b/src/client/changes/changes.module.css
@@ -347,6 +347,8 @@
.mdToggle:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
.mdToggle[data-on='true'] { border-color: var(--dsw-alias-state-business-primary); color: var(--dsw-alias-state-business-primary); }
.mdBody { padding: 12px 16px 20px; font: var(--dsw-font-xs-regular-13); line-height: 1.6; min-height: 0; overflow-y: auto; }
+.htmlPane { flex: 1; min-height: 0; display: flex; }
+.htmlFrame { flex: 1; width: 100%; border: 0; background: #fff; }
.diffPane { border-top: 1px solid var(--dsw-alias-border-l1); display: flex; flex-direction: column; flex: none; min-height: 0; }
.dragHandle { flex: none; height: 8px; cursor: ns-resize; position: relative; background: var(--dsw-alias-bg-base); }
diff --git a/src/client/html-preview.ts b/src/client/html-preview.ts
new file mode 100644
index 0000000..6bc9e5b
--- /dev/null
+++ b/src/client/html-preview.ts
@@ -0,0 +1,15 @@
+/**
+ * Shared vocabulary of the sidebar's HTML preview surfaces (the editor's
+ * html viewer and the changes tab's op render preview): the sandbox tokens
+ * both preview iframes load with.
+ */
+
+/**
+ * The sandbox tokens of an HTML preview iframe. NO allow-same-origin (the
+ * preview must stay in an opaque origin — with the route's own origin it
+ * could read session data) and NO allow-top-navigation (a previewed page
+ * must not hijack the GUI). The editor viewer can disable the sandbox
+ * per-feature in the side card settings (warned); the changes tab's op
+ * render preview always stays sandboxed.
+ */
+export const HTML_IFRAME_SANDBOX = 'allow-scripts allow-popups allow-downloads allow-modals'
diff --git a/src/client/locales-ar.ts b/src/client/locales-ar.ts
index a453ae2..e2c103e 100644
--- a/src/client/locales-ar.ts
+++ b/src/client/locales-ar.ts
@@ -21,6 +21,8 @@ export const ar: Record = {
changesSessionEmpty: 'لا توجد عمليات ملفات في هذه الجلسة بعد',
changesRead: 'قراءة',
changesMdReading: 'قراءة',
+ changesHtmlRender: "عرض",
+ changesHtmlRaw: "المصدر",
changesMdRaw: 'الخام',
changesWrite: 'كتابة',
changesEdit: 'تحرير',
diff --git a/src/client/locales-de.ts b/src/client/locales-de.ts
index 4e76a6f..a99b8b6 100644
--- a/src/client/locales-de.ts
+++ b/src/client/locales-de.ts
@@ -6,6 +6,8 @@ export const de: Record = {
changesSessionEmpty: 'Noch keine Dateioperationen in dieser Sitzung',
changesRead: 'Lesen',
changesMdReading: 'Lesen',
+ changesHtmlRender: "Rendern",
+ changesHtmlRaw: "Quelltext",
changesMdRaw: 'Rohfassung',
changesWrite: 'Schreiben',
changesEdit: 'Bearbeiten',
diff --git a/src/client/locales-fr.ts b/src/client/locales-fr.ts
index 33c6f7e..44eeb74 100644
--- a/src/client/locales-fr.ts
+++ b/src/client/locales-fr.ts
@@ -13,6 +13,8 @@ export const fr: Record = {
changesSessionEmpty: 'Aucune opération de fichier dans cette session',
changesRead: 'Lecture',
changesMdReading: 'Lecture',
+ changesHtmlRender: "Rendu",
+ changesHtmlRaw: "Source",
changesMdRaw: 'Brut',
changesWrite: 'Écriture',
changesEdit: 'Modification',
diff --git a/src/client/locales-hi.ts b/src/client/locales-hi.ts
index 5d42431..dba4566 100644
--- a/src/client/locales-hi.ts
+++ b/src/client/locales-hi.ts
@@ -20,6 +20,8 @@ export const hi: Record = {
changesSessionEmpty: 'इस सत्र में अभी कोई फ़ाइल ऑपरेशन नहीं',
changesRead: 'पढ़ना',
changesMdReading: 'पठन',
+ changesHtmlRender: "रेंडर",
+ changesHtmlRaw: "मूल",
changesMdRaw: 'मूल पाठ',
changesWrite: 'लिखना',
changesEdit: 'संपादन',
diff --git a/src/client/locales-id.ts b/src/client/locales-id.ts
index d059b83..a0241f0 100644
--- a/src/client/locales-id.ts
+++ b/src/client/locales-id.ts
@@ -18,6 +18,8 @@ export const id: Record = {
changesSessionEmpty: 'Belum ada operasi file di sesi ini',
changesRead: 'Baca',
changesMdReading: 'Baca',
+ changesHtmlRender: "Render",
+ changesHtmlRaw: "Sumber",
changesMdRaw: 'Mentah',
changesWrite: 'Tulis',
changesEdit: 'Edit',
diff --git a/src/client/locales-it.ts b/src/client/locales-it.ts
index eff3685..8463614 100644
--- a/src/client/locales-it.ts
+++ b/src/client/locales-it.ts
@@ -11,6 +11,8 @@ export const it: Record = {
changesSessionEmpty: 'Ancora nessuna operazione sui file in questa sessione',
changesRead: 'Lettura',
changesMdReading: 'Lettura',
+ changesHtmlRender: "Render",
+ changesHtmlRaw: "Sorgente",
changesMdRaw: 'Grezzo',
changesWrite: 'Scrittura',
changesEdit: 'Modifica',
diff --git a/src/client/locales-ja.ts b/src/client/locales-ja.ts
index 91f9488..4f01772 100644
--- a/src/client/locales-ja.ts
+++ b/src/client/locales-ja.ts
@@ -20,6 +20,8 @@ export const ja: Record = {
changesSessionEmpty: 'このセッションにはファイル操作がまだありません',
changesRead: '読み取り',
changesMdReading: '閲覧',
+ changesHtmlRender: "レンダリング",
+ changesHtmlRaw: "原文",
changesMdRaw: '原文',
changesWrite: '書き込み',
changesEdit: '編集',
diff --git a/src/client/locales-ko.ts b/src/client/locales-ko.ts
index 29ced15..46e6500 100644
--- a/src/client/locales-ko.ts
+++ b/src/client/locales-ko.ts
@@ -12,6 +12,8 @@ export const ko: Record = {
changesSessionEmpty: '이 세션에 아직 파일 작업이 없습니다',
changesRead: '읽기',
changesMdReading: '읽기',
+ changesHtmlRender: "렌더링",
+ changesHtmlRaw: "원문",
changesMdRaw: '원문',
changesWrite: '쓰기',
changesEdit: '편집',
diff --git a/src/client/locales-nl.ts b/src/client/locales-nl.ts
index 5d96712..46358e3 100644
--- a/src/client/locales-nl.ts
+++ b/src/client/locales-nl.ts
@@ -18,6 +18,8 @@ export const nl: Record = {
changesSessionEmpty: 'Nog geen bestandsbewerkingen in deze sessie',
changesRead: 'Lezen',
changesMdReading: 'Lezen',
+ changesHtmlRender: "Renderen",
+ changesHtmlRaw: "Bron",
changesMdRaw: 'Brontekst',
changesWrite: 'Schrijven',
changesEdit: 'Bewerken',
diff --git a/src/client/locales-pl.ts b/src/client/locales-pl.ts
index 6fb4876..512f817 100644
--- a/src/client/locales-pl.ts
+++ b/src/client/locales-pl.ts
@@ -22,6 +22,8 @@ export const pl: Record = {
changesSessionEmpty: 'Brak operacji na plikach w tej sesji',
changesRead: 'Odczyt',
changesMdReading: 'Czytanie',
+ changesHtmlRender: "Renderuj",
+ changesHtmlRaw: "Źródło",
changesMdRaw: 'Źródło',
changesWrite: 'Zapis',
changesEdit: 'Edycja',
diff --git a/src/client/locales-pt.ts b/src/client/locales-pt.ts
index ea27600..bdd8ce5 100644
--- a/src/client/locales-pt.ts
+++ b/src/client/locales-pt.ts
@@ -3,6 +3,8 @@ export const pt: Record = {
changesSessionEmpty: 'Ainda sem operações de arquivo nesta sessão',
changesRead: 'Leitura',
changesMdReading: 'Leitura',
+ changesHtmlRender: "Renderizar",
+ changesHtmlRaw: "Fonte",
changesMdRaw: 'Bruto',
changesWrite: 'Escrita',
changesEdit: 'Edição',
diff --git a/src/client/locales-ru.ts b/src/client/locales-ru.ts
index b6dfce2..43f6fda 100644
--- a/src/client/locales-ru.ts
+++ b/src/client/locales-ru.ts
@@ -16,6 +16,8 @@ export const ru: Record = {
changesSessionEmpty: 'В этой сессии пока нет файловых операций',
changesRead: 'Чтение',
changesMdReading: 'Чтение',
+ changesHtmlRender: "Рендер",
+ changesHtmlRaw: "Исходник",
changesMdRaw: 'Исходный текст',
changesWrite: 'Запись',
changesEdit: 'Изменение',
diff --git a/src/client/locales-sv.ts b/src/client/locales-sv.ts
index f587881..0e079c1 100644
--- a/src/client/locales-sv.ts
+++ b/src/client/locales-sv.ts
@@ -3,6 +3,8 @@ export const sv: Record = {
changesSessionEmpty: 'Inga filoperationer i den här sessionen ännu',
changesRead: 'Läs',
changesMdReading: 'Läsning',
+ changesHtmlRender: "Rendera",
+ changesHtmlRaw: "Källa",
changesMdRaw: 'Råtext',
changesWrite: 'Skriv',
changesEdit: 'Redigera',
diff --git a/src/client/locales-th.ts b/src/client/locales-th.ts
index 1b5657a..a36104d 100644
--- a/src/client/locales-th.ts
+++ b/src/client/locales-th.ts
@@ -20,6 +20,8 @@ export const th: Record = {
changesSessionEmpty: 'ยังไม่มีการดำเนินการไฟล์ในเซสชันนี้',
changesRead: 'อ่าน',
changesMdReading: 'อ่าน',
+ changesHtmlRender: "เรนเดอร์",
+ changesHtmlRaw: "ต้นฉบับ",
changesMdRaw: 'ดิบ',
changesWrite: 'เขียน',
changesEdit: 'แก้ไข',
diff --git a/src/client/locales-tr.ts b/src/client/locales-tr.ts
index a299629..ba58f51 100644
--- a/src/client/locales-tr.ts
+++ b/src/client/locales-tr.ts
@@ -20,6 +20,8 @@ export const tr: Record = {
changesSessionEmpty: 'Bu oturumda henüz dosya işlemi yok',
changesRead: 'Okuma',
changesMdReading: 'Okuma',
+ changesHtmlRender: "Render",
+ changesHtmlRaw: "Kaynak",
changesMdRaw: 'Ham',
changesWrite: 'Yazma',
changesEdit: 'Düzenleme',
diff --git a/src/client/locales-vi.ts b/src/client/locales-vi.ts
index 3c8ee06..5f93c25 100644
--- a/src/client/locales-vi.ts
+++ b/src/client/locales-vi.ts
@@ -20,6 +20,8 @@ export const vi: Record = {
changesSessionEmpty: 'Chưa có thao tác tệp nào trong phiên này',
changesRead: 'Đọc',
changesMdReading: 'Đọc',
+ changesHtmlRender: "Kết xuất",
+ changesHtmlRaw: "Nguyên văn",
changesMdRaw: 'Gốc',
changesWrite: 'Ghi',
changesEdit: 'Chỉnh sửa',
diff --git a/src/client/locales-zh-HK.ts b/src/client/locales-zh-HK.ts
index 98e20ac..25954cf 100644
--- a/src/client/locales-zh-HK.ts
+++ b/src/client/locales-zh-HK.ts
@@ -35,6 +35,8 @@ export const zhHK: Record = {
changesSessionEmpty: '本工作階段還沒有檔案操作',
changesRead: '讀取',
changesMdReading: '閱讀',
+ changesHtmlRender: "渲染",
+ changesHtmlRaw: "原文",
changesMdRaw: '原文',
changesWrite: '寫入',
changesEdit: '編輯',
diff --git a/src/client/locales-zh-MO.ts b/src/client/locales-zh-MO.ts
index d0b3dd1..c010591 100644
--- a/src/client/locales-zh-MO.ts
+++ b/src/client/locales-zh-MO.ts
@@ -35,6 +35,8 @@ export const zhMO: Record = {
changesSessionEmpty: '本工作階段還沒有檔案操作',
changesRead: '讀取',
changesMdReading: '閱讀',
+ changesHtmlRender: "渲染",
+ changesHtmlRaw: "原文",
changesMdRaw: '原文',
changesWrite: '寫入',
changesEdit: '編輯',
diff --git a/src/client/locales-zh-TW.ts b/src/client/locales-zh-TW.ts
index 09b1965..ca52b85 100644
--- a/src/client/locales-zh-TW.ts
+++ b/src/client/locales-zh-TW.ts
@@ -35,6 +35,8 @@ export const zhTW: Record = {
changesSessionEmpty: '本作業階段還沒有檔案操作',
changesRead: '讀取',
changesMdReading: '閱讀',
+ changesHtmlRender: "渲染",
+ changesHtmlRaw: "原文",
changesMdRaw: '原文',
changesWrite: '寫入',
changesEdit: '編輯',
diff --git a/src/client/locales.ts b/src/client/locales.ts
index a9714b1..d8a69f2 100644
--- a/src/client/locales.ts
+++ b/src/client/locales.ts
@@ -28,6 +28,8 @@ export const zh = {
changesRead: '读取',
changesMdReading: '阅读',
changesMdRaw: '原文',
+ changesHtmlRender: '渲染',
+ changesHtmlRaw: '原文',
changesWrite: '写入',
changesEdit: '编辑',
changesRunning: '执行中',
@@ -464,6 +466,8 @@ export const en: Record = {
changesRead: 'Read',
changesMdReading: 'Reading',
changesMdRaw: 'Raw',
+ changesHtmlRender: 'Render',
+ changesHtmlRaw: 'Raw',
changesWrite: 'Write',
changesEdit: 'Edit',
changesRunning: 'running',
diff --git a/tests/sandbox-views.spec.tsx b/tests/sandbox-views.spec.tsx
index 2b88157..5cc9660 100644
--- a/tests/sandbox-views.spec.tsx
+++ b/tests/sandbox-views.spec.tsx
@@ -12,7 +12,9 @@ import { renderToString } from 'react-dom/server'
import { createElement } from 'react'
import './browser-globals.ts'
import type { Context } from '../src/context-types.ts'
-import { TextEditor, HTML_IFRAME_SANDBOX } from '../src/client/TextEditor.tsx'
+import { TextEditor } from '../src/client/TextEditor.tsx'
+import { HTML_IFRAME_SANDBOX } from '../src/client/html-preview.ts'
+import { DiffPane, HtmlRenderPreview } from '../src/client/changes/DiffPane.tsx'
import { BrowserView, BrowserEmbedBlocked, BROWSER_IFRAME_SANDBOX, iframeSandboxFor } from '../src/client/BrowserView.tsx'
import { createSidebarStore } from '../src/client/state.ts'
import type { FileViewerProps } from '../src/client/service.ts'
@@ -109,6 +111,53 @@ describe('HTML preview iframe sandbox', () => {
})
})
+describe('changes tab HTML render preview sandbox', () => {
+ function opProps(path: string) {
+ return {
+ target: {
+ kind: 'op' as const,
+ path,
+ op: { callId: 'c1', kind: 'read' as const, path, time: 0, running: false, isError: false, read: '1: hi' },
+ },
+ scope: { sessionId: 's1', cwd: '/p' },
+ height: 300,
+ onHeightCommit: () => {},
+ onClose: () => {},
+ onExpand: () => {},
+ }
+ }
+
+ it('render iframe is ALWAYS sandboxed (no escape hatch) with the route src, never srcdoc', () => {
+ const html = renderToString(createElement(HtmlRenderPreview, { src: '/sidebar/html/s1/p/a/index.html', title: '/p/a/index.html' }))
+ const iframe = /