From 7de1e886b1c39754d4ba5e48abd788a42c38df90 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Wed, 8 Jul 2026 16:57:00 +0800 Subject: [PATCH] fix(cua): update driver and skill name --- .../cua-cross-platform-computer-use/plan.md | 14 +++--- .../cua-cross-platform-computer-use/spec.md | 14 +++--- .../cua-cross-platform-computer-use/tasks.md | 8 +-- .../cua-computer-use-skill-name/spec.md | 48 ++++++++++++++++++ docs/issues/cua-driver-0-7-1-update/spec.md | 49 +++++++++++++++++++ plugins/cua/plugin.json | 13 ++--- plugins/cua/policies/tool-policy.json | 7 +-- .../{cua-driver => computer-use}/README.md | 2 +- .../{cua-driver => computer-use}/RECORDING.md | 0 .../{cua-driver => computer-use}/SKILL.md | 11 +++-- .../{cua-driver => computer-use}/TESTS.md | 1 + .../{cua-driver => computer-use}/WEB_APPS.md | 0 plugins/cua/vendor/cua-driver/upstream.json | 20 ++++---- src/main/presenter/skillPresenter/index.ts | 19 ++++++- test/main/presenter/pluginPresenter.test.ts | 45 +++++++++++------ .../skillPresenter/skillPresenter.test.ts | 41 ++++++++++++++++ 16 files changed, 227 insertions(+), 65 deletions(-) create mode 100644 docs/issues/cua-computer-use-skill-name/spec.md create mode 100644 docs/issues/cua-driver-0-7-1-update/spec.md rename plugins/cua/skills/{cua-driver => computer-use}/README.md (95%) rename plugins/cua/skills/{cua-driver => computer-use}/RECORDING.md (100%) rename plugins/cua/skills/{cua-driver => computer-use}/SKILL.md (93%) rename plugins/cua/skills/{cua-driver => computer-use}/TESTS.md (87%) rename plugins/cua/skills/{cua-driver => computer-use}/WEB_APPS.md (100%) diff --git a/docs/features/cua-cross-platform-computer-use/plan.md b/docs/features/cua-cross-platform-computer-use/plan.md index 18dc7b984..e5841995e 100644 --- a/docs/features/cua-cross-platform-computer-use/plan.md +++ b/docs/features/cua-cross-platform-computer-use/plan.md @@ -26,7 +26,7 @@ Update `plugins/cua/plugin.json`: - `plugin:runtime/linux/${arch}/cua-driver` - Keep plugin-local runtime candidates first. - Update packaged download URL conventions to include target platform and arch. -- Update tool policies for upstream v0.6.7 tools. +- Update tool policies for upstream v0.7.1 tools. - Keep the internal tool server declaration owned by the plugin host; do not add user-facing MCP setup instructions. @@ -36,9 +36,9 @@ Update `plugins/cua/vendor/cua-driver/upstream.json` from the old Swift fork met Rust driver release: - `source`: upstream `trycua/cua`. -- `tag`: `cua-driver-rs-v0.6.7`. -- `commit`: `d6dea4bc3c3a65ce821261752067cae8200fe5d6`. -- `version`: `0.6.7`. +- `tag`: `cua-driver-rs-v0.7.1`. +- `commit`: `7caf72bee2286f47a985c3121b56aaabdebd62b9`. +- `version`: `0.7.1`. - Include the expected asset map and checksums source. - Record Windows arm64 as supported and Linux arm64 as unsupported for this pinned DeepChat integration. @@ -104,13 +104,13 @@ Update `.github/workflows/build.yml` and `.github/workflows/release.yml`: ### Skill Docs -Adapt CUA skill docs from upstream v0.6.7 into DeepChat-specific docs: +Adapt CUA skill docs from upstream v0.7.1 into DeepChat-specific docs: - Remove upstream manual install, PATH, and standalone MCP setup requirements. - Describe the DeepChat tool surface and platform behavior. - Add platform caveats for macOS permissions, Windows foreground/background dispatch, and Linux pre-release limitations. -- Replace Swift-era tool names with v0.6.7 tool names. +- Replace Swift-era tool names with v0.7.1 tool names. - Keep plugin support metadata aligned with the supported platform/arch matrix. ### Settings and Permission UX @@ -136,7 +136,7 @@ Update and add focused tests for: - CUA manifest hydration and visibility for supported platform/arch targets. - Runtime packaging validation per platform and arch. - Unsupported Linux arm64 behavior. -- Tool policy coverage for upstream v0.6.7 known tools. +- Tool policy coverage for upstream v0.7.1 known tools. - Skill docs no longer asserting macOS-only or user-managed MCP-only language. - Build and release workflow assertions for CUA on Windows x64/arm64, macOS, and Linux x64. diff --git a/docs/features/cua-cross-platform-computer-use/spec.md b/docs/features/cua-cross-platform-computer-use/spec.md index f1533dc9a..9eb2f7667 100644 --- a/docs/features/cua-cross-platform-computer-use/spec.md +++ b/docs/features/cua-cross-platform-computer-use/spec.md @@ -20,8 +20,8 @@ The current plugin is macOS-only: - Skill docs, runtime permission wording, tests, and packaging docs assume macOS. Upstream `trycua/cua` now publishes the Rust CUA driver as cross-platform release artifacts. The -latest verified driver release for this plan is `cua-driver-rs-v0.6.7`, published on -2026-06-24. DeepChat support for this feature is limited to the targets that have upstream release +latest verified driver release for this plan is `cua-driver-rs-v0.7.1`, published on +2026-07-07. DeepChat support for this feature is limited to the targets that have upstream release assets and have been validated for bundled plugin packaging: - macOS arm64 and x86_64, plus universal variants. @@ -101,9 +101,9 @@ DeepChat must continue to own the integration boundary: Pin the CUA runtime to a specific upstream release: -- Tag: `cua-driver-rs-v0.6.7`. -- Commit: `d6dea4bc3c3a65ce821261752067cae8200fe5d6`. -- Version: `0.6.7`. +- Tag: `cua-driver-rs-v0.7.1`. +- Commit: `7caf72bee2286f47a985c3121b56aaabdebd62b9`. +- Version: `0.7.1`. The build step must stage release artifacts instead of relying on local Swift-only source builds. Every staged asset must be validated before packaging: @@ -145,7 +145,7 @@ still consuming verified upstream release artifacts. ## Tool Surface -The plugin policy and skill docs must match upstream v0.6.7 tool names. +The plugin policy and skill docs must match upstream v0.7.1 tool names. Removed or renamed assumptions: @@ -224,7 +224,7 @@ The packaged app must keep CUA usable after Electron packaging: - Optional MCP capabilities not implemented by the CUA driver, such as prompts and resources, are treated as absent capabilities and must not produce error-level log spam. - Skill docs describe DeepChat usage and platform caveats, not upstream manual installer workflows. -- Tool policies cover all upstream v0.6.7 tools known to this integration. +- Tool policies cover all upstream v0.7.1 tools known to this integration. - Packaging docs and tests no longer describe CUA as macOS-only. - Build, lint, i18n, and focused test suites pass after implementation. diff --git a/docs/features/cua-cross-platform-computer-use/tasks.md b/docs/features/cua-cross-platform-computer-use/tasks.md index ee35ed05a..4a946a239 100644 --- a/docs/features/cua-cross-platform-computer-use/tasks.md +++ b/docs/features/cua-cross-platform-computer-use/tasks.md @@ -3,7 +3,7 @@ ## Task List - [x] T01 - Update CUA upstream metadata - - Replace old Swift fork metadata with pinned `cua-driver-rs-v0.6.7` metadata. + - Replace old Swift fork metadata with pinned `cua-driver-rs-v0.7.1` metadata. - Record supported and unsupported platform/arch targets. - Add expected upstream asset names and checksum source. @@ -30,7 +30,7 @@ - [x] T05 - Update CUA tool policies - Remove Swift-era `screenshot` and `set_recording` assumptions. - - Add policies for v0.6.7 read-only, action, recording, session, update, and platform-specific + - Add policies for v0.7.1 read-only, action, recording, session, update, and platform-specific tools. - Add a test that fails when a known upstream tool lacks an explicit policy. @@ -54,10 +54,10 @@ - Keep official plugin verification failing on missing expected artifacts. - [x] T09 - Update DeepChat skill docs - - Adapt upstream v0.6.7 skill guidance to DeepChat's bundled integration. + - Adapt upstream v0.7.1 skill guidance to DeepChat's bundled integration. - Remove manual installer, PATH, and user-managed MCP setup language. - Add macOS, Windows, and Linux platform caveats. - - Replace old tool names with v0.6.7 tool names. + - Replace old tool names with v0.7.1 tool names. - [x] T10 - Update settings and permission status - Keep macOS accessibility and screen-capture permission handling. diff --git a/docs/issues/cua-computer-use-skill-name/spec.md b/docs/issues/cua-computer-use-skill-name/spec.md new file mode 100644 index 000000000..b0c358751 --- /dev/null +++ b/docs/issues/cua-computer-use-skill-name/spec.md @@ -0,0 +1,48 @@ +# CUA Computer Use Skill Name + +## Issue + +The official CUA plugin contributes its built-in agent skill as `cua-driver` from +`skills/cua-driver/SKILL.md`. DeepChat skills use the folder-format contract +`/SKILL.md`, and discovery warns when `SKILL.md` frontmatter `name` differs from the +folder name. The user-facing capability is Computer Use; `cua-driver` is the runtime and MCP server +implementation detail. + +GitHub issue: https://github.com/ThinkInAIXYZ/deepchat/issues/1900 + +## Impact + +- Users see or activate a runtime implementation name instead of the Computer Use capability. +- The plugin skill is easier to confuse with the MCP server id. +- Future skill sync/export behavior expects the folder and frontmatter name to match. +- Existing sessions that persisted `cua-driver` as an active skill should keep Computer Use enabled + after the rename. + +## Root Cause + +The plugin skill was adapted from upstream CUA's `cua-driver` skill package without renaming the +DeepChat-owned skill contribution to the product capability name. + +## Fix Plan + +- Rename the plugin skill id and folder to `computer-use`. +- Rename `SKILL.md` frontmatter and heading to `computer-use`. +- Migrate persisted active skill names from `cua-driver` to `computer-use`. +- Keep runtime id, MCP server id, binary names, and upstream metadata as `cua-driver`. +- Update focused plugin tests. + +## Tasks + +- [x] Rename the CUA plugin skill contribution. +- [x] Migrate old active skill state to `computer-use`. +- [x] Update tests and references. +- [x] Run focused tests and required repository checks. + +## Validation + +- `corepack pnpm exec vitest run test/main/presenter/pluginPresenter.test.ts` +- `corepack pnpm exec vitest run test/main/presenter/skillPresenter/skillPresenter.test.ts` +- `corepack pnpm run plugin:bundle -- --name cua --platform darwin --arch arm64` +- `corepack pnpm run format` +- `corepack pnpm run i18n` +- `corepack pnpm run lint` diff --git a/docs/issues/cua-driver-0-7-1-update/spec.md b/docs/issues/cua-driver-0-7-1-update/spec.md new file mode 100644 index 000000000..e53bc1097 --- /dev/null +++ b/docs/issues/cua-driver-0-7-1-update/spec.md @@ -0,0 +1,49 @@ +# CUA Driver 0.7.1 Update + +## Issue + +DeepChat pins the bundled CUA runtime to `cua-driver-rs v0.6.7`, while upstream now publishes +`cua-driver-rs v0.7.1`. Packaged users cannot update DeepChat's managed helper through their own +PATH-installed `cua-driver`, so the bundled runtime metadata, minimum version, and tool policy need +to track the latest verified upstream release. + +GitHub issue: https://github.com/ThinkInAIXYZ/deepchat/issues/1898 + +## Impact + +- Packaged CUA can report itself stale even though the user cannot update the bundled helper. +- New read-only desktop capture support in `v0.7.1` is unavailable unless the policy allows it. +- Obsolete tool names remain in the allowlist/asklist if the policy is not synced. + +## Root Cause + +The official CUA plugin consumes pinned GitHub release assets from +`plugins/cua/vendor/cua-driver/upstream.json`. The pin and conservative tool policy are still based +on `cua-driver-rs-v0.6.7`. + +## Fix Plan + +- Update the pinned upstream metadata to `cua-driver-rs-v0.7.1`. +- Keep the existing DeepChat target matrix unchanged. +- Update the plugin runtime `minVersion`. +- Sync CUA tool policy with the `cua-driver 0.7.1 list-tools` output. +- Update the maintained CUA cross-platform contract docs. +- Run focused CUA checks plus required format, i18n, and lint commands. + +## Tasks + +- [x] Update release metadata and plugin minimum version. +- [x] Sync CUA policy and tests with the v0.7.1 tool surface. +- [x] Update maintained SDD contract docs. +- [x] Validate plugin runtime staging for representative targets. +- [x] Run required repository checks. + +## Validation + +- `pnpm exec vitest run test/main/presenter/pluginPresenter.test.ts` +- `pnpm run plugin:cua:build:mac:arm64` +- `pnpm run plugin:cua:build:win:x64` +- `pnpm run plugin:cua:build:linux:x64` +- `pnpm run format` +- `pnpm run i18n` +- `pnpm run lint` diff --git a/plugins/cua/plugin.json b/plugins/cua/plugin.json index 17a8276b4..707cc2862 100644 --- a/plugins/cua/plugin.json +++ b/plugins/cua/plugin.json @@ -37,7 +37,7 @@ "mode": "user-confirmed", "provider": "trycua", "strategy": "bundled-plugin-helper", - "minVersion": "0.6.7", + "minVersion": "0.7.1", "guideUrl": "https://cua.ai/docs/cua-driver/guide/getting-started/installation" } }, @@ -59,8 +59,8 @@ ], "skills": [ { - "id": "cua-driver", - "path": "skills/cua-driver/SKILL.md", + "id": "computer-use", + "path": "skills/computer-use/SKILL.md", "scope": "agent" } ], @@ -83,13 +83,13 @@ "get_screen_size": "allow", "get_window_state": "allow", "get_accessibility_tree": "allow", + "get_desktop_state": "allow", "get_cursor_position": "allow", "get_config": "allow", "get_recording_state": "allow", "get_agent_cursor_state": "allow", "check_for_update": "allow", "health_report": "allow", - "debug_window_info": "allow", "start_session": "allow", "end_session": "allow", "launch_app": "ask", @@ -99,14 +99,9 @@ "right_click": "ask", "double_click": "ask", "drag": "ask", - "mouse_button_down": "ask", - "mouse_button_up": "ask", - "mouse_drag": "ask", - "parallel_mouse_drag": "ask", "scroll": "ask", "move_cursor": "ask", "type_text": "ask", - "type_text_chars": "ask", "press_key": "ask", "hotkey": "ask", "set_value": "ask", diff --git a/plugins/cua/policies/tool-policy.json b/plugins/cua/policies/tool-policy.json index c68d92b11..aa717b34c 100644 --- a/plugins/cua/policies/tool-policy.json +++ b/plugins/cua/policies/tool-policy.json @@ -7,13 +7,13 @@ "get_screen_size": "allow", "get_window_state": "allow", "get_accessibility_tree": "allow", + "get_desktop_state": "allow", "get_cursor_position": "allow", "get_config": "allow", "get_recording_state": "allow", "get_agent_cursor_state": "allow", "check_for_update": "allow", "health_report": "allow", - "debug_window_info": "allow", "start_session": "allow", "end_session": "allow", "launch_app": "ask", @@ -23,14 +23,9 @@ "right_click": "ask", "double_click": "ask", "drag": "ask", - "mouse_button_down": "ask", - "mouse_button_up": "ask", - "mouse_drag": "ask", - "parallel_mouse_drag": "ask", "scroll": "ask", "move_cursor": "ask", "type_text": "ask", - "type_text_chars": "ask", "press_key": "ask", "hotkey": "ask", "set_value": "ask", diff --git a/plugins/cua/skills/cua-driver/README.md b/plugins/cua/skills/computer-use/README.md similarity index 95% rename from plugins/cua/skills/cua-driver/README.md rename to plugins/cua/skills/computer-use/README.md index dd7f9395b..4d6daa9e0 100644 --- a/plugins/cua/skills/cua-driver/README.md +++ b/plugins/cua/skills/computer-use/README.md @@ -1,4 +1,4 @@ -# CUA Computer Use Workflow +# Computer Use Workflow This skill uses DeepChat's plugin-provided Computer Use tools. diff --git a/plugins/cua/skills/cua-driver/RECORDING.md b/plugins/cua/skills/computer-use/RECORDING.md similarity index 100% rename from plugins/cua/skills/cua-driver/RECORDING.md rename to plugins/cua/skills/computer-use/RECORDING.md diff --git a/plugins/cua/skills/cua-driver/SKILL.md b/plugins/cua/skills/computer-use/SKILL.md similarity index 93% rename from plugins/cua/skills/cua-driver/SKILL.md rename to plugins/cua/skills/computer-use/SKILL.md index 6097f2b0c..0094de2a6 100644 --- a/plugins/cua/skills/cua-driver/SKILL.md +++ b/plugins/cua/skills/computer-use/SKILL.md @@ -1,5 +1,5 @@ --- -name: cua-driver +name: computer-use description: Drive native desktop apps through DeepChat's built-in Computer Use tools. Use when the user asks to operate, inspect, automate, or perform a GUI task in a real desktop application. platforms: - darwin @@ -9,7 +9,7 @@ metadata: deepchatFeature: computer-use --- -# cua-driver +# computer-use Use DeepChat's plugin-provided Computer Use tools as the only action surface for this skill. Do not ask the user to install `cua-driver`, configure an external server, or put anything on PATH for the @@ -70,12 +70,13 @@ Use this fallback order: pixels. 3. Use `get_window_state` with vision capture for broad visual confirmation when window contents or active overlays are unclear. -4. Use at most one `zoom({ pid, window_id, x1, y1, x2, y2 })` for small text or dense icons. +4. Use `get_desktop_state` only for desktop-scope workflows where there is no stable target window. +5. Use at most one `zoom({ pid, window_id, x1, y1, x2, y2 })` for small text or dense icons. Repeated zoom calls are a failure signal; return to the full-window snapshot or ask for clarification. -5. Use pixel coordinates from the latest same-window state with `click({ pid, window_id, x, y })`, +6. Use pixel coordinates from the latest same-window state with `click({ pid, window_id, x, y })`, or from the single zoom image with `click({ pid, window_id, x, y, from_zoom: true })`. -6. Re-snapshot after each action and compare the resulting state. +7. Re-snapshot after each action and compare the resulting state. Ask the user only when visible candidates are ambiguous, the requested action is destructive, or the target is outside the current visible window. diff --git a/plugins/cua/skills/cua-driver/TESTS.md b/plugins/cua/skills/computer-use/TESTS.md similarity index 87% rename from plugins/cua/skills/cua-driver/TESTS.md rename to plugins/cua/skills/computer-use/TESTS.md index 8f3e18f14..9060aa404 100644 --- a/plugins/cua/skills/cua-driver/TESTS.md +++ b/plugins/cua/skills/computer-use/TESTS.md @@ -7,6 +7,7 @@ Use these checks after enabling the CUA plugin: - `launch_app` starts a target app and returns a `pid` when the platform can provide one. - `list_windows` returns windows for that `pid`. - `get_window_state` returns a screenshot or accessibility tree for a selected `window_id`. +- `get_desktop_state` returns a full-display snapshot where desktop-scope capture is supported. - `click` or `set_value` works after a same-window snapshot. - `start_recording`, `stop_recording`, and `get_recording_state` are permission-gated. - Plugin disable removes the `cua-driver` tools after the tool surface refreshes. diff --git a/plugins/cua/skills/cua-driver/WEB_APPS.md b/plugins/cua/skills/computer-use/WEB_APPS.md similarity index 100% rename from plugins/cua/skills/cua-driver/WEB_APPS.md rename to plugins/cua/skills/computer-use/WEB_APPS.md diff --git a/plugins/cua/vendor/cua-driver/upstream.json b/plugins/cua/vendor/cua-driver/upstream.json index c1d798f3d..165b09cc9 100644 --- a/plugins/cua/vendor/cua-driver/upstream.json +++ b/plugins/cua/vendor/cua-driver/upstream.json @@ -2,29 +2,29 @@ "sourceKind": "upstream-release", "upstreamRepo": "https://github.com/trycua/cua.git", "upstreamSubdir": "libs/cua-driver/rust", - "tag": "cua-driver-rs-v0.6.7", - "commit": "2cba1e769264a18f5a9d5f4e419729eb7fc17962", - "version": "0.6.7", - "updatedAt": "2026-06-24", - "releaseUrl": "https://github.com/trycua/cua/releases/tag/cua-driver-rs-v0.6.7", + "tag": "cua-driver-rs-v0.7.1", + "commit": "7caf72bee2286f47a985c3121b56aaabdebd62b9", + "version": "0.7.1", + "updatedAt": "2026-07-07", + "releaseUrl": "https://github.com/trycua/cua/releases/tag/cua-driver-rs-v0.7.1", "checksumsAsset": "checksums.txt", "supportedTargets": ["darwin/arm64", "darwin/x64", "win32/x64", "win32/arm64", "linux/x64"], "unsupportedTargets": ["linux/arm64"], "assets": { "darwin-arm64": { - "name": "cua-driver-rs-0.6.7-darwin-arm64.tar.gz" + "name": "cua-driver-rs-0.7.1-darwin-arm64.tar.gz" }, "darwin-x64": { - "name": "cua-driver-rs-0.6.7-darwin-x86_64.tar.gz" + "name": "cua-driver-rs-0.7.1-darwin-x86_64.tar.gz" }, "windows-x64": { - "name": "cua-driver-rs-0.6.7-windows-x86_64.zip" + "name": "cua-driver-rs-0.7.1-windows-x86_64.zip" }, "windows-arm64": { - "name": "cua-driver-rs-0.6.7-windows-arm64.zip" + "name": "cua-driver-rs-0.7.1-windows-arm64.zip" }, "linux-x64": { - "name": "cua-driver-rs-0.6.7-linux-x86_64-binary.tar.gz" + "name": "cua-driver-rs-0.7.1-linux-x86_64-binary.tar.gz" } }, "releasePolicy": "Stage pinned upstream release assets at build time. Do not run upstream installers or require PATH-installed runtime binaries for the bundled DeepChat plugin." diff --git a/src/main/presenter/skillPresenter/index.ts b/src/main/presenter/skillPresenter/index.ts index 3d4a302ef..a058c0e38 100644 --- a/src/main/presenter/skillPresenter/index.ts +++ b/src/main/presenter/skillPresenter/index.ts @@ -102,6 +102,7 @@ const DEFAULT_RUNTIME_POLICY: SkillRuntimePolicy = { } const SKILL_NAME_PATTERN = /^[a-z0-9][a-z0-9._-]*$/ +const SKILL_NAME_ALIASES = new Map([['cua-driver', 'computer-use']]) const BINARY_LIKE_EXTENSIONS = new Set([ '.png', '.jpg', @@ -2736,7 +2737,7 @@ export class SkillPresenter implements ISkillPresenter { if (await this.isNewAgentSession(conversationId)) { const skills = await this.loadNewSessionSkills(conversationId) const validSkills = await this.validateSkillNames(skills) - if (validSkills.length !== skills.length) { + if (!this.areSkillListsEqual(validSkills, skills)) { this.setPersistedNewSessionSkills(conversationId, validSkills) } return validSkills @@ -2802,7 +2803,21 @@ export class SkillPresenter implements ISkillPresenter { async validateSkillNames(names: string[]): Promise { const available = await this.getMetadataList() const availableNames = new Set(available.map((s) => s.name)) - return names.filter((name) => availableNames.has(name)) + const seen = new Set() + const validNames: string[] = [] + for (const name of names) { + const resolvedName = availableNames.has(name) ? name : (SKILL_NAME_ALIASES.get(name) ?? name) + if (!availableNames.has(resolvedName) || seen.has(resolvedName)) { + continue + } + seen.add(resolvedName) + validNames.push(resolvedName) + } + return validNames + } + + private areSkillListsEqual(left: string[], right: string[]): boolean { + return left.length === right.length && left.every((skill, index) => skill === right[index]) } /** diff --git a/test/main/presenter/pluginPresenter.test.ts b/test/main/presenter/pluginPresenter.test.ts index 6a1db1a73..7710e6b00 100644 --- a/test/main/presenter/pluginPresenter.test.ts +++ b/test/main/presenter/pluginPresenter.test.ts @@ -1142,7 +1142,7 @@ describe('PluginPresenter', () => { expect(mcpConfig.env).toEqual(server.env) }) - it('keeps CUA v0.6.7 tool policies explicit and conservative', async () => { + it('keeps CUA v0.7.1 tool policies explicit and conservative', async () => { const manifest = JSON.parse(await readFile('plugins/cua/plugin.json', 'utf8')) const policy = JSON.parse(await readFile('plugins/cua/policies/tool-policy.json', 'utf8')) const manifestTools = manifest.toolPolicies.find( @@ -1155,13 +1155,13 @@ describe('PluginPresenter', () => { 'get_screen_size', 'get_window_state', 'get_accessibility_tree', + 'get_desktop_state', 'get_cursor_position', 'get_config', 'get_recording_state', 'get_agent_cursor_state', 'check_for_update', 'health_report', - 'debug_window_info', 'start_session', 'end_session' ] @@ -1173,14 +1173,9 @@ describe('PluginPresenter', () => { 'right_click', 'double_click', 'drag', - 'mouse_button_down', - 'mouse_button_up', - 'mouse_drag', - 'parallel_mouse_drag', 'scroll', 'move_cursor', 'type_text', - 'type_text_chars', 'press_key', 'hotkey', 'set_value', @@ -1207,8 +1202,20 @@ describe('PluginPresenter', () => { expect(manifestTools.screenshot).toBeUndefined() expect(manifestTools.set_recording).toBeUndefined() + expect(manifestTools.debug_window_info).toBeUndefined() + expect(manifestTools.mouse_button_down).toBeUndefined() + expect(manifestTools.mouse_button_up).toBeUndefined() + expect(manifestTools.mouse_drag).toBeUndefined() + expect(manifestTools.parallel_mouse_drag).toBeUndefined() + expect(manifestTools.type_text_chars).toBeUndefined() expect(policy.tools.screenshot).toBeUndefined() expect(policy.tools.set_recording).toBeUndefined() + expect(policy.tools.debug_window_info).toBeUndefined() + expect(policy.tools.mouse_button_down).toBeUndefined() + expect(policy.tools.mouse_button_up).toBeUndefined() + expect(policy.tools.mouse_drag).toBeUndefined() + expect(policy.tools.parallel_mouse_drag).toBeUndefined() + expect(policy.tools.type_text_chars).toBeUndefined() }) it('tracks CUA as a pinned upstream release asset set', async () => { @@ -1221,15 +1228,15 @@ describe('PluginPresenter', () => { sourceKind: 'upstream-release', upstreamRepo: 'https://github.com/trycua/cua.git', upstreamSubdir: 'libs/cua-driver/rust', - tag: 'cua-driver-rs-v0.6.7', - commit: '2cba1e769264a18f5a9d5f4e419729eb7fc17962', - version: '0.6.7', + tag: 'cua-driver-rs-v0.7.1', + commit: '7caf72bee2286f47a985c3121b56aaabdebd62b9', + version: '0.7.1', supportedTargets: ['darwin/arm64', 'darwin/x64', 'win32/x64', 'win32/arm64', 'linux/x64'], unsupportedTargets: ['linux/arm64'] }) - expect(metadata.assets['windows-x64'].name).toBe('cua-driver-rs-0.6.7-windows-x86_64.zip') - expect(metadata.assets['windows-arm64'].name).toBe('cua-driver-rs-0.6.7-windows-arm64.zip') - expect(metadata.assets['linux-x64'].name).toBe('cua-driver-rs-0.6.7-linux-x86_64-binary.tar.gz') + expect(metadata.assets['windows-x64'].name).toBe('cua-driver-rs-0.7.1-windows-x86_64.zip') + expect(metadata.assets['windows-arm64'].name).toBe('cua-driver-rs-0.7.1-windows-arm64.zip') + expect(metadata.assets['linux-x64'].name).toBe('cua-driver-rs-0.7.1-linux-x86_64-binary.tar.gz') expect(buildScript).toContain('verifyChecksum') expect(buildScript).toContain('downloadFile') expect(buildScript).toContain('isLinuxGlibcLoaderMismatch') @@ -1263,12 +1270,22 @@ describe('PluginPresenter', () => { }) it('keeps the CUA skill instructions aligned with DeepChat bundled tools', async () => { + const manifest = JSON.parse(await readFile('plugins/cua/plugin.json', 'utf8')) const files = ['SKILL.md', 'README.md', 'WEB_APPS.md', 'RECORDING.md', 'TESTS.md'] const contents = await Promise.all( - files.map((file) => readFile(`plugins/cua/skills/cua-driver/${file}`, 'utf8')) + files.map((file) => readFile(`plugins/cua/skills/computer-use/${file}`, 'utf8')) ) const combined = contents.join('\n') + expect(manifest.skills).toEqual([ + { + id: 'computer-use', + path: 'skills/computer-use/SKILL.md', + scope: 'agent' + } + ]) + expect(contents[0]).toContain('name: computer-use') + expect(contents[0]).toContain('# computer-use') expect(combined).toContain('list_apps') expect(combined).toContain('launch_app') expect(combined).toContain('get_window_state') diff --git a/test/main/presenter/skillPresenter/skillPresenter.test.ts b/test/main/presenter/skillPresenter/skillPresenter.test.ts index b2ffb3a7d..2fc0821c1 100644 --- a/test/main/presenter/skillPresenter/skillPresenter.test.ts +++ b/test/main/presenter/skillPresenter/skillPresenter.test.ts @@ -2449,6 +2449,27 @@ describe('SkillPresenter', () => { ) }) + it('migrates the old CUA active skill name to computer-use', async () => { + ;(skillSessionStatePort.hasNewSession as Mock).mockResolvedValue(true) + newSessionActiveSkillsStore.set('new-session-cua', ['cua-driver']) + mockSkillTree(['computer-use']) + ;(fs.existsSync as Mock).mockReturnValue(true) + ;(fs.readFileSync as Mock).mockReturnValue('test') + ;(matter as unknown as Mock).mockReturnValue({ + data: { name: 'computer-use', description: 'Computer Use' }, + content: '' + }) + await skillPresenter.discoverSkills() + + const active = await skillPresenter.getActiveSkills('new-session-cua') + + expect(active).toEqual(['computer-use']) + expect(skillSessionStatePort.setPersistedNewSessionSkills).toHaveBeenCalledWith( + 'new-session-cua', + ['computer-use'] + ) + }) + it('repairs imported legacy sessions when persisted skills are empty', async () => { ;(skillSessionStatePort.hasNewSession as Mock).mockResolvedValue(true) mockSkillTree(['skill-1', 'skill-2']) @@ -2570,6 +2591,26 @@ describe('SkillPresenter', () => { ['skill-1'] ) }) + + it('normalizes the old CUA skill name when setting active skills', async () => { + ;(skillSessionStatePort.hasNewSession as Mock).mockResolvedValue(true) + mockSkillTree(['computer-use']) + ;(fs.existsSync as Mock).mockReturnValue(true) + ;(fs.readFileSync as Mock).mockReturnValue('test') + ;(matter as unknown as Mock).mockReturnValue({ + data: { name: 'computer-use', description: 'Computer Use' }, + content: '' + }) + await skillPresenter.discoverSkills() + + const active = await skillPresenter.setActiveSkills('new-session-cua-set', ['cua-driver']) + + expect(active).toEqual(['computer-use']) + expect(skillSessionStatePort.setPersistedNewSessionSkills).toHaveBeenCalledWith( + 'new-session-cua-set', + ['computer-use'] + ) + }) }) describe('clearNewAgentSessionSkills', () => {