Skip to content

Commit b0cc054

Browse files
zerob13yyhhyyyyyyzhangmo8
authored
feat: mac computer use (#1557)
* docs: add mac computer use spec * docs: sync provider tables * fix: rtk status (#1541) * fix(rtk): simplify health check * fix(knowledge): use config ipc * fix(models): persist db model status * fix: harden MCP env and knowledge delete * fix: clean knowledge presenter cleanup paths * refactor: enhance transition effects and performance across message components (#1542) - Updated transition classes in MessageActionButtons.vue for smoother animations. - Refactored MessageBlockContent.vue to optimize artifact snapshot handling with computed properties. - Improved transition effects in MessageBlockToolCall.vue for better user experience. - Added a mention icon map in MessageContent.vue to streamline icon retrieval. - Enhanced MessageItemUser.vue with a new line counting function for better text handling. - Optimized MessageToolbar.vue for consistent transition effects on button interactions. - Refactored BrowserPanel.vue to simplify state management for synced bounds. - Improved ChatSidePanel.vue with better resizing and visibility handling. - Updated ChatPage.vue to enhance chat search highlight scheduling. - Cleaned up ChatTabView.vue by removing legacy collapsed new chat button functionality. - Enhanced tests in ChatTabView.test.ts and WindowSideBar.test.ts for improved coverage and accuracy. * chore: update markstream-vue to 0.0.13 (#1544) * fix: preserve interleaved reasoning (#1543) * chore(release): prepare v1.0.4-beta.2 * fix(ipc): allow attachment date metadata (#1547) * chore(release): prepare v1.0.4-beta.3 * feat: add mac computer use helper * feat: enhance computer use guidance * chore: bump acp registry versions * fix: import mac signing identity for helper * build(cua): vendor CUA driver source * fix(cua): prefer element index click mode * fix(cua): route zoom clicks by coordinates * docs(cua): prefer visual fallback for sparse UI * feat: update vendored cua driver * fix(computer-use): improve error handling and testability * docs(cua): add runtime plugin spec * feat(plugin): add CUA runtime plugin * feat: migrate computer use to plugin * fix: surface plugin tools and permissions * fix(plugin): use MCP-only CUA flow * ci(plugin): release CUA dcplugin assets * fix(plugin): hide CUA on unsupported OS * feat(plugin): bundle official CUA plugin * fix: harden plugin startup and CUA telemetry * chore: update CUA driver vendor * fix(build): sign CUA plugin helper * fix: improve CUA window scoped vision fallback * fix(cua): align pixel clicks with upstream --------- Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com> Co-authored-by: xiaomo <wegi866@gmail.com>
1 parent f516e16 commit b0cc054

268 files changed

Lines changed: 110365 additions & 69717 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ jobs:
188188
- name: Build Mac
189189
run: |
190190
pnpm run build
191+
pnpm run plugin:cua:bundle:mac:${{ matrix.arch }}
191192
pnpm exec electron-builder --mac --${{ matrix.arch }} --publish=never
192193
env:
193194
CSC_LINK: ${{ secrets.DEEPCHAT_CSC_LINK }}
@@ -202,6 +203,20 @@ jobs:
202203
NODE_OPTIONS: '--max-old-space-size=4096'
203204
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
204205

206+
- name: Verify bundled CUA plugin
207+
shell: bash
208+
env:
209+
TARGET_ARCH: ${{ matrix.arch }}
210+
run: |
211+
VERSION="$(node -p "require('./package.json').version")"
212+
APP_DIR="dist/mac/DeepChat.app"
213+
if [ "$TARGET_ARCH" = "arm64" ]; then
214+
APP_DIR="dist/mac-arm64/DeepChat.app"
215+
fi
216+
PLUGIN="${APP_DIR}/Contents/Resources/app.asar.unpacked/plugins/deepchat-plugin-cua-${VERSION}-darwin-${TARGET_ARCH}.dcplugin"
217+
test -f "$PLUGIN"
218+
ls -lh "$PLUGIN"
219+
205220
- name: Upload artifacts
206221
uses: actions/upload-artifact@v6
207222
with:

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ jobs:
288288
- name: Build Mac
289289
run: |
290290
pnpm run build
291+
pnpm run plugin:cua:bundle:mac:${{ matrix.arch }}
291292
pnpm exec electron-builder --mac --${{ matrix.arch }} --publish=never
292293
env:
293294
CSC_LINK: ${{ secrets.DEEPCHAT_CSC_LINK }}
@@ -303,6 +304,20 @@ jobs:
303304
NODE_OPTIONS: '--max-old-space-size=4096'
304305
VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }}
305306

