dsh-code-ui 1.1.3

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) 2025 dsh-code-ui contributors
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,38 @@
1
+ # dsh-code-ui
2
+
3
+ A **Cursor-style AI code editor** inside DeepSeek Harness (DSH): file tree, multi-tab editing, syntax highlighting, and "cite/translate a selection to AI".
4
+
5
+ Bring the "read code, chat with AI" flow into DSH: a code workspace with an activity bar, file-tree sidebar, multi-tab editor, and an embedded AI input at the bottom.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ dsh plugin --profile web add dsh-code-ui
11
+ ```
12
+
13
+ Restart DSH, then click the floating **`Code UI`** / `default-ui` toggle at the top to enter the editor.
14
+
15
+ ## Usage
16
+
17
+ 1. Open the editor via the top `Code UI` toggle.
18
+ 2. Open a file from the tree or the file picker.
19
+ 3. Right-click a selection: copy / add note / translate / cite to AI.
20
+ 4. Type in the bottom input (Ctrl+Enter to send); cited code is attached automatically.
21
+ 5. Or say "read my cited code" and the AI will call the `get_referenced_snippets` tool.
22
+
23
+ ## Layout
24
+
25
+ ```
26
+ dsh-code-ui/
27
+ ├── package.json # dsh.bundle.patch / dsh.client manifest
28
+ ├── lib/
29
+ │ ├── index.js # Host: connection.rpc file/reference/note endpoints + tool
30
+ │ └── client.js # Client: __ModuleLoader__ + editor UI
31
+ └── cordis.patch.yml # bundle patch layer
32
+ ```
33
+
34
+ Hand-written JavaScript — no build step, `npm publish` directly.
35
+
36
+ ## License
37
+
38
+ MIT
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # dsh-code-ui
2
+
3
+ 在 DeepSeek Harness(DSH)里的 **Cursor 风格 AI 代码编辑器**插件:文件树、多标签页编辑、语法高亮、引用/翻译给 AI。
4
+
5
+ 它把 Cursor 那种「边看代码、边跟 AI 对话」的体验搬进 DSH:一个带活动栏、文件树、多标签页编辑器的代码工作区,底部直接内嵌 AI 输入框。
6
+
7
+ ## 功能
8
+
9
+ - **Cursor 风格工作区**:活动栏 + 文件树侧边栏 + 多标签页编辑器 + 状态栏
10
+ - **语法高亮**:内联轻量 tokenizer,覆盖 JS/TS/Python/HTML/CSS 等
11
+ - **文件浏览与编辑**:展开目录、打开文件、直接编辑、`Ctrl+S` 保存写回磁盘
12
+ - **选中代码右键**:
13
+ - 📋 复制
14
+ - 📥 粘贴到备注
15
+ - 📝 添加备注
16
+ - 🌐 翻译(创建翻译引用,交给 AI 翻译)
17
+ - 🔗 引用给 AI
18
+ - **引用 chip**:引用后输入框上方显示 `文件名(起行-止行)` + ✕,删除引用
19
+ - **内嵌 AI 输入框**:直接输入、`Ctrl+Enter` 发送,发送时自动附带已引用的完整代码
20
+ - **主题跟随**:使用 DSH 的 `--dsw-alias-*` 语义变量,浅色/深色自动切换
21
+ - **窗口化/全屏**:可拖拽、可缩放、可全屏/还原
22
+ - **以此文件夹为根**:文件浏览器里可选任意目录作为工作区根
23
+ - **检查更新 / 一键更新**:设置 → 插件 → 插件配置 中的 dsh-code-ui 卡片,支持在线检查 npm 新版本并一键更新;未发布/开发期可填本地 `.tgz` 路径安装(pnpm 流式进度展示,失败自动归类给出建议,完成后提示重启 DSH 生效)
24
+
25
+ ## 安装
26
+
27
+ 通过 `dsh plugin` 一键安装(已声明 `dsh.bundle`):
28
+
29
+ ```bash
30
+ dsh plugin --profile web add dsh-code-ui
31
+ ```
32
+
33
+ 安装完成后重启 DSH,页面顶部出现 `Code UI` / `原始风格-ui` 切换浮条,点 `Code UI` 进入编辑器。
34
+
35
+ 或手动安装:
36
+
37
+ ```bash
38
+ cd $DSH_HOME/profiles # Windows: %USERPROFILE%\.dsh\profiles
39
+ npm install dsh-code-ui
40
+ ```
41
+
42
+ 然后在 `cordis.patch.yml` 追加:
43
+
44
+ ```yaml
45
+ - insert:
46
+ - id: dsh-code-ui
47
+ name: 'dsh-code-ui'
48
+ ```
49
+
50
+ ## 使用
51
+
52
+ 1. 点顶部 `Code UI` 进入编辑器
53
+ 2. 在文件树/浏览器里打开文件
54
+ 3. 选中代码右键 → 引用 / 翻译 / 备注 / 复制
55
+ 4. 底部输入框直接发消息(`Ctrl+Enter` 发送),已引用的代码会自动附带
56
+ 5. 也可对 AI 说「读取我引用的代码」,AI 会调用 `get_referenced_snippets` 工具
57
+
58
+ ## 目录结构
59
+
60
+ ```
61
+ dsh-code-ui/
62
+ ├── package.json # 包声明(含 dsh.bundle.patch / dsh.client)
63
+ ├── lib/
64
+ │ ├── index.js # Host 端:connection.rpc 文件/引用/备注 RPC + get_referenced_snippets 工具
65
+ │ └── client.js # Client 端:__ModuleLoader__ + 编辑器 UI
66
+ └── cordis.patch.yml # bundle 插接层
67
+ ```
68
+
69
+ 纯 JavaScript 手写实现,无需构建,可直接 `npm publish`。
70
+
71
+ ## 实现说明
72
+
73
+ - **Host↔Client RPC**:Host 通过 `connection.rpc.handle("/dsh-code-ui", handler)` 注册文件系统/引用/备注端点;Client 通过 `connection.rpc.call("/dsh-code-ui", endpoint, payload)` 调用。RPC 返回值遵循 DSH 的 `RpcResult` 协议(`{ ok: true, value }` / `{ ok: false, error }`)。
74
+ - **模型工具**:注册 `get_referenced_snippets`,让 AI 读取用户标记的代码片段。
75
+ - **Client UI**:`window.__ModuleLoader__.load({ id, factory })` 注册,React 通过 `require("react")` 获取,slot 通过 `ctx.get("slots")` 注册(`shell.overlay`),样式用 `--dsw-alias-*` 主题变量。
76
+
77
+ ## 二次开发
78
+
79
+ - `lib/index.js`:改文件读写、引用/备注存储、或新增 RPC 端点(在 `connection.rpc.handle` 的 handler 里加 `if (endpoint === ...)`)
80
+ - `lib/client.js`:改编辑器 UI 布局、配色(`styles` 模板串里的 CSS)、或新增右键菜单项
81
+ - 引用/备注数据存模块内存(运行期有效,重启清空)
82
+
83
+ ## 发布
84
+
85
+ ```bash
86
+ npm publish --dry-run
87
+ npm publish
88
+ ```
89
+
90
+ 发布前确认 `name` 未被占用,必要时改为 scope 如 `@yourname/dsh-code-ui`。
91
+
92
+ ## License
93
+
94
+ MIT
@@ -0,0 +1,10 @@
1
+ # dsh-code-ui — bundle patch layer.
2
+ #
3
+ # Installing this package into a profile (`dsh plugin --profile <name> add dsh-code-ui`)
4
+ # appends it to `dsh.profile.bundles`; this patch is then applied as that
5
+ # bundle's layer. The row below loads the package's main entry (lib/index.js)
6
+ # as the host half, and because the package declares `dsh.client`, the web
7
+ # app also loads its `./client` bundle as the browser half.
8
+ - insert:
9
+ - id: dsh-code-ui
10
+ name: dsh-code-ui