dsh-files-native 0.1.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 meyaomiao
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.md ADDED
@@ -0,0 +1,79 @@
1
+ <div align="center">
2
+
3
+ # dsh-files-native
4
+
5
+ **给 [DeepSeek Harness](https://github.com/deepseek-ai) 接近原生质感的附件上传:拖入 / 粘贴 / 回形针,图片缩略图与文件卡混排在官方输入框同一条轨。**
6
+
7
+ [![dsh-plugin](https://img.shields.io/badge/dsh-plugin-4d6bfe)](https://github.com/topics/dsh-plugin)
8
+ [![npm](https://img.shields.io/npm/v/dsh-files-native)](https://www.npmjs.com/package/dsh-files-native)
9
+ [![license](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
10
+
11
+ </div>
12
+
13
+ 运行时插件 id 仍是 `file-native`(上传路由 `/plugins/file-native/*`)。npm / GitHub 仓库名是 `dsh-files-native`。
14
+
15
+ - **图片**(PNG / JPEG / WebP / GIF)走官方草稿图栏(64px 缩略图,点击灯箱),发送后进模型视觉上下文。
16
+ - **其它文件**落到会话工作区 `.dsh-uploads/`,同一条轨上用 64px 高可读横条卡(扩展名角标 + 文件名 + 大小)。
17
+ - 发送后文件卡贴在用户气泡栈(与官方图同一列),作业回复不会插在提问和文件中间。
18
+ - 发送成功即清输入框待发轨。回复结尾只画「产物」chip。
19
+
20
+ 不要和 `dsh-file-fix` / `dsh-file-upload` / `dsh-paste-to-path` 叠装。
21
+
22
+ ## 截图
23
+
24
+ | 空输入框(回形针在左,无额外上边距) | 待发:图 + 已上传 / 上传中 / 超限 |
25
+ |---|---|
26
+ | ![空输入框](screenshots/01-empty.png) | ![待发混排](screenshots/02-rail.png) |
27
+
28
+ | 拖入窗口任意位置 | 发送后:图与文件卡跟用户气泡,产物在回复尾 |
29
+ |---|---|
30
+ | ![拖入遮罩](screenshots/03-overlay.png) | ![发送后](screenshots/04-sent.png) |
31
+
32
+ 本地预览页(可切状态):打开仓库里的 [`preview.html`](preview.html)。
33
+
34
+ ## 入口
35
+
36
+ | 操作 | 行为 |
37
+ |---|---|
38
+ | 拖进窗口任意位置 | 全屏「松开以添加文件」;松手即分流,不必对准卡片 |
39
+ | Ctrl+V 粘贴文件 | 同上分流;纯文本粘贴不受影响 |
40
+ | 输入框回形针 | `multiple` 文件选择,不限格式 |
41
+ | Esc | 取消本次拖入 |
42
+
43
+ ## 安装
44
+
45
+ ```bash
46
+ # 方式〇: npm(推荐)
47
+ npm i -g dsh-files-native
48
+ dsh plugin --profile web add dsh-files-native
49
+
50
+ # 方式一: GitHub
51
+ dsh plugin --profile web add github:meyaomiao/dsh-files-native
52
+
53
+ # 方式二: 克隆后本地挂载
54
+ git clone https://github.com/meyaomiao/dsh-files-native.git
55
+ cd dsh-files-native
56
+ pnpm install && pnpm build
57
+ dsh plugin --profile web add .
58
+ ```
59
+
60
+ 然后彻底重启 `dsh web`,浏览器硬刷新。宿主入口的 `inject` 必须含 `webServer` 与 `sessions`(漏了 DSH 会起不来,见 [插件开发门禁](docs/plugin-dev-gate.md))。
61
+
62
+ ## 当前实现
63
+
64
+ | 半区 | 入口 | Cordis `inject` | 职责 |
65
+ |---|---|---|---|
66
+ | host | `src/index.ts` | `webServer`, `sessions` | loopback 上传/删除;文件落到会话 cwd `.dsh-uploads/`;`agent/pre-step` 注入路径清单 |
67
+ | client | `src/client.ts` | `slots` | 整窗拖入/粘贴拦截;回形针;输入框混排轨;对话区文件卡 |
68
+
69
+ 关键约束:
70
+
71
+ - **禁止**在渲染路径调用 `useSession` / `useInput`。会话 id 只读 `InputZone` 快照 `session.id`。
72
+ - **禁止**对聊天时间线挂 `MutationObserver`。卡片一次性 portal 进相邻用户气泡栈。
73
+ - 空输入框时 `[data-file-native-host]:empty` 隐藏,避免 composer `gap` 多出一截上边距。有文件时轨 padding 对齐官方图栏 `4px 12px 0`。
74
+
75
+ ## 限制
76
+
77
+ - 单文件 50 MB,单批 20 个。
78
+ - 上传路由仅 loopback。
79
+ - 刷新会丢掉「已上传未发送」的文件卡(磁盘文件仍在 `.dsh-uploads/`)。
@@ -0,0 +1,6 @@
1
+ # dsh-files-native:接近原生质感的附件上传。
2
+ # 运行时插件 id 仍为 file-native(上传路由 /plugins/file-native/*、notice.plugin)。
3
+ # 图片走官方草稿图;其它文件落到会话工作区 .dsh-uploads/,发送时把相对路径交给模型。
4
+ - insert:
5
+ - id: file-native
6
+ name: dsh-files-native