307+
- name: Verify bundled CUA plugin
308+
shell: bash
309+
env:
310+
TARGET_ARCH: ${{ matrix.arch }}
311+
run: |
312+
VERSION="$(node -p "require('./package.json').version")"
313+
APP_DIR="dist/mac/DeepChat.app"
314+
if [ "$TARGET_ARCH" = "arm64" ]; then
315+
APP_DIR="dist/mac-arm64/DeepChat.app"
316+
fi
317+
PLUGIN="${APP_DIR}/Contents/Resources/app.asar.unpacked/plugins/deepchat-plugin-cua-${VERSION}-darwin-${TARGET_ARCH}.dcplugin"
318+
test -f "$PLUGIN"
319+
ls -lh "$PLUGIN"
320+
306321
- name: Upload artifacts
307322
uses: actions/upload-artifact@v6
308323
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ build/macarm.json
1414
build/macx64.json
1515
build/winarm.json
1616
build/winx64.json
17+
build/bundled-plugins/
1718
runtime/**/*
19+
plugins/*/runtime/**/*
1820
.eslintcache
1921
.env
2022
.env.local

docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Renderer
3535
| [architecture/session-management.md](./architecture/session-management.md) | 新会话管理与 legacy 数据平面边界 |
3636
| [guides/code-navigation.md](./guides/code-navigation.md) | 当前代码导航入口 |
3737
| [guides/getting-started.md](./guides/getting-started.md) | 新开发者快速上手 |
38+
| [guides/plugin-packaging.md](./guides/plugin-packaging.md) | `.dcplugin` 打包、内置分发和 release 规则 |
3839
| [architecture/baselines/dependency-report.md](./architecture/baselines/dependency-report.md) | 当前依赖与耦合基线 |
3940
| [architecture/baselines/main-kernel-boundary-baseline.md](./architecture/baselines/main-kernel-boundary-baseline.md) | main kernel refactor 当前阶段的边界指标与 hot path 快照 |
4041
| [architecture/baselines/main-kernel-bridge-register.md](./architecture/baselines/main-kernel-bridge-register.md) | main kernel refactor 的临时 bridge 登记表 |
@@ -112,6 +113,7 @@ docs/
112113
├── guides/
113114
│ ├── getting-started.md
114115
│ ├── code-navigation.md
116+
│ ├── plugin-packaging.md
115117
│ └── debugging.md
116118
├── specs/
117119
│ ├── agent-cleanup/
@@ -151,4 +153,3 @@ docs/
151153
- 工具与权限: [architecture/tool-system.md](./architecture/tool-system.md)
152154
- 会话与兼容边界: [architecture/session-management.md](./architecture/session-management.md)
153155
4. 如果需要对照旧实现,再去看 `archives/` 历史文档,不要依赖已经移除的历史源码快照。
154-

