dsh-work-components 0.0.0-stage → 0.2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-workbench 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/NOTICE ADDED
@@ -0,0 +1,49 @@
1
+ dsh-workbench
2
+ Copyright (c) 2026 dsh-workbench contributors
3
+
4
+ The original source in this repository is licensed under the MIT License.
5
+ See the LICENSE file in the repository root.
6
+
7
+ This notice does not change the license of third-party material. Keep it, and
8
+ the license texts it points to, with every copy or substantial portion.
9
+
10
+ ## Third-party code
11
+
12
+ vendor/dsh-tools/ is a copy of DeepSeek Harness code, not a work of the
13
+ dsh-workbench contributors.
14
+
15
+ Copyright (c) 2026 DeepSeek
16
+ License: MIT (vendor/dsh-tools/LICENSE)
17
+ Upstream: https://github.com/deepseek-ai/deepseek-harness
18
+
19
+ Taken from DSH Desktop 2.0.13, package version 0.1.5-rc.2:
20
+
21
+ schema.js, json-schema.js
22
+ @deepseek-ai/dsh-tools
23
+ util-values.js
24
+ @deepseek-ai/dsh-util-values
25
+ harness-error.js
26
+ the HarnessError class from @deepseek-ai/dsh-llm
27
+
28
+ Local edits are limited to rewriting package imports onto relative paths in
29
+ this directory, and keeping only the HarnessError class in harness-error.js.
30
+ npm run vendor:sync rewrites those three generated files and puts the
31
+ copyright notice back. The DeepSeek copyright notice and MIT permission
32
+ text must stay with these files.
33
+
34
+ The published npm metadata for an older @deepseek-ai/dsh-tools release
35
+ (0.0.1-rc.1) has been described as BSD-3-Clause. The copy in this repository
36
+ follows the MIT text of the public deepseek-harness tree, which matches these
37
+ sources. If a future sync comes from a package whose own LICENSE file is
38
+ different, replace vendor/dsh-tools/LICENSE with that file and update this
39
+ notice. Do not drop the upstream copyright line.
40
+
41
+ ## Names
42
+
43
+ DeepSeek, DSH, and the names of the applications this plugin can launch are
44
+ used to say what the plugin is compatible with. They are trademarks of their
45
+ owners. This project is not affiliated with, sponsored by, or endorsed by
46
+ DeepSeek or those other owners.
47
+
48
+ The settings page uses generic stroke icons. It does not include third-party
49
+ logos or screenshots of third-party user interfaces.
package/README.md CHANGED
@@ -1,3 +1,160 @@
1
- # Temporary Holding Version
1
+ # dsh-work-components(工作组件)
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
+ 兼容 DeepSeek Harness(DSH)的插件,用来统一挂载和管理「控制其他工作软件」的 MCP 服务器(Office / 创作工具 / Windows 桌面 / Notion / Cloudflare / GitHub / ComfyUI 等)。每个工作组件以 `@deepseek-ai/dsh-mcp-client` 子插件的形式挂载:不写进 profile,随本插件卸载,设置改动后只重挂受影响的组件。
4
+
5
+ 自有代码采用 [MIT 许可证](./LICENSE)。`vendor/dsh-tools/` 是 DeepSeek 的代码副本,版权归 DeepSeek,许可同样是 MIT,全文和保留义务见 [NOTICE](./NOTICE) 与 [vendor/dsh-tools/LICENSE](./vendor/dsh-tools/LICENSE)。
6
+
7
+ 文中的产品名称只用来说明兼容对象,是各自权利人的商标。本项目与 DeepSeek、微软、Blender Foundation、Unity Technologies、Figma、Adobe、Google、Godot Foundation、Notion、Cloudflare、GitHub、Comfy、FFmpeg、Obsidian 等没有隶属、赞助或授权关系。设置页图标是通用线条;仓库不收录第三方产品标志。插件自身设置页的实装截图见下文「实装截图」。
8
+
9
+ | 组件 | MCP 服务器 | 工具名前缀 | 前提(简述) |
10
+ |---|---|---|---|
11
+ | Office | [OfficeMCP](https://github.com/officemcp/officemcp)(COM) | `mcp__officemcp__` | Windows + Office(Word / Excel / PowerPoint 等) |
12
+ | Blender | [mcp-for-blender](https://github.com/ahujasid/blender-mcp)(PyPI) | `mcp__blender__` | Blender 开着并启用对应插件 |
13
+ | Unity | [mcp-for-unity / mcpforunityserver](https://github.com/CoplayDev/unity-mcp)(Coplay) | `mcp__unity__` | Unity 编辑器装了 MCP for Unity 包并开着工程 |
14
+ | Figma | [figma-console-mcp](https://github.com/southleft/figma-console-mcp)(npm;也可改连官方桌面版 MCP) | `mcp__figma__` | Figma 桌面版 + Desktop Bridge(console)或 Dev Mode 官方 MCP |
15
+ | Photoshop | [@alisaitteke/photoshop-mcp](https://github.com/alisaitteke/photoshop-mcp)(npm,COM / ExtendScript) | `mcp__photoshop__` | Windows(或 macOS)装有 Photoshop 并开着 |
16
+ | Chrome | [chrome-devtools-mcp](https://github.com/ChromeDevTools/chrome-devtools-mcp)(npm) | `mcp__chrome__` | 本机 Google Chrome;可独立启动或连已有实例 |
17
+ | Windows | [Windows-MCP](https://github.com/CursorTouch/Windows-MCP)(PyPI) | `mcp__windows__` | Windows;stdio 由插件拉起,或连已有 HTTP 服务 |
18
+ | Notion | [Notion MCP](https://developers.notion.com/docs/mcp)(经 [mcp-remote](https://github.com/geelen/mcp-remote) OAuth 桥) | `mcp__notion__` | 首次 OAuth;token 在 `%USERPROFILE%\.mcp-auth` |
19
+ | Cloudflare | [Cloudflare API MCP](https://github.com/cloudflare/mcp-server-cloudflare)(经 mcp-remote) | `mcp__cloudflare__` | 首次 OAuth(scope=offline_access) |
20
+ | Cloudflare Docs | [Cloudflare Docs MCP](https://developers.cloudflare.com/agents/model-context-protocol/mcp-servers-catalog/)(公开 HTTP) | `mcp__cloudflare-docs__` | 无需登录 |
21
+ | GitHub | [GitHub MCP](https://github.com/github/github-mcp-server)(托管 HTTP) | `mcp__github__` | PAT:设置 `githubToken` 或环境变量 `GITHUB_MCP_PAT` |
22
+ | ComfyUI | [comfy-mcp](https://github.com/Comfy-Org/comfy-mcp)(PyPI) | `mcp__comfyui__` | 本机 ComfyUI / comfy-cli |
23
+ | Godot | [godot-ai](https://github.com/hi-godot/godot-ai)(PyPI,`godot-ai attach`) | `mcp__godot__` | Godot 4.7+ 编辑器开着项目,且项目启用了同版本 Godot AI 插件 |
24
+ | FFmpeg | [Kinocut](https://github.com/KyaniteLabs/kinocut)(PyPI `kinocut`,原 mcp-video) | `mcp__ffmpeg__` | 本机已安装 ffmpeg/ffprobe(PATH 或设置路径) |
25
+ | Obsidian | [obsidian-mcp-server](https://github.com/cyanheads/obsidian-mcp-server)(npm) | `mcp__obsidian__` | Obsidian 开着 + 社区插件 Local REST API + API 密钥 |
26
+
27
+ 组件依赖的运行时(uv + Python,或 Node.js)与各上游 MCP 包,都可以在设置页「下载安装」到插件自己的 `tools/` 目录。**新鲜安装时所有工作组件 MCP 与会话控制均默认关闭**(`*Enabled: false`),装好后在管理页逐个打开「启用」才会挂载对应 MCP。具体安装、桥接、端口与项目侧配置都在设置 UI 里完成,本 README 不重复操作步骤。
28
+
29
+ 计划加入:TRIX-GAMEBOT。
30
+
31
+ 多模态:`mm_send_image`(本地图片 → Host `attachmentId`;render=`text`+`image`;UI:`presentationMeta.mm` → turnTail MmCard,toolview 仅 pending/compact)。
32
+
33
+ ## 实装截图
34
+
35
+ ![工作组件列表](https://github.com/meya-ashuripehya/dsh-multimodal/raw/main/docs/images/01-settings-workbench-list.png)
36
+
37
+ ## 设置页
38
+
39
+ DSH 设置里的「工作组件」页:首页是功能列表(按分组),行首应用图标、行尾实时状态,点进该项的管理页。
40
+
41
+ | 分组 | 功能 | 列表状态(示意) | 管理页要点 |
42
+ | --- | --- | --- | --- |
43
+ | 多模态 | 媒体卡片 | mm_send_image · 可用 | `mm_send_image` 发图(API text+image;settled MmCard 在 turnTail,toolview 折叠后仍可见) |
44
+ | 工作组件 | Office / Blender / Unity / Figma / Photoshop / Chrome / Godot / Windows / Notion / Cloudflare / Cloudflare Docs / GitHub / ComfyUI / FFmpeg / Obsidian(徽标「已验证」) | 已连接 / 已启用 / 未启用 / 未安装 / 出错 / 安装中… | 运行与连接说明、下载安装 / 卸载、「启用」、组件专属配置 |
45
+ | 本地兼容 | `local-components/<id>/` 下的用户模块(徽标「本地」;可用 env `DSH_WORKBENCH_LOCAL_COMPONENTS_DIR`) | 同上 | 与仓库自带同接口;详情页「启用」;管理页复制 PR 清单 / 打开 Compare(**不**自动 commit / push / `gh pr create`) |
46
+ | 通用 | uv / Node.js / 下载代理 | 可用 / 未安装 / 已设置… | 运行时安装与代理等共用项 |
47
+ | 基础工具 | 添加工作组件 | 提示词工具 | Token 声明 + 可复制 AI 提示词:写成**本地**模块(不装进 `tools/`)。选型**功能最全优先**;应补可配置/必填参数(中文 label);本地阶段 `keys` + `launch`/`spec` 硬编码默认,拟议 schema 写注释;自定义键未进 schema 前不持久化。模块就位后重启 DSH,再在设置页下载安装。 |
48
+
49
+ 有上游仓库的功能在标题旁显示蓝色网址文字(新标签打开)。管理页「‹ 返回」或 Esc 回列表;每页各自「保存」;「启用」拨动后立即单独保存(本地组件同样有启用开关,键 `<id>Enabled`,**缺省关**)。安装进行中列表与管理页约每 1.5 秒刷新;有组件已启动时约每 5 秒刷新以跟上「已连接」。设置命名空间:`dsh-workbench`。
50
+
51
+ ### 「已连接」
52
+
53
+ 优先级:安装中 / 排队中 → 出错 → **已连接** → 已启动 → 未启动 / 未安装。
54
+
55
+ - **已启动**(`status: on`):MCP 服务器已挂载,尚未确认够得着目标程序。
56
+ - **已连接**(`status: connected`):已启动,且 (a) 对应程序在运行,(b) MCP 层可达。
57
+
58
+ 探测在 `GET /components` 时按需进行(`src/connect.mjs`):只读、不拉起程序;结果缓存 `PROBE_TTL_MS`(6s),同一组件不并发,一轮共用一次进程列表;单次探测限时 `PROBE_TIMEOUT_MS`(15s)、工具调用默认限时 4s;请求最多等 1.5s,未完成的下次再带。工具经 `ctx.tools` 里 dsh-mcp-client 已有连接直接执行。上次已连接而本次工具超时则暂保持已连接并注明。组件重挂后旧结果作废。
59
+
60
+ | 组件 | (a) 程序在运行 | (b) MCP 够得着 |
61
+ | --- | --- | --- |
62
+ | Office | 进程 WINWORD / EXCEL / POWERPNT 等(含 Visio、Outlook、WPS 等) | `RunningApps`(COM,只读)非空 |
63
+ | Blender | 进程 blender | 已注册工具 + TCP 连插件端口(`BLENDER_HOST:BLENDER_PORT`,默认 `localhost:9876`) |
64
+ | Unity | 进程 Unity | 已注册工具 + 按 `~/.unity-mcp`(或 `UNITY_MCP_STATUS_DIR`)端口文件与默认 6400 做桥接 ping |
65
+ | Figma(console) | 进程 Figma(不含 figma_agent) | `figma_get_status` 中 `transport.websocket.available` |
66
+ | Figma(官方) | 进程 Figma | TCP 连官方 MCP 地址(默认 `127.0.0.1:3845`) |
67
+ | Photoshop | 进程 Photoshop | `photoshop_ping` 成功(`PSMCP_FEEDBACK=0`、`ANALYTICS_DISABLED=1`) |
68
+ | Chrome(launch) | chrome-devtools-mcp 专用配置目录被 Chrome 占用 | `list_pages` 成功(未占用时不调,避免拉起 Chrome) |
69
+ | Chrome(autoConnect) | chrome + 渠道默认配置目录有 `DevToolsActivePort` 且端口开 | `list_pages` 成功 |
70
+ | Chrome(browserUrl) | `GET <调试地址>/json/version` 成功 | `list_pages` 成功 |
71
+ | Godot | 进程名以 Godot 开头(不含 venv 里的 `godot-ai`) | 已注册工具 + `session_manage(op=list)` 有会话 + `editor_state` 成功 |
72
+ | FFmpeg | 本机能解析到 ffmpeg(PATH 或 `ffmpegPath`) | MCP 已就绪(Kinocut 不依赖常驻 GUI) |
73
+ | Obsidian | 进程 Obsidian | 已注册工具 + TCP 连 Local REST API(`obsidianBaseUrl`,默认 `127.0.0.1:27123`) |
74
+
75
+ ## 架构(给开发者)
76
+
77
+ 组件文件夹约定见 **[docs/component-module.md](./docs/component-module.md)**(布局、稳定导出、共享层、新增检查清单)。
78
+
79
+ ```
80
+ src/
81
+ index.mjs 宿主入口:SettingsSchema、API、mm_send_image
82
+ components.mjs 兼容再导出 → ./components/
83
+ components/ 仓库自带组件 + shared / registry / manager
84
+ connect-lib.mjs 「已连接」共享原语(进程 / TCP / MCP 调用)
85
+ connect.mjs 汇总各组件 app/probe,提供 probeComponent
86
+ tools.mjs tools/ 布局、下载、uv / Node / npm / venv 安装
87
+ lib/
88
+ index.mjs 构建产物(宿主)
89
+ client.js 前端设置页、mm_send_image toolview(pending)与 turnTail MmCard(ModuleLoader)
90
+ office/launch.py OfficeMCP 启动包装(stdio 友好)
91
+ cordis.patch.yml bundle 层,插入宿主插件行
92
+ docs/component-module.md 组件模块约定(含 bundled vs local)
93
+ scripts/ build、vendor:sync、各类 smoke
94
+ tools/ 本机「下载安装」落地(gitignore)
95
+ local-components/ 用户本地兼容源码(gitignore;可用 DSH_WORKBENCH_LOCAL_COMPONENTS_DIR 覆盖)
96
+ ```
97
+
98
+ **托管安装**:设置页可把 uv、Node.js 与各组件装进 `tools/`(`.dsh-install.json` 记版本)。启动查找顺序一般为:插件 `tools/` → 设置路径 → 系统 / 旁路兜底(如 uvx、`npx`、旁边的 `../officemcp`)。Figma「官方桌面版 MCP」模式走 streamable-http,不需本地包。测试可用环境变量 `DSH_WORKBENCH_TOOLS_DIR` 改落地目录。
99
+
100
+ **同源 API**(前缀 `/dsh-workbench/api`):
101
+
102
+ | 方法 | 路径 | 说明 |
103
+ |---|---|---|
104
+ | GET/POST | `/settings` | 读写 `dsh-workbench` 设置 |
105
+ | GET | `/components` | `{ ok, toolsDir, localComponentsDir, contributeCompareUrl, components }`;组件含 `moduleSource`(`bundled`/`local`)、`status`、`connection`、`install`、`source`(启动来源)等 |
106
+ | GET | `/components/<id>/contribute` | 仅 local:PR 清单、文件列表、compare URL、命令模板 |
107
+ | POST | `/components/<id>/install` | 开始(重新)安装,202;冲突 409。`id`:`uv` / `node` / `office` / … / `godot` / `ffmpeg` / `obsidian` |
108
+ | POST | `/components/<id>/uninstall` | 删除 `tools/` 中该安装 |
109
+ | POST | `/components/godot/addon` | body `{ project }`:把同版本插件装进 Godot 项目 |
110
+
111
+ 另有 `/dsh-workbench/assets/*` 提供插件 `assets/` 静态资源。
112
+
113
+ ### 从纯 MCP(cordis.patch)迁入
114
+
115
+ 本机原先在 `~/.dsh/profiles/desktop/cordis.patch.yml` 里用 `@deepseek-ai/dsh-mcp-client` 直接挂的 Windows / Notion / Cloudflare / Cloudflare Docs / GitHub / ComfyUI,已收进本插件的「工作组件」。迁完后请**去掉** profile 里对应的 `mcp-*` 插入项,避免工具双重注册;备份目录示例:`~/.dsh/profiles/desktop/.backup-before-mcp-to-workbench-*`。
116
+
117
+ **新增组件**:先写 `local-components/<id>/`(设置页「添加工作组件」提示词),再按 [docs/component-module.md](./docs/component-module.md) 合入 `src/components/` 并开 PR。本地模块由 registry 自动发现,与 bundled **同 id 时 bundled 优先**。宿主用 `RuntimeSettingsSchema` 合并本地 `*Enabled`(见 `src/index.mjs`)。运行时下载仍只落在 `tools/`(gitignore),仓库不附带已下载的 MCP 树。本机可有 gitignore 下的示例(如 `local-components/docker/`),文档只记约定,不强制提交该目录。测试可用 `DSH_WORKBENCH_LOCAL_COMPONENTS_DIR` 指向桩目录。
118
+
119
+ ## 构建与测试
120
+
121
+ ```powershell
122
+ npm install
123
+ npm run build # 不依赖已安装的 DSH;defineTool 在 vendor/dsh-tools(升级后可 npm run vendor:sync)
124
+ npm run smoke # 假 ctx,mm_send_image → lib/smoke.png
125
+ npm run smoke:tools # 走同一套安装代码装组件,再 MCP initialize / tools/list(可指定组件、--proxy、--skip-install、--uninstall)
126
+ npm run smoke:office # 按插件启动方案拉起 OfficeMCP(可用 --expect-managed)
127
+ npm run smoke:connect # 「已连接」实机冒烟(Windows):node scripts/connect-smoke.mjs chrome …
128
+ npm run smoke:local # 本地兼容发现 / moduleSource / contribute 清单
129
+ ```
130
+
131
+ 从源码挂进 DSH Desktop:在 `~/.dsh/profiles/desktop` 用 `pnpm add link:<插件目录>`,并在 `dsh.profile.bundles` 加入 `"dsh-work-components"`(若 profile 里曾直接挂同名 mcp-client,先去掉以免重复)。改 bundle 后需重启 Desktop。
132
+
133
+
134
+ ## 会话控制(通用)
135
+
136
+ 内置于本插件,不单独装包。面向官方 Harness **0.2.0-rc.2** 会话日志。
137
+
138
+ ### 功能
139
+
140
+ | 功能 | 入口 | 行为 |
141
+ |------|------|------|
142
+ | **撤回** | 用户消息下方操作行的「撤回」(设置 → 工作组件 → 通用 → 会话控制 可关) | 先把当前页正在看的会话恢复到内存,再追加一条 `surfaceOp: replace`,当前页收起该回合及之后的内容。恢复失败时才备份并物理截断磁盘日志,并由页面重新同步。 |
143
+ | **重试** | 助手操作行的「重试」(复制与分支之间) | 先恢复会话,再保留这条用户消息,用 `surfaceOp: replace` 收起它后面的回复,然后 `followup` 同一条内容。新回复直接流在原问题下面。恢复失败时不改磁盘日志。 |
144
+ | **熔断** | 输入框「暂停」按钮(随时可用,含思考中);或自动阈值 | 暂停只调用 `agent.cancel({ kind: 'user' }, { keepInbox: true })`。自动熔断在同一取消之后,等回合停写,再按撤回把失败尾轮从磁盘截掉。 |
145
+
146
+ ### 使用注意
147
+
148
+ 1. 只打开着、还没在内存里的会话,会先按官方 `sessionController` 恢复,再在当前页收起内容。撤回收起该回合及之后的全部对话;重试留下原问题,收起原回复并立刻重新生成。页面不用退出再进。恢复失败时,撤回仍截断磁盘并由当前页重新同步;重试不先删日志。
149
+ 2. 备份目录:`~/.dsh/repair-backups/workbench-session-controls-<时间戳>/`。
150
+ 3. 聊天内自动使用当前会话 `sessionId`,无需粘贴;设置页仍可调自动熔断阈值。
151
+ 4. 自动熔断阈值在设置页「会话控制」中调整。
152
+ 5. 主开关 `sessionControlsEnabled` 经 `/settings` 保存。有 DSH 设置服务时写入该服务;Desktop 无设置服务时写入插件目录 `.dsh-workbench-settings.json`(可用 `DSH_WORKBENCH_SETTINGS_FILE` 覆盖路径)。启用后聊天内撤回/重试/暂停会立即出现,无需重启。
153
+
154
+ ### API(宿主)
155
+
156
+ - `GET /dsh-workbench/api/session/turns?sessionId=`
157
+ - `POST /dsh-workbench/api/session/retract` `{ sessionId, userMessageSeq? , messageId? }`
158
+ - `POST /dsh-workbench/api/session/regenerate` `{ sessionId, userMessageSeq?, messageId? }`
159
+ - `POST /dsh-workbench/api/session/cancel` `{ sessionId, reason? }`
160
+ - `GET /dsh-workbench/api/session/notices`
@@ -0,0 +1,5 @@
1
+ # dsh-work-components bundle 层:插入宿主插件行(客户端半边由 package.json 的 dsh.client 声明)。
2
+ - insert:
3
+ - id: dsh-work-components
4
+ name: 'dsh-work-components'
5
+ config: {}