-
Notifications
You must be signed in to change notification settings - Fork 668
chore(cua): sync driver v0.2.0 #1671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Plan | ||
|
|
||
| ## Source Review | ||
|
|
||
| - Compare upstream `trycua/cua` tags `cua-driver-v0.1.5` and | ||
| `cua-driver-v0.2.0`. | ||
| - Apply the Swift driver delta with a three-way merge against DeepChat's | ||
| maintained fork. | ||
| - Keep upstream Rust driver changes out of this sync. | ||
|
|
||
| ## Implementation | ||
|
|
||
| - Merge upstream Swift runtime changes into | ||
| `plugins/cua/vendor/cua-driver/source`. | ||
| - Adapt new upstream TCC, doctor, and MCP daemon-proxy text and commands to | ||
| `DeepChat Computer Use.app` and `com.wefonk.deepchat.computeruse`. | ||
| - Preserve DeepChat-only CLI behavior: `deepchat-permission-probe`, nonblocking | ||
| MCP startup, and DeepChat-managed `update`. | ||
| - Update `plugins/cua/vendor/cua-driver/upstream.json` to `cua-driver-v0.2.0`. | ||
| - Leave packaged skills unchanged unless validation shows upstream skill content | ||
| changed in the Swift release. | ||
|
|
||
| ## Validation | ||
|
|
||
| - Run `swift build --package-path plugins/cua/vendor/cua-driver/source --product cua-driver`. | ||
| - Run `pnpm run format`. | ||
| - Run `pnpm run i18n`. | ||
| - Run `pnpm run lint`. | ||
| - Run `git diff --check`. | ||
| - Run `pnpm run plugin:cua:build:mac:arm64`. | ||
| - Run `pnpm run plugin:validate -- --name cua --platform darwin --arch arm64`. | ||
|
|
||
| ## Risk | ||
|
|
||
| The vendored driver is a local fork with DeepChat-specific TCC and packaging | ||
| behavior. A direct replacement with upstream source would risk regressing the | ||
| helper identity, permission flow, and plugin-managed update path, so the sync is | ||
| kept as an explicit fork merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # CUA Driver v0.2.0 Sync | ||
|
|
||
| ## Problem | ||
|
|
||
| The bundled DeepChat Computer Use helper is based on upstream | ||
| `cua-driver-v0.1.5`. Upstream Swift CUA driver `cua-driver-v0.2.0` contains | ||
| macOS reliability fixes for focus suppression, screenshot capture fallback, | ||
| hidden app handling, side-effect detection, and MCP daemon proxying. | ||
|
|
||
| ## User Story | ||
|
|
||
| As a DeepChat user using the bundled CUA plugin, I need the macOS helper to | ||
| include current upstream Swift driver fixes while continuing to use DeepChat's | ||
| helper app, TCC permissions, MCP registration, and plugin packaging. | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - Vendored upstream metadata records `cua-driver-v0.2.0` and commit | ||
| `d3f3b9325f49aa5302c15fb03f6b66bd1e688e27`. | ||
| - The local fork includes the upstream Swift driver runtime improvements from | ||
| `v0.1.5` through `v0.2.0`. | ||
| - DeepChat-specific behavior remains intact: `DeepChat Computer Use.app`, | ||
| bundle id `com.wefonk.deepchat.computeruse`, `deepchat-permission-probe`, | ||
| DeepChat-managed updates, and MCP-first plugin skills. | ||
| - The Rust `cua-driver-rs` runtime is not introduced in this sync. | ||
| - Validation covers Swift build, formatting, i18n, lint, diff checks, CUA | ||
| runtime build, and plugin validation where practical. | ||
|
|
||
| ## Non-goals | ||
|
|
||
| - No migration to `cua-driver-rs`. | ||
| - No changes to the CUA plugin manifest, settings UI, MCP server id, or tool | ||
| policy. | ||
| - No adoption of upstream standalone installer behavior for DeepChat updates. | ||
|
|
||
| ## Constraints | ||
|
|
||
| - Preserve DeepChat's local helper app identity for TCC attribution. | ||
| - Keep packaged `plugins/cua/skills/cua-driver` guidance MCP-first. | ||
| - Treat upstream standalone scripts as reference material unless required by | ||
| the bundled helper build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Tasks | ||
|
|
||
| - [x] Identify latest upstream Swift CUA driver release. | ||
| - [x] Confirm Rust `cua-driver-rs` remains out of scope. | ||
| - [x] Compare `cua-driver-v0.1.5` to `cua-driver-v0.2.0`. | ||
| - [x] Merge upstream Swift runtime changes into the DeepChat fork. | ||
| - [x] Preserve DeepChat helper app identity, permission probe, update policy, | ||
| and MCP-first behavior. | ||
| - [x] Update vendored upstream metadata. | ||
| - [x] Run Swift build validation. | ||
| - [x] Run formatting, i18n, lint, and diff checks. | ||
| - [x] Build the CUA plugin runtime. | ||
| - [x] Validate the CUA plugin package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
plugins/cua/vendor/cua-driver/source/Sources/CuaDriverCLI/BundleHelpers.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import Darwin | ||
| import Foundation | ||
|
|
||
| /// Shared "is this binary running from inside an installed DeepChat Computer Use.app | ||
| /// bundle?" heuristic used by both `ServeCommand` (for the | ||
| /// auto-relaunch-via-`open` path) and `MCPCommand` (for the daemon proxy | ||
| /// path). Resolves `Bundle.main.executablePath` (falling back to | ||
| /// `CommandLine.arguments.first`) through any symlinks via `realpath` and | ||
| /// checks whether the resolved path lives inside some | ||
| /// `DeepChat Computer Use.app/Contents/MacOS/` directory. | ||
| /// | ||
| /// That's the "installed via install-local.sh / install.sh" shape — | ||
| /// `/usr/local/bin/cua-driver` is a symlink into | ||
| /// `/Applications/DeepChat Computer Use.app`, and `realpath` walks into the | ||
| /// bundle. Returns `false` for `swift run` / | ||
| /// raw `.build/<config>/cua-driver` dev invocations, which have no installed | ||
| /// bundle to relaunch into. | ||
| /// | ||
| /// Subcommands may wrap this with additional gating (env vars, flags, | ||
| /// parent-pid checks, etc.) when their relaunch heuristics diverge. | ||
| func isExecutableInsideCuaDriverApp() -> Bool { | ||
| // Prefer Foundation's executablePath (stable, absolute). | ||
| // Fall back to argv[0] when unset, which realpath() still | ||
| // resolves via $PATH lookup at the shell level — good enough | ||
| // for the cases we care about. | ||
| let candidate = Bundle.main.executablePath | ||
| ?? CommandLine.arguments.first | ||
| ?? "" | ||
| guard !candidate.isEmpty else { return false } | ||
|
|
||
| var buffer = [CChar](repeating: 0, count: Int(PATH_MAX)) | ||
| guard realpath(candidate, &buffer) != nil else { return false } | ||
| let resolved = String(cString: buffer) | ||
| return resolved.contains("/DeepChat Computer Use.app/Contents/MacOS/") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.