docs/guides/plugin-packaging.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# DeepChat Plugin Packaging
2+
3+
This guide documents `.dcplugin` packaging for official DeepChat plugins bundled with DeepChat
4+
release packages.
5+
6+
## Package Format
7+
8+
A `.dcplugin` file is a zip archive built from one plugin directory.
9+
10+
Required files:
11+
12+
- `plugin.json`: hydrated manifest used by the installer.
13+
- `checksums.json`: SHA-256 checksums for packaged files.
14+
- every file declared by manifest skills and settings contributions.
15+
- runtime payloads required by the target platform and architecture.
16+
17+
The packager excludes development-only sources such as `vendor/`, `build/`, `node_modules/`,
18+
`.build/`, `.DS_Store`, and symlinks.
19+
20+
Official packages keep DeepChat release asset URLs in their manifest metadata:
21+
22+
```text
23+
https://github.com/ThinkInAIXYZ/deepchat/releases/download/v<version>/<asset-name>.dcplugin
24+
```
25+
26+
## CUA Plugin Artifacts
27+
28+
The CUA plugin ships one macOS helper app per CPU architecture. The bundled package filename
29+
includes both platform and architecture:
30+
31+
```text
32+
deepchat-plugin-cua-<version>-darwin-arm64.dcplugin
33+
deepchat-plugin-cua-<version>-darwin-x64.dcplugin
34+
```
35+
36+
The manifest inside each package keeps the official DeepChat release-download namespace for trust
37+
metadata. Runtime detection inside the package uses the same architecture-specific plugin path:
38+
39+
```text
40+
plugin:runtime/darwin/<arch>/DeepChat Computer Use.app/Contents/MacOS/cua-driver
41+
```
42+
43+
Architecture mapping:
44+
45+
| DeepChat arch | Swift arch | Runtime directory |
46+
| --- | --- | --- |
47+
| `arm64` | `arm64` | `runtime/darwin/arm64/` |
48+
| `x64` | `x86_64` | `runtime/darwin/x64/` |
49+
50+
Each `.dcplugin` contains only the runtime directory for its target architecture.
51+
52+
## Local Commands
53+
54+
Validate the package metadata for the current host architecture:
55+
56+
```bash
57+
pnpm run plugin:cua:validate
58+
```
59+
60+
Build and package the current host architecture:
61+
62+
```bash
63+
pnpm run plugin:cua:package
64+
```
65+
66+
Build and package explicit macOS architectures:
67+
68+
```bash
69+
pnpm run plugin:cua:package:mac:arm64
70+
pnpm run plugin:cua:package:mac:x64
71+
```
72+
73+
Build the package that will be embedded into the macOS app:
74+
75+
```bash
76+
pnpm run plugin:cua:bundle:mac:arm64
77+
pnpm run plugin:cua:bundle:mac:x64
78+
```
79+
80+
Validate explicit macOS architectures after their helper runtimes have been staged:
81+
82+
```bash
83+
pnpm run plugin:cua:validate:mac:arm64
84+
pnpm run plugin:cua:validate:mac:x64
85+
```
86+
87+
Standalone packages are written to:
88+
89+
```text
90+
dist/plugins/
91+
```
92+
93+
Bundled packages are written to:
94+
95+
```text
96+
build/bundled-plugins/
97+
```
98+
99+
## CI And Release
100+
101+
The macOS build matrix in `.github/workflows/build.yml` builds the matching CUA plugin bundle before
102+
running `electron-builder`. Electron Builder embeds it into:
103+
104+
```text
105+
DeepChat.app/Contents/Resources/app.asar.unpacked/plugins/
106+
```
107+
108+
Each matrix job verifies the expected bundled `.dcplugin` exists inside the app before uploading
109+
artifacts.
110+
111+
The release workflow repeats the same bundled package step. The final release uploads app artifacts
112+
only; `.dcplugin` files are not published as separate GitHub Release assets.
113+
114+
Expected embedded files:
115+
116+
```text
117+
app.asar.unpacked/plugins/deepchat-plugin-cua-<version>-darwin-x64.dcplugin
118+
app.asar.unpacked/plugins/deepchat-plugin-cua-<version>-darwin-arm64.dcplugin
119+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Non-macOS Handoff Notes
2+
3+
This implementation was completed on Windows, so the architecture and TypeScript integration were
4+
validated locally, while macOS runtime behavior still needs a Mac pass.
5+
6+
## Implemented
7+
8+
- Official-source-only plugin installation path with GitHub Release download and local
9+
`.dcplugin` selection.
10+
- Generic plugin resources for runtimes, MCP servers, skills, settings contributions, and tool
11+
policies.
12+
- Plugin-owned MCP registration with `ownerPluginId`.
13+
- Plugin-owned skill contribution support.
14+
- Isolated plugin settings renderer preload API exposed as `window.deepchatPlugin`.
15+
- Official `plugins/cua` package with a bundled macOS `DeepChat Computer Use.app` helper runtime.
16+
- CI/package scripts for architecture-specific
17+
`deepchat-plugin-cua-<version>-darwin-<arch>.dcplugin` artifacts.
18+
- App packaging no longer embeds the CUA helper inside the DeepChat app bundle.
19+
- App packaging no longer embeds the CUA plugin source; the app and plugin artifacts are built
20+
independently.
21+
22+
## Manual Install Flow
23+
24+
1. Build the plugin package for the current Mac:
25+
`pnpm run plugin:cua:package`
26+
- Apple Silicon explicit package: `pnpm run plugin:cua:package:mac:arm64`
27+
- Intel explicit package: `pnpm run plugin:cua:package:mac:x64`
28+
2. Open Settings > Plugins.
29+
3. Click Install on `com.deepchat.plugins.cua`.
30+
- DeepChat first downloads
31+
`https://github.com/ThinkInAIXYZ/deepchat/releases/download/v<app-version>/deepchat-plugin-cua-<app-version>-darwin-<arch>.dcplugin`.
32+
- If the asset is missing, DeepChat opens the matching GitHub Release page.
33+
4. Click Choose `.dcplugin` and select the downloaded package when automatic download is not
34+
available.
35+
5. Enable `com.deepchat.plugins.cua`, then verify runtime status, permission check, MCP
36+
registration, skill visibility, and tool policy prompts.
37+
38+
## Requires macOS validation
39+
40+
- `cua-driver --version` output shape.
41+
- `cua-driver check_permissions` output shape and permission parsing.
42+
- `cua-driver mcp` startup under DeepChat MCP stdio management.
43+
- TCC ownership remains with the bundled `DeepChat Computer Use.app` helper inside the installed
44+
plugin.
45+
- Plugin settings window can open the CUA permission guide and refresh status.
46+
- Signed `.dcplugin` packaging and official source distribution metadata.
47+
48+
## Legacy Demo Code
49+
50+
The prior built-in Computer Use implementation is removed from startup, routes, renderer API,
51+
settings, helper packaging, vendored source, and tests. The remaining CUA-specific source of truth is
52+
`plugins/cua`.

0 commit comments

Comments
 (0)