@him666233/dsh-inline-diff 0.0.0-stage → 1.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Him666233
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,125 @@
1
+ # Inline Diff
2
+
3
+ [中文](README.md) | English
4
+
5
+ > **Originality notice (important)**: This project is **an entirely original work**. It has **no relationship whatsoever** with [JanEickholt/dsh-inline-diff](https://github.com/JanEickholt/dsh-inline-diff) **or any other plugin, repository, or project with the same or a similar name**. This project did not reference, copy, or port any of those projects; the implementation approach, module split, code organization, and final rendering are completely different. Any similarity in part of the functionality (inline diff display in conversations) is **coincidental** — this project only discovered the same-named/similar project when searching for similar plugins after the implementation was already complete. This project is **not** a derivative work, a re-creation, or a fork of any other project.
6
+
7
+ DeepSeek Harness plugin: renders inline diff cards in place for every `edit` / `write` / `str_replace_editor` call in the conversation, automatically detects the file language (57 languages) and applies red/green-safe syntax highlighting, and provides side-by-side comparison, inline character-level highlighting, moved-block and passive line-number annotations, and Read range display; command, search, web, and generic tool calls can also switch to the expanded style (IN/OUT open by default), and command and tool cards color their input/output status per segment. **Since 1.3.0 the UI and documentation are fully bilingual (Chinese / English), with an independent language switch on the settings page (Chinese by default).**
8
+
9
+ - **Author**: [Him666233](https://github.com/Him666233)
10
+ - **Repository**: [Him666233/dsh-inline-diff](https://github.com/Him666233/dsh-inline-diff)
11
+ - **License**: MIT
12
+ - **npm**: `@him666233/dsh-inline-diff`
13
+ - **Current version**: 1.3.0
14
+
15
+ > “Expanded style / Expanded” in the settings means the expanded, flat, transparent output style of modern coding agents; the project contains no third-party product brand names.
16
+
17
+ ## Compatibility
18
+
19
+ - **DSH version range (`engines.dsh`)**: `>=0.2.2-rc.1 <0.3.0`
20
+ - **Tested version**: `0.2.2-rc.1`
21
+ - Outside the `engines.dsh` range, the DSH loader refuses to load the plugin and never silently runs an unverified version
22
+ - If the desktop app and the Web UI use different profiles, the plugin must be installed separately in each
23
+ - Does not shadow the tool-call entries of `conversation.chat.node` (the official Tool layer owns that entry and declares the `tool.call.toolview` sub-slot, and declaring it again throws); only registered tool rows are taken over through keyed `tool.call.toolview`, and unregistered tools keep the official generic row
24
+ - Does not take over slots from startup-animation plugins; animation keyframes use a separate namespace (`dsh-inline-diff-*`), and the Read range observer only reacts to Read-row-related DOM changes, avoiding contention with startup animations for the main thread
25
+ - Coexists with third-party themes: keyed `tool.call.toolview` uses priority `-100` to avoid duplicate-key conflicts with theme plugins that also register tool views (e.g. claude-style registers at `-1`); card headers carry an `aria-haspopup="false"` exemption and only respond to real user gestures, so a theme replaying a synthetic click when its fold animation ends cannot turn “Expand / Trace / file path” clicks into a card collapse
26
+
27
+ ## Installation
28
+
29
+ Install from npm in DSH (recommended):
30
+
31
+ ```bash
32
+ dsh plugin add @him666233/dsh-inline-diff
33
+ ```
34
+
35
+ You can also install it from the DSH Web UI under **Plugins → Add plugin** by entering the package name directly. If the desktop app and the Web UI use different profiles, install in each; refresh the page or restart DSH after the plugin loads. The npm package name is written both in this package's `cordis.patch.yml` (the bundle plugin's module name) and in `client.js` (the browser module id) — never change just one of them.
36
+
37
+ Other installation methods (the older methods remain available):
38
+
39
+ - **Local directory / offline install**: hand this directory (`plugin/`) to DSH under **Plugins → Add plugin** (enter the absolute path), or extract `dsh-inline-diff-<version>-plugin.zip` from a Release and select the extracted `plugin/` directory;
40
+ - **Manual link (development/debugging)**: see below;
41
+ - **Upgrade**: `dsh plugin add @him666233/dsh-inline-diff@<version>`, or uninstall and reinstall from the plugin page; **uninstall**: `dsh plugin remove @him666233/dsh-inline-diff` (or uninstall from the plugin page). Do not keep a link copy and an npm copy in the same profile.
42
+
43
+ For local development or offline install, install this directory (`plugin/`) as a local plugin, or link it manually:
44
+
45
+ ```bash
46
+ cd ~/.dsh/profiles/<profile>
47
+ pnpm add link:/absolute/path/to/dsh-inline-diff/plugin
48
+ ```
49
+
50
+ Then add the following to the profile's `package.json`:
51
+
52
+ ```json
53
+ {
54
+ "dependencies": {
55
+ "@him666233/dsh-inline-diff": "link:/absolute/path/to/dsh-inline-diff/plugin"
56
+ },
57
+ "dsh": {
58
+ "profile": {
59
+ "bundles": ["@him666233/dsh-inline-diff"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Features
66
+
67
+ - Per-edit inline diff for edit / write / str_replace_editor with exact old/new line numbers; each change carries an OLD / NEW legend above its gutter (strictly aligned with the gutter; changes with line numbers on only one side, such as a new file, show only that side), removed lines' old numbers are tinted red and added lines' new numbers tinted green and bolded;
68
+ - Compact gutter and clearer card borders: content is inset and code starts further left, while added/removed color bars still run edge to edge;
69
+ - Inline character-level highlighting that marks only genuinely changed fragments in deep red/deep green; whitespace and punctuation shared by both sides of a replacement merge into the change region to form one continuous highlight band, and isolated whitespace/punctuation differences are never falsely marked;
70
+ - Moved blocks labeled “moved to / moved from old/new Lx–Ly” (single-line moves are judged by display width and annotated only at ≥12 cells); passive line-number shifts explained as `old Lx–Ly → new Lm–Ln · line numbers shifted ±N`;
71
+ - Side-by-side dialog and whole-file comparison (backed by the Host's in-memory snapshot); Changes mode groups by change with sticky change headers, and the replay notice banner and “Before / After” bars stay fixed below the title while the scrollbar belongs only to the comparison content;
72
+ - Fixed file/change headers; when a Read row is collapsed, the actual line range appears next to the file name (disjoint ranges separated by ` · `, omitted after 4 segments), and expanding it keeps DSH's native presentation;
73
+ - Automatic file-language detection (57 languages, by extension, special filenames, and shebang first line) with a language badge in the card header and the expanded dialog (short code / full name / hidden; “Hidden” hides every badge; while badges are visible an unknown language can show a dashed badge; plain text shows a “Plain text” marker);
74
+ - Per-language syntax highlighting: code lines in inline cards and the side-by-side dialog are colored consistently; the palette is limited to the blue→purple range (hue 180°–285°) and deliberately avoids red/green/orange/yellow/magenta so it never reads as an added/removed marker; every foreground color reaches ≥ 4.5:1 contrast on the official dark/light code surfaces; when highlighting is off, or the language is unknown or plain text, it falls back to the default foreground color (following light/dark appearance);
75
+ - Four syntax-highlighting settings: on/off, language badge (short code / full name / hidden), unknown language (show / hide), and font emphasis (color + font style / color only: keywords etc. bold, comments italic); the settings page can expand to view the 57 supported languages;
76
+ - grep / glob / web_search / web_fetch share the expanded style with generic tool calls: category icon, keyword/path/URL summary, match/file/source/HTTP-status badges, and IN/OUT open by default;
77
+ - Inline diff cards and all expanded-style tool rows share the same “Trace” pill button;
78
+ - The left color bar of command and tool-call cards shows status independently for IN/OUT: IN preparing/awaiting output = theme color (pulsing), input side completed = green, input side failed = red; OUT running = theme color (pulsing, with a “Running…” placeholder), output succeeded = green, execution failed/non-zero exit = red, user aborted = warning color; failures are attributed to the input or output side by error code (falling back to whether the raw arguments form a valid JSON object when the code is missing), and the OUT segment is marked “Skipped” when the input side fails; input-side failures turn IN code red and output-side failures turn OUT code red, while normal text follows the inner tone and light/dark appearance;
79
+ - File-change, command, and other tool-call cards all use the “shell + inner” two-tone structure; the shell follows the current theme (including third-party themes) — derived colors resolve at the `body` layer, so both the official stock theme (tokens on `body`) and skin themes (tokens on `:root`) are followed correctly and no tint of the previous theme remains after switching; the inner area uses the code-block surface and matching text color of the official light/dark appearance; the three card types can each configure shell/inner tones (shell: auto / light / dark; inner: auto / light / dark / same as shell);
80
+ - Reads the host's actual light/dark appearance (light / dark / follow system); cards and the settings window automatically use readable backgrounds and text colors, so a third-party theme switching to light never produces light-on-light text; dialogs and cards are opaque surfaces and never show the wallpaper through;
81
+ - Four independent display options: file cards, command rows, other tool calls, and process folding; the settings dialog has a fixed title bar with independently scrolling content and scrollbars that hug or inset from their regions as appropriate.
82
+
83
+ ## Settings
84
+
85
+ Bottom of the sidebar → “Diff style”, or the DSH settings page → “Inline Diff”:
86
+
87
+ **Language (new in 1.3.0)**:
88
+
89
+ | Setting | Options |
90
+ | --- | --- |
91
+ | Language | 中文 (default) / English / Follow DSH |
92
+
93
+ Changes take effect immediately without a refresh and never modify DSH's global language; documentation language: Chinese is the default ([README.md](README.md)), and English is in this file ([README.en.md](README.en.md)). The top of the settings page also shows a prominent originality notice: this project is a fully original work and has no relationship with any same-named/similar plugin (including [JanEickholt/dsh-inline-diff](https://github.com/JanEickholt/dsh-inline-diff)).
94
+
95
+ Four display styles:
96
+
97
+ | Setting | Expanded / Unfolded | DSH native |
98
+ | --- | --- | --- |
99
+ | File-change cards | This plugin's inline diff cards | The official file-mutation row |
100
+ | Command rows | Flat command row with IN/OUT open | The official bash / pwsh / win_bash row |
101
+ | Other tool calls | Generic/details/search/web tools open IN/OUT | The official cards |
102
+ | Process folding | Writes the DSH verbose preference | Keeps your existing preference |
103
+
104
+ When “Other tool calls → Expanded” is enabled while “Process folding” is still DSH native, the plugin automatically switches it to “Unfolded”; otherwise completed tool rows would be hidden by DSH folding groups.
105
+
106
+ Syntax highlighting and language badge (independent of the table above):
107
+
108
+ | Setting | Options |
109
+ | --- | --- |
110
+ | Syntax highlighting | On / Off |
111
+ | Language badge | Short code / Full name / Hidden |
112
+ | Unknown language | Show “Unknown” / Hide |
113
+ | Font emphasis | Color + font style / Color only |
114
+
115
+ Settings are saved in localStorage (`dsh-inline-diff.settings.v4`); old v3 / v2 values are migrated automatically and the old keys are removed.
116
+
117
+ ## Data and limitations
118
+
119
+ The plugin makes no network requests and has no telemetry, and the client uses no `innerHTML` / `dangerouslySetInnerHTML` / `eval`. The Host keeps only the before/after text needed for display in in-memory snapshots (LRU: at most 240 entries, 4 MB per side, plus a 64 MB total cap) and never writes it to disk; the Host read-only APIs are protected by the DSH browser trust boundary (`connection` admission, falling back to a local loopback fence when that service is unavailable), with a 1 MB request-body cap, JSON-only bodies, a 10-second request-read timeout, a 15-second file-read timeout, and an 8-concurrent-read limit. Very large files and very long single lines have a materialization budget on the browser side (200k lines / 1,000,000 characters per line); beyond it the plugin automatically degrades to changed hunks with a reason notice and never freezes the page. The Host saves snapshots only for `edit` / `write`, while `str_replace_editor` shows the changed hunks from the tool metadata and tries to locate line numbers — its card and the expanded dialog use a dedicated “this tool call keeps no execution snapshot” notice (not history-replay wording); after an app restart, history replay is likewise explained in the expanded dialog. In extreme cases the plugin falls back step by step: “snapshot → current-file read → tool-metadata changed hunks → explicit explanation”; the UI language, settings storage, and syntax highlighting also have Chinese / default-value fallbacks, so the final outcome is a readable explanation rather than a silent failure. History-replay line numbers are located again in the current file; if the file has since changed and the hunk cannot be located uniquely, “line numbers pending” is shown and the dialog explains that only the changed hunks can be shown. The same card shows the execution snapshot of that edit and does not refresh as the file changes later; the full display behavior (snapshot semantics, refresh rules, line-number legend, dialog layering and scrolling, performance notes) is documented in the repository's [docs/display-behavior.en.md](https://github.com/Him666233/dsh-inline-diff/blob/main/docs/display-behavior.en.md).
120
+
121
+ For the full documentation, internal architecture, and known limitations, see the repository's [README](https://github.com/Him666233/dsh-inline-diff/blob/main/README.en.md).
122
+
123
+ ## License
124
+
125
+ MIT © 2026 [Him666233](https://github.com/Him666233)
package/README.md CHANGED
@@ -1,3 +1,125 @@
1
- # Temporary Holding Version
1
+ # Inline Diff · 内联差异
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 中文(默认)| [English](README.en.md)
4
+
5
+ > **原创声明(重要)**:本项目是**完全原创**的作品,与 [JanEickholt/dsh-inline-diff](https://github.com/JanEickholt/dsh-inline-diff) **以及任何其他同名插件、仓库或项目没有任何关系**。本项目没有参考、复制或移植上述项目;两者的实现方式、模块划分、代码组织与最终渲染效果完全不同。部分功能相似(对话内联差异展示)纯属**雷同巧合**——本项目是在完成实现之后搜索同类插件时,才发现存在同名/相似项目。本项目**不是**任何其他项目的衍生作品、复刻作品或分支。
6
+
7
+ DeepSeek Harness 插件:为每次 `edit` / `write` / `str_replace_editor` 调用在对话中就地渲染内联差异卡片,自动识别文件语言(57 种)并做避开红绿的语法高亮,并提供左右对照、行内字符级高亮、移动块与被动行号说明、Read 行范围展示;命令、搜索、网页与通用工具调用还可切换为默认展开 IN/OUT 的「展开风格」,命令与工具卡片的输入/输出状态按段独立着色。**1.3.0 起界面与文档提供完整中英双语,并可在设置页独立切换语言(默认中文)。**
8
+
9
+ - **作者**:[Him666233](https://github.com/Him666233)
10
+ - **仓库**:[Him666233/dsh-inline-diff](https://github.com/Him666233/dsh-inline-diff)
11
+ - **License**:MIT
12
+ - **npm**:`@him666233/dsh-inline-diff`
13
+ - **当前版本**:1.3.0
14
+
15
+ > 设置项中的「展开风格 / Expanded」指展开式、平板式、类现代编码代理的透明输出效果;项目不包含任何第三方产品品牌字样。
16
+
17
+ ## 兼容性
18
+
19
+ - **DSH 版本范围(`engines.dsh`)**:`>=0.2.2-rc.1 <0.3.0`
20
+ - **实测版本**:`0.2.2-rc.1`
21
+ - 不在 `engines.dsh` 范围内时,DSH 加载器会拒绝加载本插件,不会静默运行未验证版本
22
+ - 桌面端与 Web UI 若使用不同 profile,需要分别安装
23
+ - 不 shadow `conversation.chat.node` 的 tool-call 条目(官方 Tool 层拥有该条目并声明 `tool.call.toolview` 子槽,重复声明会抛错),只通过 keyed `tool.call.toolview` 注册接管已登记的工具行;未登记工具沿用官方通用行
24
+ - 与启动动画类插件互不接管 slot;动画关键帧使用独立命名空间(`dsh-inline-diff-*`),Read 范围观察器只响应 Read 行相关 DOM 变更,避免抢占启动动画的主线程
25
+ - 与第三方主题共存:keyed `tool.call.toolview` 使用 priority `-100`,避免与同样注册工具视图的主题插件(如 claude-style 在 `-1` 注册)发生重复 key 冲突;卡片头部带 `aria-haspopup="false"` 豁免并只响应真实用户手势,避免主题在折叠动画结束时重放合成点击、把「放大 / 轨迹 / 文件路径」的点击变成折叠卡片
26
+
27
+ ## 安装
28
+
29
+ 在 DSH 中从 npm 安装(推荐):
30
+
31
+ ```bash
32
+ dsh plugin add @him666233/dsh-inline-diff
33
+ ```
34
+
35
+ 也可以在 DSH Web UI 的「插件 → 添加插件」里直接输入包名安装。桌面端与 Web UI 若使用不同 profile,需要分别安装;插件加载后刷新或重启 DSH。npm 包名同时写在本包的 `cordis.patch.yml`(bundle 插件的模块名)与 `client.js`(浏览器模块 id)里,请勿只改其中一个。
36
+
37
+ 其他安装方式(旧方式继续可用):
38
+
39
+ - **本地目录 / 离线安装**:把本目录(`plugin/`)交给 DSH「插件 → 添加插件」(输入绝对路径),或解压 Release 中的 `dsh-inline-diff-<版本>-plugin.zip` 后选择解压出的 `plugin/` 目录;
40
+ - **手动 link(开发调试)**:见下方;
41
+ - **升级**:`dsh plugin add @him666233/dsh-inline-diff@<版本>`,或在插件页卸载后重装;**卸载**:`dsh plugin remove @him666233/dsh-inline-diff`(或插件页卸载)。同一个 profile 不要同时保留 link 版与 npm 版。
42
+
43
+ 本地开发或离线安装:把本目录(`plugin/`)作为本地插件安装,或手动 link:
44
+
45
+ ```bash
46
+ cd ~/.dsh/profiles/<profile>
47
+ pnpm add link:/absolute/path/to/dsh-inline-diff/plugin
48
+ ```
49
+
50
+ 然后在 profile 的 `package.json` 中加入:
51
+
52
+ ```json
53
+ {
54
+ "dependencies": {
55
+ "@him666233/dsh-inline-diff": "link:/absolute/path/to/dsh-inline-diff/plugin"
56
+ },
57
+ "dsh": {
58
+ "profile": {
59
+ "bundles": ["@him666233/dsh-inline-diff"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## 功能
66
+
67
+ - edit / write / str_replace_editor 逐次内联差异,精确旧/新行号;每个修改点的行号列上方带「旧 / 新」图例(与行号列严格对齐;新建文件等只有一侧行号的修改点只显示对应一侧图例),删除行旧行号染红、增加行新行号染绿并加粗;
68
+ - 紧凑行号栏与更清晰的卡片边框:内容内缩、代码起点更靠左,新增/删除色条仍通栏到边缘;
69
+ - 行内字符级高亮,只有真正变化的片段标深红/深绿;同一处替换中共享的空白与标点并入改动区,连成连续高亮带,孤立的空白/标点差异不会被误标;
70
+ - 移动块标注「移至/移自 旧/新 Lx–Ly」(单行移动按显示宽度判定,≥12 格才标注);被动行号位移说明 `旧 Lx–Ly → 新 Lm–Ln · 行号顺延 ±N`;
71
+ - 左右对照弹窗与全文对照(依赖 Host 内存快照);变更块模式按修改点分组、横条吸顶,历史回放等说明横幅与「修改前/修改后」栏固定在标题下方,滚动条只属于对比内容区域;
72
+ - 固定文件/修改点表头;Read 行折叠时在文件名旁显示实际行范围(多段用 ` · ` 分隔,最多 4 段后省略),展开后保留 DSH 原生展示;
73
+ - 自动识别文件语言(57 种,按扩展名、特殊文件名与 shebang 首行),在卡片头部与放大弹窗显示语言徽章(短代码 / 全名 / 隐藏;「隐藏」隐藏全部徽章;徽章可见时未知语言可显示虚线徽章;纯文本显示「纯文本」标记);
74
+ - 逐语言语法高亮:内联卡片与左右对照弹窗的代码行统一着色;配色限定在蓝→紫区间(色相 180°–285°)并刻意避开红/绿/橙/黄/品红,避免与新增/删除标记混淆;每个前景色在官方深色/浅色代码底色上对比度 ≥ 4.5:1;关闭高亮、未知语言或纯文本时回退默认前景色(跟随浅色/深色外观);
75
+ - 语法高亮四项设置:开启/关闭、语言标识(短代码/全名/隐藏)、未知语言(显示/不显示)、字体强调(颜色+字体样式/仅颜色:关键词等加粗、注释斜体);设置页内可展开查看支持的 57 种语言;
76
+ - grep / glob / web_search / web_fetch 与普通工具调用共用展开风格:类别图标、关键词/路径/URL 摘要、匹配数/文件数/来源数/HTTP 状态徽标、默认展开 IN/OUT;
77
+ - 内联差异卡片与所有展开风格工具行使用统一的「轨迹」胶囊按钮;
78
+ - 命令执行与工具调用卡片的左侧色条按 IN/OUT 分段独立显示状态:IN 准备/等待输出=主题色(脉动)、输入侧完成=绿、输入侧失败=红;OUT 执行中=主题色(脉动,含「执行中…」占位)、输出成功=绿、执行失败/非零退出=红、用户中止=警告色;失败按错误码归因到输入侧或输出侧(缺少错误码时按原始参数是否合法 JSON 回退判定),输入侧失败时 OUT 标为「跳过」;输入侧失败时 IN 代码红字、输出侧失败时 OUT 代码红字,正常文字跟随内部配色与明暗外观;
79
+ - 文件修改、命令执行、其它工具调用三类卡片都使用「外壳 + 内部」双色结构;外壳跟随当前主题(含第三方主题)——派生颜色在 `body` 层解析,官方原版主题(token 在 `body`)与皮肤主题(token 在 `:root`)都能正确跟随,切换后不会残留上一个主题的色调;内部使用官方明暗外观的代码块底色与对应字色;三类卡片可分别配置外壳/内部配色(外壳:自动 / 浅色 / 深色;内部:自动 / 浅色 / 深色 / 与外壳一致);
80
+ - 读取宿主实际明暗外观(浅色 / 深色 / 跟随系统),卡片与设置窗口自动使用可读的底色和字色,第三方主题切浅色时也不会浅底浅字;弹窗与卡片均为不透明表面,不会透出壁纸;
81
+ - 四项独立展示选项:文件卡片、命令执行行、其它工具调用、过程折叠;设置弹窗标题栏固定、内容独立滚动,滚动条按区域贴边或内缩。
82
+
83
+ ## 设置
84
+
85
+ 侧边栏底部「差异样式」或 DSH 设置页「内联差异」:
86
+
87
+ **界面语言(1.3.0 新增)**:
88
+
89
+ | 设置项 | 可选项 |
90
+ | --- | --- |
91
+ | 界面语言 / Language | 中文(默认) / English / 跟随 DSH |
92
+
93
+ 切换立即生效、无需刷新,不会改动 DSH 全局语言;文档语言:中文默认(本文件),英文见 [README.en.md](README.en.md)。设置页顶部同时展示一条醒目的原创声明:本项目为完全原创作品,与任何同名/相似插件(包括 [JanEickholt/dsh-inline-diff](https://github.com/JanEickholt/dsh-inline-diff))没有任何关系。
94
+
95
+ 四项展示风格:
96
+
97
+ | 设置项 | 展开风格 / 不折叠 | DSH 原生 |
98
+ | --- | --- | --- |
99
+ | 文件修改卡片 | 本插件的内联差异卡片 | 官方文件修改行 |
100
+ | 命令执行行 | 默认展开 IN/OUT 的扁平命令行 | 官方 bash / pwsh / win_bash 行 |
101
+ | 其它工具调用 | 普通/详情/搜索/网页类工具默认展开 IN/OUT | 官方卡片 |
102
+ | 过程折叠 | 写入 DSH verbose 偏好 | 保留用户已有偏好 |
103
+
104
+ 开启「其它工具调用 → 展开风格」时,若「过程折叠」仍为 DSH 原生,插件会自动把它切到「不折叠」,否则已完成的工具行会被 DSH 折叠组遮住。
105
+
106
+ 语法高亮与语言徽章(独立于上表):
107
+
108
+ | 设置项 | 可选项 |
109
+ | --- | --- |
110
+ | 语法高亮 | 开启 / 关闭 |
111
+ | 语言标识 | 短代码 / 全名 / 隐藏 |
112
+ | 未知语言 | 显示“未知语言” / 不显示 |
113
+ | 字体强调 | 颜色 + 字体样式 / 仅颜色 |
114
+
115
+ 设置保存在 localStorage(`dsh-inline-diff.settings.v4`);旧 v3 / v2 值自动迁移并删除旧键。
116
+
117
+ ## 数据与限制
118
+
119
+ 插件没有网络请求或遥测,客户端不使用 `innerHTML` / `dangerouslySetInnerHTML` / `eval`。Host 只保留显示所需的修改前后文本到内存快照(LRU:最多 240 条、每侧上限 4MB,并限制总量 64MB),不落盘;Host 只读 API 受 DSH 浏览器信任边界(`connection` 准入,无该服务时回退本机 loopback 围栏)保护,并有请求体 1MB、仅 JSON、10 秒读取超时、15 秒文件读超时与 8 并发上限。超大文件与超大单行在浏览器侧有物化预算(20 万行 / 单行 100 万字符),超限自动降级为差异块并提示原因,不会冻结页面。Host 只为 `edit` / `write` 保存快照,`str_replace_editor` 按工具元数据中的修改块展示并尽量定位行号,卡片与放大弹窗用「不保存执行快照」的专用说明(不是历史回放措辞);应用重启后的历史回放同样会在放大弹窗内说明。极端情况下按「快照 → 当前文件读取 → 工具元数据差异块 → 明确说明」逐级回退;界面语言、设置存储、语法高亮同样有中文 / 默认值兜底,最终才显示可读的错误说明而不是静默失败。历史回放的行号按当前文件重新定位;若文件此后又被改动导致无法唯一定位,会显示「行号待定」并在弹窗说明只展示修改块。同一张卡片展示的是该次编辑的执行快照,不会随文件后续改动刷新;完整的显示行为说明(快照语义、刷新规则、行号图例、弹窗层级与滚动、性能提示)见仓库 [docs/display-behavior.md](https://github.com/Him666233/dsh-inline-diff/blob/main/docs/display-behavior.md)。
120
+
121
+ 完整说明、内部架构与已知限制见仓库根目录 [README](https://github.com/Him666233/dsh-inline-diff#readme)。
122
+
123
+ ## License
124
+
125
+ MIT © 2026 [Him666233](https://github.com/Him666233)