DSH / Atlas
2026-09-17implementedfeaturearchived 2026-09-30

Shared developer-tool settings

共享开发者工具设置

Diagnostic views, preset selection and changed-file summaries add complexity to routine tasks. Scripted HTML also grants capabilities that a basic document preview does not need. Desktop and Web share these renderers, so independent switches would let the same setting produce different results across clients.

English

Problem

Diagnostic views, preset selection and changed-file summaries add complexity to routine tasks. Scripted HTML also grants capabilities that a basic document preview does not need. Desktop and Web share these renderers, so independent switches would let the same setting produce different results across clients.

Decision

The settings-owned ctx.configForms.developerTools preference uses a shared entry form and exposes one accepted ui-settings.enabled preference. The initial default-off choice reduces routine-task complexity; Developer tools default on after preference resolution supersedes that default and owns startup enablement. General Settings offers the same switch on Web and desktop. The existing settings transport owns validation, ordered writes, persistence and recovery; loopback Web and desktop follow Host acceptance. Remote Web owns one browser-local observable shared by all consumers until reload, with no Host writes.

Off hides the Trajectory View, hides tool Inspect actions when no visible View declares tool-call inspection, hides the conversation View tab bar while fewer than two Views are available, hides built-in PTC and Minimal choices, and omits the changed-files card and its summary read. Views registered by other plugins stay available. Turning it off while Trajectory is active activates Chat. Existing Session presets, Session events and explicit delivery cards remain unchanged. Preset choices, default correction and unapplied selections follow the preset UI policy. This preference is presentation policy, not Host authorization.

Plugin assembly translates the shared preference into component-specific capabilities (showCodeDiff, the new-session preset chip's developerTools, and interactivePreview). Conversation supplies the inspection callback using the visible target's toolCallFocus; Chat does not name the target. The builtin HTML renderer uses DOMPurify for complete-document sanitization and parser-mutation defenses. Off preserves root styling, removes active documents, resource hints, SVG animation and all href attributes, and mounts an iframe with no sandbox permissions and a CSP denying scripts and external resources. It reads no related files. On retains the opaque scripted Blob renderer and its bounded related-file reads. Switching modes replaces the browsing context and disposes pending reads. The document-preview decision and filesystem-read authority remain authoritative for advanced rendering and Host read access.

Alternatives considered

Limit the switch to desktop. The selected requirement contains no desktop-only restriction, and the affected UI is shared. A desktop check would leave the Web renderer with inconsistent visibility and preview behavior.

Hide controls without changing the active View or iframe. Previously selected diagnostic content and already-running scripts would survive the toggle. Filtering the available View roster and remounting the HTML context enforce the selected presentation immediately.

Consequences

Basic HTML sacrifices JavaScript, external and related resources, and link navigation; inline styles and data images remain available. Advanced mode retains normal browser networking and does not gain parent-origin, popup, form or top-navigation privileges. The setting does not constrain third-party preview implementations or revoke Host filesystem authority.

Component and settings tests cover defaulting, schema rejection, accepted-state updates, preset choice visibility, changed-file visibility and iframe disposal. The recorded-session document preview and changed-files scenarios exercise the real settings control and the shared renderer. The browser scaffold uses the shipped default unless a scenario specifies a preference. Settings chrome, document preview and changed-files scenarios explicitly disable developer tools; together they cover hidden diagnostic controls, static previews, and switching back to Chat. Refused Host writes recover accepted state and show the localized retry message. Native Electron execution remains unverified.

中文

Problem

诊断视图、预设选择和改动文件摘要增加了日常任务的复杂度。支持脚本的 HTML 还授予了基础文档预览不需要的能力。桌面端和 Web 共享这些渲染器,分别设置开关会让同一设置在不同客户端产生不同结果。

Decision

设置域内的 ctx.configForms.developerTools 偏好对象使用共享条目表单,提供一个已接受的 ui-settings.enabled 偏好。最初默认关闭的选择用于降低日常任务的复杂度;偏好解析后默认开启开发者工具取代该默认值并负责启动时的启用策略。Web 和桌面端的通用设置提供同一个开关。现有设置传输负责验证、有序写入、持久化和恢复;回环 Web 和桌面端跟随 Host 接受的状态。远程 Web 持有一个所有消费者共享的浏览器本地可观察值,刷新后重置,不发送 Host 写入。

关闭时隐藏 Trajectory View,在没有可见 View 声明工具调用检查能力时隐藏 Inspect 操作,可见 View 少于两个时隐藏会话 View 标签栏,隐藏内置 PTC 和极简选项,并省略改动文件卡片及其摘要读取。其他插件注册的 View 保持可用。在 Trajectory 中关闭开关会激活 Chat。已有 Session 的预设、Session 事件和显式交付卡片保持不变。预设选项、默认值修正和尚未应用的选择遵循预设 UI 策略。此偏好是展示策略,不是 Host 授权。

插件组装层将共享偏好转换为组件自身的能力(showCodeDiff、新会话预设入口读取的 developerTools,以及 interactivePreview)。Conversation 根据可见目标的 toolCallFocus 提供检查回调;Chat 不再指定目标名称。内置 HTML 渲染器使用 DOMPurify 清理完整文档并防护解析变异。关闭时保留根节点样式,移除主动文档、资源提示、SVG 动画及所有 href 属性,再放入不授予沙箱权限的 iframe,并通过 CSP 禁止脚本和外部资源。不读取关联文件。开启时保留不透明源的脚本 Blob 渲染器及其有界关联文件读取。切换模式会替换浏览上下文并清理待处理读取。文档预览决策和文件系统读取权限继续定义高级渲染与 Host 读取访问。

Alternatives considered

仅在桌面端提供开关。 所选需求没有仅限桌面的约束,相关 UI 也是共享的。桌面端条件判断会让 Web 渲染器的展示和预览行为不一致。

隐藏控件但不改变激活的 View 或 iframe。 之前选择的诊断内容和已经运行的脚本会在切换后继续存在。过滤可用 View 并重新挂载 HTML 上下文,可以立即执行所选展示策略。

Consequences

基础 HTML 放弃 JavaScript、外部与关联资源和链接导航;行内样式与 data 图片仍可用。高级模式保留正常浏览器网络能力,不增加父源、弹窗、表单或顶层导航权限。此设置不约束第三方预览实现,也不撤销 Host 文件系统读取权限。

组件和设置测试覆盖默认值、schema 拒绝、已接受状态更新、预设选项展示、改动文件展示和 iframe 清理。基于已记录 Session 的文档预览与改动文件场景验证真实设置控件及共用渲染器。浏览器脚手架使用产品默认值,除非场景指定偏好。设置外壳、文档预览和改动文件场景显式关闭开发者工具;这些场景共同覆盖诊断控件隐藏、静态预览和切回 Chat。Host 拒绝写入后会恢复已接受状态,并显示本地化重试提示。原生 Electron 执行尚未验证。