dsh-document-view 0.0.0-stage → 1.1.1

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.
@@ -0,0 +1,69 @@
1
+ # 兼容性与安全说明
2
+
3
+ ## 当前验证基线
4
+
5
+ | 项目 | 值 | 依据 |
6
+ | --- | --- | --- |
7
+ | 运行中的 DSH | `0.2.2-rc.3` | 安装包 `app.asar` 内 `@deepseek-ai/dsh-desktop` 与 `@deepseek-ai/dsh-desktop-runtime` 的 `package.json` |
8
+ | 官方最新 release | `dsh-v0.2.2-rc.3` | [deepseek-ai/DeepSeek-Harness releases](https://github.com/deepseek-ai/DeepSeek-Harness/releases/tag/dsh-v0.2.2-rc.3) |
9
+ | 插件版本 | `1.1.0` | `package.json` |
10
+ | Node.js | >= 20(仅构建时) | `engines.node` |
11
+
12
+ 本插件就是在上述版本上开发并实际运行的,因此**与当前最新官方版本兼容**。DSH 内置插件清单里 `ui-sidebar-right`、`ui-sidebar-documentpreview`、`office-kit`、`ui-conversation` 等条目均存在,与本插件依赖的宿主能力一致。
13
+
14
+ > 无法承诺「未来所有 DSH 版本都兼容」——插件依赖宿主内部 DOM 与 slot 名称,这些不属于公开稳定 API。下面说明失效时的行为与复核方法。
15
+
16
+ ## 依赖的宿主契约
17
+
18
+ **Client 服务(通过 `ctx.inject` 注入)**
19
+
20
+ - `slots` — `inject()` / `register()`,注册槽位:
21
+ - `conversation.session.header.actions`
22
+ - `sidebar.right.tab.document.actions`
23
+ - `sidebarRight` — `mounted`(`getSnapshot` / `subscribe`)、`openTabs`(`getSnapshot` / `subscribe`)、`isExpanded()`、`active()`
24
+
25
+ **DOM 钩子(稳定 data 属性,非构建哈希类名)**
26
+
27
+ `data-rightbar-col`、`data-sidebar-right-panel`、`data-sidebar-right-session`、`data-sidebar-right-mode`、`data-sidebar-collapsed`、`data-textpreview-tool`、`data-excel-preview`、`data-slot="conversation.session.header.actions"`、`.fortune-zoom-container`
28
+
29
+ ## 失效时不会拖垮页面(v1.1.0 起)
30
+
31
+ 两道保护,都是「 fail closed 」——宿主结构变了就安静停用,而不是抛错:
32
+
33
+ 1. **契约检查**:`installDocumentCollaboration` 在执行前检查上述服务与方法是否齐全,缺失则打印一条 `console.warn` 并直接返回,不注入任何样式或监听。
34
+ 2. **激活兜底**:`client.js` 的 `apply()` 用 `try/catch` 包住整个安装过程。即使 DSH 未来改了模块加载方式导致意外异常,也只停用本插件,**宿主页面照常可用**(不会出现白屏)。
35
+
36
+ 因此升级 DSH 后最坏的结果是「插件暂时不生效」,而不是「DSH 起不来」。
37
+
38
+ ## 为什么不设 `engines.dsh`
39
+
40
+ `engines.dsh` 写错或过窄会在安装阶段直接拒绝插件,且第三方无法自行判断该填哪个范围。兼容性改为写在本文件、README 与 `meta.description` 里,由用户和维护者判断。
41
+
42
+ ## 升级复核清单
43
+
44
+ DSH 发布新版本后,维护者按以下步骤复核(可提 PR):
45
+
46
+ 1. 记录新版本号,确认 `app.asar` 内的实际版本。
47
+ 2. 打开任一文件,启用「文档视图」,确认中间文档 / 右侧对话同时可见。
48
+ 3. 拖动分隔线,确认比例变化且刷新后保持;`←` / `→` / `Home` / 双击复位逐一验证。
49
+ 4. 打开设置,验证自动进入、三种布局预设、自动更新 / 暂停。
50
+ 5. 缩窄窗口,验证「文档 / 对话」切换、未发送输入保留、焦点不丢失。
51
+ 6. 退出 / 停用插件,确认宿主原生布局完全恢复、无残留样式与属性。
52
+ 7. 检查浏览器 Console 是否出现 `[dsh-document-view] client host contract changed` 警告——出现即表示宿主契约已变,需对照上表适配选择器。
53
+ 8. 更新本文件与 `locale/*.json` 的验证版本,发新版。
54
+
55
+ ## 密钥与个人信息核查
56
+
57
+ 发布前已对全仓(含 `src/`、`client.js`、`index.js`、`cordis.patch.yml`、`locale/`、`docs/`)做扫描:
58
+
59
+ - 无 API Key、Token、密码、私钥、Cookie、`.env`、凭据文件;
60
+ - 无本机绝对路径、用户名目录、内网地址、私有仓库地址;
61
+ - 代码内无外部 URL(仅 README / docs 中的公开文档链接,以及 `package.json` 的公开仓库字段);
62
+ - 三张界面图为通用占位内容绘制的脱敏示意图,不含真实会话、文件名、账号或个人数据。
63
+
64
+ 复核命令:
65
+
66
+ ```sh
67
+ grep -rniE "api[_-]?key|secret|token|password|bearer|ghp_|BEGIN .*PRIVATE" . --exclude-dir=.git
68
+ npm pack --dry-run
69
+ ```
package/docs/DETAIL.md ADDED
@@ -0,0 +1 @@
1
+ ![Document view: document in the center, conversation on the right, with a resizable divider](preview.svg)
@@ -0,0 +1 @@
1
+ ![文档视图:中间是文档,右侧是对话,中间分隔线可拖动调整宽度](preview.svg)
@@ -0,0 +1,125 @@
1
+ # 上架插件市场:完整指南
2
+
3
+ > 本文只记录**已查证的公开规则与入口**(查证日期 2026-11-15)。各市场规则可能变化,操作前请以对应仓库的 `CONTRIBUTING.md` 为准。文中不含任何账号、密钥或凭据。
4
+
5
+ ## 结论先行
6
+
7
+ **性价比最高的一步:给 GitHub 仓库加 `dsh-plugin` topic。** 多个市场(1024 Store、dsh 社区商店)会自动抓取带这个 topic 的公开仓库并做静态校验,通过后自动收录,无需逐个提交。其次是**发布到 npm**——市场的一键安装命令读的是 npm 包,不发 npm 就只能「浏览模式」(有仓库链接、无安装命令)。
8
+
9
+ 按性价比排序:
10
+
11
+ 1. **加 GitHub topic `dsh-plugin`**(自动收录,成本最低)
12
+ 2. **`npm publish`**(解锁一键安装)
13
+ 3. **向 awesome 目录发 catalog PR**(人工精选收录,可控)
14
+ 4. **在 dsh-market 提交入口登记**(可选)
15
+
16
+ ## 前置条件(本仓库已全部满足)
17
+
18
+ - [x] 公开 GitHub 仓库,默认分支有 `package.json`
19
+ - [x] `package.json` 声明了非空的 `dsh.bundle.patch`
20
+ - [x] 该 patch 文件(`cordis.patch.yml`)确实在默认分支上
21
+ - [x] 中英文展示元数据 `locale/en.json` / `locale/zh.json`
22
+ - [x] MIT `LICENSE`、`README`、图标与详情页
23
+ - [x] 有真实的兼容性测试证据(见 [COMPATIBILITY.md](COMPATIBILITY.md))
24
+
25
+ 静态校验只会**只读检查文件树**,不会安装依赖、不会执行插件代码。
26
+
27
+ ## 渠道一:1024 Store / awesome 社区目录(推荐)
28
+
29
+ | | |
30
+ | --- | --- |
31
+ | 目录仓库 | [imsai-sh/awesome-deepseek-harness-plugins](https://github.com/imsai-sh/awesome-deepseek-harness-plugins) |
32
+ | 在线市场 | [deepseek1024.com](https://deepseek1024.com/) |
33
+ | 收录规范 | [CONTRIBUTING.md](https://github.com/imsai-sh/awesome-deepseek-harness-plugins/blob/HEAD/CONTRIBUTING.md) |
34
+ | 规模 | 约 1.4 万个插件(2026-11) |
35
+ | 安装命令 | `dsh1024 plugin --profile web add <npm-package>` |
36
+
37
+ ### 路径 A:自动发现(零 PR)
38
+
39
+ 1. 打开仓库页 → 右侧 **About** 旁的齿轮 → 在 Topics 加 `dsh-plugin`。
40
+ 2. 自动收集服务会抓取新建 / 新推送的带 topic 仓库,静态校验 `package.json` 的 `dsh.bundle.patch` 与 patch 文件是否存在。
41
+ 3. 通过后自动进入目录并同步到网站。
42
+
43
+ ### 路径 B:提交 catalog PR(人工精选、可控)
44
+
45
+ 1. Fork 目录仓库,基于其默认分支建分支(如 `add-Frank-Fan-1058-dsh-document-view`)。
46
+ 2. 只新增**一个**文件 `catalog/plugins/frank-fan-1058--dsh-document-view.json`,内容可直接用本仓库的 [awesome-dsh-catalog-entry.json](awesome-dsh-catalog-entry.json)(把 `added` 改成提交当天日期)。
47
+ 3. **不要**改目录仓库的 `README.md`、`catalog/README.md`、工作流或脚本——它们是 CI 生成的投影。
48
+ 4. PR 标题:`catalog: add Frank-Fan-1058/dsh-document-view`,正文按仓库根 PR 模板如实填写插件验证与测试命令。
49
+ 5. 非草稿新增类 PR 通过 `Plugin submission review / static-review` 后**自动合并**;合并后 CI 自动同步到网站与 README。
50
+ 6. 修改 / 下架既有条目的 PR 不会自动合并,需维护者人工审核。
51
+
52
+ 条目只允许这些字段:`$schema`、`id`、`name`、`repository`、`category`、`description`、`added`。分类选 `ui`(界面增强)。中英文简介要客观中性,不要最高级、Star 数或宣传语。
53
+
54
+ > 也可用官方提交 Skill:`npx skills add imsai-sh/awesome-deepseek-harness-plugins --skill submit-dsh-plugin -g`,然后让助手「使用 $submit-dsh-plugin 检查并提交我的 DeepSeek Harness 插件」。
55
+
56
+ ## 渠道二:npm 发布(解锁一键安装)
57
+
58
+ 1024 Store **只提供 npm 安装**:网站探测 manifest 声明的包名,只要 npm 上的 latest 版本声明了 `dsh.bundle` 就显示安装命令。未发 npm 的插件仍会收录,但只有仓库链接。
59
+
60
+ ### 纯 CLI 发布(推荐,不用开浏览器)
61
+
62
+ **一次性准备**:在 npmjs.com → Access Tokens 建一个 Granular Access Token(只勾这个包的 publish 权限),然后在终端设置一次:
63
+
64
+ ```sh
65
+ export NODE_AUTH_TOKEN=<你的 npm 令牌> # macOS / Linux
66
+ # Windows PowerShell: $env:NODE_AUTH_TOKEN = "<你的 npm 令牌>"
67
+ ```
68
+
69
+ 之后每次发版都是纯命令行,不再需要浏览器:
70
+
71
+ ```sh
72
+ node scripts/publish-npm.mjs # 校验 + npm pack --dry-run + publish
73
+ node scripts/publish-npm.mjs --dry-run # 只校验,不发布
74
+ ```
75
+
76
+ 脚本会先 `npm whoami` 验证凭据、跑 25 项 `verify.mjs` 断言、`npm pack --dry-run` 核对文件清单,再 `npm publish --access public`。**令牌不写进仓库、不回显、不进日志**。
77
+
78
+ 浏览器只用于「一次性登录」的替代路径(`npm login --auth-type=web`),登录完成后 `.npmrc` 存下凭据,后续同样是纯 CLI。
79
+
80
+ ### 首次手工发布
81
+
82
+ ```sh
83
+ npm login # 需要你自己的 npm 账号(一次性)
84
+ npm pack --dry-run # 先核对发布文件清单
85
+ npm publish --access public
86
+ ```
87
+
88
+ 发布后核对:`npm view dsh-document-view dsh.bundle` 应返回 patch 声明。
89
+
90
+ > 本仓库 `files` 是白名单,开发用的 `AGENTS.md` / `PROJECT.md` / `临时/` 不会进包。发布前再跑一次 [SECURITY.md](../SECURITY.md) 里的敏感信息扫描。
91
+
92
+ ## 渠道三:dsh-market(DSH 内置可视化市场)
93
+
94
+ | | |
95
+ | --- | --- |
96
+ | 仓库 | [dsh-market/dsh-market](https://github.com/dsh-market/dsh-market) |
97
+ | 站点 | [dshmarket.com](https://dshmarket.com/) |
98
+ | 形态 | 装在 DSH 里的市场插件(本机已装 `dshmarket@1.73.19`),在设置里浏览 / 搜索 / 一键安装 |
99
+ | 提交入口 | 仓库 README 的 **Submit your plugin** 链接 —— 请以该仓库 README 为准,本指南不复述可能变化的地址 |
100
+ | 注意 | 仓库明确写着「Please don't PR plugin entries against this repo」,**不要**往这个仓库发插件条目 PR |
101
+
102
+ 该市场同样从 GitHub `topic:dsh-plugin` 自动同步,并支持在 DSH 0.2.1+ 的 **插件 → 发现 → 索引源** 添加自定义索引。其 README 也强调 **Listing ≠ endorsement**(收录不等于背书)。
103
+
104
+ ## 其他聚合站
105
+
106
+ `dsh.market`、`dshopen.org`、`deepseekharness.online` 等站点会聚合 `dsh-plugin` topic 仓库,通常无需单独提交。加好 topic、把 README 写清楚、发好 Release,它们会自动抓到。
107
+
108
+ ## 提升曝光的可做事项
109
+
110
+ - [ ] 仓库 **About** 写一句清晰描述 + 填 Homepage + 加 `dsh-plugin`、`deepseek-harness`、`dsh` 等 topic
111
+ - [ ] README 首屏放一张能一眼看懂的界面图(本仓库已放)
112
+ - [ ] 每次发版写清 Release notes,并打 `vN` tag
113
+ - [ ] 中英文 README 都齐全
114
+ - [ ] 在 DSH 社区 / 讨论区发一篇使用场景介绍(**对外发布前需你确认**)
115
+ - [ ] 回复 Issue、按反馈迭代,保持仓库活跃
116
+
117
+ ## 需要你确认后我才能代做的动作
118
+
119
+ 以下都是**对外部服务的写操作**,本指南只准备材料、不擅自执行:
120
+
121
+ 1. 给 GitHub 仓库加 `dsh-plugin` topic
122
+ 2. `npm publish`(需要你的 npm 账号登录)
123
+ 3. Fork 目录仓库并创建 catalog PR
124
+ 4. 修改仓库 About 描述
125
+ 5. 在社区发帖宣传
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "../schema/plugin.schema.json",
3
+ "id": "Frank-Fan-1058/dsh-document-view",
4
+ "name": "dsh-document-view",
5
+ "repository": "https://github.com/Frank-Fan-1058/dsh-document-view",
6
+ "category": "ui",
7
+ "description": {
8
+ "en": "A DeepSeek Harness bundle that adds a split document view: the opened document stays in the center while the current conversation remains visible on the right. It provides a per-session toggle, a resizable divider with keyboard support, an optional auto-enter setting, three layout presets, and a Document/Chat switch for narrow windows. Only the window layout changes; editing, saving and preview continue to use the host's native document and Office viewers.",
9
+ "zh": "为 DeepSeek Harness 增加分栏文档视图的 bundle:打开的文档居中显示,当前会话保留在右侧。支持按会话保存的开关、可拖动并支持键盘调节的分隔线、可选的自动进入设置、三种布局预设,以及窄窗口下的「文档 / 对话」切换。仅调整窗口布局,编辑、保存与预览继续沿用宿主原生文档与 Office 查看器。"
10
+ },
11
+ "added": "2026-11-15"
12
+ }
@@ -0,0 +1,57 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="640" height="300" viewBox="0 0 640 300">
2
+ <rect x="0" y="0" width="640" height="300" rx="16" fill="none" stroke="#9aa6bb" stroke-opacity="0.5" stroke-width="2"/>
3
+ <path d="M16 44 H624" stroke="#9aa6bb" stroke-opacity="0.4" stroke-width="1.5"/>
4
+ <circle cx="30" cy="22" r="5" fill="#e8a6a3"/><circle cx="48" cy="22" r="5" fill="#e8c98d"/><circle cx="66" cy="22" r="5" fill="#a6d6b4"/>
5
+ <rect x="90" y="15" width="14" height="14" rx="4" fill="#2563eb"/>
6
+ <rect x="112" y="19" width="92" height="7" rx="3.5" fill="#9aa6bb" fill-opacity="0.55"/>
7
+
8
+ <!-- left rail -->
9
+ <path d="M16 44 V284 H70 V44" fill="#f4f7fc" stroke="#9aa6bb" stroke-opacity="0.3" stroke-width="1.5"/>
10
+ <rect x="30" y="60" width="26" height="26" rx="8" fill="#dbe7ff"/>
11
+ <rect x="30" y="98" width="26" height="26" rx="8" fill="#e7ecf5"/>
12
+ <rect x="30" y="136" width="26" height="26" rx="8" fill="#e7ecf5"/>
13
+
14
+ <!-- document panel -->
15
+ <rect x="82" y="56" width="344" height="216" rx="10" fill="#ffffff" stroke="#d8e0ee" stroke-width="1.5"/>
16
+ <rect x="82" y="56" width="344" height="28" rx="10" fill="#f7f9fd"/>
17
+ <path d="M82 84 H426" stroke="#d8e0ee" stroke-width="1.5"/>
18
+ <rect x="94" y="65" width="84" height="15" rx="5" fill="#ffffff" stroke="#d8e0ee"/>
19
+ <rect x="104" y="70" width="48" height="5" rx="2.5" fill="#9aa6bb" fill-opacity="0.7"/>
20
+ <!-- toggle pill -->
21
+ <rect x="94" y="96" width="92" height="24" rx="8" fill="#e9f1ff" stroke="#bcd2ff" stroke-width="1.5"/>
22
+ <circle cx="108" cy="108" r="4.5" fill="#2563eb"/>
23
+ <rect x="118" y="104" width="54" height="7" rx="3.5" fill="#2563eb" fill-opacity="0.75"/>
24
+ <rect x="192" y="100" width="20" height="16" rx="5" fill="#ffffff" stroke="#d8e0ee"/>
25
+ <path d="M198 107 l4 4 l4 -4" fill="none" stroke="#8a94a6" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
26
+ <!-- document body -->
27
+ <rect x="96" y="136" width="110" height="10" rx="5" fill="#3b4a63" fill-opacity="0.7"/>
28
+ <rect x="96" y="158" width="308" height="7" rx="3.5" fill="#dfe5f0"/>
29
+ <rect x="96" y="172" width="286" height="7" rx="3.5" fill="#dfe5f0"/>
30
+ <rect x="96" y="186" width="220" height="7" rx="3.5" fill="#dfe5f0"/>
31
+ <rect x="96" y="208" width="86" height="8" rx="4" fill="#9aa6bb" fill-opacity="0.6"/>
32
+ <rect x="96" y="226" width="308" height="7" rx="3.5" fill="#e7ebf3"/>
33
+ <rect x="96" y="240" width="270" height="7" rx="3.5" fill="#e7ebf3"/>
34
+ <rect x="96" y="254" width="296" height="7" rx="3.5" fill="#e7ebf3"/>
35
+
36
+ <!-- divider -->
37
+ <rect x="428" y="56" width="12" height="216" fill="#f4f7fc" stroke="#d8e0ee" stroke-width="1.5"/>
38
+ <rect x="432" y="146" width="4" height="36" rx="2" fill="#a8bde0"/>
39
+ <path d="M434 56 V272" stroke="#2563eb" stroke-opacity="0.55" stroke-width="1.5"/>
40
+
41
+ <!-- chat panel -->
42
+ <rect x="442" y="56" width="182" height="216" rx="10" fill="#f7f9fd" stroke="#d8e0ee" stroke-width="1.5"/>
43
+ <path d="M442 88 H624" stroke="#d8e0ee" stroke-width="1.5"/>
44
+ <rect x="454" y="69" width="66" height="8" rx="4" fill="#3b4a63" fill-opacity="0.6"/>
45
+ <rect x="548" y="68" width="64" height="12" rx="6" fill="#ffffff" stroke="#d8e0ee"/>
46
+ <rect x="500" y="100" width="112" height="30" rx="9" fill="#2563eb"/>
47
+ <rect x="510" y="109" width="92" height="5" rx="2.5" fill="#ffffff" fill-opacity="0.85"/>
48
+ <rect x="510" y="119" width="70" height="5" rx="2.5" fill="#ffffff" fill-opacity="0.65"/>
49
+ <rect x="454" y="142" width="126" height="46" rx="9" fill="#ffffff" stroke="#d8e0ee"/>
50
+ <rect x="464" y="152" width="106" height="5" rx="2.5" fill="#dfe5f0"/>
51
+ <rect x="464" y="163" width="92" height="5" rx="2.5" fill="#dfe5f0"/>
52
+ <rect x="464" y="174" width="100" height="5" rx="2.5" fill="#dfe5f0"/>
53
+ <rect x="454" y="200" width="158" height="12" rx="6" fill="#e9edf5"/>
54
+ <rect x="454" y="244" width="158" height="20" rx="8" fill="#ffffff" stroke="#d8e0ee"/>
55
+ <rect x="464" y="251" width="72" height="6" rx="3" fill="#dfe5f0"/>
56
+ <circle cx="600" cy="254" r="7" fill="#2563eb"/>
57
+ </svg>
Binary file
Binary file
Binary file
package/icon.svg ADDED
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
2
+ <rect x="3" y="5" width="30" height="26" rx="4" fill="none" stroke="#247bbf" stroke-width="2"/>
3
+ <line x1="21" y1="5" x2="21" y2="31" stroke="#247bbf" stroke-width="2"/>
4
+ <rect x="21" y="5" width="12" height="26" rx="4" fill="#247bbf" fill-opacity="0.18"/>
5
+ <line x1="7" y1="12" x2="16" y2="12" stroke="#247bbf" stroke-width="1.6" stroke-linecap="round"/>
6
+ <line x1="7" y1="17" x2="16" y2="17" stroke="#247bbf" stroke-width="1.6" stroke-linecap="round"/>
7
+ <line x1="7" y1="22" x2="14" y2="22" stroke="#247bbf" stroke-width="1.6" stroke-linecap="round"/>
8
+ </svg>
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export const name = 'dsh-document-view';
2
+ export function apply() {}
package/locale/en.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Document view",
4
+ "description": "Adds a split document view to DeepSeek Harness: the opened document stays in the center while the current conversation remains visible on the right, so you can read a file and ask the AI about it on the same screen. Open a file from the right sidebar, then enable 'Document view' in the conversation header actions or the file tab actions. The arrow next to the toggle opens settings: 'Auto-enter on document view' (off by default, triggered only by your own file clicks), three layout presets (Document-first / Balanced / Chat-first), and an Auto update / Paused control that reuses the host's native file watcher. Drag the divider to resize; Left/Right arrows nudge, Home or double-click resets the ratio. In a narrow window, switch between Document and Chat with unsent input preserved. The toggle and ratio are saved per session. This is a layout-only plugin: it makes no network requests, reads or writes no files, ships no credentials, and stores only the toggle and ratios in localStorage under dsh.document-view.v1. Editing, saving and preview continue to use DSH's native document and Office viewers. Disabling the plugin restores the default layout. Verified on DSH Desktop 0.2.2-rc.3; because it relies on the host's DOM structure and slot names, a future DSH upgrade may change them — in that case the plugin disables itself safely so the page keeps working.",
5
+ "detail": "docs/DETAIL.md"
6
+ }
7
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "文档视图",
4
+ "description": "为 DeepSeek Harness 增加分栏文档视图:打开的文档居中显示,当前会话保留在右侧,可以边看文档边让 AI 对照回答,不用再来回切换。在右侧栏打开文件后,从会话头部操作区或文件标签操作区开启「文档视图」。开关旁的箭头打开设置:可启用「查看文档时自动进入」(默认关闭,仅响应你主动点击文件)、选择文档优先 / 均衡 / 对话优先三种布局预设,以及沿用宿主原生文件监听的「自动更新 / 已暂停」。拖动分隔线调整宽度,左右方向键微调、Home 或双击复位;窄窗口下可在「文档 / 对话」间切换且保留未发送的输入。开关与比例按会话保存。本插件只调整布局:不发任何网络请求、不读写文件、不含任何凭据,仅在 localStorage 的 dsh.document-view.v1 中保存开关与比例;编辑、保存与预览继续沿用 DSH 原生文档 / Office 查看器。停用插件即恢复默认布局。已在 DSH Desktop 0.2.2-rc.3 上验证;因依赖宿主 DOM 结构与 slot 名称,DSH 升级后这些内部结构若变化,插件会安全自动停用、页面照常可用,届时按仓库 docs/COMPATIBILITY.md 的升级复核清单重验。",
5
+ "detail": "docs/DETAIL.zh.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "dsh-document-view",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.1",
4
+ "description": "Split document view for DeepSeek Harness: read a document in the center while the conversation stays on the right.",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": {
10
+ "default": "./client.js"
11
+ },
12
+ "./locale/*.json": "./locale/*.json",
13
+ "./icon": "./icon.svg",
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "index.js",
18
+ "client.js",
19
+ "cordis.patch.yml",
20
+ "README.md",
21
+ "README.en.md",
22
+ "LICENSE",
23
+ "SECURITY.md",
24
+ "CHANGELOG.md",
25
+ "icon.svg",
26
+ "locale/*.json",
27
+ "docs",
28
+ "src",
29
+ "scripts"
30
+ ],
31
+ "engines": {
32
+ "node": ">=20"
33
+ },
34
+ "keywords": [
35
+ "dsh",
36
+ "deepseek-harness",
37
+ "dsh-plugin",
38
+ "plugin",
39
+ "bundle",
40
+ "document",
41
+ "document-view",
42
+ "split-view",
43
+ "layout",
44
+ "ui",
45
+ "office",
46
+ "productivity"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/Frank-Fan-1058/dsh-document-view.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/Frank-Fan-1058/dsh-document-view/issues"
54
+ },
55
+ "homepage": "https://github.com/Frank-Fan-1058/dsh-document-view#readme",
56
+ "license": "MIT",
57
+ "dsh": {
58
+ "bundle": {
59
+ "patch": "./cordis.patch.yml"
60
+ },
61
+ "client": {
62
+ "platform": "web"
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,35 @@
1
+ // Rebuild the self-contained client bundle from src/.
2
+ // Usage: node scripts/build.mjs
3
+ import { readFileSync, writeFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const root = fileURLToPath(new URL('../', import.meta.url));
7
+ const name = 'dsh-document-view';
8
+
9
+ const strip = p => readFileSync(root + p, 'utf8').replace(/^export /gm, '');
10
+ const model = strip('src/model.mjs');
11
+ const browser = strip('src/collaboration.mjs');
12
+
13
+ const client = `// Independent document collaboration client; no UI patch bundle included.
14
+ window.__ModuleLoader__.load({
15
+ id: '${name}',
16
+ factory: (require) => {
17
+ ${model}
18
+ ${browser}
19
+ // Fail-safe activation: a future DSH release may change the module
20
+ // loader or host contract. Never let an unexpected error inside this
21
+ // plugin take down the page; disable it and report one clear line.
22
+ function apply(ctx) {
23
+ try {
24
+ installDocumentCollaboration(ctx, require);
25
+ } catch (error) {
26
+ console.warn('[dsh-document-view] disabled safely after activation error:', error);
27
+ }
28
+ }
29
+ return { apply };
30
+ }
31
+ });
32
+ `;
33
+
34
+ writeFileSync(root + 'client.js', client);
35
+ console.log('Built self-contained client.js for ' + name + ' (' + client.split('\n').length + ' lines).');
@@ -0,0 +1,42 @@
1
+ // Pure-CLI npm publishing. No browser is involved at publish time.
2
+ // Auth comes from ~/.npmrc (npm login) or NODE_AUTH_TOKEN / NPM_TOKEN env var.
3
+ // Usage: node scripts/publish-npm.mjs [--dry-run]
4
+ import { execFileSync } from 'node:child_process';
5
+ import { readFileSync } from 'node:fs';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const root = fileURLToPath(new URL('../', import.meta.url));
9
+ const pkg = JSON.parse(readFileSync(root + 'package.json', 'utf8'));
10
+ const dry = process.argv.includes('--dry-run');
11
+
12
+ const run = (bin, args, opts = {}) => {
13
+ console.log(`\n$ ${bin} ${args.join(' ')}`);
14
+ // stdio: 'inherit' returns null, so never call .toString() on the result.
15
+ execFileSync(bin, args, { cwd: root, stdio: 'inherit', shell: true, ...opts });
16
+ };
17
+
18
+ console.log(`Publishing ${pkg.name}@${pkg.version} (pure CLI)`);
19
+
20
+ // 1. Verify auth without printing any credential.
21
+ try {
22
+ const whoami = execFileSync('npm', ['whoami'], { cwd: root, encoding: 'utf8', shell: true }).trim();
23
+ console.log(`Authenticated as ${whoami}`);
24
+ } catch {
25
+ console.error('\nNot logged in. Set up credentials ONCE, then publishing stays pure CLI:');
26
+ console.error(' npm login --auth-type=web # one-time browser authorization');
27
+ console.error(' # or: export NODE_AUTH_TOKEN=<your npm automation token>');
28
+ process.exit(1);
29
+ }
30
+
31
+ // 2. Release checks.
32
+ run('node', ['scripts/verify.mjs']);
33
+ run('npm', ['pack', '--dry-run']);
34
+
35
+ if (dry) {
36
+ console.log('\n--dry-run: skipping publish.');
37
+ process.exit(0);
38
+ }
39
+
40
+ // 3. Publish.
41
+ run('npm', ['publish', '--access', 'public']);
42
+ console.log(`\nPublished: https://www.npmjs.com/package/${pkg.name}/v/${pkg.version}`);
@@ -0,0 +1,71 @@
1
+ // Lightweight release verification: model unit checks + artifact integrity.
2
+ // Run: node scripts/verify.mjs
3
+ import { readFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { CollaborationState, solveColumns, isDocument } from '../src/model.mjs';
6
+
7
+ const root = fileURLToPath(new URL('../', import.meta.url));
8
+ let failures = 0;
9
+ const check = (name, cond) => {
10
+ console.log(`${cond ? ' PASS' : ' FAIL'} ${name}`);
11
+ if (!cond) failures++;
12
+ };
13
+
14
+ console.log('== model ==');
15
+ check('isDocument accepts dsh-resource://file/', isDocument('dsh-resource://file/a.md'));
16
+ check('isDocument rejects other addresses', !isDocument('https://example.com/a.md'));
17
+ check('solveColumns narrow below 760px', solveColumns(700, 0, 0.35).narrow === true);
18
+ check('solveColumns wide splits document/chat', (() => {
19
+ const r = solveColumns(1200, 0, 0.35);
20
+ return !r.narrow && r.document >= 360 && r.chat >= 400 && r.document + r.chat === 1200;
21
+ })());
22
+ check('ratio clamped to 0.2..0.65', (() => {
23
+ const r = solveColumns(1200, 0, 0.99);
24
+ return r.chat === Math.round(1200 * 0.65);
25
+ })());
26
+
27
+ const store = {
28
+ data: {},
29
+ getItem(k) { return this.data[k] ?? null; },
30
+ setItem(k, v) { this.data[k] = v; },
31
+ };
32
+ const state = new CollaborationState(store);
33
+ check('auto mode off by default', state.auto === false);
34
+ state.auto = true;
35
+ state.session('s1').enabled = true;
36
+ state.session('s1').ratio = 0.5;
37
+ state.save();
38
+ const restored = new CollaborationState(store);
39
+ check('auto mode persists', restored.auto === true);
40
+ check('per-session toggle persists', restored.session('s1').enabled === true);
41
+ check('per-session ratio persists', restored.session('s1').ratio === 0.5);
42
+ const corrupted = new CollaborationState({ getItem: () => '{not json', setItem() {} });
43
+ check('corrupted storage does not throw', corrupted.auto === false);
44
+
45
+ console.log('== artifact ==');
46
+ const client = readFileSync(root + 'client.js', 'utf8');
47
+ check('client.js registers module loader id', client.includes("id: 'dsh-document-view'"));
48
+ check('client.js contains host contract guard', client.includes('hostContractIntact'));
49
+ check('client.js wraps activation in try/catch', client.includes('disabled safely after activation error'));
50
+ check('client.js has no external URL', !/https?:\/\//.test(client));
51
+ check('client.js has no network API', !/\b(fetch|XMLHttpRequest|WebSocket|EventSource)\s*\(/.test(client));
52
+ check('client.js has no hardcoded local path', !/[A-Za-z]:\\|C:\/Users|\/Users\//.test(client));
53
+ check('client.js inlines CSS (no external stylesheet)', !/\.css['"]\s*\)/.test(client) && client.includes('style.textContent'));
54
+
55
+ const pkg = JSON.parse(readFileSync(root + 'package.json', 'utf8'));
56
+ check('manifest declares dsh.bundle.patch', typeof pkg.dsh?.bundle?.patch === 'string' && pkg.dsh.bundle.patch.length > 0);
57
+ check('patch file exists', readFileSync(root + 'cordis.patch.yml', 'utf8').includes('dsh-document-view'));
58
+ check('no engines.dsh hard constraint', !('dsh' in (pkg.engines || {})));
59
+ check('exports locale + icon', !!pkg.exports['./locale/*.json'] && !!pkg.exports['./icon']);
60
+
61
+ for (const f of ['locale/en.json', 'locale/zh.json']) {
62
+ const meta = JSON.parse(readFileSync(root + f, 'utf8')).meta;
63
+ check(`${f} has localized title/description/detail`, !!(meta.title && meta.description && meta.detail));
64
+ const detailPath = root + meta.detail;
65
+ const body = readFileSync(detailPath, 'utf8');
66
+ const img = body.match(/!\[[^\]]*\]\(([^)]+)\)/);
67
+ check(`${f} detail image exists`, !!img && !!readFileSync(root + 'docs/' + img[1]));
68
+ }
69
+
70
+ console.log(failures === 0 ? '\nAll checks passed.' : `\n${failures} check(s) FAILED.`);
71
+ process.exit(failures === 0 ? 0 : 1);